|
@ -263,25 +263,15 @@ export default { |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
<app-form |
|
|
<app-form |
|
|
mode="import" |
|
|
ref="importFormRef" |
|
|
|
|
|
mode="update" |
|
|
label-position="left" |
|
|
label-position="left" |
|
|
:schema="config.import?.schema" |
|
|
:schema="config.import?.schema" |
|
|
v-model="importModel" |
|
|
v-model="importModel" |
|
|
:hideButton="true" |
|
|
:hideButton="true" |
|
|
:isQueryForm="true" |
|
|
:isQueryForm="true" |
|
|
|
|
|
style="height:100%;" |
|
|
> |
|
|
> |
|
|
<el-form-item :label="$t('文件')" label-width="80px"> |
|
|
|
|
|
<el-upload |
|
|
|
|
|
ref="uploadRef" |
|
|
|
|
|
class="upload" |
|
|
|
|
|
drag |
|
|
|
|
|
accept=".xlsx" |
|
|
|
|
|
:auto-upload="false" |
|
|
|
|
|
:on-change="handleChange" |
|
|
|
|
|
> |
|
|
|
|
|
<el-icon class="el-icon--upload"><ep-upload-filled /></el-icon> |
|
|
|
|
|
</el-upload> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</app-form> |
|
|
</app-form> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="editFormMode==='filter'"> |
|
|
<template v-else-if="editFormMode==='filter'"> |
|
@ -408,6 +398,7 @@ export default { |
|
|
const tableSchema = ref({}); |
|
|
const tableSchema = ref({}); |
|
|
const tableData = ref([]); |
|
|
const tableData = ref([]); |
|
|
const editFormRef = ref(null); |
|
|
const editFormRef = ref(null); |
|
|
|
|
|
const importFormRef = ref(null); |
|
|
const editFormloading = ref(false); |
|
|
const editFormloading = ref(false); |
|
|
const editFormMode = ref(null); |
|
|
const editFormMode = ref(null); |
|
|
const editFormTitle = ref(""); |
|
|
const editFormTitle = ref(""); |
|
@ -424,11 +415,26 @@ export default { |
|
|
businessType: route.meta.businessType, |
|
|
businessType: route.meta.businessType, |
|
|
}; |
|
|
}; |
|
|
const exportModel = ref(defaultExportModel); |
|
|
const exportModel = ref(defaultExportModel); |
|
|
const defaultImportModel = config.import?.schema ? schemaToModel(config.import.schema) : {}; |
|
|
//
|
|
|
const importModel = ref(defaultImportModel); |
|
|
config.import ??= { schema: { type: "object", properties: {} } }; |
|
|
const factories = ref([]); |
|
|
config.import.schema.properties.files ??= { |
|
|
|
|
|
title: "文件", |
|
|
|
|
|
type: "array", |
|
|
|
|
|
multiple: true, |
|
|
|
|
|
input: "file", |
|
|
|
|
|
accept: ".xlsx", |
|
|
|
|
|
default: [], |
|
|
|
|
|
limit: 3, |
|
|
|
|
|
rules: [ |
|
|
|
|
|
{ |
|
|
|
|
|
required: true, |
|
|
|
|
|
trigger: "change", |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}; |
|
|
|
|
|
const defaultImportModel = schemaToModel(config.import.schema); |
|
|
|
|
|
const importModel = ref(null); |
|
|
const versions = ref([]); |
|
|
const versions = ref([]); |
|
|
const fileList = ref([]); |
|
|
|
|
|
const getSortModel = (model) => { |
|
|
const getSortModel = (model) => { |
|
|
(model.sorting ?? "") |
|
|
(model.sorting ?? "") |
|
|
.split(",") |
|
|
.split(",") |
|
@ -575,10 +581,6 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// await post(
|
|
|
|
|
|
// url,
|
|
|
|
|
|
// rows.map((o) => o.id)
|
|
|
|
|
|
// );
|
|
|
|
|
|
await load(); |
|
|
await load(); |
|
|
} else if (item.path === "export") { |
|
|
} else if (item.path === "export") { |
|
|
//export
|
|
|
//export
|
|
@ -609,20 +611,7 @@ export default { |
|
|
importModel.value = Object.assign({}, defaultImportModel); |
|
|
importModel.value = Object.assign({}, defaultImportModel); |
|
|
editFormloading.value = true; |
|
|
editFormloading.value = true; |
|
|
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`; |
|
|
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`; |
|
|
fileList.value = []; |
|
|
|
|
|
dialogVisible.value = true; |
|
|
dialogVisible.value = true; |
|
|
// versions.value = (
|
|
|
|
|
|
// await request("settleaccount/centralized-control/get-all", null, { method: "POST" })
|
|
|
|
|
|
// ).data.items.map((o) => ({
|
|
|
|
|
|
// value: o.version,
|
|
|
|
|
|
// label: o.version,
|
|
|
|
|
|
// }));
|
|
|
|
|
|
// factories.value = (
|
|
|
|
|
|
// await request("settleaccount/code-setting/get-all", null, { method: "POST" })
|
|
|
|
|
|
// ).data.items.map((o) => ({
|
|
|
|
|
|
// value: o.project,
|
|
|
|
|
|
// label: o.project,
|
|
|
|
|
|
// }));
|
|
|
|
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
console.log(e); |
|
|
console.log(e); |
|
|
} finally { |
|
|
} finally { |
|
@ -667,38 +656,47 @@ export default { |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
|
editFormMode.value = null; |
|
|
editFormMode.value = null; |
|
|
} else if (editFormMode.value === "compare") { |
|
|
} else if (editFormMode.value === "compare") { |
|
|
// const postData = JSON.parse(JSON.stringify(queryModel.value));
|
|
|
|
|
|
// postData.filters = filterList.value.filter((o) => o.property && o.value);
|
|
|
|
|
|
// delete postData.query["items"];
|
|
|
|
|
|
// delete postData.query["id"];
|
|
|
|
|
|
// const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`;
|
|
|
|
|
|
// const response = await post(url, postData);
|
|
|
|
|
|
// download(response);
|
|
|
|
|
|
const url = config.edit.compareUrl; |
|
|
const url = config.edit.compareUrl; |
|
|
await request(url, exportModel.value, { method: config.edit.compareMethod }); |
|
|
await request(url, exportModel.value, { method: config.edit.compareMethod }); |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
|
} else if (editFormMode.value === "import") { |
|
|
} else if (editFormMode.value === "import") { |
|
|
editFormloading.value = true; |
|
|
try { |
|
|
const url = config.edit.importUrl; |
|
|
const valid = await importFormRef.value.validate(); |
|
|
const formData = new FormData(); |
|
|
if (valid) { |
|
|
// formData.append("version", importModel.value.version);
|
|
|
editFormloading.value = true; |
|
|
// // formData.append("factory", importModel.value.factory);
|
|
|
const url = config.edit.importUrl; |
|
|
// Object.keys(importModel.value).forEach((q) => {if(importModel.value)
|
|
|
const formData = new FormData(); |
|
|
Object.keys(importModel.value).forEach((q) => { |
|
|
//
|
|
|
if (importModel.value[q]) { |
|
|
if (config.query.schema.properties.businessType?.default) { |
|
|
formData.append(q, importModel.value[q]); |
|
|
formData.append("businessType", config.query.schema.properties.businessType.default); |
|
|
|
|
|
} |
|
|
|
|
|
Object.keys(importModel.value).forEach((propertyName) => { |
|
|
|
|
|
if (importModel.value[propertyName]) { |
|
|
|
|
|
const schema = config.import.schema.properties[propertyName]; |
|
|
|
|
|
const value = importModel.value[propertyName]; |
|
|
|
|
|
if (schema?.type === "array") { |
|
|
|
|
|
importModel.value[propertyName].forEach((item) => { |
|
|
|
|
|
formData.append(propertyName, schema.input === "file" ? item.raw : item); |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
formData.append(propertyName, schema.input === "file" ? value.raw : value); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
const result = await request(url, formData); |
|
|
|
|
|
if (result.data?.code === 200) { |
|
|
|
|
|
editFormloading.value = false; |
|
|
|
|
|
dialogVisible.value = false; |
|
|
|
|
|
await load(); |
|
|
|
|
|
} else if (result.data?.code === 400 && result.data.fileName) { |
|
|
|
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
} catch (error) { |
|
|
if (config.query.schema.properties.businessType?.default) { |
|
|
console.log(error); |
|
|
formData.append("businessType", config.query.schema.properties.businessType.default); |
|
|
} finally { |
|
|
} |
|
|
editFormloading.value = false; |
|
|
for (let i = 0; i < fileList.value.length; i++) { |
|
|
|
|
|
formData.append(`files`, fileList.value[i].raw); |
|
|
|
|
|
} |
|
|
} |
|
|
await post(url, formData); |
|
|
|
|
|
editFormloading.value = false; |
|
|
|
|
|
dialogVisible.value = false; |
|
|
|
|
|
await load(); |
|
|
|
|
|
} else if (editFormMode.value === "filter") { |
|
|
} else if (editFormMode.value === "filter") { |
|
|
await load(); |
|
|
await load(); |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
@ -728,9 +726,6 @@ export default { |
|
|
const response = await get(url); |
|
|
const response = await get(url); |
|
|
download(url, response.filename); |
|
|
download(url, response.filename); |
|
|
}; |
|
|
}; |
|
|
const handleChange = (uploadFile, uploadFiles) => { |
|
|
|
|
|
fileList.value = uploadFiles; |
|
|
|
|
|
}; |
|
|
|
|
|
const getButtonDisabled = async (src, row) => { |
|
|
const getButtonDisabled = async (src, row) => { |
|
|
if (src) { |
|
|
if (src) { |
|
|
const method = await importFunction(src); |
|
|
const method = await importFunction(src); |
|
@ -887,6 +882,7 @@ export default { |
|
|
sortChange, |
|
|
sortChange, |
|
|
getProp, |
|
|
getProp, |
|
|
getImportTemplate, |
|
|
getImportTemplate, |
|
|
|
|
|
importFormRef, |
|
|
editFormRef, |
|
|
editFormRef, |
|
|
editFormloading, |
|
|
editFormloading, |
|
|
editFormMode, |
|
|
editFormMode, |
|
@ -903,10 +899,7 @@ export default { |
|
|
submit, |
|
|
submit, |
|
|
showList, |
|
|
showList, |
|
|
subListQuery, |
|
|
subListQuery, |
|
|
fileList, |
|
|
|
|
|
handleChange, |
|
|
|
|
|
getButtonDisabled, |
|
|
getButtonDisabled, |
|
|
factories, |
|
|
|
|
|
versions, |
|
|
versions, |
|
|
pushfilterList, |
|
|
pushfilterList, |
|
|
getOperators, |
|
|
getOperators, |
|
|