Browse Source

调整机构扩展图片模块

luojun 2 years ago
parent
commit
f0a01725c0
1 changed files with 101 additions and 72 deletions
  1. 101 72
      src/views/system/dept/extend.vue

+ 101 - 72
src/views/system/dept/extend.vue

@@ -53,7 +53,7 @@
                 <el-option v-for="item in areaList" :key="item.key" :label="item.value" :value="item.key"></el-option>
               </el-select>-->
               <el-cascader
-              clearable
+                clearable
                 v-model="weatherAreaCode"
                 :options="areaList"
                 @change="selectArea"
@@ -64,7 +64,7 @@
           <el-col :span="8">
             <el-form-item v-if="type == 4" label="营业场所面积">
               <el-input
-              clearable
+                clearable
                 v-model="premisesArea"
                 placeholder="请输入营业场所面积"
                 @input="handleInput"
@@ -105,7 +105,11 @@
           </el-col>
           <el-col :span="8">
             <el-form-item v-if="type == 10" label="平台品牌">
-              <el-select clearable v-model="platformBrand" placeholder="请选择平台品牌">
+              <el-select
+                clearable
+                v-model="platformBrand"
+                placeholder="请选择平台品牌"
+              >
                 <el-option
                   v-for="dict in dict.type.org_platform_brand"
                   :key="dict.value"
@@ -118,7 +122,7 @@
           <el-col :span="8">
             <el-form-item v-if="type == 10" label="平台供应商品牌">
               <el-select
-              clearable
+                clearable
                 v-model="platformSupplierBrand"
                 placeholder="请选择平台供应商品牌"
               >
@@ -146,7 +150,11 @@
           <el-row>
             <el-col :span="8">
               <el-form-item label="是否自有产权">
-                <el-select clearable v-model="ownership" placeholder="请选择是否自有产权">
+                <el-select
+                  clearable
+                  v-model="ownership"
+                  placeholder="请选择是否自有产权"
+                >
                   <el-option
                     v-for="dict in dict.type.property_situation"
                     :key="dict.value"
@@ -158,7 +166,11 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="是否区域外">
-                <el-select clearable v-model="outsideArea" placeholder="请选择是否区域外">
+                <el-select
+                  clearable
+                  v-model="outsideArea"
+                  placeholder="请选择是否区域外"
+                >
                   <el-option
                     v-for="dict in dict.type.org_extend_is"
                     :key="dict.value"
@@ -279,9 +291,9 @@
           <el-col :span="12" :xs="24">
             <p style="font-size: 12px; color: #999">上传保安证</p>
             <image-upload
+              :limit="5"
               :value="askariCertificate"
               :fileSize="2"
-              :type="'alone'"
               @input="getImgUrl"
             ></image-upload>
 
@@ -318,7 +330,7 @@
             <el-col :span="7">
               <el-form-item label="业务库类型">
                 <el-select
-                clearable
+                  clearable
                   v-model="businessLibraryType"
                   placeholder="请选择业务库类型"
                 >
@@ -776,24 +788,24 @@
           label="证书"
           prop="certificate"
         >
-          <el-input
+          <!-- <el-input
             v-if="false"
             v-model="Businessform.certificate"
             placeholder="请输入证书"
-          />
+          /> -->
           <div
             class="image-container"
             style="margin-left: 20px"
-            v-if="!Businessform.certificate"
+            v-if="Businessform.certificateEvidence"
           >
             <p style="font-size: 12px; color: #999">上传证书</p>
             <image-upload
-              :limit="1"
+              :limit="5"
               :fileSize="2"
+              :value="Businessform.certificate"
               @input="uploadBusinessSuccess"
             ></image-upload>
           </div>
-          <a :href="Businessform.certificate">点击查看</a>
           <!-- <el-button type="primary" @click="resetimg(Businessform.certificate)">重新上传</el-button> -->
         </el-form-item>
         <el-form-item v-if="false" label="佐证" prop="evidence">
@@ -865,24 +877,24 @@
           label="证书"
           prop="certificate"
         >
-          <el-input
+          <!-- <el-input
             v-if="false"
             v-model="Bankform.certificate"
             placeholder="请输入证书"
-          />
+          /> -->
           <div
             class="image-container"
             style="margin-left: 20px"
-            v-if="!Bankform.certificate"
+            v-if="Bankform.certificateEvidence"
           >
             <p style="font-size: 12px; color: #999">上传证书</p>
             <image-upload
