Commit d8f77d935aafcb836d51bfc478a0aca40c37d904

Authored by ww
1 parent 7b924d4e

feat: device list create device modal add refresh clientID button

... ... @@ -421,6 +421,7 @@ export const step2Schemas: FormSchema[] = [
421 421 field: 'clientId',
422 422 required: true,
423 423 ifShow: false,
  424 + slot: 'clientId',
424 425 componentProps: {
425 426 maxLength: 36,
426 427 placeholder: '请输入客户端ID',
... ...
... ... @@ -12,7 +12,9 @@
12 12 <template #clientId="{ field, model }">
13 13 <div class="flex items-center">
14 14 <Input v-model:value="model[field]" placeholder="请输入客户端ID" />
15   - <ReloadOutlined class="ml-3 !text-blue-600" @click="handleCreateUUID" />
  15 + <Tooltip title="刷新客户端ID">
  16 + <ReloadOutlined class="ml-3 !text-blue-600" @click="handleCreateUUID" />
  17 + </Tooltip>
16 18 </div>
17 19 </template>
18 20 </BasicForm>
... ... @@ -26,7 +28,7 @@
26 28 import { TokenSchemas, credentialTypeEnum } from '../../config/data';
27 29 import { saveDeviceToken } from '/@/api/device/deviceManager';
28 30 import { useMessage } from '/@/hooks/web/useMessage';
29   - import { Input } from 'ant-design-vue';
  31 + import { Input, Tooltip } from 'ant-design-vue';
30 32 import { buildUUID } from '/@/utils/uuid';
31 33 import { ReloadOutlined } from '@ant-design/icons-vue';
32 34 export default defineComponent({
... ... @@ -35,6 +37,7 @@
35 37 BasicForm,
36 38 Input,
37 39 ReloadOutlined,
  40 + Tooltip,
38 41 },
39 42 emits: ['register'],
40 43 setup() {
... ...
... ... @@ -4,6 +4,18 @@
4 4 <template #addAgree="{ model, field }">
5 5 <Checkbox v-model:checked="model[field]" @change="checkedChange">添加协议</Checkbox>
6 6 </template>
  7 + <template #clientId="{ model, field }">
  8 + <div class="flex justify-center items-center">
  9 + <Input v-model:value="model[field]" placeholder="请输入客户端ID" />
  10 + <Tooltip title="刷新客户端ID">
  11 + <Icon
  12 + class="ml-3 cursor-pointer !text-blue-600"
  13 + icon="ant-design:reload-outlined"
  14 + @click="handleGenerateClientId"
  15 + />
  16 + </Tooltip>
  17 + </div>
  18 + </template>
7 19 </BasicForm>
8 20 <div>
9 21 <a-button @click="prevStep">上一步</a-button>
... ... @@ -13,13 +25,18 @@
13 25 <script lang="ts">
14 26 import { defineComponent } from 'vue';
15 27
16   - import { Checkbox } from 'ant-design-vue';
  28 + import { Checkbox, Input, Tooltip } from 'ant-design-vue';
17 29 import { BasicForm, useForm } from '/@/components/Form';
18 30 import { step2Schemas } from '../../config/data';
  31 + import { Icon } from '/@/components/Icon';
  32 + import { buildUUID } from '/@/utils/uuid';
19 33 export default defineComponent({
20 34 components: {
21 35 BasicForm,
22 36 Checkbox,
  37 + Input,
  38 + Icon,
  39 + Tooltip,
23 40 },
24 41
25 42 emits: ['prev', 'next'],
... ... @@ -105,6 +122,10 @@
105 122 validate();
106 123 }
107 124
  125 + const handleGenerateClientId = () => {
  126 + setFieldsValue({ clientId: buildUUID() });
  127 + };
  128 +
108 129 return {
109 130 prevStep,
110 131 registerForm,
... ... @@ -113,6 +134,7 @@
113 134 validate,
114 135 resetFieldsValueAndStatus,
115 136 validateStep2Method,
  137 + handleGenerateClientId,
116 138 };
117 139 },
118 140 });
... ...