fix: 数采设备-数采映射设备禁用时传默认状态disabled
This commit is contained in:
parent
4d61e884d7
commit
0ced59c084
|
@ -224,6 +224,7 @@ const handleClick = async () => {
|
|||
provider: treeList.value.find(
|
||||
(it: any) => it.id === item.parentId,
|
||||
).provider,
|
||||
state: _props.deviceData.state.value === 'notActive' ? 'disabled' : null,
|
||||
}));
|
||||
params.push(...array);
|
||||
});
|
||||
|
|
|
@ -220,6 +220,7 @@ const handleClick = async () => {
|
|||
provider: treeList.value.find(
|
||||
(it: any) => it.id === item.parentId,
|
||||
)?.provider,
|
||||
state: instanceStore.current.state.value === 'notActive' ? 'disabled' : null,
|
||||
}));
|
||||
params.push(...array);
|
||||
});
|
||||
|
|
|
@ -374,7 +374,12 @@ const onSave = () => {
|
|||
formRef.value
|
||||
.validate()
|
||||
.then(async (_data: any) => {
|
||||
const arr = toRaw(data.value).filter((i: any) => i.channelId);
|
||||
const arr = toRaw(data.value).filter((i: any) => i.channelId).map(item => {
|
||||
if (instanceStore.current.state?.value === 'notActive') {
|
||||
item.state = 'disabled'
|
||||
}
|
||||
return item
|
||||
});
|
||||
if (arr && arr.length !== 0) {
|
||||
const submitData = {
|
||||
deviceId: instanceStore.current.id,
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
<script lang="ts" setup>
|
||||
import { treeMapping, saveMapping } from '@/api/device/instance';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
import { useInstanceStore } from "store/instance";
|
||||
|
||||
const _props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
|
@ -73,6 +75,7 @@ const _props = defineProps({
|
|||
});
|
||||
const _emits = defineEmits(['close', 'save']);
|
||||
|
||||
const instanceStore = useInstanceStore();
|
||||
const checkedKeys = ref<string[]>([]);
|
||||
|
||||
const leftList = ref<any[]>([]);
|
||||
|
@ -142,7 +145,7 @@ const handleClick = async () => {
|
|||
onlyMessage('请选择采集器', 'warning');
|
||||
} else {
|
||||
const params: any[] = [];
|
||||
rightList.value.map((item: any) => {
|
||||
rightList.value.forEach((item: any) => {
|
||||
const array = (item.children || []).map((element: any) => ({
|
||||
channelId: item.parentId,
|
||||
collectorId: element.collectorId,
|
||||
|
@ -152,10 +155,10 @@ const handleClick = async () => {
|
|||
(i: any) => i.name === element.name,
|
||||
)?.metadataId,
|
||||
provider: item.provider,
|
||||
state: instanceStore.current.state.value == 'notActive' ? 'disabled': null,
|
||||
}));
|
||||
params.push(...array);
|
||||
});
|
||||
|
||||
const filterParms = params.filter((item) => !!item.metadataId);
|
||||
if (filterParms && filterParms.length !== 0) {
|
||||
const res = await saveMapping(
|
||||
|
|
Loading…
Reference in New Issue