Commit 4b60dae14433f15b19d30415aa220544c31909a8
Merge branch 'ft' into 'main_dev'
Ft See merge request yunteng/thingskit-front!846
Showing
5 changed files
with
38 additions
and
17 deletions
| @@ -66,7 +66,7 @@ export interface RoleReqDTO { | @@ -66,7 +66,7 @@ export interface RoleReqDTO { | ||
| 66 | name?: string; | 66 | name?: string; |
| 67 | remark?: string; | 67 | remark?: string; |
| 68 | status: number; | 68 | status: number; |
| 69 | - menu: Array<string>; | 69 | + menu: Array<string | number>; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | export interface ChangeAccountParams { | 72 | export interface ChangeAccountParams { |
| @@ -102,7 +102,12 @@ | @@ -102,7 +102,12 @@ | ||
| 102 | <template> | 102 | <template> |
| 103 | <StepContainer> | 103 | <StepContainer> |
| 104 | <div class="">设备文件</div> | 104 | <div class="">设备文件</div> |
| 105 | - <Upload.Dragger :fileList="fileList" :customRequest="handleParseFile" accept=".csv" name="file"> | 105 | + <Upload.Dragger |
| 106 | + v-model:fileList="fileList" | ||
| 107 | + :customRequest="handleParseFile" | ||
| 108 | + accept=".csv" | ||
| 109 | + name="file" | ||
| 110 | + > | ||
| 106 | <section class="cursor-pointer flex flex-col justify-center items-center"> | 111 | <section class="cursor-pointer flex flex-col justify-center items-center"> |
| 107 | <InboxOutlined class="text-[4rem] !text-blue-400" /> | 112 | <InboxOutlined class="text-[4rem] !text-blue-400" /> |
| 108 | <div class="text-gray-500">点击上传或拖拽上传</div> | 113 | <div class="text-gray-500">点击上传或拖拽上传</div> |
| @@ -68,7 +68,7 @@ export const formSchemas: FormSchema[] = [ | @@ -68,7 +68,7 @@ export const formSchemas: FormSchema[] = [ | ||
| 68 | componentProps: { | 68 | componentProps: { |
| 69 | placeholder: '请输入标识符', | 69 | placeholder: '请输入标识符', |
| 70 | }, | 70 | }, |
| 71 | - colProps: { span: 6 }, | 71 | + colProps: { span: 7 }, |
| 72 | }, | 72 | }, |
| 73 | { | 73 | { |
| 74 | field: 'eventType', | 74 | field: 'eventType', |
| @@ -83,7 +83,7 @@ export const formSchemas: FormSchema[] = [ | @@ -83,7 +83,7 @@ export const formSchemas: FormSchema[] = [ | ||
| 83 | labelField: 'itemText', | 83 | labelField: 'itemText', |
| 84 | valueField: 'itemValue', | 84 | valueField: 'itemValue', |
| 85 | }, | 85 | }, |
| 86 | - colProps: { span: 6 }, | 86 | + colProps: { span: 7 }, |
| 87 | }, | 87 | }, |
| 88 | { | 88 | { |
| 89 | field: 'dateRange', | 89 | field: 'dateRange', |
| @@ -94,6 +94,6 @@ export const formSchemas: FormSchema[] = [ | @@ -94,6 +94,6 @@ export const formSchemas: FormSchema[] = [ | ||
| 94 | defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], | 94 | defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], |
| 95 | }, | 95 | }, |
| 96 | }, | 96 | }, |
| 97 | - colProps: { span: 6 }, | 97 | + colProps: { span: 7 }, |
| 98 | }, | 98 | }, |
| 99 | ]; | 99 | ]; |
| @@ -110,14 +110,20 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -110,14 +110,20 @@ export const tenantFormSchema: FormSchema[] = [ | ||
| 110 | label: '租户角色', | 110 | label: '租户角色', |
| 111 | component: 'ApiSelect', | 111 | component: 'ApiSelect', |
| 112 | required: true, | 112 | required: true, |
| 113 | - componentProps: { | ||
| 114 | - mode: 'multiple', | ||
| 115 | - api: getAllRoleList, | ||
| 116 | - params: { | ||
| 117 | - roleType: RoleEnum.TENANT_ADMIN, | ||
| 118 | - }, | ||
| 119 | - labelField: 'name', | ||
| 120 | - valueField: 'id', | 113 | + componentProps: () => { |
| 114 | + return { | ||
| 115 | + api: async () => { | ||
| 116 | + const res = await getAllRoleList({ roleType: RoleEnum.TENANT_ADMIN }); | ||
| 117 | + return res; | ||
| 118 | + }, | ||
| 119 | + mode: 'multiple', | ||
| 120 | + showSearch: true, | ||
| 121 | + labelField: 'name', | ||
| 122 | + valueField: 'id', | ||
| 123 | + filterOption: (inputValue: string, options: Record<'label' | 'value', string>) => { | ||
| 124 | + return options.label.toLowerCase().includes(inputValue.toLowerCase()); | ||
| 125 | + }, | ||
| 126 | + }; | ||
| 121 | }, | 127 | }, |
| 122 | }, | 128 | }, |
| 123 | { | 129 | { |
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | import { BasicForm, useForm } from '/@/components/Form/index'; | 32 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 33 | import { formSchema } from './role.data'; | 33 | import { formSchema } from './role.data'; |
| 34 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 34 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 35 | - import { BasicTree, CheckEvent, TreeActionType, TreeItem } from '/@/components/Tree'; | 35 | + import { BasicTree, CheckEvent, TreeActionType, TreeItem, CheckKeys } from '/@/components/Tree'; |
| 36 | const { t } = useI18n(); //加载国际化 | 36 | const { t } = useI18n(); //加载国际化 |
| 37 | // 加载菜单数据 | 37 | // 加载菜单数据 |
| 38 | import { getAdminMenuList, getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; | 38 | import { getAdminMenuList, getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; |
| @@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
| 60 | const treeRef = ref<Nullable<TreeActionType>>(null); | 60 | const treeRef = ref<Nullable<TreeActionType>>(null); |
| 61 | const checked = ref<string[]>([]); //需要选中的节点 | 61 | const checked = ref<string[]>([]); //需要选中的节点 |
| 62 | const spinning = ref(false); | 62 | const spinning = ref(false); |
| 63 | - const checkedKeysWithHalfChecked = ref<string[]>([]); | 63 | + const checkedKeysWithHalfChecked = ref<(string | number)[]>([]); |
| 64 | 64 | ||
| 65 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ | 65 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
| 66 | labelWidth: 90, | 66 | labelWidth: 90, |
| @@ -137,7 +137,12 @@ | @@ -137,7 +137,12 @@ | ||
| 137 | async function handleSubmit() { | 137 | async function handleSubmit() { |
| 138 | setDrawerProps({ loading: true, confirmLoading: true }); | 138 | setDrawerProps({ loading: true, confirmLoading: true }); |
| 139 | const { createMessage } = useMessage(); | 139 | const { createMessage } = useMessage(); |
| 140 | - const treeCheckedKeys: string[] = (unref(treeRef)?.getCheckedKeys() as string[]) || []; | 140 | + let treeCheckedKeys: string[] | CheckKeys = |
| 141 | + (unref(treeRef)?.getCheckedKeys() as string[] | CheckKeys) || []; | ||
| 142 | + //fix 取消层级独立后(unref(treeRef)?.getCheckedKeys() as string[])的数据不是数组,是{checked:[],halfChecked:[]}对象,迭代报错 | ||
| 143 | + if (!Array.isArray(treeCheckedKeys)) { | ||
| 144 | + treeCheckedKeys = treeCheckedKeys?.checked; | ||
| 145 | + } | ||
| 141 | const menu = [...new Set([...unref(checkedKeysWithHalfChecked), ...treeCheckedKeys])]; | 146 | const menu = [...new Set([...unref(checkedKeysWithHalfChecked), ...treeCheckedKeys])]; |
| 142 | try { | 147 | try { |
| 143 | const values = await validate(); | 148 | const values = await validate(); |
| @@ -237,7 +242,12 @@ | @@ -237,7 +242,12 @@ | ||
| 237 | return needExcludeKeys; | 242 | return needExcludeKeys; |
| 238 | }; | 243 | }; |
| 239 | 244 | ||
| 240 | - const handleCheckClick = (selectedKeys: string[], event: CheckEvent) => { | 245 | + const handleCheckClick = (selectedKeys: CheckKeys, event: CheckEvent) => { |
| 246 | + //fix 取消层级独立后selectedKeys不是数组,是{checked:[],halfChecked:[]}对象 迭代报错 | ||
| 247 | + if (!Array.isArray(selectedKeys)) { | ||
| 248 | + selectedKeys = selectedKeys?.checked; | ||
| 249 | + event.halfCheckedKeys = []; | ||
| 250 | + } | ||
| 241 | checkedKeysWithHalfChecked.value = [ | 251 | checkedKeysWithHalfChecked.value = [ |
| 242 | ...selectedKeys, | 252 | ...selectedKeys, |
| 243 | ...(event.halfCheckedKeys as string[]), | 253 | ...(event.halfCheckedKeys as string[]), |