Browse Source

会议回复

gks 1 year ago
parent
commit
e87638afa5
1 changed files with 75 additions and 63 deletions
  1. 75 63
      src/views/JOINTCONFERENCE/add.vue

+ 75 - 63
src/views/JOINTCONFERENCE/add.vue

@@ -19,23 +19,26 @@
         ></el-input>
       </el-form-item>
       <p style="display: none" v-html="form.conferenceContent" ref="test"></p>
+      <!-- <p  v-for="(item, i) in deptList"> {{ item.deptId  + '----' + item.deptName }} </p> -->
       <el-form-item label="协作单位" prop="cooperativeUnitId">
         <el-select
+          clearable
+          filterable
+          :multiple="user.type == 1"
           v-model="form.cooperativeUnitId"
           placeholder="请选择协作单位"
           @change="handleChange"
         >
           <!-- style="width: 100%" -->
           <el-option
-            v-for="item in deptList"
+            :disabled="item.type == user.type && item.deptId == user.deptId"
+            v-for="(item, i) in deptList"
             :key="item.deptId"
             :label="item.deptName"
             :value="item.deptId"
-            :disabled="item.type == user.type"
           >
           </el-option>
         </el-select>
-
       </el-form-item>
       <el-form-item label="协作要求" prop="collaborativeContent">
         <el-input
@@ -127,18 +130,19 @@ export default {
         },
       },
       isShowDate: false,
-      user: null,
+      user: {
+        type:1
+      },
       // 状态选择
       status: null,
       // 限期日期
       date: null,
 
-
       deptId: [],
       deptList: [],
       form: {
         conferenceContent: "",
-        cooperativeUnitId: null
+        cooperativeUnitId: null,
       },
       rules: {
         conferenceTitle: [
@@ -168,52 +172,55 @@ export default {
       getJOINTCONFERENCE(this.param.id).then((response) => {
         this.form = response.data;
         let arr = eval("(" + this.form.deptIds + ")");
-        // this.form.cooperativeUnitId = arr[0];
         this.deptId = JSON.parse(this.form.deptIds);
       });
     }
 
-
-
     getInfo().then((res) => {
-      this.user = res.user.dept
+      this.user = res.user.dept;
       if (res.user.dept.type == 1 && res.user.userId == 14) {
-        getDept(2).then((res) => {
-          this.deptList = [...res.data,{
-            searchValue: null,
-            createBy: "admin",
-            createTime: "2023-07-20 14:40:52",
-            updateBy: "admin",
-            updateTime: "2023-09-18 18:46:44",
-            params: {},
-            deptId: 100,
-            parentId: 0,
-            ancestors: "0",
-            deptName: "广西壮族自治区北部湾办公室",
-            type: 1,
-            orderNum: 0,
-            leader: "XXX",
-            phone: "15888888888",
-            biaoCang: "23",
-            email: "ry@qq.com",
-            status: "0",
-            delFlag: "0",
-            parentName: null,
-            industryOrientation: null,
-            planningArea: null,
-            acceptanceArea: null,
-            useArea: null,
-            usageRate: null,
-            warehouse: null,
-            oilDepot: null,
-            refrigeratory: null,
-            workshop: null,
-            approvalTime: null,
-            children: [],
-            createBy_dictText: "管理员",
-          }];
-          console.log(this.deptList);
+        listDept().then((res) => {
+          this.deptList = res.data;
         });
+        // getDept().then((res) => {
+        //   console.log(res);
+        //   this.deptList = [
+        //     ...res.data,
+        //     {
+        //       searchValue: null,
+        //       createBy: "admin",
+        //       createTime: "2023-07-20 14:40:52",
+        //       updateBy: "admin",
+        //       updateTime: "2023-09-18 18:46:44",
+        //       params: {},
+        //       deptId: 100,
+        //       parentId: 0,
+        //       ancestors: "0",
+        //       deptName: "广西壮族自治区北部湾办公室",
+        //       type: 1,
+        //       orderNum: 0,
+        //       leader: "XXX",
+        //       phone: "15888888888",
+        //       biaoCang: "23",
+        //       email: "ry@qq.com",
+        //       status: "0",
+        //       delFlag: "0",
+        //       parentName: null,
+        //       industryOrientation: null,
+        //       planningArea: null,
+        //       acceptanceArea: null,
+        //       useArea: null,
+        //       usageRate: null,
+        //       warehouse: null,
+        //       oilDepot: null,
+        //       refrigeratory: null,
+        //       workshop: null,
+        //       approvalTime: null,
+        //       children: [],
+        //       createBy_dictText: "管理员",
+        //     },
+        //   ];
+        // });
       } else if (res.user.dept.type == 2) {
         this.deptList = [
           {
@@ -266,36 +273,41 @@ export default {
       this.isShowDate = true;
     },
 
-
     handleChange(val) {
-
-      console.log(typeof(val));
+      console.log(typeof val);
     },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate((valid) => {
+        let cooperativeUnitId;
         if (valid) {
-          let cooperativeUnitId =  [this.form.cooperativeUnitId];
-          console.log();
-          if (this.form.id != null) {
+          if (typeof this.form.cooperativeUnitId == "object") {
+            cooperativeUnitId = this.form.cooperativeUnitId;
+          } else {
+            cooperativeUnitId = [this.form.cooperativeUnitId];
+          }
 
+          if (this.form.id != null) {
             this.form.deptNum = 1;
-            updateJOINTCONFERENCE({...this.form,cooperativeUnitId}).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.$layer.close(this.layerid);
-              this.$parent.getList();
-            });
+            updateJOINTCONFERENCE({ ...this.form, cooperativeUnitId }).then(
+              (response) => {
+                this.$modal.msgSuccess("修改成功");
+                this.$layer.close(this.layerid);
+                this.$parent.getList();
+              }
+            );
           } else {
-         
             //俊豪像甲方一样,老是让我改传参
             //↑好家伙你还改错了,是seleValue不是deptId
             //↑啥玩意?
-            this.form.deptNum = this.form.cooperativeUnitId.length;
-            addJOINTCONFERENCE({...this.form,cooperativeUnitId}).then((response) => {
-              this.$modal.msgSuccess("发布成功");
-              this.$layer.close(this.layerid);
-              this.$parent.getList();
-            });
+            this.form.deptNum = cooperativeUnitId.length;
+            addJOINTCONFERENCE({ ...this.form, cooperativeUnitId }).then(
+              (response) => {
+                this.$modal.msgSuccess("发布成功");
+                this.$layer.close(this.layerid);
+                this.$parent.getList();
+              }
+            );
           }
         }
       });