Commit b2c2d9b12a776d4b1a6edb97bb66e9760bc97c3e
Merge branch 'ft-dev' into 'main'
fix:修复场景联动执行条件和执行动作回显问题 See merge request huang/yun-teng-iot-front!125
Showing
7 changed files
with
235 additions
and
310 deletions
| @@ -123,19 +123,23 @@ export const usePermissionStore = defineStore({ | @@ -123,19 +123,23 @@ export const usePermissionStore = defineStore({ | ||
| 123 | let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME; | 123 | let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME; | 
| 124 | function patcher(routes: AppRouteRecordRaw[], parentPath = '') { | 124 | function patcher(routes: AppRouteRecordRaw[], parentPath = '') { | 
| 125 | if (parentPath) parentPath = parentPath + '/'; | 125 | if (parentPath) parentPath = parentPath + '/'; | 
| 126 | - routes?.forEach((route: AppRouteRecordRaw) => { | ||
| 127 | - const { path, children, redirect } = route; | ||
| 128 | - const currentPath = path.startsWith('/') ? path : parentPath + path; | ||
| 129 | - if (currentPath === homePath) { | ||
| 130 | - if (redirect) { | ||
| 131 | - homePath = route.redirect! as string; | ||
| 132 | - } else { | ||
| 133 | - route.meta = Object.assign({}, route.meta, { affix: true }); | ||
| 134 | - throw new Error('end'); | 126 | + try { | 
| 127 | + routes?.forEach((route: AppRouteRecordRaw) => { | ||
| 128 | + const { path, children, redirect } = route; | ||
| 129 | + const currentPath = path.startsWith('/') ? path : parentPath + path; | ||
| 130 | + if (currentPath === homePath) { | ||
| 131 | + if (redirect) { | ||
| 132 | + homePath = route.redirect! as string; | ||
| 133 | + } else { | ||
| 134 | + route.meta = Object.assign({}, route.meta, { affix: true }); | ||
| 135 | + throw new Error('end'); | ||
| 136 | + } | ||
| 135 | } | 137 | } | 
| 136 | - } | ||
| 137 | - children && children.length > 0 && patcher(children, currentPath); | ||
| 138 | - }); | 138 | + children && children.length > 0 && patcher(children, currentPath); | 
| 139 | + }); | ||
| 140 | + } catch (e) { | ||
| 141 | + return e; | ||
| 142 | + } | ||
| 139 | } | 143 | } | 
| 140 | try { | 144 | try { | 
| 141 | patcher(routes); | 145 | patcher(routes); | 
| @@ -20,14 +20,14 @@ export const columns: BasicColumn[] = [ | @@ -20,14 +20,14 @@ export const columns: BasicColumn[] = [ | ||
| 20 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 20 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 
| 21 | ? 'MQTT' | 21 | ? 'MQTT' | 
| 22 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 22 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 
| 23 | - ? 'RabbitMq' | ||
| 24 | - : 'Api'; | 23 | + ? 'RabbitMQ' | 
| 24 | + : 'REST_API'; | ||
| 25 | const color = | 25 | const color = | 
| 26 | enable == 'KafKa' | 26 | enable == 'KafKa' | 
| 27 | ? '#0099FF' | 27 | ? '#0099FF' | 
| 28 | : enable == 'MQTT' | 28 | : enable == 'MQTT' | 
| 29 | ? '#7C7CC9' | 29 | ? '#7C7CC9' | 
| 30 | - : enable == 'RabbitMq' | 30 | + : enable == 'RabbitMQ' | 
| 31 | ? '#E8A15E' | 31 | ? '#E8A15E' | 
| 32 | : '#81B1AB'; | 32 | : '#81B1AB'; | 
| 33 | const text = | 33 | const text = | 
| @@ -35,9 +35,9 @@ export const columns: BasicColumn[] = [ | @@ -35,9 +35,9 @@ export const columns: BasicColumn[] = [ | ||
| 35 | ? 'KafKa' | 35 | ? 'KafKa' | 
| 36 | : enable == 'MQTT' | 36 | : enable == 'MQTT' | 
| 37 | ? 'MQTT' | 37 | ? 'MQTT' | 
| 38 | - : enable == 'RabbitMq' | ||
| 39 | - ? 'RabbitMq' | ||
| 40 | - : 'Api'; | 38 | + : enable == 'RabbitMQ' | 
| 39 | + ? 'RabbitMQ' | ||
| 40 | + : 'REST_API'; | ||
| 41 | return h(Tag, { color: color }, () => text); | 41 | return h(Tag, { color: color }, () => text); | 
| 42 | }, | 42 | }, | 
| 43 | 43 | ||
| @@ -47,8 +47,8 @@ export const columns: BasicColumn[] = [ | @@ -47,8 +47,8 @@ export const columns: BasicColumn[] = [ | ||
| 47 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 47 | : record.type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | 
| 48 | ? 'MQTT' | 48 | ? 'MQTT' | 
| 49 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 49 | : record.type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | 
| 50 | - ? 'RabbitMq' | ||
| 51 | - : 'Api'; | 50 | + ? 'RabbitMQ' | 
| 51 | + : 'REST_API'; | ||
| 52 | }, | 52 | }, | 
| 53 | }, | 53 | }, | 
| 54 | { | 54 | { | 
| @@ -59,66 +59,60 @@ | @@ -59,66 +59,60 @@ | ||
| 59 | </template> | 59 | </template> | 
| 60 | <template #uploadAdd1="{ field }"> | 60 | <template #uploadAdd1="{ field }"> | 
| 61 | <span style="display: none">{{ field }}</span> | 61 | <span style="display: none">{{ field }}</span> | 
| 62 | - <Upload> | ||
| 63 | - <UploadDragger | ||
| 64 | - v-model:fileList="fileList" | ||
| 65 | - name="file" | ||
| 66 | - :multiple="true" | ||
| 67 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 68 | - @change="handleChange" | ||
| 69 | - > | ||
| 70 | - <p class="ant-upload-drag-icon"> | ||
| 71 | - <InboxOutlined /> | ||
| 72 | - </p> | ||
| 73 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 74 | - <p class="ant-upload-hint"> | ||
| 75 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 76 | - or other band files | ||
| 77 | - </p> | ||
| 78 | - </UploadDragger> | ||
| 79 | - </Upload> | 62 | + <a-upload-dragger | 
| 63 | + v-model:fileList="fileList" | ||
| 64 | + name="file" | ||
| 65 | + :multiple="true" | ||
| 66 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 67 | + @change="handleChange" | ||
| 68 | + > | ||
| 69 | + <p class="ant-upload-drag-icon"> | ||
| 70 | + <InboxOutlined /> | ||
| 71 | + </p> | ||
| 72 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 73 | + <p class="ant-upload-hint"> | ||
| 74 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 75 | + other band files | ||
| 76 | + </p> | ||
| 77 | + </a-upload-dragger> | ||
| 80 | </template> | 78 | </template> | 
| 81 | <template #uploadAdd2="{ field }"> | 79 | <template #uploadAdd2="{ field }"> | 
| 82 | <span style="display: none">{{ field }}</span> | 80 | <span style="display: none">{{ field }}</span> | 
| 83 | - <Upload> | ||
| 84 | - <UploadDragger | ||
| 85 | - v-model:fileList="fileList" | ||
| 86 | - name="file" | ||
| 87 | - :multiple="true" | ||
| 88 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 89 | - @change="handleChange" | ||
| 90 | - > | ||
| 91 | - <p class="ant-upload-drag-icon"> | ||
| 92 | - <InboxOutlined /> | ||
| 93 | - </p> | ||
| 94 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 95 | - <p class="ant-upload-hint"> | ||
| 96 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 97 | - or other band files | ||
| 98 | - </p> | ||
| 99 | - </UploadDragger> | ||
| 100 | - </Upload> | 81 | + <a-upload-dragger | 
| 82 | + v-model:fileList="fileList" | ||
| 83 | + name="file" | ||
| 84 | + :multiple="true" | ||
| 85 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 86 | + @change="handleChange" | ||
| 87 | + > | ||
| 88 | + <p class="ant-upload-drag-icon"> | ||
| 89 | + <InboxOutlined /> | ||
| 90 | + </p> | ||
| 91 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 92 | + <p class="ant-upload-hint"> | ||
| 93 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 94 | + other band files | ||
| 95 | + </p> | ||
| 96 | + </a-upload-dragger> | ||
| 101 | </template> | 97 | </template> | 
| 102 | <template #uploadAdd3="{ field }"> | 98 | <template #uploadAdd3="{ field }"> | 
| 103 | <span style="display: none">{{ field }}</span> | 99 | <span style="display: none">{{ field }}</span> | 
| 104 | - <Upload> | ||
| 105 | - <UploadDragger | ||
| 106 | - v-model:fileList="fileList" | ||
| 107 | - name="file" | ||
| 108 | - :multiple="true" | ||
| 109 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 110 | - @change="handleChange" | ||
| 111 | - > | ||
| 112 | - <p class="ant-upload-drag-icon"> | ||
| 113 | - <InboxOutlined /> | ||
| 114 | - </p> | ||
| 115 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 116 | - <p class="ant-upload-hint"> | ||
| 117 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 118 | - or other band files | ||
| 119 | - </p> | ||
| 120 | - </UploadDragger> | ||
| 121 | - </Upload> | 100 | + <a-upload-dragger | 
| 101 | + v-model:fileList="fileList" | ||
| 102 | + name="file" | ||
| 103 | + :multiple="true" | ||
| 104 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 105 | + @change="handleChange" | ||
| 106 | + > | ||
| 107 | + <p class="ant-upload-drag-icon"> | ||
| 108 | + <InboxOutlined /> | ||
| 109 | + </p> | ||
| 110 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 111 | + <p class="ant-upload-hint"> | ||
| 112 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 113 | + other band files | ||
| 114 | + </p> | ||
| 115 | + </a-upload-dragger> | ||
| 122 | </template> | 116 | </template> | 
| 123 | </BasicForm> | 117 | </BasicForm> | 
| 124 | </div> | 118 | </div> | 
| @@ -142,8 +136,7 @@ | @@ -142,8 +136,7 @@ | ||
| 142 | [Descriptions.name]: Descriptions, | 136 | [Descriptions.name]: Descriptions, | 
| 143 | [Descriptions.Item.name]: Descriptions.Item, | 137 | [Descriptions.Item.name]: Descriptions.Item, | 
| 144 | InboxOutlined, | 138 | InboxOutlined, | 
| 145 | - Upload: Upload, | ||
| 146 | - UploadDragger: Upload.UploadDragger, | 139 | + [Upload.Dragger.name]: Upload.Dragger, | 
| 147 | }, | 140 | }, | 
| 148 | emits: ['next', 'prev', 'register'], | 141 | emits: ['next', 'prev', 'register'], | 
| 149 | setup(_, { emit }) { | 142 | setup(_, { emit }) { | 
| @@ -4,66 +4,60 @@ | @@ -4,66 +4,60 @@ | ||
| 4 | <BasicForm :showSubmitButton="false" @register="register"> | 4 | <BasicForm :showSubmitButton="false" @register="register"> | 
| 5 | <template #uploadAdd1="{ field }"> | 5 | <template #uploadAdd1="{ field }"> | 
| 6 | <span style="display: none">{{ field }}</span> | 6 | <span style="display: none">{{ field }}</span> | 
| 7 | - <Upload> | ||
| 8 | - <UploadDragger | ||
| 9 | - v-model:fileList="fileList" | ||
| 10 | - name="file" | ||
| 11 | - :multiple="true" | ||
| 12 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 13 | - @change="handleChange" | ||
| 14 | - > | ||
| 15 | - <p class="ant-upload-drag-icon"> | ||
| 16 | - <InboxOutlined /> | ||
| 17 | - </p> | ||
| 18 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 19 | - <p class="ant-upload-hint"> | ||
| 20 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 21 | - or other band files | ||
| 22 | - </p> | ||
| 23 | - </UploadDragger> | ||
| 24 | - </Upload> | 7 | + <a-upload-dragger | 
| 8 | + v-model:fileList="fileList" | ||
| 9 | + name="file" | ||
| 10 | + :multiple="true" | ||
| 11 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 12 | + @change="handleChange" | ||
| 13 | + > | ||
| 14 | + <p class="ant-upload-drag-icon"> | ||
| 15 | + <InboxOutlined /> | ||
| 16 | + </p> | ||
| 17 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 18 | + <p class="ant-upload-hint"> | ||
| 19 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 20 | + other band files | ||
| 21 | + </p> | ||
| 22 | + </a-upload-dragger> | ||
| 25 | </template> | 23 | </template> | 
| 26 | <template #uploadAdd2="{ field }"> | 24 | <template #uploadAdd2="{ field }"> | 
| 27 | <span style="display: none">{{ field }}</span> | 25 | <span style="display: none">{{ field }}</span> | 
| 28 | - <Upload> | ||
| 29 | - <UploadDragger | ||
| 30 | - v-model:fileList="fileList" | ||
| 31 | - name="file" | ||
| 32 | - :multiple="true" | ||
| 33 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 34 | - @change="handleChange" | ||
| 35 | - > | ||
| 36 | - <p class="ant-upload-drag-icon"> | ||
| 37 | - <InboxOutlined /> | ||
| 38 | - </p> | ||
| 39 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 40 | - <p class="ant-upload-hint"> | ||
| 41 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 42 | - or other band files | ||
| 43 | - </p> | ||
| 44 | - </UploadDragger> | ||
| 45 | - </Upload> | 26 | + <a-upload-dragger | 
| 27 | + v-model:fileList="fileList" | ||
| 28 | + name="file" | ||
| 29 | + :multiple="true" | ||
| 30 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 31 | + @change="handleChange" | ||
| 32 | + > | ||
| 33 | + <p class="ant-upload-drag-icon"> | ||
| 34 | + <InboxOutlined /> | ||
| 35 | + </p> | ||
| 36 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 37 | + <p class="ant-upload-hint"> | ||
| 38 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 39 | + other band files | ||
| 40 | + </p> | ||
| 41 | + </a-upload-dragger> | ||
| 46 | </template> | 42 | </template> | 
| 47 | <template #uploadAdd3="{ field }"> | 43 | <template #uploadAdd3="{ field }"> | 
| 48 | <span style="display: none">{{ field }}</span> | 44 | <span style="display: none">{{ field }}</span> | 
| 49 | - <Upload> | ||
| 50 | - <UploadDragger | ||
| 51 | - v-model:fileList="fileList" | ||
| 52 | - name="file" | ||
| 53 | - :multiple="true" | ||
| 54 | - action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 55 | - @change="handleChange" | ||
| 56 | - > | ||
| 57 | - <p class="ant-upload-drag-icon"> | ||
| 58 | - <InboxOutlined /> | ||
| 59 | - </p> | ||
| 60 | - <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 61 | - <p class="ant-upload-hint"> | ||
| 62 | - Support for a single or bulk upload. Strictly prohibit from uploading company data | ||
| 63 | - or other band files | ||
| 64 | - </p> | ||
| 65 | - </UploadDragger> | ||
| 66 | - </Upload> | 45 | + <a-upload-dragger | 
| 46 | + v-model:fileList="fileList" | ||
| 47 | + name="file" | ||
| 48 | + :multiple="true" | ||
| 49 | + action="https://www.mocky.io/v2/5cc8019d300000980a055e76" | ||
| 50 | + @change="handleChange" | ||
| 51 | + > | ||
| 52 | + <p class="ant-upload-drag-icon"> | ||
| 53 | + <InboxOutlined /> | ||
| 54 | + </p> | ||
| 55 | + <p class="ant-upload-text">Click or drag file to this area to upload</p> | ||
| 56 | + <p class="ant-upload-hint"> | ||
| 57 | + Support for a single or bulk upload. Strictly prohibit from uploading company data or | ||
| 58 | + other band files | ||
| 59 | + </p> | ||
| 60 | + </a-upload-dragger> | ||
| 67 | </template> | 61 | </template> | 
| 68 | </BasicForm> | 62 | </BasicForm> | 
| 69 | </div> | 63 | </div> | 
| @@ -84,8 +78,7 @@ | @@ -84,8 +78,7 @@ | ||
| 84 | [Descriptions.name]: Descriptions, | 78 | [Descriptions.name]: Descriptions, | 
| 85 | [Descriptions.Item.name]: Descriptions.Item, | 79 | [Descriptions.Item.name]: Descriptions.Item, | 
| 86 | InboxOutlined, | 80 | InboxOutlined, | 
| 87 | - Upload: Upload, | ||
| 88 | - UploadDragger: Upload.UploadDragger, | 81 | + [Upload.Dragger.name]: Upload.Dragger, | 
| 89 | }, | 82 | }, | 
| 90 | emits: ['next', 'prev', 'register'], | 83 | emits: ['next', 'prev', 'register'], | 
| 91 | setup(_, { emit }) { | 84 | setup(_, { emit }) { | 
| @@ -112,7 +105,6 @@ | @@ -112,7 +105,6 @@ | ||
| 112 | submitFunc: customSubmitFunc, | 105 | submitFunc: customSubmitFunc, | 
| 113 | }); | 106 | }); | 
| 114 | const setStepTwoFieldsValueFunc = (v, v1) => { | 107 | const setStepTwoFieldsValueFunc = (v, v1) => { | 
| 115 | - console.log(v); | ||
| 116 | setFieldsValue(v); | 108 | setFieldsValue(v); | 
| 117 | setFieldsValue({ | 109 | setFieldsValue({ | 
| 118 | name: v1, | 110 | name: v1, | 
| @@ -597,9 +597,8 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -597,9 +597,8 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 597 | field: 'outTarget', | 597 | field: 'outTarget', | 
| 598 | label: '', | 598 | label: '', | 
| 599 | component: 'Select', | 599 | component: 'Select', | 
| 600 | - required: true, | ||
| 601 | componentProps: { | 600 | componentProps: { | 
| 602 | - placeholder: '设备输出', | 601 | + placeholder: '请选择设备输出', | 
| 603 | options: [ | 602 | options: [ | 
| 604 | { label: '设备输出', value: 'DEVICE_OUT' }, | 603 | { label: '设备输出', value: 'DEVICE_OUT' }, | 
| 605 | { label: '消息通知', value: 'MSG_NOTIFY' }, | 604 | { label: '消息通知', value: 'MSG_NOTIFY' }, | 
| @@ -612,7 +611,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -612,7 +611,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 612 | field: 'deviceId', | 611 | field: 'deviceId', | 
| 613 | label: '', | 612 | label: '', | 
| 614 | component: 'Select', | 613 | component: 'Select', | 
| 615 | - required: true, | ||
| 616 | componentProps: { | 614 | componentProps: { | 
| 617 | placeholder: '请选择设备', | 615 | placeholder: '请选择设备', | 
| 618 | }, | 616 | }, | 
| @@ -626,8 +624,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -626,8 +624,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 626 | field: 'command', | 624 | field: 'command', | 
| 627 | component: 'Input', | 625 | component: 'Input', | 
| 628 | label: '', | 626 | label: '', | 
| 629 | - required: true, | ||
| 630 | - | ||
| 631 | componentProps: { | 627 | componentProps: { | 
| 632 | maxLength: 255, | 628 | maxLength: 255, | 
| 633 | placeholder: '请输入下发指定', | 629 | placeholder: '请输入下发指定', | 
| @@ -716,104 +712,3 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -716,104 +712,3 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 716 | slot: 'add', | 712 | slot: 'add', | 
| 717 | }, | 713 | }, | 
| 718 | ]; | 714 | ]; | 
| 719 | - | ||
| 720 | -export const mockData = { | ||
| 721 | - id: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 722 | - creator: 'b75f1c80-0f94-4a06-84ef-253962bbfe9e', | ||
| 723 | - createTime: '2022-02-21 15:03:44', | ||
| 724 | - name: '测试3', | ||
| 725 | - enabled: false, | ||
| 726 | - description: '测试3', | ||
| 727 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 728 | - organizationId: '0454b838-411b-425b-81c1-7cdcf9ef4816', | ||
| 729 | - triggers: [ | ||
| 730 | - { | ||
| 731 | - enabled: false, | ||
| 732 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 733 | - deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | ||
| 734 | - triggerEvent: 'DEVICE_ACT', | ||
| 735 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 736 | - }, | ||
| 737 | - { | ||
| 738 | - enabled: false, | ||
| 739 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 740 | - deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | ||
| 741 | - triggerEvent: 'DEVICE_ACT', | ||
| 742 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 743 | - }, | ||
| 744 | - { | ||
| 745 | - enabled: false, | ||
| 746 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 747 | - deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | ||
| 748 | - triggerEvent: 'DEVICE_ACT', | ||
| 749 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 750 | - }, | ||
| 751 | - { | ||
| 752 | - enabled: false, | ||
| 753 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 754 | - deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | ||
| 755 | - triggerEvent: 'DEVICE_ACT', | ||
| 756 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 757 | - }, | ||
| 758 | - ], | ||
| 759 | - doActions: [ | ||
| 760 | - { | ||
| 761 | - enabled: false, | ||
| 762 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 763 | - deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | ||
| 764 | - outTarget: 'DEVICE_OUT', | ||
| 765 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 766 | - }, | ||
| 767 | - { | ||
| 768 | - enabled: false, | ||
| 769 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 770 | - deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | ||
| 771 | - outTarget: 'DEVICE_OUT', | ||
| 772 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 773 | - }, | ||
| 774 | - { | ||
| 775 | - enabled: false, | ||
| 776 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 777 | - deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | ||
| 778 | - outTarget: 'DEVICE_OUT', | ||
| 779 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 780 | - }, | ||
| 781 | - { | ||
| 782 | - enabled: false, | ||
| 783 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 784 | - deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | ||
| 785 | - outTarget: 'DEVICE_OUT', | ||
| 786 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 787 | - }, | ||
| 788 | - ], | ||
| 789 | - doConditions: [ | ||
| 790 | - { | ||
| 791 | - enabled: false, | ||
| 792 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 793 | - deviceId: '38bbb9e6-7769-4c32-ad4d-f81df4e37044', | ||
| 794 | - status: 'DEVICE_STATUS', | ||
| 795 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 796 | - }, | ||
| 797 | - { | ||
| 798 | - enabled: false, | ||
| 799 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 800 | - deviceId: '242ffd69-fea8-4929-8815-9bd6f6b6d8bd', | ||
| 801 | - status: 'DEVICE_STATUS', | ||
| 802 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 803 | - }, | ||
| 804 | - { | ||
| 805 | - enabled: false, | ||
| 806 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 807 | - deviceId: 'ddb672d8-32ed-4f62-9a97-95af3d7a3c35', | ||
| 808 | - status: 'DEVICE_STATUS', | ||
| 809 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 810 | - }, | ||
| 811 | - { | ||
| 812 | - enabled: false, | ||
| 813 | - tenantId: 'de10f9e0-8892-11ec-ac19-e398562c8b61', | ||
| 814 | - deviceId: 'ee10b318-1bb9-4e78-997b-726b184cc6be', | ||
| 815 | - status: 'DEVICE_STATUS', | ||
| 816 | - sceneLinkageId: 'f90f3cc9-e6ab-41cd-86b8-bb3a8f71ae28', | ||
| 817 | - }, | ||
| 818 | - ], | ||
| 819 | -}; | 
| @@ -16,13 +16,13 @@ | @@ -16,13 +16,13 @@ | ||
| 16 | :key="index" | 16 | :key="index" | 
| 17 | > | 17 | > | 
| 18 | <span style="display: none">{{ item + index }}</span> | 18 | <span style="display: none">{{ item + index }}</span> | 
| 19 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span> | 19 | + <span style="position: relative; top: 3.2vh; left: 0.5vw">触发器 {{ index + 1 }}</span> | 
| 20 | <div style="display: block"> | 20 | <div style="display: block"> | 
| 21 | <AddTriggerForm | 21 | <AddTriggerForm | 
| 22 | + ref="refTriggerChild" | ||
| 22 | :editTriggerFather="isUpdate == false ? 1 : item" | 23 | :editTriggerFather="isUpdate == false ? 1 : item" | 
| 23 | :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | 24 | :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | 
| 24 | :deviceInfo="getDeviceInfo" | 25 | :deviceInfo="getDeviceInfo" | 
| 25 | - ref="refTriggerChild" | ||
| 26 | /> | 26 | /> | 
| 27 | </div> | 27 | </div> | 
| 28 | <div style="height: 3vh"></div> | 28 | <div style="height: 3vh"></div> | 
| @@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
| 62 | :key="index" | 62 | :key="index" | 
| 63 | > | 63 | > | 
| 64 | <span style="display: none">{{ item + index }}</span> | 64 | <span style="display: none">{{ item + index }}</span> | 
| 65 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件 {{ index + 1 }}</span> | 65 | + <span style="position: relative; top: 3.2vh; left: 0.5vw">执行条件 {{ index + 1 }}</span> | 
| 66 | 66 | ||
| 67 | <div> | 67 | <div> | 
| 68 | <AddConditiForm | 68 | <AddConditiForm | 
| @@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
| 90 | </div> | 90 | </div> | 
| 91 | <div style="display: flex; width: 4vw; height: 4vh"> | 91 | <div style="display: flex; width: 4vw; height: 4vh"> | 
| 92 | <Button | 92 | <Button | 
| 93 | - v-if="addConditionPushData.length != 0 || addConditionPushData.length != 0" | 93 | + v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0" | 
| 94 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 94 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 
| 95 | type="default" | 95 | type="default" | 
| 96 | class="mt-5" | 96 | class="mt-5" | 
| @@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
| 137 | </div> | 137 | </div> | 
| 138 | <div style="display: flex; width: 4vw; height: 4vh"> | 138 | <div style="display: flex; width: 4vw; height: 4vh"> | 
| 139 | <Button | 139 | <Button | 
| 140 | - v-if="addActionPushData.length > 0 || addActionPushData.length > 0" | 140 | + v-if="addActionPushData.length !== 0 || editActionPushData.length !== 0" | 
| 141 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 141 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 
| 142 | type="default" | 142 | type="default" | 
| 143 | class="mt-5" | 143 | class="mt-5" | 
| @@ -203,6 +203,15 @@ | @@ -203,6 +203,15 @@ | ||
| 203 | compare: '', | 203 | compare: '', | 
| 204 | value: '', | 204 | value: '', | 
| 205 | }); | 205 | }); | 
| 206 | + const editTriggerData = reactive<IAddTrigger>({ | ||
| 207 | + id: Date.now() + Math.random() + '', | ||
| 208 | + triggerEvent: '请选择设备触发', | ||
| 209 | + deviceId: '请选择设备', | ||
| 210 | + touchWay: '请选择出发方式', | ||
| 211 | + attributeChoose: '请选择属性', | ||
| 212 | + compare: '', | ||
| 213 | + value: '', | ||
| 214 | + }); | ||
| 206 | const addConditionData = reactive<IAddCondition>({ | 215 | const addConditionData = reactive<IAddCondition>({ | 
| 207 | id: Date.now() + Math.random() + '', | 216 | id: Date.now() + Math.random() + '', | 
| 208 | status: '', | 217 | status: '', | 
| @@ -213,6 +222,16 @@ | @@ -213,6 +222,16 @@ | ||
| 213 | compare: '', | 222 | compare: '', | 
| 214 | value: '', | 223 | value: '', | 
| 215 | }); | 224 | }); | 
| 225 | + const editConditionData = reactive<IAddCondition>({ | ||
| 226 | + id: Date.now() + Math.random() + '', | ||
| 227 | + status: '', | ||
| 228 | + deviceId: '', | ||
| 229 | + createTime: '', | ||
| 230 | + updateTime: '', | ||
| 231 | + property: '请选择', | ||
| 232 | + compare: '', | ||
| 233 | + value: '', | ||
| 234 | + }); | ||
| 216 | const addActionData = reactive<IAddAction>({ | 235 | const addActionData = reactive<IAddAction>({ | 
| 217 | id: Date.now() + Math.random() + '', | 236 | id: Date.now() + Math.random() + '', | 
| 218 | outTarget: '', | 237 | outTarget: '', | 
| @@ -220,6 +239,13 @@ | @@ -220,6 +239,13 @@ | ||
| 220 | command: '', | 239 | command: '', | 
| 221 | sceneLinkageId: '', | 240 | sceneLinkageId: '', | 
| 222 | }); | 241 | }); | 
| 242 | + const editActionData = reactive<IAddAction>({ | ||
| 243 | + id: Date.now() + Math.random() + '', | ||
| 244 | + outTarget: '请选择触发方式', | ||
| 245 | + deviceId: '请选择设备', | ||
| 246 | + command: '请输入执行命令', | ||
| 247 | + sceneLinkageId: '', | ||
| 248 | + }); | ||
| 223 | const addTriggerPushData = ref<[]>([]); | 249 | const addTriggerPushData = ref<[]>([]); | 
| 224 | const addConditionPushData = ref<[]>([]); | 250 | const addConditionPushData = ref<[]>([]); | 
| 225 | const addActionPushData = ref<[]>([]); | 251 | const addActionPushData = ref<[]>([]); | 
| @@ -244,6 +270,18 @@ | @@ -244,6 +270,18 @@ | ||
| 244 | const newFilterMap = ref<[]>([]); | 270 | const newFilterMap = ref<[]>([]); | 
| 245 | const newConditionFilterMap = ref<[]>([]); | 271 | const newConditionFilterMap = ref<[]>([]); | 
| 246 | const newActionFilterMap = ref<[]>([]); | 272 | const newActionFilterMap = ref<[]>([]); | 
| 273 | + const filterNewTriggerArr = ref<[]>([]); | ||
| 274 | + const filterNewConditionArr = ref<[]>([]); | ||
| 275 | + const filterNewActionArr = ref<[]>([]); | ||
| 276 | + const pushEditArray = ref<[]>([]); | ||
| 277 | + const pushEditConditionArray = ref<[]>([]); | ||
| 278 | + const pushEditActionArray = ref<[]>([]); | ||
| 279 | + const filterArrayTrigger = ref<[]>([]); | ||
| 280 | + const filterArrayCondition = ref<[]>([]); | ||
| 281 | + const filterArrayAction = ref<[]>([]); | ||
| 282 | + const filterArrayTriggerObj = ref({}); | ||
| 283 | + const filterArrayConditionObj = ref({}); | ||
| 284 | + const filterArrayActionObj = ref({}); | ||
| 247 | 285 | ||
| 248 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 286 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 
| 249 | labelWidth: 120, | 287 | labelWidth: 120, | 
| @@ -256,20 +294,17 @@ | @@ -256,20 +294,17 @@ | ||
| 256 | setDrawerProps({ confirmLoading: false }); | 294 | setDrawerProps({ confirmLoading: false }); | 
| 257 | isUpdate.value = !!data?.isUpdate; | 295 | isUpdate.value = !!data?.isUpdate; | 
| 258 | if (!unref(isUpdate)) { | 296 | if (!unref(isUpdate)) { | 
| 259 | - editTriggerPushData.value = []; | ||
| 260 | - editTriggerPushData.value.length = 0; | ||
| 261 | - addTriggerPushData.value = []; | ||
| 262 | - addTriggerPushData.value.length = 0; | ||
| 263 | - addConditionPushData.value = []; | ||
| 264 | - addConditionPushData.value.length = 0; | ||
| 265 | - addActionPushData.value = []; | ||
| 266 | - addActionPushData.value.length = 0; | ||
| 267 | try { | 297 | try { | 
| 268 | - setTimeout(() => { | ||
| 269 | - proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
| 270 | - proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
| 271 | - proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
| 272 | - }, 50); | 298 | + proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | 
| 299 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
| 300 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
| 301 | + lastRefTriggerChildDataArray.value.length = 0; | ||
| 302 | + lastRefConditionChildDataArray.value.length = 0; | ||
| 303 | + lastRefActionChildDataArray.value.length = 0; | ||
| 304 | + editTriggerPushData.value.length = 0; | ||
| 305 | + addTriggerPushData.value.length = 0; | ||
| 306 | + addConditionPushData.value.length = 0; | ||
| 307 | + addActionPushData.value.length = 0; | ||
| 273 | } catch (e) { | 308 | } catch (e) { | 
| 274 | return e; | 309 | return e; | 
| 275 | } | 310 | } | 
| @@ -289,14 +324,6 @@ | @@ -289,14 +324,6 @@ | ||
| 289 | ...data.record, | 324 | ...data.record, | 
| 290 | }); | 325 | }); | 
| 291 | editTriggerPushData.value = data.record.triggers; | 326 | editTriggerPushData.value = data.record.triggers; | 
| 292 | - editTriggerPushData.value.forEach((f) => { | ||
| 293 | - if (f?.id.length == 18) { | ||
| 294 | - editTriggerPushData.value.pop(); | ||
| 295 | - if (editTriggerPushData.value.length) { | ||
| 296 | - editTriggerPushData.value.length = editTriggerPushData.value.length; | ||
| 297 | - } | ||
| 298 | - } | ||
| 299 | - }); | ||
| 300 | editConditionPushData.value = data.record.doConditions; | 327 | editConditionPushData.value = data.record.doConditions; | 
| 301 | editActionPushData.value = data.record.doActions; | 328 | editActionPushData.value = data.record.doActions; | 
| 302 | const options = await screenLinkPageByDeptIdGetDevice({ | 329 | const options = await screenLinkPageByDeptIdGetDevice({ | 
| @@ -403,10 +430,6 @@ | @@ -403,10 +430,6 @@ | ||
| 403 | lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | 430 | lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | 
| 404 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | 431 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | 
| 405 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 432 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 
| 406 | - //删除第一个 | ||
| 407 | - lastRefTriggerChildDataArray.value.shift(); | ||
| 408 | - lastRefConditionChildDataArray.value.shift(); | ||
| 409 | - lastRefActionChildDataArray.value.shift(); | ||
| 410 | const triggersObj = { | 433 | const triggersObj = { | 
| 411 | triggers: lastRefTriggerChildDataArray.value, | 434 | triggers: lastRefTriggerChildDataArray.value, | 
| 412 | }; | 435 | }; | 
| @@ -421,19 +444,38 @@ | @@ -421,19 +444,38 @@ | ||
| 421 | refTriggerChildDataFunc(); | 444 | refTriggerChildDataFunc(); | 
| 422 | refConditionChildDataFunc(); | 445 | refConditionChildDataFunc(); | 
| 423 | refActionChildDataFunc(); | 446 | refActionChildDataFunc(); | 
| 424 | - lastEditRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | ||
| 425 | - lastEditRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
| 426 | - lastEditRefActionChildDataArray.value.push(refActionChildData.value as never); | ||
| 427 | - lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
| 428 | - lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 447 | + pushEditArray.value.push(refTriggerChildData.value as never); | 
| 448 | + pushEditConditionArray.value.push(refConditionChildData.value as never); | ||
| 449 | + pushEditActionArray.value.push(refActionChildData.value as never); | ||
| 450 | + filterArrayTrigger.value = editTriggerPushData.value.filter( | ||
| 451 | + (f) => f?.triggerEvent !== '' | ||
| 452 | + ); | ||
| 453 | + filterArrayCondition.value = editTriggerPushData.value.filter((f) => f?.property !== ''); | ||
| 454 | + | ||
| 455 | + filterArrayAction.value = editTriggerPushData.value.filter((f) => f?.outTarget !== ''); | ||
| 456 | + | ||
| 457 | + pushEditArray.value.forEach((f) => { | ||
| 458 | + filterArrayTriggerObj.value = f; | ||
| 459 | + filterArrayTrigger.value.push(filterArrayTriggerObj.value as never); | ||
| 460 | + }); | ||
| 461 | + pushEditConditionArray.value.forEach((f) => { | ||
| 462 | + filterArrayConditionObj.value = f; | ||
| 463 | + filterArrayCondition.value.push(filterArrayConditionObj.value as never); | ||
| 464 | + }); | ||
| 465 | + | ||
| 466 | + pushEditActionArray.value.forEach((f) => { | ||
| 467 | + filterArrayActionObj.value = f; | ||
| 468 | + filterArrayAction.value.push(filterArrayActionObj.value as never); | ||
| 469 | + }); | ||
| 470 | + | ||
| 429 | const triggersObj = { | 471 | const triggersObj = { | 
| 430 | - triggers: lastEditRefTriggerChildDataArray.value, | 472 | + triggers: filterArrayTrigger.value, | 
| 431 | }; | 473 | }; | 
| 432 | const conditionsObj = { | 474 | const conditionsObj = { | 
| 433 | - doConditions: lastRefConditionChildDataArray.value, | 475 | + doConditions: filterArrayCondition.value, | 
| 434 | }; | 476 | }; | 
| 435 | const actionsObj = { | 477 | const actionsObj = { | 
| 436 | - doActions: lastRefActionChildDataArray.value, | 478 | + doActions: filterArrayAction.value, | 
| 437 | }; | 479 | }; | 
| 438 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 480 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 
| 439 | } | 481 | } | 
| @@ -461,6 +503,8 @@ | @@ -461,6 +503,8 @@ | ||
| 461 | emit('success'); | 503 | emit('success'); | 
| 462 | } | 504 | } | 
| 463 | }; | 505 | }; | 
| 506 | + | ||
| 507 | + //默认添加触发器 | ||
| 464 | const defaultAddTrigger = () => { | 508 | const defaultAddTrigger = () => { | 
| 465 | if (unref(addTriggerPushData).length == 0) { | 509 | if (unref(addTriggerPushData).length == 0) { | 
| 466 | setTimeout(() => { | 510 | setTimeout(() => { | 
| @@ -468,26 +512,27 @@ | @@ -468,26 +512,27 @@ | ||
| 468 | }, 10); | 512 | }, 10); | 
| 469 | } | 513 | } | 
| 470 | }; | 514 | }; | 
| 471 | - | ||
| 472 | //新增触发器 | 515 | //新增触发器 | 
| 473 | const addTrigger = () => { | 516 | const addTrigger = () => { | 
| 474 | if (!unref(isUpdate)) { | 517 | if (!unref(isUpdate)) { | 
| 475 | unref(addTriggerPushData).push(addTriggerData as never); | 518 | unref(addTriggerPushData).push(addTriggerData as never); | 
| 476 | refTriggerChildDataFunc(); | 519 | refTriggerChildDataFunc(); | 
| 477 | lastRefTriggerChildData.value = refTriggerChildData.value; | 520 | lastRefTriggerChildData.value = refTriggerChildData.value; | 
| 478 | - lastRefTriggerChildDataArray.value.push(lastRefTriggerChildData.value as never); | 521 | + filterNewTriggerArr.value.push(lastRefTriggerChildData.value as never); | 
| 522 | + lastRefTriggerChildDataArray.value = filterNewTriggerArr.value.filter( | ||
| 523 | + (v) => Object.keys(v).length !== 0 | ||
| 524 | + ); | ||
| 479 | } else { | 525 | } else { | 
| 480 | - unref(editTriggerPushData).push(addTriggerData as never); | ||
| 481 | refTriggerChildDataFunc(); | 526 | refTriggerChildDataFunc(); | 
| 482 | - lastRefTriggerChildData.value = refTriggerChildData.value; | ||
| 483 | - lastEditRefTriggerChildDataArray.value.push(lastRefTriggerChildData.value as never); | 527 | + pushEditArray.value.push(refTriggerChildData.value); | 
| 528 | + unref(editTriggerPushData).push(editTriggerData as never); | ||
| 484 | } | 529 | } | 
| 485 | }; | 530 | }; | 
| 486 | const removeTrigger = () => { | 531 | const removeTrigger = () => { | 
| 487 | if (!unref(isUpdate)) { | 532 | if (!unref(isUpdate)) { | 
| 488 | try { | 533 | try { | 
| 489 | unref(addTriggerPushData).splice(0, 1); | 534 | unref(addTriggerPushData).splice(0, 1); | 
| 490 | - lastRefTriggerChildDataArray.value.splice(0, 1); | 535 | + lastRefTriggerChildDataArray.value.pop(); | 
| 491 | } catch (e) { | 536 | } catch (e) { | 
| 492 | return e; | 537 | return e; | 
| 493 | } | 538 | } | 
| @@ -501,30 +546,33 @@ | @@ -501,30 +546,33 @@ | ||
| 501 | } | 546 | } | 
| 502 | }; | 547 | }; | 
| 503 | 548 | ||
| 549 | + //默认添加执行条件 | ||
| 550 | + const defaultAddCondition = () => { | ||
| 551 | + if (unref(addConditionPushData).length == 0) { | ||
| 552 | + addCondition(); | ||
| 553 | + } | ||
| 554 | + }; | ||
| 504 | //新增执行条件 | 555 | //新增执行条件 | 
| 505 | const addCondition = () => { | 556 | const addCondition = () => { | 
| 506 | if (!unref(isUpdate)) { | 557 | if (!unref(isUpdate)) { | 
| 507 | unref(addConditionPushData).push(addConditionData as never); | 558 | unref(addConditionPushData).push(addConditionData as never); | 
| 508 | refConditionChildDataFunc(); | 559 | refConditionChildDataFunc(); | 
| 509 | lastRefConditionChildData.value = refConditionChildData.value; | 560 | lastRefConditionChildData.value = refConditionChildData.value; | 
| 510 | - lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | 561 | + filterNewConditionArr.value.push(lastRefConditionChildData.value as never); | 
| 562 | + lastRefConditionChildDataArray.value = filterNewConditionArr.value.filter( | ||
| 563 | + (v) => Object.keys(v).length !== 0 | ||
| 564 | + ); | ||
| 511 | } else { | 565 | } else { | 
| 512 | - unref(editConditionPushData).push(addConditionData as never); | ||
| 513 | - console.log(unref(editConditionPushData)); | ||
| 514 | refConditionChildDataFunc(); | 566 | refConditionChildDataFunc(); | 
| 515 | - lastRefConditionChildData.value = refConditionChildData.value; | ||
| 516 | - lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | 567 | + pushEditConditionArray.value.push(refConditionChildData.value); | 
| 568 | + unref(editConditionPushData).push(editConditionData as never); | ||
| 517 | } | 569 | } | 
| 518 | - // unref(addConditionPushData).push(addConditionData as never); | ||
| 519 | - // refConditionChildDataFunc(); | ||
| 520 | - // lastRefConditionChildData.value = refConditionChildData.value; | ||
| 521 | - // lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | ||
| 522 | }; | 570 | }; | 
| 523 | const removeCondition = () => { | 571 | const removeCondition = () => { | 
| 524 | if (!unref(isUpdate)) { | 572 | if (!unref(isUpdate)) { | 
| 525 | try { | 573 | try { | 
| 526 | unref(addConditionPushData).splice(0, 1); | 574 | unref(addConditionPushData).splice(0, 1); | 
| 527 | - lastRefConditionChildDataArray.value.splice(0, 1); | 575 | + lastRefConditionChildDataArray.value.pop(); | 
| 528 | } catch (e) { | 576 | } catch (e) { | 
| 529 | return e; | 577 | return e; | 
| 530 | } | 578 | } | 
| @@ -538,40 +586,33 @@ | @@ -538,40 +586,33 @@ | ||
| 538 | } | 586 | } | 
| 539 | }; | 587 | }; | 
| 540 | 588 | ||
| 541 | - //新增执行动作 | 589 | + //默认新增执行动作 | 
| 542 | const defaultAddAction = () => { | 590 | const defaultAddAction = () => { | 
| 543 | if (unref(addActionPushData).length == 0) { | 591 | if (unref(addActionPushData).length == 0) { | 
| 544 | addAction(); | 592 | addAction(); | 
| 545 | } | 593 | } | 
| 546 | }; | 594 | }; | 
| 547 | - | ||
| 548 | - const defaultAddCondition = () => { | ||
| 549 | - if (unref(addConditionPushData).length == 0) { | ||
| 550 | - addCondition(); | ||
| 551 | - } | ||
| 552 | - }; | 595 | + //新增执行动作 | 
| 553 | const addAction = () => { | 596 | const addAction = () => { | 
| 554 | if (!unref(isUpdate)) { | 597 | if (!unref(isUpdate)) { | 
| 555 | unref(addActionPushData).push(addActionData as never); | 598 | unref(addActionPushData).push(addActionData as never); | 
| 556 | refActionChildDataFunc(); | 599 | refActionChildDataFunc(); | 
| 557 | lastRefActionChildData.value = refActionChildData.value; | 600 | lastRefActionChildData.value = refActionChildData.value; | 
| 558 | - lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | 601 | + filterNewActionArr.value.push(lastRefActionChildData.value as never); | 
| 602 | + lastRefActionChildDataArray.value = filterNewActionArr.value.filter( | ||
| 603 | + (v) => Object.keys(v).length !== 0 | ||
| 604 | + ); | ||
| 559 | } else { | 605 | } else { | 
| 560 | - unref(editActionPushData).push(addActionData as never); | ||
| 561 | refActionChildDataFunc(); | 606 | refActionChildDataFunc(); | 
| 562 | - lastRefActionChildData.value = refActionChildData.value; | ||
| 563 | - lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | 607 | + pushEditActionArray.value.push(refActionChildData.value); | 
| 608 | + unref(editActionPushData).push(editActionData as never); | ||
| 564 | } | 609 | } | 
| 565 | - // unref(addActionPushData).push(addActionData as never); | ||
| 566 | - // refActionChildDataFunc(); | ||
| 567 | - // lastRefActionChildData.value = refActionChildData.value; | ||
| 568 | - // lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | ||
| 569 | }; | 610 | }; | 
| 570 | const removeAction = () => { | 611 | const removeAction = () => { | 
| 571 | if (!unref(isUpdate)) { | 612 | if (!unref(isUpdate)) { | 
| 572 | try { | 613 | try { | 
| 573 | unref(addActionPushData).splice(0, 1); | 614 | unref(addActionPushData).splice(0, 1); | 
| 574 | - lastRefActionChildDataArray.value.splice(0, 1); | 615 | + lastRefActionChildDataArray.value.pop(); | 
| 575 | } catch (e) { | 616 | } catch (e) { | 
| 576 | return e; | 617 | return e; | 
| 577 | } | 618 | } |