update 3.27 窑车加删除
This commit is contained in:
@@ -145,7 +145,7 @@ export default {
|
||||
dataList: [],
|
||||
tableLoading: false,
|
||||
refreshLayoutKey: null,
|
||||
updateCarPayloadKey: 1
|
||||
updateCarPayloadKey: 1,
|
||||
};
|
||||
},
|
||||
inject: ["urls"],
|
||||
@@ -230,8 +230,14 @@ export default {
|
||||
// payload: { type: string, data: string | number | object }
|
||||
switch (type) {
|
||||
case "delete": {
|
||||
// 找到删除的 prompt 字段
|
||||
const deleteConfig = data.head?.options?.find((item) => item.name === "delete");
|
||||
let promptName = data.name ?? data.id;
|
||||
if (deleteConfig && "promptField" in deleteConfig) {
|
||||
promptName = data[deleteConfig.promptField];
|
||||
}
|
||||
// 确认是否删除
|
||||
return this.$confirm(`确定要删除记录 "${data.name ?? data.id}" 吗?`, "提示", {
|
||||
return this.$confirm(`确定要删除记录 "${promptName}" 吗?`, "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "我再想想",
|
||||
type: "warning",
|
||||
@@ -241,7 +247,10 @@ export default {
|
||||
this.$http({
|
||||
url: this.urls.base,
|
||||
method: "DELETE",
|
||||
data: [`${data.id}`],
|
||||
data: data.id,
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success("删除成功!");
|
||||
|
||||
@@ -23,6 +23,7 @@ export default function () {
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: "to-car-payload", label: "装载详情", icon: 'document' },
|
||||
{ name: "delete", label: "删除", icon: 'delete', emitFull: true, promptField: 'code' }
|
||||
// { name: "edit-payload", label: "输入载砖详情", icon: 'edit' },
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user