Pre Merge pull request !120 from puhui999/master-vxe

pull/120/MERGE
puhui999 2023-04-13 09:32:08 +00:00 committed by Gitee
commit ccede9211b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
48 changed files with 214 additions and 131 deletions

View File

@ -6,21 +6,25 @@ import progress from 'vite-plugin-progress'
import EslintPlugin from 'vite-plugin-eslint' import EslintPlugin from 'vite-plugin-eslint'
import PurgeIcons from 'vite-plugin-purge-icons' import PurgeIcons from 'vite-plugin-purge-icons'
import { ViteEjsPlugin } from 'vite-plugin-ejs' import { ViteEjsPlugin } from 'vite-plugin-ejs'
// @ts-ignore
import ElementPlus from 'unplugin-element-plus/vite' import ElementPlus from 'unplugin-element-plus/vite'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite' import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import viteCompression from 'vite-plugin-compression' import viteCompression from 'vite-plugin-compression'
import vueSetupExtend from 'vite-plugin-vue-setup-extend' import topLevelAwait from 'vite-plugin-top-level-await'
import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export function createVitePlugins() { export function createVitePlugins() {
const root = process.cwd() const root = process.cwd()
// 路径查找 // 路径查找
function pathResolve(dir: string) { function pathResolve(dir: string) {
return resolve(root, '.', dir) return resolve(root, '.', dir)
} }
return [ return [
Vue(), Vue(),
VueJsx(), VueJsx(),
@ -46,6 +50,7 @@ export function createVitePlugins() {
'@/hooks/web/useXTable': ['useXTable'], '@/hooks/web/useXTable': ['useXTable'],
'@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'], '@/hooks/web/useVxeCrudSchemas': ['useVxeCrudSchemas'],
'@/hooks/web/useTable': ['useTable'], '@/hooks/web/useTable': ['useTable'],
'@/hooks/web/useAdaptiveXTable': ['useAdaptiveXTable'],
'@/hooks/web/useCrudSchemas': ['useCrudSchemas'], '@/hooks/web/useCrudSchemas': ['useCrudSchemas'],
'@/utils/formRules': ['required'], '@/utils/formRules': ['required'],
'@/utils/dict': ['DICT_TYPE'] '@/utils/dict': ['DICT_TYPE']
@ -95,6 +100,13 @@ export function createVitePlugins() {
ext: '.gz', // 生成的压缩包后缀 ext: '.gz', // 生成的压缩包后缀
deleteOriginFile: false //压缩后是否删除源文件 deleteOriginFile: false //压缩后是否删除源文件
}), }),
ViteEjsPlugin() ViteEjsPlugin(),
topLevelAwait({
// https://juejin.cn/post/7152191742513512485
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`
})
] ]
} }

View File

@ -122,7 +122,8 @@
"vite-plugin-progress": "^0.0.6", "vite-plugin-progress": "^0.0.6",
"vite-plugin-purge-icons": "^0.9.2", "vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-top-level-await": "^1.3.0",
"vite-plugin-vue-setup-extend-plus": "^0.1.0",
"vite-plugin-windicss": "^1.8.10", "vite-plugin-windicss": "^1.8.10",
"vue-tsc": "^1.2.0", "vue-tsc": "^1.2.0",
"windicss": "^3.5.6" "windicss": "^3.5.6"

View File

@ -1,11 +1,11 @@
<template> <template>
<VxeGrid v-bind="getProps" ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar"> <VxeGrid ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar" v-bind="getProps">
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item"> <template v-for="item in Object.keys($slots)" :key="item" #[item]="data">
<slot :name="item" v-bind="data || {}"></slot> <slot :name="item" v-bind="data || {}"></slot>
</template> </template>
</VxeGrid> </VxeGrid>
</template> </template>
<script setup lang="ts" name="XTable"> <script lang="ts" name="XTable" setup>
import { PropType } from 'vue' import { PropType } from 'vue'
import { SizeType, VxeGridInstance } from 'vxe-table' import { SizeType, VxeGridInstance } from 'vxe-table'
import { useAppStore } from '@/store/modules/app' import { useAppStore } from '@/store/modules/app'
@ -37,7 +37,6 @@ const removeStyles = () => {
allsuspects[i].getAttribute(targetattr) != null && allsuspects[i].getAttribute(targetattr) != null &&
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1 allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
) { ) {
console.log(allsuspects[i], 'node')
allsuspects[i].parentNode?.removeChild(allsuspects[i]) allsuspects[i].parentNode?.removeChild(allsuspects[i])
} }
} }
@ -90,7 +89,6 @@ const innerProps = ref<Partial<XTableProps>>()
const getProps = computed(() => { const getProps = computed(() => {
const options = innerProps.value || props.options const options = innerProps.value || props.options
options.size = currentSize as any options.size = currentSize as any
options.height = 700
getOptionInitConfig(options) getOptionInitConfig(options)
getColumnsConfig(options) getColumnsConfig(options)
getProxyConfig(options) getProxyConfig(options)
@ -254,7 +252,7 @@ const getPageConfig = (options: XTableProps) => {
background: false, // background: false, //
perfect: false, // perfect: false, //
pageSize: 10, // pageSize: 10, //
pagerCount: 7, // pagerCount: 5, //
autoHidden: false, // autoHidden: false, //
pageSizes: [5, 10, 20, 30, 50, 100], // pageSizes: [5, 10, 20, 30, 50, 100], //
layouts: [ layouts: [
@ -272,7 +270,7 @@ const getPageConfig = (options: XTableProps) => {
} }
} }
// tool bar // toolbar
const getToolBarConfig = (options: XTableProps) => { const getToolBarConfig = (options: XTableProps) => {
const { toolBar, toolbarConfig, topActionSlots } = options const { toolBar, toolbarConfig, topActionSlots } = options
if (toolbarConfig) return if (toolbarConfig) return
@ -421,7 +419,8 @@ const getCheckboxRecords = () => {
return g.getCheckboxRecords(false) return g.getCheckboxRecords(false)
} }
const setProps = (prop: Partial<XTableProps>) => { const setProps = (prop: Partial<XTableProps>) => {
innerProps.value = { ...unref(innerProps), ...prop } //
innerProps.value = { ...innerProps.value, ...prop, ...props.options }
} }
defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList }) defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList })

View File

@ -0,0 +1,64 @@
/**
* 使
* @param setPropsFunctions [useXTablesetProps],
* @param container XTableContentWrap
*/
export const useAdaptiveXTable = (setPropsFunctions: Function[], container = 'ContentWrap') => {
// 最终的表格高度
const height = ref(0)
// header区域和tags区域的高度和
const htHeight = ref(126)
// vxe-grid类名
const vxeGridClassName = ref('.vxe-grid')
// 精确计算vxe表格所在cart的可用高度
const getTableHeight = () => {
// 找到vxe(目的获取vex-grid所在el-cart的高度)
const vxeElement = document.querySelector(vxeGridClassName.value)
if (vxeElement) {
// ========== 计算容器可用高度(tag: 不使用元素获取的方式是怕类名有变化) ==========
// 父元素el-card__body(ContentWrap要获取两次parentElement因为还有一层div包裹)
let parent
if ('ContentWrap' === container) {
parent = vxeElement?.parentElement?.parentElement
} else {
parent = vxeElement?.parentElement
}
// 父元素的兄弟元素也就是el-card__header
const previous = parent?.previousElementSibling as HTMLElement
let previousHeight
// 如果有标题获取高度
if (previous) {
previousHeight = previous?.offsetHeight
}
//获取浏览器窗口内容高度
const vh = window.innerHeight
// 计算容器可用高度,如果有标题话减去标题占用的高度, 最后减去header区域和tags区域的高度
height.value = (previousHeight && vh ? vh - previousHeight : vh) - htHeight.value
for (const setProps of setPropsFunctions) {
setProps({ height: height.value })
}
}
}
const initOnresize = () => {
// 监听浏览器窗口变化重新计算高度
window.onresize = () => {
getTableHeight()
}
getTableHeight()
}
onMounted(() => {
initOnresize()
})
//页面卸载之前干掉onresize
onBeforeUnmount(() => {
window.onresize = () => {}
})
// 针对缓存了的页面
onActivated(() => {
// 调用时机为首次挂载
// 以及每次从缓存中被重新插入时,重新更新onresize和计算高度
initOnresize()
})
return { height }
}

View File

@ -27,7 +27,7 @@ export const useXTable = (props: XTableProps): [Function, tableMethod] => {
} }
const methods: tableMethod = { const methods: tableMethod = {
reload: () => getInstance().reload(), reload: () => getInstance().reload(),
setProps: (props) => getInstance().setProps(props), setProps: (props) => getInstance()?.setProps(props),
deleteData: (id: string | number) => getInstance().deleteData(id), deleteData: (id: string | number) => getInstance().deleteData(id),
deleteBatch: () => getInstance().deleteBatch(), deleteBatch: () => getInstance().deleteBatch(),
exportList: (fileName?: string) => getInstance().exportList(fileName), exportList: (fileName?: string) => getInstance().exportList(fileName),

View File

@ -23,7 +23,6 @@ declare module '@vue/runtime-core' {
DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default'] DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default']
Echart: typeof import('./../components/Echart/src/Echart.vue')['default'] Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer']
ElBadge: typeof import('element-plus/es')['ElBadge'] ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
@ -34,7 +33,6 @@ declare module '@vue/runtime-core' {
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition'] ElCollapseTransition: typeof import('element-plus/es')['ElCollapseTransition']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
@ -53,7 +51,6 @@ declare module '@vue/runtime-core' {
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon'] ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
@ -71,12 +68,9 @@ declare module '@vue/runtime-core' {
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTableV2: typeof import('element-plus/es')['ElTableV2']
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs'] ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTransfer: typeof import('element-plus/es')['ElTransfer']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']

View File

@ -51,6 +51,7 @@ declare global {
const toRefs: typeof import('vue')['toRefs'] const toRefs: typeof import('vue')['toRefs']
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref'] const unref: typeof import('vue')['unref']
const useAdaptiveXTable: typeof import('@/hooks/web/useAdaptiveXTable')['useAdaptiveXTable']
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: typeof import('vue')['useAttrs']
const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas'] const useCrudSchemas: typeof import('@/hooks/web/useCrudSchemas')['useCrudSchemas']
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: typeof import('vue')['useCssModule']

View File

@ -54,12 +54,12 @@ const { t } = useI18n() // 国际化
const { push } = useRouter() // const { push } = useRouter() //
// //
const [registerTable, { deleteData }] = useXTable({ const [registerTable, { deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: FormApi.getFormPageApi, getListApi: FormApi.getFormPageApi,
deleteApi: FormApi.deleteFormApi deleteApi: FormApi.deleteFormApi
}) })
useAdaptiveXTable([setProps])
// //
const handleCreate = () => { const handleCreate = () => {
push({ push({

View File

@ -95,11 +95,12 @@ import { FormExpose } from '@/components/Form'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: UserGroupApi.getUserGroupPageApi, getListApi: UserGroupApi.getUserGroupPageApi,
deleteApi: UserGroupApi.deleteUserGroupApi deleteApi: UserGroupApi.deleteUserGroupApi
}) })
useAdaptiveXTable([setProps])
// //
const users = ref<UserVO[]>([]) const users = ref<UserVO[]>([])

View File

@ -338,10 +338,11 @@ const bpmnControlForm = ref({
prefix: 'flowable' prefix: 'flowable'
}) })
// ========== ========== // ========== ==========
const [registerTable, { reload }] = useXTable({ const [registerTable, { reload, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ModelApi.getModelPageApi getListApi: ModelApi.getModelPageApi
}) })
useAdaptiveXTable([setProps])
const forms = ref() // const forms = ref() //
// //

View File

@ -35,11 +35,11 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
const { push } = useRouter() // const { push } = useRouter() //
const [registerTable, { reload }] = useXTable({ const [registerTable, { reload, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: LeaveApi.getLeavePageApi getListApi: LeaveApi.getLeavePageApi
}) })
useAdaptiveXTable([setProps])
// //
const handleCreate = () => { const handleCreate = () => {
push({ push({

View File

@ -55,10 +55,11 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() // const { t } = useI18n() //
// ========== ========== // ========== ==========
const [registerTable, { reload }] = useXTable({ const [registerTable, { reload, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ProcessInstanceApi.getMyProcessInstancePageApi getListApi: ProcessInstanceApi.getMyProcessInstancePageApi
}) })
useAdaptiveXTable([setProps])
/** 发起流程操作 **/ /** 发起流程操作 **/
const handleCreate = () => { const handleCreate = () => {

View File

@ -173,13 +173,13 @@ const queryParams = reactive({
modelId: modelId, modelId: modelId,
processDefinitionId: processDefinitionId processDefinitionId: processDefinitionId
}) })
const [registerTable, { reload }] = useXTable({ const [registerTable, { reload, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
params: queryParams, params: queryParams,
getListApi: TaskAssignRuleApi.getTaskAssignRuleList, getListApi: TaskAssignRuleApi.getTaskAssignRuleList,
isList: true isList: true
}) })
useAdaptiveXTable([setProps])
// //
const getAssignRuleOptionName = (type, option) => { const getAssignRuleOptionName = (type, option) => {
if (type === 10) { if (type === 10) {

View File

@ -60,11 +60,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() const message = useMessage()
// ========== ========== // ========== ==========
const [registerTable, { reload, exportList }] = useXTable({ const [registerTable, { reload, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ApiErrorLogApi.getApiErrorLogPageApi, getListApi: ApiErrorLogApi.getApiErrorLogPageApi,
exportListApi: ApiErrorLogApi.exportApiErrorLogApi exportListApi: ApiErrorLogApi.exportApiErrorLogApi
}) })
useAdaptiveXTable([setProps])
// ========== ========== // ========== ==========
const detailData = ref() // Ref const detailData = ref() // Ref
const dialogVisible = ref(false) // const dialogVisible = ref(false) //

View File

@ -67,12 +67,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
const { push } = useRouter() // const { push } = useRouter() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: CodegenApi.getCodegenTablePageApi, getListApi: CodegenApi.getCodegenTablePageApi,
deleteApi: CodegenApi.deleteCodegenTableApi deleteApi: CodegenApi.deleteCodegenTableApi
}) })
useAdaptiveXTable([setProps])
// //
const importRef = ref() const importRef = ref()
const openImportTable = () => { const openImportTable = () => {

View File

@ -91,13 +91,13 @@ import { rules, allSchemas } from './config.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ConfigApi.getConfigPage, getListApi: ConfigApi.getConfigPage,
deleteApi: ConfigApi.deleteConfig, deleteApi: ConfigApi.deleteConfig,
exportListApi: ConfigApi.exportConfigApi exportListApi: ConfigApi.exportConfigApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -74,12 +74,13 @@ import { rules, allSchemas } from './dataSourceConfig.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
isList: true, isList: true,
getListApi: DataSourceConfiggApi.getDataSourceConfigListApi, getListApi: DataSourceConfiggApi.getDataSourceConfigListApi,
deleteApi: DataSourceConfiggApi.deleteDataSourceConfigApi deleteApi: DataSourceConfiggApi.deleteDataSourceConfigApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const loading = ref(false) // const loading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -167,12 +167,12 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: FileConfigApi.getFileConfigPageApi, getListApi: FileConfigApi.getFileConfigPageApi,
deleteApi: FileConfigApi.deleteFileConfigApi deleteApi: FileConfigApi.deleteFileConfigApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -90,12 +90,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: FileApi.getFilePageApi, getListApi: FileApi.getFilePageApi,
deleteApi: FileApi.deleteFileApi deleteApi: FileApi.deleteFileApi
}) })
useAdaptiveXTable([setProps])
const detailData = ref() // Ref const detailData = ref() // Ref
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //

View File

@ -54,11 +54,12 @@ import { allSchemas } from './jobLog.data'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: JobLogApi.getJobLogPageApi, getListApi: JobLogApi.getJobLogPageApi,
exportListApi: JobLogApi.exportJobLogApi exportListApi: JobLogApi.exportJobLogApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //

View File

@ -139,13 +139,13 @@ const message = useMessage() // 消息弹窗
const { push } = useRouter() const { push } = useRouter()
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: JobApi.getJobPageApi, getListApi: JobApi.getJobPageApi,
deleteApi: JobApi.deleteJobApi, deleteApi: JobApi.deleteJobApi,
exportListApi: JobApi.exportJobApi exportListApi: JobApi.exportJobApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -84,13 +84,13 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: AppApi.getAppPageApi, getListApi: AppApi.getAppPageApi,
deleteApi: AppApi.deleteAppApi, deleteApi: AppApi.deleteAppApi,
exportListApi: AppApi.exportAppApi exportListApi: AppApi.exportAppApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -82,13 +82,13 @@ import * as MerchantApi from '@/api/pay/merchant'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: MerchantApi.getMerchantPageApi, getListApi: MerchantApi.getMerchantPageApi,
deleteApi: MerchantApi.deleteMerchantApi, deleteApi: MerchantApi.deleteMerchantApi,
exportListApi: MerchantApi.exportMerchantApi exportListApi: MerchantApi.exportMerchantApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -47,11 +47,12 @@ import * as OrderApi from '@/api/pay/order'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: OrderApi.getOrderPageApi, getListApi: OrderApi.getOrderPageApi,
exportListApi: OrderApi.exportOrderApi exportListApi: OrderApi.exportOrderApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -40,12 +40,12 @@ import * as RefundApi from '@/api/pay/refund'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: RefundApi.getRefundPageApi, getListApi: RefundApi.getRefundPageApi,
exportListApi: RefundApi.exportRefundApi exportListApi: RefundApi.exportRefundApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const detailData = ref() // Ref const detailData = ref() // Ref

View File

@ -75,7 +75,7 @@
</XModal> </XModal>
</template> </template>
<script setup lang="ts" name="Dept"> <script setup lang="ts" name="Dept">
import { handleTree, defaultProps } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import type { FormExpose } from '@/components/Form' import type { FormExpose } from '@/components/Form'
import { allSchemas, rules } from './dept.data' import { allSchemas, rules } from './dept.data'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
@ -102,8 +102,7 @@ const deptOptions = ref() // 树形结构
const userOption = ref<UserVO[]>([]) const userOption = ref<UserVO[]>([])
const getUserList = async () => { const getUserList = async () => {
const res = await getListSimpleUsersApi() userOption.value = await getListSimpleUsersApi()
userOption.value = res
} }
// [] // []
const getTree = async () => { const getTree = async () => {
@ -113,12 +112,13 @@ const getTree = async () => {
dept.children = handleTree(res) dept.children = handleTree(res)
deptOptions.value.push(dept) deptOptions.value.push(dept)
} }
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
treeConfig: treeConfig, treeConfig: treeConfig,
getListApi: DeptApi.getDeptPageApi, getListApi: DeptApi.getDeptPageApi,
deleteApi: DeptApi.deleteDeptApi deleteApi: DeptApi.deleteDeptApi
}) })
useAdaptiveXTable([setProps])
// ========== / ========== // ========== / ==========
// //

View File

@ -133,21 +133,24 @@ import { DictDataVO, DictTypeVO } from '@/api/system/dict/types'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const [registerType, { reload: typeGetList, deleteData: typeDeleteData }] = useXTable({ const [registerType, { reload: typeGetList, deleteData: typeDeleteData, setProps: typeSetProps }] =
allSchemas: DictTypeSchemas.allSchemas, useXTable({
getListApi: DictTypeApi.getDictTypePageApi, allSchemas: DictTypeSchemas.allSchemas,
deleteApi: DictTypeApi.deleteDictTypeApi getListApi: DictTypeApi.getDictTypePageApi,
}) deleteApi: DictTypeApi.deleteDictTypeApi
})
const queryParams = reactive({ const queryParams = reactive({
dictType: null dictType: null
}) })
const [registerData, { reload: dataGetList, deleteData: dataDeleteData }] = useXTable({ const [registerData, { reload: dataGetList, deleteData: dataDeleteData, setProps: dataSetProps }] =
allSchemas: DictDataSchemas.allSchemas, useXTable({
params: queryParams, allSchemas: DictDataSchemas.allSchemas,
getListApi: DictDataApi.getDictDataPageApi, params: queryParams,
deleteApi: DictDataApi.deleteDictDataApi getListApi: DictDataApi.getDictDataPageApi,
}) deleteApi: DictDataApi.deleteDictDataApi
})
const { height } = useAdaptiveXTable([typeSetProps, dataSetProps], 'Card')
// ========== ========== // ========== ==========
const dictTypeValue = ref('') const dictTypeValue = ref('')
// //
@ -180,6 +183,7 @@ const cellClickEvent: VxeTableEvents.CellClick = async ({ row }) => {
tableTypeSelect.value = true tableTypeSelect.value = true
queryParams.dictType = row['type'] queryParams.dictType = row['type']
await nextTick() await nextTick()
dataSetProps({ height })
await dataGetList() await dataGetList()
parentType.value = row['type'] parentType.value = row['type']
} }

View File

@ -75,11 +75,12 @@ import * as ErrorCodeApi from '@/api/system/errorCode'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ErrorCodeApi.getErrorCodePageApi, getListApi: ErrorCodeApi.getErrorCodePageApi,
deleteApi: ErrorCodeApi.deleteErrorCodeApi deleteApi: ErrorCodeApi.deleteErrorCodeApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //

View File

@ -34,12 +34,12 @@ import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: getLoginLogPageApi, getListApi: getLoginLogPageApi,
exportListApi: exportLoginLogApi exportListApi: exportLoginLogApi
}) })
useAdaptiveXTable([setProps])
// //
const detailData = ref() // Ref const detailData = ref() // Ref
const dialogVisible = ref(false) // const dialogVisible = ref(false) //

View File

@ -76,12 +76,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: MailAccountApi.getMailAccountPageApi, getListApi: MailAccountApi.getMailAccountPageApi,
deleteApi: MailAccountApi.deleteMailAccountApi deleteApi: MailAccountApi.deleteMailAccountApi
}) })
useAdaptiveXTable([setProps])
// //
const modelVisible = ref(false) // const modelVisible = ref(false) //
const modelTitle = ref('edit') // const modelTitle = ref('edit') //

View File

@ -146,12 +146,13 @@ const message = useMessage() // 消息弹窗
const queryParams = reactive({ const queryParams = reactive({
accountId: null accountId: null
}) })
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
params: queryParams, params: queryParams,
getListApi: MailTemplateApi.getMailTemplatePageApi, getListApi: MailTemplateApi.getMailTemplatePageApi,
deleteApi: MailTemplateApi.deleteMailTemplateApi deleteApi: MailTemplateApi.deleteMailTemplateApi
}) })
useAdaptiveXTable([setProps])
const accountOptions = ref<any[]>([]) // const accountOptions = ref<any[]>([]) //
// //

View File

@ -222,12 +222,13 @@ const treeConfig = {
parentField: 'parentId', parentField: 'parentId',
expandAll: false expandAll: false
} }
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
treeConfig: treeConfig, treeConfig: treeConfig,
getListApi: MenuApi.getMenuListApi, getListApi: MenuApi.getMenuListApi,
deleteApi: MenuApi.deleteMenuApi deleteApi: MenuApi.deleteMenuApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //

View File

@ -79,11 +79,12 @@ import { rules, allSchemas } from './notice.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: NoticeApi.getNoticePageApi, getListApi: NoticeApi.getNoticePageApi,
deleteApi: NoticeApi.deleteNoticeApi deleteApi: NoticeApi.deleteNoticeApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //

View File

@ -29,11 +29,11 @@ import * as NotifyMessageApi from '@/api/system/notify/message'
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, getCheckboxRecords }] = useXTable({ const [registerTable, { reload, getCheckboxRecords, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: NotifyMessageApi.getMyNotifyMessagePage getListApi: NotifyMessageApi.getMyNotifyMessagePage
}) })
useAdaptiveXTable([setProps])
const handleUpdateList = async () => { const handleUpdateList = async () => {
const list = getCheckboxRecords() as any as any[] const list = getCheckboxRecords() as any as any[]
if (list.length === 0) { if (list.length === 0) {

View File

@ -125,12 +125,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: NotifyTemplateApi.getNotifyTemplatePageApi, getListApi: NotifyTemplateApi.getNotifyTemplatePageApi,
deleteApi: NotifyTemplateApi.deleteNotifyTemplateApi deleteApi: NotifyTemplateApi.deleteNotifyTemplateApi
}) })
useAdaptiveXTable([setProps])
// //
const modelVisible = ref(false) // const modelVisible = ref(false) //
const modelTitle = ref('edit') // const modelTitle = ref('edit') //

View File

@ -139,11 +139,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: ClientApi.getOAuth2ClientPageApi, getListApi: ClientApi.getOAuth2ClientPageApi,
deleteApi: ClientApi.deleteOAuth2ClientApi deleteApi: ClientApi.deleteOAuth2ClientApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //

View File

@ -31,12 +31,12 @@ import * as TokenApi from '@/api/system/oauth2/token'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload }] = useXTable({ const [registerTable, { reload, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false, topActionSlots: false,
getListApi: TokenApi.getAccessTokenPageApi getListApi: TokenApi.getAccessTokenPageApi
}) })
useAdaptiveXTable([setProps])
// ========== ========== // ========== ==========
const detailData = ref() // Ref const detailData = ref() // Ref
const dialogVisible = ref(false) // const dialogVisible = ref(false) //

View File

@ -48,12 +48,12 @@ import { allSchemas } from './operatelog.data'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: OperateLogApi.getOperateLogPageApi, getListApi: OperateLogApi.getOperateLogPageApi,
exportListApi: OperateLogApi.exportOperateLogApi exportListApi: OperateLogApi.exportOperateLogApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const actionLoading = ref(false) // Loading const actionLoading = ref(false) // Loading

View File

@ -56,13 +56,13 @@ import PostForm from './form.vue'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, // allSchemas: allSchemas, //
getListApi: PostApi.getPostPageApi, // API getListApi: PostApi.getPostPageApi, // API
deleteApi: PostApi.deletePostApi, // API deleteApi: PostApi.deletePostApi, // API
exportListApi: PostApi.exportPostApi // API exportListApi: PostApi.exportPostApi // API
}) })
useAdaptiveXTable([setProps])
// //
const modalRef = ref() const modalRef = ref()
const openModal = (type: string, id?: number) => { const openModal = (type: string, id?: number) => {

View File

@ -137,8 +137,9 @@
empty-text="加载中,请稍后" empty-text="加载中,请稍后"
/> />
</el-card> </el-card>
</el-form-item> </el-col </el-form-item>
></el-row> </el-col>
</el-row>
</el-form> </el-form>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
@ -159,10 +160,10 @@
<script setup lang="ts" name="Role"> <script setup lang="ts" name="Role">
import type { ElTree } from 'element-plus' import type { ElTree } from 'element-plus'
import type { FormExpose } from '@/components/Form' import type { FormExpose } from '@/components/Form'
import { handleTree, defaultProps } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import { SystemDataScopeEnum } from '@/utils/constants' import { SystemDataScopeEnum } from '@/utils/constants'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { rules, allSchemas } from './role.data' import { allSchemas, rules } from './role.data'
import * as RoleApi from '@/api/system/role' import * as RoleApi from '@/api/system/role'
import { listSimpleMenusApi } from '@/api/system/menu' import { listSimpleMenusApi } from '@/api/system/menu'
import { listSimpleDeptApi } from '@/api/system/dept' import { listSimpleDeptApi } from '@/api/system/dept'
@ -171,12 +172,12 @@ import * as PermissionApi from '@/api/system/permission'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: RoleApi.getRolePageApi, getListApi: RoleApi.getRolePageApi,
deleteApi: RoleApi.deleteRoleApi deleteApi: RoleApi.deleteRoleApi
}) })
useAdaptiveXTable([setProps])
// ========== CRUD ========== // ========== CRUD ==========
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //

View File

@ -110,12 +110,13 @@ import { rules, allSchemas } from './sensitiveWord.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SensitiveWordApi.getSensitiveWordPageApi, getListApi: SensitiveWordApi.getSensitiveWordPageApi,
deleteApi: SensitiveWordApi.deleteSensitiveWordApi, deleteApi: SensitiveWordApi.deleteSensitiveWordApi,
exportListApi: SensitiveWordApi.exportSensitiveWordApi exportListApi: SensitiveWordApi.exportSensitiveWordApi
}) })
useAdaptiveXTable([setProps])
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //

View File

@ -77,12 +77,12 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsChannelApi.getSmsChannelPageApi, getListApi: SmsChannelApi.getSmsChannelPageApi,
deleteApi: SmsChannelApi.deleteSmsChannelApi deleteApi: SmsChannelApi.deleteSmsChannelApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //

View File

@ -36,12 +36,12 @@ import * as SmsLoglApi from '@/api/system/sms/smsLog'
const { t } = useI18n() // const { t } = useI18n() //
// //
const [registerTable, { exportList }] = useXTable({ const [registerTable, { exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsLoglApi.getSmsLogPageApi, getListApi: SmsLoglApi.getSmsLogPageApi,
exportListApi: SmsLoglApi.exportSmsLogApi exportListApi: SmsLoglApi.exportSmsLogApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref(t('action.detail')) // const dialogTitle = ref(t('action.detail')) //

View File

@ -112,18 +112,18 @@
import type { FormExpose } from '@/components/Form' import type { FormExpose } from '@/components/Form'
// import // import
import * as SmsTemplateApi from '@/api/system/sms/smsTemplate' import * as SmsTemplateApi from '@/api/system/sms/smsTemplate'
import { rules, allSchemas } from './sms.template.data' import { allSchemas, rules } from './sms.template.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: SmsTemplateApi.getSmsTemplatePageApi, getListApi: SmsTemplateApi.getSmsTemplatePageApi,
deleteApi: SmsTemplateApi.deleteSmsTemplateApi deleteApi: SmsTemplateApi.deleteSmsTemplateApi
}) })
useAdaptiveXTable([setProps])
// //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('edit') // const dialogTitle = ref('edit') //
@ -156,8 +156,7 @@ const handleUpdate = async (rowId: number) => {
const handleDetail = async (rowId: number) => { const handleDetail = async (rowId: number) => {
setDialogTile('detail') setDialogTile('detail')
// //
const res = await SmsTemplateApi.getSmsTemplateApi(rowId) detailData.value = await SmsTemplateApi.getSmsTemplateApi(rowId)
detailData.value = res
} }
// //

View File

@ -93,13 +93,13 @@ import { rules, allSchemas, tenantPackageOption } from './tenant.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: TenantApi.getTenantPageApi, getListApi: TenantApi.getTenantPageApi,
deleteApi: TenantApi.deleteTenantApi, deleteApi: TenantApi.deleteTenantApi,
exportListApi: TenantApi.exportTenantApi exportListApi: TenantApi.exportTenantApi
}) })
useAdaptiveXTable([setProps])
const actionLoading = ref(false) // const actionLoading = ref(false) //
const actionType = ref('') // const actionType = ref('') //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //

View File

@ -106,12 +106,12 @@ const getTree = async () => {
menuOptions.value = handleTree(res) menuOptions.value = handleTree(res)
} }
const [registerTable, { reload, deleteData }] = useXTable({ const [registerTable, { reload, deleteData, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
getListApi: TenantPackageApi.getTenantPackageTypePageApi, getListApi: TenantPackageApi.getTenantPackageTypePageApi,
deleteApi: TenantPackageApi.deleteTenantPackageTypeApi deleteApi: TenantPackageApi.deleteTenantPackageTypeApi
}) })
useAdaptiveXTable([setProps])
// //
const setDialogTile = (type: string) => { const setDialogTile = (type: string) => {
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="flex"> <div class="flex">
<el-card class="w-1/5 user" :gutter="12" shadow="always"> <el-card class="w-1/5" :gutter="12" shadow="always">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>部门列表</span> <span>部门列表</span>
@ -8,7 +8,7 @@
</div> </div>
</template> </template>
<el-input v-model="filterText" placeholder="搜索部门" /> <el-input v-model="filterText" placeholder="搜索部门" />
<el-scrollbar height="650"> <el-scrollbar>
<el-tree <el-tree
ref="treeRef" ref="treeRef"
node-key="id" node-key="id"
@ -22,7 +22,7 @@
/> />
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
<el-card class="w-4/5 user" style="margin-left: 10px" :gutter="12" shadow="hover"> <el-card class="w-4/5" style="margin-left: 10px" :gutter="12" shadow="hover">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>{{ tableTitle }}</span> <span>{{ tableTitle }}</span>
@ -147,7 +147,7 @@
v-for="item in postOptions" v-for="item in postOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="(item.id as unknown as number)" :value="item.id"
/> />
</el-select> </el-select>
</template> </template>
@ -169,7 +169,7 @@
</template> </template>
</el-tag> </el-tag>
</template> </template>
<template v-else> </template> <template v-else></template>
</template> </template>
</Descriptions> </Descriptions>
<!-- 操作按钮 --> <!-- 操作按钮 -->
@ -289,13 +289,14 @@ const queryParams = reactive({
// ========== ========== // ========== ==========
const tableTitle = ref('用户列表') const tableTitle = ref('用户列表')
// //
const [registerTable, { reload, deleteData, exportList }] = useXTable({ const [registerTable, { reload, deleteData, exportList, setProps }] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
params: queryParams, params: queryParams,
getListApi: UserApi.getUserPageApi, getListApi: UserApi.getUserPageApi,
deleteApi: UserApi.deleteUserApi, deleteApi: UserApi.deleteUserApi,
exportListApi: UserApi.exportUserApi exportListApi: UserApi.exportUserApi
}) })
useAdaptiveXTable([setProps], 'Card')
// ========== ========== // ========== ==========
const filterText = ref('') const filterText = ref('')
const deptOptions = ref<Tree[]>([]) // const deptOptions = ref<Tree[]>([]) //
@ -332,26 +333,24 @@ const getPostOptions = async () => {
const res = await listSimplePostsApi() const res = await listSimplePostsApi()
postOptions.value.push(...res) postOptions.value.push(...res)
} }
const dataFormater = (val) => { const dataFormater = computed(() => (deptId: number) => deptFormater(deptOptions.value, deptId))
return deptFormater(deptOptions.value, val)
}
// //
const deptFormater = (ary, val: any) => { const deptFormater = (arr: Tree[], deptId: number) => {
var o = '' let deptName = ''
if (ary && val) { if (arr && deptId) {
for (const v of ary) { for (const item of arr) {
if (v.id == val) { if (item.id === deptId) {
o = v.name deptName = item.name
if (o) return o break
} else if (v.children?.length) { }
o = deptFormater(v.children, val) if (item.children) {
if (o) return o deptName = deptFormater(item.children, deptId) ?? ''
break
} }
} }
return o
} else {
return val
} }
return deptName
} }
// //
@ -363,7 +362,7 @@ const setDialogTile = async (type: string) => {
// //
const handleCreate = async () => { const handleCreate = async () => {
setDialogTile('create') await setDialogTile('create')
// //
await nextTick() await nextTick()
if (allSchemas.formSchema[0].field !== 'username') { if (allSchemas.formSchema[0].field !== 'username') {
@ -388,7 +387,7 @@ const handleCreate = async () => {
// //
const handleUpdate = async (rowId: number) => { const handleUpdate = async (rowId: number) => {
setDialogTile('update') await setDialogTile('update')
await nextTick() await nextTick()
unref(formRef)?.delSchema('username') unref(formRef)?.delSchema('username')
unref(formRef)?.delSchema('password') unref(formRef)?.delSchema('password')
@ -569,10 +568,6 @@ onMounted(async () => {
</script> </script>
<style scoped> <style scoped>
.user {
height: 780px;
max-height: 800px;
}
.card-header { .card-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -1,7 +1,7 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
// 国际化 // 国际化
const { t } = useI18n() const { t } = useI18n()
const validateMobile = (rule: any, value: any, callback: any) => { const validateMobile = (_, value: any, callback: any) => {
const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/ const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
if (value === '') { if (value === '') {
callback(new Error('请输入联系手机')) callback(new Error('请输入联系手机'))
@ -13,7 +13,7 @@ const validateMobile = (rule: any, value: any, callback: any) => {
} }
} }
} }
const validatePassword = (rule: any, value: any, callback: any) => { const validatePassword = (_, value: any, callback: any) => {
const reg = /^(?! +$).+/ const reg = /^(?! +$).+/
if (value === '') { if (value === '') {
callback(new Error('请输入用户密码')) callback(new Error('请输入用户密码'))