Browse Source

修改测试计划组织架构

plg 5 months ago
parent
commit
104e6f9ea2

+ 156 - 75
src/components/PlanRegister.vue

@@ -86,13 +86,13 @@
                   </el-col>
                 </el-row>
               </el-form-item>
-              <el-form-item label="配置计划">
+              <el-form-item label="组织架构" prop="checkedList">
                 <el-tree
                   :data="treeData"
                   show-checkbox
                   node-key="id"
                   default-expand-all
-                  :default-checked-keys="checkedList"
+                  :default-checked-keys="ruleForm.checkedList"
                   :props="defaultProps"
                   ref="tree"
                 >
@@ -100,7 +100,7 @@
               </el-form-item>
               <el-button @click="getCheckedNodes"> 获取已选 </el-button>
               <el-form-item label="任务选择" class="taskSelect">
-                <el-checkbox-group v-model="checkboxGroup2" size="mini">
+                <el-checkbox-group v-model="ruleForm.checkboxGroup2" size="mini">
                   <el-checkbox
                     v-for="item in scaleList"
                     :key="item.id"
@@ -124,7 +124,7 @@
           </el-form>
           <div class="dig_button">
             <el-button type="info" round @click="resetData()">重置</el-button>
-            <el-button type="success" round @click="submitCom()">提交</el-button>
+            <el-button :disabled="disableFlag" type="success" round @click="submitCom()">提交</el-button>
           </div>
         </div>
         <!-- <div slot="footer">
@@ -159,16 +159,19 @@ export default {
         //所属组织架构
         planName: "",
         endTime: "",
+        checkboxGroup2: [],
+        checkedList: [],
       },
       isView: true,
       rules: {
         planName: [{ required: true, message: "请输入计划名称", trigger: "blur" }],
         endTime: [{ required: true, message: "请输结束时间", trigger: "blur" }],
+        checkedList: [{ required: true, message: "请选择组织架构", trigger: "blur" }],
       },
       userInfo: {},
 
       scaleAndCon: [],
-      checkboxGroup2: ["1"],
+
       //查看是不是两次都调用完了
       countList: [],
       //显示用的认知任务名称
