|  |  |  | 
|---|
|  |  |  | <AppContainer> | 
|---|
|  |  |  | <ProTableQueryFilterBar @on-reset="handleReset"> | 
|---|
|  |  |  | <template #query> | 
|---|
|  |  |  | <QueryFilterItem> | 
|---|
|  |  |  | <FieldRadio | 
|---|
|  |  |  | v-model="state.clientType" | 
|---|
|  |  |  | :value-enum="EnumClientTypeText" | 
|---|
|  |  |  | buttonStyle | 
|---|
|  |  |  | @change="getAllModule()" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </QueryFilterItem> | 
|---|
|  |  |  | <QueryFilterItem> | 
|---|
|  |  |  | <FieldRadio | 
|---|
|  |  |  | v-model="state.userType" | 
|---|
|  |  |  | :value-enum="EnumUserTypeText" | 
|---|
|  |  |  | buttonStyle | 
|---|
|  |  |  | @change="getAllModule()" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </QueryFilterItem> | 
|---|
|  |  |  | <div class="query-filter-list-item"> | 
|---|
|  |  |  | <SearchInput | 
|---|
|  |  |  | v-model="state.searchValue" | 
|---|
|  |  |  | 
|---|
|  |  |  | row.type=v?EnumMenuType.Menu:EnumMenuType.Page | 
|---|
|  |  |  | }" | 
|---|
|  |  |  | inline-prompt | 
|---|
|  |  |  | @change="(v: number) => handleChangeStatus(v, row, 'isMenu')" | 
|---|
|  |  |  | @change="(v: boolean) => handleChangeStatus(v, row, 'isMenu')" | 
|---|
|  |  |  | ></el-switch> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | <template v-else-if="column.property === 'enabledMark'"> | 
|---|
|  |  |  | <el-switch | 
|---|
|  |  |  | :modelValue="!row.isDisabled" | 
|---|
|  |  |  | :onUpdate:modelValue="(v: boolean) => row.isDisabled =!v" | 
|---|
|  |  |  | @change="(v: number) => handleChangeStatus(v, row, 'enabledMark')" | 
|---|
|  |  |  | @change="(v: boolean) => handleChangeStatus(v, row, 'enabledMark')" | 
|---|
|  |  |  | ></el-switch> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | LoadingLayout, | 
|---|
|  |  |  | OperationBtnType, | 
|---|
|  |  |  | SearchInput, | 
|---|
|  |  |  | QueryFilterItem, | 
|---|
|  |  |  | FieldRadio, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import { ModuleUtils, TreeModuleDtoGroupDto, Message, TreeStore, flattenTree } from '@/utils'; | 
|---|
|  |  |  | import { TableInstance } from 'element-plus'; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | type StatusEventType = { | 
|---|
|  |  |  | isCache: boolean; | 
|---|
|  |  |  | isMenu: number; | 
|---|
|  |  |  | enabledMark: number; | 
|---|
|  |  |  | isMenu: boolean; | 
|---|
|  |  |  | enabledMark: boolean; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | async function handleChangeStatus<T extends keyof StatusEventType>( | 
|---|
|  |  |  | value: StatusEventType[T], | 
|---|
|  |  |  | value: boolean, | 
|---|
|  |  |  | data: TreeModuleDtoGroupDto, | 
|---|
|  |  |  | statusType: T | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // let params = { | 
|---|
|  |  |  | //   ..._.omit(data, ['children', 'parentNode']), | 
|---|
|  |  |  | //   [statusType]: value, | 
|---|
|  |  |  | // }; | 
|---|
|  |  |  | // await baseModuleServices.addOrEditModule(params); | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | Message.errorMessage('操作失败'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let params: API.SetMenuSwitchCommand = { | 
|---|
|  |  |  | ids: [data.id], | 
|---|
|  |  |  | type: data.type, | 
|---|
|  |  |  | isDisabled: data.isDisabled, | 
|---|
|  |  |  | isCache: data.isCache, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | if (statusType === 'isMenu') { | 
|---|
|  |  |  | params.type = value ? EnumMenuType.Menu : EnumMenuType.Page; | 
|---|
|  |  |  | } else if (statusType === 'isCache') { | 
|---|
|  |  |  | params.isCache = value; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | params.isDisabled = !value; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | await menuServices.setMenuSwitch(params); | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function getMenu(id: string) { | 
|---|
|  |  |  | 
|---|
|  |  |  | name: subModule.name, | 
|---|
|  |  |  | group: state.group, | 
|---|
|  |  |  | // location: 'string', | 
|---|
|  |  |  | width: subModule.width, | 
|---|
|  |  |  | width: subModule.width.toString(), | 
|---|
|  |  |  | sort: subModule.sortCode, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | if (subModule.id) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (drawerState.type === SubModuleType.Column) { | 
|---|
|  |  |  | let columnModuleList = drawerState.tableData; //.filter((d) => d.isEdit); | 
|---|
|  |  |  | if (columnModuleList.length > 0) { | 
|---|
|  |  |  | const groups = currentDrawerModule.value.groups.map((group) => { | 
|---|
|  |  |  | if (group.group === state.group) { | 
|---|
|  |  |  | group.fields = columnModuleList.map((c) => ({ | 
|---|
|  |  |  | let groups = [...currentDrawerModule.value.groups]; | 
|---|
|  |  |  | const isExist = groups.some((g) => g.group === state.group); | 
|---|
|  |  |  | if (isExist) { | 
|---|
|  |  |  | groups = groups.map((group) => { | 
|---|
|  |  |  | if (group.group === state.group) { | 
|---|
|  |  |  | group.fields = columnModuleList.map((c) => ({ | 
|---|
|  |  |  | code: c.enCode, | 
|---|
|  |  |  | name: c.name, | 
|---|
|  |  |  | width: c.width.toString(), | 
|---|
|  |  |  | sort: c.sortCode, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return group; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | const group: API.GetMenuQueryResultGroup = { | 
|---|
|  |  |  | group: state.group, | 
|---|
|  |  |  | fields: columnModuleList.map((c) => ({ | 
|---|
|  |  |  | code: c.enCode, | 
|---|
|  |  |  | name: c.name, | 
|---|
|  |  |  | width: c.width, | 
|---|
|  |  |  | width: c.width.toString(), | 
|---|
|  |  |  | sort: c.sortCode, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return group; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | })), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | groups.push(group); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let params: API.SaveMenuCommand = { | 
|---|
|  |  |  | ...currentDrawerModule.value, | 
|---|
|  |  |  | groups: groups, | 
|---|