From c3195997a0b88ca50edb0e760c15ff4fddeda959 Mon Sep 17 00:00:00 2001 From: qiaochuLei <124648559+qiaochuLei@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:52:05 +0800 Subject: [PATCH] =?UTF-8?q?*=20fix:=20=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修改导入图标 --- .../Collector/Point/Save/DeathArea.vue | 2 +- .../Collector/Point/Save/SaveS7.vue | 101 ++++++++++-------- .../Point/components/Import/index.vue | 12 +-- 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/src/views/DataCollect/Collector/Point/Save/DeathArea.vue b/src/views/DataCollect/Collector/Point/Save/DeathArea.vue index 05f94ec9..80e2394f 100644 --- a/src/views/DataCollect/Collector/Point/Save/DeathArea.vue +++ b/src/views/DataCollect/Collector/Point/Save/DeathArea.vue @@ -60,7 +60,7 @@ const formItemContext = Form.useInjectFormItemContext() const props = defineProps({ value: { type: Array, - default: () => [{}] + default: () => [] } }) diff --git a/src/views/DataCollect/Collector/Point/Save/SaveS7.vue b/src/views/DataCollect/Collector/Point/Save/SaveS7.vue index e752a2b4..c64080f3 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveS7.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveS7.vue @@ -46,11 +46,12 @@ placeholder="请输入字符串长度" :precision="0" :controls="false" :maxlength="64" :disabled="disabled" /> - + @@ -116,6 +117,9 @@ 只推送变化的数据 + + + @@ -127,6 +131,7 @@ + 取消 ({ type: undefined, interval: 3000, areaNumber: undefined, - bytes:undefined, + bytes: undefined, terms: [] }, accessModes: [], @@ -268,19 +273,19 @@ const handleCancelInterval = () => { const handleOk = async () => { - const res:any = await formRef.value?.validate(); - + const res: any = await formRef.value?.validate(); + const params = { ...res, - configuration:{ + configuration: { ...res.configuration, - bytes:res.configuration.bytes || form.value.configuration.bytes + bytes: res.configuration.bytes || form.value.configuration.bytes }, inheritBreaker: true, pointKey: props.data.pointKey || randomString(9), - provider:props.data.provider, - collectorId:props.data.collectorId, - accessModes:res?.accessModes.filter((item:any)=>item) + provider: props.data.provider, + collectorId: props.data.collectorId, + accessModes: res?.accessModes.filter((item: any) => item) } loading.value = true; const response = !props.data.id @@ -296,13 +301,15 @@ const handleCancel = () => { const Area = (_: any, value: any): Promise => new Promise(async (resolve, reject) => { - console.log('value',value) - if(value.length === 0){ + if (!value) { return resolve('') - }else if(value.length === 1){ + } + if (value?.length === 0) { + return resolve('') + } else if (value?.length === 1) { return value[0].value && value[0].termType ? resolve('') : reject('请配置点位死区'); - }else{ - if(value[0].column === 'currentValue'){ + } else { + if (value?.[0].column === 'currentValue') { // value.forEach((item:any) => { // if(item.termType && item.value){ // return resolve('') @@ -310,52 +317,54 @@ const Area = (_: any, value: any): Promise => // return reject('请配置点位死区') // } // }); - const pass = value.every((item:any)=>item.termType && item.value) - return pass ? resolve(''):reject('请配置点位死区') - }else{ - value.forEach((item:any) => { - if(item.column ===`this['currentValue'] - this['lastValue']*init/100`){ + const pass = value.every((item: any) => item.termType && item.value) + return pass ? resolve('') : reject('请配置点位死区') + } else { + value.forEach((item: any) => { + if (item.column === `this['currentValue'] - this['lastValue']*init/100`) { return reject('请配置点位死区') - }else{ + } else { return resolve('') } }); } + } }); onMounted(() => { - form.value.features = props.data.features?.map((item:any)=>item.value) + form.value.features = props.data.features?.map((item: any) => item.value) form.value.configuration.bytes = props.data.configuration?.bytes - if(props.data.accessModes?.length!==0){ - form.value.accessModes = props.data.accessModes?.map((item:any)=>item.value) + if (props.data.accessModes?.length !== 0) { + form.value.accessModes = props.data.accessModes?.map((item: any) => item.value) } + console.log(props.data.configuration, 123) }) watch( - () => dataTypesList.value, - (val: any[]) => { - if (val) { - const result: any = dataTypesList.value.find( - (item: any) => item.id == form.value.configuration.type, - ); - if(result) { - // console.log('result',result) - disabled.value = (result && result.length !== 0); - } - } - }, + () => dataTypesList.value, + (val: any[]) => { + if (val) { + const result: any = dataTypesList.value.find( + (item: any) => item.id == form.value.configuration.type, + ); + if (result) { + // console.log('result',result) + disabled.value = (result && result.length !== 0); + } + } + }, ); watch( - () => form.value.configuration.type, - (val) => { - if (val !== 'Bool') { - form.value.configuration.bits = 0; - } - }, - { deep: true }, + () => form.value.configuration.type, + (val) => { + if (val !== 'Bool') { + form.value.configuration.bits = 0; + } + }, + { deep: true }, ); diff --git a/src/views/DataCollect/Collector/Point/components/Import/index.vue b/src/views/DataCollect/Collector/Point/components/Import/index.vue index 04525486..ee71e70d 100644 --- a/src/views/DataCollect/Collector/Point/components/Import/index.vue +++ b/src/views/DataCollect/Collector/Point/components/Import/index.vue @@ -18,16 +18,16 @@ - + 正在导入 - 导入成功 总数量 + 导入成功 总数量 {{ successNumber }} - 导入失败 总数量 + 导入失败 总数量 {{ failNumber }} @@ -44,12 +44,6 @@
- 导入成功 总数量 + 导入成功 总数量 {{ successNumber }}