zhangyuewww преди 3 години
родител
ревизия
ac4b1d7256
променени са 1 файла, в които са добавени 116 реда и са изтрити 109 реда
  1. 116 109
      src/views/platformaudit/grainpulseenterprisereview.vue

+ 116 - 109
src/views/platformaudit/grainpulseenterprisereview.vue

@@ -206,12 +206,12 @@
             <el-input v-model="companyList1.compName" placeholder="请输入公司名称"></el-input>
           </el-form-item>
           <el-form-item label="主营类型(可多选,必须为真实经营类型)" prop="mainBusinessType">
-            <el-checkbox-group v-model="companyList1.mainBusinessType" style="">
+            <el-checkbox-group v-model="companyList1.mainBusinessType">
               <el-checkbox-button label="粮库" name="Type"></el-checkbox-button>
               <el-checkbox-button label="加工厂" name="Type"></el-checkbox-button>
               <el-checkbox-button label="烘干塔" name="Type"></el-checkbox-button>
               <el-checkbox-button label="饲料厂" name="Type"></el-checkbox-button>
-              <el-checkbox-button label="养殖" name="Type"></el-checkbox-button>
+              <el-checkbox-button label="养殖" name="Type"></el-checkbox-button>
               <el-checkbox-button label="粮贸" name="Type"></el-checkbox-button>
               <el-checkbox-button label="期货" name="Type"></el-checkbox-button>
             </el-checkbox-group>
@@ -227,77 +227,64 @@
             <span>纬度:{{ companyList1.latitude }}</span>
           </el-form-item>
           <el-form-item label="所在区域" :label-width="formLabelWidth" >
-            <!-- <el-input v-model="companyList1.adress" placeholder="请输入所在区域"></el-input> -->
             {{ companyList1.province }}{{ companyList1.city }}{{ companyList1.area }}
           </el-form-item>
           <el-form-item label="详细地址" :label-width="formLabelWidth" prop="detailedAddress">
             <el-input v-model="companyList1.detailedAddress" placeholder="请输入详细地址"></el-input>
           </el-form-item>
           <el-form-item label="上传封面图片" :label-width="formLabelWidth" prop="attachmentAddress">
-          <el-upload
+            <el-upload
+            class="avatar-uploader"
             action="https://www.zthymaoyi.com/upload/admin"
-            list-type="picture-card"
-            :on-preview="handlePictureCardPreview1"
-            :on-remove="handleRemove"
-          >
-            <i class="el-icon-plus"></i>
-          </el-upload>
-          <el-dialog :visible.sync="dialogVisible1">
-            <img width="100%" :src="companyList1.attachmentAddress" alt="" />
-          </el-dialog>
+            :show-file-list="false"
+            :on-success="handleAvatarSuccess"
+            :before-upload="beforeAvatarUpload">
+            <img v-if="companyList1.attachmentAddress" :src="companyList1.attachmentAddress" class="avatar">
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+            </el-upload>
           </el-form-item>
           <el-form-item label="营业执照" :label-width="formLabelWidth" prop="licenseAddress">
-          <el-upload
+            <el-upload
+            class="avatar-uploader"
             action="https://www.zthymaoyi.com/upload/admin"
-            list-type="picture-card"
-            :on-preview="handlePictureCardPreview2"
-            :on-remove="handleRemove"
-          >
-            <i class="el-icon-plus"></i>
-          </el-upload>
-          <el-dialog :visible.sync="dialogVisible2">
-            <img width="100%" :src="companyList1.licenseAddress" alt="" />
-          </el-dialog>
+            :show-file-list="false"
+            :on-success="handleAvatarSuccess1"
+            :before-upload="beforeAvatarUpload">
+            <img v-if="companyList1.licenseAddress" :src="companyList1.licenseAddress" class="avatar">
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+            </el-upload>
           </el-form-item>
           <h3 style="margin-left: 30px">附加信息(选填)</h3>
           <el-form-item label="企业概况" :label-width="formLabelWidth" prop="companyContant">
