Merge branch 'dev' into dev-dictionary

This commit is contained in:
XieYongHong 2023-10-18 18:14:58 +08:00
commit 94069da4b1
1 changed files with 11 additions and 5 deletions

View File

@ -8,7 +8,7 @@
</j-space> </j-space>
</template> </template>
<j-form ref="formRef" :model="modelRef"> <j-form ref="formRef" :model="modelRef">
<j-table :dataSource="modelRef.dataSource" :columns="columns"> <j-table :columns="columns" :dataSource="modelRef.dataSource" @change="tableChange">
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.key === 'collectorId'"> <template v-if="column.key === 'collectorId'">
采集器 采集器
@ -20,7 +20,7 @@
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'channelId'"> <template v-if="column.dataIndex === 'channelId'">
<j-form-item <j-form-item
:name="['dataSource', index, 'channelId']" :name="['dataSource', myCurrent * 10 + index, 'channelId']"
> >
<j-select <j-select
style="width: 100%" style="width: 100%"
@ -36,7 +36,7 @@
</template> </template>
<template v-if="column.dataIndex === 'collectorId'"> <template v-if="column.dataIndex === 'collectorId'">
<j-form-item <j-form-item
:name="['dataSource', index, 'collectorId']" :name="['dataSource', myCurrent * 10 + index, 'collectorId']"
:rules="[ :rules="[
{ {
required: !!record.channelId, required: !!record.channelId,
@ -53,7 +53,7 @@
</template> </template>
<template v-if="column.dataIndex === 'pointId'"> <template v-if="column.dataIndex === 'pointId'">
<j-form-item <j-form-item
:name="['dataSource', index, 'pointId']" :name="['dataSource', myCurrent * 10 + index, 'pointId']"
:rules="[ :rules="[
{ {
required: !!record.channelId, required: !!record.channelId,
@ -157,6 +157,8 @@ const columns = [
}, },
]; ];
const myCurrent = ref(0)
const filterOption = (input: string, option: any) => { const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
}; };
@ -235,6 +237,10 @@ const handleSearch = async () => {
loading.value = false; loading.value = false;
}; };
const tableChange = (pagination: { current: number }) => {
myCurrent.value = pagination.current - 1
}
const unbind = async (id: string) => { const unbind = async (id: string) => {
if (id) { if (id) {
const resp = await removeMapping('device', instanceStore.current.id, [ const resp = await removeMapping('device', instanceStore.current.id, [
@ -286,4 +292,4 @@ const onSave = () => {
:deep(.ant-form-item) { :deep(.ant-form-item) {
margin: 0 !important; margin: 0 !important;
} }
</style> </style>