Эх сурвалжийг харах

教育培训 机构树组件变更

jingyuanchao 2 жил өмнө
parent
commit
c10cc4c5d6

+ 6 - 2
src/components/elDialog/dialog.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-dialog v-bind="$attrs" v-on="$listeners" :close-on-click-modal="false">
+    <el-dialog :close="close" v-bind="$attrs" v-on="$listeners" :close-on-click-modal="false">
       <slot></slot>
       <slot name="footer" class="dialog-footer"></slot>
     </el-dialog>
@@ -16,7 +16,11 @@ export default {
 
   mounted() {},
 
-  methods: {},
+  methods: {
+    close(){
+      this.$emit("close");
+    }
+  },
 };
 </script>
 <style lang="scss">

+ 26 - 14
src/views/core/edu/plan/index.vue

@@ -135,7 +135,7 @@
       </el-col>
     </el-row>
     <!-- 添加或修改教育培训计划对话框 -->
-    <DialogCom :title="title" :visible.sync="open" width="800px" height="800px" append-to-body>
+    <DialogCom :title="title" :visible.sync="open" width="800px" height="800px" append-to-body @close="clear">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-row>
           <el-col :span="12">
@@ -213,10 +213,14 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
+            <!--            <el-form-item label="培训机构" prop="planExecOrgIdList">
+                          <tree-select v-model="form.planExecOrgIdList" :options="deptOptions" :show-count="true"
+                                       :normalizer="tenantIdnormalizer" :props="{ checkStrictly: true, label: 'name' }"
+                                       placeholder="请选择培训机构"/>
+                        </el-form-item>-->
             <el-form-item label="培训机构" prop="planExecOrgIdList">
-              <tree-select v-model="form.planExecOrgIdList" :options="deptOptions" :show-count="true"
-                           :normalizer="tenantIdnormalizer" :props="{ checkStrictly: true, label: 'name' }"
-                           placeholder="请选择培训机构"/>
+              <org-tree-select ref="orgTreeSelect" @selectNode="queryNode"
+                               placeholder="请选择培训机构"></org-tree-select>
             </el-form-item>
           </el-col>
         </el-row>
@@ -267,6 +271,7 @@ import {
   roleList,
   updatePlan
 } from "@/api/core/edu/plan";
+import OrgTreeSelect from '@/components/orgTreeSelect'
 import tableList from "@/mixins/tableList";
 import OrgTree from "@/components/orgTree";
 import {deptTreeSelect} from "@/api/system/public";
@@ -276,7 +281,7 @@ import DialogSelectFile from "./dialog.select.file.vue";
 export default {
   name: "Plan",
   dicts: ['plan_cycle', 'sys_org_type', 'plan_status', 'edu_plan_cycle'],
-  components: {OrgTree, KFileUpload, DialogSelectFile},
+  components: {OrgTreeSelect, OrgTree, KFileUpload, DialogSelectFile},
   mixins: [tableList],
   data() {
     return {
@@ -311,7 +316,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         belongOrgId: null,
-        checkSub:true
+        checkSub: true
 
       },
       // 表单参数
@@ -359,6 +364,14 @@ export default {
     this.orgId = this.$store.getters.orgId;
   },
   methods: {
+    clear() {
+      this.$refs['orgTreeSelect'].clear();
+    },
+    queryNode(nodes) {
+      this.form.planExecOrgIdList = JSON.parse(nodes).map(v => {
+        return v.id
+      });
+    },
     /** 查询教育培训计划列表 */
     getList() {
       this.loading = true;
@@ -409,7 +422,7 @@ export default {
     },
     checkCanDel(row) {
       //计划创建机构为当前机构且不是顶级机构创建的计划才显示“删除”按钮
-      return row.belongOrgId == this.$store.getters.orgId && row.createByTopOrg == 1 && row.issue == 0 || row.done !=1
+      return row.belongOrgId == this.$store.getters.orgId && row.createByTopOrg == 1 && row.issue == 0 || row.done != 1
     },
     //省联社下发的计划不显示“删除”按钮
     checkCreateByTopOrg(row) {
@@ -429,6 +442,7 @@ export default {
     cancel() {
       this.open = false;
       this.reset();
+      this.$refs['orgTreeSelect'].clear();
     },
     // 表单重置
     reset() {
@@ -439,7 +453,7 @@ export default {
         execTimes: null,
         planStatus: null,
         execOrgType: null,
-        planExecOrgIdList: null,
+        planExecOrgIdList: [],
         startDate: null,
         endDate: null,
         buildTaskNow: null,
@@ -518,12 +532,11 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          let request={...this.form};
-          if(this.form.planExecOrgIdList){
+          let request = {...this.form};
+          if (this.form.planExecOrgIdList) {
             const list = Array.isArray(this.form.planExecOrgIdList) ? this.form.planExecOrgIdList : [this.form.planExecOrgIdList];
-          request.planExecOrgIdList = list;
-        }
-          else{
+            request.planExecOrgIdList = list;
+          } else {
             request.planExecOrgIdList = [];
           }
           if (request.id != null) {
@@ -576,7 +589,6 @@ export default {
       this.$refs["DialogSelectFile"].show();
     },
     fileSelected(list) {
-      console.log("fileSelected", list);
       if (!list) return;
       list.forEach(x => {
         this.form.fileList = this.form.fileList.concat(x.fileList);