-              :limit="1"
+              :limit="5"
               :fileSize="2"
+              :value="Bankform.certificate"
               @input="uploadBankSuccess"
             ></image-upload>
           </div>
-          <a :href="Bankform.certificate">点击查看</a>
         </el-form-item>
         <el-form-item v-if="false" label="佐证" prop="evidence">
           <el-input v-model="Bankform.evidence" placeholder="请输入佐证" />
@@ -944,24 +956,24 @@
           label="证书"
           prop="certificate"
         >
-          <el-input
+          <!-- <el-input
             v-if="false"
             v-model="orgform.certificate"
             placeholder="请输入证书"
-          />
+          /> -->
           <div
             class="image-container"
             style="margin-left: 20px"
-            v-if="!orgform.certificate"
+            v-if="orgform.certificateEvidence"
           >
             <p style="font-size: 12px; color: #999">上传证书</p>
             <image-upload
-              :limit="1"
+              :limit="5"
               :fileSize="2"
+              :value="orgform.certificate"
               @input="uploadorgSuccess"
             ></image-upload>
           </div>
-          <a :href="orgform.certificate">点击查看</a>
         </el-form-item>
         <el-form-item v-if="false" label="佐证" prop="evidence">
           <el-input v-model="orgform.evidence" placeholder="请输入佐证" />
@@ -1032,24 +1044,24 @@
           label="证书"
           prop="certificate"
         >
-          <el-input
+          <!-- <el-input
             v-if="false"
             v-model="detachedform.certificate"
             placeholder="请输入证书"
-          />
+          /> -->
           <div
             class="image-container"
             style="margin-left: 20px"
-            v-if="!detachedform.certificate"
+            v-if="detachedform.certificateEvidence"
           >
             <p style="font-size: 12px; color: #999">上传证书</p>
             <image-upload
-              :limit="1"
+              :limit="5"
               :fileSize="2"
+              :value="detachedform.certificate"
               @input="uploaddetachedSuccess"
             ></image-upload>
           </div>
-          <a :href="detachedform.certificate">点击查看</a>
         </el-form-item>
         <el-form-item v-if="false" label="佐证" prop="evidence">
           <el-input v-model="detachedform.evidence" placeholder="请输入佐证" />
@@ -1130,9 +1142,9 @@ export default {
             trigger: "blur",
           },
         ],
-        certificate: [
-          { validator: this.isreq, message: "请选择图片", trigger: "blur" },
-        ],
+        // certificate: [
+        //   { validator: this.isreq, message: "请选择图片", trigger: "blur" },
+        // ],
       },
 
       //基础信息key
@@ -1244,6 +1256,11 @@ export default {
 
       row: "",
       areaList: [],
+      imgs: [],
+      Businessimgs: [],
+      Bankimgs: [],
+      orgimgs: [],
+      detachedimgs: [],
     };
   },
   watch: {
@@ -1308,15 +1325,19 @@ export default {
         callback();
       }
     },
