Commit a6f77a1ff57b71c7001fd4071704a02e83fb4abf

Authored by xp.Huang
2 parents 93a5d035 b975b384

Merge branch 'sqy_dev' into 'main'

fix:oem地区选择调整,适配小屏幕,feat:设备配置新增Topic提示

See merge request huang/yun-teng-iot-front!120
@@ -8,13 +8,13 @@ VITE_PUBLIC_PATH = / @@ -8,13 +8,13 @@ VITE_PUBLIC_PATH = /
8 # Please note that no line breaks 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 VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] 14 VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 15
16 # 实时数据的ws地址 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 # Delete console 19 # Delete console
20 VITE_DROP_CONSOLE = true 20 VITE_DROP_CONSOLE = true
@@ -23,7 +23,7 @@ VITE_DROP_CONSOLE = true @@ -23,7 +23,7 @@ VITE_DROP_CONSOLE = true
23 VITE_GLOB_API_URL=/api 23 VITE_GLOB_API_URL=/api
24 24
25 # File upload address, optional 25 # File upload address, optional
26 -VITE_GLOB_UPLOAD_URL=/upload 26 +VITE_GLOB_UPLOAD_URL=/api/yt/oss/upload
27 27
28 # Interface prefix 28 # Interface prefix
29 VITE_GLOB_API_URL_PREFIX=/yt 29 VITE_GLOB_API_URL_PREFIX=/yt
@@ -20,7 +20,8 @@ VITE_GLOB_API_URL=http://101.133.234.90:8080/api @@ -20,7 +20,8 @@ VITE_GLOB_API_URL=http://101.133.234.90:8080/api
20 20
21 # File upload address, optional 21 # File upload address, optional
22 # It can be forwarded by nginx or write the actual address directly 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 # Interface prefix 26 # Interface prefix
26 VITE_GLOB_API_URL_PREFIX=/yt 27 VITE_GLOB_API_URL_PREFIX=/yt
@@ -54,7 +54,7 @@ export const alarmSearchSchemas: FormSchema[] = [ @@ -54,7 +54,7 @@ export const alarmSearchSchemas: FormSchema[] = [
54 }, 54 },
55 { 55 {
56 field: 'endTime', 56 field: 'endTime',
57 - label: '告警时间范围', 57 + label: '告警时间',
58 component: 'DatePicker', 58 component: 'DatePicker',
59 componentProps: { 59 componentProps: {
60 valueFormat: 'x', 60 valueFormat: 'x',
@@ -54,7 +54,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -54,7 +54,7 @@ export const searchFormSchema: FormSchema[] = [
54 field: 'username', 54 field: 'username',
55 label: '联系人姓名', 55 label: '联系人姓名',
56 component: 'Input', 56 component: 'Input',
57 - colProps: { span: 6 }, 57 + colProps: { span: 8 },
58 componentProps: { 58 componentProps: {
59 maxLength: 36, 59 maxLength: 36,
60 placeholder: '请输入联系人姓名', 60 placeholder: '请输入联系人姓名',
@@ -5,7 +5,48 @@ @@ -5,7 +5,48 @@
5 <Image :src="deviceDetail.deviceInfo.avatar" :width="100" /> 5 <Image :src="deviceDetail.deviceInfo.avatar" :width="100" />
6 </div> 6 </div>
7 <div> 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 <Description @register="register" class="mt-4" :data="deviceDetail" /> 50 <Description @register="register" class="mt-4" :data="deviceDetail" />
10 </div> 51 </div>
11 <div class="mt-4"> 52 <div class="mt-4">
@@ -22,23 +63,28 @@ @@ -22,23 +63,28 @@
22 </template> 63 </template>
23 <script lang="ts"> 64 <script lang="ts">
24 import { defineComponent, ref, unref, nextTick } from 'vue'; 65 import { defineComponent, ref, unref, nextTick } from 'vue';
25 - import { Image } from 'ant-design-vue'; 66 + import { Image, Tooltip } from 'ant-design-vue';
26 import { descSchema } from '../../config/detail.config'; 67 import { descSchema } from '../../config/detail.config';
27 import { useScript } from '/@/hooks/web/useScript'; 68 import { useScript } from '/@/hooks/web/useScript';
28 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; 69 import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
29 import { useMessage } from '/@/hooks/web/useMessage'; 70 import { useMessage } from '/@/hooks/web/useMessage';
30 import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; 71 import { BAI_DU_MAP_URL } from '/@/utils/fnUtils';
31 - import { useModal } from '/@/components/Modal'; 72 + import { BasicModal, useModal } from '/@/components/Modal';
32 import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; 73 import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue';
33 import { getDeviceToken } from '/@/api/device/deviceManager'; 74 import { getDeviceToken } from '/@/api/device/deviceManager';
34 import { Description, useDescription } from '/@/components/Description'; 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 export default defineComponent({ 80 export default defineComponent({
38 components: { 81 components: {
39 Image, 82 Image,
40 Description, 83 Description,
41 ManageDeviceTokenModal, 84 ManageDeviceTokenModal,
  85 + QuestionCircleOutlined,
  86 + BasicModal,
  87 + Tooltip,
42 }, 88 },
43 props: { 89 props: {
44 deviceDetail: { 90 deviceDetail: {
@@ -108,6 +154,13 @@ @@ -108,6 +154,13 @@
108 const token = await getDeviceToken(props.deviceDetail.tbDeviceId); 154 const token = await getDeviceToken(props.deviceDetail.tbDeviceId);
109 openModal(true, token); 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 return { 165 return {
113 wrapRef, 166 wrapRef,
@@ -117,6 +170,10 @@ @@ -117,6 +170,10 @@
117 manageDeviceToken, 170 manageDeviceToken,
118 registerModal, 171 registerModal,
119 register, 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,7 +82,7 @@ export const searchFormSchema: FormSchema[] = [
82 field: 'roleName', 82 field: 'roleName',
83 label: '角色名称', 83 label: '角色名称',
84 component: 'Input', 84 component: 'Input',
85 - colProps: { span: 8 }, 85 + colProps: { span: 6 },
86 componentProps: { 86 componentProps: {
87 maxLength: 255, 87 maxLength: 255,
88 }, 88 },
@@ -97,7 +97,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -97,7 +97,7 @@ export const searchFormSchema: FormSchema[] = [
97 { label: '停用', value: 0 }, 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,7 +94,6 @@ export const schemas: FormSchema[] = [
94 field: 'synopsis', 94 field: 'synopsis',
95 component: 'InputTextArea', 95 component: 'InputTextArea',
96 label: '公司简介', 96 label: '公司简介',
97 -  
98 colProps: { 97 colProps: {
99 span: 24, 98 span: 24,
100 }, 99 },
@@ -133,11 +132,106 @@ export const schemas: FormSchema[] = [ @@ -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 field: 'nameProv', 230 field: 'nameProv',
137 component: 'ApiSelect', 231 component: 'ApiSelect',
138 - label: '所在城市', 232 + label: '',
139 colProps: { 233 colProps: {
140 - span: 5, 234 + span: 6,
141 }, 235 },
142 componentProps({ formModel, formActionType }) { 236 componentProps({ formModel, formActionType }) {
143 const { updateSchema } = formActionType; 237 const { updateSchema } = formActionType;
@@ -259,12 +353,8 @@ export const schemas: FormSchema[] = [ @@ -259,12 +353,8 @@ export const schemas: FormSchema[] = [
259 field: 'nameCity', 353 field: 'nameCity',
260 component: 'Select', 354 component: 'Select',
261 label: '', 355 label: '',
262 - labelWidth: 0,  
263 colProps: { 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,10 +362,7 @@ export const schemas: FormSchema[] = [
272 component: 'Select', 362 component: 'Select',
273 label: '', 363 label: '',
274 colProps: { 364 colProps: {
275 - span: 5,  
276 - style: {  
277 - marginLeft: '-10rem',  
278 - }, 365 + span: 6,
279 }, 366 },
280 componentProps: { 367 componentProps: {
281 placeholder: '区/县', 368 placeholder: '区/县',
@@ -287,112 +374,9 @@ export const schemas: FormSchema[] = [ @@ -287,112 +374,9 @@ export const schemas: FormSchema[] = [
287 label: '', 374 label: '',
288 colProps: { 375 colProps: {
289 span: 6, 376 span: 6,
290 - style: {  
291 - marginLeft: '-10rem',  
292 - },  
293 }, 377 },
294 componentProps: { 378 componentProps: {
295 placeholder: '城镇/街道', 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,12 +14,12 @@
14 > 14 >
15 <img v-if="logoPic" :src="logoPic" /> 15 <img v-if="logoPic" :src="logoPic" />
16 <div v-else> 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 </div> 19 </div>
20 <div 20 <div
21 class="ant-upload-text flex" 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 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div 24 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div
25 > 25 >
@@ -37,12 +37,12 @@ @@ -37,12 +37,12 @@
37 > 37 >
38 <img v-if="bgPic" :src="bgPic" alt="avatar" /> 38 <img v-if="bgPic" :src="bgPic" alt="avatar" />
39 <div v-else> 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 </div> 42 </div>
43 <div 43 <div
44 class="ant-upload-text flex" 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 支持.PNG、.JPG格式,建议尺寸为1080*1620px,大小不超过5M</div 47 支持.PNG、.JPG格式,建议尺寸为1080*1620px,大小不超过5M</div
48 > 48 >
@@ -64,12 +64,12 @@ @@ -64,12 +64,12 @@
64 :before-upload="beforeUploadHomeSwiper" 64 :before-upload="beforeUploadHomeSwiper"
65 > 65 >
66 <div v-if="fileList.length < 5"> 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 </div> 69 </div>
70 <div 70 <div
71 class="ant-upload-text flex" 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 >支持.PNG、.JPG格式,建议尺寸为800*600px,大小不超过3M</div 73 >支持.PNG、.JPG格式,建议尺寸为800*600px,大小不超过3M</div
74 > 74 >
75 </div> 75 </div>
@@ -13,12 +13,12 @@ @@ -13,12 +13,12 @@
13 > 13 >
14 <img v-if="logoPic" :src="logoPic" /> 14 <img v-if="logoPic" :src="logoPic" />
15 <div v-else> 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 </div> 18 </div>
19 <div 19 <div
20 class="ant-upload-text flex" 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 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div 23 支持.PNG、.JPG格式,建议尺寸为32*32px,大小不超过500KB</div
24 > 24 >
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 </div> 44 </div>
45 <div 45 <div
46 class="ant-upload-text flex" 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 支持.ICON格式,建议尺寸为16*16px</div 49 支持.ICON格式,建议尺寸为16*16px</div
50 > 50 >
@@ -62,12 +62,12 @@ @@ -62,12 +62,12 @@
62 > 62 >
63 <img v-if="bgPic" :src="bgPic" alt="avatar" /> 63 <img v-if="bgPic" :src="bgPic" alt="avatar" />
64 <div v-else> 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 </div> 67 </div>
68 <div 68 <div
69 class="ant-upload-text flex" 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 支持.PNG、.JPG格式,建议尺寸为1920*1080px以上,大小不超过5M</div 72 支持.PNG、.JPG格式,建议尺寸为1920*1080px以上,大小不超过5M</div
73 > 73 >
@@ -13,18 +13,21 @@ @@ -13,18 +13,21 @@
13 > 13 >
14 <img v-if="qrcodePic" :src="qrcodePic" alt="avatar" /> 14 <img v-if="qrcodePic" :src="qrcodePic" alt="avatar" />
15 <div v-else> 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 </div> 18 </div>
19 <div 19 <div
20 class="ant-upload-text flex" 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 支持.PNG、.JPG格式,建议尺寸为300*300px,大小不超过2M</div 23 支持.PNG、.JPG格式,建议尺寸为300*300px,大小不超过2M</div
24 > 24 >
25 </div> 25 </div>
26 </Upload> 26 </Upload>
27 </template> 27 </template>
  28 + <template #customProv>
  29 + <BasicForm @register="registerCustomForm" />
  30 + </template>
28 </BasicForm> 31 </BasicForm>
29 </Card> 32 </Card>
30 <Loading v-bind="compState" /> 33 <Loading v-bind="compState" />
@@ -32,7 +35,7 @@ @@ -32,7 +35,7 @@
32 @click="handleUpdateInfo" 35 @click="handleUpdateInfo"
33 size="large" 36 size="large"
34 type="primary" 37 type="primary"
35 - style="margin-top: 20px; border-radius: 5px" 38 + style="margin-top: 1rem; border-radius: 0.5rem"
36 >更新基本信息</a-button 39 >更新基本信息</a-button
37 > 40 >
38 </div> 41 </div>
@@ -42,7 +45,7 @@ @@ -42,7 +45,7 @@
42 import { defineComponent, onMounted, ref } from 'vue'; 45 import { defineComponent, onMounted, ref } from 'vue';
43 import { Card, Upload } from 'ant-design-vue'; 46 import { Card, Upload } from 'ant-design-vue';
44 import { BasicForm, useForm } from '/@/components/Form/index'; 47 import { BasicForm, useForm } from '/@/components/Form/index';
45 - import { schemas } from '../config/enterPriseInfo.config'; 48 + import { schemas, provSchemas } from '../config/enterPriseInfo.config';
46 import { getAreaList, getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index'; 49 import { getAreaList, getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index';
47 import { Loading } from '/@/components/Loading'; 50 import { Loading } from '/@/components/Loading';
48 import { useMessage } from '/@/hooks/web/useMessage'; 51 import { useMessage } from '/@/hooks/web/useMessage';
@@ -66,15 +69,30 @@ @@ -66,15 +69,30 @@
66 loading: false, 69 loading: false,
67 tip: '拼命加载中...', 70 tip: '拼命加载中...',
68 }); 71 });
69 - const [registerForm, { getFieldsValue, setFieldsValue, updateSchema, validate }] = useForm({ 72 + const [registerForm, { getFieldsValue, setFieldsValue, validate }] = useForm({
70 labelWidth: 80, 73 labelWidth: 80,
71 schemas, 74 schemas,
72 showResetButton: false, 75 showResetButton: false,
73 showSubmitButton: false, 76 showSubmitButton: false,
74 wrapperCol: { 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 const { createMessage } = useMessage(); 96 const { createMessage } = useMessage();
79 97
80 const qrcodePic = ref(); 98 const qrcodePic = ref();
@@ -103,9 +121,10 @@ @@ -103,9 +121,10 @@
103 const handleUpdateInfo = async () => { 121 const handleUpdateInfo = async () => {
104 try { 122 try {
105 const fieldsValue = getFieldsValue(); 123 const fieldsValue = getFieldsValue();
  124 + const { nameTown } = getNameTown();
106 const newFieldValue: any = { 125 const newFieldValue: any = {
107 ...fieldsValue, 126 ...fieldsValue,
108 - codeTown: fieldsValue.nameTown, 127 + codeTown: nameTown,
109 qrCode: qrcodePic.value, 128 qrCode: qrcodePic.value,
110 }; 129 };
111 delete newFieldValue.nameProv; 130 delete newFieldValue.nameProv;
@@ -157,7 +176,7 @@ @@ -157,7 +176,7 @@
157 item.label = item.name; 176 item.label = item.name;
158 item.value = item.code; 177 item.value = item.code;
159 }); 178 });
160 - const { codeCountry, codeProv, codeCity, codeCoun, codeTown } = code; 179 + const { codeProv, codeCity, codeCoun, codeTown } = code;
161 updateSchema([ 180 updateSchema([
162 { 181 {
163 field: 'nameCity', 182 field: 'nameCity',
@@ -227,7 +246,7 @@ @@ -227,7 +246,7 @@
227 options: couns, 246 options: couns,
228 async onChange(value) { 247 async onChange(value) {
229 if (value === undefined) { 248 if (value === undefined) {
230 - setFieldsValue({ 249 + setNameTown({
231 nameTown: undefined, 250 nameTown: undefined,
232 }); 251 });
233 updateSchema({ 252 updateSchema({
@@ -243,7 +262,7 @@ @@ -243,7 +262,7 @@
243 item.label = item.name; 262 item.label = item.name;
244 item.value = item.code; 263 item.value = item.code;
245 }); 264 });
246 - setFieldsValue({ 265 + setNameTown({
247 nameTown: undefined, 266 nameTown: undefined,
248 }); 267 });
249 updateSchema({ 268 updateSchema({
@@ -264,8 +283,7 @@ @@ -264,8 +283,7 @@
264 }, 283 },
265 }, 284 },
266 ]); 285 ]);
267 - setFieldsValue({  
268 - nameCountry: codeCountry, 286 + setNameTown({
269 nameProv: codeProv, 287 nameProv: codeProv,
270 nameCity: codeCity, 288 nameCity: codeCity,
271 nameCoun: codeCoun, 289 nameCoun: codeCoun,
@@ -286,12 +304,11 @@ @@ -286,12 +304,11 @@
286 codeTown, 304 codeTown,
287 }; 305 };
288 updateCityData(cities, couns, towns, code); 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 return { 314 return {
@@ -301,6 +318,7 @@ @@ -301,6 +318,7 @@
301 handleUpdateInfo, 318 handleUpdateInfo,
302 customUploadqrcodePic, 319 customUploadqrcodePic,
303 beforeUploadqrcodePic, 320 beforeUploadqrcodePic,
  321 + registerCustomForm,
304 }; 322 };
305 }, 323 },
306 }); 324 });
@@ -4,7 +4,6 @@ import { h } from 'vue'; @@ -4,7 +4,6 @@ import { h } from 'vue';
4 import { Switch } from 'ant-design-vue'; 4 import { Switch } from 'ant-design-vue';
5 import { setRoleStatus } from '/@/api/system/system'; 5 import { setRoleStatus } from '/@/api/system/system';
6 import { useMessage } from '/@/hooks/web/useMessage'; 6 import { useMessage } from '/@/hooks/web/useMessage';
7 -import { RoleEnum } from '/@/enums/roleEnum';  
8 export const columns: BasicColumn[] = [ 7 export const columns: BasicColumn[] = [
9 { 8 {
10 title: '角色名称', 9 title: '角色名称',
@@ -66,23 +65,13 @@ export const searchFormSchema: FormSchema[] = [ @@ -66,23 +65,13 @@ export const searchFormSchema: FormSchema[] = [
66 field: 'roleName', 65 field: 'roleName',
67 label: '角色名称', 66 label: '角色名称',
68 component: 'Input', 67 component: 'Input',
69 - colProps: { span: 8 }, 68 + colProps: { span: 6 },
70 componentProps: { 69 componentProps: {
71 maxLength: 255, 70 maxLength: 255,
72 placeholder: '请输入角色名称', 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 field: 'status', 76 field: 'status',
88 label: '状态', 77 label: '状态',
@@ -93,7 +82,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -93,7 +82,7 @@ export const searchFormSchema: FormSchema[] = [
93 { label: '停用', value: 0 }, 82 { label: '停用', value: 0 },
94 ], 83 ],
95 }, 84 },
96 - colProps: { span: 8 }, 85 + colProps: { span: 6 },
97 }, 86 },
98 ]; 87 ];
99 88