2025-11-06 11:17:05 +08:00
|
|
|
import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
|
2025-11-03 11:33:56 +08:00
|
|
|
import { request } from "@/utils/request";
|
|
|
|
|
import { Search } from "@element-plus/icons-vue";
|
2025-11-03 17:56:26 +08:00
|
|
|
import DetailDialog from "./detailDialog.vue";
|
|
|
|
|
import EditDialog from "./editDialog.vue";
|
|
|
|
|
import AddDialog from "./addDialog.vue";
|
2025-11-06 11:17:05 +08:00
|
|
|
import { useRoute } from 'vue-router'
|
2025-11-14 14:58:33 +08:00
|
|
|
import { formatDate } from '../../../../shared/utils'
|
2025-11-03 11:33:56 +08:00
|
|
|
|
|
|
|
|
const treeData = ref([]);
|
|
|
|
|
const treeProps = {
|
|
|
|
|
children: "children",
|
|
|
|
|
label: "name",
|
|
|
|
|
key: "id",
|
|
|
|
|
}
|
|
|
|
|
const filterText = ref(''); // 树节点过滤条件
|
|
|
|
|
const tableData = ref([]);
|
|
|
|
|
const qxmc = ref(''); // 区县名称
|
2025-11-14 14:58:33 +08:00
|
|
|
const selectedYHZData = ref(null); // 被选中的养护站数据
|
2025-11-03 11:33:56 +08:00
|
|
|
const yhzid = ref(''); // 养护站id
|
|
|
|
|
const filterData = reactive({
|
|
|
|
|
sbmc: '',
|
|
|
|
|
sbdl: '',
|
|
|
|
|
sblx: '',
|
|
|
|
|
sbzt: '',
|
|
|
|
|
}); // 表格过滤条件
|
|
|
|
|
const pagination = reactive({
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
total: 0,
|
|
|
|
|
pageSizes: [10, 20, 50],
|
|
|
|
|
layout: "prev, pager, next, jumper",
|
|
|
|
|
onChange: (page, pageSize) => {
|
|
|
|
|
pagination.current = page;
|
|
|
|
|
pagination.pageSize = pageSize;
|
2025-11-03 17:56:26 +08:00
|
|
|
getyhzsbList(qxmc.value, yhzid.value, filterData);
|
2025-11-03 11:33:56 +08:00
|
|
|
},
|
2025-11-03 17:56:26 +08:00
|
|
|
}); // 表格分页
|
|
|
|
|
const modelVisible = ref(false); // 弹窗显示状态
|
|
|
|
|
const model = reactive({
|
|
|
|
|
title: '',
|
|
|
|
|
content: null,
|
|
|
|
|
props: {},
|
|
|
|
|
onCancel: null,
|
|
|
|
|
onConfirm: null,
|
|
|
|
|
}); // 弹窗内容
|
|
|
|
|
const dialogType = ref(''); // 弹窗类型
|
|
|
|
|
const dialogRef = ref(null); // 弹窗实例
|
2025-11-14 14:58:33 +08:00
|
|
|
const detailDialogRef = ref(null); // 详情信息弹窗
|
2025-11-03 17:56:26 +08:00
|
|
|
|
|
|
|
|
const INIT_FORM = {
|
|
|
|
|
rid: "",
|
|
|
|
|
qxmc: "",
|
|
|
|
|
sbbh: "",
|
|
|
|
|
sbdl: "",
|
|
|
|
|
sbmc: "",
|
|
|
|
|
sblx: "",
|
|
|
|
|
sbxh: "",
|
|
|
|
|
sbwz: "",
|
|
|
|
|
jd: "",
|
|
|
|
|
wd: "",
|
|
|
|
|
glry: "",
|
|
|
|
|
glryid: "",
|
|
|
|
|
czy: "",
|
|
|
|
|
czyid: "",
|
|
|
|
|
gzrq: "",
|
|
|
|
|
gmfy: "",
|
2025-11-21 16:54:23 +08:00
|
|
|
sbzt: "完好",
|
2025-11-03 17:56:26 +08:00
|
|
|
sccj: "",
|
|
|
|
|
sfyjsb: "",
|
|
|
|
|
sfnrsjbz: "",
|
|
|
|
|
fsfw: "",
|
|
|
|
|
yhzid: "",
|
|
|
|
|
}; // 表单初始值
|
|
|
|
|
const form = reactive({ ...INIT_FORM }); // 表单
|
|
|
|
|
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
|
|
|
|
|
// 节点过滤函数
|
|
|
|
|
const filterNode = (value, node) => {
|
|
|
|
|
const keyword = (value || '').toLowerCase();
|
|
|
|
|
|
|
|
|
|
const nodeData = node || {}
|
|
|
|
|
|
2025-11-21 14:27:25 +08:00
|
|
|
if (nodeData.type === 'root') {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
// 处理区域节点匹配
|
|
|
|
|
if (nodeData.type === 'area') {
|
|
|
|
|
return (nodeData.rawName || '').toLowerCase().includes(keyword)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理站点节点匹配
|
|
|
|
|
if (nodeData.type === 'site') {
|
|
|
|
|
const parentData = node.parent?.data?.type === 'area' ? node.parent.data : {}
|
|
|
|
|
const parentMatch = (parentData.rawName || '').toLowerCase().includes(keyword)
|
|
|
|
|
return parentMatch || (nodeData.name || '').toLowerCase().includes(keyword)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// 获取养护站列表分组
|
|
|
|
|
const getTreeData = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await request({
|
2025-11-10 16:52:03 +08:00
|
|
|
url: '/snow-ops-platform/yhz/listAreaGroup?dataType=EQUIPMENT',
|
2025-11-03 11:33:56 +08:00
|
|
|
method: 'GET'
|
|
|
|
|
})
|
|
|
|
|
if (res.code === '00000') {
|
2025-11-21 14:27:25 +08:00
|
|
|
treeData.value = [{
|
|
|
|
|
id: -1,
|
|
|
|
|
name: `全部(${res.data.totalSbsl})`,
|
|
|
|
|
type: "root",
|
|
|
|
|
children: res.data.areaList.map((qx, index) => (
|
|
|
|
|
{
|
2025-11-21 14:55:58 +08:00
|
|
|
id: qx.qxmc,
|
2025-11-21 14:27:25 +08:00
|
|
|
name: `${qx.qxmc}(${qx.sbsl})`,
|
|
|
|
|
type: 'area',
|
|
|
|
|
children: qx.yhzList.map(site => ({
|
|
|
|
|
id: site.id,
|
|
|
|
|
name: `${site.mc}(${site.sbsl})`,
|
|
|
|
|
type: 'site',
|
|
|
|
|
qxmc: qx.qxmc,
|
|
|
|
|
rawName: site.mc,
|
|
|
|
|
jd: site.jd,
|
|
|
|
|
wd: site.wd,
|
|
|
|
|
sbwz: qx.qxmc
|
|
|
|
|
})),
|
|
|
|
|
rawName: qx.qxmc, // 原始名称
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
}]
|
|
|
|
|
// console.log('treeData', toRaw(treeData.value))
|
2025-11-03 11:33:56 +08:00
|
|
|
} else {
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 处理节点点击事件
|
2025-11-04 10:13:02 +08:00
|
|
|
const handleNodeClick = (data, node) => {
|
2025-11-06 11:17:05 +08:00
|
|
|
if (!data || !data.type) return;
|
2025-11-21 14:27:25 +08:00
|
|
|
if (data.type === 'root') {
|
|
|
|
|
console.log('你点击的是全部')
|
2025-11-04 10:13:02 +08:00
|
|
|
yhzid.value = ''; // 重置养护站id
|
|
|
|
|
qxmc.value = ''; // 重置区县名称
|
2025-11-14 14:58:33 +08:00
|
|
|
selectedYHZData.value = null;
|
2025-11-04 10:13:02 +08:00
|
|
|
return;
|
2025-11-21 14:27:25 +08:00
|
|
|
};
|
|
|
|
|
// if (data.type === 'area' && node.expanded === false) {
|
|
|
|
|
// console.log('树节点关闭', node.expanded)
|
|
|
|
|
// yhzid.value = ''; // 重置养护站id
|
|
|
|
|
// qxmc.value = ''; // 重置区县名称
|
|
|
|
|
// selectedYHZData.value = null;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2025-11-03 11:33:56 +08:00
|
|
|
if (data.type === 'area') {
|
2025-11-21 14:27:25 +08:00
|
|
|
console.log('你点击的是区县', data.rawName)
|
2025-11-03 11:33:56 +08:00
|
|
|
yhzid.value = ''; // 重置养护站id
|
2025-11-21 14:27:25 +08:00
|
|
|
qxmc.value = data.rawName; // 保存区县名称
|
2025-11-14 14:58:33 +08:00
|
|
|
selectedYHZData.value = null
|
2025-11-21 14:27:25 +08:00
|
|
|
return;
|
2025-11-03 11:33:56 +08:00
|
|
|
}
|
|
|
|
|
if (data.type === 'site') {
|
|
|
|
|
console.log('你点击的是站点', data.name)
|
|
|
|
|
yhzid.value = data.id; // 保存养护站id
|
|
|
|
|
qxmc.value = ''; // 重置区县名称
|
2025-11-14 14:58:33 +08:00
|
|
|
selectedYHZData.value = data
|
2025-11-21 14:27:25 +08:00
|
|
|
return;
|
2025-11-03 11:33:56 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取养护站设备列表
|
|
|
|
|
const getyhzsbList = async (qxmc, yhzid, filterData) => {
|
|
|
|
|
try {
|
|
|
|
|
const data = {
|
|
|
|
|
qxmc: qxmc,
|
|
|
|
|
yhzid: yhzid,
|
|
|
|
|
sbmc: filterData?.sbmc || '',
|
|
|
|
|
sbdl: filterData?.sbdl || '',
|
|
|
|
|
sblx: filterData?.sblx || '',
|
|
|
|
|
sbzt: filterData?.sbzt || '',
|
|
|
|
|
pageNum: pagination.current,
|
|
|
|
|
pageSize: pagination.pageSize,
|
|
|
|
|
}
|
|
|
|
|
const res = await request({
|
2025-11-05 15:10:15 +08:00
|
|
|
url: '/snow-ops-platform/yjsb/list',
|
2025-11-03 11:33:56 +08:00
|
|
|
method: 'GET',
|
|
|
|
|
params: data,
|
|
|
|
|
})
|
|
|
|
|
if (res.code === '00000') {
|
|
|
|
|
tableData.value = res.data.records;
|
2025-11-12 11:39:38 +08:00
|
|
|
pagination.total = Number(res.data.total);
|
2025-11-03 11:33:56 +08:00
|
|
|
} else {
|
|
|
|
|
tableData.value = [];
|
|
|
|
|
pagination.total = 0;
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
prop: 'sbzt',
|
|
|
|
|
label: '设备状态',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sbmc',
|
|
|
|
|
label: '设备名称',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sbbh',
|
|
|
|
|
label: '设备编号',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sbxh',
|
|
|
|
|
label: '设备型号',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sbdl',
|
|
|
|
|
label: '设备大类',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sblx',
|
|
|
|
|
label: '设备类型',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'gzrq',
|
|
|
|
|
label: '购置日期',
|
2025-11-14 14:58:33 +08:00
|
|
|
width: 160,
|
|
|
|
|
render: (row) => {
|
|
|
|
|
const el = h('span', null, [row.gzrq ? formatDate(row.gzrq) : ''])
|
|
|
|
|
return el
|
|
|
|
|
}
|
2025-11-03 11:33:56 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'gmfy',
|
|
|
|
|
label: '购买费用(万元)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'qxmc',
|
|
|
|
|
label: '所属区县',
|
|
|
|
|
},
|
2025-11-14 14:58:33 +08:00
|
|
|
{
|
|
|
|
|
label: '上传时间',
|
|
|
|
|
width: 160,
|
|
|
|
|
render: (row) => {
|
|
|
|
|
const el = h('span', null, [row.tjsj ? formatDate(row.tjsj) : ''])
|
|
|
|
|
return el
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-11-03 11:33:56 +08:00
|
|
|
{
|
|
|
|
|
label: "操作",
|
|
|
|
|
fixed: "right",
|
|
|
|
|
width: 150,
|
|
|
|
|
render: (row) => () =>
|
|
|
|
|
h("div", { class: "action-btns" }, [
|
|
|
|
|
h(
|
|
|
|
|
ElButton,
|
|
|
|
|
{
|
|
|
|
|
type: "primary",
|
|
|
|
|
link: true,
|
|
|
|
|
onClick: async () => {
|
2025-11-03 17:56:26 +08:00
|
|
|
dialogType.value = 'detail'
|
2025-11-03 11:33:56 +08:00
|
|
|
await getDetailData(row);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
() => "详情"
|
|
|
|
|
),
|
2025-11-14 14:58:33 +08:00
|
|
|
// h(
|
|
|
|
|
// ElButton,
|
|
|
|
|
// {
|
|
|
|
|
// type: "primary",
|
|
|
|
|
// link: true,
|
|
|
|
|
// onClick: async () => {
|
|
|
|
|
// dialogType.value = 'edit'
|
|
|
|
|
// await getDetailData(row);
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
// () => "编辑"
|
|
|
|
|
// ),
|
2025-11-03 17:56:26 +08:00
|
|
|
h(
|
|
|
|
|
ElButton,
|
|
|
|
|
{
|
|
|
|
|
type: "danger",
|
|
|
|
|
link: true,
|
|
|
|
|
onClick: async () => {
|
|
|
|
|
try {
|
|
|
|
|
await ElMessageBox.confirm("确定要删除该设备吗?", "删除确认", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
type: "warning",
|
|
|
|
|
});
|
|
|
|
|
const res = await request({
|
2025-11-05 15:10:15 +08:00
|
|
|
url: `/snow-ops-platform/yjsb/delete`,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: {
|
|
|
|
|
rid: row.rid,
|
|
|
|
|
}
|
2025-11-03 17:56:26 +08:00
|
|
|
});
|
|
|
|
|
if (res.code === '00000') {
|
|
|
|
|
ElMessage.success('删除成功');
|
|
|
|
|
getyhzsbList(qxmc.value, yhzid.value, filterData);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
() => "删除"
|
|
|
|
|
),
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
]),
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
2025-11-03 17:56:26 +08:00
|
|
|
const handleEdit = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await dialogRef?.value?.dynamicComponentRef?.formRef.validate();
|
|
|
|
|
console.log('form', toRaw(form))
|
|
|
|
|
const res = await request({
|
2025-11-05 15:10:15 +08:00
|
|
|
url: '/snow-ops-platform/yjsb/update',
|
|
|
|
|
method: 'POST',
|
2025-11-03 17:56:26 +08:00
|
|
|
data: toRaw(form),
|
|
|
|
|
});
|
|
|
|
|
if (res.code === '00000') {
|
|
|
|
|
ElMessage.success('编辑成功');
|
|
|
|
|
dialogType.value = '';
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
getyhzsbList(qxmc.value, yhzid.value, filterData);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log('error', error)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取养护站设备详情
|
|
|
|
|
const getDetailData = async (row) => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await request({
|
2025-11-05 15:10:15 +08:00
|
|
|
url: `/snow-ops-platform/yjsb/getById?rid=${row.rid}`,
|
2025-11-03 17:56:26 +08:00
|
|
|
method: 'GET',
|
|
|
|
|
});
|
2025-11-04 10:14:46 +08:00
|
|
|
if (!res || res.code !== '00000') {
|
|
|
|
|
throw new Error('获取物资详情失败')
|
|
|
|
|
}
|
2025-11-03 17:56:26 +08:00
|
|
|
if (res.code === '00000') {
|
|
|
|
|
if (dialogType.value === 'detail') {
|
2025-11-14 14:58:33 +08:00
|
|
|
// 打开详情
|
|
|
|
|
detailDialogRef.value.showDialog(res.data)
|
|
|
|
|
|
2025-11-03 17:56:26 +08:00
|
|
|
}
|
|
|
|
|
if (dialogType.value === 'edit') {
|
|
|
|
|
model.title = `编辑设备`;
|
|
|
|
|
model.content = EditDialog;
|
2025-11-11 14:51:55 +08:00
|
|
|
Object.assign(form, res.data.equipment);
|
2025-11-03 17:56:26 +08:00
|
|
|
model.props = {
|
2025-11-11 14:51:55 +08:00
|
|
|
detailData: res.data.equipment,
|
2025-11-03 17:56:26 +08:00
|
|
|
form: form,
|
|
|
|
|
};
|
|
|
|
|
model.onCancel = () => {
|
|
|
|
|
dialogType.value = '';
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
model.onConfirm = async () => {
|
|
|
|
|
|
|
|
|
|
await handleEdit();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
modelVisible.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 打开新增设备弹窗
|
|
|
|
|
const openAddEquipmentModel = () => {
|
2025-11-18 15:11:37 +08:00
|
|
|
if (!selectedYHZData.value) {
|
|
|
|
|
ElMessage.error('请先选择养护站');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-11-03 17:56:26 +08:00
|
|
|
model.title = `新增设备`;
|
|
|
|
|
model.content = AddDialog;
|
2025-11-14 14:58:33 +08:00
|
|
|
const extraData = {
|
|
|
|
|
jd: selectedYHZData.value.jd,
|
|
|
|
|
wd: selectedYHZData.value.wd,
|
|
|
|
|
yhzid: selectedYHZData.value.id,
|
|
|
|
|
qxmc: selectedYHZData.value.qxmc,
|
|
|
|
|
sbwz: selectedYHZData.value.sbwz,
|
|
|
|
|
}
|
|
|
|
|
Object.assign(form, INIT_FORM, extraData);
|
2025-11-03 17:56:26 +08:00
|
|
|
model.props = {
|
2025-11-14 14:58:33 +08:00
|
|
|
yhzData: selectedYHZData,
|
2025-11-03 17:56:26 +08:00
|
|
|
detailData: {},
|
|
|
|
|
form: form,
|
|
|
|
|
};
|
|
|
|
|
model.onCancel = () => {
|
|
|
|
|
dialogType.value = '';
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
model.onConfirm = async () => {
|
|
|
|
|
try {
|
|
|
|
|
console.log('form', toRaw(form))
|
|
|
|
|
const res = await request({
|
2025-11-05 15:10:15 +08:00
|
|
|
url: '/snow-ops-platform/yjsb/add',
|
2025-11-03 17:56:26 +08:00
|
|
|
method: 'POST',
|
2025-11-14 14:58:33 +08:00
|
|
|
data: {
|
|
|
|
|
equipment: toRaw(form)
|
|
|
|
|
},
|
2025-11-03 17:56:26 +08:00
|
|
|
});
|
|
|
|
|
if (res.code === '00000') {
|
|
|
|
|
ElMessage.success('新增成功');
|
|
|
|
|
dialogType.value = '';
|
|
|
|
|
modelVisible.value = false;
|
|
|
|
|
getyhzsbList(qxmc.value, yhzid.value, filterData);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(res.message);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
ElMessage.error(error.message);
|
|
|
|
|
console.log('error', error)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
modelVisible.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
|
2025-11-06 11:17:05 +08:00
|
|
|
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
export default () => {
|
|
|
|
|
|
|
|
|
|
const treeRef = ref(null);
|
|
|
|
|
watch(() => filterText.value, (val) => {
|
|
|
|
|
treeRef.value.filter(val || '')
|
2025-11-06 11:17:05 +08:00
|
|
|
|
|
|
|
|
// 添加自动点击逻辑
|
|
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const visibleNodes = getFilteredVisibleNodes()
|
2025-11-21 15:18:37 +08:00
|
|
|
if (visibleNodes.length === 3) {
|
|
|
|
|
handleAutoClickNode(visibleNodes[0])
|
2025-11-06 11:17:05 +08:00
|
|
|
}
|
|
|
|
|
}, 100) // 增加 100ms 延迟确保过滤完成
|
|
|
|
|
})
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
})
|
|
|
|
|
|
2025-11-06 11:17:05 +08:00
|
|
|
// 获取过滤后的可见节点
|
|
|
|
|
const getFilteredVisibleNodes = () => {
|
|
|
|
|
return Object.values(treeRef.value?.store?.nodesMap || {})
|
|
|
|
|
.filter(node => node.visible && !node.isHidden)
|
|
|
|
|
}
|
|
|
|
|
const handleAutoClickNode = (node) => {
|
|
|
|
|
// 展开父节点
|
|
|
|
|
if (node.parent) {
|
|
|
|
|
node.parent.expanded = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 执行点击逻辑
|
|
|
|
|
handleNodeClick(
|
|
|
|
|
node.data,
|
|
|
|
|
{
|
|
|
|
|
data: node.data,
|
|
|
|
|
expanded: false,
|
|
|
|
|
isCurrent: true
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
watch(
|
|
|
|
|
[() => filterData, qxmc, yhzid],
|
|
|
|
|
([newFilterData, newQxmc, newYhzid]) => {
|
|
|
|
|
getyhzsbList(newQxmc, newYhzid, newFilterData)
|
|
|
|
|
},
|
|
|
|
|
{ deep: true }
|
|
|
|
|
)
|
|
|
|
|
|
2025-11-06 11:17:05 +08:00
|
|
|
const route = useRoute()
|
|
|
|
|
|
2025-11-03 11:33:56 +08:00
|
|
|
|
2025-11-06 11:17:05 +08:00
|
|
|
onMounted(async () => {
|
|
|
|
|
await getTreeData();
|
|
|
|
|
await getyhzsbList();
|
2025-11-12 11:39:38 +08:00
|
|
|
const rowData = (decodeURIComponent(route.params.data));
|
2025-11-14 14:58:33 +08:00
|
|
|
if (rowData !== 'undefined' && rowData !== 'null' && rowData !== '') {
|
2025-11-12 11:39:38 +08:00
|
|
|
const JSONData = JSON.parse(rowData);
|
|
|
|
|
filterText.value = JSONData.mc;
|
2025-11-06 11:17:05 +08:00
|
|
|
};
|
2025-11-03 11:33:56 +08:00
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
treeRef,
|
|
|
|
|
treeData,
|
|
|
|
|
treeProps,
|
|
|
|
|
filterText,
|
|
|
|
|
filterNode,
|
|
|
|
|
handleNodeClick,
|
|
|
|
|
|
|
|
|
|
tableData,
|
|
|
|
|
filterData,
|
|
|
|
|
pagination,
|
|
|
|
|
columns,
|
2025-11-03 17:56:26 +08:00
|
|
|
modelVisible,
|
|
|
|
|
dialogRef,
|
|
|
|
|
model,
|
|
|
|
|
openAddEquipmentModel,
|
2025-11-14 14:58:33 +08:00
|
|
|
|
|
|
|
|
selectedYHZData,
|
|
|
|
|
detailDialogRef
|
2025-11-03 11:33:56 +08:00
|
|
|
}
|
|
|
|
|
}
|