xiaodai2022 2 年之前
父節點
當前提交
d21e224ec0

+ 10 - 0
src/utils/validate.js

@@ -516,3 +516,13 @@ export function hasSpace(s) {
   const str2 = s.replace(/[\r\n]/g, "");
   return !(str2 === s);
 }
+//营业执照成立日期大写转小写
+export function invTime(s) {
+  let str = ["年", "月", "日"];
+  let si = s.replace(/[\r\n]/g, "").replace(/\s/g, "");
+  for (let i = 0; i < str.length; i++) {
+    si = si.replace(str[i], i == 2 ? "" : "-");
+  }
+  let arr = si.split("-");
+  return arr;
+}

+ 85 - 177
src/views/serviceParam/supplier/components/addEdit.vue

@@ -19,14 +19,13 @@
           <el-form
             ref="ruleForm"
             :model="ruleForm"
-            status-icon
-            :size="'small'"
+            size="mini"
             :rules="rulesThis"
             label-width="90px"
             class="demo-ruleForm"
           >
             <el-row style="">
-              <el-col :span="1" style="height: 336px; border-right: 1px solid #dcdfe6">
+              <el-col :span="1" style="height: 258px; border-right: 1px solid #dcdfe6">
                 <ul class="tc fff">
                   <li>企</li>
                   <li>业</li>
@@ -36,117 +35,74 @@
               </el-col>
               <el-col :span="23">
                 <el-row>
-                  <el-col :span="13">
-                    <el-form-item label="企业名称" prop="company">
-                      <el-input
-                        placeholder="企业名称"
-                        filterable
-                        :disabled="isDetail == '007'"
-                        maxlength="100"
-                        clearable
-                        v-model="ruleForm.company"
-                      />
-                    </el-form-item>
-                  </el-col>
-                  <el-col :span="11"
-                    ><el-form-item
-                      label="统一社会信用代码"
-                      prop="inv_code"
-                      label-width="150px"
-                      style="width: 100%"
-                    >
-                      <el-input
-                        placeholder="统一社会信用代码"
-                        filterable
-                        :disabled="isDetail == '007'"
-                        maxlength="40"
-                        clearable
-                        v-model="ruleForm.inv_code"
-                      />
-                    </el-form-item>
-                  </el-col>
-
-                  <el-col :span="11">
+                  <el-col :span="4">
                     <el-form-item label="法人" prop="inv_legaler">
-                      <el-input
-                        placeholder="法人"
-                        v-model="ruleForm.inv_legaler"
-                        maxlength="12"
-                        minlength="2"
-                        clearable
-                        :disabled="isDetail == '007'"
-                      /> </el-form-item
-                  ></el-col>
-                  <el-col :span="13">
-                    <el-form-item label="成立日期" prop="inv_time">
-                      <el-date-picker
-                        style="width: 100%"
-                        v-model="ruleForm.inv_time"
-                        align="right"
-                        type="date"
-                        placeholder="成立日期"
-                        value-format="yyyy-MM-dd"
-                        :picker-options="pickerOptions"
-                      >
-                      </el-date-picker>
-                    </el-form-item>
-                  </el-col>
-                  <el-col :span="11">
-                    <el-form-item label="公司类型" prop="type">
-                      <search-company-type
-                        :value="ruleForm.type"
-                        :disabled="false"
-                        :size="'mini'"
-                        :isDetail="false"
-                        :placeholder="'公司类型'"
-                        @searchChange="type_search_change"
-                      /> </el-form-item
-                  ></el-col>
-
-                  <el-col :span="11" style="height: 124px">
+                      {{ ruleForm.inv_legaler }}</el-form-item
+                    ></el-col
+                  >
+                  <el-col :span="4">
                     <el-form-item
                       label="营业执照"
                       prop="license_img"
                       class="activity-upload"
                     >
-                      <div class="btnupload" style="position: relative">
+                      <div
+                        class="btnupload"
+                        style="position: relative; width: 28px; height: 28px"
+                      >
                         <img
                           v-if="ruleForm.license_img"
                           :src="ruleForm.license_img"
+                          v-viewer
                           class="avatar"
                         />
-                        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-                        <file-upload
-                          class="Upload"
-                          :disabled="isDetail == '007'"
-                          :accept="'.jpg,.png,.jpeg'"
-                          :multiple="true"
-                          :uploadcondition="beforeAvatarUpload"
-                          @UploadErrorEvent="UploadErrorEvent"
-                          @UploadSuccessEvent="UploadSuccessEvent"
-                        ></file-upload>
-                      </div>
-                      <div class="txt-tips fl">
-                        <p>大小:小于1M</p>
-                        <p>尺寸:100*100</p>
-                        <p>类型:jpg.png.jpeg</p>
                       </div>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="13">
