|
@ -194,7 +194,7 @@ export default { |
|
|
v-model="dialogVisible" |
|
|
v-model="dialogVisible" |
|
|
align-center |
|
|
align-center |
|
|
destroy-on-close |
|
|
destroy-on-close |
|
|
style="width:auto;min-width:300px;max-width:700px;" |
|
|
style="width:auto;min-width:500px;max-width:1000px;" |
|
|
> |
|
|
> |
|
|
<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"> |
|
@ -214,7 +214,7 @@ export default { |
|
|
/> |
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="editFormMode==='export'"> |
|
|
<template v-else-if="editFormMode==='export'"> |
|
|
<el-form :model="exportModel" style="height:100%;"> |
|
|
<el-form :model="exportModel"> |
|
|
<el-form-item :label="$t('全部')"> |
|
|
<el-form-item :label="$t('全部')"> |
|
|
<el-switch v-model="exportModel.includeAll" /> |
|
|
<el-switch v-model="exportModel.includeAll" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -224,9 +224,9 @@ export default { |
|
|
</el-form> |
|
|
</el-form> |
|
|
</template> |
|
|
</template> |
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
<el-form :model="importModel" style="height:100%;"> |
|
|
<el-form :model="importModel" inline> |
|
|
<el-form-item :label="$t('部分成功')"> |
|
|
<el-form-item :label="$t('部分成功')"> |
|
|
<el-switch v-model="importModel.partal" /> |
|
|
<el-switch v-model="importModel.partial" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item :label="$t('全部替换')"> |
|
|
<el-form-item :label="$t('全部替换')"> |
|
|
<el-switch v-model="importModel.replace" /> |
|
|
<el-switch v-model="importModel.replace" /> |
|
@ -235,9 +235,17 @@ export default { |
|
|
<el-link type="primary" @click="getImportTemplate">{{$t('下载')}}</el-link> |
|
|
<el-link type="primary" @click="getImportTemplate">{{$t('下载')}}</el-link> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item :label="$t('文件')"> |
|
|
<el-form-item :label="$t('文件')"> |
|
|
<el-upload drag v-model="importModel.file" :auto-upload="false"> |
|
|
<el-upload |
|
|
|
|
|
ref="uploadRef" |
|
|
|
|
|
drag |
|
|
|
|
|
accept=".xlsx" |
|
|
|
|
|
:disabled="fileList.length===1" |
|
|
|
|
|
:limit="1" |
|
|
|
|
|
:auto-upload="false" |
|
|
|
|
|
:on-change="handleChange" |
|
|
|
|
|
> |
|
|
<el-icon class="el-icon--upload"><ep-upload-filled /></el-icon> |
|
|
<el-icon class="el-icon--upload"><ep-upload-filled /></el-icon> |
|
|
<div class="el-upload__text">{{$t('拖放文件到此处或')}} <em>{{$t('点击上传')}}</em></div> |
|
|
<div class="el-upload__text">{{$t('拖放文件或')}} <em>{{$t('点击上传')}}</em></div> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
@ -320,6 +328,7 @@ export default { |
|
|
children: "children", |
|
|
children: "children", |
|
|
}); |
|
|
}); |
|
|
const tableRef = ref(null); |
|
|
const tableRef = ref(null); |
|
|
|
|
|
const uploadRef = ref(null); |
|
|
const columns = ref([]); |
|
|
const columns = ref([]); |
|
|
const filterDrawer = ref(false); |
|
|
const filterDrawer = ref(false); |
|
|
const subDrawer = ref(false); |
|
|
const subDrawer = ref(false); |
|
@ -353,9 +362,8 @@ export default { |
|
|
const importModel = reactive({ |
|
|
const importModel = reactive({ |
|
|
partial: true, |
|
|
partial: true, |
|
|
replace: false, |
|
|
replace: false, |
|
|
template: null, |
|
|
|
|
|
file: null, |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
const fileList = ref([]); |
|
|
const getSortModel = (model) => { |
|
|
const getSortModel = (model) => { |
|
|
model.orderBy |
|
|
model.orderBy |
|
|
.split(",") |
|
|
.split(",") |
|
@ -466,6 +474,7 @@ export default { |
|
|
//import
|
|
|
//import
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
editFormTitle.value = `${t(item.path)}${schema.value?.title}`; |
|
|
editFormTitle.value = `${t(item.path)}${schema.value?.title}`; |
|
|
|
|
|
fileList.value = []; |
|
|
dialogVisible.value = true; |
|
|
dialogVisible.value = true; |
|
|
} else if (item === "filter") { |
|
|
} else if (item === "filter") { |
|
|
editFormTitle.value = t("自定义查询"); |
|
|
editFormTitle.value = t("自定义查询"); |
|
@ -504,14 +513,20 @@ export default { |
|
|
delete postData.query["id"]; |
|
|
delete postData.query["id"]; |
|
|
const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`; |
|
|
const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`; |
|
|
const response = await post(url, postData); |
|
|
const response = await post(url, postData); |
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
download(response); |
|
|
const filename = response.filename; |
|
|
|
|
|
let link = document.createElement("a"); |
|
|
|
|
|
link.href = downloadUrl; |
|
|
|
|
|
link.download = filename; |
|
|
|
|
|
link.click(); |
|
|
|
|
|
window.URL.revokeObjectURL(downloadUrl); |
|
|
|
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
|
|
|
|
} else if (editFormMode.value === "import") { |
|
|
|
|
|
editFormloading.value = true; |
|
|
|
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
|
|
const formData = new FormData(); |
|
|
|
|
|
formData.append("partial", importModel.partial); |
|
|
|
|
|
formData.append("replace", importModel.replace); |
|
|
|
|
|
formData.append("file", fileList.value[0]?.raw); |
|
|
|
|
|
console.log(uploadRef.value); |
|
|
|
|
|
const response = await post(url, formData); |
|
|
|
|
|
editFormloading.value = false; |
|
|
|
|
|
dialogVisible.value = false; |
|
|
|
|
|
await load(indexUrl); |
|
|
} else if (editFormMode.value === "filter") { |
|
|
} else if (editFormMode.value === "filter") { |
|
|
await load(indexUrl); |
|
|
await load(indexUrl); |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
@ -547,9 +562,7 @@ export default { |
|
|
logic: "and", |
|
|
logic: "and", |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const getImportTemplate = async () => { |
|
|
const download = (response) => { |
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
|
|
const response = await get(url); |
|
|
|
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
const filename = response.filename; |
|
|
const filename = response.filename; |
|
|
let link = document.createElement("a"); |
|
|
let link = document.createElement("a"); |
|
@ -558,6 +571,14 @@ export default { |
|
|
link.click(); |
|
|
link.click(); |
|
|
window.URL.revokeObjectURL(downloadUrl); |
|
|
window.URL.revokeObjectURL(downloadUrl); |
|
|
}; |
|
|
}; |
|
|
|
|
|
const getImportTemplate = async () => { |
|
|
|
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
|
|
const response = await get(url); |
|
|
|
|
|
download(response); |
|
|
|
|
|
}; |
|
|
|
|
|
const handleChange = (uploadFile, uploadFiles) => { |
|
|
|
|
|
fileList.value = uploadFiles; |
|
|
|
|
|
}; |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
pushQueryList(); |
|
|
pushQueryList(); |
|
|
const vm = (await get(indexUrl)).data; |
|
|
const vm = (await get(indexUrl)).data; |
|
@ -575,6 +596,7 @@ export default { |
|
|
return { |
|
|
return { |
|
|
treeProps, |
|
|
treeProps, |
|
|
tableRef, |
|
|
tableRef, |
|
|
|
|
|
uploadRef, |
|
|
tableLoading, |
|
|
tableLoading, |
|
|
columns, |
|
|
columns, |
|
|
showColumn, |
|
|
showColumn, |
|
@ -609,6 +631,8 @@ export default { |
|
|
showList, |
|
|
showList, |
|
|
subListQuery, |
|
|
subListQuery, |
|
|
pushQueryList, |
|
|
pushQueryList, |
|
|
|
|
|
fileList, |
|
|
|
|
|
handleChange, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|