ソースを参照

回溯机构扩展

luojun 2 年 前
コミット
a1e4ada0d6
1 ファイル変更37 行追加50 行削除
  1. 37 50
      src/views/system/dept/extend.vue

+ 37 - 50
src/views/system/dept/extend.vue

@@ -735,9 +735,7 @@
         >取消</el-button
       >
     </div>
-
-
-
+    <!-- 添加或编辑业务库物防建设对话框 -->
     <DialogCom
       :title="Businesstitle"
       :visible.sync="Businessopen"
@@ -822,7 +820,7 @@
         <el-button @click="Businesscancel">取 消</el-button>
       </div>
     </DialogCom>
-
+    <!-- 添加或编辑银行物防建设对话框 -->
     <DialogCom
       :title="Banktitle"
       :visible.sync="Bankopen"
@@ -989,7 +987,7 @@
         <el-button @click="orgcancel">取 消</el-button>
       </div>
     </DialogCom>
-
+    <!-- 添加或编辑离行物防建设对话框 -->
     <DialogCom
       :title="detachedtitle"
       :visible.sync="detachedopen"
@@ -998,7 +996,7 @@
     >
       <el-form
         ref="detachedform"
-        :model="formData"
+        :model="detachedform"
         label-width="80px"
         :rules="rules"
       >
@@ -1007,7 +1005,7 @@
           <el-select
             prop="planType"
             label="标准"
-            v-model="formData.standard"
+            v-model="detachedform.standard"
             placeholder="请选择标准"
             clearable
           >
@@ -1022,7 +1020,7 @@
         <el-form-item label="达标日期" prop="dateOfCompliance">
           <el-date-picker
             clearable
-            v-model="formData.dateOfCompliance"
+            v-model="detachedform.dateOfCompliance"
             type="date"
             value-format="yyyy-MM-dd HH:mm:ss"
             placeholder="请选择达标日期"
@@ -1035,17 +1033,16 @@
             placeholder="请输入证书佐证"
           /> -->
           <el-switch
-            v-model="certificate"
+            v-model="detachedform.certificateEvidence"
             active-text
             :active-value="1"
             :inactive-value="0"
           ></el-switch>
         </el-form-item>
         <el-form-item
-          v-if="certificate"
+          v-if="detachedform.certificateEvidence"
           label="证书"
-          required
-          prop="certificateImgs"
+          prop="certificate"
         >
           <!-- <el-input
             v-if="false"
@@ -1055,14 +1052,15 @@
           <div
             class="image-container"
             style="margin-left: 20px"
-            v-if="certificate"
+            v-if="detachedform.certificateEvidence"
           >
-<!--            <p style="font-size: 12px; color: #999">上传证书</p>-->
-            <img-upload
+            <p style="font-size: 12px; color: #999">上传证书</p>
+            <image-upload
               :limit="5"
               :fileSize="2"
-              v-model="formData.certificateImgs"
-            ></img-upload>
+              :value="detachedform.certificate"
+              @input="uploaddetachedSuccess"
+            ></image-upload>
           </div>
         </el-form-item>
         <el-form-item v-if="false" label="佐证" prop="evidence">
@@ -1085,7 +1083,6 @@ import uploadpng from "@/assets/images/upload.png";
 import uplpng from "@/assets/images/upl.png";
 import request from "@/utils/request";
 import { statusOptions, getLabel } from "./../../commonOption";
-import ImgUpload from "@/components/ImgsUpload";
 import {
   listExtend,
   getExtend,
@@ -1114,7 +1111,6 @@ import {
 } from "@/api/system/OrgPhysicalDefenseConstruction";
 import { selectCityInfoVoList } from "@/api/core/weather";
 import TreeNodeDialogVue from "../../tool/build/TreeNodeDialog.vue";
-import {formatDate} from "@/utils";
 
 export default {
   dicts: [
@@ -1132,27 +1128,10 @@ export default {
     "property_situation",
   ],
   props: [],
-  components: {ImgUpload},
+  components: {},
   data() {
-     let formatRule = function(rule, value, callback) {
-      console.log(value,'value')
-      if (!value.length) {
-        callback(new Error("证书为必填项"));
-      } else {
-        callback();
-      }
-    };
     return {
-      //证书佐证
-      certificate:false,
       reqmsg: false,
-      formData:{
-      standard:null,
-      dateOfCompliance:null,
-      certificateEvidence:null,
-      certificate:null,  //回显时使用
-      certificateImgs:[],  //实际获取到的图片地址
-    },
       //表单验证
       rules: {
         standard: [{ required: true, message: "请输入标准", trigger: "blur" }],
@@ -1163,9 +1142,9 @@ export default {
             trigger: "blur",
           },
         ],
-        certificateImgs: [
-          { validator: formatRule, message: "请选择图片", trigger: "blur" },
-        ],
+        // certificate: [
+        //   { validator: this.isreq, message: "请选择图片", trigger: "blur" },
+        // ],
       },
 
       //基础信息key
@@ -1339,6 +1318,13 @@ export default {
   },
   mounted() {},
   methods: {
+    isreq(rule, value, callback) {
+      if (this.reqmsg) {
+        callback(new Error("证书为必填项"));
+      } else {
+        callback();
+      }
+    },
     // getImgUrl(fileList) {
     //   let matchResult = fileList.match(/\/statics(.*)/);
     //   if (matchResult) {
@@ -1379,7 +1365,7 @@ export default {
       this.orgimgs.push(img);
     },
     uploaddetachedSuccess(img) {
-      this.formData.certificateImgs.push(img);
+      this.detachedimgs.push(img);
     },
 
     handleInput() {
@@ -1553,7 +1539,7 @@ export default {
       if(this.Businessimgs.length>1){
         this.Businessform.certificate= this.Businessimgs[this.Businessimgs.length - 1].toString(",");
       }
-
+     
       this.$refs.Businessform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
@@ -1657,7 +1643,7 @@ export default {
         this.Bankform.certificate= this.Bankimgs[this.Bankimgs.length - 1].toString(",");
       }
 
-
+      
       this.$refs.Bankform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
@@ -1754,16 +1740,17 @@ export default {
     },
     /** 提交按钮 */
     submitdetachedForm() {
-      // if(this.detachedimgs.length>1){
-      //   this.detachedform.certificate= this.detachedimgs[this.detachedimgs.length - 1].toString(",");
-      // }
-      //
+      if(this.detachedimgs.length>1){
+        this.detachedform.certificate= this.detachedimgs[this.detachedimgs.length - 1].toString(",");
+      }
+
+     
       this.$refs.detachedform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
           this.detachedform.orgId = this.$route.params.id;
           this.detachedform.type = 4;
-
+ 
           if (this.detachedform.id != null) {
             updateOrgPhysicalDefenseConstruction(this.detachedform).then(
               (response) => {
@@ -1858,13 +1845,13 @@ export default {
       if(this.orgimgs.length>1){
         this.orgform.certificate= this.orgimgs[this.orgimgs.length - 1].toString(",");
       }
-
+      
       this.$refs.orgform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
           this.orgform.orgId = this.$route.params.id;
           this.orgform.type = 1;
-
+  
           if (this.orgform.id != null) {
             updateOrgPhysicalDefenseConstruction(this.orgform).then(
               (response) => {