Commit 67d50a55647c42e7ad63d03901bd20c179413bdc
Merge branch 'ft' into 'main'
fix:修改告警管理表格名字,默认配置不可删除和编辑 See merge request huang/yun-teng-iot-front!174
Showing
11 changed files
with
221 additions
and
40 deletions
... | ... | @@ -11,25 +11,25 @@ import { useMessage } from '/@/hooks/web/useMessage'; |
11 | 11 | // 表格列数据 |
12 | 12 | export const columns: BasicColumn[] = [ |
13 | 13 | { |
14 | - title: '告警配置名称', | |
14 | + title: '配置名称', | |
15 | 15 | dataIndex: 'name', |
16 | 16 | width: 120, |
17 | 17 | }, |
18 | 18 | { |
19 | 19 | title: '所属组织', |
20 | 20 | dataIndex: 'organizationName', |
21 | - width: 160, | |
21 | + width: 150, | |
22 | 22 | }, |
23 | 23 | { |
24 | - title: '告警通知联系人', | |
24 | + title: '告警联系人', | |
25 | 25 | dataIndex: 'alarmContactId', |
26 | - width: 160, | |
26 | + width: 155, | |
27 | 27 | slots: { customRender: 'alarmContact' }, |
28 | 28 | }, |
29 | 29 | { |
30 | - title: '告警联系方式', | |
30 | + title: '联系方式', | |
31 | 31 | dataIndex: 'messageMode', |
32 | - width: 160, | |
32 | + width: 155, | |
33 | 33 | slots: { customRender: 'messageMode' }, |
34 | 34 | }, |
35 | 35 | { |
... | ... | @@ -42,8 +42,8 @@ export const columns: BasicColumn[] = [ |
42 | 42 | } |
43 | 43 | return h(Switch, { |
44 | 44 | checked: record.status === 1, |
45 | - checkedChildren: '配置', | |
46 | - unCheckedChildren: '未配置', | |
45 | + checkedChildren: '启用', | |
46 | + unCheckedChildren: '未启用', | |
47 | 47 | loading: record.pendingStatus, |
48 | 48 | onChange(checked: boolean) { |
49 | 49 | record.pendingStatus = true; |
... | ... | @@ -53,9 +53,9 @@ export const columns: BasicColumn[] = [ |
53 | 53 | .then(() => { |
54 | 54 | record.status = newStatus; |
55 | 55 | if (record.status == 1) { |
56 | - createMessage.success(`已配置`); | |
56 | + createMessage.success(`启用`); | |
57 | 57 | } else { |
58 | - createMessage.error('未配置'); | |
58 | + createMessage.success('未启用'); | |
59 | 59 | } |
60 | 60 | }) |
61 | 61 | .finally(() => { |
... | ... | @@ -88,7 +88,7 @@ export const searchFormSchema: FormSchema[] = [ |
88 | 88 | field: 'name', |
89 | 89 | label: '告警配置名称', |
90 | 90 | component: 'Input', |
91 | - colProps: { span: 8 }, | |
91 | + colProps: { span: 6 }, | |
92 | 92 | componentProps: { |
93 | 93 | maxLength: 36, |
94 | 94 | placeholder: '请输入告警配置名称', |
... | ... | @@ -98,15 +98,15 @@ export const searchFormSchema: FormSchema[] = [ |
98 | 98 | field: 'status', |
99 | 99 | label: '告警配置状态', |
100 | 100 | component: 'Select', |
101 | - colProps: { span: 8 }, | |
101 | + colProps: { span: 6 }, | |
102 | 102 | componentProps: { |
103 | 103 | options: [ |
104 | 104 | { |
105 | - label: '已配置', | |
105 | + label: '启用', | |
106 | 106 | value: 1, |
107 | 107 | }, |
108 | 108 | { |
109 | - label: '未配置', | |
109 | + label: '未启用', | |
110 | 110 | value: 0, |
111 | 111 | }, |
112 | 112 | ], | ... | ... |
... | ... | @@ -20,12 +20,12 @@ |
20 | 20 | </template> |
21 | 21 | <template #alarmContact="{ record }"> |
22 | 22 | <a-button type="link" class="ml-2" @click="showAlarmContact(record)"> |
23 | - 查看告警联系人 | |
23 | + 查看联系人 | |
24 | 24 | </a-button> |
25 | 25 | </template> |
26 | 26 | <template #messageMode="{ record }"> |
27 | 27 | <a-button type="link" class="ml-2" @click="showMessageMode(record)"> |
28 | - 查看告警联系方式 | |
28 | + 查看联系方式 | |
29 | 29 | </a-button> |
30 | 30 | </template> |
31 | 31 | <template #action="{ record }"> |
... | ... | @@ -35,11 +35,17 @@ |
35 | 35 | label: '编辑', |
36 | 36 | icon: 'clarity:note-edit-line', |
37 | 37 | onClick: handleCreateOrEdit.bind(null, record), |
38 | + ifShow: () => { | |
39 | + return record.status === 0; | |
40 | + }, | |
38 | 41 | }, |
39 | 42 | { |
40 | 43 | label: '删除', |
41 | 44 | icon: 'ant-design:delete-outlined', |
42 | 45 | color: 'error', |
46 | + ifShow: () => { | |
47 | + return record.status === 0; | |
48 | + }, | |
43 | 49 | popConfirm: { |
44 | 50 | title: '是否确认删除', |
45 | 51 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
... | ... | @@ -92,6 +98,7 @@ |
92 | 98 | api: queryAlarmConfig, |
93 | 99 | columns, |
94 | 100 | clickToRowSelect: false, |
101 | + showIndexColumn: false, | |
95 | 102 | formConfig: { |
96 | 103 | labelWidth: 120, |
97 | 104 | schemas: searchFormSchema, | ... | ... |
... | ... | @@ -8,33 +8,33 @@ export const columns: BasicColumn[] = [ |
8 | 8 | { |
9 | 9 | title: '名称', |
10 | 10 | dataIndex: 'name', |
11 | - width: 150, | |
11 | + width: 120, | |
12 | 12 | }, |
13 | 13 | { |
14 | 14 | title: '配置类型', |
15 | 15 | dataIndex: 'type', |
16 | - width: 100, | |
16 | + width: 90, | |
17 | 17 | }, |
18 | 18 | { |
19 | 19 | title: '传输方式', |
20 | 20 | dataIndex: 'transportType', |
21 | - width: 100, | |
21 | + width: 90, | |
22 | 22 | }, |
23 | 23 | { |
24 | 24 | title: '默认配置', |
25 | 25 | dataIndex: 'default', |
26 | - width: 100, | |
26 | + width: 50, | |
27 | 27 | format: (text) => (text ? '是' : '否'), |
28 | 28 | }, |
29 | 29 | { |
30 | 30 | title: '描述', |
31 | 31 | dataIndex: 'description', |
32 | - width: 150, | |
32 | + width: 100, | |
33 | 33 | }, |
34 | 34 | { |
35 | 35 | title: '创建时间', |
36 | 36 | dataIndex: 'createTime', |
37 | - width: 150, | |
37 | + width: 100, | |
38 | 38 | }, |
39 | 39 | ]; |
40 | 40 | ... | ... |
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | <TableAction |
20 | 20 | :actions="[ |
21 | 21 | { |
22 | - label: '设置默认', | |
22 | + label: '默认', | |
23 | 23 | icon: 'ant-design:profile-outlined', |
24 | 24 | onClick: handleSetDefault.bind(null, record), |
25 | 25 | ifShow: () => { |
... | ... | @@ -105,10 +105,11 @@ |
105 | 105 | bordered: true, |
106 | 106 | showIndexColumn: false, |
107 | 107 | actionColumn: { |
108 | - width: 250, | |
108 | + width: 240, | |
109 | 109 | title: '操作', |
110 | 110 | dataIndex: 'action', |
111 | 111 | slots: { customRender: 'action' }, |
112 | + fixed: 'right', | |
112 | 113 | }, |
113 | 114 | }); |
114 | 115 | ... | ... |
... | ... | @@ -8,6 +8,9 @@ |
8 | 8 | <div v-else-if="isMqttType == 'COAP'"> |
9 | 9 | <CoapCpns ref="coapRef" /> |
10 | 10 | </div> |
11 | + <div v-else-if="isMqttType == 'LWM2M1'"> | |
12 | + <Lwm2mCpns ref="lwm2mRef" /> | |
13 | + </div> | |
11 | 14 | <div |
12 | 15 | style=" |
13 | 16 | display: flex; |
... | ... | @@ -47,12 +50,14 @@ |
47 | 50 | Button, |
48 | 51 | MqttCpns, |
49 | 52 | CoapCpns, |
53 | + Lwm2mCpns, | |
50 | 54 | }, |
51 | 55 | emits: ['next', 'prev', 'register'], |
52 | 56 | setup(_, { emit }) { |
53 | 57 | const { proxy } = getCurrentInstance() as any; |
54 | 58 | const mqttRef = ref(null); |
55 | 59 | const coapRef = ref(null); |
60 | + const lwm2mRef = ref(null); | |
56 | 61 | const isMqttType = ref(''); |
57 | 62 | let step2Data = reactive({ |
58 | 63 | transportConfiguration: {}, |
... | ... | @@ -91,6 +96,7 @@ |
91 | 96 | { label: '默认', value: 'DEFAULT' }, |
92 | 97 | { label: 'MQTT', value: 'MQTT' }, |
93 | 98 | { label: 'CoAP', value: 'COAP' }, |
99 | + // { label: 'LWM2M', value: 'LWM2M' }, | |
94 | 100 | ], |
95 | 101 | onChange(e) { |
96 | 102 | isMqttType.value = e; |
... | ... | @@ -123,6 +129,7 @@ |
123 | 129 | isMqttType, |
124 | 130 | mqttRef, |
125 | 131 | coapRef, |
132 | + lwm2mRef, | |
126 | 133 | }; |
127 | 134 | }, |
128 | 135 | }); | ... | ... |
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> | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | 3 | <BasicModal |
4 | + :showOkBtn="false" | |
5 | + :showCancelBtn="false" | |
4 | 6 | v-bind="$attrs" |
5 | 7 | @register="registerDrawer" |
6 | - showFooter | |
7 | 8 | :title="getTitle" |
8 | 9 | width="1000px" |
9 | - @ok="handleSubmit" | |
10 | - @cancel="handleCancel" | |
11 | 10 | > |
12 | 11 | <div class="step-form-form"> |
13 | 12 | <a-steps :current="current"> |
... | ... | @@ -26,17 +25,32 @@ |
26 | 25 | @prevSon="handlePrev" |
27 | 26 | /></div> |
28 | 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 | 34 | </BasicModal> |
30 | 35 | </div> |
31 | 36 | </template> |
32 | 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 | 47 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
35 | 48 | import { Steps } from 'ant-design-vue'; |
36 | 49 | import TransferConfigMode from './cpns/transferConfigMode.vue'; |
37 | 50 | import TransferConfigParams from './cpns/transferConfigParams.vue'; |
38 | 51 | import { postAddConvertApi } from '/@/api/datamanager/dataManagerApi'; |
39 | 52 | import { useMessage } from '/@/hooks/web/useMessage'; |
53 | + import { Button } from '/@/components/Button'; | |
40 | 54 | |
41 | 55 | export default defineComponent({ |
42 | 56 | name: 'ConfigDrawer', |
... | ... | @@ -46,12 +60,14 @@ |
46 | 60 | [Steps.Step.name]: Steps.Step, |
47 | 61 | TransferConfigMode, |
48 | 62 | TransferConfigParams, |
63 | + Button, | |
49 | 64 | }, |
50 | 65 | emits: ['success', 'register'], |
51 | 66 | setup(_, { emit }) { |
52 | 67 | const { createMessage } = useMessage(); |
68 | + const disStatus = ref(false); | |
53 | 69 | const { proxy } = getCurrentInstance() as any; |
54 | - const allPostForm = reactive({}); | |
70 | + let allPostForm: any = reactive({}); | |
55 | 71 | const getNameObj = reactive({ |
56 | 72 | name: '', |
57 | 73 | }); |
... | ... | @@ -64,8 +80,8 @@ |
64 | 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 | 85 | const refTransferConfigParams = ref(null); |
70 | 86 | const refTransferConfigMode = ref(null); |
71 | 87 | const getModeSelectVal = ref({}); |
... | ... | @@ -100,18 +116,20 @@ |
100 | 116 | editNextType.name = data.record.name; |
101 | 117 | editNextType.remark = data.record.remark; |
102 | 118 | proxy.$refs.refTransferConfigMode.setStepOneFieldsValueFunc(editNextType); |
119 | + } else { | |
120 | + nextTick(() => { | |
121 | + proxy.$refs.refTransferConfigMode?.customResetStepOneFunc(); | |
122 | + }); | |
103 | 123 | } |
104 | 124 | }); |
105 | 125 | const handleCancel = () => { |
106 | 126 | defineClearFunc(); |
107 | 127 | }; |
108 | 128 | const defineClearFunc = () => { |
109 | - try { | |
110 | - proxy.$refs.refTransferConfigMode.customResetStepOneFunc(); | |
129 | + nextTick(() => { | |
130 | + proxy.$refs.refTransferConfigMode?.customResetStepOneFunc(); | |
111 | 131 | proxy.$refs.refTransferConfigParams?.clearSonValueDataFunc(); |
112 | - } catch (e) { | |
113 | - return e; | |
114 | - } | |
132 | + }); | |
115 | 133 | }; |
116 | 134 | const handleNext = (args) => { |
117 | 135 | current.value++; |
... | ... | @@ -198,12 +216,16 @@ |
198 | 216 | }; |
199 | 217 | const handleSubmit = async () => { |
200 | 218 | if (!unref(isUpdate)) { |
219 | + disStatus.value = true; | |
201 | 220 | await addOrEditFunc(); |
202 | 221 | await postAddConvertApi(allPostForm); |
203 | 222 | createMessage.success('数据流转新增成功'); |
204 | 223 | emit('success'); |
205 | 224 | defineClearFunc(); |
206 | 225 | closeModal(); |
226 | + setTimeout(() => { | |
227 | + disStatus.value = false; | |
228 | + }, 2000); | |
207 | 229 | } else { |
208 | 230 | await addOrEditFunc(); |
209 | 231 | await postAddConvertApi(allPostForm); |
... | ... | @@ -224,6 +246,7 @@ |
224 | 246 | getModeSelectVal, |
225 | 247 | refTransferConfigParams, |
226 | 248 | refTransferConfigMode, |
249 | + disStatus, | |
227 | 250 | }; |
228 | 251 | }, |
229 | 252 | }); | ... | ... |
... | ... | @@ -51,9 +51,6 @@ |
51 | 51 | updateSchema({ field: 'title', componentProps: { disabled: false } }); |
52 | 52 | //如果是编辑操作,设置页面数据 |
53 | 53 | if (unref(isUpdate)) { |
54 | - console.log('------------编辑时获得的值-----------------------'); | |
55 | - console.log(data.record); | |
56 | - | |
57 | 54 | // // 动态设置 表单值 |
58 | 55 | // |
59 | 56 | let menuObj: metaModel = Reflect.get(data.record, 'meta'); | ... | ... |