|
|
@ -3,11 +3,12 @@ import request, { get, post } from "../../request/index.js"; |
|
|
|
import { defineAsyncComponent, ref, reactive, onMounted } from "vue"; |
|
|
|
import { useRoute, useRouter } from "vue-router"; |
|
|
|
import { useI18n } from "vue-i18n"; |
|
|
|
import { listToTree, schemaToModel, importFunction } from "../../utils/index.js"; |
|
|
|
import { listToTree, schemaToModel, importFunction, format } from "../../utils/index.js"; |
|
|
|
import qs from "../../lib/qs/shim.js"; |
|
|
|
import VueOfficeExcel from "@vue-office/excel"; |
|
|
|
import { camelCase, capitalize } from "lodash"; |
|
|
|
import { useAppStore } from "../../store/index.js"; |
|
|
|
import { ElMessage, ElMessageBox } from "element-plus"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "AppList", |
|
|
@ -477,8 +478,8 @@ export default { |
|
|
|
if (item.path === "create") { |
|
|
|
editFormModel.value = schemaToModel(config.edit.schema); |
|
|
|
} else { |
|
|
|
const url = `${config.edit.updateUrl ?? config.query.url}/${rows[0].id}`; |
|
|
|
editFormModel.value = (await request(url, null, { method: "GET" })).data; |
|
|
|
const url = format(config.edit.detailsUrl, rows[0].id); |
|
|
|
editFormModel.value = (await request(url, null, { method: config.edit.detailsMethod })).data; |
|
|
|
editFormModel.value.id = rows[0].id; |
|
|
|
} |
|
|
|
editFormTitle.value = `${t(item.path)}${config.edit.schema.title}`; |
|
|
@ -490,6 +491,25 @@ export default { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
// 单个删除
|
|
|
|
const url = format(config.edit.deleteUrl, rows[0].id); |
|
|
|
try { |
|
|
|
await ElMessageBox.confirm("删除", "提示", { |
|
|
|
type: "warning", |
|
|
|
message: format("确认删除当前行数据吗?", rows[0]), |
|
|
|
}); |
|
|
|
await request(url, null, { method: config.edit.deleteMethod }); |
|
|
|
ElMessage({ |
|
|
|
type: "info", |
|
|
|
message: "操作完毕", |
|
|
|
}); |
|
|
|
} catch (error) { |
|
|
|
if (error === "cancel") { |
|
|
|
ElMessage({ |
|
|
|
type: "info", |
|
|
|
message: "删除取消", |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
|
// await post(
|
|
|
@ -522,7 +542,7 @@ export default { |
|
|
|
let url = |
|
|
|
(editFormMode.value === "create" ? config.edit.createUrl : config.edit.updateUrl) ?? config.query.url; |
|
|
|
if (editFormMode.value === "update") { |
|
|
|
url = `${url}/${editFormModel.value.id}`; |
|
|
|
url = format(url, editFormModel.value.id); |
|
|
|
} |
|
|
|
const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod; |
|
|
|
const result = await request(url, editFormModel.value, { method }); |
|
|
|