Commit fa515ee3b12f35a13d262a795dc606e811014a69
1 parent
f6dece6c
fix:修复账号管理手机号编辑问题,fix:修改场景联动部分问题,主要是修改一下数据收集
Showing
19 changed files
with
209 additions
and
89 deletions
... | ... | @@ -8,10 +8,10 @@ VITE_PUBLIC_PATH = / |
8 | 8 | # Please note that no line breaks |
9 | 9 | |
10 | 10 | # 本地 |
11 | -VITE_PROXY = [["/api","http://192.168.10.107:8080/api"]] | |
11 | +# VITE_PROXY = [["/api","http://192.168.10.147:8080/api"]] | |
12 | 12 | |
13 | 13 | # 线上 |
14 | -# VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
14 | +VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
15 | 15 | |
16 | 16 | # 实时数据的ws地址 |
17 | 17 | VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | ... | ... |
... | ... | @@ -17,10 +17,12 @@ 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.SYS_ADMIN)) { | |
21 | - url = Api.SysAdminMenuList; | |
22 | - } | |
23 | - return defHttp.get<getMenuListResultModel>({ url }); | |
20 | + try { | |
21 | + if (userStore.getRoleList.find((v) => v == RoleEnum.SYS_ADMIN)) { | |
22 | + url = Api.SysAdminMenuList; | |
23 | + } | |
24 | + return defHttp.get<getMenuListResultModel>({ url }); | |
25 | + } catch (e) {} | |
24 | 26 | }; |
25 | 27 | |
26 | 28 | export const delMenu = (menuIds: string[]) => { | ... | ... |
src/assets/images/delete.png
renamed from
src/assets/images/shanchu.png
688 Bytes
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | document.createElement('link')) as HTMLLinkElement; |
64 | 64 | link.type = 'image/x-icon'; |
65 | 65 | link.rel = 'shortcut icon'; |
66 | - link.href = userStore.platInfo?.icon ?? '/public/favicon.ico'; | |
66 | + link.href = userStore.platInfo?.icon ?? '/favicon.ico'; | |
67 | 67 | document.getElementsByTagName('head')[0].appendChild(link); |
68 | 68 | return userStore.platInfo?.name ?? title; |
69 | 69 | }); | ... | ... |
... | ... | @@ -175,7 +175,6 @@ |
175 | 175 | |
176 | 176 | const [registerModal, { closeModal }] = useModalInner(async (data) => { |
177 | 177 | refreshCacheGetData(); |
178 | - console.log(updataPersonlData.value); | |
179 | 178 | try { |
180 | 179 | if (updataPersonlData.value != null) { |
181 | 180 | (peresonalPic.value = updataPersonlData.value.avatar), | ... | ... |
... | ... | @@ -30,6 +30,7 @@ export function createPermissionGuard(router: Router) { |
30 | 30 | userStore.getUserInfo.homePath && |
31 | 31 | userStore.getUserInfo.homePath !== PageEnum.BASE_HOME |
32 | 32 | ) { |
33 | + console.log(userStore.getUserInfo.homePath); | |
33 | 34 | next(userStore.getUserInfo.homePath); |
34 | 35 | return; |
35 | 36 | } | ... | ... |
... | ... | @@ -254,13 +254,13 @@ |
254 | 254 | .noticeTitle:hover { |
255 | 255 | border-bottom: 1px solid #ccc; |
256 | 256 | } |
257 | - :deep().ant-anchor-link-active > .ant-anchor-link-title { | |
257 | + :deep.ant-anchor-link-active > .ant-anchor-link-title { | |
258 | 258 | color: #666; |
259 | 259 | } |
260 | - :deep().ant-pagination-prev { | |
260 | + :deep.ant-pagination-prev { | |
261 | 261 | display: none; |
262 | 262 | } |
263 | - :deep().ant-pagination-next { | |
263 | + :deep.ant-pagination-next { | |
264 | 264 | display: none; |
265 | 265 | } |
266 | 266 | </style> | ... | ... |
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | style="cursor: pointer" |
9 | 9 | @click="deleteAlarmRule(index)" |
10 | 10 | alt="移除" |
11 | - src="../../../../assets/images/shanchu.png" | |
11 | + src="../../../../assets/images/delete.png" | |
12 | 12 | /> |
13 | 13 | </div> |
14 | 14 | </template> |
... | ... | @@ -286,7 +286,6 @@ |
286 | 286 | id: Date.now() + Math.random() + '', |
287 | 287 | alarmType: '', |
288 | 288 | createRules: {}, |
289 | - | |
290 | 289 | propagate: false, |
291 | 290 | propagateRelationTypes: [''], |
292 | 291 | }, | ... | ... |
... | ... | @@ -46,9 +46,10 @@ |
46 | 46 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
47 | 47 | // eslint-disable-next-line vue/require-prop-types |
48 | 48 | props: ['deviceInfo1'], |
49 | - setup(props) { | |
50 | - const getValueData: any = ref({}); | |
49 | + emits: ['eDoConditionGetAddPushValueData'], | |
50 | + setup(props, { emit }) { | |
51 | 51 | const addHideButton = ref(1); |
52 | + const getAddPushValueData: any = ref([]); | |
52 | 53 | |
53 | 54 | const [ |
54 | 55 | registerCondition, |
... | ... | @@ -90,12 +91,13 @@ |
90 | 91 | const setFieldsFormValue = (v) => { |
91 | 92 | setFieldsValue(v); |
92 | 93 | }; |
93 | - function getAllFields(getV) { | |
94 | - const values = getFieldsValue(); | |
95 | - getValueData.value = values; | |
96 | - getV = getValueData.value; | |
94 | + const getAllFields = (getV: any) => { | |
95 | + getV = { | |
96 | + data: getFieldsValue(), | |
97 | + count: 1, | |
98 | + }; | |
97 | 99 | return getV; |
98 | - } | |
100 | + }; | |
99 | 101 | function funcResetFields() { |
100 | 102 | resetFields(); |
101 | 103 | } |
... | ... | @@ -119,6 +121,12 @@ |
119 | 121 | |
120 | 122 | const n = ref(1); |
121 | 123 | function add() { |
124 | + const pushValue = getFieldsValue(); | |
125 | + getAddPushValueData.value.push(pushValue); | |
126 | + emit('eDoConditionGetAddPushValueData', { | |
127 | + data: getAddPushValueData.value, | |
128 | + count: 2, | |
129 | + }); | |
122 | 130 | addHideButton.value++; |
123 | 131 | if (addHideButton.value == 3) { |
124 | 132 | setTimeout(() => { | ... | ... |
... | ... | @@ -46,10 +46,11 @@ |
46 | 46 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
47 | 47 | // eslint-disable-next-line vue/require-prop-types |
48 | 48 | props: ['deviceInfo2'], |
49 | - setup(props) { | |
49 | + emits: ['eDoactionGetAddPushValueData'], | |
50 | + setup(props, { emit }) { | |
50 | 51 | const addHideButton = ref(1); |
52 | + const getAddPushValueData: any = ref([]); | |
51 | 53 | |
52 | - const getValueData: any = ref({}); | |
53 | 54 | const [ |
54 | 55 | registerAction, |
55 | 56 | { |
... | ... | @@ -90,12 +91,13 @@ |
90 | 91 | const setFieldsFormValue = (v) => { |
91 | 92 | setFieldsValue(v); |
92 | 93 | }; |
93 | - function getAllFields(getV) { | |
94 | - const values = getFieldsValue(); | |
95 | - getValueData.value = values; | |
96 | - getV = getValueData.value; | |
94 | + const getAllFields = (getV: any) => { | |
95 | + getV = { | |
96 | + data: getFieldsValue(), | |
97 | + count: 1, | |
98 | + }; | |
97 | 99 | return getV; |
98 | - } | |
100 | + }; | |
99 | 101 | function funcResetFields() { |
100 | 102 | resetFields(); |
101 | 103 | } |
... | ... | @@ -118,6 +120,13 @@ |
118 | 120 | }; |
119 | 121 | const n = ref(1); |
120 | 122 | function add() { |
123 | + const pushValue = getFieldsValue(); | |
124 | + | |
125 | + getAddPushValueData.value.push(pushValue); | |
126 | + emit('eDoactionGetAddPushValueData', { | |
127 | + data: getAddPushValueData.value, | |
128 | + count: 2, | |
129 | + }); | |
121 | 130 | addHideButton.value++; |
122 | 131 | if (addHideButton.value == 3) { |
123 | 132 | setTimeout(() => { | ... | ... |
... | ... | @@ -59,11 +59,12 @@ |
59 | 59 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
60 | 60 | // eslint-disable-next-line vue/require-prop-types |
61 | 61 | props: ['deviceInfo'], |
62 | - setup(props) { | |
63 | - const getValueData: any = ref({}); | |
62 | + emits: ['eGetAddPushValueData'], | |
63 | + setup(props, { emit }) { | |
64 | 64 | const getPushValueData: any = ref([]); |
65 | 65 | const addHideButton = ref(1); |
66 | 66 | const addHideButtonTemp: any = ref(null); |
67 | + const getAddPushValueData: any = ref([]); | |
67 | 68 | const [ |
68 | 69 | registerTrigger, |
69 | 70 | { |
... | ... | @@ -124,21 +125,33 @@ |
124 | 125 | const clearGetPushValueDataEmpty = () => { |
125 | 126 | getPushValueData.value.length = 0; |
126 | 127 | }; |
127 | - function getAllFields(getV) { | |
128 | - const values = getFieldsValue(); | |
129 | - getValueData.value = values; | |
130 | - getV = getValueData.value; | |
131 | - getPushValueData.value.push(getV); | |
132 | - console.log(getPushValueData.value); | |
128 | + | |
129 | + const getAllFields = (getV: any) => { | |
130 | + getV = { | |
131 | + data: getFieldsValue(), | |
132 | + count: 1, | |
133 | + }; | |
133 | 134 | return getV; |
134 | - } | |
135 | + }; | |
135 | 136 | async function funcResetFields() { |
136 | 137 | await resetFields(); |
137 | 138 | } |
138 | 139 | const addString: any = ref('tiggerEvent1') || ref('tiggerEvent2') || ref('tiggerEvent3'); |
139 | 140 | |
140 | 141 | const n = ref(1); |
142 | + const clearAddTriggerStatusFunc = () => { | |
143 | + // addHideButton.value = 1; | |
144 | + }; | |
145 | + const addClearGetAddPushValueDataArrayIsEmpty = () => { | |
146 | + getAddPushValueData.value = []; | |
147 | + }; | |
141 | 148 | function add() { |
149 | + const pushValue = getFieldsValue(); | |
150 | + getAddPushValueData.value.push(pushValue); | |
151 | + emit('eGetAddPushValueData', { | |
152 | + data: getAddPushValueData.value, | |
153 | + count: 2, | |
154 | + }); | |
142 | 155 | addHideButton.value++; |
143 | 156 | addHideButtonTemp.value = addHideButton.value; |
144 | 157 | addHideButtonTemp.value -= 2; |
... | ... | @@ -530,6 +543,8 @@ |
530 | 543 | n.value--; |
531 | 544 | } |
532 | 545 | return { |
546 | + addClearGetAddPushValueDataArrayIsEmpty, | |
547 | + clearAddTriggerStatusFunc, | |
533 | 548 | addHideButtonTemp, |
534 | 549 | addHideButton, |
535 | 550 | editSelectDevice, | ... | ... |
... | ... | @@ -9,13 +9,25 @@ |
9 | 9 | > |
10 | 10 | <BasicForm @register="registerForm" /> |
11 | 11 | <div> |
12 | - <AddTriggerForm ref="getTriggerChildData" :deviceInfo="getDeviceInfo" /> | |
12 | + <AddTriggerForm | |
13 | + @eGetAddPushValueData="getAddPushValueDataValueFunc" | |
14 | + ref="getTriggerChildData" | |
15 | + :deviceInfo="getDeviceInfo" | |
16 | + /> | |
13 | 17 | </div> |
14 | 18 | <div> |
15 | - <AddConditiForm ref="getConditionChildData" :deviceInfo1="getDeviceInfo1" /> | |
19 | + <AddConditiForm | |
20 | + @eDoConditionGetAddPushValueData="getAddDoconditionPushValueDataValueFunc" | |
21 | + ref="getConditionChildData" | |
22 | + :deviceInfo1="getDeviceInfo1" | |
23 | + /> | |
16 | 24 | </div> |
17 | 25 | <div> |
18 | - <AddActionForm ref="getChildData" :deviceInfo2="getDeviceInfo2" /> | |
26 | + <AddActionForm | |
27 | + @eDoactionGetAddPushValueData="getAddDoActionPushValueDataValueFunc" | |
28 | + ref="getChildData" | |
29 | + :deviceInfo2="getDeviceInfo2" | |
30 | + /> | |
19 | 31 | </div> |
20 | 32 | </BasicDrawer> |
21 | 33 | </template> |
... | ... | @@ -51,9 +63,16 @@ |
51 | 63 | let getAllFormData: any = reactive({}); |
52 | 64 | let getValuesFormData: any = reactive({}); |
53 | 65 | let getId = ref(''); |
66 | + let getTenantId = ref(''); | |
54 | 67 | let getDeviceInfo = ref(null); |
55 | 68 | let getDeviceInfo1 = ref(null); |
56 | 69 | let getDeviceInfo2 = ref(null); |
70 | + const isCountT = ref(null); | |
71 | + const isAddTriggerT: any = ref([]); | |
72 | + const isCountD = ref(null); | |
73 | + const isAddActionD: any = ref([]); | |
74 | + const isCountC = ref(null); | |
75 | + const isAddConditionD: any = ref([]); | |
57 | 76 | |
58 | 77 | const [registerForm, { resetFields, setFieldsValue, validateFields, getFieldsValue }] = |
59 | 78 | useForm({ |
... | ... | @@ -74,6 +93,16 @@ |
74 | 93 | isUpdate.value = !!data?.isUpdate; |
75 | 94 | |
76 | 95 | if (!unref(isUpdate)) { |
96 | + triggersArray.length = 0; | |
97 | + doConditionsArray.length = 0; | |
98 | + doActionsArray.length = 0; | |
99 | + isAddTriggerT.value.length = 0; | |
100 | + | |
101 | + isAddActionD.value.length = 0; | |
102 | + | |
103 | + isAddConditionD.value.length = 0; | |
104 | + proxy.$refs.getTriggerChildData.addClearGetAddPushValueDataArrayIsEmpty(); | |
105 | + proxy.$refs.getTriggerChildData.clearAddTriggerStatusFunc(); | |
77 | 106 | proxy.$refs.getTriggerChildData.clearGetPushValueDataEmpty(); |
78 | 107 | proxy.$refs.getTriggerChildData.clearSelectDevice(); |
79 | 108 | proxy.$refs.getChildData.clearSelectDevice(); |
... | ... | @@ -84,7 +113,9 @@ |
84 | 113 | } |
85 | 114 | //编辑 |
86 | 115 | if (unref(isUpdate)) { |
116 | + console.log(data); | |
87 | 117 | getId.value = data.record.id; |
118 | + getTenantId.value = data.record.tenantId; | |
88 | 119 | await setFieldsValue({ |
89 | 120 | ...data.record, |
90 | 121 | }); |
... | ... | @@ -96,21 +127,23 @@ |
96 | 127 | organizationId: data.record.organizationId, |
97 | 128 | }); |
98 | 129 | newMap = options.items.map((m) => { |
99 | - newTwoFilterMap = data.record?.triggers.map((m1) => { | |
100 | - if (m.id == m1.deviceId) { | |
130 | + try { | |
131 | + newTwoFilterMap = data.record?.triggers.map((m1) => { | |
132 | + if (m.id == m1.deviceId) { | |
133 | + return { | |
134 | + value: m.id, | |
135 | + label: m.name, | |
136 | + }; | |
137 | + } | |
138 | + }); | |
139 | + | |
140 | + if (m.id == data.record?.triggers[0].deviceId) { | |
101 | 141 | return { |
102 | 142 | value: m.id, |
103 | 143 | label: m.name, |
104 | 144 | }; |
105 | 145 | } |
106 | - }); | |
107 | - | |
108 | - if (m.id == data.record?.triggers[0].deviceId) { | |
109 | - return { | |
110 | - value: m.id, | |
111 | - label: m.name, | |
112 | - }; | |
113 | - } | |
146 | + } catch (e) {} | |
114 | 147 | }); |
115 | 148 | newFilterMap = newMap.filter((f) => f !== undefined); |
116 | 149 | newFilterTwoFilterMap = newTwoFilterMap.filter((f) => f !== undefined); |
... | ... | @@ -151,22 +184,55 @@ |
151 | 184 | } |
152 | 185 | }); |
153 | 186 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
187 | + const getAddPushValueDataValueFunc = (v) => { | |
188 | + if (v.count == 2) { | |
189 | + isCountT.value = v.count; | |
190 | + isAddTriggerT.value = v.data; | |
191 | + } | |
192 | + }; | |
193 | + const getAddDoActionPushValueDataValueFunc = (v) => { | |
194 | + if (v.count == 2) { | |
195 | + isCountD.value = v.count; | |
196 | + isAddActionD.value = v.data; | |
197 | + } | |
198 | + }; | |
199 | + const getAddDoconditionPushValueDataValueFunc = (v) => { | |
200 | + if (v.count == 2) { | |
201 | + isCountC.value = v.count; | |
202 | + isAddConditionD.value = v.data; | |
203 | + } | |
204 | + }; | |
154 | 205 | |
155 | 206 | async function handleSubmit() { |
156 | 207 | if (!unref(isUpdate)) { |
208 | + triggersArray.length = 0; | |
209 | + doConditionsArray.length = 0; | |
210 | + doActionsArray.length = 0; | |
157 | 211 | let res = validateFields(); |
158 | 212 | if (!res) return; |
159 | - let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
160 | 213 | let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); |
214 | + if (getTriggerChildValues.count === 1) { | |
215 | + triggersArray.push(getTriggerChildValues.data); | |
216 | + } | |
161 | 217 | let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); |
162 | - doActionsArray.push(getChildValues); | |
163 | - triggersArray.push(getTriggerChildValues); | |
164 | - doConditionsArray.push(getconditionChildValues); | |
218 | + if (getconditionChildValues.count === 1) { | |
219 | + doConditionsArray.push(getconditionChildValues.data); | |
220 | + } | |
221 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
222 | + if (getChildValues.count === 1) { | |
223 | + doActionsArray.push(getChildValues.data); | |
224 | + } | |
225 | + | |
165 | 226 | getValuesFormData = getFieldsValue(); |
166 | 227 | Object.assign(getAllFormData, getValuesFormData); |
167 | - getAllFormData.triggers = triggersArray; | |
168 | - getAllFormData.doConditions = doConditionsArray; | |
169 | - getAllFormData.doActions = doActionsArray; | |
228 | + getAllFormData.triggers = | |
229 | + isCountT.value == 2 ? isAddTriggerT.value.concat(triggersArray) : triggersArray; | |
230 | + getAllFormData.doConditions = | |
231 | + isCountC.value == 2 | |
232 | + ? isAddConditionD.value.concat(doConditionsArray) | |
233 | + : doConditionsArray; | |
234 | + getAllFormData.doActions = | |
235 | + isCountD.value == 2 ? isAddActionD.value.concat(doActionsArray) : doActionsArray; | |
170 | 236 | //所有的表单值 |
171 | 237 | await screenLinkPageAddApi(getAllFormData); |
172 | 238 | createMessage.success('场景联动新增成功'); |
... | ... | @@ -174,18 +240,34 @@ |
174 | 240 | emit('success'); |
175 | 241 | } |
176 | 242 | if (unref(isUpdate)) { |
177 | - getValuesFormData = getFieldsValue(); | |
178 | - let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
243 | + triggersArray = []; | |
244 | + doConditionsArray = []; | |
245 | + doActionsArray = []; | |
179 | 246 | let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); |
247 | + if (getTriggerChildValues.count === 1) { | |
248 | + triggersArray.push(getTriggerChildValues.data); | |
249 | + } | |
180 | 250 | let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); |
181 | - doActionsArray.push(getChildValues); | |
182 | - triggersArray.push(getTriggerChildValues); | |
183 | - doConditionsArray.push(getconditionChildValues); | |
251 | + if (getconditionChildValues.count === 1) { | |
252 | + doConditionsArray.push(getconditionChildValues.data); | |
253 | + } | |
254 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
255 | + if (getChildValues.count === 1) { | |
256 | + doActionsArray.push(getChildValues.data); | |
257 | + } | |
258 | + getValuesFormData = getFieldsValue(); | |
259 | + | |
184 | 260 | getValuesFormData.id = getId.value; |
261 | + getValuesFormData.tenantId = getTenantId.value; | |
185 | 262 | Object.assign(getAllFormData, getValuesFormData); |
186 | - getAllFormData.triggers = triggersArray; | |
187 | - getAllFormData.doConditions = doConditionsArray; | |
188 | - getAllFormData.doActions = doActionsArray; | |
263 | + getAllFormData.triggers = | |
264 | + isCountT.value == 2 ? isAddTriggerT.value.concat(triggersArray) : triggersArray; | |
265 | + getAllFormData.doConditions = | |
266 | + isCountC.value == 2 | |
267 | + ? isAddConditionD.value.concat(doConditionsArray) | |
268 | + : doConditionsArray; | |
269 | + getAllFormData.doActions = | |
270 | + isCountD.value == 2 ? isAddActionD.value.concat(doActionsArray) : doActionsArray; | |
189 | 271 | await screenLinkPageUpdateApi(getAllFormData); |
190 | 272 | createMessage.success('场景联动编辑成功'); |
191 | 273 | closeDrawer(); |
... | ... | @@ -193,6 +275,9 @@ |
193 | 275 | } |
194 | 276 | } |
195 | 277 | return { |
278 | + getAddDoconditionPushValueDataValueFunc, | |
279 | + getAddDoActionPushValueDataValueFunc, | |
280 | + getAddPushValueDataValueFunc, | |
196 | 281 | getConditionChildData, |
197 | 282 | getTriggerChildData, |
198 | 283 | getChildData, | ... | ... |
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | document.createElement('link')) as HTMLLinkElement; |
143 | 143 | link.type = 'image/x-icon'; |
144 | 144 | link.rel = 'shortcut icon'; |
145 | - link.href = res.icon ?? '/public/favicon.ico'; | |
145 | + link.href = res.icon ?? '/favicon.ico'; | |
146 | 146 | document.getElementsByTagName('head')[0].appendChild(link); |
147 | 147 | } |
148 | 148 | } catch (error: any) { | ... | ... |
... | ... | @@ -10,13 +10,14 @@ |
10 | 10 | <BasicForm @register="registerForm"> |
11 | 11 | <template #organizationId="{ model, field }"> |
12 | 12 | <BasicTree |
13 | + v-if="organizationTreeData.length" | |
13 | 14 | v-model:value="model[field]" |
14 | 15 | :treeData="organizationTreeData" |
15 | 16 | :checked-keys="checkGroup" |
16 | - :defaultExpandAll="true" | |
17 | + default-expand-all | |
18 | + ref="basicTreeRef" | |
17 | 19 | checkable |
18 | 20 | toolbar |
19 | - title="所属组织" | |
20 | 21 | /> |
21 | 22 | </template> |
22 | 23 | </BasicForm> |
... | ... | @@ -42,8 +43,13 @@ |
42 | 43 | const isUpdate = ref(true); |
43 | 44 | const rowId = ref(''); |
44 | 45 | const organizationTreeData = ref<TreeItem[]>([]); |
46 | + const basicTreeRef = ref(); | |
45 | 47 | const checkGroup = ref<string[]>([]); |
46 | - const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ | |
48 | + const olderPhoneNumber = ref(); | |
49 | + const [ | |
50 | + registerForm, | |
51 | + { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, | |
52 | + ] = useForm({ | |
47 | 53 | labelWidth: 100, |
48 | 54 | schemas: accountFormSchema, |
49 | 55 | showActionButtonGroup: false, |
... | ... | @@ -57,7 +63,7 @@ |
57 | 63 | setModalProps({ confirmLoading: false }); |
58 | 64 | isUpdate.value = !!data?.isUpdate; |
59 | 65 | const groupListModel = await findCurrentUserGroups(); |
60 | - if (unref(organizationTreeData).length === 0) { | |
66 | + if (!unref(organizationTreeData).length) { | |
61 | 67 | copyTransTreeFun(groupListModel); |
62 | 68 | organizationTreeData.value = groupListModel; |
63 | 69 | } |
... | ... | @@ -65,6 +71,7 @@ |
65 | 71 | if (unref(isUpdate)) { |
66 | 72 | rowId.value = data.record.id; |
67 | 73 | const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); |
74 | + olderPhoneNumber.value = data.record.phoneNumber; | |
68 | 75 | findCurrentUserRelation(roleParams).then((result) => { |
69 | 76 | Reflect.set(data.record, 'roleIds', result); |
70 | 77 | Reflect.set(data.record, 'password', '******'); |
... | ... | @@ -85,7 +92,19 @@ |
85 | 92 | async function handleSubmit() { |
86 | 93 | try { |
87 | 94 | const { createMessage } = useMessage(); |
88 | - const values = await validate(); | |
95 | + const values = await validate([ | |
96 | + 'id', | |
97 | + 'username', | |
98 | + 'realName', | |
99 | + 'password', | |
100 | + 'roleIds', | |
101 | + 'email', | |
102 | + 'accountExpireTime', | |
103 | + 'enabled', | |
104 | + 'remark', | |
105 | + 'organizationIds', | |
106 | + olderPhoneNumber.value == getFieldsValue().phoneNumber ? '' : 'phoneNumber', | |
107 | + ]); | |
89 | 108 | values.accountExpireTime = |
90 | 109 | typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null |
91 | 110 | ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') |
... | ... | @@ -106,6 +125,7 @@ |
106 | 125 | getTitle, |
107 | 126 | organizationTreeData, |
108 | 127 | checkGroup, |
128 | + basicTreeRef, | |
109 | 129 | }; |
110 | 130 | }, |
111 | 131 | }); | ... | ... |
... | ... | @@ -66,23 +66,11 @@ export const searchFormSchema: FormSchema[] = [ |
66 | 66 | label: '姓名', |
67 | 67 | component: 'Input', |
68 | 68 | colProps: { span: 8 }, |
69 | + required: true, | |
69 | 70 | componentProps: { |
70 | 71 | maxLength: 255, |
71 | 72 | placeholder: '请输入姓名', |
72 | 73 | }, |
73 | - dynamicRules: () => { | |
74 | - return [ | |
75 | - { | |
76 | - required: false, | |
77 | - validator: (_, value) => { | |
78 | - if (String(value).length > 255) { | |
79 | - return Promise.reject('字数不超过255个字'); | |
80 | - } | |
81 | - return Promise.resolve(); | |
82 | - }, | |
83 | - }, | |
84 | - ]; | |
85 | - }, | |
86 | 74 | }, |
87 | 75 | ]; |
88 | 76 | ... | ... |
... | ... | @@ -94,7 +94,6 @@ |
94 | 94 | await updateSchema({ field: 'title', componentProps: { disabled: false } }); |
95 | 95 | //如果是编辑操作,设置页面数据 |
96 | 96 | if (unref(isUpdate)) { |
97 | - // console.log(data.record); | |
98 | 97 | getTenantRoles(data.record.tenantId).then((result) => { |
99 | 98 | Reflect.set(data.record, 'roleIds', result); |
100 | 99 | //为表单赋值 | ... | ... |
... | ... | @@ -136,7 +136,6 @@ |
136 | 136 | previewVisible.value = false; |
137 | 137 | }; |
138 | 138 | const handlePreview = async (file: FileItem) => { |
139 | - console.log(file); | |
140 | 139 | if (!file.url && !file.preview) { |
141 | 140 | file.preview = (await getBase64(file.originFileObj)) as string; |
142 | 141 | } |
... | ... | @@ -209,7 +208,6 @@ |
209 | 208 | status: 'done', |
210 | 209 | url: response.fileStaticUri, |
211 | 210 | }); |
212 | - console.log('改变前', fileList.value); | |
213 | 211 | const fileArr = fileList.value.filter((item) => { |
214 | 212 | return item.percent !== 0; |
215 | 213 | }); |
... | ... | @@ -232,7 +230,6 @@ |
232 | 230 | |
233 | 231 | const handleUpdateInfo = async () => { |
234 | 232 | try { |
235 | - console.log(fileList.value); | |
236 | 233 | const fieldValue = getFieldsValue(); |
237 | 234 | // 做换字段 |
238 | 235 | const homeSwiper = fileList.value.map((item) => item.url); | ... | ... |