修改树节点区县key

This commit is contained in:
huangchenhao 2025-11-21 14:55:58 +08:00
parent 04305171ce
commit 4001c4942f
3 changed files with 6 additions and 6 deletions

View File

@ -114,7 +114,7 @@ const getTreeData = async () => {
type: "root", type: "root",
children: res.data.areaList.map((qx, index) => ( children: res.data.areaList.map((qx, index) => (
{ {
id: index, id: qx.qxmc,
name: `${qx.qxmc}(${qx.sbsl})`, name: `${qx.qxmc}(${qx.sbsl})`,
type: 'area', type: 'area',
children: qx.yhzList.map(site => ({ children: qx.yhzList.map(site => ({

View File

@ -130,7 +130,7 @@ const getTreeData = async () => {
type: "root", type: "root",
children: res.data.areaList.map((qx, index) => ( children: res.data.areaList.map((qx, index) => (
{ {
id: index, id: qx.qxmc,
name: `${qx.qxmc}(${qx.wzsl})`, name: `${qx.qxmc}(${qx.wzsl})`,
type: 'area', type: 'area',
children: qx.yhzList.map(site => ({ children: qx.yhzList.map(site => ({

View File

@ -113,7 +113,7 @@ const getTreeData = async () => {
type: 'root', type: 'root',
children: res.data.areaList.map((qx, index) => ( children: res.data.areaList.map((qx, index) => (
{ {
id: index, id: qx.qxmc,
name: `${qx.qxmc}(${qx.bxsjsl})`, name: `${qx.qxmc}(${qx.bxsjsl})`,
type: 'area', type: 'area',
children: qx.yhzList.map(site => ({ children: qx.yhzList.map(site => ({
@ -137,7 +137,7 @@ const getTreeData = async () => {
// 处理节点点击事件 // 处理节点点击事件
const handleNodeClick = (data, node) => { const handleNodeClick = (data, node) => {
if (!data || !data.type) return; if (!data || !data.type) return;
if (data.type === 'root'){ if (data.type === 'root') {
console.log('你点击的是全部') console.log('你点击的是全部')
yhzid.value = ''; // 重置养护站id yhzid.value = ''; // 重置养护站id
qxmc.value = ''; // 重置区县名称 qxmc.value = ''; // 重置区县名称
@ -166,7 +166,7 @@ const formatDate = (date) => {
if (!date) return ''; if (!date) return '';
const pad = n => n.toString().padStart(2, '0'); const pad = n => n.toString().padStart(2, '0');
const d = new Date(date); const d = new Date(date);
return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ` + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ` +
`${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`; `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
}; };