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. 10
      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);
};
//

10
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">
@ -204,7 +204,7 @@
import { useTableSession } from '/nerv-lib/component/table/use-table-session';
import { useTableColumn } from '/nerv-lib/component/table/use-table-column';
import { useNavigate } from '/nerv-lib/use/use-navigate';
import { object } from 'vue-types';
import { object } from 'vue-types';
export default defineComponent({
name: 'NsTable',
components: {
@ -357,7 +357,6 @@ import { object } from 'vue-types';
}
const tableChangeEvent = (pagination: Props, filters: [], sorter: any) => {
if (sorter?.field) {
if (sorter.order) {
orderRef.value = {
@ -482,12 +481,11 @@ import { object } from 'vue-types';
};
} else {
//dyfadd
if(props.tableTitle=='系统菜单'){
if (props.tableTitle == '系统菜单') {
pageParams = {};
// [props.paramsPageField]: defaultPageRef.value, // 0
// [props.paramsPageSizeField]:999,
}else{
} else {
pageParams = {
[props.paramsPageField]: defaultPageRef.value, // 0
[props.paramsPageSizeField]:

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