|
@@ -186,6 +186,7 @@ import {
|
|
unionListTableData,
|
|
unionListTableData,
|
|
getInfoBySqlKey,
|
|
getInfoBySqlKey,
|
|
addTableData,
|
|
addTableData,
|
|
|
|
+ batchEdit,
|
|
} from "@/api/tablelist/commonTable";
|
|
} from "@/api/tablelist/commonTable";
|
|
import { getToken } from "@/utils/auth";
|
|
import { getToken } from "@/utils/auth";
|
|
import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
@@ -359,7 +360,9 @@ export default {
|
|
},
|
|
},
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
handleSelectionChange(selection) {
|
|
- this.ids = selection.map((item) => item.id);
|
|
|
|
|
|
+ this.ids = selection.map(
|
|
|
|
+ (item) => item[this.templateInfo.template?.primaryKey]
|
|
|
|
+ );
|
|
this.single = selection.length != 1;
|
|
this.single = selection.length != 1;
|
|
this.multiple = !selection.length;
|
|
this.multiple = !selection.length;
|
|
},
|
|
},
|
|
@@ -448,10 +451,10 @@ export default {
|
|
* */
|
|
* */
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
let delIds = this.ids;
|
|
let delIds = this.ids;
|
|
-
|
|
|
|
- if (row.id != undefined && row.id != null) {
|
|
|
|
|
|
+ let primary = this.templateInfo.template?.primaryKey;
|
|
|
|
+ if (row[primary] != undefined && row[primary] != null) {
|
|
delIds = [];
|
|
delIds = [];
|
|
- delIds.push(row.id);
|
|
|
|
|
|
+ delIds.push(row[primary]);
|
|
// if (delIds.findIndex(item => item === row.id) == -1) {
|
|
// if (delIds.findIndex(item => item === row.id) == -1) {
|
|
// delIds.push(row.id);
|
|
// delIds.push(row.id);
|
|
// }
|
|
// }
|
|
@@ -461,9 +464,10 @@ export default {
|
|
tableName: this.tableName,
|
|
tableName: this.tableName,
|
|
},
|
|
},
|
|
conditionMap: {
|
|
conditionMap: {
|
|
- id: delIds,
|
|
|
|
|
|
+ // id: delIds,
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
+ data.conditionMap[primary] = delIds;
|
|
this.$modal
|
|
this.$modal
|
|
.confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
.confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
.then(function () {
|
|
.then(function () {
|
|
@@ -560,6 +564,22 @@ export default {
|
|
addListMap: [values],
|
|
addListMap: [values],
|
|
};
|
|
};
|
|
if (Object.keys(this.defaultValue).length) {
|
|
if (Object.keys(this.defaultValue).length) {
|
|
|
|
+ let updateData = {
|
|
|
|
+ // 基本参数
|
|
|
|
+ basicMap: {
|
|
|
|
+ // 表名
|
|
|
|
+ tableName: this.tableName,
|
|
|
|
+ },
|
|
|
|
+ conditionMap: {},
|
|
|
|
+ commMap: {},
|
|
|
|
+ };
|
|
|
|
+ updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
|
+ values[this.templateInfo.template?.primaryKey];
|
|
|
|
+ Object.keys(values).map((k) => {
|
|
|
|
+ updateData.commMap[k] = values[k];
|
|
|
|
+ });
|
|
|
|
+ console.log(values);
|
|
|
|
+ let res = await batchEdit(updateData);
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.getList();
|
|
this.getList();
|
|
} else {
|
|
} else {
|
|
@@ -567,7 +587,6 @@ export default {
|
|
this.$modal.msgSuccess("添加成功");
|
|
this.$modal.msgSuccess("添加成功");
|
|
this.getList();
|
|
this.getList();
|
|
}
|
|
}
|
|
- console.log("123");
|
|
|
|
this.defaultValue = {};
|
|
this.defaultValue = {};
|
|
this.open = false;
|
|
this.open = false;
|
|
})
|
|
})
|