8
0

update 设备类型tree数据“

Dieser Commit ist enthalten in:
lb 2023-02-14 09:56:52 +08:00
Ursprung 91aba7682d
Commit 6b0d5f0bc1
2 geänderte Dateien mit 8 neuen und 54 gelöschten Zeilen

Datei anzeigen

@ -105,27 +105,6 @@ import "quill/dist/quill.bubble.css";
import { quillEditor } from "vue-quill-editor"; 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 { export default {
name: "DialogJustForm", name: "DialogJustForm",
components: { uploadBtn, quillEditor }, components: { uploadBtn, quillEditor },
@ -168,18 +147,13 @@ export default {
else if (col.fetchTreeData) { else if (col.fetchTreeData) {
// parentId 0 // parentId 0
col.fetchTreeData().then(({ data: res }) => { col.fetchTreeData().then(({ data: res }) => {
console.log("[DialogJustForm fetchTreeData -->]", res.data.list); console.log("[DialogJustForm fetchTreeData -->]", res.data);
if (res.code === 0 && res.data.list) { if (res.code === 0 && res.data) {
// if ("list" in res.data) {
const obj = {}; this.$set(col, "options", res.data.list);
res.data.list.map((item) => { } else if (Array.isArray(res.data)) {
obj[item.id] = item; this.$set(col, "options", res.data);
}); }
//
let filteredList = reConstructTreeData(obj);
// options
console.log("[DialogJustForm fetchTreeData 2 -->]", filteredList);
this.$set(col, "options", filteredList);
} else { } else {
col.options.splice(0); col.options.splice(0);
} }
@ -295,21 +269,6 @@ export default {
} }
this.loadingStatus = false; 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 { } else {
// //
} }
@ -385,8 +344,6 @@ export default {
if (this.loadingStatus) this.loadingStatus = false; if (this.loadingStatus) this.loadingStatus = false;
}); });
} else { } else {
//
// this.$message.error(JSON.stringify(result));
this.$message.error("请核查字段信息"); this.$message.error("请核查字段信息");
} }
}); });

Datei anzeigen

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