Browse Source

fix:修改树查询问题 修改接口

temp
zhaohy 3 months ago
parent
commit
49a5168454
  1. 2
      hx-ai-intelligent/src/api/ventilatingSystem.ts
  2. 8
      hx-ai-intelligent/src/view/equipmentControl/planToAdd/index.vue
  3. 4
      lib/component/table/table.vue
  4. 25
      lib/component/tree/tree-api.vue

2
hx-ai-intelligent/src/api/ventilatingSystem.ts

@ -3,7 +3,7 @@ const prefix = '/carbon-smart/api';
// 通风系统相关接口
export enum ventilating {
//传感器获取数据
getSensorData = prefix + '/multiFuncSensorCtrl/getDeviceState',
getSensorData = prefix + '/sensorCtrl/getMultiFuncSensorState',
// 排风扇相关 =============================================
// 获得排风扇系统的树形结构
getTree1 = prefix + '/ventilatingFanCtrl/getCtrlPanelTree',

8
hx-ai-intelligent/src/view/equipmentControl/planToAdd/index.vue

@ -107,6 +107,8 @@
children: 'childList',
},
formConfig: {
callList: true, //
defaultSelection: true, //
schemas: [
{
field: 'ctrlType',
@ -220,9 +222,9 @@
rowKey: 'uuid',
};
//
setTimeout(() => {
mainRef.value?.nsTableRef.reload();
}, 1);
// setTimeout(() => {
// mainRef.value?.nsTableRef.reload();
// }, 1);
};
//

4
lib/component/table/table.vue

@ -17,7 +17,7 @@
<!-- todo drag -->
<div class="ns-part-tree" v-if="!isEmpty(treeConfig)">
<ns-tree-api v-bind="getTreeBindValue" @select="treeSelect" />
<ns-tree-api v-bind="getTreeBindValue" @reload="reload" @select="treeSelect" />
</div>
<div class="ns-part-table">
<a-spin :spinning="tableState.loading">
@ -357,7 +357,6 @@ import { object } from 'vue-types';
}
const tableChangeEvent = (pagination: Props, filters: [], sorter: any) => {
if (sorter?.field) {
if (sorter.order) {
orderRef.value = {
@ -486,7 +485,6 @@ import { object } from 'vue-types';
pageParams = {};
// [props.paramsPageField]: defaultPageRef.value, // 0
// [props.paramsPageSizeField]:999,
} else {
pageParams = {
[props.paramsPageField]: defaultPageRef.value, // 0

25
lib/component/tree/tree-api.vue

@ -35,7 +35,7 @@
defineOptions({
name: 'NsTreeApi',
});
const emit = defineEmits(['update:treeData', 'select']);
const emit = defineEmits(['update:treeData', 'select', 'reload']);
// const model = defineModel('treeData');
const formElRef = ref();
@ -73,6 +73,15 @@
const formFinish = debounce((data: object) => {
// selectedKeys.value = [];
getData(data);
// formConfig.value.schemas.forEach((item: any) => {
// if (item.callList) {
// emit('reload');
// }
// });
//
if (formConfig.value.callList && !formConfig.value.defaultSelection) {
emit('reload');
}
}, 200);
const handleSelect = (keys: any, selectedRows: any) => {
@ -109,6 +118,20 @@
})
.then((res) => {
treeData.value = transform(get(res, resultField));
//
selectedKeys.value = [];
if (formConfig.value.callList && formConfig.value.defaultSelection) {
handleSelect([treeData.value[0].id], {
selected: true,
event: 'select',
selectedNodes: treeData.value,
node: {
...treeData.value[0],
dataRef: { ...treeData.value[0] },
},
});
//
}
emit('update:treeData', treeData.value);
// model.value = treeData.value;
})

Loading…
Cancel
Save