Commit 82c219cf57b4ec086c171b2c0e1c515bfa58d517
1 parent
48808a47
fix:修改密码和角色回显 feat:新增场景联动接口,待联调 wip:开发场景联动中
Showing
9 changed files
with
445 additions
and
234 deletions
1 | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
2 | 2 | |
3 | -export type ScreenLinkPageTableQueryParam = BasicPageParams; | |
4 | -export interface ScreenModel { | |
5 | - name: string; | |
6 | - act: number; | |
7 | - stu: number; | |
8 | - desc: string; | |
9 | - createTime: string; | |
3 | +export type ScreenLinkPageTableQueryParam = BasicPageParams & ScreenParam; | |
4 | + | |
5 | +export type ScreenParam = { | |
6 | + name?: string; | |
7 | + other?: string; | |
8 | +}; | |
9 | +export interface ScreenAddModel { | |
10 | + createTime?: '2021-11-29T09:13:38.810Z'; | |
11 | + creator?: 'string'; | |
12 | + defaultConfig?: 'string'; | |
13 | + description?: 'string'; | |
14 | + doAction?: [ | |
15 | + { | |
16 | + command: 'string'; | |
17 | + createTime: '2021-11-29T09:13:38.810Z'; | |
18 | + creator: 'string'; | |
19 | + defaultConfig: 'string'; | |
20 | + description: 'string'; | |
21 | + deviceId: 'string'; | |
22 | + enabled: true; | |
23 | + icon: 'string'; | |
24 | + id: 'string'; | |
25 | + name: 'string'; | |
26 | + outPut: 'string'; | |
27 | + outTarget: 'string'; | |
28 | + roleIds: ['string']; | |
29 | + tenantCode: 'string'; | |
30 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
31 | + tenantId: 'string'; | |
32 | + tenantStatus: 'DISABLED'; | |
33 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
34 | + updater: 'string'; | |
35 | + } | |
36 | + ]; | |
37 | + doCondition?: [ | |
38 | + { | |
39 | + compare: 0; | |
40 | + createTime: '2021-11-29T09:13:38.811Z'; | |
41 | + creator: 'string'; | |
42 | + defaultConfig: 'string'; | |
43 | + description: 'string'; | |
44 | + deviceId: 'string'; | |
45 | + enabled: true; | |
46 | + icon: 'string'; | |
47 | + id: 'string'; | |
48 | + name: 'string'; | |
49 | + property: 'string'; | |
50 | + roleIds: ['string']; | |
51 | + status: 'string'; | |
52 | + tenantCode: 'string'; | |
53 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
54 | + tenantId: 'string'; | |
55 | + tenantStatus: 'DISABLED'; | |
56 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
57 | + updater: 'string'; | |
58 | + value: 'string'; | |
59 | + } | |
60 | + ]; | |
61 | + enabled?: true; | |
62 | + icon?: 'string'; | |
63 | + id?: 'string'; | |
64 | + name?: 'string'; | |
65 | + organizationId?: 'string'; | |
66 | + roleIds?: ['string']; | |
67 | + status?: 'string'; | |
68 | + tenantCode?: 'string'; | |
69 | + tenantExpireTime?: '2021-11-29T09:13:38.811Z'; | |
70 | + tenantId?: 'string'; | |
71 | + tenantStatus?: 'DISABLED'; | |
72 | + triggers?: [ | |
73 | + { | |
74 | + attributeChoose: 'string'; | |
75 | + compare: 0; | |
76 | + createTime: '2021-11-29T09:13:38.811Z'; | |
77 | + creator: 'string'; | |
78 | + defaultConfig: 'string'; | |
79 | + description: 'string'; | |
80 | + deviceId: 'string'; | |
81 | + enabled: true; | |
82 | + icon: 'string'; | |
83 | + id: 'string'; | |
84 | + name: 'string'; | |
85 | + roleIds: ['string']; | |
86 | + tenantCode: 'string'; | |
87 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
88 | + tenantId: 'string'; | |
89 | + tenantStatus: 'DISABLED'; | |
90 | + tiggerEvent: 'string'; | |
91 | + touchWay: 'string'; | |
92 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
93 | + updater: 'string'; | |
94 | + value: 'string'; | |
95 | + } | |
96 | + ]; | |
97 | + updateTime?: '2021-11-29T09:13:38.811Z'; | |
98 | + updater?: 'string'; | |
99 | +} | |
100 | + | |
101 | +export interface ScreenUpdateModel { | |
102 | + createTime?: '2021-11-29T09:13:38.810Z'; | |
103 | + creator?: 'string'; | |
104 | + defaultConfig?: 'string'; | |
105 | + description?: 'string'; | |
106 | + doAction?: [ | |
107 | + { | |
108 | + command: 'string'; | |
109 | + createTime: '2021-11-29T09:13:38.810Z'; | |
110 | + creator: 'string'; | |
111 | + defaultConfig: 'string'; | |
112 | + description: 'string'; | |
113 | + deviceId: 'string'; | |
114 | + enabled: true; | |
115 | + icon: 'string'; | |
116 | + id: 'string'; | |
117 | + name: 'string'; | |
118 | + outPut: 'string'; | |
119 | + outTarget: 'string'; | |
120 | + roleIds: ['string']; | |
121 | + tenantCode: 'string'; | |
122 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
123 | + tenantId: 'string'; | |
124 | + tenantStatus: 'DISABLED'; | |
125 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
126 | + updater: 'string'; | |
127 | + } | |
128 | + ]; | |
129 | + doCondition?: [ | |
130 | + { | |
131 | + compare: 0; | |
132 | + createTime: '2021-11-29T09:13:38.811Z'; | |
133 | + creator: 'string'; | |
134 | + defaultConfig: 'string'; | |
135 | + description: 'string'; | |
136 | + deviceId: 'string'; | |
137 | + enabled: true; | |
138 | + icon: 'string'; | |
139 | + id: 'string'; | |
140 | + name: 'string'; | |
141 | + property: 'string'; | |
142 | + roleIds: ['string']; | |
143 | + status: 'string'; | |
144 | + tenantCode: 'string'; | |
145 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
146 | + tenantId: 'string'; | |
147 | + tenantStatus: 'DISABLED'; | |
148 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
149 | + updater: 'string'; | |
150 | + value: 'string'; | |
151 | + } | |
152 | + ]; | |
153 | + enabled?: true; | |
154 | + icon?: 'string'; | |
155 | + id?: 'string'; | |
156 | + name?: 'string'; | |
157 | + organizationId?: 'string'; | |
158 | + roleIds?: ['string']; | |
159 | + status?: 'string'; | |
160 | + tenantCode?: 'string'; | |
161 | + tenantExpireTime?: '2021-11-29T09:13:38.811Z'; | |
162 | + tenantId?: 'string'; | |
163 | + tenantStatus?: 'DISABLED'; | |
164 | + triggers?: [ | |
165 | + { | |
166 | + attributeChoose: 'string'; | |
167 | + compare: 0; | |
168 | + createTime: '2021-11-29T09:13:38.811Z'; | |
169 | + creator: 'string'; | |
170 | + defaultConfig: 'string'; | |
171 | + description: 'string'; | |
172 | + deviceId: 'string'; | |
173 | + enabled: true; | |
174 | + icon: 'string'; | |
175 | + id: 'string'; | |
176 | + name: 'string'; | |
177 | + roleIds: ['string']; | |
178 | + tenantCode: 'string'; | |
179 | + tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
180 | + tenantId: 'string'; | |
181 | + tenantStatus: 'DISABLED'; | |
182 | + tiggerEvent: 'string'; | |
183 | + touchWay: 'string'; | |
184 | + updateTime: '2021-11-29T09:13:38.811Z'; | |
185 | + updater: 'string'; | |
186 | + value: 'string'; | |
187 | + } | |
188 | + ]; | |
189 | + updateTime?: '2021-11-29T09:13:38.811Z'; | |
190 | + updater?: 'string'; | |
10 | 191 | } | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | -import { ScreenLinkPageTableQueryParam } from '/@/api/ruleengine/model/ruleengineModel'; | |
2 | +import { | |
3 | + ScreenLinkPageTableQueryParam, | |
4 | + ScreenAddModel, | |
5 | + ScreenUpdateModel, | |
6 | +} from '/@/api/ruleengine/model/ruleengineModel'; | |
3 | 7 | |
4 | 8 | enum ScreenManagerApi { |
5 | 9 | /** |
6 | 10 | * 场景URL |
7 | 11 | */ |
8 | - SCREEN_URL = '/getTable', | |
12 | + SCREEN_GET_URL = '/sceneLinkage', | |
13 | + SCREEN_ADD_URL = '/sceneLinkage', | |
14 | + SCREEN_DELETE_URL = '/sceneLinkage', | |
15 | + SCREEN_UPDATE_URL = '/sceneLinkage/update', | |
9 | 16 | } |
10 | 17 | |
11 | 18 | /** |
12 | 19 | * 分页查询场景联动表格页面 |
13 | 20 | * @param params pageSize page name |
14 | 21 | */ |
15 | -export const screenLinkPageApi = () => { | |
22 | +export const screenLinkPageGetApi = () => { | |
16 | 23 | return defHttp.get<ScreenLinkPageTableQueryParam>({ |
17 | - url: ScreenManagerApi.SCREEN_URL, | |
24 | + url: ScreenManagerApi.SCREEN_GET_URL, | |
18 | 25 | }); |
19 | 26 | }; |
20 | 27 | |
21 | -//模拟数据 | |
22 | -export const screenLinkPageApiList = () => { | |
23 | - return [ | |
24 | - { | |
25 | - id: '10001', | |
26 | - name: '李丽', | |
27 | - act: 1, | |
28 | - stu: '启用', | |
29 | - desc: '好的好的', | |
30 | - createTime: '2021-11-20', | |
31 | - }, | |
32 | - { | |
33 | - id: '10002', | |
34 | - name: '史芳', | |
35 | - act: 1, | |
36 | - stu: '停用', | |
37 | - desc: '好的好的', | |
38 | - createTime: '2021-11-20', | |
39 | - }, | |
40 | - { | |
41 | - id: '10003', | |
28 | +/** | |
29 | + * 新增场景联动 | |
30 | + * @param params pageSize page name | |
31 | + */ | |
32 | +export const screenLinkPageAddApi = (params: ScreenAddModel) => { | |
33 | + return defHttp.post<ScreenLinkPageTableQueryParam>({ | |
34 | + url: ScreenManagerApi.SCREEN_ADD_URL, | |
35 | + params, | |
36 | + }); | |
37 | +}; | |
42 | 38 | |
43 | - name: '程强', | |
44 | - act: 1, | |
45 | - stu: '启用', | |
46 | - desc: '好的好的', | |
47 | - createTime: '2021-11-20', | |
48 | - }, | |
49 | - { | |
50 | - id: '10004', | |
51 | - name: '罗敏', | |
52 | - act: 1, | |
53 | - stu: '停用', | |
54 | - desc: '好的好的', | |
55 | - createTime: '2021-11-20', | |
56 | - }, | |
57 | - { | |
58 | - id: '10005', | |
59 | - name: '蔡杰', | |
60 | - act: 1, | |
61 | - stu: '停用', | |
62 | - desc: '好的好的', | |
63 | - createTime: '2021-11-20', | |
39 | +/** | |
40 | + * 更新场景联动 | |
41 | + * @param params pageSize page name | |
42 | + */ | |
43 | +export const screenLinkPageUpdateApi = (params: ScreenUpdateModel) => { | |
44 | + return defHttp.post<ScreenLinkPageTableQueryParam>({ | |
45 | + url: ScreenManagerApi.SCREEN_UPDATE_URL, | |
46 | + params, | |
47 | + }); | |
48 | +}; | |
49 | + | |
50 | +/** | |
51 | + * 删除场景联动 | |
52 | + * @param params pageSize page name | |
53 | + */ | |
54 | +export const screenLinkPageDeleteApi = (ids: string[]) => { | |
55 | + return defHttp.delete({ | |
56 | + url: ScreenManagerApi.SCREEN_DELETE_URL, | |
57 | + data: { | |
58 | + ids: ids, | |
64 | 59 | }, |
65 | - ]; | |
60 | + }); | |
66 | 61 | }; | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
2 | -import {getMenuListResultModel} from './model/menuModel'; | |
3 | -import {useUserStore} from '/@/store/modules/user'; | |
4 | -import {RoleEnum} from '/@/enums/roleEnum'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { getMenuListResultModel } from './model/menuModel'; | |
3 | +import { useUserStore } from '/@/store/modules/user'; | |
4 | +import { RoleEnum } from '/@/enums/roleEnum'; | |
5 | 5 | |
6 | 6 | enum Api { |
7 | 7 | BaseMenuUrl = '/menu', |
8 | 8 | GetMenuList = '/menu/me/menus', |
9 | 9 | SysAdminMenuList = '/admin/me/menus', |
10 | - GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/' | |
10 | + GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/', | |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
... | ... | @@ -17,17 +17,17 @@ enum Api { |
17 | 17 | export const getMenuList = () => { |
18 | 18 | const userStore = useUserStore(); |
19 | 19 | let url = Api.GetMenuList; |
20 | - if (userStore.getRoleList.find(v => v == RoleEnum.ROLE_SYS_ADMIN)) { | |
20 | + if (userStore.getRoleList.find((v) => v == RoleEnum.ROLE_SYS_ADMIN)) { | |
21 | 21 | url = Api.SysAdminMenuList; |
22 | 22 | } |
23 | - return defHttp.get<getMenuListResultModel>({url: url}); | |
23 | + return defHttp.get<getMenuListResultModel>({ url: url }); | |
24 | 24 | }; |
25 | 25 | |
26 | 26 | export const delMenu = (menuIds: string[]) => { |
27 | 27 | let url = Api.BaseMenuUrl; |
28 | - return defHttp.delete({url: url, data: menuIds}) | |
29 | -} | |
28 | + return defHttp.delete({ url: url, data: menuIds }); | |
29 | +}; | |
30 | 30 | export const getMenusIdsByRoleId = (roleId: string) => { |
31 | 31 | let url = Api.GetMenuIdsByRoleId + roleId; |
32 | - return defHttp.get<Array<string>>({url: url}); | |
33 | -} | |
32 | + return defHttp.get<Array<string>>({ url: url }); | |
33 | +}; | ... | ... |
... | ... | @@ -16,10 +16,31 @@ |
16 | 16 | <SaleRadar :loading="loading" class="enter-y" /> |
17 | 17 | </div> |
18 | 18 | </div> |
19 | + <BasicModal | |
20 | + @register="register" | |
21 | + v-bind="$attrs" | |
22 | + :mask="true" | |
23 | + :showCancelBtn="false" | |
24 | + :showOkBtn="false" | |
25 | + :canFullscreen="false" | |
26 | + :closable="false" | |
27 | + :maskStyle="maskColor" | |
28 | + :height="600" | |
29 | + :width="1500" | |
30 | + :maskClosable="false" | |
31 | + title="请修改密码" | |
32 | + :helpMessage="['请您修改密码']" | |
33 | + > | |
34 | + <PasswordDialog /> | |
35 | + </BasicModal> | |
19 | 36 | </PageWrapper> |
20 | 37 | </template> |
21 | 38 | <script lang="ts" setup> |
22 | - import { ref } from 'vue'; | |
39 | + import PasswordDialog from '/@/views/system/password/index.vue'; | |
40 | + import { BasicModal, useModal } from '/@/components/Modal'; | |
41 | + import { getAuthCache } from '/@/utils/auth'; | |
42 | + import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | |
43 | + import { ref, onMounted } from 'vue'; | |
23 | 44 | import { Card } from 'ant-design-vue'; |
24 | 45 | import { PageWrapper } from '/@/components/Page'; |
25 | 46 | import WorkbenchHeader from './components/WorkbenchHeader.vue'; |
... | ... | @@ -28,8 +49,23 @@ |
28 | 49 | import DynamicInfo from './components/DynamicInfo.vue'; |
29 | 50 | import SaleRadar from './components/SaleRadar.vue'; |
30 | 51 | |
31 | - const loading = ref(true); | |
32 | - | |
52 | + const maskColor = ref({ backgroundColor: 'grey' }); | |
53 | + const statusModel = ref(false); | |
54 | + const [register, { openModal }] = useModal(); | |
55 | + onMounted(() => { | |
56 | + const userInfo: object = getAuthCache(USER_INFO_KEY); | |
57 | + if (userInfo.needSetPwd == true) { | |
58 | + statusModel.value = true; | |
59 | + openModal(statusModel.value); | |
60 | + } else if (userInfo.needSetPwd == false) { | |
61 | + openModal(statusModel.value); | |
62 | + } | |
63 | + }); | |
64 | + //Yunteng123456!!! | |
65 | + //Password123456! | |
66 | + //System123456! | |
67 | + //Testrole123456! | |
68 | + const loading = ref(false); | |
33 | 69 | setTimeout(() => { |
34 | 70 | loading.value = false; |
35 | 71 | }, 1500); | ... | ... |
... | ... | @@ -15,7 +15,7 @@ export const columns: BasicColumn[] = [ |
15 | 15 | }, |
16 | 16 | { |
17 | 17 | title: '状态', |
18 | - dataIndex: 'stu', | |
18 | + dataIndex: 'status', | |
19 | 19 | width: 200, |
20 | 20 | component: 'RadioButtonGroup', |
21 | 21 | defaultValue: 0, |
... | ... | @@ -28,7 +28,7 @@ export const columns: BasicColumn[] = [ |
28 | 28 | }, |
29 | 29 | { |
30 | 30 | title: '描述', |
31 | - dataIndex: 'desc', | |
31 | + dataIndex: 'description', | |
32 | 32 | width: 200, |
33 | 33 | }, |
34 | 34 | { |
... | ... | @@ -50,7 +50,7 @@ export const formSchema: FormSchema[] = [ |
50 | 50 | }, |
51 | 51 | }, |
52 | 52 | { |
53 | - field: 'org', | |
53 | + field: 'organizationId', | |
54 | 54 | label: '所属组织', |
55 | 55 | required: true, |
56 | 56 | colProps: { span: 20 }, |
... | ... | @@ -65,7 +65,7 @@ export const formSchema: FormSchema[] = [ |
65 | 65 | }, |
66 | 66 | }, |
67 | 67 | { |
68 | - field: 'desc', | |
68 | + field: 'description', | |
69 | 69 | label: '描述', |
70 | 70 | // colProps: { span: 20 }, |
71 | 71 | component: 'InputTextArea', |
... | ... | @@ -77,7 +77,7 @@ export const formSchema: FormSchema[] = [ |
77 | 77 | |
78 | 78 | export const searchFormSchema: FormSchema[] = [ |
79 | 79 | { |
80 | - field: 'org', | |
80 | + field: 'organizationId', | |
81 | 81 | label: '所属组织', |
82 | 82 | component: 'ApiTreeSelect', |
83 | 83 | componentProps: { |
... | ... | @@ -86,7 +86,7 @@ export const searchFormSchema: FormSchema[] = [ |
86 | 86 | colProps: { span: 7 }, |
87 | 87 | }, |
88 | 88 | { |
89 | - field: 'name1', | |
89 | + field: 'name', | |
90 | 90 | label: '名称', |
91 | 91 | component: 'Input', |
92 | 92 | colProps: { span: 8 }, |
... | ... | @@ -95,7 +95,7 @@ export const searchFormSchema: FormSchema[] = [ |
95 | 95 | }, |
96 | 96 | }, |
97 | 97 | { |
98 | - field: 's1', | |
98 | + field: 'status', | |
99 | 99 | label: '状态', |
100 | 100 | component: 'ApiSelect', |
101 | 101 | componentProps: { | ... | ... |
... | ... | @@ -41,7 +41,12 @@ |
41 | 41 | import SceneLinkAgeDrawer from './useDrawer.vue'; |
42 | 42 | import { columns, searchFormSchema } from './config.d'; |
43 | 43 | import { useMessage } from '/@/hooks/web/useMessage'; |
44 | - import { screenLinkPageApiList } from '/@/api/ruleengine/ruleengineApi'; | |
44 | + import { | |
45 | + screenLinkPageGetApi, | |
46 | + screenLinkPageAddApi, | |
47 | + screenLinkPageUpdateApi, | |
48 | + screenLinkPageDeleteApi, | |
49 | + } from '/@/api/ruleengine/ruleengineApi'; | |
45 | 50 | |
46 | 51 | export default defineComponent({ |
47 | 52 | name: 'DeviceManagement', |
... | ... | @@ -52,7 +57,7 @@ |
52 | 57 | const { createMessage } = useMessage(); |
53 | 58 | const [registerTable, { reload }] = useTable({ |
54 | 59 | title: '', |
55 | - api: screenLinkPageApiList, | |
60 | + api: screenLinkPageGetApi, | |
56 | 61 | columns, |
57 | 62 | formConfig: { |
58 | 63 | labelWidth: 120, | ... | ... |
... | ... | @@ -3,12 +3,12 @@ |
3 | 3 | <!-- register 用于注册 useTable,如果需要使用useTable提供的 api,必须将 register 传入组件的 onRegister--> |
4 | 4 | <!-- @fetch-success接口请求成功后触发 --> |
5 | 5 | <BasicTable @register="registerTable" @fetch-success="onFetchSuccess"> |
6 | - | |
7 | 6 | <!-- 通过模板,加载工具栏 --> |
8 | 7 | <template #toolbar> |
9 | 8 | <a-button type="primary" @click="handleCreate"> |
10 | 9 | {{ getI18nCreateMenu }} |
11 | - </a-button> <!-- 新增菜单--> | |
10 | + </a-button> | |
11 | + <!-- 新增菜单--> | |
12 | 12 | </template> |
13 | 13 | |
14 | 14 | <!-- 表格单项,操作 --> |
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | icon: 'ant-design:delete-outlined', |
24 | 24 | color: 'error', |
25 | 25 | popConfirm: { |
26 | - title: getDeleteTitle(),//是否确认删除//getDeleteTitle() | |
26 | + title: getDeleteTitle(), //是否确认删除//getDeleteTitle() | |
27 | 27 | confirm: handleDelete.bind(null, record), |
28 | 28 | }, |
29 | 29 | }, |
... | ... | @@ -33,135 +33,135 @@ |
33 | 33 | </BasicTable> |
34 | 34 | |
35 | 35 | <!-- 弹出框 --> |
36 | - <MenuDrawer @register="registerDrawer" @success="handleSuccess"/> | |
36 | + <MenuDrawer @register="registerDrawer" @success="handleSuccess" /> | |
37 | 37 | </div> |
38 | 38 | </template> |
39 | 39 | <script lang="ts"> |
40 | -//导入所需插件 | |
41 | -import {computed, defineComponent, nextTick} from 'vue'; | |
42 | - | |
43 | -// 导入表格组件,表格事件 | |
44 | -import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |
45 | - | |
46 | -// 加载表格数据 | |
47 | -import {getMenuList, delMenu} from '/@/api/sys/menu'; | |
48 | -// 加载自定义侧边弹出框 组件 | |
49 | -import {useDrawer} from '/@/components/Drawer'; | |
50 | - | |
51 | -// 导入子页面【新增、修改】 | |
52 | -import MenuDrawer from './MenuDrawer.vue'; | |
53 | - | |
54 | -// 导入列 属性,和搜索栏内容 | |
55 | -import {columns, searchFormSchema} from './menu.data'; | |
56 | -import {useI18n} from "/@/hooks/web/useI18n"; | |
57 | -import {notification} from "ant-design-vue"; | |
58 | - | |
59 | -// 自定义表格组件和属性 | |
60 | -export default defineComponent({ | |
61 | - name: 'MenuManagement', | |
62 | - components: {BasicTable, MenuDrawer, TableAction}, | |
63 | - setup() { | |
64 | - const [registerDrawer, {openDrawer}] = useDrawer();//使用右侧弹出框 | |
65 | - const {t} = useI18n(); //加载国际化 | |
66 | - // 新增菜单 | |
67 | - const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); | |
68 | - | |
69 | - const [registerTable, {reload, expandAll}] = useTable({ | |
70 | - title: t('routes.common.system.pageSystemTitleMenuList'),//'菜单列表' | |
71 | - api: getMenuList, //加载数据 | |
72 | - columns, //加载列 | |
73 | - // formConfig: { | |
74 | - // labelWidth: 120, | |
75 | - // schemas: searchFormSchema, | |
76 | - // }, | |
77 | - isTreeTable: true, | |
78 | - pagination: false, | |
79 | - striped: false, | |
80 | - // useSearchForm: true, | |
81 | - showTableSetting: true, | |
82 | - bordered: true, | |
83 | - showIndexColumn: false, | |
84 | - canResize: false, | |
85 | - actionColumn: { | |
86 | - width: 80, | |
87 | - title: t('routes.common.system.pageSystemTitleOperation'),//操作 | |
88 | - dataIndex: 'action', | |
89 | - slots: {customRender: 'action'}, | |
90 | - fixed: undefined, | |
91 | - }, | |
92 | - }); | |
93 | - | |
94 | - /** | |
95 | - * 获得删除提示框的文字 | |
96 | - */ | |
97 | - function getDeleteTitle(): string { | |
98 | - let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); | |
99 | - return labelText | |
100 | - } | |
101 | - | |
102 | - /** | |
103 | - * 打开新增菜单 | |
104 | - */ | |
105 | - function handleCreate() { | |
106 | - openDrawer(true, { | |
107 | - isUpdate: false, | |
40 | + //导入所需插件 | |
41 | + import { computed, defineComponent, nextTick } from 'vue'; | |
42 | + | |
43 | + // 导入表格组件,表格事件 | |
44 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
45 | + | |
46 | + // 加载表格数据 | |
47 | + import { getMenuList, delMenu } from '/@/api/sys/menu'; | |
48 | + // 加载自定义侧边弹出框 组件 | |
49 | + import { useDrawer } from '/@/components/Drawer'; | |
50 | + | |
51 | + // 导入子页面【新增、修改】 | |
52 | + import MenuDrawer from './MenuDrawer.vue'; | |
53 | + | |
54 | + // 导入列 属性,和搜索栏内容 | |
55 | + import { columns, searchFormSchema } from './menu.data'; | |
56 | + import { useI18n } from '/@/hooks/web/useI18n'; | |
57 | + import { notification } from 'ant-design-vue'; | |
58 | + | |
59 | + // 自定义表格组件和属性 | |
60 | + export default defineComponent({ | |
61 | + name: 'MenuManagement', | |
62 | + components: { BasicTable, MenuDrawer, TableAction }, | |
63 | + setup() { | |
64 | + const [registerDrawer, { openDrawer }] = useDrawer(); //使用右侧弹出框 | |
65 | + const { t } = useI18n(); //加载国际化 | |
66 | + // 新增菜单 | |
67 | + const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); | |
68 | + console.log(111); | |
69 | + const [registerTable, { reload, expandAll }] = useTable({ | |
70 | + title: t('routes.common.system.pageSystemTitleMenuList'), //'菜单列表' | |
71 | + api: getMenuList, //加载数据 | |
72 | + columns, //加载列 | |
73 | + // formConfig: { | |
74 | + // labelWidth: 120, | |
75 | + // schemas: searchFormSchema, | |
76 | + // }, | |
77 | + isTreeTable: true, | |
78 | + pagination: false, | |
79 | + striped: false, | |
80 | + // useSearchForm: true, | |
81 | + showTableSetting: true, | |
82 | + bordered: true, | |
83 | + showIndexColumn: false, | |
84 | + canResize: false, | |
85 | + actionColumn: { | |
86 | + width: 80, | |
87 | + title: t('routes.common.system.pageSystemTitleOperation'), //操作 | |
88 | + dataIndex: 'action', | |
89 | + slots: { customRender: 'action' }, | |
90 | + fixed: undefined, | |
91 | + }, | |
108 | 92 | }); |
109 | - } | |
110 | 93 | |
111 | - /** | |
112 | - * 打开 编辑菜单 | |
113 | - * @param record | |
114 | - */ | |
115 | - function handleEdit(record: Recordable) { | |
116 | - console.log("----------------------------333-------------"+record.parentId); | |
117 | - openDrawer(true, { | |
118 | - record, | |
119 | - isUpdate: true, | |
120 | - }); | |
121 | - } | |
94 | + /** | |
95 | + * 获得删除提示框的文字 | |
96 | + */ | |
97 | + function getDeleteTitle(): string { | |
98 | + let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); | |
99 | + return labelText; | |
100 | + } | |
122 | 101 | |
123 | - /** | |
124 | - * 执行 删除操作 | |
125 | - * @param record | |
126 | - */ | |
127 | - async function handleDelete(record: Recordable) { | |
128 | - try { | |
129 | - let ids = [record.id,]; | |
130 | - await delMenu(ids); | |
131 | - notification.success({ | |
132 | - message: "成功", | |
133 | - description: "删除菜单成功", | |
134 | - duration: 3, | |
102 | + /** | |
103 | + * 打开新增菜单 | |
104 | + */ | |
105 | + function handleCreate() { | |
106 | + openDrawer(true, { | |
107 | + isUpdate: false, | |
135 | 108 | }); |
136 | - await reload(); | |
137 | - } catch (e) { | |
138 | - return Promise.reject(e); | |
139 | 109 | } |
140 | - } | |
141 | 110 | |
142 | - /** | |
143 | - * 操作成功,重新加载页面 | |
144 | - */ | |
145 | - function handleSuccess() { | |
146 | - reload(); | |
147 | - } | |
111 | + /** | |
112 | + * 打开 编辑菜单 | |
113 | + * @param record | |
114 | + */ | |
115 | + function handleEdit(record: Recordable) { | |
116 | + console.log('----------------------------333-------------' + record.parentId); | |
117 | + openDrawer(true, { | |
118 | + record, | |
119 | + isUpdate: true, | |
120 | + }); | |
121 | + } | |
148 | 122 | |
149 | - function onFetchSuccess() { | |
150 | - // 演示默认展开所有表项 | |
151 | - nextTick(expandAll); | |
152 | - } | |
123 | + /** | |
124 | + * 执行 删除操作 | |
125 | + * @param record | |
126 | + */ | |
127 | + async function handleDelete(record: Recordable) { | |
128 | + try { | |
129 | + let ids = [record.id]; | |
130 | + await delMenu(ids); | |
131 | + notification.success({ | |
132 | + message: '成功', | |
133 | + description: '删除菜单成功', | |
134 | + duration: 3, | |
135 | + }); | |
136 | + await reload(); | |
137 | + } catch (e) { | |
138 | + return Promise.reject(e); | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + /** | |
143 | + * 操作成功,重新加载页面 | |
144 | + */ | |
145 | + function handleSuccess() { | |
146 | + reload(); | |
147 | + } | |
148 | + | |
149 | + function onFetchSuccess() { | |
150 | + // 演示默认展开所有表项 | |
151 | + nextTick(expandAll); | |
152 | + } | |
153 | 153 | |
154 | - return { | |
155 | - getDeleteTitle, | |
156 | - getI18nCreateMenu, | |
157 | - registerTable, | |
158 | - registerDrawer, | |
159 | - handleCreate, | |
160 | - handleEdit, | |
161 | - handleDelete, | |
162 | - handleSuccess, | |
163 | - onFetchSuccess, | |
164 | - }; | |
165 | - }, | |
166 | -}); | |
154 | + return { | |
155 | + getDeleteTitle, | |
156 | + getI18nCreateMenu, | |
157 | + registerTable, | |
158 | + registerDrawer, | |
159 | + handleCreate, | |
160 | + handleEdit, | |
161 | + handleDelete, | |
162 | + handleSuccess, | |
163 | + onFetchSuccess, | |
164 | + }; | |
165 | + }, | |
166 | + }); | |
167 | 167 | </script> | ... | ... |
... | ... | @@ -10,18 +10,18 @@ |
10 | 10 | </PageWrapper> |
11 | 11 | </template> |
12 | 12 | <script lang="ts"> |
13 | - import { defineComponent } from 'vue'; | |
13 | + import { defineComponent, ref } from 'vue'; | |
14 | 14 | import { PageWrapper } from '/@/components/Page'; |
15 | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | - import {USER_INFO_KEY} from "/@/enums/cacheEnum"; | |
17 | - import {getAuthCache} from "/@/utils/auth"; | |
16 | + import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | |
17 | + import { getAuthCache } from '/@/utils/auth'; | |
18 | 18 | import { formSchema } from './pwd.data'; |
19 | - import {resetPassword} from "/@/api/system/system"; | |
20 | - import {useMultipleTabStore} from "/@/store/modules/multipleTab"; | |
21 | - import {useUserStore} from "/@/store/modules/user"; | |
22 | - import {useAppStore} from "/@/store/modules/app"; | |
23 | - import {usePermissionStore} from "/@/store/modules/permission"; | |
24 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
19 | + import { resetPassword } from '/@/api/system/system'; | |
20 | + import { useMultipleTabStore } from '/@/store/modules/multipleTab'; | |
21 | + import { useUserStore } from '/@/store/modules/user'; | |
22 | + import { useAppStore } from '/@/store/modules/app'; | |
23 | + import { usePermissionStore } from '/@/store/modules/permission'; | |
24 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
25 | 25 | export default defineComponent({ |
26 | 26 | name: 'ChangePassword', |
27 | 27 | components: { BasicForm, PageWrapper }, |
... | ... | @@ -36,35 +36,35 @@ |
36 | 36 | const userStore = useUserStore(); |
37 | 37 | const appStore = useAppStore(); |
38 | 38 | const permissionStore = usePermissionStore(); |
39 | - const {createMessage} = useMessage(); | |
39 | + const { createMessage } = useMessage(); | |
40 | 40 | const userInfo = getAuthCache(USER_INFO_KEY); |
41 | - console.log(userInfo,"userInfo") | |
41 | + // console.log(userInfo, 'userInfo'); | |
42 | 42 | async function handleSubmit() { |
43 | 43 | try { |
44 | 44 | const values = await validate(); |
45 | 45 | const { passwordOld, passwordNew } = values; |
46 | 46 | const params = { |
47 | - userId:userInfo.userId, | |
48 | - password:passwordOld, | |
49 | - resetPassword:passwordNew | |
47 | + userId: userInfo.userId, | |
48 | + password: passwordOld, | |
49 | + resetPassword: passwordNew, | |
50 | 50 | }; |
51 | 51 | |
52 | - await resetPassword(params).then((result)=>{ | |
53 | - if(result.data){ | |
54 | - createMessage.success("修改成功"); | |
55 | - setTimeout(function (){ | |
56 | - localStorage.clear(); | |
57 | - appStore.resetAllState(); | |
58 | - permissionStore.resetState(); | |
59 | - tabStore.resetState(); | |
60 | - userStore.resetState(); | |
61 | - location.reload(); | |
62 | - },500) | |
63 | - } | |
52 | + await resetPassword(params).then((result) => { | |
53 | + if (result.data) { | |
54 | + createMessage.success('修改成功'); | |
55 | + // /dashboard/analysis | |
56 | + setTimeout(function () { | |
57 | + localStorage.clear(); | |
58 | + appStore.resetAllState(); | |
59 | + permissionStore.resetState(); | |
60 | + tabStore.resetState(); | |
61 | + userStore.resetState(); | |
62 | + location.reload(); | |
63 | + }, 500); | |
64 | + } | |
64 | 65 | }); |
65 | 66 | } catch (error) {} |
66 | 67 | } |
67 | - | |
68 | 68 | return { register, resetFields, handleSubmit }; |
69 | 69 | }, |
70 | 70 | }); | ... | ... |
... | ... | @@ -112,7 +112,6 @@ |
112 | 112 | } |
113 | 113 | }); |
114 | 114 | }); |
115 | - console.log(roleMenus.value); | |
116 | 115 | proxy.$refs.tree.setCheckedKeys(roleMenus.value); |
117 | 116 | roleId.value = data.record.id; |
118 | 117 | } |
... | ... | @@ -145,6 +144,7 @@ |
145 | 144 | } |
146 | 145 | // Tree check事件 |
147 | 146 | const handleCheckClick = (_, e) => { |
147 | + allCheckedKeys.value = []; | |
148 | 148 | let nodes = e.checkedNodes; |
149 | 149 | let halfKeys = e.halfCheckedKeys; |
150 | 150 | nodes.map((node) => { |
... | ... | @@ -156,12 +156,6 @@ |
156 | 156 | }); |
157 | 157 | allCheckedKeys.value.push(...halfKeys); |
158 | 158 | }; |
159 | - // const handleCheckClick = (checkedKeys: string[], { halfCheckedKeys }) => { | |
160 | - // allCheckedKeys.value = [...checkedKeys, ...halfCheckedKeys]; | |
161 | - // // 父节点 | |
162 | - // roleHalfCheckedKeys.value = halfCheckedKeys; | |
163 | - // }; | |
164 | - | |
165 | 159 | return { |
166 | 160 | allCheckedKeys, |
167 | 161 | registerDrawer, | ... | ... |