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