|
@ -12,6 +12,7 @@ import VueOfficeExcel from "@vue-office/excel"; |
|
|
import { camelCase, capitalize } from "lodash"; |
|
|
import { camelCase, capitalize } from "lodash"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
|
|
|
name: "AppList", |
|
|
components: { AppForm, SvgIcon, AppFormInput, VueOfficeExcel }, |
|
|
components: { AppForm, SvgIcon, AppFormInput, VueOfficeExcel }, |
|
|
template: html` |
|
|
template: html` |
|
|
<el-row> |
|
|
<el-row> |
|
@ -30,7 +31,7 @@ export default { |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row style="padding-bottom:20px;"> |
|
|
<el-row style="padding-bottom:20px;"> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<template v-for="item in $route.meta.buttons"> |
|
|
<template v-for="item in buttons"> |
|
|
<el-button |
|
|
<el-button |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
v-if="item.meta.isTop" |
|
|
v-if="item.meta.isTop" |
|
@ -74,6 +75,15 @@ export default { |
|
|
<template #default="scope">{{getProp(scope.row,item.navigation)}}</template> |
|
|
<template #default="scope">{{getProp(scope.row,item.navigation)}}</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
<template v-else-if="item.oneToMany"> |
|
|
|
|
|
<el-table-column :prop="key" :label="item.title"> |
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
<el-link type="primary" @click="showList(scope.row[key],item.oneToMany)"> |
|
|
|
|
|
<app-form-input :isReadOnly="true" :schema="item" :prop="key" v-model="scope.row" /> |
|
|
|
|
|
</el-link> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</template> |
|
|
<template v-else> |
|
|
<template v-else> |
|
|
<template v-if="showColumn(item,key)"> |
|
|
<template v-if="showColumn(item,key)"> |
|
|
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]"> |
|
|
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]"> |
|
@ -95,7 +105,7 @@ export default { |
|
|
</template> |
|
|
</template> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<div class="flex"> |
|
|
<div class="flex"> |
|
|
<template v-for="item in $route.meta.buttons"> |
|
|
<template v-for="item in buttons"> |
|
|
<el-button |
|
|
<el-button |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
:class="item.meta.htmlClass??'el-button--primary'" |
|
|
v-if="!item.meta.isTop" |
|
|
v-if="!item.meta.isTop" |
|
@ -151,13 +161,27 @@ export default { |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
</el-scrollbar> |
|
|
</el-scrollbar> |
|
|
|
|
|
|
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<span class="dialog-footer"> |
|
|
<span class="dialog-footer"> |
|
|
<el-button type="primary" @click="filterDrawer=false"> {{$t('confirm')}} </el-button> |
|
|
<el-button type="primary" @click="filterDrawer=false"> {{$t('confirm')}} </el-button> |
|
|
</span> |
|
|
</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-drawer> |
|
|
</el-drawer> |
|
|
|
|
|
<el-drawer v-model="subDrawer" destroy-on-close size="50%"> |
|
|
|
|
|
<el-scrollbar> |
|
|
|
|
|
<app-list |
|
|
|
|
|
v-if="subDrawer" |
|
|
|
|
|
:controller="subListQuery.controller" |
|
|
|
|
|
:query="subListQuery.query" |
|
|
|
|
|
:buttons="subListQuery.buttons" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-scrollbar> |
|
|
|
|
|
<template #footer> |
|
|
|
|
|
<span class="dialog-footer"> |
|
|
|
|
|
<el-button type="primary" @click="subDrawer=false"> {{$t('confirm')}} </el-button> |
|
|
|
|
|
</span> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-drawer> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close width="700"> |
|
|
<el-dialog v-model="dialogVisible" align-center destroy-on-close width="700"> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> |
|
|
<el-row> |
|
|
<el-row> |
|
@ -185,22 +209,30 @@ export default { |
|
|
</template> |
|
|
</template> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
`,
|
|
|
`,
|
|
|
props: ["modelValue"], |
|
|
styles: html`<style>
|
|
|
|
|
|
.el-overlay { |
|
|
|
|
|
} |
|
|
|
|
|
</style>`, |
|
|
|
|
|
props: ["modelValue", "controller", "buttons"], |
|
|
emits: ["command"], |
|
|
emits: ["command"], |
|
|
async setup(props, context) { |
|
|
async setup(props, context) { |
|
|
const tableRef = ref(null); |
|
|
const tableRef = ref(null); |
|
|
const columns = ref([]); |
|
|
const columns = ref([]); |
|
|
const filterDrawer = ref(false); |
|
|
const filterDrawer = ref(false); |
|
|
|
|
|
const subDrawer = ref(false); |
|
|
|
|
|
const subListQuery = ref({}); |
|
|
const tableLoading = ref(false); |
|
|
const tableLoading = ref(false); |
|
|
const selectedRows = ref([]); |
|
|
const selectedRows = ref([]); |
|
|
const dialogVisible = ref(false); |
|
|
const dialogVisible = ref(false); |
|
|
const route = useRoute(); |
|
|
const route = useRoute(); |
|
|
const { t } = useI18n(); |
|
|
const { t } = useI18n(); |
|
|
const baseUrl = `${route.meta.controller}`; |
|
|
const buttons = ref(props.buttons ?? route.meta.buttons); |
|
|
|
|
|
const baseUrl = props.controller ?? `${route.meta.controller}`; |
|
|
const indexUrl = `${baseUrl}/index`; |
|
|
const indexUrl = `${baseUrl}/index`; |
|
|
const vm = (await get(indexUrl)).data; |
|
|
const vm = (await get(indexUrl)).data; |
|
|
const schema = vm.schema; |
|
|
const schema = vm.schema; |
|
|
const data = reactive(vm.model ?? schemaToModel(schema)); |
|
|
const data = reactive(vm.model ?? schemaToModel(schema)); |
|
|
|
|
|
//Object.assign(data,prop.)
|
|
|
const sortColumns = ref(new Map()); |
|
|
const sortColumns = ref(new Map()); |
|
|
const getSortModel = (model) => { |
|
|
const getSortModel = (model) => { |
|
|
const orderBy = model.orderBy |
|
|
const orderBy = model.orderBy |
|
@ -355,19 +387,30 @@ export default { |
|
|
dialogVisible.value = false; |
|
|
dialogVisible.value = false; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
const showList = (value, nav) => { |
|
|
|
|
|
if (!subDrawer.value) { |
|
|
|
|
|
subListQuery.value = { |
|
|
|
|
|
controller: nav.substr(0, nav.lastIndexOf(".")), |
|
|
|
|
|
query: { [nav.substr(nav.lastIndexOf(".") + 1)]: value }, |
|
|
|
|
|
buttons: [], |
|
|
|
|
|
}; |
|
|
|
|
|
subDrawer.value = true; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
await load(indexUrl); |
|
|
await load(indexUrl); |
|
|
return { |
|
|
return { |
|
|
route, |
|
|
|
|
|
tableRef, |
|
|
tableRef, |
|
|
tableLoading, |
|
|
tableLoading, |
|
|
columns, |
|
|
columns, |
|
|
showColumn, |
|
|
showColumn, |
|
|
filterDrawer, |
|
|
filterDrawer, |
|
|
|
|
|
subDrawer, |
|
|
dialogVisible, |
|
|
dialogVisible, |
|
|
selectedRows, |
|
|
selectedRows, |
|
|
schema, |
|
|
schema, |
|
|
queryFromSchema, |
|
|
queryFromSchema, |
|
|
tableSchema, |
|
|
tableSchema, |
|
|
|
|
|
buttons, |
|
|
data, |
|
|
data, |
|
|
sortModel, |
|
|
sortModel, |
|
|
getClass, |
|
|
getClass, |
|
@ -385,6 +428,8 @@ export default { |
|
|
load, |
|
|
load, |
|
|
click, |
|
|
click, |
|
|
submit, |
|
|
submit, |
|
|
|
|
|
showList, |
|
|
|
|
|
subListQuery, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|