From 716df458913f6ef84a0051423cbf411ee6dfc7ad Mon Sep 17 00:00:00 2001
From: 100011797 <2642441182@qq.com>
Date: Tue, 28 Mar 2023 15:06:19 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=BA=E6=99=AF=E8=81=94=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/NormalUpload/index.vue | 21 +++++++-------
src/views/device/Instance/Import/index.vue | 5 +++-
src/views/device/Instance/Save/index.vue | 2 ++
.../device/components/Metadata/Cat/index.vue | 15 ++++++----
.../Scene/Save/action/Delay/index.vue | 28 +++++++++++--------
.../Save/action/Device/device/Device.vue | 3 +-
.../Scene/Save/action/Device/device/Tag.vue | 16 +++++------
.../Scene/Save/action/ListItem/Item.vue | 8 +++---
.../action/Notify/VariableDefinitions.vue | 15 ++++++++--
.../action/Notify/variableItem/BuildIn.vue | 19 ++++++++-----
10 files changed, 80 insertions(+), 52 deletions(-)
diff --git a/src/components/NormalUpload/index.vue b/src/components/NormalUpload/index.vue
index 15c365c5..296164f1 100644
--- a/src/components/NormalUpload/index.vue
+++ b/src/components/NormalUpload/index.vue
@@ -1,6 +1,6 @@
-
-
+
-
+
文件上传
-
-
+
+
-
+
-
-
+
+
总数量:{{ count }}
{{ errMessage }}
diff --git a/src/views/device/Instance/Import/index.vue b/src/views/device/Instance/Import/index.vue
index 258eb4d8..076cbcf0 100644
--- a/src/views/device/Instance/Import/index.vue
+++ b/src/views/device/Instance/Import/index.vue
@@ -4,7 +4,6 @@
width="800px"
:visible="true"
title="导入"
- @ok="handleSave"
@cancel="handleCancel"
>
@@ -44,6 +43,9 @@
+
+ 关闭
+
@@ -100,6 +102,7 @@ const handleCancel = () => {
};
const handleSave = () => {
+ emit('close');
emit('save');
};
\ No newline at end of file
diff --git a/src/views/device/Instance/Save/index.vue b/src/views/device/Instance/Save/index.vue
index 21b63b15..17ac2138 100644
--- a/src/views/device/Instance/Save/index.vue
+++ b/src/views/device/Instance/Save/index.vue
@@ -193,6 +193,8 @@ watch(
}
});
Object.assign(modelRef, newValue);
+ // description 和 describe 处理
+ modelRef.describe = newValue?.describe || newValue?.description
},
{ immediate: true, deep: true },
);
diff --git a/src/views/device/components/Metadata/Cat/index.vue b/src/views/device/components/Metadata/Cat/index.vue
index 9ff7c0bd..8dcdda33 100644
--- a/src/views/device/components/Metadata/Cat/index.vue
+++ b/src/views/device/components/Metadata/Cat/index.vue
@@ -117,11 +117,16 @@ const routeChange = async (id: string) => {
});
}
}
-watch(
- () => route.params.id,
- (id) => routeChange(id as string),
- { immediate: true }
-)
+
+// watch(
+// () => route.params.id,
+// (id) => routeChange(id as string),
+// { immediate: true }
+// )
+
+onMounted(() => {
+ routeChange(route.params.id as string)
+})
watch(
() => [props.visible, props.type],
diff --git a/src/views/rule-engine/Scene/Save/action/Delay/index.vue b/src/views/rule-engine/Scene/Save/action/Delay/index.vue
index 6a79672e..cf1a8d28 100644
--- a/src/views/rule-engine/Scene/Save/action/Delay/index.vue
+++ b/src/views/rule-engine/Scene/Save/action/Delay/index.vue
@@ -12,7 +12,7 @@
placeholder="请输入时间"
v-model:value="_value"
:precision="3"
- :min="0"
+ :min="0.001"
:max="65535"
>
@@ -60,8 +60,8 @@ const unit = ref<'seconds' | 'minutes' | 'hours'>(
watch(
() => props.value,
(newVal) => {
- _value.value = newVal?.time || 0
- unit.value = newVal?.unit || 'seconds'
+ _value.value = newVal?.time || 0;
+ unit.value = newVal?.unit || 'seconds';
},
{
immediate: true,
@@ -73,17 +73,21 @@ const onCancel = () => {
emit('cancel');
};
const onOk = () => {
- if (unref(_value) || unref(_value) === 0) {
+ if (unref(_value)) {
+ emit(
+ 'save',
+ {
+ time: _value.value,
+ unit: unit.value,
+ },
+ {
+ name: `${_value.value} ${
+ timeUnitEnum[unit.value]
+ }后,执行后续动作`,
+ },
+ );
} else {
onlyMessage('请输入时间', 'error');
}
- emit(
- 'save',
- {
- time: _value.value,
- unit: unit.value,
- },
- { name: `${_value.value} ${timeUnitEnum[unit.value]}后,执行后续动作` },
- );
};
\ No newline at end of file
diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
index eeb7c287..b98f67dd 100644
--- a/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
+++ b/src/views/rule-engine/Scene/Save/action/Device/device/Device.vue
@@ -172,9 +172,8 @@ const handleClick = (_detail: any) => {
};
watch(() => props.value?.[0]?.value, (newVal) => {
- console.log(newVal, '123')
if(newVal){
- detail(newVal[0]?.value).then(resp => {
+ detail(newVal).then(resp => {
emit('change', resp.result);
})
}
diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue
index e1d4f346..5835f980 100644
--- a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue
+++ b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue
@@ -99,7 +99,7 @@ const handleItem = (data: any) => {
valueType: data.valueType ? data.valueType.type : '-',
format: data.valueType ? data.valueType.format : undefined,
options: data.valueType ? data.valueType.elements : undefined,
- value: data.value,
+ value: data?.value,
};
};
@@ -135,9 +135,9 @@ watch(
options.value = newTag.map((item: any) => {
return { label: item.name, value: item.id, ...item };
});
- if (newVal && newVal[0] && newVal[0].name && newTag && newTag.length) {
+ if (newVal && newVal[0] && newVal[0]?.name && newTag && newTag.length) {
const names: string[] = [];
- const newTagList = newVal[0].value
+ const newTagList = newVal[0]?.value
.filter((valueItem: any) => {
return newTag.some(
(item: any) => valueItem.column === item.id,
@@ -151,8 +151,8 @@ watch(
names.push(oldItem.name);
return {
...handleItem(oldItem),
- value: valueItem.value,
- type: valueItem.type,
+ value: valueItem?.value,
+ type: valueItem?.type,
};
}
return valueItem;
@@ -169,12 +169,12 @@ watch(
);
const onValueChange = () => {
- const _data = tagList.value.filter((item) => !!item.value);
+ const _data = tagList.value.filter((item) => !!item?.value);
const newValue = _data.map((item: any) => {
return {
column: item.id,
- type: item.type,
- value: item.value,
+ type: item?.type,
+ value: item?.value,
};
});
emits('update:value', [{ value: newValue, name: '标签' }]);
diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue
index 1ad6e6a0..5f927c13 100644
--- a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue
+++ b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue
@@ -77,10 +77,10 @@
钉钉
向{{
- options?.orgName || ''
+ options?.sendTo || ''
}}
{{
- options?.sendTo || ''
+ options?.orgName || ''
}}
发送
@@ -107,10 +107,10 @@
微信
向{{
- options?.orgName || ''
+ options?.sendTo || ''
}}
{{
- options?.sendTo || ''
+ options?.orgName || ''
}}
{{
options?.tagName || ''
diff --git a/src/views/rule-engine/Scene/Save/action/Notify/VariableDefinitions.vue b/src/views/rule-engine/Scene/Save/action/Notify/VariableDefinitions.vue
index 12a7b6d8..975bbae1 100644
--- a/src/views/rule-engine/Scene/Save/action/Notify/VariableDefinitions.vue
+++ b/src/views/rule-engine/Scene/Save/action/Notify/VariableDefinitions.vue
@@ -44,7 +44,12 @@
v-else-if="getType(item) === 'link'"
v-model:value="modelRef[item.id]"
/>
-
+ onChange(val, 'build-in')"
+ />
@@ -79,7 +84,6 @@ const formRef = ref();
const modelRef = reactive({});
watchEffect(() => {
- console.log(props?.value)
Object.assign(modelRef, props?.value);
});
@@ -88,6 +92,9 @@ const getType = (item: any) => {
};
const checkValue = (_rule: any, value: any, item: any) => {
+ if(!value){
+ return Promise.resolve();
+ }
const type = item.expands?.businessType || item?.type;
if (type === 'file') {
return Promise.resolve();
@@ -153,7 +160,7 @@ const checkValue = (_rule: any, value: any, item: any) => {
if (
props.notify.notifyType &&
['sms', 'voice'].includes(props?.notify?.notifyType) &&
- value?.source !== 'relation'
+ value?.source !== 'relation' && value?.value
) {
const reg = /^[1][3-9]\d{9}$/;
if (!reg.test(value?.value)) {
@@ -173,6 +180,8 @@ const onChange = (val: any, type: any) => {
emit('change', { tagName: val });
} else if (type === 'user') {
emit('change', { sendTo: val });
+ } else if (type === 'build-in') {
+ // emit('change', { sendTo: val });
}
};
diff --git a/src/views/rule-engine/Scene/Save/action/Notify/variableItem/BuildIn.vue b/src/views/rule-engine/Scene/Save/action/Notify/variableItem/BuildIn.vue
index 107679fa..019698f7 100644
--- a/src/views/rule-engine/Scene/Save/action/Notify/variableItem/BuildIn.vue
+++ b/src/views/rule-engine/Scene/Save/action/Notify/variableItem/BuildIn.vue
@@ -16,12 +16,14 @@
placeholder="请选择参数"
style="width: calc(100% - 120px)"
:fieldNames="{ label: 'name', value: 'id' }"
- @change="(val) => itemOnChange(undefined, val)"
+ @change="(val, label) => itemOnChange(undefined, val, label)"
>
{{ fullName }}
- {{ description }}
+ {{
+ description
+ }}
@@ -84,7 +86,7 @@ const props = defineProps({
},
});
-const emit = defineEmits(['update:value']);
+const emit = defineEmits(['update:value', 'change']);
const source = computed(() => {
return props.value?.source || 'fixed';
@@ -97,15 +99,18 @@ const sourceChange = (val: any) => {
emit('update:value', {
...props.value,
source: val,
- value: undefined
+ value: undefined,
});
};
-const itemOnChange = (val: any, _upperKey?: string) => {
+const itemOnChange = (val: any, _upperKey?: string, label?: any) => {
emit('update:value', {
...props.value,
value: val,
- upperKey: _upperKey
+ upperKey: _upperKey,
+ });
+ emit('change', {
+ sendTo: label?.[0] || val,
});
};
@@ -164,7 +169,7 @@ watch(
watch(
() => props.value.upperKey,
(newVal) => {
- upperKey.value = newVal
+ upperKey.value = newVal;
},
{ immediate: true },
);