-            <el-input type="textarea" v-model="companyList1.companyContant" placeholder="请输入企业概况,如经营项目、产品类型、企业规模等,不超过300字"></el-input>
+            <el-input type="textarea" v-model="companyList1.companyContant" maxlength="300" placeholder="请输入企业概况,如经营项目、产品类型、企业规模等,不超过300字"></el-input>
           </el-form-item>
           <el-form-item label="标签(标签应突出企业特色,最多6个)" prop="label" >
-            <el-tag
+           <el-tag
               :key="tag"
-              v-for="tag in dynamicTags"
+              v-for="tag in companyList1.label"
               closable
               :disable-transitions="false"
-              @close="handleClose(tag)"
-            >
-              {{ tag }}
-            </el-tag>
-            <el-input
+              @close="handleClose(tag)">
+              {{tag}}
+              </el-tag>
+              <el-input
               class="input-new-tag"
               v-if="inputVisible"
               v-model="label"
               ref="saveTagInput"
               size="small"
-              maxlength="6"
-              placeholder="请输入标签内容,不超过6个字符"
               @keyup.enter.native="handleInputConfirm"
               @blur="handleInputConfirm"
-            >
-            </el-input>
-            <el-button
-              v-else
-              class="button-new-tag"
-              size="small"
-              @click="showInput"
-              >添加</el-button
-            >
+              >
+              </el-input>
+              <el-button v-else class="button-new-tag" size="small" @click="showInput">添加</el-button>
           </el-form-item>
           <el-form-item label="场地图片(图片清晰,最多9张)" :label-width="formLabelWidth" prop="sitePhotoAddress">
           <el-upload
             action="https://www.zthymaoyi.com/upload/admin"
             list-type="picture-card"
-            :on-preview="handlePictureCardPreview3"
+            :limit="9"
+            :on-preview="handlePictureCardPreview"
             :on-remove="handleRemove"
           >
             <i class="el-icon-plus"></i>
