|
|
@ -190,7 +190,12 @@ export default { |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
</el-drawer> |
|
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close> |
|
|
|
<el-dialog |
|
|
|
v-model="dialogVisible" |
|
|
|
align-center |
|
|
|
destroy-on-close |
|
|
|
style="width:auto;min-width:300px;max-width:700px;" |
|
|
|
> |
|
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
|
<el-row v-loading="editFormloading"> |
|
|
|
<el-col style="max-height:calc(100vh - 180px );min-height:100%;"> |
|
|
@ -219,18 +224,27 @@ export default { |
|
|
|
</el-form> |
|
|
|
</template> |
|
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
|
<el-form :model="exportModel" style="height:100%;"> |
|
|
|
<el-form :model="importModel" style="height:100%;"> |
|
|
|
<el-form-item :label="$t('部分成功')"> |
|
|
|
<el-switch v-model="exportModel.includeAll" /> |
|
|
|
<el-switch v-model="importModel.partal" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('只更新')"> |
|
|
|
<el-switch v-model="exportModel.includeDeleted" /> |
|
|
|
<el-form-item :label="$t('全部替换')"> |
|
|
|
<el-switch v-model="importModel.replace" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('导入模板')"> |
|
|
|
<el-link type="primary" @click="getImportTemplate">{{$t('下载')}}</el-link> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('文件')"> |
|
|
|
<el-upload drag v-model="importModel.file"> |
|
|
|
<el-icon class="el-icon--upload"><ep-upload-filled /></el-icon> |
|
|
|
<div class="el-upload__text">{{$t('拖放文件到此处或')}} <em>{{$t('点击上传')}}</em></div> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</template> |
|
|
|
<template v-else-if="editFormMode==='filter'"> |
|
|
|
<el-form :model="queryList" inline> |
|
|
|
<el-row v-for="(item,index) in queryList" style="padding:10px;"> |
|
|
|
<el-form :model="queryList" inline class="filter"> |
|
|
|
<el-row v-for="(item,index) in queryList"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-select v-model="item.property" :placeholder="$t('字段')"> |
|
|
|
<el-option |
|
|
@ -256,14 +270,14 @@ export default { |
|
|
|
<el-col :span="6"> |
|
|
|
<el-input v-model="item.value" :placeholder="$t('值')" /> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<!-- <el-col :span="4"> |
|
|
|
<el-select v-model="item.logic" :placeholder="$t('关系')"> |
|
|
|
<el-option value="and" :label="$t('且')" /> |
|
|
|
<el-option value="or" :label="$t('或')" /> |
|
|
|
</el-select> |
|
|
|
</el-col> |
|
|
|
</el-col> --> |
|
|
|
<el-col :span="2"> |
|
|
|
<el-button circle @click="queryList.splice(index, 1)" style="margin-left:10px;"> |
|
|
|
<el-button circle @click="queryList.splice(index, 1)"> |
|
|
|
<template #icon> |
|
|
|
<ep-close /> |
|
|
|
</template> |
|
|
@ -272,7 +286,7 @@ export default { |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col> |
|
|
|
<el-button circle @click="pushQueryList" style="margin-left:10px;"> |
|
|
|
<el-button circle @click="pushQueryList"> |
|
|
|
<template #icon> |
|
|
|
<ep-plus /> |
|
|
|
</template> |
|
|
@ -295,7 +309,8 @@ export default { |
|
|
|
</el-dialog> |
|
|
|
`,
|
|
|
|
styles: html`<style>
|
|
|
|
.el-overlay { |
|
|
|
.el-form.filter .el-col { |
|
|
|
padding: 5px; |
|
|
|
} |
|
|
|
</style>`, |
|
|
|
props: ["modelValue", "schema", "controller", "query", "buttons"], |
|
|
@ -335,6 +350,12 @@ export default { |
|
|
|
includeAll: false, |
|
|
|
includeDeleted: false, |
|
|
|
}); |
|
|
|
const importModel = reactive({ |
|
|
|
partial: true, |
|
|
|
replace: false, |
|
|
|
template: null, |
|
|
|
file: null, |
|
|
|
}); |
|
|
|
const getSortModel = (model) => { |
|
|
|
model.orderBy |
|
|
|
.split(",") |
|
|
@ -439,11 +460,12 @@ export default { |
|
|
|
await load(indexUrl); |
|
|
|
} else if (item.path === "export") { |
|
|
|
//export
|
|
|
|
editFormTitle.value = `${t(item.path)}${schema.value?.title}`; |
|
|
|
dialogVisible.value = true; |
|
|
|
} else if (item.path === "import") { |
|
|
|
//import
|
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
|
editFormTitle.value = `${t("import")}${schema.value?.title}`; |
|
|
|
editFormTitle.value = `${t(item.path)}${schema.value?.title}`; |
|
|
|
dialogVisible.value = true; |
|
|
|
} else if (item === "filter") { |
|
|
|
editFormTitle.value = t("自定义查询"); |
|
|
@ -473,16 +495,25 @@ export default { |
|
|
|
editFormloading.value = false; |
|
|
|
} |
|
|
|
} else if (editFormMode.value === "details") { |
|
|
|
await load(indexUrl); |
|
|
|
editFormMode.value = null; |
|
|
|
dialogVisible.value = false; |
|
|
|
editFormMode.value = null; |
|
|
|
} else if (editFormMode.value === "export") { |
|
|
|
const url = `${baseUrl}/${item.path}?${qs.stringify(exportModel)}`; |
|
|
|
// await load(exportUrl);
|
|
|
|
const postData = JSON.parse(JSON.stringify(data.value)); |
|
|
|
postData.filters = queryList.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); |
|
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
|
const filename = response.filename; |
|
|
|
let link = document.createElement("a"); |
|
|
|
link.href = downloadUrl; |
|
|
|
link.download = filename; |
|
|
|
link.click(); |
|
|
|
window.URL.revokeObjectURL(downloadUrl); |
|
|
|
dialogVisible.value = false; |
|
|
|
} else if (editFormMode.value === "filter") { |
|
|
|
alert(JSON.stringify(queryList.value)); |
|
|
|
//const url = `${baseUrl}/${item.path}?${qs.stringify(exportModel)}`;
|
|
|
|
// await load(exportUrl);
|
|
|
|
await load(indexUrl); |
|
|
|
dialogVisible.value = false; |
|
|
|
} |
|
|
|
}; |
|
|
@ -513,9 +544,20 @@ export default { |
|
|
|
property: "", |
|
|
|
operator: "{0}=@0", |
|
|
|
value: "", |
|
|
|
logic: "or", |
|
|
|
logic: "and", |
|
|
|
}); |
|
|
|
}; |
|
|
|
const getImportTemplate = async () => { |
|
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
const response = await get(url); |
|
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
|
const filename = response.filename; |
|
|
|
let link = document.createElement("a"); |
|
|
|
link.href = downloadUrl; |
|
|
|
link.download = filename; |
|
|
|
link.click(); |
|
|
|
window.URL.revokeObjectURL(downloadUrl); |
|
|
|
}; |
|
|
|
onMounted(async () => { |
|
|
|
pushQueryList(); |
|
|
|
const vm = (await get(indexUrl)).data; |
|
|
@ -549,6 +591,7 @@ export default { |
|
|
|
getClass, |
|
|
|
sortChange, |
|
|
|
getProp, |
|
|
|
getImportTemplate, |
|
|
|
editFormRef, |
|
|
|
editFormloading, |
|
|
|
editFormMode, |
|
|
@ -556,6 +599,7 @@ export default { |
|
|
|
editFormSchema, |
|
|
|
editFormModel, |
|
|
|
exportModel, |
|
|
|
importModel, |
|
|
|
onPageSizeChange, |
|
|
|
onPageIndexChange, |
|
|
|
handleSelectionChange, |
|
|
|