Commit a6f77a1ff57b71c7001fd4071704a02e83fb4abf
Merge branch 'sqy_dev' into 'main'
fix:oem地区选择调整,适配小屏幕,feat:设备配置新增Topic提示 See merge request huang/yun-teng-iot-front!120
Showing
11 changed files
with
224 additions
and
175 deletions
... | ... | @@ -8,13 +8,13 @@ VITE_PUBLIC_PATH = / |
8 | 8 | # Please note that no line breaks |
9 | 9 | |
10 | 10 | # 本地 |
11 | -# VITE_PROXY = [["/api","http://192.168.10.147:8080/api"]] | |
11 | +# VITE_PROXY = [["/api","http://192.168.10.108:8080/api"]] | |
12 | 12 | |
13 | 13 | # 线上 |
14 | 14 | VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] |
15 | 15 | |
16 | 16 | # 实时数据的ws地址 |
17 | -VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | |
17 | +VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | |
18 | 18 | |
19 | 19 | # Delete console |
20 | 20 | VITE_DROP_CONSOLE = true |
... | ... | @@ -23,7 +23,7 @@ VITE_DROP_CONSOLE = true |
23 | 23 | VITE_GLOB_API_URL=/api |
24 | 24 | |
25 | 25 | # File upload address, optional |
26 | -VITE_GLOB_UPLOAD_URL=/upload | |
26 | +VITE_GLOB_UPLOAD_URL=/api/yt/oss/upload | |
27 | 27 | |
28 | 28 | # Interface prefix |
29 | 29 | VITE_GLOB_API_URL_PREFIX=/yt | ... | ... |
... | ... | @@ -20,7 +20,8 @@ VITE_GLOB_API_URL=http://101.133.234.90:8080/api |
20 | 20 | |
21 | 21 | # File upload address, optional |
22 | 22 | # It can be forwarded by nginx or write the actual address directly |
23 | -VITE_GLOB_UPLOAD_URL=http://101.133.234.90:8080/upload | |
23 | +VITE_GLOB_UPLOAD_URL=http://101.133.234.90:8080/api/yt/oss/upload | |
24 | + | |
24 | 25 | |
25 | 26 | # Interface prefix |
26 | 27 | VITE_GLOB_API_URL_PREFIX=/yt | ... | ... |
... | ... | @@ -5,7 +5,48 @@ |
5 | 5 | <Image :src="deviceDetail.deviceInfo.avatar" :width="100" /> |
6 | 6 | </div> |
7 | 7 | <div> |
8 | - <p>设备信息</p> | |
8 | + <div class="flex" style="align-items: center"> | |
9 | + <div>设备信息</div> | |
10 | + <Tooltip | |
11 | + title="帮助" | |
12 | + @click="openTopicModal" | |
13 | + placement="right" | |
14 | + v-if="deviceDetail.deviceType !== DeviceTypeEnum.SENSOR" | |
15 | + > | |
16 | + <QuestionCircleOutlined class="ml-2" style="font-size: 1rem" /> | |
17 | + </Tooltip> | |
18 | + <BasicModal | |
19 | + @register="registerTopicModal" | |
20 | + centered | |
21 | + :footer="null" | |
22 | + title="设备Topic" | |
23 | + :canFullscreen="false" | |
24 | + :minHeight="50" | |
25 | + :height="50" | |
26 | + :useWrapper="false" | |
27 | + > | |
28 | + <div v-if="deviceDetail.deviceType === DeviceTypeEnum.GATEWAY" class="flex"> | |
29 | + <div> 网关设备Topic : v1/gateway/telemetry </div> | |
30 | + <a-button | |
31 | + size="small" | |
32 | + class="ml-4" | |
33 | + @click="copyTopic('v1/gateway/telemetry')" | |
34 | + color="success" | |
35 | + >复制</a-button | |
36 | + > | |
37 | + </div> | |
38 | + <div v-if="deviceDetail.deviceType === DeviceTypeEnum.DIRECT_CONNECTION" class="flex"> | |
39 | + <div> 直连设备Topic : v1/devices/me/telemetry </div> | |
40 | + <a-button | |
41 | + size="small" | |
42 | + class="ml-4" | |
43 | + @click="copyTopic('v1/devices/me/telemetry')" | |
44 | + color="success" | |
45 | + >复制</a-button | |
46 | + > | |
47 | + </div> | |
48 | + </BasicModal> | |
49 | + </div> | |
9 | 50 | <Description @register="register" class="mt-4" :data="deviceDetail" /> |
10 | 51 | </div> |
11 | 52 | <div class="mt-4"> |
... | ... | @@ -22,23 +63,28 @@ |
22 | 63 | </template> |
23 | 64 | <script lang="ts"> |
24 | 65 | import { defineComponent, ref, unref, nextTick } from 'vue'; |
25 | - import { Image } from 'ant-design-vue'; | |
66 | + import { Image, Tooltip } from 'ant-design-vue'; | |
26 | 67 | import { descSchema } from '../../config/detail.config'; |
27 | 68 | import { useScript } from '/@/hooks/web/useScript'; |
28 | 69 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
29 | 70 | import { useMessage } from '/@/hooks/web/useMessage'; |
30 | 71 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; |
31 | - import { useModal } from '/@/components/Modal'; | |
72 | + import { BasicModal, useModal } from '/@/components/Modal'; | |
32 | 73 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; |
33 | 74 | import { getDeviceToken } from '/@/api/device/deviceManager'; |
34 | 75 | import { Description, useDescription } from '/@/components/Description'; |
35 | - import wz from '/@/assets/images/wz.png'; | |
76 | + import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | |
77 | + import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | |
36 | 78 | |
79 | + import wz from '/@/assets/images/wz.png'; | |
37 | 80 | export default defineComponent({ |
38 | 81 | components: { |
39 | 82 | Image, |
40 | 83 | Description, |
41 | 84 | ManageDeviceTokenModal, |
85 | + QuestionCircleOutlined, | |
86 | + BasicModal, | |
87 | + Tooltip, | |
42 | 88 | }, |
43 | 89 | props: { |
44 | 90 | deviceDetail: { |
... | ... | @@ -108,6 +154,13 @@ |
108 | 154 | const token = await getDeviceToken(props.deviceDetail.tbDeviceId); |
109 | 155 | openModal(true, token); |
110 | 156 | }; |
157 | + const copyTopic = (value) => { | |
158 | + clipboardRef.value = value; | |
159 | + console.log(clipboardRef.value); | |
160 | + createMessage.success('复制成功~'); | |
161 | + }; | |
162 | + | |
163 | + const [registerTopicModal, { openModal: openTopicModal }] = useModal(); | |
111 | 164 | |
112 | 165 | return { |
113 | 166 | wrapRef, |
... | ... | @@ -117,6 +170,10 @@ |
117 | 170 | manageDeviceToken, |
118 | 171 | registerModal, |
119 | 172 | register, |
173 | + openTopicModal, | |
174 | + registerTopicModal, | |
175 | + DeviceTypeEnum, | |
176 | + copyTopic, | |
120 | 177 | }; |
121 | 178 | }, |
122 | 179 | }); | ... | ... |
... | ... | @@ -82,7 +82,7 @@ export const searchFormSchema: FormSchema[] = [ |
82 | 82 | field: 'roleName', |
83 | 83 | label: '角色名称', |
84 | 84 | component: 'Input', |
85 | - colProps: { span: 8 }, | |
85 | + colProps: { span: 6 }, | |
86 | 86 | componentProps: { |
87 | 87 | maxLength: 255, |
88 | 88 | }, |
... | ... | @@ -97,7 +97,7 @@ export const searchFormSchema: FormSchema[] = [ |
97 | 97 | { label: '停用', value: 0 }, |
98 | 98 | ], |
99 | 99 | }, |
100 | - colProps: { span: 8 }, | |
100 | + colProps: { span: 6 }, | |
101 | 101 | }, |
102 | 102 | ]; |
103 | 103 | ... | ... |
... | ... | @@ -94,7 +94,6 @@ export const schemas: FormSchema[] = [ |
94 | 94 | field: 'synopsis', |
95 | 95 | component: 'InputTextArea', |
96 | 96 | label: '公司简介', |
97 | - | |
98 | 97 | colProps: { |
99 | 98 | span: 24, |
100 | 99 | }, |
... | ... | @@ -133,11 +132,106 @@ export const schemas: FormSchema[] = [ |
133 | 132 | }, |
134 | 133 | }, |
135 | 134 | { |
135 | + field: 'prov', | |
136 | + label: '所在城市', | |
137 | + component: 'Input', | |
138 | + colProps: { | |
139 | + span: 24, | |
140 | + }, | |
141 | + | |
142 | + slot: 'customProv', | |
143 | + }, | |
144 | + { | |
145 | + field: 'address', | |
146 | + component: 'Input', | |
147 | + label: '详细地址', | |
148 | + colProps: { | |
149 | + span: 24, | |
150 | + }, | |
151 | + componentProps: { | |
152 | + maxLength: 100, | |
153 | + placeholder: '请输入详细地址', | |
154 | + }, | |
155 | + dynamicRules: () => { | |
156 | + return [ | |
157 | + { | |
158 | + required: false, | |
159 | + validator: (_, value) => { | |
160 | + if (String(value).length > 100) { | |
161 | + return Promise.reject('字数不超过100个字'); | |
162 | + } | |
163 | + return Promise.resolve(); | |
164 | + }, | |
165 | + }, | |
166 | + ]; | |
167 | + }, | |
168 | + }, | |
169 | + | |
170 | + { | |
171 | + field: 'contacts', | |
172 | + component: 'Input', | |
173 | + label: '联系人', | |
174 | + colProps: { | |
175 | + span: 24, | |
176 | + }, | |
177 | + componentProps: { | |
178 | + maxLength: 25, | |
179 | + placeholder: '请输入联系人', | |
180 | + }, | |
181 | + dynamicRules: () => { | |
182 | + return [ | |
183 | + { | |
184 | + required: false, | |
185 | + validator: (_, value) => { | |
186 | + if (String(value).length > 25) { | |
187 | + return Promise.reject('字数不超过25个字'); | |
188 | + } | |
189 | + return Promise.resolve(); | |
190 | + }, | |
191 | + }, | |
192 | + ]; | |
193 | + }, | |
194 | + }, | |
195 | + { | |
196 | + field: 'tel', | |
197 | + component: 'Input', | |
198 | + label: '联系电话', | |
199 | + colProps: { | |
200 | + span: 24, | |
201 | + }, | |
202 | + componentProps: { | |
203 | + placeholder: '请输入联系电话', | |
204 | + }, | |
205 | + rules: phoneRule, | |
206 | + }, | |
207 | + { | |
208 | + field: 'qrcode', | |
209 | + label: '二维码', | |
210 | + component: 'Input', | |
211 | + colProps: { | |
212 | + span: 24, | |
213 | + }, | |
214 | + slot: 'qrcode', | |
215 | + }, | |
216 | + { | |
217 | + field: 'id', | |
218 | + label: '唯一id', | |
219 | + component: 'Input', | |
220 | + show: false, | |
221 | + componentProps: { | |
222 | + maxLength: 36, | |
223 | + placeholder: '请输入唯一id', | |
224 | + }, | |
225 | + }, | |
226 | +]; | |
227 | + | |
228 | +export const provSchemas: FormSchema[] = [ | |
229 | + { | |
136 | 230 | field: 'nameProv', |
137 | 231 | component: 'ApiSelect', |
138 | - label: '所在城市', | |
232 | + label: '', | |
139 | 233 | colProps: { |
140 | - span: 5, | |
234 | + span: 6, | |
141 | 235 | }, |
142 | 236 | componentProps({ formModel, formActionType }) { |
143 | 237 | const { updateSchema } = formActionType; |
... | ... | @@ -259,12 +353,8 @@ export const schemas: FormSchema[] = [ |
259 | 353 | field: 'nameCity', |
260 | 354 | component: 'Select', |
261 | 355 | label: '', |
262 | - labelWidth: 0, | |
263 | 356 | colProps: { |
264 | - span: 5, | |
265 | - style: { | |
266 | - marginLeft: '-5rem', | |
267 | - }, | |
357 | + span: 6, | |
268 | 358 | }, |
269 | 359 | }, |
270 | 360 | { |
... | ... | @@ -272,10 +362,7 @@ export const schemas: FormSchema[] = [ |
272 | 362 | component: 'Select', |
273 | 363 | label: '', |
274 | 364 | colProps: { |
275 | - span: 5, | |
276 | - style: { | |
277 | - marginLeft: '-10rem', | |
278 | - }, | |
365 | + span: 6, | |
279 | 366 | }, |
280 | 367 | componentProps: { |
281 | 368 | placeholder: '区/县', |
... | ... | @@ -287,112 +374,9 @@ export const schemas: FormSchema[] = [ |
287 | 374 | label: '', |
288 | 375 | colProps: { |
289 | 376 | span: 6, |
290 | - style: { | |
291 | - marginLeft: '-10rem', | |
292 | - }, | |
293 | 377 | }, |
294 | 378 | componentProps: { |
295 | 379 | placeholder: '城镇/街道', |
296 | 380 | }, |
297 | 381 | }, |
298 | - { | |
299 | - field: 'address', | |
300 | - component: 'Input', | |
301 | - label: '详细地址', | |
302 | - colProps: { | |
303 | - span: 24, | |
304 | - }, | |
305 | - componentProps: { | |
306 | - maxLength: 100, | |
307 | - placeholder: '请输入详细地址', | |
308 | - }, | |
309 | - dynamicRules: () => { | |
310 | - return [ | |
311 | - { | |
312 | - required: false, | |
313 | - validator: (_, value) => { | |
314 | - if (String(value).length > 100) { | |
315 | - return Promise.reject('字数不超过100个字'); | |
316 | - } | |
317 | - return Promise.resolve(); | |
318 | - }, | |
319 | - }, | |
320 | - ]; | |
321 | - }, | |
322 | - }, | |
323 | - | |
324 | - { | |
325 | - field: 'contacts', | |
326 | - component: 'Input', | |
327 | - label: '联系人', | |
328 | - colProps: { | |
329 | - span: 24, | |
330 | - }, | |
331 | - componentProps: { | |
332 | - maxLength: 25, | |
333 | - placeholder: '请输入联系人', | |
334 | - }, | |
335 | - dynamicRules: () => { | |
336 | - return [ | |
337 | - { | |
338 | - required: false, | |
339 | - validator: (_, value) => { | |
340 | - if (String(value).length > 25) { | |
341 | - return Promise.reject('字数不超过25个字'); | |
342 | - } | |
343 | - return Promise.resolve(); | |
344 | - }, | |
345 | - }, | |
346 | - ]; | |
347 | - }, | |
348 | - }, | |
349 | - { | |
350 | - field: 'tel', | |
351 | - component: 'Input', | |
352 | - label: '联系电话', | |
353 | - colProps: { | |
354 | - span: 24, | |
355 | - }, | |
356 | - componentProps: { | |
357 | - placeholder: '请输入联系电话', | |
358 | - }, | |
359 | - rules: phoneRule, | |
360 | - }, | |
361 | - { | |
362 | - field: 'qrcode', | |
363 | - label: '二维码', | |
364 | - component: 'Input', | |
365 | - componentProps: { | |
366 | - maxLength: 255, | |
367 | - placeholder: '请输入二维码', | |
368 | - }, | |
369 | - dynamicRules: () => { | |
370 | - return [ | |
371 | - { | |
372 | - required: false, | |
373 | - validator: (_, value) => { | |
374 | - if (String(value).length > 255) { | |
375 | - return Promise.reject('字数不超过255个字'); | |
376 | - } | |
377 | - return Promise.resolve(); | |
378 | - }, | |
379 | - }, | |
380 | - ]; | |
381 | - }, | |
382 | - | |
383 | - colProps: { | |
384 | - span: 24, | |
385 | - }, | |
386 | - slot: 'qrcode', | |
387 | - }, | |
388 | - { | |
389 | - field: 'id', | |
390 | - label: '唯一id', | |
391 | - component: 'Input', | |
392 | - show: false, | |
393 | - componentProps: { | |
394 | - maxLength: 36, | |
395 | - placeholder: '请输入唯一id', | |
396 | - }, | |
397 | - }, | |
398 | 382 | ]; | ... | ... |
... | ... | @@ -14,12 +14,12 @@ |
14 | 14 | > |
15 | 15 | <img v-if="logoPic" :src="logoPic" /> |
16 | 16 | <div v-else> |
17 | - <div style="margin-top: 30px"> | |
18 | - <PlusOutlined style="font-size: 50px" /> | |
17 | + <div style="margin-top: 1.875rem"> | |
18 | + <PlusOutlined style="font-size: 2.5rem" /> | |
19 | 19 | </div> |
20 | 20 | <div |
21 | 21 | class="ant-upload-text flex" |
22 | - style="width: 180px; height: 100px; align-items: center; font-size: 9px" | |
22 | + style="width: 180px; height: 100px; align-items: center; font-size: 0.5625rem" | |
23 | 23 | > |
24 | 24 | 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div |
25 | 25 | > |
... | ... | @@ -37,12 +37,12 @@ |
37 | 37 | > |
38 | 38 | <img v-if="bgPic" :src="bgPic" alt="avatar" /> |
39 | 39 | <div v-else> |
40 | - <div style="margin-top: 30px"> | |
41 | - <PlusOutlined style="font-size: 50px" /> | |
40 | + <div style="margin-top: 1.875rem"> | |
41 | + <PlusOutlined style="font-size: 2.5rem" /> | |
42 | 42 | </div> |
43 | 43 | <div |
44 | 44 | class="ant-upload-text flex" |
45 | - style="width: 280px; height: 100px; align-items: center; font-size: 9px" | |
45 | + style="width: 280px; height: 100px; align-items: center; font-size: 0.5625rem" | |
46 | 46 | > |
47 | 47 | 支持.PNG、.JPG格式,建议尺寸为1080*1620px,大小不超过5M</div |
48 | 48 | > |
... | ... | @@ -64,12 +64,12 @@ |
64 | 64 | :before-upload="beforeUploadHomeSwiper" |
65 | 65 | > |
66 | 66 | <div v-if="fileList.length < 5"> |
67 | - <div style="margin-top: 30px"> | |
68 | - <PlusOutlined style="font-size: 50px" /> | |
67 | + <div style="margin-top: 1.875rem"> | |
68 | + <PlusOutlined style="font-size: 2.5rem" /> | |
69 | 69 | </div> |
70 | 70 | <div |
71 | 71 | class="ant-upload-text flex" |
72 | - style="width: 150px; height: 70px; align-items: center; font-size: 9px" | |
72 | + style="width: 150px; height: 70px; align-items: center; font-size: 0.5625rem" | |
73 | 73 | >支持.PNG、.JPG格式,建议尺寸为800*600px,大小不超过3M</div |
74 | 74 | > |
75 | 75 | </div> | ... | ... |
... | ... | @@ -13,12 +13,12 @@ |
13 | 13 | > |
14 | 14 | <img v-if="logoPic" :src="logoPic" /> |
15 | 15 | <div v-else> |
16 | - <div style="margin-top: 30px"> | |
17 | - <PlusOutlined style="font-size: 50px" /> | |
16 | + <div style="margin-top: 1.875rem"> | |
17 | + <PlusOutlined style="font-size: 2.5rem" /> | |
18 | 18 | </div> |
19 | 19 | <div |
20 | 20 | class="ant-upload-text flex" |
21 | - style="width: 180px; height: 100px; align-items: center; font-size: 9px" | |
21 | + style="width: 180px; height: 100px; align-items: center; font-size: 0.5625rem" | |
22 | 22 | > |
23 | 23 | 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div |
24 | 24 | > |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | </div> |
45 | 45 | <div |
46 | 46 | class="ant-upload-text flex" |
47 | - style="width: 130px; height: 70px; align-items: center; font-size: 9px" | |
47 | + style="width: 130px; height: 70px; align-items: center; font-size: 0.5625rem" | |
48 | 48 | > |
49 | 49 | 支持.ICON格式,建议尺寸为16*16px</div |
50 | 50 | > |
... | ... | @@ -62,12 +62,12 @@ |
62 | 62 | > |
63 | 63 | <img v-if="bgPic" :src="bgPic" alt="avatar" /> |
64 | 64 | <div v-else> |
65 | - <div style="margin-top: 30px"> | |
66 | - <PlusOutlined style="font-size: 50px" /> | |
65 | + <div style="margin-top: 1.875rem"> | |
66 | + <PlusOutlined style="font-size: 2.5rem" /> | |
67 | 67 | </div> |
68 | 68 | <div |
69 | 69 | class="ant-upload-text flex" |
70 | - style="width: 280px; height: 130px; align-items: center; font-size: 9px" | |
70 | + style="width: 280px; height: 130px; align-items: center; font-size: 0.5625rem" | |
71 | 71 | > |
72 | 72 | 支持.PNG、.JPG格式,建议尺寸为1920*1080px以上,大小不超过5M</div |
73 | 73 | > | ... | ... |
... | ... | @@ -13,18 +13,21 @@ |
13 | 13 | > |
14 | 14 | <img v-if="qrcodePic" :src="qrcodePic" alt="avatar" /> |
15 | 15 | <div v-else> |
16 | - <div style="margin-top: 30px"> | |
17 | - <PlusOutlined style="font-size: 50px" /> | |
16 | + <div style="margin-top: 1.875rem"> | |
17 | + <PlusOutlined style="font-size: 2.5rem" /> | |
18 | 18 | </div> |
19 | 19 | <div |
20 | 20 | class="ant-upload-text flex" |
21 | - style="width: 180px; height: 100px; align-items: center; font-size: 9px" | |
21 | + style="width: 180px; height: 100px; align-items: center; font-size: 0.5625rem" | |
22 | 22 | > |
23 | 23 | 支持.PNG、.JPG格式,建议尺寸为300*300px,大小不超过2M</div |
24 | 24 | > |
25 | 25 | </div> |
26 | 26 | </Upload> |
27 | 27 | </template> |
28 | + <template #customProv> | |
29 | + <BasicForm @register="registerCustomForm" /> | |
30 | + </template> | |
28 | 31 | </BasicForm> |
29 | 32 | </Card> |
30 | 33 | <Loading v-bind="compState" /> |
... | ... | @@ -32,7 +35,7 @@ |
32 | 35 | @click="handleUpdateInfo" |
33 | 36 | size="large" |
34 | 37 | type="primary" |
35 | - style="margin-top: 20px; border-radius: 5px" | |
38 | + style="margin-top: 1rem; border-radius: 0.5rem" | |
36 | 39 | >更新基本信息</a-button |
37 | 40 | > |
38 | 41 | </div> |
... | ... | @@ -42,7 +45,7 @@ |
42 | 45 | import { defineComponent, onMounted, ref } from 'vue'; |
43 | 46 | import { Card, Upload } from 'ant-design-vue'; |
44 | 47 | import { BasicForm, useForm } from '/@/components/Form/index'; |
45 | - import { schemas } from '../config/enterPriseInfo.config'; | |
48 | + import { schemas, provSchemas } from '../config/enterPriseInfo.config'; | |
46 | 49 | import { getAreaList, getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index'; |
47 | 50 | import { Loading } from '/@/components/Loading'; |
48 | 51 | import { useMessage } from '/@/hooks/web/useMessage'; |
... | ... | @@ -66,15 +69,30 @@ |
66 | 69 | loading: false, |
67 | 70 | tip: '拼命加载中...', |
68 | 71 | }); |
69 | - const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, validate }] = useForm({ | |
72 | + const [registerForm, { getFieldsValue, setFieldsValue, validate }] = useForm({ | |
70 | 73 | labelWidth: 80, |
71 | 74 | schemas, |
72 | 75 | showResetButton: false, |
73 | 76 | showSubmitButton: false, |
74 | 77 | wrapperCol: { |
75 | - span: 10, | |
78 | + span: 12, | |
79 | + }, | |
80 | + }); | |
81 | + | |
82 | + const [ | |
83 | + registerCustomForm, | |
84 | + { getFieldsValue: getNameTown, updateSchema, setFieldsValue: setNameTown }, | |
85 | + ] = useForm({ | |
86 | + labelWidth: 80, | |
87 | + schemas: provSchemas, | |
88 | + showResetButton: false, | |
89 | + showSubmitButton: false, | |
90 | + compact: true, | |
91 | + actionColOptions: { | |
92 | + span: 0, | |
76 | 93 | }, |
77 | 94 | }); |
95 | + | |
78 | 96 | const { createMessage } = useMessage(); |
79 | 97 | |
80 | 98 | const qrcodePic = ref(); |
... | ... | @@ -103,9 +121,10 @@ |
103 | 121 | const handleUpdateInfo = async () => { |
104 | 122 | try { |
105 | 123 | const fieldsValue = getFieldsValue(); |
124 | + const { nameTown } = getNameTown(); | |
106 | 125 | const newFieldValue: any = { |
107 | 126 | ...fieldsValue, |
108 | - codeTown: fieldsValue.nameTown, | |
127 | + codeTown: nameTown, | |
109 | 128 | qrCode: qrcodePic.value, |
110 | 129 | }; |
111 | 130 | delete newFieldValue.nameProv; |
... | ... | @@ -157,7 +176,7 @@ |
157 | 176 | item.label = item.name; |
158 | 177 | item.value = item.code; |
159 | 178 | }); |
160 | - const { codeCountry, codeProv, codeCity, codeCoun, codeTown } = code; | |
179 | + const { codeProv, codeCity, codeCoun, codeTown } = code; | |
161 | 180 | updateSchema([ |
162 | 181 | { |
163 | 182 | field: 'nameCity', |
... | ... | @@ -227,7 +246,7 @@ |
227 | 246 | options: couns, |
228 | 247 | async onChange(value) { |
229 | 248 | if (value === undefined) { |
230 | - setFieldsValue({ | |
249 | + setNameTown({ | |
231 | 250 | nameTown: undefined, |
232 | 251 | }); |
233 | 252 | updateSchema({ |
... | ... | @@ -243,7 +262,7 @@ |
243 | 262 | item.label = item.name; |
244 | 263 | item.value = item.code; |
245 | 264 | }); |
246 | - setFieldsValue({ | |
265 | + setNameTown({ | |
247 | 266 | nameTown: undefined, |
248 | 267 | }); |
249 | 268 | updateSchema({ |
... | ... | @@ -264,8 +283,7 @@ |
264 | 283 | }, |
265 | 284 | }, |
266 | 285 | ]); |
267 | - setFieldsValue({ | |
268 | - nameCountry: codeCountry, | |
286 | + setNameTown({ | |
269 | 287 | nameProv: codeProv, |
270 | 288 | nameCity: codeCity, |
271 | 289 | nameCoun: codeCoun, |
... | ... | @@ -286,12 +304,11 @@ |
286 | 304 | codeTown, |
287 | 305 | }; |
288 | 306 | updateCityData(cities, couns, towns, code); |
289 | - setFieldsValue(res); | |
290 | - qrcodePic.value = res.qrCode; | |
291 | - } else { | |
292 | - setFieldsValue(res); | |
293 | - qrcodePic.value = res.qrCode; | |
307 | + setFieldsValue({ nameCountry: codeCountry }); | |
294 | 308 | } |
309 | + setFieldsValue(res); | |
310 | + console.log(res); | |
311 | + qrcodePic.value = res.qrCode; | |
295 | 312 | }); |
296 | 313 | |
297 | 314 | return { |
... | ... | @@ -301,6 +318,7 @@ |
301 | 318 | handleUpdateInfo, |
302 | 319 | customUploadqrcodePic, |
303 | 320 | beforeUploadqrcodePic, |
321 | + registerCustomForm, | |
304 | 322 | }; |
305 | 323 | }, |
306 | 324 | }); | ... | ... |
... | ... | @@ -4,7 +4,6 @@ import { h } from 'vue'; |
4 | 4 | import { Switch } from 'ant-design-vue'; |
5 | 5 | import { setRoleStatus } from '/@/api/system/system'; |
6 | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
7 | -import { RoleEnum } from '/@/enums/roleEnum'; | |
8 | 7 | export const columns: BasicColumn[] = [ |
9 | 8 | { |
10 | 9 | title: '角色名称', |
... | ... | @@ -66,23 +65,13 @@ export const searchFormSchema: FormSchema[] = [ |
66 | 65 | field: 'roleName', |
67 | 66 | label: '角色名称', |
68 | 67 | component: 'Input', |
69 | - colProps: { span: 8 }, | |
68 | + colProps: { span: 6 }, | |
70 | 69 | componentProps: { |
71 | 70 | maxLength: 255, |
72 | 71 | placeholder: '请输入角色名称', |
73 | 72 | }, |
74 | 73 | }, |
75 | - { | |
76 | - field: 'roleType', | |
77 | - label: '', | |
78 | - component: 'Input', | |
79 | - colProps: { span: 8 }, | |
80 | - defaultValue: RoleEnum.TENANT_ADMIN, | |
81 | - ifShow: false, | |
82 | - componentProps: { | |
83 | - maxLength: 20, | |
84 | - }, | |
85 | - }, | |
74 | + | |
86 | 75 | { |
87 | 76 | field: 'status', |
88 | 77 | label: '状态', |
... | ... | @@ -93,7 +82,7 @@ export const searchFormSchema: FormSchema[] = [ |
93 | 82 | { label: '停用', value: 0 }, |
94 | 83 | ], |
95 | 84 | }, |
96 | - colProps: { span: 8 }, | |
85 | + colProps: { span: 6 }, | |
97 | 86 | }, |
98 | 87 | ]; |
99 | 88 | ... | ... |