@@ -369,7 +356,7 @@ export default {
       //标签
       dynamicTags: [],
       inputVisible: false,
-      // inputValue: '',
+      label: '',
       //图片
       dialogImageUrl: '',
       dialogVisible1: false,
@@ -437,19 +424,29 @@ export default {
     this.showType = this.isShow
   },
   methods: {
+    handleAvatarSuccess(res, file) {
+      this.companyList1.attachmentAddress = file.response.url;
+    },
+    handleAvatarSuccess1(res, file) {
+      this.companyList1.licenseAddress = file.response.url;
+    },
+    beforeAvatarUpload(file) {
+      const isJPG = file.type === 'image/jpeg';
+      const isLt2M = file.size / 1024 / 1024 < 2;
+
+      if (!isJPG) {
+        this.$message.error('上传图片只能是 JPG 格式!');
+      }
+      if (!isLt2M) {
+        this.$message.error('上传图片大小不能超过 2MB!');
+      }
+      return isJPG && isLt2M;
+    },
     //图片
     handleRemove(file, fileList) {
       console.log(file, fileList)
     },
-    handlePictureCardPreview1(e) {
-      this.companyList1.attachmentAddress = e.url+ ','
-      this.dialogVisible1 = true
-    },
-    handlePictureCardPreview2(file) {
-      this.companyList1.licenseAddress = file.url
-      this.dialogVisible2 = true
-    },
-    handlePictureCardPreview3(file) {
+    handlePictureCardPreview(file) {
       this.companyList1.sitePhotoAddress = file.url
       this.dialogVisible3 = true
     },
@@ -512,7 +509,7 @@ export default {
         .then((response) => {
           this.companyList = response
           this.id=response.id
-            this.dialogFormVisible1 = true
+          this.dialogFormVisible1 = true
         })
     },
     //编辑
@@ -522,7 +519,19 @@ export default {
         .then((response) => {
           this.companyList1 = response
           this.id=response.id
-            this.dialogFormVisible2 = true
+          if(response.mainBusinessType!=null){
+          this.companyList1.mainBusinessType=response.mainBusinessType.split(',')
+          }
+          if(response.label!=null){
+             this.companyList1.label=response.label.split(',')
+          }
+          else{
+             this.companyList1.label=[]
+          }
+          if(response.sitePhotoAddress!=null){
+          this.companyList1.sitePhotoAddress=response.sitePhotoAddress.split(',')
+          }
+          this.dialogFormVisible2 = true
         })
     },
     submit(id){
@@ -543,7 +552,7 @@ export default {
         })
         return
       }
-      if (!this.companyList1.mainBusinessType) {
+      if (this.companyList1.mainBusinessType.length<2) {
         this.$message({
           message: '至少选择一个主营类型',
           type: 'warning',
@@ -601,51 +610,20 @@ export default {
         })
         return
       }
-      // if (!this.companyList1.attachmentAddress) {
-      //   this.$message({
-      //     message: '封面照片不能为空!',
-      //     type: 'warning',
-      //   })
-      //   return
-      // }
-      // if (this.companyList1.attachmentAddress != 1) {
-      //   this.$message({
-      //     message: '封面照片只能一张!',
-      //     type: 'warning',
-      //   })
-      //   return
-      // }
-      // if (!this.companyList1.licenseAddress) {
-      //   this.$message({
-      //     message: '营业执照不能为空!',
-      //     type: 'warning',
-      //   })
-      //   return
-      // }
-      // if (this.companyList1.licenseAddress.length != 1) {
-      //   this.$message({
-      //     message: '营业执照只能一张!',
-      //     type: 'warning',
-      //   })
-      //   return
-      // }
-      if (
-        this.companyList1.companyContant.length > 300 ||
-        this.companyList1.companyContant.length < 0
-      ) {
+      if (!this.companyList1.attachmentAddress) {
         this.$message({
-          message: '企业概况0-300字',
+          message: '封面照片不能为空!',
+          type: 'warning',
+        })
+        return
+      }
+      if (!this.companyList1.licenseAddress) {
+        this.$message({
+          message: '营业执照不能为空!',
           type: 'warning',
         })
         return
       }
-      // if (this.companyList1.sitePhotoAddress.length > 9) {
-      //   this.$message({
-      //     message: '场地图片最多9张!',
-      //     type: 'warning',
-      //   })
-      //   return
-      // }
       if (
         this.companyList1.contacts > 10 ||
         this.companyList1.contacts < 2
@@ -666,17 +644,21 @@ export default {
         })
         return
       }
-      if (
-        this.companyList1.fax.length > 20 ||
-        this.companyList1.fax.length < 6
-      ) {
-        this.$message({
-          message: '传真输入错误',
-          type: 'warning',
-        })
-        return
-      }
+      // if (
+      //   this.companyList1.fax.length > 20 ||
+      //   this.companyList1.fax.length < 6
+      // ) {
+      //   this.$message({
+      //     message: '传真输入错误',
+      //     type: 'warning',
+      //   })
+      //   return
+      // }
       this.companyList1.id = id
+      this.companyList1.mainBusinessType=this.companyList1.mainBusinessType.toString()
+      console.log(this.companyList1.label,111)
+      this.companyList1.label=this.companyList1.label.toString()
+      console.log(this.companyList1.label,333)
       this.$confirm(`确定提交企业信息?`, {
         cancelButtonText: '取消',
         confirmButtonText: '确定',
@@ -691,6 +673,7 @@ export default {
                 message: '提交成功',
               })
               this.getList()
+              this.dialogFormVisible2 = false
             })
             .catch((response) => {
               EventBus.$emit('error', response.message)
@@ -834,7 +817,7 @@ export default {
     },
     //标签
     handleClose(tag) {
-      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
+      this.companyList1.label.splice(this.companyList1.label.indexOf(tag), 1)
     },
 
     showInput() {
@@ -845,9 +828,10 @@ export default {
     },
 
     handleInputConfirm() {
-      let label = this.label
+      let label = this.label;
       if (label) {
-        this.dynamicTags.push(label)
+        console.log(this.companyList1.label,11)
+        this.companyList1.label.push(label)
       }
       this.inputVisible = false
       this.label = ''
@@ -987,4 +971,27 @@ export default {
 .add{
   margin-left: 10%;
 }
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 178px;
+  height: 178px;
+  line-height: 178px;
+  text-align: center;
+}
+.avatar {
+  width: 178px;
+  height: 178px;
+  display: block;
+}
 </style>