-                    <el-form-item label="详细地址" prop="inv_addr">
-                      <el-input
-                        placeholder="详细地址"
-                        v-model="ruleForm.inv_addr"
-                        maxlength="100"
-                        clearable
-                        :disabled="isDetail == '007'"
-                      >
-                      </el-input>
+                  <el-col :span="16">
+                    <el-form-item label="企业名称" prop="company">
+                      {{ ruleForm.company }}
                     </el-form-item>
                   </el-col>
 
-                  <el-col :span="11">
+                  <el-col :span="24">
+                    <el-row>
+                      <el-col :span="8"
+                        ><el-form-item
+                          label="纳税识别号"
+                          prop="inv_code"
+                          label-width="100px"
+                          style="width: 100%"
+                        >
+                          {{ ruleForm.inv_code }}
+                        </el-form-item>
+                      </el-col>
+                      <el-col :span="7">
+                        <el-form-item label="成立日期" prop="inv_time">
+                          {{ ruleForm.inv_time }}
+                        </el-form-item>
+                      </el-col>
+
+                      <el-col :span="9">
+                        <el-form-item label="公司类型" prop="type">
+                          <search-company-type
+                            :value="ruleForm.type"
+                            :disabled="false"
+                            :size="'mini'"
+                            :isDetail="false"
+                            :placeholder="'公司类型'"
+                            @searchChange="type_search_change"
+                          /> </el-form-item
+                      ></el-col>
+                    </el-row>
+                  </el-col>
+
+                  <el-col :span="18">
+                    <el-form-item label="详细地址" prop="inv_addr">
+                      {{ ruleForm.inv_addr }}
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="6">
                     <el-form-item label="联系人" prop="contactor">
                       <el-input
                         placeholder="联系人"
@@ -157,14 +113,15 @@
                         :disabled="isDetail == '007'"
                       /> </el-form-item
                   ></el-col>
-                  <el-col :span="13">
+
+                  <el-col :span="24">
                     <el-form-item label="营业范围" prop="inv_scope">
                       <el-input
                         v-model="ruleForm.inv_scope"
                         type="textarea"
                         placeholder="营业范围"
                         maxlength="2000"
-                        :rows="8"
+                        :rows="5"
                         show-word-limit
                         :disabled="isDetail == '007'"
                       />
@@ -193,7 +150,7 @@
               <el-col :span="23" style="padding: 20px 0 0 0">
                 <el-row>
                   <el-col :span="13">
-                    <el-form-item label="银行名称" prop="inv_bank">
+                    <el-form-item size="medium" label="银行名称" prop="inv_bank">
                       <el-input
                         v-model="ruleForm.inv_bank"
                         placeholder="银行名称"
@@ -203,7 +160,7 @@
                     </el-form-item>
                   </el-col>
                   <el-col :span="11">
-                    <el-form-item label="银行卡号" prop="inv_bankNo">
+                    <el-form-item size="medium" label="银行卡号" prop="inv_bankNo">
                       <el-input
                         v-model="ruleForm.inv_bankNo"
                         placeholder="银行卡号"
@@ -214,7 +171,7 @@
                   </el-col>
 
                   <el-col :span="13">
-                    <el-form-item label="联系地址" prop="addr">
+                    <el-form-item size="medium" label="联系地址" prop="addr">
                       <el-input
                         v-model="ruleForm.addr"
                         placeholder="联系地址"
@@ -224,7 +181,7 @@
                     </el-form-item>
                   </el-col>
                   <el-col :span="11">
-                    <el-form-item label="联系电话" prop="mobile">
+                    <el-form-item size="medium" label="联系电话" prop="mobile">
                       <el-input
                         v-model="ruleForm.mobile"
                         placeholder="联系电话"
