Showing
7 changed files
with
47 additions
and
34 deletions
... | ... | @@ -172,11 +172,9 @@ |
172 | 172 | }; |
173 | 173 | }); |
174 | 174 | let arr3 = findName.filter((obj: any) => joinArray.some((obj1) => obj1 == obj.id)); |
175 | - let arr4 = arr3 | |
176 | - .map((m: any) => { | |
177 | - return m.username; | |
178 | - }) | |
179 | - .join(); | |
175 | + let arr4 = arr3.map((m: any) => { | |
176 | + return m.username; | |
177 | + }); | |
180 | 178 | Modal.info({ |
181 | 179 | title: '当前告警通知联系人', |
182 | 180 | width: 600, |
... | ... | @@ -194,11 +192,10 @@ |
194 | 192 | }; |
195 | 193 | }); |
196 | 194 | let arr3 = findName.filter((obj: any) => joinArray.some((obj1) => obj1 == obj.itemValue)); |
197 | - let arr4 = arr3 | |
198 | - .map((m: any) => { | |
199 | - return m.itemText; | |
200 | - }) | |
201 | - .join(); | |
195 | + let arr4 = arr3.map((m: any) => { | |
196 | + return m.itemText; | |
197 | + }); | |
198 | + | |
202 | 199 | Modal.info({ |
203 | 200 | title: '当前告警联系方式', |
204 | 201 | width: 600, | ... | ... |
... | ... | @@ -29,13 +29,14 @@ |
29 | 29 | </div> |
30 | 30 | </template> |
31 | 31 | <script lang="ts"> |
32 | - import { defineComponent, watch, reactive, ref, getCurrentInstance } from 'vue'; | |
32 | + import { defineComponent, reactive, ref, getCurrentInstance, onUnmounted } from 'vue'; | |
33 | 33 | import { BasicForm, useForm } from '/@/components/Form'; |
34 | - import { step2Schemas, isChangeType } from './data'; | |
34 | + import { step2Schemas } from './data'; | |
35 | 35 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
36 | 36 | import { Button } from '/@/components/Button'; |
37 | 37 | import MqttCpns from '../step/cpns/mqtt/Mqtt.vue'; |
38 | 38 | import CoapCpns from '../step/cpns/coap/Coap.vue'; |
39 | + import { nextTick } from 'process'; | |
39 | 40 | |
40 | 41 | export default defineComponent({ |
41 | 42 | components: { |
... | ... | @@ -57,7 +58,7 @@ |
57 | 58 | let step2Data = reactive({ |
58 | 59 | transportConfiguration: {}, |
59 | 60 | }); |
60 | - const [register, { validate, resetFields, setFieldsValue }] = useForm({ | |
61 | + const [register, { validate, resetFields, setFieldsValue, updateSchema }] = useForm({ | |
61 | 62 | labelWidth: 80, |
62 | 63 | schemas: step2Schemas, |
63 | 64 | actionColOptions: { |
... | ... | @@ -74,15 +75,33 @@ |
74 | 75 | proxy.$refs.coapRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); |
75 | 76 | }, 100); |
76 | 77 | }; |
78 | + | |
77 | 79 | const customClearStepTwoValueFunc = () => { |
78 | - isMqttType.value = 'other'; | |
80 | + isMqttType.value = ''; | |
79 | 81 | resetFields(); |
80 | 82 | }; |
81 | 83 | async function customResetFunc() { |
82 | 84 | emit('prev'); |
83 | 85 | } |
84 | - watch(isChangeType, (v) => { | |
85 | - isMqttType.value = v; | |
86 | + nextTick(() => { | |
87 | + updateSchema({ | |
88 | + field: 'transportType', | |
89 | + componentProps() { | |
90 | + return { | |
91 | + options: [ | |
92 | + { label: '默认', value: 'DEFAULT' }, | |
93 | + { label: 'MQTT', value: 'MQTT' }, | |
94 | + { label: 'CoAP', value: 'COAP' }, | |
95 | + ], | |
96 | + onChange(e) { | |
97 | + isMqttType.value = e; | |
98 | + }, | |
99 | + }; | |
100 | + }, | |
101 | + }); | |
102 | + }); | |
103 | + onUnmounted(() => { | |
104 | + isMqttType.value = ''; | |
86 | 105 | }); |
87 | 106 | const getStep2DataFunc = async () => { |
88 | 107 | const val = await validate(); | ... | ... |
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | 2 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
3 | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | -import { ref } from 'vue'; | |
5 | 4 | |
6 | 5 | export const step1Schemas: FormSchema[] = [ |
7 | 6 | { |
... | ... | @@ -66,22 +65,21 @@ export const step1Schemas: FormSchema[] = [ |
66 | 65 | }, |
67 | 66 | ]; |
68 | 67 | |
69 | -export const isChangeType = ref(''); | |
70 | 68 | export const step2Schemas: FormSchema[] = [ |
71 | 69 | { |
72 | 70 | field: 'transportType', |
73 | 71 | component: 'Select', |
74 | 72 | label: '传输方式', |
75 | 73 | defaultValue: 'DEFAULT', |
76 | - componentProps: { | |
77 | - options: [ | |
78 | - { label: '默认', value: 'DEFAULT' }, | |
79 | - { label: 'MQTT', value: 'MQTT' }, | |
80 | - { label: 'CoAP', value: 'COAP' }, | |
81 | - ], | |
82 | - onChange(e) { | |
83 | - isChangeType.value = e; | |
84 | - }, | |
74 | + componentProps() { | |
75 | + return { | |
76 | + options: [ | |
77 | + { label: '默认', value: 'DEFAULT' }, | |
78 | + { label: 'MQTT', value: 'MQTT' }, | |
79 | + { label: 'CoAP', value: 'COAP' }, | |
80 | + ], | |
81 | + onChange(e) {}, | |
82 | + }; | |
85 | 83 | }, |
86 | 84 | colProps: { span: 11 }, |
87 | 85 | }, | ... | ... |
... | ... | @@ -46,7 +46,7 @@ export const columns: BasicColumn[] = [ |
46 | 46 | width: 200, |
47 | 47 | customRender: ({ record }) => { |
48 | 48 | const status = record.status; |
49 | - const enable = status === 0 ? '已发布' : status === 1 ? '草稿' : '其他'; | |
49 | + const enable = status === 1 ? '已发布' : status === 0 ? '草稿' : '其他'; | |
50 | 50 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; |
51 | 51 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; |
52 | 52 | return h(Tag, { color }, () => text); | ... | ... |
... | ... | @@ -22,7 +22,6 @@ |
22 | 22 | label: '编辑', |
23 | 23 | icon: 'clarity:note-edit-line', |
24 | 24 | onClick: handleEdit.bind(null, record), |
25 | - // auth: 'isTenant' || 'isCustomer', | |
26 | 25 | ifShow: (_action) => { |
27 | 26 | return record.status === 0 && record.creator == userId; |
28 | 27 | }, |
... | ... | @@ -31,7 +30,7 @@ |
31 | 30 | label: '删除', |
32 | 31 | icon: 'ant-design:delete-outlined', |
33 | 32 | color: 'error', |
34 | - ifShow: record.creator == userId || record.tenantId == tenantId, | |
33 | + ifShow: record.creator == userId, | |
35 | 34 | popConfirm: { |
36 | 35 | title: '是否确认删除', |
37 | 36 | confirm: handleDeleteOrBatchDelete.bind(null, record), | ... | ... |
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | const { proxy } = getCurrentInstance() as any; |
36 | 36 | const getChildData = ref(null); |
37 | 37 | const editGetId: any = ref(''); |
38 | - const [registerForm, { getFieldsValue, resetFields, setFieldsValue }] = useForm({ | |
38 | + const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({ | |
39 | 39 | schemas: formSchema, |
40 | 40 | showActionButtonGroup: false, |
41 | 41 | }); |
... | ... | @@ -60,8 +60,9 @@ |
60 | 60 | }); |
61 | 61 | const getTitle = computed(() => (!unref(isUpdate) ? '新增租户配置' : '编辑租户配置')); |
62 | 62 | |
63 | - const getAllFieldsFunc = () => { | |
64 | - getValuesFormData = getFieldsValue(); | |
63 | + const getAllFieldsFunc = async () => { | |
64 | + getValuesFormData = await validate(); | |
65 | + if (!getValuesFormData) return; | |
65 | 66 | let getChildValues = proxy.$refs.getChildData.getAllFields(); |
66 | 67 | let profileData1 = { |
67 | 68 | configuration: getChildValues, | ... | ... |