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 { export enum ventilating {
//传感器获取数据 //传感器获取数据
getSensorData = prefix + '/multiFuncSensorCtrl/getDeviceState', getSensorData = prefix + '/sensorCtrl/getMultiFuncSensorState',
// 排风扇相关 ============================================= // 排风扇相关 =============================================
// 获得排风扇系统的树形结构 // 获得排风扇系统的树形结构
getTree1 = prefix + '/ventilatingFanCtrl/getCtrlPanelTree', getTree1 = prefix + '/ventilatingFanCtrl/getCtrlPanelTree',

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

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

10
lib/component/table/table.vue

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

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

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

Loading…
Cancel
Save