From 0615f6c8dddf1cff5368e85ce4bfa92c4deebe02 Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期二, 29 十一月 2022 18:36:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/operate/baseSetting/illegalBuild/createUser/index.vue | 99 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 79 insertions(+), 20 deletions(-)
diff --git a/src/views/operate/baseSetting/illegalBuild/createUser/index.vue b/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
index 5c0ddeb..db5f524 100644
--- a/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
+++ b/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
@@ -18,15 +18,20 @@
</el-form-item>
<!-- 鐖剁骇id -->
<el-form-item class="optionItem" label="鐖剁骇:" prop="parentId">
- <el-select v-model="things.parentId" placeholder="璇烽�夋嫨鎵�灞炵埗绾�">
- <el-option v-for="item in parentList" :key="item.id" :label="item.name" :value="item.id">
+ <el-select v-model="things.parentId" placeholder="璇烽�夋嫨鎵�灞炵埗绾�" :disabled="things.level===1">
+ <!-- <el-option v-for="item in parentList" :key="item.id" :label="item.name" :value="item.id">
+ </el-option> -->
+ <el-option :value="mylabel">
+ <el-tree ref="tree" :check-strictly="true" :data="parentList" :props="defaultProps" show-checkbox
+ @check-change="handleCheck" default-expand-all node-key="id">
+ </el-tree>
</el-option>
</el-select>
</el-form-item>
<!-- 妗堢敱 -->
- <el-form-item class="optionItem" label="妗堢敱:" prop="type">
- <el-input type="textarea" autosize v-model="things.type" placeholder="璇疯緭鍏ユ鐢辨弿杩板唴瀹�"></el-input>
- </el-form-item>
+ <!-- <el-form-item class="optionItem" label="妗堢敱:" prop="type">
+ <el-input type="textarea" :rows="2" v-model="things.type" placeholder="璇疯緭鍏ユ鐢辨弿杩板唴瀹�" :disabled="things.level!==2"></el-input>
+ </el-form-item> -->
<el-form-item>
<div class="optionBtn">
<el-button type="primary" class="btn submit" @click.native.prevent="handleSubmit">纭
@@ -83,30 +88,43 @@
value: 2,
},
],
+ parentList: [],
+ selectOrg: {
+ orgsid: []
+ },
+ defaultProps: {
+ children: 'children',
+ label: 'name'
+ },
+ mylabel:''
}
},
created() {
},
methods: {
// 鏌ヨ鎵�灞炵被鍨�
- getTypeThird() {
- this.$axios({
+ async getTypeThird() {
+ let arr = [];
+ await this.$axios({
method: 'get',
url: "sccg/illegal_building/query/type_first",
})
.then(res => {
- this.parentList = res.data;
+ arr = res.data;
})
+ return arr;
},
// 鏌ヨ鎵�灞炲ぇ绫�
- getTypeSecond() {
- this.$axios({
+ async getTypeSecond() {
+ let arr =[];
+ await this.$axios({
method: 'get',
url: "sccg/illegal_building/query/type_second",
})
.then(res => {
- this.parentList = res.data;
+ arr = res.data;
})
+ return arr;
},
// 鎻愪氦鏂板杩濊绫诲瀷
handleSubmit() {
@@ -114,22 +132,21 @@
this.$refs.user.validate((valid) => {
console.log(valid);
if (valid) {
- const { things } = this;
+ const { things,selectOrg } = this;
this.$axios({
method: 'post',
url: 'sccg/illegal_building/addition/type',
data: {
code: '1111',
- level: things.parentId === '' ? things.level : things.level + 1,
+ level: things.level,
name: things.name,
- parentId: things.parentId === '' ? 0 : things.parentId,
+ parentId: things.parentId === '' ? 0 : selectOrg.orgsid[0],
typeCode: '06',
typeName: '杩濆缓绫诲瀷',
remark: things.type,
}
})
.then(res => {
- console.log(res);
if (res.code === 200) {
this.$message({
type: 'success',
@@ -149,13 +166,55 @@
})
},
// 妗堜欢绾у埆鍙樺寲
- resetParentList(index) {
+ async resetParentList(index) {
if (index === 1) {
- this.getTypeThird();
- }else {
- this.getTypeSecond();
+
+ }else{
+ this.parentList = await this.getTypeThird()
+ // this.parentList = this.addChildren(await this.getTypeThird(), await this.getTypeSecond());
}
- }
+ },
+ // addChildren(parentArr, childArr) {
+ // // console.log(parentArr.length,childArr);
+ // parentArr.forEach(item => {
+ // item.children = [];
+ // childArr.forEach(child => {
+ // if (item.id === child.parentId) {
+ // item.children.push(child);
+ // }
+ // })
+ // })
+ // console.log(parentArr);
+ // return parentArr;
+ // },
+ handleCheck(data, checked) {
+ this.things.parentId = data.name;
+ console.log(this.selectOrg.orgsid);
+ // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮�
+ const indexs = this.selectOrg.orgsid.indexOf(data.id)
+ // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆�
+ if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) {
+ this.$message({
+ message: '鍙兘閫夋嫨涓�涓尯鍩燂紒',
+ type: 'warning',
+ showClose: true
+ })
+ // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕�
+ this.$refs.tree.setChecked(data, false)
+ } else if (this.selectOrg.orgsid.length === 0 && checked) {
+ // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨
+ // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push
+ this.selectOrg.orgsid = []
+ this.selectOrg.orgsid.push(data.id)
+ } else if (
+ indexs >= 0 &&
+ this.selectOrg.orgsid.length === 1 &&
+ !checked
+ ) {
+ // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣�
+ this.selectOrg.orgsid = []
+ }
+ },
},
props: ['changeDialog']
}
--
Gitblit v1.8.0