优化绑定商品

This commit is contained in:
duan
2024-07-05 10:15:39 +08:00
parent d6a8aca57f
commit 456b262cbe
2 changed files with 33 additions and 16 deletions

View File

@@ -16,7 +16,7 @@
</el-form-item>
</el-form>
<div class="head-container">
<el-table ref="table" :data="tableData.list" v-loading="tableData.loading">
<el-table ref="table" :data="tableData.list" @select="firstSelectChange" v-loading="tableData.loading">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="商品信息">
<template v-slot="scope">
@@ -36,11 +36,11 @@
</template>
</el-table-column> <el-table-column label="是否售罄">
<template v-slot="scope">
{{ scope.row.isPauseSale == 1?'':'' }}
{{ scope.row.isPauseSale == 1 ? '' : '' }}
</template>
</el-table-column> <el-table-column label="是否分销">
<template v-slot="scope">
{{ scope.row.isDistribute == 1?'':'' }}
{{ scope.row.isDistribute == 1 ? '' : '' }}
</template>
</el-table-column>
<el-table-column label="售价">
@@ -85,16 +85,30 @@ export default {
loading: false,
list: []
},
goods: []
goods: [],
// 是否单选
isselect: false
}
},
methods: {
firstSelectChange() {
// console.log(selection)
let selection = this.$refs.table.selection
if (selection.length > 1 && this.isselect) {
const del_row = selection.shift();
this.$refs.table.toggleRowSelection(del_row, false);
}
},
// 确定选商品
confirmHandle() {
let res = this.$refs.table.selection
this.$emit('success', res)
this.close()
},
// 是否单选
isselectEvent() {
this.isselect = true
},
// 重置查询
resetHandle() {
this.searhForm.name = ''