Showing
11 changed files
with
223 additions
and
42 deletions
| @@ -11,25 +11,25 @@ import { useMessage } from '/@/hooks/web/useMessage'; | @@ -11,25 +11,25 @@ import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 11 | // 表格列数据 | 11 | // 表格列数据 |
| 12 | export const columns: BasicColumn[] = [ | 12 | export const columns: BasicColumn[] = [ |
| 13 | { | 13 | { |
| 14 | - title: '告警配置名称', | 14 | + title: '配置名称', |
| 15 | dataIndex: 'name', | 15 | dataIndex: 'name', |
| 16 | width: 120, | 16 | width: 120, |
| 17 | }, | 17 | }, |
| 18 | { | 18 | { |
| 19 | title: '所属组织', | 19 | title: '所属组织', |
| 20 | dataIndex: 'organizationName', | 20 | dataIndex: 'organizationName', |
| 21 | - width: 160, | 21 | + width: 150, |
| 22 | }, | 22 | }, |
| 23 | { | 23 | { |
| 24 | - title: '告警通知联系人', | 24 | + title: '告警联系人', |
| 25 | dataIndex: 'alarmContactId', | 25 | dataIndex: 'alarmContactId', |
| 26 | - width: 160, | 26 | + width: 155, |
| 27 | slots: { customRender: 'alarmContact' }, | 27 | slots: { customRender: 'alarmContact' }, |
| 28 | }, | 28 | }, |
| 29 | { | 29 | { |
| 30 | - title: '告警联系方式', | 30 | + title: '联系方式', |
| 31 | dataIndex: 'messageMode', | 31 | dataIndex: 'messageMode', |
| 32 | - width: 160, | 32 | + width: 155, |
| 33 | slots: { customRender: 'messageMode' }, | 33 | slots: { customRender: 'messageMode' }, |
| 34 | }, | 34 | }, |
| 35 | { | 35 | { |
| @@ -42,8 +42,8 @@ export const columns: BasicColumn[] = [ | @@ -42,8 +42,8 @@ export const columns: BasicColumn[] = [ | ||
| 42 | } | 42 | } |
| 43 | return h(Switch, { | 43 | return h(Switch, { |
| 44 | checked: record.status === 1, | 44 | checked: record.status === 1, |
| 45 | - checkedChildren: '配置', | ||
| 46 | - unCheckedChildren: '未配置', | 45 | + checkedChildren: '启用', |
| 46 | + unCheckedChildren: '未启用', | ||
| 47 | loading: record.pendingStatus, | 47 | loading: record.pendingStatus, |
| 48 | onChange(checked: boolean) { | 48 | onChange(checked: boolean) { |
| 49 | record.pendingStatus = true; | 49 | record.pendingStatus = true; |
| @@ -53,9 +53,9 @@ export const columns: BasicColumn[] = [ | @@ -53,9 +53,9 @@ export const columns: BasicColumn[] = [ | ||
| 53 | .then(() => { | 53 | .then(() => { |
| 54 | record.status = newStatus; | 54 | record.status = newStatus; |
| 55 | if (record.status == 1) { | 55 | if (record.status == 1) { |
| 56 | - createMessage.success(`已配置`); | 56 | + createMessage.success(`启用`); |
| 57 | } else { | 57 | } else { |
| 58 | - createMessage.error('未配置'); | 58 | + createMessage.success('未启用'); |
| 59 | } | 59 | } |
| 60 | }) | 60 | }) |
| 61 | .finally(() => { | 61 | .finally(() => { |
| @@ -88,7 +88,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -88,7 +88,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 88 | field: 'name', | 88 | field: 'name', |
| 89 | label: '告警配置名称', | 89 | label: '告警配置名称', |
| 90 | component: 'Input', | 90 | component: 'Input', |
| 91 | - colProps: { span: 8 }, | 91 | + colProps: { span: 6 }, |
| 92 | componentProps: { | 92 | componentProps: { |
| 93 | maxLength: 36, | 93 | maxLength: 36, |
| 94 | placeholder: '请输入告警配置名称', | 94 | placeholder: '请输入告警配置名称', |
| @@ -98,15 +98,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -98,15 +98,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 98 | field: 'status', | 98 | field: 'status', |
| 99 | label: '告警配置状态', | 99 | label: '告警配置状态', |
| 100 | component: 'Select', | 100 | component: 'Select', |
| 101 | - colProps: { span: 8 }, | 101 | + colProps: { span: 6 }, |
| 102 | componentProps: { | 102 | componentProps: { |
| 103 | options: [ | 103 | options: [ |
| 104 | { | 104 | { |
| 105 | - label: '已配置', | 105 | + label: '启用', |
| 106 | value: 1, | 106 | value: 1, |
| 107 | }, | 107 | }, |
| 108 | { | 108 | { |
| 109 | - label: '未配置', | 109 | + label: '未启用', |
| 110 | value: 0, | 110 | value: 0, |
| 111 | }, | 111 | }, |
| 112 | ], | 112 | ], |
| @@ -20,12 +20,12 @@ | @@ -20,12 +20,12 @@ | ||
| 20 | </template> | 20 | </template> |
| 21 | <template #alarmContact="{ record }"> | 21 | <template #alarmContact="{ record }"> |
| 22 | <a-button type="link" class="ml-2" @click="showAlarmContact(record)"> | 22 | <a-button type="link" class="ml-2" @click="showAlarmContact(record)"> |
| 23 | - 查看告警联系人 | 23 | + 查看联系人 |
| 24 | </a-button> | 24 | </a-button> |
| 25 | </template> | 25 | </template> |
| 26 | <template #messageMode="{ record }"> | 26 | <template #messageMode="{ record }"> |
| 27 | <a-button type="link" class="ml-2" @click="showMessageMode(record)"> | 27 | <a-button type="link" class="ml-2" @click="showMessageMode(record)"> |
| 28 | - 查看告警联系方式 | 28 | + 查看联系方式 |
| 29 | </a-button> | 29 | </a-button> |
| 30 | </template> | 30 | </template> |
| 31 | <template #action="{ record }"> | 31 | <template #action="{ record }"> |
| @@ -35,11 +35,17 @@ | @@ -35,11 +35,17 @@ | ||
| 35 | label: '编辑', | 35 | label: '编辑', |
| 36 | icon: 'clarity:note-edit-line', | 36 | icon: 'clarity:note-edit-line', |
| 37 | onClick: handleCreateOrEdit.bind(null, record), | 37 | onClick: handleCreateOrEdit.bind(null, record), |
| 38 | + ifShow: () => { | ||
| 39 | + return record.status === 0; | ||
| 40 | + }, | ||
| 38 | }, | 41 | }, |
| 39 | { | 42 | { |
| 40 | label: '删除', | 43 | label: '删除', |
| 41 | icon: 'ant-design:delete-outlined', | 44 | icon: 'ant-design:delete-outlined', |
| 42 | color: 'error', | 45 | color: 'error', |
| 46 | + ifShow: () => { | ||
| 47 | + return record.status === 0; | ||
| 48 | + }, | ||
| 43 | popConfirm: { | 49 | popConfirm: { |
| 44 | title: '是否确认删除', | 50 | title: '是否确认删除', |
| 45 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 51 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
| @@ -92,6 +98,7 @@ | @@ -92,6 +98,7 @@ | ||
| 92 | api: queryAlarmConfig, | 98 | api: queryAlarmConfig, |
| 93 | columns, | 99 | columns, |
| 94 | clickToRowSelect: false, | 100 | clickToRowSelect: false, |
| 101 | + showIndexColumn: false, | ||
| 95 | formConfig: { | 102 | formConfig: { |
| 96 | labelWidth: 120, | 103 | labelWidth: 120, |
| 97 | schemas: searchFormSchema, | 104 | schemas: searchFormSchema, |
| @@ -8,33 +8,33 @@ export const columns: BasicColumn[] = [ | @@ -8,33 +8,33 @@ export const columns: BasicColumn[] = [ | ||
| 8 | { | 8 | { |
| 9 | title: '名称', | 9 | title: '名称', |
| 10 | dataIndex: 'name', | 10 | dataIndex: 'name', |
| 11 | - width: 150, | 11 | + width: 120, |
| 12 | }, | 12 | }, |
| 13 | { | 13 | { |
| 14 | title: '配置类型', | 14 | title: '配置类型', |
| 15 | dataIndex: 'type', | 15 | dataIndex: 'type', |
| 16 | - width: 100, | 16 | + width: 90, |
| 17 | }, | 17 | }, |
| 18 | { | 18 | { |
| 19 | title: '传输方式', | 19 | title: '传输方式', |
| 20 | dataIndex: 'transportType', | 20 | dataIndex: 'transportType', |
| 21 | - width: 100, | 21 | + width: 90, |
| 22 | }, | 22 | }, |
| 23 | { | 23 | { |
| 24 | title: '默认配置', | 24 | title: '默认配置', |
| 25 | dataIndex: 'default', | 25 | dataIndex: 'default', |
| 26 | - width: 100, | 26 | + width: 50, |
| 27 | format: (text) => (text ? '是' : '否'), | 27 | format: (text) => (text ? '是' : '否'), |
| 28 | }, | 28 | }, |
| 29 | { | 29 | { |
| 30 | title: '描述', | 30 | title: '描述', |
| 31 | dataIndex: 'description', | 31 | dataIndex: 'description', |
| 32 | - width: 150, | 32 | + width: 100, |
| 33 | }, | 33 | }, |
| 34 | { | 34 | { |
| 35 | title: '创建时间', | 35 | title: '创建时间', |
| 36 | dataIndex: 'createTime', | 36 | dataIndex: 'createTime', |
| 37 | - width: 150, | 37 | + width: 100, |
| 38 | }, | 38 | }, |
| 39 | ]; | 39 | ]; |
| 40 | 40 |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <TableAction | 19 | <TableAction |
| 20 | :actions="[ | 20 | :actions="[ |
| 21 | { | 21 | { |
| 22 | - label: '设置默认', | 22 | + label: '默认', |
| 23 | icon: 'ant-design:profile-outlined', | 23 | icon: 'ant-design:profile-outlined', |
| 24 | onClick: handleSetDefault.bind(null, record), | 24 | onClick: handleSetDefault.bind(null, record), |
| 25 | ifShow: () => { | 25 | ifShow: () => { |
| @@ -105,10 +105,11 @@ | @@ -105,10 +105,11 @@ | ||
| 105 | bordered: true, | 105 | bordered: true, |
| 106 | showIndexColumn: false, | 106 | showIndexColumn: false, |
| 107 | actionColumn: { | 107 | actionColumn: { |
| 108 | - width: 250, | 108 | + width: 240, |
| 109 | title: '操作', | 109 | title: '操作', |
| 110 | dataIndex: 'action', | 110 | dataIndex: 'action', |
| 111 | slots: { customRender: 'action' }, | 111 | slots: { customRender: 'action' }, |
| 112 | + fixed: 'right', | ||
| 112 | }, | 113 | }, |
| 113 | }); | 114 | }); |
| 114 | 115 |
| @@ -8,6 +8,9 @@ | @@ -8,6 +8,9 @@ | ||
| 8 | <div v-else-if="isMqttType == 'COAP'"> | 8 | <div v-else-if="isMqttType == 'COAP'"> |
| 9 | <CoapCpns ref="coapRef" /> | 9 | <CoapCpns ref="coapRef" /> |
| 10 | </div> | 10 | </div> |
| 11 | + <div v-else-if="isMqttType == 'LWM2M1'"> | ||
| 12 | + <Lwm2mCpns ref="lwm2mRef" /> | ||
| 13 | + </div> | ||
| 11 | <div | 14 | <div |
| 12 | style=" | 15 | style=" |
| 13 | display: flex; | 16 | display: flex; |
| @@ -29,14 +32,14 @@ | @@ -29,14 +32,14 @@ | ||
| 29 | </div> | 32 | </div> |
| 30 | </template> | 33 | </template> |
| 31 | <script lang="ts"> | 34 | <script lang="ts"> |
| 32 | - import { defineComponent, reactive, ref, getCurrentInstance, onUnmounted } from 'vue'; | 35 | + import { defineComponent, reactive, ref, getCurrentInstance, onUnmounted, nextTick } from 'vue'; |
| 33 | import { BasicForm, useForm } from '/@/components/Form'; | 36 | import { BasicForm, useForm } from '/@/components/Form'; |
| 34 | import { step2Schemas } from './data'; | 37 | import { step2Schemas } from './data'; |
| 35 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; | 38 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
| 36 | import { Button } from '/@/components/Button'; | 39 | import { Button } from '/@/components/Button'; |
| 37 | import MqttCpns from '../step/cpns/mqtt/Mqtt.vue'; | 40 | import MqttCpns from '../step/cpns/mqtt/Mqtt.vue'; |
| 38 | import CoapCpns from '../step/cpns/coap/Coap.vue'; | 41 | import CoapCpns from '../step/cpns/coap/Coap.vue'; |
| 39 | - import { nextTick } from 'process'; | 42 | + import Lwm2mCpns from '../step/cpns/lwm2m/index.vue'; |
| 40 | 43 | ||
| 41 | export default defineComponent({ | 44 | export default defineComponent({ |
| 42 | components: { | 45 | components: { |
| @@ -48,12 +51,14 @@ | @@ -48,12 +51,14 @@ | ||
| 48 | Button, | 51 | Button, |
| 49 | MqttCpns, | 52 | MqttCpns, |
| 50 | CoapCpns, | 53 | CoapCpns, |
| 54 | + Lwm2mCpns, | ||
| 51 | }, | 55 | }, |
| 52 | emits: ['next', 'prev', 'register'], | 56 | emits: ['next', 'prev', 'register'], |
| 53 | setup(_, { emit }) { | 57 | setup(_, { emit }) { |
| 54 | const { proxy } = getCurrentInstance() as any; | 58 | const { proxy } = getCurrentInstance() as any; |
| 55 | const mqttRef = ref(null); | 59 | const mqttRef = ref(null); |
| 56 | const coapRef = ref(null); | 60 | const coapRef = ref(null); |
| 61 | + const lwm2mRef = ref(null); | ||
| 57 | const isMqttType = ref(''); | 62 | const isMqttType = ref(''); |
| 58 | let step2Data = reactive({ | 63 | let step2Data = reactive({ |
| 59 | transportConfiguration: {}, | 64 | transportConfiguration: {}, |
| @@ -92,6 +97,7 @@ | @@ -92,6 +97,7 @@ | ||
| 92 | { label: '默认', value: 'DEFAULT' }, | 97 | { label: '默认', value: 'DEFAULT' }, |
| 93 | { label: 'MQTT', value: 'MQTT' }, | 98 | { label: 'MQTT', value: 'MQTT' }, |
| 94 | { label: 'CoAP', value: 'COAP' }, | 99 | { label: 'CoAP', value: 'COAP' }, |
| 100 | + // { label: 'LWM2M', value: 'LWM2M' }, | ||
| 95 | ], | 101 | ], |
| 96 | onChange(e) { | 102 | onChange(e) { |
| 97 | isMqttType.value = e; | 103 | isMqttType.value = e; |
| @@ -124,6 +130,7 @@ | @@ -124,6 +130,7 @@ | ||
| 124 | isMqttType, | 130 | isMqttType, |
| 125 | mqttRef, | 131 | mqttRef, |
| 126 | coapRef, | 132 | coapRef, |
| 133 | + lwm2mRef, | ||
| 127 | }; | 134 | }; |
| 128 | }, | 135 | }, |
| 129 | }); | 136 | }); |
| @@ -59,7 +59,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -59,7 +59,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
| 59 | { | 59 | { |
| 60 | field: 'powerMode', | 60 | field: 'powerMode', |
| 61 | component: 'Select', | 61 | component: 'Select', |
| 62 | - label: 'Power Mode', | 62 | + label: '模式', |
| 63 | defaultValue: 'DRX', | 63 | defaultValue: 'DRX', |
| 64 | componentProps: { | 64 | componentProps: { |
| 65 | options: [ | 65 | options: [ |
| 1 | +import { FormSchema } from '/@/components/Form'; | ||
| 2 | + | ||
| 3 | +export const modelSchemas: FormSchema[] = [ | ||
| 4 | + { | ||
| 5 | + field: '0', | ||
| 6 | + component: 'Input', | ||
| 7 | + label: 'Object list', | ||
| 8 | + componentProps: { | ||
| 9 | + placeholder: '请输入Object list', | ||
| 10 | + }, | ||
| 11 | + colProps: { span: 11 }, | ||
| 12 | + }, | ||
| 13 | +]; | ||
| 14 | + | ||
| 15 | +export const serverSchemas: FormSchema[] = [ | ||
| 16 | + { | ||
| 17 | + field: '1', | ||
| 18 | + component: 'InputNumber', | ||
| 19 | + label: 'Short ID', | ||
| 20 | + required: true, | ||
| 21 | + defaultValue: 123, | ||
| 22 | + colProps: { span: 8 }, | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + field: '2', | ||
| 26 | + component: 'InputNumber', | ||
| 27 | + label: 'Client registration lifetime', | ||
| 28 | + required: true, | ||
| 29 | + defaultValue: 123, | ||
| 30 | + colProps: { span: 8 }, | ||
| 31 | + }, | ||
| 32 | +]; | ||
| 33 | + | ||
| 34 | +export const settingsSchemas: FormSchema[] = [ | ||
| 35 | + { | ||
| 36 | + field: 'deviceTelemetryTopic', | ||
| 37 | + component: 'Input', | ||
| 38 | + label: '筛选器', | ||
| 39 | + required: true, | ||
| 40 | + defaultValue: 'v1/devices/me/telemetry', | ||
| 41 | + componentProps: { | ||
| 42 | + placeholder: '请输入遥测数据 topic 筛选器', | ||
| 43 | + }, | ||
| 44 | + colProps: { span: 11 }, | ||
| 45 | + }, | ||
| 46 | +]; | ||
| 47 | + | ||
| 48 | +export const deviceSchemas: FormSchema[] = [ | ||
| 49 | + { | ||
| 50 | + field: 'deviceTelemetryTopic', | ||
| 51 | + component: 'Input', | ||
| 52 | + label: '筛选器', | ||
| 53 | + required: true, | ||
| 54 | + defaultValue: 'v1/devices/me/telemetry', | ||
| 55 | + componentProps: { | ||
| 56 | + placeholder: '请输入遥测数据 topic 筛选器', | ||
| 57 | + }, | ||
| 58 | + colProps: { span: 11 }, | ||
| 59 | + }, | ||
| 60 | +]; |
| 1 | +<template> | ||
| 2 | + <div style=""> | ||
| 3 | + <Tabs | ||
| 4 | + :defaultActiveKey="currentKey" | ||
| 5 | + v-model:activeKey="currentKey" | ||
| 6 | + :size="currentSize" | ||
| 7 | + :animated="true" | ||
| 8 | + > | ||
| 9 | + <TabPane key="1" tab="LWM2M Model"> | ||
| 10 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerModel" /> | ||
| 11 | + </TabPane> | ||
| 12 | + <TabPane key="2" tab="Servers"> | ||
| 13 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerServer" /> | ||
| 14 | + </TabPane> | ||
| 15 | + <TabPane key="3" tab="Other settings"> | ||
| 16 | + <BasicForm | ||
| 17 | + :showResetButton="false" | ||
| 18 | + :showSubmitButton="false" | ||
| 19 | + @register="registerSettings" | ||
| 20 | + /> | ||
| 21 | + </TabPane> | ||
| 22 | + <TabPane key="4" tab="Json Config Profile Device"> | ||
| 23 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerDevice" /> | ||
| 24 | + </TabPane> | ||
| 25 | + </Tabs> | ||
| 26 | + </div> | ||
| 27 | +</template> | ||
| 28 | + | ||
| 29 | +<script lang="ts"> | ||
| 30 | + import { defineComponent, ref } from 'vue'; | ||
| 31 | + import { Tabs } from 'ant-design-vue'; | ||
| 32 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
| 33 | + import { modelSchemas, serverSchemas, settingsSchemas, deviceSchemas } from './index'; | ||
| 34 | + | ||
| 35 | + export default defineComponent({ | ||
| 36 | + name: 'index', | ||
| 37 | + components: { | ||
| 38 | + Tabs, | ||
| 39 | + TabPane: Tabs.TabPane, | ||
| 40 | + BasicForm, | ||
| 41 | + }, | ||
| 42 | + setup() { | ||
| 43 | + const currentKey = ref(1); | ||
| 44 | + const currentSize = ref('large'); | ||
| 45 | + | ||
| 46 | + const [registerModel] = useForm({ | ||
| 47 | + labelWidth: 80, | ||
| 48 | + schemas: modelSchemas, | ||
| 49 | + actionColOptions: { | ||
| 50 | + span: 14, | ||
| 51 | + }, | ||
| 52 | + }); | ||
| 53 | + const [registerServer] = useForm({ | ||
| 54 | + labelWidth: 80, | ||
| 55 | + schemas: serverSchemas, | ||
| 56 | + actionColOptions: { | ||
| 57 | + span: 14, | ||
| 58 | + }, | ||
| 59 | + }); | ||
| 60 | + const [registerSettings] = useForm({ | ||
| 61 | + labelWidth: 80, | ||
| 62 | + schemas: settingsSchemas, | ||
| 63 | + actionColOptions: { | ||
| 64 | + span: 14, | ||
| 65 | + }, | ||
| 66 | + }); | ||
| 67 | + const [registerDevice] = useForm({ | ||
| 68 | + labelWidth: 80, | ||
| 69 | + schemas: deviceSchemas, | ||
| 70 | + actionColOptions: { | ||
| 71 | + span: 14, | ||
| 72 | + }, | ||
| 73 | + }); | ||
| 74 | + | ||
| 75 | + return { | ||
| 76 | + currentKey, | ||
| 77 | + currentSize, | ||
| 78 | + registerModel, | ||
| 79 | + registerServer, | ||
| 80 | + registerSettings, | ||
| 81 | + registerDevice, | ||
| 82 | + }; | ||
| 83 | + }, | ||
| 84 | + }); | ||
| 85 | +</script> |
| @@ -77,6 +77,7 @@ export const step2Schemas: FormSchema[] = [ | @@ -77,6 +77,7 @@ export const step2Schemas: FormSchema[] = [ | ||
| 77 | { label: '默认', value: 'DEFAULT' }, | 77 | { label: '默认', value: 'DEFAULT' }, |
| 78 | { label: 'MQTT', value: 'MQTT' }, | 78 | { label: 'MQTT', value: 'MQTT' }, |
| 79 | { label: 'CoAP', value: 'COAP' }, | 79 | { label: 'CoAP', value: 'COAP' }, |
| 80 | + // { label: 'LWM2M', value: 'LWM2M' }, | ||
| 80 | ], | 81 | ], |
| 81 | onChange(e) {}, | 82 | onChange(e) {}, |
| 82 | }; | 83 | }; |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | <BasicModal | 3 | <BasicModal |
| 4 | + :showOkBtn="false" | ||
| 5 | + :showCancelBtn="false" | ||
| 4 | v-bind="$attrs" | 6 | v-bind="$attrs" |
| 5 | @register="registerDrawer" | 7 | @register="registerDrawer" |
| 6 | - showFooter | ||
| 7 | :title="getTitle" | 8 | :title="getTitle" |
| 8 | width="1000px" | 9 | width="1000px" |
| 9 | - @ok="handleSubmit" | ||
| 10 | - @cancel="handleCancel" | ||
| 11 | > | 10 | > |
| 12 | <div class="step-form-form"> | 11 | <div class="step-form-form"> |
| 13 | <a-steps :current="current"> | 12 | <a-steps :current="current"> |
| @@ -26,17 +25,32 @@ | @@ -26,17 +25,32 @@ | ||
| 26 | @prevSon="handlePrev" | 25 | @prevSon="handlePrev" |
| 27 | /></div> | 26 | /></div> |
| 28 | </div> | 27 | </div> |
| 28 | + <div style="float: right"> | ||
| 29 | + <Button :disabled="disStatus" type="primary" @click="handleSubmit" class="mr-2" | ||
| 30 | + >确认</Button | ||
| 31 | + > | ||
| 32 | + <Button type="default" @click="handleCancel" class="mr-2">取消</Button> | ||
| 33 | + </div> | ||
| 29 | </BasicModal> | 34 | </BasicModal> |
| 30 | </div> | 35 | </div> |
| 31 | </template> | 36 | </template> |
| 32 | <script lang="ts"> | 37 | <script lang="ts"> |
| 33 | - import { defineComponent, reactive, ref, computed, unref, getCurrentInstance } from 'vue'; | 38 | + import { |
| 39 | + defineComponent, | ||
| 40 | + reactive, | ||
| 41 | + ref, | ||
| 42 | + computed, | ||
| 43 | + unref, | ||
| 44 | + getCurrentInstance, | ||
| 45 | + nextTick, | ||
| 46 | + } from 'vue'; | ||
| 34 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 47 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 35 | import { Steps } from 'ant-design-vue'; | 48 | import { Steps } from 'ant-design-vue'; |
| 36 | import TransferConfigMode from './cpns/transferConfigMode.vue'; | 49 | import TransferConfigMode from './cpns/transferConfigMode.vue'; |
| 37 | import TransferConfigParams from './cpns/transferConfigParams.vue'; | 50 | import TransferConfigParams from './cpns/transferConfigParams.vue'; |
| 38 | import { postAddConvertApi } from '/@/api/datamanager/dataManagerApi'; | 51 | import { postAddConvertApi } from '/@/api/datamanager/dataManagerApi'; |
| 39 | import { useMessage } from '/@/hooks/web/useMessage'; | 52 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 53 | + import { Button } from '/@/components/Button'; | ||
| 40 | 54 | ||
| 41 | export default defineComponent({ | 55 | export default defineComponent({ |
| 42 | name: 'ConfigDrawer', | 56 | name: 'ConfigDrawer', |
| @@ -46,12 +60,14 @@ | @@ -46,12 +60,14 @@ | ||
| 46 | [Steps.Step.name]: Steps.Step, | 60 | [Steps.Step.name]: Steps.Step, |
| 47 | TransferConfigMode, | 61 | TransferConfigMode, |
| 48 | TransferConfigParams, | 62 | TransferConfigParams, |
| 63 | + Button, | ||
| 49 | }, | 64 | }, |
| 50 | emits: ['success', 'register'], | 65 | emits: ['success', 'register'], |
| 51 | setup(_, { emit }) { | 66 | setup(_, { emit }) { |
| 52 | const { createMessage } = useMessage(); | 67 | const { createMessage } = useMessage(); |
| 68 | + const disStatus = ref(false); | ||
| 53 | const { proxy } = getCurrentInstance() as any; | 69 | const { proxy } = getCurrentInstance() as any; |
| 54 | - const allPostForm = reactive({}); | 70 | + let allPostForm: any = reactive({}); |
| 55 | const getNameObj = reactive({ | 71 | const getNameObj = reactive({ |
| 56 | name: '', | 72 | name: '', |
| 57 | }); | 73 | }); |
| @@ -64,8 +80,8 @@ | @@ -64,8 +80,8 @@ | ||
| 64 | description: '', | 80 | description: '', |
| 65 | }, | 81 | }, |
| 66 | }; | 82 | }; |
| 67 | - const getSonFormValue = ref({}); | ||
| 68 | - const getModeSonFormValue = ref({}); | 83 | + const getSonFormValue: any = ref({}); |
| 84 | + const getModeSonFormValue: any = ref({}); | ||
| 69 | const refTransferConfigParams = ref(null); | 85 | const refTransferConfigParams = ref(null); |
| 70 | const refTransferConfigMode = ref(null); | 86 | const refTransferConfigMode = ref(null); |
| 71 | const getModeSelectVal = ref({}); | 87 | const getModeSelectVal = ref({}); |
| @@ -100,18 +116,20 @@ | @@ -100,18 +116,20 @@ | ||
| 100 | editNextType.name = data.record.name; | 116 | editNextType.name = data.record.name; |
| 101 | editNextType.remark = data.record.remark; | 117 | editNextType.remark = data.record.remark; |
| 102 | proxy.$refs.refTransferConfigMode.setStepOneFieldsValueFunc(editNextType); | 118 | proxy.$refs.refTransferConfigMode.setStepOneFieldsValueFunc(editNextType); |
| 119 | + } else { | ||
| 120 | + nextTick(() => { | ||
| 121 | + proxy.$refs.refTransferConfigMode?.customResetStepOneFunc(); | ||
| 122 | + }); | ||
| 103 | } | 123 | } |
| 104 | }); | 124 | }); |
| 105 | const handleCancel = () => { | 125 | const handleCancel = () => { |
| 106 | defineClearFunc(); | 126 | defineClearFunc(); |
| 107 | }; | 127 | }; |
| 108 | const defineClearFunc = () => { | 128 | const defineClearFunc = () => { |
| 109 | - try { | ||
| 110 | - proxy.$refs.refTransferConfigMode.customResetStepOneFunc(); | 129 | + nextTick(() => { |
| 130 | + proxy.$refs.refTransferConfigMode?.customResetStepOneFunc(); | ||
| 111 | proxy.$refs.refTransferConfigParams?.clearSonValueDataFunc(); | 131 | proxy.$refs.refTransferConfigParams?.clearSonValueDataFunc(); |
| 112 | - } catch (e) { | ||
| 113 | - return e; | ||
| 114 | - } | 132 | + }); |
| 115 | }; | 133 | }; |
| 116 | const handleNext = (args) => { | 134 | const handleNext = (args) => { |
| 117 | current.value++; | 135 | current.value++; |
| @@ -198,12 +216,16 @@ | @@ -198,12 +216,16 @@ | ||
| 198 | }; | 216 | }; |
| 199 | const handleSubmit = async () => { | 217 | const handleSubmit = async () => { |
| 200 | if (!unref(isUpdate)) { | 218 | if (!unref(isUpdate)) { |
| 219 | + disStatus.value = true; | ||
| 201 | await addOrEditFunc(); | 220 | await addOrEditFunc(); |
| 202 | await postAddConvertApi(allPostForm); | 221 | await postAddConvertApi(allPostForm); |
| 203 | createMessage.success('数据流转新增成功'); | 222 | createMessage.success('数据流转新增成功'); |
| 204 | emit('success'); | 223 | emit('success'); |
| 205 | defineClearFunc(); | 224 | defineClearFunc(); |
| 206 | closeModal(); | 225 | closeModal(); |
| 226 | + setTimeout(() => { | ||
| 227 | + disStatus.value = false; | ||
| 228 | + }, 2000); | ||
| 207 | } else { | 229 | } else { |
| 208 | await addOrEditFunc(); | 230 | await addOrEditFunc(); |
| 209 | await postAddConvertApi(allPostForm); | 231 | await postAddConvertApi(allPostForm); |
| @@ -224,6 +246,7 @@ | @@ -224,6 +246,7 @@ | ||
| 224 | getModeSelectVal, | 246 | getModeSelectVal, |
| 225 | refTransferConfigParams, | 247 | refTransferConfigParams, |
| 226 | refTransferConfigMode, | 248 | refTransferConfigMode, |
| 249 | + disStatus, | ||
| 227 | }; | 250 | }; |
| 228 | }, | 251 | }, |
| 229 | }); | 252 | }); |
| @@ -51,9 +51,6 @@ | @@ -51,9 +51,6 @@ | ||
| 51 | updateSchema({ field: 'title', componentProps: { disabled: false } }); | 51 | updateSchema({ field: 'title', componentProps: { disabled: false } }); |
| 52 | //如果是编辑操作,设置页面数据 | 52 | //如果是编辑操作,设置页面数据 |
| 53 | if (unref(isUpdate)) { | 53 | if (unref(isUpdate)) { |
| 54 | - console.log('------------编辑时获得的值-----------------------'); | ||
| 55 | - console.log(data.record); | ||
| 56 | - | ||
| 57 | // // 动态设置 表单值 | 54 | // // 动态设置 表单值 |
| 58 | // | 55 | // |
| 59 | let menuObj: metaModel = Reflect.get(data.record, 'meta'); | 56 | let menuObj: metaModel = Reflect.get(data.record, 'meta'); |