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