@@ -196,7 +199,7 @@ export default {
       grade: [],
       instructor: [],
       ppData: [],
-      checkedList: [],
+
       //任务可选量表数据
       scaleAndTaskList: [],
       scaleList: [],
@@ -263,13 +266,12 @@ export default {
             this.taskList = res.data.filter((item) => {
               return item.type == "1" && item.isDisplayed == "1";
             });
-            // checkboxGroup2
             let listRequest = res.data.filter((item) => {
               return item.isRequired == "1";
             });
-            this.checkboxGroup2 = [];
+            this.ruleForm.checkboxGroup2 = [];
             for (let i = 0; i < listRequest.length; i++) {
-              this.checkboxGroup2.push(listRequest[i].flag);
+              this.ruleForm.checkboxGroup2.push(listRequest[i].flag);
             }
             // instructorOption
           } else {
@@ -312,8 +314,7 @@ export default {
     //当选择的届减少时
     gradeDecrease(val, flag) {
       //减少的时候去查询
-      // this.checkedList = [];
-      let original = JSON.parse(JSON.stringify(this.checkedList));
+      let original = JSON.parse(JSON.stringify(this.ruleForm.checkedList));
       let gradeIds = [];
       if (flag == "isGrade") {
         for (let i = 0; i < this.ppData.length; i++) {
@@ -336,10 +337,9 @@ export default {
       }
 
       //求差值
-      this.checkedList = original.filter((item) => !gradeIds.includes(item));
+      this.ruleForm.checkedList = original.filter((item) => !gradeIds.includes(item));
       //这些ID都需要从已选中去掉
-      // this.checkedList=['000000100015']
-      this.$refs.tree.setCheckedKeys(this.checkedList);
+      this.$refs.tree.setCheckedKeys(this.ruleForm.checkedList);
       //应该是要判断减少的是什么
     },
     //当选择的届发生改变时
@@ -348,12 +348,15 @@ export default {
       //届数改变以后
       //获取数行已选项,将已选ID组合
       //---------------已选 开始----------
-      this.checkedList = [];
+      this.ruleForm.checkedList = [];
       let list = this.$refs.tree.getCheckedNodes();
+
       let listIds = [];
       if (list.length > 0) {
         for (let i = 0; i < list.length; i++) {
-          listIds.push(list[i].id);
+          if (list[i].id.length == 12) {
+            listIds.push(list[i].id);
+          }
         }
       }
       //---------------已选 结束----------
@@ -386,8 +389,7 @@ export default {
       let listDeWeight = listAll.filter((item, index, arr) => {
         return arr.indexOf(item) == index;
       });
-      this.checkedList = listDeWeight;
-      //this.checkedList
+      this.ruleForm.checkedList = listDeWeight;
       //然后将两个数组进行合并去重
 
       //---------------筛选届 结束----------
@@ -430,7 +432,6 @@ export default {
     //   console.log("去重listDeWeight");
     //   console.log(listDeWeight);
     //   this.checkedList = listDeWeight;
-    //   //this.checkedList
     //   //然后将两个数组进行合并去重
 
     //   //---------------筛选届 结束----------
@@ -439,7 +440,14 @@ export default {
     // },
     //通过node获取方法已选选项
     getCheckedNodes() {
-      console.log(this.$refs.tree.getCheckedNodes());
+      // console.log(this.$refs.tree.getCheckedNodes());
+      console.log(this.$refs.tree.getCheckedKeys());
+      let list = [];
+      list = this.$refs.tree.getCheckedKeys();
+      this.ruleForm.checkedList = list.filter((item) => {
+        return item.length == 12;
+      });
+      // this.ruleForm.checkedList=this.$refs.tree.getCheckedNodes()
       //循环得到ID 将ID放入数组
     },
     //获取组织架构方法--------------------开始-----------------------
@@ -612,8 +620,23 @@ export default {
       this.isView = false;
       this.ruleForm.planName = val.planName;
       this.ruleForm.endTime = val.planEndTime;
+      //将配置计划置空
+      this.ruleForm.checkedList = [];
+      //将快捷选项 届数 置空
+      this.grade = [];
+      //将快捷选项辅导员置空
+      this.instructor = [];
+      //将任务选择置空
+      this.ruleForm.checkboxGroup2 = [];
+      this.$refs["ruleForm"].clearValidate();
       this.userDetailData = val;
+      this.getGradeFun();
+      this.getChannel();
+      this.getTeacher();
+      this.queryStudentTemp();
 
+      //根据ID查询详情
+      this.queryDetail();
       //调用查询详情的接口
     },
     //查询量表
@@ -621,13 +644,29 @@ export default {
       //val 是查询的类型
       this.$http.get(`/plan/findPlanById?id=${this.id}`, {}, (res) => {
         if (res.code == 200) {
-          let list = res.data.contentEntities;
-          let listTmp = list.filter((item) => {
-            return item.contentType == "1";
+          //查询到已选任务的列表
+          let list = [];
+          list = res.data.contentEntities.filter((item) => {
+            return item.isDisplayed == "1";
           });
-          if (listTmp.length > 0) {
-            // this.checkboxGroup2 = ["1", "2"];
+          //已选任务的列表
+          let listTask = [];
+          for (let i = 0; i < list.length; i++) {
+            //
+            listTask.push(list[i].flag);
+          }
+          this.ruleForm.checkboxGroup2 = listTask;
+          //查询到已选任务
+          //查询到已选组织架构的列表
+          let listOrg = [];
+          //res.data.orgEntityList
+          for (let i = 0; i < res.data.orgEntityList.length; i++) {
+            //
+            listOrg.push(res.data.orgEntityList[i].orgNo);
           }
+
+          this.ruleForm.checkedList = listOrg;
+          this.$refs.tree.setCheckedKeys(this.ruleForm.checkedList);
         }
       });
     },
@@ -637,18 +676,23 @@ export default {
       //清空表单
       this.ruleForm.planName = "";
       this.ruleForm.endTime = "";
+      this.ruleForm.checkboxGroup2 = [];
+      this.ruleForm.checkedList = [];
     },
     cancle() {
       this.$refs["ruleForm"].clearValidate();
       //清空表单
       this.ruleForm.planName = "";
       this.ruleForm.endTime = "";
+      this.ruleForm.checkedList = [];
+      this.ruleForm.checkboxGroup2 = [];
       this.dialogVisible = false;
     },
     disableFlagStatus() {
-      setTimeout(() => {
-        this.disableFlag = false;
-      }, 1500);
+      this.disableFlag = false;
+      // setTimeout(() => {
+      //   this.disableFlag = false;
+      // }, 1500);
     },
     submitCom() {
       if (this.disableFlag) {
@@ -657,25 +701,33 @@ export default {
       this.disableFlag = true;
       let validSp = [];
       if (this.isView) {
-        validSp = ["planName", "endTime"];
+        validSp = ["planName", "endTime", "checkedList"];
       } else {
-        validSp = ["planName", "endTime"];
+        validSp = ["planName", "endTime", "checkedList"];
       }
       let aa = [];
+      console.log("---------------------");
+      //获取已选项
+      //将值赋值给this.ruleForm.checkedList
+      this.getCheckedNodes();
       this.$refs["ruleForm"].validateField(validSp, (valid) => {
         if (!valid) {
           aa.push(valid);
           //判断是编辑还是新增
           if (this.isView) {
-            if (aa.length == 2) {
+            if (aa.length == 3) {
+              this.disableFlag = true;
               this.register();
             } else {
+              console.log("3re")
               this.disableFlagStatus();
             }
           } else {
-            if (aa.length == 2) {
+            if (aa.length == 3) {
+              this.disableFlag = true;
               this.editUserFun();
             } else {
+              console.log("3fun")
               this.disableFlagStatus();
             }
           }
@@ -683,6 +735,7 @@ export default {
           //都校验通过后可以触发注册接口了
           //调用方法进行入参
         } else {
+          console.log('usagduahd')
           this.disableFlagStatus();
         }
       });
@@ -692,8 +745,9 @@ export default {
       //获取已选任务的列表
       let list = [];
       let listTmp = [];
+      let listTmpNo = [];
       listTmp = this.scaleAndTaskList.filter((item) => {
-        return this.checkboxGroup2.includes(item.flag);
+        return this.ruleForm.checkboxGroup2.includes(item.flag);
       });
       for (let i = 0; i < listTmp.length; i++) {
         let obj = {
@@ -701,16 +755,33 @@ export default {
           flag: listTmp[i].flag,
           isDisplayed: listTmp[i].isDisplayed,
           isAvailable: listTmp[i].isAvailable,
-          name:listTmp[i].name
+          name: listTmp[i].name,
+        };
+        list.push(obj);
+      }
+      //不展示要传输到后台的字段
+      listTmpNo = this.scaleAndTaskList.filter((item) => {
+        return item.isDisplayed == "0";
+      });
+      for (let i = 0; i < listTmpNo.length; i++) {
+        let obj = {
+          contentType: listTmpNo[i].type,
+          flag: listTmpNo[i].flag,
+          isDisplayed: listTmpNo[i].isDisplayed,
+          isAvailable: listTmpNo[i].isAvailable,
+          name: listTmpNo[i].name,
         };
         list.push(obj);
       }
+
+      //得到不展示的数组
+
       //获取已选组织架构的列表
 
       let listOrg = [];
       let listOrgTmp = [];
       listOrgTmp = this.ppData.filter((item) => {
-        return this.checkedList.includes(item.orgNo);
+        return this.ruleForm.checkedList.includes(item.orgNo);
       });
 
       for (let i = 0; i < listOrgTmp.length; i++) {
@@ -732,7 +803,7 @@ export default {
           createUserName: this.userInfo.userName,
           planOrgNo: this.userInfo.orgNo,
           planOrgName: this.userInfo.orgName,
-          planType:'0'
+          planType: "0",
         },
         (res) => {
           this.disableFlagStatus();
@@ -757,46 +828,59 @@ export default {
     },
     editUserFun() {
       let that = this;
+
+      //获取已选任务的列表
       let list = [];
-      if (this.checkboxGroup2.length == 2) {
-        //开始组装数据
-        for (let i = 0; i < this.scaleAndCon.length; i++) {
-          //
-          if (this.scaleAndCon[i].paramType == "cognition") {
-            let obj = {
-              contentType: "1",
-              description: this.scaleAndCon[i].paramDesc,
-              flag: this.scaleAndCon[i].paramValue,
-              name: this.scaleAndCon[i].paramName,
-            };
-            list.push(obj);
-          }
-          if (this.scaleAndCon[i].paramType == "scale") {
-            let obj = {
-              contentType: "0",
-              description: this.scaleAndCon[i].paramDesc,
-              flag: this.scaleAndCon[i].paramValue,
-              name: this.scaleAndCon[i].paramName,
-            };
-            list.push(obj);
-          }
-        }
-      } else {
-        for (let i = 0; i < this.scaleAndCon.length; i++) {
-          if (this.scaleAndCon[i].paramType == "scale") {
-            let obj = {
-              contentType: "0",
-              description: this.scaleAndCon[i].paramDesc,
-              flag: this.scaleAndCon[i].paramValue,
-              name: this.scaleAndCon[i].paramName,
-            };
-            list.push(obj);
-          }
-        }
+      let listTmp = [];
+      let listTmpNo = [];
+      listTmp = this.scaleAndTaskList.filter((item) => {
+        return this.ruleForm.checkboxGroup2.includes(item.flag);
+      });
+      for (let i = 0; i < listTmp.length; i++) {
+        let obj = {
+          contentType: listTmp[i].type,
+          flag: listTmp[i].flag,
+          isDisplayed: listTmp[i].isDisplayed,
+          isAvailable: listTmp[i].isAvailable,
+          name: listTmp[i].name,
+        };
+        list.push(obj);
       }
+      //不展示要传输到后台的字段
+      listTmpNo = this.scaleAndTaskList.filter((item) => {
+        return item.isDisplayed == "0";
+      });
+      for (let i = 0; i < listTmpNo.length; i++) {
+        let obj = {
+          contentType: listTmpNo[i].type,
+          flag: listTmpNo[i].flag,
+          isDisplayed: listTmpNo[i].isDisplayed,
+          isAvailable: listTmpNo[i].isAvailable,
+          name: listTmpNo[i].name,
+        };
+        list.push(obj);
+      }
+
+      //获取已选组织架构的列表
+
+      let listOrg = [];
+      let listOrgTmp = [];
+      listOrgTmp = this.ppData.filter((item) => {
+        return this.ruleForm.checkedList.includes(item.orgNo);
+      });
+
+      for (let i = 0; i < listOrgTmp.length; i++) {
+        let obj = {
+          orgNo: listOrgTmp[i].orgNo,
+          orgName: listOrgTmp[i].orgName,
+        };
+        listOrg.push(obj);
+      }
+
       this.userDetailData.planEndTime = this.ruleForm.endTime;
       this.userDetailData.planName = this.ruleForm.planName;
       this.userDetailData.contentEntities = list;
+      this.userDetailData.orgEntityList = listOrg;
 
       this.$http.post(
         `/plan/addOrUpdate`,
@@ -804,6 +888,7 @@ export default {
           ...this.userDetailData,
         },
         (res) => {
+          console.log('----sasas')
           this.disableFlagStatus();
           if (res && res.code == 200) {
             this.dialogVisible = false;
@@ -815,10 +900,6 @@ export default {
             // this.$toast.fail({ message: res.msg });
             this.$message.error(res.msg);
           }
-
-          //清空缓存
-
-          //清空缓存
         }
       );
     },

+ 1 - 1
src/components/PlanUser.vue

@@ -196,7 +196,7 @@ export default {
   },
   mounted() {
     this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
-    this.searchTarget();
+    // this.searchTarget();
     //获取渠道信息
 
     // this.ruleForm.type = "3";

+ 2 - 2
src/components/PlanUserStatus.vue

@@ -113,7 +113,7 @@ export default {
   },
   mounted() {
     this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
-    this.searchTarget();
+
     //获取渠道信息
 
     // this.ruleForm.type = "3";
@@ -261,7 +261,7 @@ export default {
       }
     },
     open(val) {
-    
+      // this.searchTarget();
       this.proDataLin = val;
       this.dialogVisible = true;
       this.searchTarget();

+ 0 - 8
src/components/Register.vue

@@ -228,7 +228,6 @@ export default {
       this.$http.get(url, {}, (res) => {
         if (res && res.code == 200) {
           //辅导员组织架构
-          debugger;
           for (let i = 0; i < res.data.gradeEntities.length; i++) {
             let obj = {
               value: res.data.gradeEntities[i].orgNo,
@@ -546,13 +545,6 @@ export default {
       }
     },
     register() {
-      // if (this.ruleForm.group.length == 1) {
-      //   this.$message({
-      //     message: "请选择专业节点",
-      //     type: "warning",
-      //   });
-      //   return;
-      // }
       let params = {};
       //当用户是院管理员时
       if (this.userInfo.roleType == "4") {