|
@ -60,7 +60,7 @@ export default { |
|
|
fit |
|
|
fit |
|
|
style="width:calc(100% - 26px);" |
|
|
style="width:calc(100% - 26px);" |
|
|
> |
|
|
> |
|
|
<el-table-column fixed="left" type="selection" :selectable="config.table.selectable" /> |
|
|
<el-table-column v-if="!config.table.schema.disableSelection" fixed="left" type="selection" :selectable="config.table.selectable" /> |
|
|
<el-table-column type="index" :label="$t('rowIndex')"> |
|
|
<el-table-column type="index" :label="$t('rowIndex')"> |
|
|
<template #default="scope"> {{ (pageModel.pageIndex - 1) * pageModel.pageSize + scope.$index + 1 }} </template> |
|
|
<template #default="scope"> {{ (pageModel.pageIndex - 1) * pageModel.pageSize + scope.$index + 1 }} </template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
@ -186,7 +186,7 @@ export default { |
|
|
</span> |
|
|
</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-drawer> |
|
|
</el-drawer> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close :close-on-click-modal="false" style="width:auto;min-width:500px;max-width:1000px;"> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close :close-on-click-modal="false" style="width:auto;width:700px;"> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<el-row v-loading="editFormloading"> |
|
|
<el-row v-loading="editFormloading"> |
|
|
<el-col style="max-height:calc(100% - 180px );min-height:100%;"> |
|
|
<el-col style="max-height:calc(100% - 180px );min-height:100%;"> |
|
@ -399,6 +399,39 @@ export default { |
|
|
const defaultImportModel = schemaToModel(config.import.schema); |
|
|
const defaultImportModel = schemaToModel(config.import.schema); |
|
|
const importModel = ref(null); |
|
|
const importModel = ref(null); |
|
|
const versions = ref([]); |
|
|
const versions = ref([]); |
|
|
|
|
|
const onClick = async (method, confirMmessage = "确认操作吗?", reload = true) => { |
|
|
|
|
|
try { |
|
|
|
|
|
if (confirMmessage) { |
|
|
|
|
|
await ElMessageBox.confirm(confirMmessage, "提示", { |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
tableLoading.value = true; |
|
|
|
|
|
let result = null; |
|
|
|
|
|
if (method.constructor.name == "AsyncFunction") { |
|
|
|
|
|
result = await method(); |
|
|
|
|
|
} else { |
|
|
|
|
|
result = method(); |
|
|
|
|
|
} |
|
|
|
|
|
if (!result.errors) { |
|
|
|
|
|
if (!result.data?.code || result.data.code === 200) { |
|
|
|
|
|
if (reload) { |
|
|
|
|
|
pageModel.pageIndex = 1; |
|
|
|
|
|
await load(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
if (error === "cancel") { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
type: "info", |
|
|
|
|
|
message: "操作取消", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
tableLoading.value = false; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
const getSortModel = (model) => { |
|
|
const getSortModel = (model) => { |
|
|
(model.sorting ?? "") |
|
|
(model.sorting ?? "") |
|
|
.split(",") |
|
|
.split(",") |
|
@ -469,11 +502,14 @@ export default { |
|
|
tableLoading.value = false; |
|
|
tableLoading.value = false; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
const onPageIndexChange = async () => await load(); |
|
|
const reload = async () => { |
|
|
const onPageSizeChange = async () => { |
|
|
|
|
|
pageModel.pageIndex = 1; |
|
|
pageModel.pageIndex = 1; |
|
|
await load(); |
|
|
await load(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
const onPageIndexChange = async () => await load(); |
|
|
|
|
|
const onPageSizeChange = async () => { |
|
|
|
|
|
await reload(); |
|
|
|
|
|
}; |
|
|
const click = async (item, rows) => { |
|
|
const click = async (item, rows) => { |
|
|
editFormloading.value = true; |
|
|
editFormloading.value = true; |
|
|
editFormMode.value = item.path ?? item; |
|
|
editFormMode.value = item.path ?? item; |
|
@ -504,11 +540,16 @@ export default { |
|
|
type: "warning", |
|
|
type: "warning", |
|
|
}); |
|
|
}); |
|
|
tableLoading.value = true; |
|
|
tableLoading.value = true; |
|
|
const response = await request( |
|
|
const result = await request( |
|
|
url, |
|
|
url, |
|
|
rows.map((o) => o.id), |
|
|
rows.map((o) => o.id), |
|
|
{ method: config.edit.deleteMethod } |
|
|
{ method: config.edit.deleteMethod }, |
|
|
|
|
|
true |
|
|
); |
|
|
); |
|
|
|
|
|
if (!result.data?.code || result.data.code === 200) { |
|
|
|
|
|
pageModel.pageIndex = 1; |
|
|
|
|
|
await reload(); |
|
|
|
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
if (error === "cancel") { |
|
|
if (error === "cancel") { |
|
|
ElMessage({ |
|
|
ElMessage({ |
|
@ -525,7 +566,8 @@ export default { |
|
|
await ElMessageBox.confirm(format("确认删除当前行数据吗?", rows[0]), "提示", { |
|
|
await ElMessageBox.confirm(format("确认删除当前行数据吗?", rows[0]), "提示", { |
|
|
type: "warning", |
|
|
type: "warning", |
|
|
}); |
|
|
}); |
|
|
await request(url, null, { method: config.edit.deleteMethod }); |
|
|
await request(url, null, { method: config.edit.deleteMethod }, true); |
|
|
|
|
|
await reload(); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
if (error === "cancel") { |
|
|
if (error === "cancel") { |
|
|
ElMessage({ |
|
|
ElMessage({ |
|
@ -541,10 +583,12 @@ export default { |
|
|
const url = config.edit.exportUrl; |
|
|
const url = config.edit.exportUrl; |
|
|
const method = config.edit.exportMethod; |
|
|
const method = config.edit.exportMethod; |
|
|
const postData = buildQuery(); |
|
|
const postData = buildQuery(); |
|
|
const response = await request(url, postData, { method }); |
|
|
await onClick(async () => { |
|
|
if (!response.errors) { |
|
|
const response = await request(url, postData, { method }); |
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
|
|
if (!response.errors) { |
|
|
} |
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
|
|
|
|
|
} |
|
|
|
|
|
}, "确认导出?"); |
|
|
} else if (item.meta.pattern === "file") { |
|
|
} else if (item.meta.pattern === "file") { |
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${rows[0]["downFileName"]}`)); |
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${rows[0]["downFileName"]}`)); |
|
|
} else if ((item.meta.pattern = "row")) { |
|
|
} else if ((item.meta.pattern = "row")) { |
|
@ -585,21 +629,23 @@ export default { |
|
|
try { |
|
|
try { |
|
|
const valid = await editFormRef.value.validate(); |
|
|
const valid = await editFormRef.value.validate(); |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
editFormloading.value = true; |
|
|
await onClick( |
|
|
let url = (editFormMode.value === "create" ? config.edit.createUrl : config.edit.updateUrl) ?? config.query.url; |
|
|
async () => { |
|
|
if (editFormMode.value === "update") { |
|
|
let url = (editFormMode.value === "create" ? config.edit.createUrl : config.edit.updateUrl) ?? config.query.url; |
|
|
url = format(url, editFormModel.value.id); |
|
|
if (editFormMode.value === "update") { |
|
|
} |
|
|
url = format(url, editFormModel.value.id); |
|
|
const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod; |
|
|
} |
|
|
const response = await request(url, editFormModel.value, { method }); |
|
|
const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod; |
|
|
if (response.errors) { |
|
|
const result = await request(url, editFormModel.value, { method }, true); |
|
|
ElMessageBox.alert(`错误:${response.errors?.error?.message}`, `代码:${response.errors?.error?.code}`); |
|
|
if (!result.errors) { |
|
|
//model.errors = response.errors; //??
|
|
|
dialogVisible.value = false; |
|
|
} else { |
|
|
editFormMode.value = null; |
|
|
await load(); |
|
|
await reload(); |
|
|
editFormMode.value = null; |
|
|
} |
|
|
dialogVisible.value = false; |
|
|
}, |
|
|
} |
|
|
null, |
|
|
|
|
|
true |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.log(error); |
|
|
console.log(error); |
|
@ -783,37 +829,6 @@ export default { |
|
|
} |
|
|
} |
|
|
return postData; |
|
|
return postData; |
|
|
} |
|
|
} |
|
|
const action = async (method, confirMmessage = "确认操作吗?", successMessage = "操作成功", reload = true) => { |
|
|
|
|
|
try { |
|
|
|
|
|
await ElMessageBox.confirm(confirMmessage, "提示", { |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
}); |
|
|
|
|
|
tableLoading.value = true; |
|
|
|
|
|
let result = null; |
|
|
|
|
|
if (method.constructor.name == "AsyncFunction") { |
|
|
|
|
|
result = await method(); |
|
|
|
|
|
} else { |
|
|
|
|
|
result = method(); |
|
|
|
|
|
} |
|
|
|
|
|
if (!result.errors) { |
|
|
|
|
|
if (!result.data?.code || result.data.code === 200) { |
|
|
|
|
|
if (reload) { |
|
|
|
|
|
pageModel.pageIndex = 1; |
|
|
|
|
|
await load(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
if (error === "cancel") { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
type: "info", |
|
|
|
|
|
message: "操作取消", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
tableLoading.value = false; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
if (route.meta.children?.length) { |
|
|
if (route.meta.children?.length) { |
|
|
for (const item of route.meta.children) { |
|
|
for (const item of route.meta.children) { |
|
@ -836,7 +851,8 @@ export default { |
|
|
return { |
|
|
return { |
|
|
listScrollbarRef, |
|
|
listScrollbarRef, |
|
|
load, |
|
|
load, |
|
|
action, |
|
|
reload, |
|
|
|
|
|
onClick, |
|
|
config, |
|
|
config, |
|
|
queryModel, |
|
|
queryModel, |
|
|
buildQuery, |
|
|
buildQuery, |
|
|