fix: bug#11210
This commit is contained in:
parent
19706fec7b
commit
035d311e07
|
@ -595,4 +595,4 @@ export const saveDeviceVirtualProperty = (productId: string, deviceId: string, d
|
|||
|
||||
export const queryDeviceVirtualProperty = (productId: string, deviceId: string, propertyId: string) => server.get(`/virtual/property/product/${productId}/${deviceId}/${propertyId}`)
|
||||
|
||||
|
||||
export const queryByParent = (deviceId: string) => server.get(`/device/gateway/${deviceId}/parent`)
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
terms: [
|
||||
{
|
||||
column: 'id$not',
|
||||
value: detail.id,
|
||||
value: parentIds.join(','),
|
||||
type: 'and',
|
||||
},
|
||||
],
|
||||
|
@ -87,13 +87,20 @@
|
|||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { query, bindDevice } from '@/api/device/instance';
|
||||
<script setup lang="ts" name="BindChildDevice">
|
||||
import { query, queryByParent, bindDevice } from '@/api/device/instance';
|
||||
import moment from 'moment';
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
|
||||
const props = defineProps({
|
||||
parentIds: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
const instanceStore = useInstanceStore();
|
||||
const { detail } = storeToRefs(instanceStore);
|
||||
|
||||
|
@ -194,6 +201,7 @@ const handleOk = () => {
|
|||
const handleCancel = () => {
|
||||
emit('change', false);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
|
|
|
@ -105,14 +105,14 @@
|
|||
</j-space>
|
||||
</template>
|
||||
</JProTable>
|
||||
<BindChildDevice v-if="visible" @change="closeBindDevice" />
|
||||
<BindChildDevice v-if="visible" :parentIds="parentIds" @change="closeBindDevice" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import moment from 'moment';
|
||||
import type { ActionsType } from '@/components/Table';
|
||||
import { query, unbindDevice, unbindBatchDevice } from '@/api/device/instance';
|
||||
import {query, unbindDevice, unbindBatchDevice, queryByParent} from '@/api/device/instance';
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import BindChildDevice from './BindChildDevice/index.vue';
|
||||
|
@ -138,6 +138,7 @@ const params = ref<Record<string, any>>({});
|
|||
const _selectedRowKeys = ref<string[]>([]);
|
||||
const visible = ref<boolean>(false);
|
||||
const _current = ref({});
|
||||
const parentIds = ref<any[]>([instanceStore.detail.id])
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -296,6 +297,13 @@ const closeBindDevice = (val: boolean) => {
|
|||
}
|
||||
};
|
||||
|
||||
const getChildren = async () => {
|
||||
const { id} = instanceStore.detail
|
||||
const data = await queryByParent(id)
|
||||
if (data.success) {
|
||||
parentIds.value.concat(data.result)
|
||||
}
|
||||
}
|
||||
const closeChildSave = () => {
|
||||
childVisible.value = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue