Commit 4defefd8f631e7072964fe46be44a11914ee9409
Merge branch 'ft-dev' into 'main'
feat:设备配置调通删除接口 See merge request huang/yun-teng-iot-front!31
Showing
13 changed files
with
232 additions
and
150 deletions
... | ... | @@ -157,7 +157,7 @@ export interface IDeviceConfigAddOrEditModel { |
157 | 157 | tenantExpireTime?: '2021-12-15T02:17:26.645Z'; |
158 | 158 | tenantId?: string; |
159 | 159 | tenantStatus?: 'DISABLED'; |
160 | - transportType?: 'COAP'; | |
160 | + transportType?: string; | |
161 | 161 | updateTime?: '2021-12-15T02:17:26.645Z'; |
162 | 162 | updater?: string; |
163 | 163 | } | ... | ... |
... | ... | @@ -72,7 +72,11 @@ |
72 | 72 | const postDeviceConfogData: any = ref({}); |
73 | 73 | const getStepOneData: any = ref({}); |
74 | 74 | const getStepTwoData: any = ref({}); |
75 | + const getStepThreeData: any = ref({}); | |
75 | 76 | const editEchoData: any = ref({}); |
77 | + const isGetStepFourData: any = ref({}); | |
78 | + const isGetStepThreeData: any = ref({}); | |
79 | + const postEditId = ref(''); | |
76 | 80 | const current = ref(0); |
77 | 81 | const isUpdate = ref(true); |
78 | 82 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); |
... | ... | @@ -80,10 +84,13 @@ |
80 | 84 | isUpdate.value = !!data?.isUpdate; |
81 | 85 | if (!unref(isUpdate)) { |
82 | 86 | current.value = 0; |
87 | + postDeviceConfogData.value = {}; | |
83 | 88 | } |
84 | 89 | if (unref(isUpdate)) { |
90 | + current.value = 0; | |
91 | + postEditId.value = data.record.id; | |
85 | 92 | editEchoData.value = data.record; |
86 | - console.log(editEchoData.value); | |
93 | + editEchoData.value.key = 'edit'; | |
87 | 94 | } |
88 | 95 | }); |
89 | 96 | function handleStepPrev() { |
... | ... | @@ -91,35 +98,55 @@ |
91 | 98 | } |
92 | 99 | function handleStepNext1(v) { |
93 | 100 | current.value++; |
94 | - console.log('第一步的数据', v); | |
95 | 101 | getStepOneData.value = v; |
96 | 102 | } |
97 | 103 | function handleStep2Next(v) { |
98 | 104 | current.value++; |
99 | - console.log('第二步的数据', v); | |
100 | 105 | getStepTwoData.value = v; |
101 | 106 | } |
102 | 107 | function handleStep3Next(v) { |
103 | 108 | current.value++; |
104 | - console.log('第三步的数据', v); | |
109 | + getStepThreeData.value = v; | |
105 | 110 | } |
106 | 111 | function handleRedo() { |
107 | 112 | current.value = 0; |
108 | 113 | } |
109 | 114 | const handleSubmit = async () => { |
110 | - let getStep4Data = proxy.$refs.getStepData.getAllFields(); | |
111 | - console.log('第四步的数据', getStep4Data); | |
112 | - Object.assign( | |
113 | - postDeviceConfogData.value, | |
114 | - getStepOneData.value, | |
115 | - getStepTwoData.value, | |
116 | - getStep4Data | |
117 | - ); | |
118 | - console.log('搜集的所有数据', postDeviceConfogData.value); | |
119 | - await deviceConfigAddOrEdit(postDeviceConfogData.value); | |
120 | - createMessage.success('新增设备配置成功'); | |
121 | - closeModal(); | |
122 | - emit('success'); | |
115 | + if (!unref(isUpdate)) { | |
116 | + isGetStepThreeData.value.alarmProfile = getStepThreeData.value; | |
117 | + let getStep4Data = proxy.$refs.getStepData.getAllFields(); | |
118 | + isGetStepFourData.value.alarmProfile = getStep4Data; | |
119 | + Object.assign( | |
120 | + postDeviceConfogData.value, | |
121 | + getStepOneData.value, | |
122 | + getStepTwoData.value, | |
123 | + isGetStepFourData.value, | |
124 | + isGetStepThreeData.value | |
125 | + ); | |
126 | + console.log('搜集的所有数据', postDeviceConfogData.value); | |
127 | + await deviceConfigAddOrEdit(postDeviceConfogData.value); | |
128 | + createMessage.success('新增设备配置成功'); | |
129 | + closeModal(); | |
130 | + emit('success'); | |
131 | + } | |
132 | + if (unref(isUpdate)) { | |
133 | + postDeviceConfogData.value.id = postEditId.value; | |
134 | + isGetStepThreeData.value.alarmProfile = getStepThreeData.value; | |
135 | + let getStep4Data = proxy.$refs.getStepData.getAllFields(); | |
136 | + isGetStepFourData.value.alarmProfile = getStep4Data; | |
137 | + Object.assign( | |
138 | + postDeviceConfogData.value, | |
139 | + getStepOneData.value, | |
140 | + getStepTwoData.value, | |
141 | + isGetStepFourData.value, | |
142 | + isGetStepThreeData.value | |
143 | + ); | |
144 | + console.log('搜集的所有数据', postDeviceConfogData.value); | |
145 | + await deviceConfigAddOrEdit(postDeviceConfogData.value); | |
146 | + createMessage.success('新增设备配置成功'); | |
147 | + closeModal(); | |
148 | + emit('success'); | |
149 | + } | |
123 | 150 | }; |
124 | 151 | const handleCancel = async () => { |
125 | 152 | console.log(2); | ... | ... |
... | ... | @@ -4,13 +4,14 @@ import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; |
4 | 4 | |
5 | 5 | export const alertContactsSchemas: FormSchema[] = [ |
6 | 6 | { |
7 | - field: 'name', | |
7 | + field: 'alarmContactId', | |
8 | 8 | label: '告警通知联系人', |
9 | 9 | component: 'ApiSelect', |
10 | 10 | componentProps: { |
11 | 11 | api: alarmContactGetPage, |
12 | 12 | labelField: 'username', |
13 | 13 | valueField: 'id', |
14 | + resultField: 'items', | |
14 | 15 | }, |
15 | 16 | }, |
16 | 17 | { | ... | ... |
... | ... | @@ -2,6 +2,9 @@ import { BasicColumn } from '/@/components/Table'; |
2 | 2 | import { FormSchema } from '/@/components/Table'; |
3 | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | 4 | import { MessageEnum } from '/@/enums/messageEnum'; |
5 | +import { getOrganizationList } from '/@/api/system/system'; | |
6 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
7 | + | |
5 | 8 | export const columns: BasicColumn[] = [ |
6 | 9 | { |
7 | 10 | title: '配置名称', |
... | ... | @@ -19,6 +22,11 @@ export const columns: BasicColumn[] = [ |
19 | 22 | width: 180, |
20 | 23 | }, |
21 | 24 | { |
25 | + title: '绑定规则链', | |
26 | + dataIndex: 'defaultRuleChainId', | |
27 | + width: 180, | |
28 | + }, | |
29 | + { | |
22 | 30 | title: '描述', |
23 | 31 | dataIndex: 'description', |
24 | 32 | width: 180, |
... | ... | @@ -27,6 +35,19 @@ export const columns: BasicColumn[] = [ |
27 | 35 | |
28 | 36 | export const searchFormSchema: FormSchema[] = [ |
29 | 37 | { |
38 | + field: 'organizationId', | |
39 | + label: '请选择组织', | |
40 | + component: 'ApiTreeSelect', | |
41 | + colProps: { span: 6 }, | |
42 | + componentProps: { | |
43 | + api: async () => { | |
44 | + const data = await getOrganizationList(); | |
45 | + copyTransFun(data as any as any[]); | |
46 | + return data; | |
47 | + }, | |
48 | + }, | |
49 | + }, | |
50 | + { | |
30 | 51 | field: 'name', |
31 | 52 | label: '配置名称', |
32 | 53 | component: 'Input', | ... | ... |
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | </BasicTable> |
46 | 46 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> |
47 | 47 | <DeviceConfigDetail v-if="!isJudgeStatus" @register="registerModal" @success="handleSuccess" /> |
48 | + <ExpExcelModal @register="register1" @success="defaultHeader" /> | |
48 | 49 | </div> |
49 | 50 | </template> |
50 | 51 | <script lang="ts"> |
... | ... | @@ -56,12 +57,19 @@ |
56 | 57 | import { useModal } from '/@/components/Modal'; |
57 | 58 | import DeviceProfileModal from '/@/views/device/profile/DeviceProfileModal.vue'; |
58 | 59 | import DeviceConfigDetail from '/@/views/device/profile/deviceConfigDetail.vue'; |
59 | - // import { aoaToSheetXlsx } from '/@/components/Excel'; | |
60 | 60 | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
61 | + import { jsonToSheetXlsx, ExpExcelModal, ExportModalResult } from '/@/components/Excel'; | |
61 | 62 | |
62 | 63 | export default defineComponent({ |
63 | 64 | name: 'DeviceProfileManagement', |
64 | - components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, | |
65 | + components: { | |
66 | + BasicTable, | |
67 | + DeviceProfileModal, | |
68 | + TableAction, | |
69 | + ImpExcel, | |
70 | + DeviceConfigDetail, | |
71 | + ExpExcelModal, | |
72 | + }, | |
65 | 73 | setup() { |
66 | 74 | let selectedRowKeys: string[] = reactive([]); |
67 | 75 | let isJudgeStatus = ref(true); |
... | ... | @@ -76,6 +84,7 @@ |
76 | 84 | labelWidth: 120, |
77 | 85 | schemas: searchFormSchema, |
78 | 86 | }, |
87 | + rowKey: 'id', | |
79 | 88 | useSearchForm: true, |
80 | 89 | showTableSetting: true, |
81 | 90 | bordered: true, |
... | ... | @@ -133,7 +142,6 @@ |
133 | 142 | async function handleTableDel() { |
134 | 143 | await deviceConfigDelete(selectedRowKeys); |
135 | 144 | createMessage.success('删除成功'); |
136 | - // reload(); | |
137 | 145 | handleSuccess(); |
138 | 146 | } |
139 | 147 | |
... | ... | @@ -152,13 +160,22 @@ |
152 | 160 | }); |
153 | 161 | isJudgeStatus.value = false; |
154 | 162 | } |
163 | + | |
164 | + function defaultHeader({ filename, bookType }: ExportModalResult) { | |
165 | + // 默认Object.keys(data[0])作为header | |
166 | + jsonToSheetXlsx({ | |
167 | + data, | |
168 | + filename, | |
169 | + write2excelOpts: { | |
170 | + bookType, | |
171 | + }, | |
172 | + }); | |
173 | + } | |
174 | + | |
175 | + const [register1, { openModal: openModalExcel }] = useModal(); | |
155 | 176 | function handleExport(record: Recordable) { |
177 | + openModalExcel(); | |
156 | 178 | console.log(record); |
157 | - // aoaToSheetXlsx({ | |
158 | - // // data: record, | |
159 | - // // header: arrHeader, | |
160 | - // filename: '二维数组方式导出excel.xlsx', | |
161 | - // }); | |
162 | 179 | } |
163 | 180 | function handleImport() { |
164 | 181 | console.log('record'); |
... | ... | @@ -167,6 +184,8 @@ |
167 | 184 | reload(); |
168 | 185 | } |
169 | 186 | return { |
187 | + register1, | |
188 | + defaultHeader, | |
170 | 189 | useSelectionChange, |
171 | 190 | handleTableDel, |
172 | 191 | isJudgeStatus, | ... | ... |
... | ... | @@ -6,10 +6,11 @@ |
6 | 6 | </div> |
7 | 7 | </template> |
8 | 8 | <script lang="ts"> |
9 | - import { defineComponent } from 'vue'; | |
9 | + import { defineComponent, watch } from 'vue'; | |
10 | 10 | import { BasicForm, useForm } from '/@/components/Form'; |
11 | 11 | import { step1Schemas } from './data'; |
12 | 12 | import { Select, Input, Divider } from 'ant-design-vue'; |
13 | + | |
13 | 14 | export default defineComponent({ |
14 | 15 | components: { |
15 | 16 | BasicForm, |
... | ... | @@ -19,8 +20,11 @@ |
19 | 20 | [Divider.name]: Divider, |
20 | 21 | }, |
21 | 22 | emits: ['next'], |
22 | - setup(_, { emit }) { | |
23 | - const [register, { validate }] = useForm({ | |
23 | + props: { | |
24 | + echoStep1: Object, | |
25 | + }, | |
26 | + setup(props, { emit }) { | |
27 | + const [register, { validate, setFieldsValue, resetFields }] = useForm({ | |
24 | 28 | labelWidth: 100, |
25 | 29 | schemas: step1Schemas, |
26 | 30 | actionColOptions: { |
... | ... | @@ -32,13 +36,23 @@ |
32 | 36 | }, |
33 | 37 | submitFunc: customSubmitFunc, |
34 | 38 | }); |
35 | - | |
39 | + watch( | |
40 | + () => props.echoStep1, | |
41 | + (newV) => { | |
42 | + if (newV?.key == 'edit') { | |
43 | + setFieldsValue({ ...newV }); | |
44 | + } else { | |
45 | + resetFields(); | |
46 | + } | |
47 | + } | |
48 | + ); | |
36 | 49 | async function customSubmitFunc() { |
37 | 50 | try { |
38 | 51 | const values = await validate(); |
39 | 52 | emit('next', values); |
40 | 53 | } catch (error) {} |
41 | 54 | } |
55 | + | |
42 | 56 | return { register }; |
43 | 57 | }, |
44 | 58 | }); | ... | ... |
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | </div> |
5 | 5 | </template> |
6 | 6 | <script lang="ts"> |
7 | - import { defineComponent } from 'vue'; | |
7 | + import { defineComponent, watch } from 'vue'; | |
8 | 8 | import { BasicForm, useForm } from '/@/components/Form'; |
9 | 9 | import { step2Schemas } from './data'; |
10 | 10 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
... | ... | @@ -18,8 +18,11 @@ |
18 | 18 | [Descriptions.Item.name]: Descriptions.Item, |
19 | 19 | }, |
20 | 20 | emits: ['next', 'prev'], |
21 | - setup(_, { emit }) { | |
22 | - const [register, { validate }] = useForm({ | |
21 | + props: { | |
22 | + echoStep2: Object, | |
23 | + }, | |
24 | + setup(props, { emit }) { | |
25 | + const [register, { validate, setFieldsValue, resetFields }] = useForm({ | |
23 | 26 | labelWidth: 80, |
24 | 27 | schemas: step2Schemas, |
25 | 28 | actionColOptions: { |
... | ... | @@ -34,6 +37,16 @@ |
34 | 37 | resetFunc: customResetFunc, |
35 | 38 | submitFunc: customSubmitFunc, |
36 | 39 | }); |
40 | + watch( | |
41 | + () => props.echoStep2, | |
42 | + (newV) => { | |
43 | + if (newV?.key == 'edit') { | |
44 | + setFieldsValue({ ...newV }); | |
45 | + } else { | |
46 | + resetFields(); | |
47 | + } | |
48 | + } | |
49 | + ); | |
37 | 50 | async function customResetFunc() { |
38 | 51 | emit('prev'); |
39 | 52 | } | ... | ... |
1 | 1 | <template> |
2 | 2 | <div class="step3"> |
3 | - <template v-for="(item, index) in alarmList" :key="item.id"> | |
3 | + <template v-for="(item, index) in alarms" :key="item.id"> | |
4 | 4 | <CollapseContainer class="border mb-8"> |
5 | 5 | <template #action> |
6 | 6 | <div @click="deleteAlarmRule(index)" class="cursor-pointer"> |
... | ... | @@ -56,13 +56,11 @@ |
56 | 56 | </BasicForm> |
57 | 57 | </CollapseContainer> |
58 | 58 | </template> |
59 | - <div class="flex justify-start"> | |
60 | - <a-button class="mr-5" @click="prevStep">上一步</a-button> | |
61 | - <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | |
62 | - <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule" | |
63 | - >添加报警规则</a-button | |
64 | - > | |
65 | - </div> | |
59 | + </div> | |
60 | + <div class="flex justify-start" style="display: fixed; top: 100px"> | |
61 | + <a-button class="mr-5" @click="prevStep">上一步</a-button> | |
62 | + <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | |
63 | + <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule">添加报警规则</a-button> | |
66 | 64 | </div> |
67 | 65 | </template> |
68 | 66 | |
... | ... | @@ -97,20 +95,20 @@ |
97 | 95 | setup(_, { emit }) { |
98 | 96 | const getAllFormData: any = ref({}); |
99 | 97 | //告警列表 |
100 | - let alarmList = ref<alarmListItem[]>([]); | |
98 | + let alarms = ref<alarmListItem[]>([]); | |
101 | 99 | const log = (e) => { |
102 | 100 | console.log(e); |
103 | 101 | }; |
104 | 102 | // 添加和删除告警配置 |
105 | 103 | const deleteAlarmRule = (index: number) => { |
106 | - unref(alarmList).splice(index, 1); | |
104 | + unref(alarms).splice(index, 1); | |
107 | 105 | }; |
108 | 106 | // 上一步 |
109 | 107 | const prevStep = () => { |
110 | 108 | emit('prev'); |
111 | 109 | }; |
112 | 110 | const addAlarmRule = () => { |
113 | - unref(alarmList).push({ | |
111 | + unref(alarms).push({ | |
114 | 112 | id: Date.now(), |
115 | 113 | messageMode: '', |
116 | 114 | enabled: false, |
... | ... | @@ -171,7 +169,7 @@ |
171 | 169 | |
172 | 170 | // 添加‘创建条件’ |
173 | 171 | const addCreateRole = (index: number) => { |
174 | - unref(alarmList)[index].createRule.push({ | |
172 | + unref(alarms)[index].createRule.push({ | |
175 | 173 | id: Date.now() + Math.random(), |
176 | 174 | alarmVisible: false, |
177 | 175 | addKeyFilterVisible: false, |
... | ... | @@ -182,7 +180,7 @@ |
182 | 180 | }; |
183 | 181 | // 删除‘创建条件’ |
184 | 182 | const deleteCondition = (index: number, createIndex: number) => { |
185 | - alarmList.value[index].createRule.splice(createIndex, 1); | |
183 | + alarms.value[index].createRule.splice(createIndex, 1); | |
186 | 184 | }; |
187 | 185 | |
188 | 186 | const handleFormStep3toStep4Next = async () => { |
... | ... | @@ -199,6 +197,7 @@ |
199 | 197 | valueRegisterFormCreateAlarm, |
200 | 198 | valueRegisterFormClearAlarm |
201 | 199 | ); |
200 | + console.log('第三步的数据', getAllFormData.value); | |
202 | 201 | emit('next', getAllFormData.value); |
203 | 202 | } catch (error) {} |
204 | 203 | }; |
... | ... | @@ -206,7 +205,7 @@ |
206 | 205 | return { |
207 | 206 | handleFormStep3toStep4Next, |
208 | 207 | log, |
209 | - alarmList, | |
208 | + alarms, | |
210 | 209 | deleteAlarmRule, |
211 | 210 | prevStep, |
212 | 211 | addAlarmRule, | ... | ... |
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | -import { findDictItemByCode } from '/@/api/system/dict'; | |
2 | +// import { findDictItemByCode } from '/@/api/system/dict'; | |
3 | 3 | import { getOrganizationList } from '/@/api/system/system'; |
4 | 4 | import { copyTransFun } from '/@/utils/fnUtils'; |
5 | 5 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
... | ... | @@ -35,21 +35,33 @@ export const step1Schemas: FormSchema[] = [ |
35 | 35 | api: deviceConfigGetRuleChain, |
36 | 36 | labelField: 'name', |
37 | 37 | valueField: 'type', |
38 | + resultField: '', | |
38 | 39 | }, |
39 | 40 | }, |
40 | - { | |
41 | - field: 'defaultConfig', | |
42 | - label: '队列优先级', | |
43 | - component: 'ApiSelect', | |
44 | - componentProps: { | |
45 | - api: findDictItemByCode, | |
46 | - params: { | |
47 | - dictCode: 'queen_execute_sequence', | |
48 | - }, | |
49 | - labelField: 'itemText', | |
50 | - valueField: 'itemValue', | |
51 | - }, | |
52 | - }, | |
41 | + // { | |
42 | + // field: 'icon', | |
43 | + // component: 'Upload', | |
44 | + // label: '请上传图片', | |
45 | + // colProps: { | |
46 | + // span: 8, | |
47 | + // }, | |
48 | + // componentProps: { | |
49 | + // // api: uploadApi, | |
50 | + // }, | |
51 | + // }, | |
52 | + // { | |
53 | + // field: 'defaultConfig', | |
54 | + // label: '队列优先级', | |
55 | + // component: 'ApiSelect', | |
56 | + // componentProps: { | |
57 | + // api: findDictItemByCode, | |
58 | + // params: { | |
59 | + // dictCode: 'queen_execute_sequence', | |
60 | + // }, | |
61 | + // labelField: 'itemText', | |
62 | + // valueField: 'itemValue', | |
63 | + // }, | |
64 | + // }, | |
53 | 65 | { |
54 | 66 | label: '描述', |
55 | 67 | field: 'description', |
... | ... | @@ -71,25 +83,6 @@ export const step2Schemas: FormSchema[] = [ |
71 | 83 | ], |
72 | 84 | }, |
73 | 85 | }, |
74 | - { | |
75 | - field: 'Topic', | |
76 | - component: 'Input', | |
77 | - label: 'Topic', | |
78 | - componentProps: { | |
79 | - placeholder: '请输入', | |
80 | - }, | |
81 | - }, | |
82 | - { | |
83 | - field: 'Payload', | |
84 | - component: 'Select', | |
85 | - label: 'Payload', | |
86 | - componentProps: { | |
87 | - options: [ | |
88 | - { label: 'JSON', value: 'DEFAULT' }, | |
89 | - { label: 'Protobuf', value: 'DEFAULT' }, | |
90 | - ], | |
91 | - }, | |
92 | - }, | |
93 | 86 | ]; |
94 | 87 | |
95 | 88 | export const step3Schemas: FormSchema[] = [ |
... | ... | @@ -97,6 +90,9 @@ export const step3Schemas: FormSchema[] = [ |
97 | 90 | field: 'description', |
98 | 91 | component: 'Input', |
99 | 92 | label: '报警类型', |
93 | + colProps: { | |
94 | + span: 12, | |
95 | + }, | |
100 | 96 | required: true, |
101 | 97 | componentProps: { |
102 | 98 | placeholder: '请输入报警类型', |
... | ... | @@ -112,7 +108,7 @@ export const step3HighSetting: FormSchema[] = [ |
112 | 108 | slot: 'checkBox', |
113 | 109 | }, |
114 | 110 | { |
115 | - field: 'messageMode', | |
111 | + field: 'defaultConfig', | |
116 | 112 | component: 'Input', |
117 | 113 | label: '关联类型', |
118 | 114 | componentProps: { |
... | ... | @@ -124,7 +120,7 @@ export const step3HighSetting: FormSchema[] = [ |
124 | 120 | |
125 | 121 | export const step3CreateAlarm: FormSchema[] = [ |
126 | 122 | { |
127 | - field: 'severity', | |
123 | + field: 'alarmType', | |
128 | 124 | component: 'Select', |
129 | 125 | label: '严重程度', |
130 | 126 | componentProps: { | ... | ... |
... | ... | @@ -14,9 +14,12 @@ interface clearRule { |
14 | 14 | detail: string; |
15 | 15 | } |
16 | 16 | export interface alarmListItem { |
17 | - id: number; | |
18 | - messageMode: string; | |
19 | - enabled: boolean; | |
20 | - createRule: createRule[]; | |
21 | - clearRule: clearRule[]; | |
17 | + id?: number; | |
18 | + messageMode?: string; | |
19 | + alarmType?: string; | |
20 | + enabled?: boolean; | |
21 | + createRule?: createRule[]; | |
22 | + clearRule?: clearRule[]; | |
23 | + propagate?: boolean; | |
24 | + propagateRelationTypes?: string[]; | |
22 | 25 | } | ... | ... |
... | ... | @@ -93,7 +93,6 @@ |
93 | 93 | getAllFormData.doConditions = doConditionsArray; |
94 | 94 | getAllFormData.doActions = doActionsArray; |
95 | 95 | //所有的表单值 |
96 | - console.log('提交的值', getAllFormData); | |
97 | 96 | await screenLinkPageAddApi(getAllFormData); |
98 | 97 | createMessage.success('场景联动新增成功'); |
99 | 98 | closeDrawer(); |
... | ... | @@ -112,7 +111,6 @@ |
112 | 111 | getAllFormData.triggers = triggersArray; |
113 | 112 | getAllFormData.doConditions = doConditionsArray; |
114 | 113 | getAllFormData.doActions = doActionsArray; |
115 | - console.log('编辑的值', getAllFormData); | |
116 | 114 | await screenLinkPageUpdateApi(getAllFormData); |
117 | 115 | createMessage.success('场景联动编辑成功'); |
118 | 116 | closeDrawer(); | ... | ... |
1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | 2 | import { Tinymce } from '/@/components/Tinymce/index'; |
3 | 3 | import { h, ref } from 'vue'; |
4 | -import { findDictItemByCode } from '/@/api/system/dict'; | |
4 | +// import { findDictItemByCode } from '/@/api/system/dict'; | |
5 | 5 | import { getOrganizationList } from '/@/api/system/system'; |
6 | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
7 | 7 | import { Tag } from 'ant-design-vue'; |
8 | 8 | |
9 | 9 | export const selectWhere = ref(null); |
10 | 10 | export const isDeptId = ref(null); |
11 | + | |
12 | +export enum IsOrgEnum { | |
13 | + IS_ORG_ENUM = '1', | |
14 | +} | |
15 | + | |
16 | +export const isOrg = (type: string) => { | |
17 | + return type === IsOrgEnum.IS_ORG_ENUM; | |
18 | +}; | |
19 | + | |
11 | 20 | export const columns: BasicColumn[] = [ |
12 | 21 | { |
13 | 22 | title: '类型', |
... | ... | @@ -117,26 +126,32 @@ export const formSchema: FormSchema[] = [ |
117 | 126 | api: async () => { |
118 | 127 | const data = await getOrganizationList(); |
119 | 128 | copyTransFun(data as any as any[]); |
120 | - return data; | |
129 | + const filterData = data.map((m) => { | |
130 | + return { | |
131 | + label: m.label, | |
132 | + value: m.value, | |
133 | + }; | |
134 | + }); | |
135 | + return filterData; | |
121 | 136 | }, |
122 | 137 | onChange: (v) => { |
123 | 138 | isDeptId.value = v; |
124 | 139 | }, |
125 | 140 | }, |
141 | + ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')), | |
126 | 142 | }, |
127 | 143 | { |
128 | 144 | field: 'receiverType', |
129 | 145 | required: true, |
130 | 146 | label: '接收者', |
131 | 147 | colProps: { span: 24 }, |
132 | - component: 'ApiSelect', | |
148 | + component: 'Select', | |
133 | 149 | componentProps: { |
134 | - api: findDictItemByCode, | |
135 | - params: { | |
136 | - dictCode: 'receiver_type', | |
137 | - }, | |
138 | - labelField: 'itemText', | |
139 | - valueField: 'itemValue', | |
150 | + placeholder: '接收者', | |
151 | + options: [ | |
152 | + { label: '全部', value: '0' }, | |
153 | + { label: '组织', value: '1' }, | |
154 | + ], | |
140 | 155 | onChange: (v) => { |
141 | 156 | switch (v) { |
142 | 157 | case '0': |
... | ... | @@ -145,17 +160,37 @@ export const formSchema: FormSchema[] = [ |
145 | 160 | case '1': |
146 | 161 | selectWhere.value = v; |
147 | 162 | break; |
148 | - case '2': | |
149 | - selectWhere.value = v; | |
150 | - break; | |
151 | - case '3': | |
152 | - selectWhere.value = v; | |
153 | - break; | |
154 | 163 | default: |
155 | - selectWhere.value = v; | |
164 | + selectWhere.value = 0; | |
156 | 165 | } |
157 | 166 | }, |
158 | 167 | }, |
168 | + // componentProps: { | |
169 | + // api: findDictItemByCode, | |
170 | + // params: { | |
171 | + // dictCode: 'receiver_type', | |
172 | + // }, | |
173 | + // labelField: 'itemText', | |
174 | + // valueField: 'itemValue', | |
175 | + // onChange: (v) => { | |
176 | + // switch (v) { | |
177 | + // case '0': | |
178 | + // selectWhere.value = v; | |
179 | + // break; | |
180 | + // case '1': | |
181 | + // selectWhere.value = v; | |
182 | + // break; | |
183 | + // case '2': | |
184 | + // selectWhere.value = v; | |
185 | + // break; | |
186 | + // case '3': | |
187 | + // selectWhere.value = v; | |
188 | + // break; | |
189 | + // default: | |
190 | + // selectWhere.value = v; | |
191 | + // } | |
192 | + // }, | |
193 | + // }, | |
159 | 194 | }, |
160 | 195 | { |
161 | 196 | field: '', | ... | ... |
... | ... | @@ -77,18 +77,6 @@ |
77 | 77 | watch(isDeptId, (nV) => { |
78 | 78 | getOranAndDeptId.value = nV; |
79 | 79 | }); |
80 | - // onMounted(() => { | |
81 | - // getOrganizationList().then((res) => { | |
82 | - // res.map((m) => { | |
83 | - // if (m.children) { | |
84 | - // m.children.map((m1) => { | |
85 | - // newArray.value.push(m1.id); | |
86 | - // }); | |
87 | - // } | |
88 | - // }); | |
89 | - // }); | |
90 | - // }); | |
91 | - | |
92 | 80 | async function handleSend() { |
93 | 81 | if (!unref(isUpdate)) { |
94 | 82 | const values = await validate(); |
... | ... | @@ -99,17 +87,9 @@ |
99 | 87 | break; |
100 | 88 | case '1': |
101 | 89 | if (pointArray.value.length === 0) { |
102 | - pointArray.value.push(getAllData.organizationId); | |
103 | - } | |
104 | - break; | |
105 | - case '2': | |
106 | - if (pointArray.value.length === 0) { | |
107 | 90 | pointArray.value.push(getOranAndDeptId.value); |
108 | 91 | } |
109 | 92 | break; |
110 | - case '3': | |
111 | - pointArray.value = [3]; | |
112 | - break; | |
113 | 93 | } |
114 | 94 | getAllData.pointId = pointArray.value; |
115 | 95 | await notifyAddLeaseApi(getAllData); |
... | ... | @@ -127,17 +107,9 @@ |
127 | 107 | break; |
128 | 108 | case '1': |
129 | 109 | if (pointArray.value.length === 0) { |
130 | - pointArray.value.push(getAllData.organizationId); | |
131 | - } | |
132 | - break; | |
133 | - case '2': | |
134 | - if (pointArray.value.length === 0) { | |
135 | 110 | pointArray.value.push(getOranAndDeptId.value); |
136 | 111 | } |
137 | 112 | break; |
138 | - case '3': | |
139 | - pointArray.value = [3]; | |
140 | - break; | |
141 | 113 | } |
142 | 114 | getAllEditData.pointId = pointArray.value; |
143 | 115 | Object.assign(postAllEditData, getAllEditData); |
... | ... | @@ -157,17 +129,9 @@ |
157 | 129 | break; |
158 | 130 | case '1': |
159 | 131 | if (pointArray.value.length === 0) { |
160 | - pointArray.value.push(getAllData.organizationId); | |
161 | - } | |
162 | - break; | |
163 | - case '2': | |
164 | - if (pointArray.value.length === 0) { | |
165 | 132 | pointArray.value.push(getOranAndDeptId.value); |
166 | 133 | } |
167 | 134 | break; |
168 | - case '3': | |
169 | - pointArray.value = [3]; | |
170 | - break; | |
171 | 135 | } |
172 | 136 | getAllData.pointId = pointArray.value; |
173 | 137 | await notifyAddDraftApi(getAllData); |
... | ... | @@ -185,17 +149,9 @@ |
185 | 149 | break; |
186 | 150 | case '1': |
187 | 151 | if (pointArray.value.length === 0) { |
188 | - pointArray.value.push(getAllData.organizationId); | |
189 | - } | |
190 | - break; | |
191 | - case '2': | |
192 | - if (pointArray.value.length === 0) { | |
193 | 152 | pointArray.value.push(getOranAndDeptId.value); |
194 | 153 | } |
195 | 154 | break; |
196 | - case '3': | |
197 | - pointArray.value = [3]; | |
198 | - break; | |
199 | 155 | } |
200 | 156 | getAllEditData.pointId = pointArray.value; |
201 | 157 | Object.assign(postAllEditData, getAllEditData); | ... | ... |