From 76e6987c295fd491c6e160bd1ba19e76c876bf2f Mon Sep 17 00:00:00 2001
From: 李喆(开发组) <lzhe@yxqiche.com>
Date: 星期二, 24 六月 2025 11:00:01 +0800
Subject: [PATCH] 1
---
src/views/wel/index.vue | 74 ++++++++++++++++++++----------------
1 files changed, 41 insertions(+), 33 deletions(-)
diff --git a/src/views/wel/index.vue b/src/views/wel/index.vue
index b65de3c..a67e4e5 100644
--- a/src/views/wel/index.vue
+++ b/src/views/wel/index.vue
@@ -21,7 +21,7 @@
<span>{{row.name}}</span>
<el-button :size="size" text icon="el-icon-setting" type="primary" placeholder="淇敼" @click="showEdit(row)"></el-button>
<el-button :size="size" text icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="鍒犻櫎"></el-button>
- <el-button :size="size" text icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="鏂板瀛愮骇"></el-button>
+ <el-button :size="size" text v-if="row.nodeType < 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="鏂板瀛愮骇"></el-button>
</template>
</avue-crud>
<el-dialog :title="modalTitle" append-to-body v-model="modalBox">
@@ -55,13 +55,11 @@
},
{
label: '璁惧锛堟満搴婏級',
- prop: 'abc',
- hide: true
+ prop: 'abc'
},
{
label: '鑺傜偣鍚嶇О',
- prop: 'name',
- hide: true
+ prop: 'name'
},
{
label: '鑺傜偣鎻忚堪',
@@ -71,14 +69,12 @@
{
label: '鍏ㄨ矾寰�',
prop: 'abc',
- hide: true,
span: 24
},
{
label: '澶囨敞',
prop: 'remark',
type: "textarea",
- hide: true,
span: 24
}
]
@@ -159,21 +155,18 @@
},
methods: {
rowDel(row, index, done) {
- console.log(done);
done(row);
},
rowSave (row, done) {
- console.log(done,1111);
done(row);
},
rowUpdate (row, index, done) {
- console.log(done,222);
done(row);
},
showEdit(row,done) {
this.modalTitle = "淇敼";
this.modalBox = true;
- return;
+ this.modalForm = row;
},
showDel(row) {
//璋冪敤鎺ュ彛
@@ -190,6 +183,9 @@
);
},
showAdd (row) { //鏂板瀛愯妭鐐�
+ if(row.nodeType == 70) {
+ return;
+ }
this.modalTitle = "鏂板瀛愯妭鐐�";
this.selectedColumn.nodeType = String(Number(row.nodeType) + 10);
this.selectedColumn.parentId = row.id;
@@ -198,44 +194,56 @@
this.modalForm = this.selectedColumn;
this.modalBox = true;
},
- modalSubmit(row) { //鏂板瀛愯妭鐐逛繚瀛�
+ modalSubmit(row,done) { //鏂板瀛愯妭鐐逛繚瀛�/淇敼
+ if(this.modalTitle == "淇敼") {
+ var url = "/blade-mdm/program/node/update";
+ }else {
+ var url = "/blade-mdm/program/node/save";
+ }
//璋冪敤鎺ュ彛
this.loading = true;
axios({
- url: '/blade-mdm/program/node/save',
+ url,
method: 'post',
data: this.modalForm,
}).then(
res => {
- //this.$refs.crud.rowSave(this.modalForm);
- this.onLoad();
- this.$refs.crud.refreshTable();
+ this.$message.success('鎿嶄綔鎴愬姛');
this.modalBox = false;
+ // 淇敼锛屾洿鏂版湰鍦版暟鎹�
+ if (this.modalTitle === "淇敼") {
+ this.updateLocalTreeNode(this.modalForm);
+ }
this.loading = false;
+ done(row);
+ // 濡傛灉鏄柊澧炴搷浣滐紝鍙兘闇�瑕侀噸鏂板姞杞芥暟鎹�
+ // this.$refs.crud.refresh();
+ // this.$refs.crud.refreshTable();
}
);
+ },
+ updateLocalTreeNode(nodeData) {
+ const updateNode = (nodes) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].id === nodeData.id) {
+ // 鏇存柊鑺傜偣鏁版嵁
+ Object.assign(nodes[i], nodeData);
+ return true;
+ }
+ if (Array.isArray(nodes[i].children) && nodes[i].children.length > 0) {
+ if (updateNode(nodes[i].children)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+ updateNode(this.data);
},
modalCancel() {
this.modalBox = false;
},
treeLoad (tree, treeNode, resolve) {
- // setTimeout(() => {
- // this.parentId += 1;
- // var hasChildren = true;
- // if(this.parentId == 6) {
- // this.$message.error("鍒板ご浜�");
- // hasChildren = false;
- // }
- // resolve([{
- // id: this.parentId,
- // parentId: this.parentId,
- // date: '2016-05-01',
- // name: '鐜嬪皬铏�',
- // address: '鏂板',
- // hasChildren: hasChildren
- // }]);
- // console.log(tree,111)
- // }, 100);
this.loading = true;
var obj = {parentId: tree.id}
axios({
--
Gitblit v1.9.3