@@ -266,6 +223,7 @@ import {
   isSpecialSymbol,
   hasSpace,
   isAddr,
+  invTime,
 } from "@/utils/validate";
 export default {
   name: "workCompany",
@@ -275,12 +233,12 @@ export default {
     const validateLicense = (rule, value, callback) => {
       if (value !== "") {
         if (!isLicense(value)) {
-          callback(new Error("统一社会信用代码不正确!"));
+          callback(new Error("纳税识别号不正确!"));
         } else {
           callback();
         }
       } else {
-        callback(new Error("统一社会信用代码不能为空!"));
+        callback(new Error("纳税识别号不能为空!"));
       }
     };
     const validatemobile = (rule, value, callback) => {
@@ -464,50 +422,42 @@ export default {
       this.loading = false;
     },
     type_search_change(e) {
-      console.log(e);
-      const { id, code, label } = e;
-      if (id) {
-        this.ruleForm.type = id;
-      } else {
-        this.ruleForm.type = "";
-      }
+      const { id } = e;
+      this.ruleForm.type = id || "";
       this.$refs.ruleForm.validateField("type");
     },
 
     async initData() {
-      const res = await asyncRequest.detail({ companyNo: this.id });
+      const { code } = this.sitem;
+      const res = await asyncRequest.detail({ code });
       if (res && res.code === 0 && res.data) {
         const {
           id,
-          company, //公司名称
-          type, //	公司类型
-          inv_code, //	纳税识别号
-          inv_legaler, //	法人
-          inv_time, //注册日期
-          inv_addr, //注册地址
-          inv_bank, //	银行
-          inv_bankNo, //	银行账户
+          name, //公司名称
+          nature, //	公司类型
+          registercode, //	纳税识别号
+          legaler, //	法人
+          registertime, //注册日期
           contactor, //		联系人
-          mobile, //	联系人电话
           addr, //		联系地址
-          inv_scope, //	经营范围
+          scope, //	经营范围
           license_img, //	营业执照
         } = res.data;
-
+        console.log(invTime(registertime));
         this.ruleForm = {
           id: id || "",
-          company: company || "", //公司名称
-          type: type || "", //	公司类型
-          inv_code: inv_code || "", //	纳税识别号
-          inv_legaler: inv_legaler || "", //	法人
-          inv_time: inv_time || "", //注册日期
-          inv_addr: inv_addr || "", //注册地址
-          inv_bank: inv_bank || "", //	银行
-          inv_bankNo: inv_bankNo || "", //	银行账户
+          company: name || "", //公司名称
+          type: nature || "", //	公司类型
+          inv_code: registercode || "", //	纳税识别号
+          inv_legaler: legaler || "", //	法人
+          inv_time: registertime || "", //注册日期
+          inv_addr: addr || "", //注册地址
+          inv_bank: "", //	银行
+          inv_bankNo: "", //	银行账户
           contactor: contactor || "", //		联系人
-          mobile: mobile || "", //	联系人电话
-          addr: addr || "", //		联系地址
-          inv_scope: inv_scope || "", //	经营范围
+          mobile: "", //	联系人电话
+          addr: "", //		联系地址
+          inv_scope: scope || "", //	经营范围
           license_img: license_img || "", //	营业执照
         };
         console.log(this.ruleForm);
@@ -579,48 +529,6 @@ export default {
         }
       });
     },
-    //判断图片规格
-    beforeAvatarUpload(file) {
-      let isJPG = false,
-        isLt2M = false;
-      if (file) {
-        if (
-          file.type === "image/jpg" ||
-          file.type === "image/png" ||
-          file.type === "image/jpeg"
-        ) {
-          isJPG = true;
-        }
-        isLt2M = file.size / 1024 / 1024 < 1;
-        if (!isJPG) {
-          this.$message.error("图片格式不正确!");
-        }
-        if (!isLt2M) {
-          this.$message.error("图片大小不能超过 1MB!");
-        }
-      }
-
-      return isJPG && isLt2M;
-    },
-    //图片上传失败
-    UploadErrorEvent(res) {
-      if (res !== "break") {
-        this.$message.error("图片上传失败!");
-        this.ruleForm.license_img = "";
-        this.$refs.ruleForm.validateField("license_img");
-      }
-    },
-    //图片上传成功
-    async UploadSuccessEvent(data) {
-      const { url } = data;
-      if (url === "noToken") {
-        await this.logout();
-      } else {
-        this.ruleForm.license_img = url;
-        this.$message.success("图片上传成功!");
-        this.$refs.ruleForm.validateField("license_img");
-      }
-    },
   },
 };
 </script>

+ 0 - 1
src/views/serviceParam/supplier/components/baseForm.vue

@@ -700,7 +700,6 @@ export default {
             return;
           }
           this.loading = true;
-
           let model = JSON.parse(JSON.stringify(this.ruleForm));
           model.prove_img = model.prove_img.toString();
           model.personid = model.personid.toString();