feat: 分组编辑商品数据去重

This commit is contained in:
duan
2025-03-25 00:20:17 +08:00
parent ec7292cf4c
commit ccab0a33ee
3 changed files with 104 additions and 227 deletions

View File

@@ -107,6 +107,14 @@
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
</template>
</page-content>
<!-- <el-table :data="selectData" border style="width: 100%">
<el-table-column prop="date" align="center" label="Date" />
<el-table-column prop="address" align="center" label="Address" />
</el-table> -->
</myDialog>
<!-- 新增 -->
<myDialog :title="title" width="30%" ref="myDialogRefAdd" @Confirm="addConfirm()">
@@ -212,8 +220,10 @@ let forms = reactive({
// 添加商品
function addgoods() {
// console.log(selectData.value, '编辑时候有的数据')
switchref.value = true
myDialogRef.value.open()
}
const rules = reactive<FormRules<RuleForm>>({
name: [
@@ -273,7 +283,12 @@ function subitgood() {
if (title.value == "编辑分组") {
let arr = selectData.value
arr.push(...contentRefs.value.getselectTable())
contentRefs.value.getselectTable().forEach((item: any) => {
let selectdata = selectData.value.find(ele => ele.id == item.id)
if (!selectdata) {
arr.push(item)
}
})
selectData.value = arr
} else {
selectData.value = contentRefs.value.getselectTable()

View File

@@ -13,14 +13,17 @@ const contentConfig: IContentConfig = {
pageSize: 10,
pageSizes: [10, 20, 30, 50],
},
indexAction: function (params) {
return UserAPI.getPage(params);
indexAction: async function (params) {
let res = await UserAPI.getPage(params);
console.log("indexAction:", res);
return res;
// return UserAPI.getPage(params);
},
modifyAction(data) {
// 模拟发起网络请求修改字段
// console.log("modifyAction:", data);
ElMessage.success(JSON.stringify(data));
return Promise.resolve(null);
// ElMessage.success(JSON.stringify(data));
// return Promise.resolve(null);
},
cols: [