update 设备类型tree数据“

这个提交包含在:
lb 2023-02-14 09:56:52 +08:00
父节点 91aba7682d
当前提交 6b0d5f0bc1
共有 2 个文件被更改,包括 8 次插入54 次删除

查看文件

@ -105,27 +105,6 @@ import "quill/dist/quill.bubble.css";
import { quillEditor } from "vue-quill-editor";
// TODO: tree
function reConstructTreeData(listObj) {
const entry = [];
Object.keys(listObj).map((key) => {
const currentNode = listObj[key];
if (currentNode.parentId === "0") {
entry.push(listObj[key]);
return; // return { label: currentNode.name, value: currentNode.id, children: currentNode.children ?? [] };
}
const parentNode = listObj[currentNode.parentId];
if (!parentNode.children) {
parentNode.children = [];
}
parentNode.children.push(currentNode);
});
console.log("[reConstructTreeData]", entry);
return entry;
}
export default {
name: "DialogJustForm",
components: { uploadBtn, quillEditor },
@ -168,18 +147,13 @@ export default {
else if (col.fetchTreeData) {
// parentId 0
col.fetchTreeData().then(({ data: res }) => {
console.log("[DialogJustForm fetchTreeData -->]", res.data.list);
if (res.code === 0 && res.data.list) {
//
const obj = {};
res.data.list.map((item) => {
obj[item.id] = item;
});
//
let filteredList = reConstructTreeData(obj);
// options
console.log("[DialogJustForm fetchTreeData 2 -->]", filteredList);
this.$set(col, "options", filteredList);
console.log("[DialogJustForm fetchTreeData -->]", res.data);
if (res.code === 0 && res.data) {
if ("list" in res.data) {
this.$set(col, "options", res.data.list);
} else if (Array.isArray(res.data)) {
this.$set(col, "options", res.data);
}
} else {
col.options.splice(0);
}
@ -295,21 +269,6 @@ export default {
}
this.loadingStatus = false;
});
// //
// this.uploadComponentsList.forEach((col) => {
// this.$http
// .get(col.fetchUrl, {
// params: {
// limit: 999,
// page: 1,
// [col.paramName]: this.dataForm.id,
// },
// })
// .then(({ data: res }) => {
// console.log("fetch filelist:", res);
// });
// });
} else {
//
}
@ -385,8 +344,6 @@ export default {
if (this.loadingStatus) this.loadingStatus = false;
});
} else {
//
// this.$message.error(JSON.stringify(result));
this.$message.error("请核查字段信息");
}
});

查看文件

@ -83,10 +83,7 @@ export default function () {
// fetchData() 获取普通列表数据
// fetchTreeData() 获取需要展示层级结构的数据
fetchTreeData: () => {
// TODO前提是工厂里总的设备类型数不会超过 999
return this.$http.get('/pms/equipmentType/page', {
params: { limit: 999, page: 1, key: "" }
})
return this.$http.get('/pms/equipmentType/getTree')
},
label: "父类",
rules: { required: false, message: "not empty", trigger: "change" },