|
|
@ -1,5 +1,5 @@ |
|
|
|
import html, { getProp } from "html"; |
|
|
|
import request, { get, post } from "../../request/index.js"; |
|
|
|
import request, { get, getUrl, post } from "../../request/index.js"; |
|
|
|
import { defineAsyncComponent, ref, reactive, onMounted } from "vue"; |
|
|
|
import { useRoute, useRouter } from "vue-router"; |
|
|
|
import { useI18n } from "vue-i18n"; |
|
|
@ -14,6 +14,7 @@ export default { |
|
|
|
name: "AppList", |
|
|
|
components: { |
|
|
|
AppForm: defineAsyncComponent(() => import("../form/index.js")), |
|
|
|
AppFormInput: defineAsyncComponent(() => import("../../components/form/form-input.js")), |
|
|
|
SvgIcon: defineAsyncComponent(() => import("../../components/icon/index.js")), |
|
|
|
AppFormInput: defineAsyncComponent(() => import("../form/form-input.js")), |
|
|
|
VueOfficeExcel, |
|
|
@ -26,13 +27,18 @@ export default { |
|
|
|
inline |
|
|
|
mode="query" |
|
|
|
label-position="left" |
|
|
|
:schema="querySchema" |
|
|
|
:schema="config.query.schema" |
|
|
|
v-model="queryModel" |
|
|
|
@submit="load" |
|
|
|
:hideButton="true" |
|
|
|
:isQueryForm="true" |
|
|
|
v-if="querySchema" |
|
|
|
/> |
|
|
|
> |
|
|
|
<template v-for="item in filterList.filter(o=>o.readOnly)"> |
|
|
|
<el-form-item :label="config.edit.schema.properties[item.column].title"> |
|
|
|
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" /> |
|
|
|
</el-form-item> |
|
|
|
</template> |
|
|
|
</app-form> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row style="padding-bottom:20px;"> |
|
|
@ -48,7 +54,7 @@ export default { |
|
|
|
<span>{{item.meta.title}}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<el-button @click="click('filter',selectedRows)"> |
|
|
|
<el-button @click="click('filter',selectedRows)" v-if="config.query.hasFilter"> |
|
|
|
<el-icon><ep-filter /></el-icon> |
|
|
|
<span>{{$t('筛选')}}</span> |
|
|
|
</el-button> |
|
|
@ -231,23 +237,26 @@ export default { |
|
|
|
</el-form> |
|
|
|
</template> |
|
|
|
<template v-else-if="editFormMode==='import'"> |
|
|
|
<el-form :model="importModel" inline> |
|
|
|
<el-form-item :label="$t('部分成功')"> |
|
|
|
<el-switch v-model="importModel.partial" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('全部替换')"> |
|
|
|
<el-switch v-model="importModel.replace" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form :model="importModel" style="height:100%;"> |
|
|
|
<el-form-item :label="$t('导入模板')"> |
|
|
|
<el-link type="primary" @click="getImportTemplate">{{$t('下载')}}</el-link> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('文件')"> |
|
|
|
<el-form-item label="选择工厂" label-width="80px"> |
|
|
|
<el-select v-model="importModel.version"> |
|
|
|
<el-option v-for="item in versions" :value="item.value" :label="item.label" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="选择期间" label-width="80px"> |
|
|
|
<el-select v-model="importModel.factory"> |
|
|
|
<el-option v-for="item in versions" :value="item.value" :label="item.label" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('文件')" label-width="80px"> |
|
|
|
<el-upload |
|
|
|
ref="uploadRef" |
|
|
|
class="upload" |
|
|
|
drag |
|
|
|
accept=".xlsx" |
|
|
|
:disabled="fileList.length===1" |
|
|
|
:limit="1" |
|
|
|
:auto-upload="false" |
|
|
|
:on-change="handleChange" |
|
|
|
> |
|
|
@ -257,37 +266,33 @@ export default { |
|
|
|
</el-form> |
|
|
|
</template> |
|
|
|
<template v-else-if="editFormMode==='filter'"> |
|
|
|
<el-form :model="queryList" inline class="filter"> |
|
|
|
<el-row v-for="(item,index) in queryList"> |
|
|
|
<el-form :model="filterList" inline class="filter"> |
|
|
|
<el-row v-for="(item,index) in filterList"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-select v-model="item.property" :placeholder="$t('字段')"> |
|
|
|
<el-option v-for="(value, prop) in querySchema.properties" :value="prop" :label="value.title" /> |
|
|
|
<el-select clearable :disabled="item.readOnly" v-model="item.column" :placeholder="$t('字段')"> |
|
|
|
<template v-for="(value, prop) in config.edit.schema.properties"> |
|
|
|
<el-option |
|
|
|
v-if="value.type!=='object'&&value.type!=='array'&&value.input!=='textarea'" |
|
|
|
:value="prop" |
|
|
|
:label="value.title" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-select> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-select v-model="item.operator" :placeholder="$t('操作符')"> |
|
|
|
<el-option value="{0}=@0" :label="$t('等于')" /> |
|
|
|
<el-option value="{0}!=@0" :label="$t('不等于')" /> |
|
|
|
<el-option value="{0}>@0" :label="$t('大于')" /> |
|
|
|
<el-option value="{0}>=@0" :label="$t('大于等于')" /> |
|
|
|
<el-option value="{0}<@0" :label="$t('小于')" /> |
|
|
|
<el-option value="{0}<=@0" :label="$t('小于等于')" /> |
|
|
|
<el-option value="{0}.Contains(@0)" :label="$t('包含')" /> |
|
|
|
<el-option value="{0}.StartsWith(@0)" :label="$t('开始于')" /> |
|
|
|
<el-option value="{0}.StartsWith(@0)" :label="$t('结束于')" /> |
|
|
|
<el-col :span="6" v-if="item.column"> |
|
|
|
<el-select clearable :disabled="item.readOnly" v-model="item.action" :placeholder="$t('操作符')"> |
|
|
|
<el-option |
|
|
|
v-for="item in getOperators(config.edit.schema.properties[item.column])" |
|
|
|
:value="item.value" |
|
|
|
:label="item.label" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-input v-model="item.value" :placeholder="$t('值')" /> |
|
|
|
<el-col :span="8" v-if="item.column"> |
|
|
|
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" /> |
|
|
|
</el-col> |
|
|
|
<!-- <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 :span="2"> |
|
|
|
<el-button circle @click="queryList.splice(index, 1)"> |
|
|
|
<el-col :span="2" v-if="!item.readOnly&&item.action"> |
|
|
|
<el-button circle @click="filterList.splice(index, 1)"> |
|
|
|
<template #icon> |
|
|
|
<ep-close /> |
|
|
|
</template> |
|
|
@ -296,7 +301,7 @@ export default { |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col> |
|
|
|
<el-button circle @click="pushQueryList"> |
|
|
|
<el-button circle @click="pushfilterList"> |
|
|
|
<template #icon> |
|
|
|
<ep-plus /> |
|
|
|
</template> |
|
|
@ -322,6 +327,22 @@ export default { |
|
|
|
.el-form.filter .el-col { |
|
|
|
padding: 5px; |
|
|
|
} |
|
|
|
dl.upload { |
|
|
|
min-height: 100%; |
|
|
|
} |
|
|
|
dl.upload dt { |
|
|
|
font-weight: bold; |
|
|
|
line-height: 3em; |
|
|
|
} |
|
|
|
dl.upload dd { |
|
|
|
line-height: 2em; |
|
|
|
} |
|
|
|
dl.upload .el-form-item { |
|
|
|
width: 300px; |
|
|
|
} |
|
|
|
div.upload { |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
</style>`, |
|
|
|
props: ["modelValue", "config", "querySchema", "controller", "query", "buttons"], |
|
|
|
emits: ["command"], |
|
|
@ -361,7 +382,7 @@ export default { |
|
|
|
const queryModel = ref({}); |
|
|
|
const sortColumns = ref(new Map()); |
|
|
|
const querySchema = ref(props.querySchema); |
|
|
|
const queryList = ref([]); |
|
|
|
const filterList = ref([]); |
|
|
|
const tableSchema = ref({}); |
|
|
|
const tableData = ref([]); |
|
|
|
const editFormRef = ref(null); |
|
|
@ -375,12 +396,16 @@ export default { |
|
|
|
includeDeleted: false, |
|
|
|
}); |
|
|
|
const importModel = reactive({ |
|
|
|
partial: true, |
|
|
|
replace: false, |
|
|
|
// partial: true,
|
|
|
|
// replace: false,
|
|
|
|
factory: "", |
|
|
|
version: "", |
|
|
|
}); |
|
|
|
const factories = ref([]); |
|
|
|
const versions = ref([]); |
|
|
|
const fileList = ref([]); |
|
|
|
const getSortModel = (model) => { |
|
|
|
model.orderBy |
|
|
|
(model.sorting ?? "") |
|
|
|
.split(",") |
|
|
|
.map((o) => o.trim()) |
|
|
|
.filter((o) => o) |
|
|
@ -393,7 +418,7 @@ export default { |
|
|
|
const getColumns = (schema) => { |
|
|
|
Object.keys(schema.properties).forEach((propertyName) => { |
|
|
|
const property = schema.properties[propertyName]; |
|
|
|
if (property.type !== "object" && property.type !== "array" && !property.hidden && property.showForList) { |
|
|
|
if (property.showForList || (property.type !== "object" && property.type !== "array" && !property.hidden)) { |
|
|
|
columns.value.push({ name: propertyName, title: property.title, checked: true }); |
|
|
|
} |
|
|
|
}); |
|
|
@ -409,39 +434,21 @@ export default { |
|
|
|
} else { |
|
|
|
sortColumns.value.set(prop, order); |
|
|
|
} |
|
|
|
queryModel.value.orderBy = Array.from(sortColumns.value) |
|
|
|
queryModel.value.sorting = Array.from(sortColumns.value) |
|
|
|
.map((o) => capitalize(o[0]) + (o[1] === "ascending" ? "" : ` DESC`)) |
|
|
|
.join(","); |
|
|
|
await load(); |
|
|
|
}; |
|
|
|
const showColumn = (item, prop) => { |
|
|
|
return ( |
|
|
|
item.type !== "object" && |
|
|
|
item.type !== "array" && |
|
|
|
!item.hidden && |
|
|
|
columns.value.findIndex((o) => o.name === prop && o.checked) >= 0 |
|
|
|
); |
|
|
|
return columns.value.some((o) => o.name === prop && o.checked); |
|
|
|
}; |
|
|
|
|
|
|
|
const handleSelectionChange = (rows) => (selectedRows.value = rows); |
|
|
|
const load = async () => { |
|
|
|
tableLoading.value = true; |
|
|
|
try { |
|
|
|
const url = config.query.url; |
|
|
|
const method = config.query.method; |
|
|
|
//
|
|
|
|
queryModel.value = schemaToModel(config.query.schema); |
|
|
|
queryModel.value.maxResultCount = pageModel.pageSize; |
|
|
|
queryModel.value.skipCount = (pageModel.pageIndex - 1) * pageModel.pageSize; |
|
|
|
//
|
|
|
|
const postData = JSON.parse(JSON.stringify(queryModel.value)); |
|
|
|
postData.filters = queryList.value.filter((o) => o.property && o.value); |
|
|
|
if (postData.items) { |
|
|
|
delete postData["items"]; |
|
|
|
} |
|
|
|
if (postData.query?.id) { |
|
|
|
delete postData.query["id"]; |
|
|
|
} |
|
|
|
const postData = buildQuery(); |
|
|
|
const listData = (await request(url, postData, { method })).data; |
|
|
|
const items = listData.items; |
|
|
|
if (tableSchema.value.isTree) { |
|
|
@ -462,8 +469,7 @@ export default { |
|
|
|
const click = async (item, rows) => { |
|
|
|
editFormloading.value = true; |
|
|
|
editFormMode.value = item.path ?? item; |
|
|
|
context.emit("command", item, rows); |
|
|
|
if (item.path === "index") { |
|
|
|
if (item.path === "query") { |
|
|
|
//list
|
|
|
|
await load(); |
|
|
|
} else if (item.path === "details") { |
|
|
@ -485,13 +491,39 @@ export default { |
|
|
|
editFormTitle.value = `${t(item.path)}${config.edit.schema.title}`; |
|
|
|
dialogVisible.value = true; |
|
|
|
} else if (item.path === "delete") { |
|
|
|
if (!rows.length) { |
|
|
|
return; |
|
|
|
} |
|
|
|
//delete
|
|
|
|
const url = format(config.edit.deleteUrl, rows[0].id); |
|
|
|
if (item.meta.isTop) { |
|
|
|
// 批量删除
|
|
|
|
return; |
|
|
|
try { |
|
|
|
await ElMessageBox.confirm("删除", "提示", { |
|
|
|
type: "warning", |
|
|
|
message: format("确认删除选中的%s行数据吗?", rows.length), |
|
|
|
}); |
|
|
|
const response = await request( |
|
|
|
url, |
|
|
|
rows.map((o) => o.id), |
|
|
|
{ method: config.edit.deleteMethod } |
|
|
|
); |
|
|
|
if (!response.errors) { |
|
|
|
ElMessage({ |
|
|
|
type: "info", |
|
|
|
message: "操作完毕", |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
if (error === "cancel") { |
|
|
|
ElMessage({ |
|
|
|
type: "info", |
|
|
|
message: "删除取消", |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 单个删除
|
|
|
|
const url = format(config.edit.deleteUrl, rows[0].id); |
|
|
|
try { |
|
|
|
await ElMessageBox.confirm("删除", "提示", { |
|
|
|
type: "warning", |
|
|
@ -511,7 +543,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
|
// await post(
|
|
|
|
// url,
|
|
|
|
// rows.map((o) => o.id)
|
|
|
@ -519,17 +550,47 @@ export default { |
|
|
|
await load(); |
|
|
|
} else if (item.path === "export") { |
|
|
|
//export
|
|
|
|
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`; |
|
|
|
dialogVisible.value = true; |
|
|
|
if ((item.pattern = "paged")) { |
|
|
|
const url = config.edit.exportUrl; |
|
|
|
const method = config.edit.exportMethod; |
|
|
|
const postData = buildQuery(); |
|
|
|
const response = await request(url, postData, { method }); |
|
|
|
if (!response.errors) { |
|
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`; |
|
|
|
dialogVisible.value = true; |
|
|
|
} |
|
|
|
} else if (item.path === "import") { |
|
|
|
//import
|
|
|
|
const url = `${baseUrl}/${item.path}`; |
|
|
|
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`; |
|
|
|
fileList.value = []; |
|
|
|
dialogVisible.value = true; |
|
|
|
try { |
|
|
|
editFormloading.value = true; |
|
|
|
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`; |
|
|
|
fileList.value = []; |
|
|
|
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) { |
|
|
|
console.log(e); |
|
|
|
} finally { |
|
|
|
editFormloading.value = false; |
|
|
|
} |
|
|
|
} else if (item === "filter") { |
|
|
|
editFormTitle.value = t("自定义查询"); |
|
|
|
dialogVisible.value = true; |
|
|
|
} else { |
|
|
|
context.emit("command", item, rows, load); |
|
|
|
} |
|
|
|
editFormloading.value = false; |
|
|
|
}; |
|
|
@ -545,10 +606,10 @@ export default { |
|
|
|
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 }); |
|
|
|
if (result.errors) { |
|
|
|
model.errors = result.errors; //??
|
|
|
|
} else { |
|
|
|
const response = await request(url, editFormModel.value, { method }); |
|
|
|
if (!response.errors) { |
|
|
|
ElMessageBox.alert(`错误:${response.errors?.error?.message}`, `代码:${response.errors?.error?.code}`); |
|
|
|
//model.errors = response.errors; //??
|
|
|
|
await load(); |
|
|
|
editFormMode.value = null; |
|
|
|
dialogVisible.value = false; |
|
|
@ -564,7 +625,7 @@ export default { |
|
|
|
editFormMode.value = null; |
|
|
|
} else if (editFormMode.value === "export") { |
|
|
|
const postData = JSON.parse(JSON.stringify(queryModel.value)); |
|
|
|
postData.filters = queryList.value.filter((o) => o.property && o.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)}`; |
|
|
@ -573,13 +634,14 @@ export default { |
|
|
|
dialogVisible.value = false; |
|
|
|
} else if (editFormMode.value === "import") { |
|
|
|
editFormloading.value = true; |
|
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
const url = config.edit.importUrl; |
|
|
|
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); |
|
|
|
formData.append("version", importModel.version); |
|
|
|
formData.append("factory", importModel.factory); |
|
|
|
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(); |
|
|
@ -610,17 +672,8 @@ export default { |
|
|
|
subDrawer.value = true; |
|
|
|
} |
|
|
|
}; |
|
|
|
const pushQueryList = () => { |
|
|
|
queryList.value.push({ |
|
|
|
property: "", |
|
|
|
operator: "{0}=@0", |
|
|
|
value: "", |
|
|
|
logic: "and", |
|
|
|
}); |
|
|
|
}; |
|
|
|
const download = (response) => { |
|
|
|
const downloadUrl = window.URL.createObjectURL(response.data); |
|
|
|
const filename = response.filename; |
|
|
|
const download = (url, filename) => { |
|
|
|
const downloadUrl = window.URL.createObjectURL(url); |
|
|
|
let link = document.createElement("a"); |
|
|
|
link.href = downloadUrl; |
|
|
|
link.download = filename; |
|
|
@ -630,7 +683,7 @@ export default { |
|
|
|
const getImportTemplate = async () => { |
|
|
|
const url = `${baseUrl}/${editFormMode.value}`; |
|
|
|
const response = await get(url); |
|
|
|
download(response); |
|
|
|
download(url, response.filename); |
|
|
|
}; |
|
|
|
const handleChange = (uploadFile, uploadFiles) => { |
|
|
|
fileList.value = uploadFiles; |
|
|
@ -642,6 +695,87 @@ export default { |
|
|
|
} |
|
|
|
return false; |
|
|
|
}; |
|
|
|
const pushfilterList = () => { |
|
|
|
filterList.value.push({ |
|
|
|
logic: "and", |
|
|
|
column: "", |
|
|
|
action: "equal", |
|
|
|
value: null, |
|
|
|
}); |
|
|
|
}; |
|
|
|
const logic = [ |
|
|
|
{ value: "and", label: "且" }, |
|
|
|
{ value: "or", label: "或" }, |
|
|
|
]; |
|
|
|
const operators = [ |
|
|
|
{ |
|
|
|
value: "equal", |
|
|
|
label: "等于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "notEqual", |
|
|
|
label: "不等于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "biggerThan", |
|
|
|
label: "大于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "smallThan", |
|
|
|
label: "小于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "biggerThanOrEqual", |
|
|
|
label: "大于等于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "smallThanOrEqual", |
|
|
|
label: "小于等于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "like", |
|
|
|
label: "类似于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "notLike", |
|
|
|
label: "不类似于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "in", |
|
|
|
label: "包含于", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: "notIn", |
|
|
|
label: "不包含于", |
|
|
|
}, |
|
|
|
]; |
|
|
|
const getOperators = (schema) => { |
|
|
|
const values = ["equal", "notEqual"]; |
|
|
|
if (schema.type === "string") { |
|
|
|
values.push("like", "notLike"); |
|
|
|
if (schema.input && ["year", "month", "date", "datetime"].includes(schema.input)) { |
|
|
|
values.push("biggerThan", "smallThan", "biggerThanOrEqual", "smallThanOrEqual"); |
|
|
|
} |
|
|
|
} else if (schema.type === "boolean") { |
|
|
|
} else { |
|
|
|
values.push("biggerThan", "smallThan", "biggerThanOrEqual", "smallThanOrEqual"); |
|
|
|
} |
|
|
|
return operators.filter((o) => values.includes(o.value)); |
|
|
|
}; |
|
|
|
function buildQuery() { |
|
|
|
queryModel.value.maxResultCount = pageModel.pageSize; |
|
|
|
queryModel.value.skipCount = (pageModel.pageIndex - 1) * pageModel.pageSize; |
|
|
|
//
|
|
|
|
const postData = JSON.parse(JSON.stringify(queryModel.value)); |
|
|
|
postData.filters = filterList.value.filter((o) => o.column && o.action && (o.value || o.value === false)); |
|
|
|
if (postData.items) { |
|
|
|
delete postData["items"]; |
|
|
|
} |
|
|
|
if (postData.query?.id) { |
|
|
|
delete postData.query["id"]; |
|
|
|
} |
|
|
|
return postData; |
|
|
|
} |
|
|
|
onMounted(async () => { |
|
|
|
if (route.meta.children?.length) { |
|
|
|
for (const item of route.meta.children) { |
|
|
@ -650,7 +784,11 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
pushQueryList(); |
|
|
|
//
|
|
|
|
queryModel.value = schemaToModel(config.query.schema); |
|
|
|
getSortModel(queryModel.value); |
|
|
|
filterList.value = queryModel.value?.filters ?? []; |
|
|
|
//pushfilterList();
|
|
|
|
// if (!querySchema.value) {
|
|
|
|
// const vm = (await get(indexUrl)).data;
|
|
|
|
// querySchema.value = vm.schema.properties.query;
|
|
|
@ -662,9 +800,6 @@ export default { |
|
|
|
// getSortModel(data.value);
|
|
|
|
// getColumns(vm.schema.properties.query);
|
|
|
|
// }
|
|
|
|
if (!config) { |
|
|
|
//
|
|
|
|
} |
|
|
|
getColumns(config.table.schema); |
|
|
|
if (props.query) { |
|
|
|
Object.assign(queryModel.value.query, props.query); |
|
|
@ -673,7 +808,9 @@ export default { |
|
|
|
// getColumns(vm.schema.properties.query);
|
|
|
|
await load(); |
|
|
|
}); |
|
|
|
context.expose({ load }); |
|
|
|
return { |
|
|
|
load, |
|
|
|
config, |
|
|
|
queryModel, |
|
|
|
pageModel, |
|
|
@ -689,7 +826,7 @@ export default { |
|
|
|
dialogVisible, |
|
|
|
selectedRows, |
|
|
|
querySchema, |
|
|
|
queryList, |
|
|
|
filterList, |
|
|
|
tableSchema, |
|
|
|
buttons, |
|
|
|
tableData, |
|
|
@ -713,10 +850,13 @@ export default { |
|
|
|
submit, |
|
|
|
showList, |
|
|
|
subListQuery, |
|
|
|
pushQueryList, |
|
|
|
fileList, |
|
|
|
handleChange, |
|
|
|
getButtonDisabled, |
|
|
|
factories, |
|
|
|
versions, |
|
|
|
pushfilterList, |
|
|
|
getOperators, |
|
|
|
}; |
|
|
|
}, |
|
|
|
}; |
|
|
|