Browse Source

修改必填项

Qukatie 1 week ago
parent
commit
1ed9791756
2 changed files with 64 additions and 31 deletions
  1. 26 1
      src/components/uploadFile/index.vue
  2. 38 30
      src/views/claimSettlement/detailsPage.vue

+ 26 - 1
src/components/uploadFile/index.vue

@@ -77,12 +77,33 @@ export default {
         columnBtn: false,
         column: [
           {
-            label: "原始文件名",
+            label: "文件名",
             prop: "fileName",
             cell: true,
             overHidden: true,
           },
           {
+            label: "文件属性",
+            prop: "fileProperties",
+            overHidden: true,
+            cell: true,
+            type: 'select',
+            dicData:[{
+              label:'鼓包并向照片',
+              value:1
+            },{
+              label:'轮胎DOT',
+              value:2
+            },{
+              label:'花纹深度',
+              value:3
+            },{
+              label:'鼓包处照片',
+              value:4
+            }],
+            hide:!this.filePropertiesHide
+          },
+          {
             label: "文件地址",
             prop: "fileUrl",
             // cell: true,
@@ -128,6 +149,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    filePropertiesHide: {
+      type: Boolean,
+      default: false,
+    },
   },
   created() {},
   methods: {

+ 38 - 30
src/views/claimSettlement/detailsPage.vue

@@ -56,12 +56,13 @@
       <trade-card title="基础信息">
         <avue-form :option="optionForm" v-model="form" ref="form"> </avue-form>
       </trade-card>
-      <trade-card title="文件中心">
+      <trade-card title="相应图片信息">
         <upload-file
           :data="form.claimAttachmentList"
           :disabled="editDis"
           @upDate="upDate"
           :isImage="true"
+          :filePropertiesHide="true"
         ></upload-file>
       </trade-card>
       <trade-card title="反馈表">
@@ -132,10 +133,6 @@ export default {
           {
             label: "电话",
             prop: "consumerPhone",
-          },
-          {
-            label: "胎号",
-            prop: "tyreNo",
             rules: [
               {
                 required: true,
@@ -145,6 +142,10 @@ export default {
             ],
           },
           {
+            label: "胎号",
+            prop: "tyreNo",
+          },
+          {
             label: "车牌号",
             prop: "vehicleNumber",
             rules: [
@@ -165,13 +166,6 @@ export default {
             type: "number",
             controls: false,
             precision: 0,
-            rules: [
-              {
-                required: true,
-                message: " ",
-                trigger: "blur",
-              },
-            ],
           },
           {
             label: "购买日期",
@@ -231,13 +225,6 @@ export default {
             type: "textarea",
             span: 12,
             minRows: 2,
-            rules: [
-              {
-                required: true,
-                message: " ",
-                trigger: "blur",
-              },
-            ],
           },
           {
             label: "备注",
@@ -436,10 +423,22 @@ export default {
             if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
               return this.$message.error("请输入正确电话");
             }
-            if (this.form.claimAttachmentList.length == 0) return this.$message.error("请上传车辆整体照片");
-            if (this.form.claimAttachmentList.length == 1) return this.$message.error("请上传轮胎DOT");
-            if (this.form.claimAttachmentList.length == 2) return this.$message.error("请上传花纹深度");
-            if (this.form.claimAttachmentList.length == 3) return this.$message.error("请上传鼓包处照片");
+            if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 1).length > 1) {
+              return this.$message.error("只能上传一张鼓包并向照片");
+            }
+            
+            if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 2).length == 0) {
+              return this.$message.error("请上传轮胎DOT");
+            }
+            if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 2).length > 1) {
+              return this.$message.error("只能上传一张轮胎DOT");
+            }
+            if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 3).length > 1) {
+              return this.$message.error("只能上传一张花纹深度");
+            }
+            if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 4).length > 1) {
+              return this.$message.error("只能上传一张鼓包处照片");
+            }
             submit(this.form);
             this.$confirm("是否提交审批?", "提示", {
               confirmButtonText: "确定",
@@ -486,13 +485,22 @@ export default {
           if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.form.consumerPhone)) {
             return this.$message.error("请输入正确电话");
           }
-          if (this.form.claimAttachmentList.length == 0) return this.$message.error("请上传车辆整体照片");
-          if (this.form.claimAttachmentList.length == 1) return this.$message.error("请上传轮胎DOT");
-          if (this.form.claimAttachmentList.length == 2) return this.$message.error("请上传花纹深度");
-          if (this.form.claimAttachmentList.length == 3) return this.$message.error("请上传鼓包处照片");
-          this.form.claimAttachmentList.forEach((item, index) => {
-            item.fileProperties = index + 1;
-          });
+          if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 1).length > 1) {
+            return this.$message.error("只能上传一张鼓包并向照片");
+          }
+          if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 2).length == 0) {
+            return this.$message.error("请上传轮胎DOT");
+          }
+          if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 2).length > 1) {
+            return this.$message.error("只能上传一张轮胎DOT");
+          }
+          if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 3).length > 1) {
+            return this.$message.error("只能上传一张花纹深度");
+          }
+          if (this.form.claimAttachmentList.filter((item) => item.fileProperties == 4).length > 1) {
+            return this.$message.error("只能上传一张鼓包处照片");
+          }
+
           const loading = this.$loading({
             lock: true,
             text: "加载中",