add 客商关系

This commit is contained in:
lb
2023-02-13 13:52:42 +08:00
parent 4faaf478f4
commit 2b94c7ac52
7 changed files with 393 additions and 7 deletions

View File

@@ -49,7 +49,7 @@
<uploadBtn
v-if="col.upload"
:key="'upload_' + Math.random()"
:key="'upload_' + rowIndex + colIndex"
:action="col.actionUrl"
:file-list="dataForm['files']"
:disabled="detailMode || !dataForm.id"
@@ -105,12 +105,13 @@ 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];
currentNode.label = currentNode.name;
currentNode.value = currentNode.id;
if (currentNode.parentId === "0") {
entry.push(listObj[key]);
return; // return { label: currentNode.name, value: currentNode.id, children: currentNode.children ?? [] };
@@ -121,6 +122,7 @@ function reConstructTreeData(listObj) {
}
parentNode.children.push(currentNode);
});
console.log("[reConstructTreeData]", entry);
return entry;
}
@@ -176,6 +178,7 @@ export default {
// 再过滤这个对象
let filteredList = reConstructTreeData(obj);
// 最后设置 options
console.log("[DialogJustForm fetchTreeData 2 -->]", filteredList);
this.$set(col, "options", filteredList);
} else {
col.options.splice(0);
@@ -231,7 +234,7 @@ export default {
id: file.id,
name: file.name,
url: file.url,
typeCode: file.typeCode
typeCode: file.typeCode,
}));
},
@@ -342,6 +345,7 @@ export default {
case "add":
case "update": {
if ("parentId" in this.dataForm) {
console.log("[DialogJustForm parentId]", this.dataForm.parentId);
// 对特殊的键做特殊处理,如 parentId 是一个 cascader获取的值是 ["xxx"]后端只需要xxx
const lastItem = this.dataForm.parentId.length - 1;
this.dataForm.parentId = this.dataForm.parentId[lastItem];