hxl13994548489 2 лет назад
Родитель
Сommit
7efc42c98f
1 измененных файлов с 53 добавлено и 1 удалено
  1. 53 1
      src/views/PeopleManage/Staff/AreaOrganization.vue

+ 53 - 1
src/views/PeopleManage/Staff/AreaOrganization.vue

@@ -153,6 +153,21 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="绑定机构" prop="bindDeptId">
+              <el-select v-model="labelData"  placeholder="请选择" :popper-append-to-body="false" style="width: 100%">
+                      <el-option :value="selectTree" class="deptOption" disabled>
+                        <el-tree :data="treedata" :props="defaultProps" ref="tree" :highlight-current="true"
+                          @node-click="handleNodeClick" default-expand-all></el-tree>
+                      </el-option>
+                    </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+           
+          </el-col>
+        </el-row>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button
@@ -184,6 +199,14 @@ export default {
   },
   data() {
     return {
+      treedata:[],
+      defaultProps: {
+        //自定义参数
+        children: "children",
+        label: "name",
+      },
+      labelData: '',
+      selectTree: [],
       loading: false,
       peopledeptid: "",
       managementSource: "", //来源类型
@@ -225,6 +248,7 @@ export default {
         name: "",
         comtype: "", //机构类型
         orderNum: 0,
+        bindDeptId: ""
       },
       //表单验证
       dataRule: {
@@ -241,6 +265,13 @@ export default {
             message: "请选择机构类型",
             trigger: "blur",
           },
+        ],
+        bindDeptId: [
+          {
+            required: true,
+            message: "请选择机构类型",
+            trigger: "change",
+          },
         ]
       },
       isshow: false,
@@ -251,6 +282,9 @@ export default {
     };
   },
   created() {
+    this.$api.dept.findDeptTree("9", "").then((res) => {
+      this.treedata = res.data;
+    });
     this.findTreeData();
     this.$api.dept.sysDeptInternalAgentType().then(res => {
       this.comtypeoptions = res.data
@@ -265,6 +299,10 @@ export default {
     this.findSubDeptPage(); //初始化数据
   },
   methods: {
+    handleNodeClick(data, self, child) {
+      this.labelData = data.name;//展示部分
+      this.dataForm.bindDeptId = data.id
+    },
     resultList() {
       this.formData = {}
       this.findTreeData()
@@ -304,6 +342,7 @@ export default {
         });
       }
       this.operType = "ADD";
+      this.labelData = "";
       this.dialogVisible = true;
     },
 
@@ -356,6 +395,7 @@ export default {
     handleEdit(data) {
       this.operType = "EDIT";
       this.dialogTitle = "修改机构信息";
+      this.labelData = "";
       this.$api.dept.findSysDeptInternalAgentById({
         id: data.id
       }).then(res => {
@@ -365,8 +405,14 @@ export default {
           parentId: res.data.parentId,
           name: res.data.name,
           orderNum: res.data.orderNum,
-          comtype: res.data.comtype
+          comtype: res.data.comtype,
+          bindDeptId: res.data.bindDeptId
         }
+        this.$api.dept.getDeptById(res.data.bindDeptId).then((res) => {
+            if (res.code == '200') {
+              this.labelData = res.data.name;
+            }
+          });
       })
       this.dialogVisible = true;
     },
@@ -457,4 +503,10 @@ body {
 .bh-medium-font-size {
   font-size: 30px !important;
 }
+.deptOption {
+  height: auto;
+  line-height: 1;
+  padding: 0;
+  background-color: #fff;
+}
 </style>