-    getImgUrl(fileList) {
-      let matchResult = fileList.match(/\/statics(.*)/);
-      if (matchResult) {
-        let result = matchResult[0];
-        this.askariCertificate = result;
-      } else {
-      }
-      // this.askariCertificate=img;
-      console.log(this.askariCertificate, "imgs");
+    // getImgUrl(fileList) {
+    //   let matchResult = fileList.match(/\/statics(.*)/);
+    //   if (matchResult) {
+    //     let result = matchResult[0];
+    //     this.askariCertificate = result;
+    //   } else {
+    //   }
+    //   // this.askariCertificate=img;
+    //   console.log(this.askariCertificate, "imgs");
+    // },
+    getImgUrl(img) {
+      this.imgs.push(img);
+      console.log(this.imgs, "imgs");
     },
     getAreaList() {
       selectCityInfoVoList({}).then((response) => {
@@ -1327,49 +1348,35 @@ export default {
       this.weatherAreaCode = value[1];
     },
     downBusiness(file) {
-      window.open(file);
+      let array = file.split(',');
+      console.log(array)
+      for (let i = 0; i < array.length; i++) {
+        window.open(array[i]);
+      }
     },
     //证书上传
-    uploadBusinessSuccess(fileList) {
-      let matchResult = fileList.match(/\/statics(.*)/);
-      if (matchResult) {
-        let result = matchResult[0];
-        this.Businessform.certificate = result;
-      } else {
-      }
+    uploadBusinessSuccess(img) {
+      this.Businessimgs.push(img);
     },
-    uploadBankSuccess(fileList) {
-      let matchResult = fileList.match(/\/statics(.*)/);
-      if (matchResult) {
-        let result = matchResult[0];
-        this.Bankform.certificate = result;
-      } else {
-      }
+    uploadBankSuccess(img) {
+      this.Bankimgs.push(img);
     },
-    uploadorgSuccess(fileList) {
-      let matchResult = fileList.match(/\/statics(.*)/);
-      if (matchResult) {
-        let result = matchResult[0];
-        this.orgform.certificate = result;
-      } else {
-      }
+    uploadorgSuccess(img) {
+      this.orgimgs.push(img);
     },
-    uploaddetachedSuccess(fileList) {
-      let matchResult = fileList.match(/\/statics(.*)/);
-      if (matchResult) {
-        let result = matchResult[0];
-        this.detachedform.certificate = result;
-      } else {
-      }
+    uploaddetachedSuccess(img) {
+      this.detachedimgs.push(img);
     },
+
     handleInput() {
       // 使用正则表达式过滤输入,只保留数字和小数点
       // this.premisesArea = this.premisesArea.replace(/[^0-9.]/g, "");
       // 限制只能输入1到999999之间的数字
       let value = parseInt(this.premisesArea, 10); // 将输入的值转为整数
 
-      if (isNaN(value) || value < 1 || value > 999999) { // 判断是否在范围内
-        this.premisesArea = ''; // 不在范围内则清空输入的值
+      if (isNaN(value) || value < 1 || value > 999999) {
+        // 判断是否在范围内
+        this.premisesArea = ""; // 不在范围内则清空输入的值
       } else {
         this.premisesArea = value.toString(); // 在范围内则保留输入的值
       }
@@ -1425,6 +1432,20 @@ export default {
             data.data.detachedWallPenetratingEquipment;
           this.cashAddingRoomRemoteControl =
             data.data.cashAddingRoomRemoteControl;
+          // if (
+          //   this.askariCertificate &&
+          //   this.askariCertificate.trim() &&
+          //   this.askariCertificate.includes(",")
+          // ) {
+          //   this.imgs = this.askariCertificate.split(",");
+          // } else if (
+          //   this.askariCertificate &&
+          //   this.askariCertificate.trim() &&
+          //   this.askariCertificate.includes(".")
+          // ) {
+          //   this.imgs.push(this.askariCertificate);
+          // }
+
           // console.log(this.extendId);
         }
       });
@@ -1515,11 +1536,13 @@ export default {
     },
     /** 提交按钮 */
     submitBusinessForm() {
+      this.Businessform.certificate= this.Businessimgs[this.Businessimgs.length - 1].toString(",");
       this.$refs.Businessform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
           this.Businessform.orgId = this.$route.params.id;
           this.Businessform.type = 2;
+
           if (this.Businessform.id != null) {
             // console.log(this.Businessform,"this.Businessform")
             updateOrgPhysicalDefenseConstruction(this.Businessform).then(
@@ -1613,11 +1636,13 @@ export default {
     },
     /** 提交按钮 */
     submitBankForm() {
+      this.Bankform.certificate= this.Bankimgs[this.Bankimgs.length - 1].toString(",");
       this.$refs.Bankform.validate((valid) => {
         if (valid) {
           // 表单验证通过,提交数据或执行其他操作
           this.Bankform.orgId = this.$route.params.id;
           this.Bankform.type = 3;
+
           if (this.Bankform.id != null) {
             updateOrgPhysicalDefenseConstruction(this.Bankform).then(
               (response) => {
@@ -1708,11 +1733,13 @@ export default {
     },
     /** 提交按钮 */
     submitdetachedForm() {
+      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) => {
@@ -1804,11 +1831,13 @@ export default {
     },
     /** 提交按钮 */
     submitOrgForm() {
+      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) => {
@@ -1853,7 +1882,7 @@ export default {
       let dat = {
         orgType: this.orgType,
         weatherAreaCode: this.weatherAreaCode,
-        askariCertificate: this.askariCertificate,
+        askariCertificate: this.imgs[this.imgs.length - 1].toString(","),
         premisesArea: this.premisesArea,
         ownership: this.ownership,
         outsideArea: this.outsideArea,