Quellcode durchsuchen

上传组件v2版本;新增沟通

damon227 vor 2 Jahren
Ursprung
Commit
cb9496d982

+ 7 - 6
src/views/modules/common/upload-component-v2.vue

@@ -86,8 +86,8 @@ export default {
     },
     value: {
       type: Array,
-      default: () => []
-    }
+      default: () => [],
+    },
   },
   watch: {
     fileList(newVal) {
@@ -126,14 +126,15 @@ export default {
         uploadFiles(formData).then(({ data }) => {
           if (data && data.code === "200") {
             data.data.forEach((item) => {
-              let fileData = this.fileList.find(
-                (file) => file.name === item.originFileName
-              );
+              let fileData = this.fileList.find((file) => {
+                file.name === item.originFileName;
+                file.fileName === item.originFileName;
+              });
               fileData.url = item.fileUrl;
               this.uploadFileList.push(fileData);
             });
 
-            this.$emit('input', this.uploadFileList);
+            this.$emit("input", this.uploadFileList);
             this.$message.success("上传成功");
           } else {
             this.$message.error("上传失败");

+ 122 - 75
src/views/modules/cus/communicate-add-or-update.vue

@@ -91,50 +91,54 @@
       </el-row>
       <el-row class="my-row">
         <el-col :span="12">
-          <upload-component
-            :display="display"
-            :displayStar="false"
-            :title="'技术资料'"
-            :accept="'*'"
-            :file-obj-list="attachListTechnical"
-            @uploadSuccess="uploadSuccessTechnical"
-          />
+          <el-form-item label="技术资料" prop="attachListTechnical">
+            <upload-component
+              :display="display"
+              :displayStar="false"
+              :accept="'*'"
+              v-model="dataForm.attachListTechnical"
+              @uploadSuccess="uploadSuccessTechnical"
+            />
+          </el-form-item>
         </el-col>
         <el-col :span="12">
-          <upload-component
-            :display="display"
-            :displayStar="false"
-            :title="'数模/图纸'"
-            :accept="'*'"
-            :file-obj-list="attachListDrawing"
-            @uploadSuccess="uploadSuccessDrawing"
-          />
+          <el-form-item label="数模/图纸" prop="attachListDrawing">
+            <upload-component
+              :display="display"
+              :displayStar="false"
+              :accept="'*'"
+              v-model="dataForm.attachListDrawing"
+              @uploadSuccess="uploadSuccessDrawing"
+            />
+          </el-form-item>
         </el-col>
       </el-row>
-      <el-row class="my-row" style="margin: 10px 0">
+      <el-row class="my-row">
         <el-col :span="12">
-          <upload-component
-            :display="display"
-            :displayStar="false"
-            :title="'沟通表原件'"
-            :accept="'*'"
-            :file-obj-list="attachList"
-            @uploadSuccess="uploadSuccess"
-          />
+          <el-form-item label="沟通表原件" prop="attachList">
+            <upload-component
+              :display="display"
+              :displayStar="false"
+              :accept="'*'"
+              v-model="dataForm.attachList"
+              @uploadSuccess="uploadSuccess"
+            />
+          </el-form-item>
         </el-col>
         <el-col :span="12">
-          <upload-component
-            :display="display"
-            :displayStar="false"
-            :title="'其他附件'"
-            :accept="'*'"
-            :file-obj-list="attachListOther"
-            @uploadSuccess="uploadSuccessOther"
-          />
+          <el-form-item label="其他附件" prop="attachListOther">
+            <upload-component
+              :display="display"
+              :displayStar="false"
+              :accept="'*'"
+              v-model="dataForm.attachListOther"
+              @uploadSuccess="uploadSuccessOther"
+            />
+          </el-form-item>
         </el-col>
       </el-row>
-      <div v-show="detailVisible">
-        <div class="title"><span style="color: red">*</span> 沟通物料明细</div>
+      <div>
+        <div class="title">沟通物料明细</div>
         <el-row>
           <el-table :data="cusRCommProductVOS" border style="width: 100%">
             <el-table-column
@@ -247,8 +251,8 @@
           ></el-button>
         </el-row>
       </div>
-      <div v-show="detailVisible">
-        <div class="title"><span style="color: red">*</span> 任务工单派发</div>
+      <div>
+        <div class="title">任务工单派发</div>
         <el-row>
           <el-table :data="workInfoList" border style="width: 100%">
             <el-table-column
@@ -262,15 +266,12 @@
               prop="taskType"
               header-align="center"
               align="center"
-              min-width="120"
-              :show-tooltip-when-overflow="true"
+              min-width="100"
+              width="120"
               label="工单类型"
             >
               <template slot-scope="scope">
-                <span>{{
-                  taskTypeOption.find((t) => t.value == scope.row.taskType)
-                    .label
-                }}</span>
+                <span>{{ scope.row.taskTypeName }}</span>
               </template>
             </el-table-column>
             <el-table-column
@@ -285,13 +286,11 @@
               prop="rank"
               header-align="center"
               align="center"
+              width="120"
               label="级别"
             >
-            <template slot-scope="scope">
-                <span>{{
-                  rankTypeOption.find((t) => t.value == scope.row.rank)
-                    .label
-                }}</span>
+              <template slot-scope="scope">
+                <span>{{ scope.row.rankTypeName }}</span>
               </template>
             </el-table-column>
             <el-table-column
@@ -299,33 +298,44 @@
               header-align="center"
               align="center"
               min-width="100"
-              width="150"
               label="工单内容"
+              :show-tooltip-when-overflow="true"
             >
             </el-table-column>
             <el-table-column
               prop="receiver"
               header-align="center"
               align="center"
-              min-width="100"
               width="150"
               label="任务接收人"
             >
+              <template slot-scope="scope">
+                <span>{{ scope.row.receiverName }}</span>
+              </template>
             </el-table-column>
             <el-table-column
               prop="attachList"
               header-align="center"
               align="center"
-              min-width="100"
               width="150"
               label="任务附件"
             >
+              <template slot-scope="scope">
+                <el-button
+                  :disabled="
+                    !scope.row.attachList || scope.row.attachList.length === 0
+                  "
+                  type="text"
+                  size="small"
+                  @click="attachDetails(scope.row.attachList)"
+                  >查看</el-button
+                >
+              </template>
             </el-table-column>
             <el-table-column
               prop="notes"
               header-align="center"
               align="center"
-              min-width="180"
               :show-tooltip-when-overflow="true"
               label="备注"
             >
@@ -376,6 +386,7 @@
       ref="worder"
       @submit="addWorderItem"
     />
+    <attach-detail-dialog ref="attachDetail" @onChose="onChose" />
   </div>
 </template>
 
@@ -383,12 +394,18 @@
 // import templateChose from '../product/template-chose'
 import { getCustomer, getCoDetail } from "@/api/cus";
 import { getDictList } from "@/api/dict";
-import uploadComponent from "../common/upload-component";
+import uploadComponent from "../common/upload-component-v2";
 import AddOrUpdate from "../product/template-add-or-update";
 import WorderAddOrUpdate from "../worder/add-or-update";
+import AttachDetailDialog from "../common/attach-detail-dialog";
 export default {
   name: "communicate-add-or-update",
-  components: { AddOrUpdate, uploadComponent, WorderAddOrUpdate },
+  components: {
+    AddOrUpdate,
+    uploadComponent,
+    WorderAddOrUpdate,
+    AttachDetailDialog,
+  },
   computed: {
     orgId: {
       get() {
@@ -401,6 +418,7 @@ export default {
       inboundVisible: false,
       detailVisible: false,
       worderVisible: false,
+      attachVisible: false,
       visible: false,
       display: false,
       dictType: "material_type",
@@ -435,7 +453,16 @@ export default {
         coType: [
           { required: true, message: "沟通类别不能为空", trigger: "change" },
         ],
-        name: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
+        contact: [
+          { required: true, message: "联系人不能为空", trigger: "blur" },
+        ],
+        contactTel: [
+          { required: true, message: "联系电话不能为空", trigger: "blur" },
+        ],
+        way: [{ required: true, message: "沟通方式不能为空", trigger: "blur" }],
+        content: [
+          { required: true, message: "沟通内容不能为空", trigger: "blur" },
+        ],
       },
     };
   },
@@ -443,7 +470,7 @@ export default {
     "dataForm.cusId"(value) {
       this.optionsCus.forEach((v) => {
         if (v.customerId === value) {
-          this.dataForm.name = v.contact;
+          this.dataForm.contact = v.contact;
         }
       });
     },
@@ -451,10 +478,15 @@ export default {
   methods: {
     onChose() {
       this.$emit("onChose");
+      this.inboundVisible = false;
+      this.detailVisible = false;
+      this.worderVisible = false;
+      this.attachVisible = false;
     },
     async init(id, display) {
       this.dataForm = {};
       this.cusRCommProductVOS = [];
+      this.workInfoList = [];
       this.visible = true;
       this.id = id || 0;
       this.display = display;
@@ -491,6 +523,11 @@ export default {
               this.addItem(item);
             });
           }
+          if (data.data.workInfoList) {
+            data.data.workInfoList.forEach((item) => {
+              this.addWorderItem(item);
+            });
+          }
         }
       });
     },
@@ -501,25 +538,26 @@ export default {
           // 添加附件
           let fList = this.fileList;
           // console.log('fileList = ' + fList)
-          if (fList.length > 0) {
-            this.dataForm.attachList = [];
-            for (let i = 0; i < fList.length; i++) {
-              this.dataForm.attachList.push({
-                fileName: fList[i].name,
-                url: fList[i].url,
-              });
-            }
-          } else {
-            this.$message.error("请上传文件");
-            return;
-          }
-          if (this.dataForm.coType === "1") {
-            if (this.cusRCommProductVOS.length === 0) {
-              this.$message.error("请选择订单产品明细");
-              return;
-            }
-            this.dataForm.cusRCommProductVOS = this.cusRCommProductVOS;
-          }
+          // if (fList.length > 0) {
+          //   this.dataForm.attachList = [];
+          //   for (let i = 0; i < fList.length; i++) {
+          //     this.dataForm.attachList.push({
+          //       fileName: fList[i].name,
+          //       url: fList[i].url,
+          //     });
+          //   }
+          // } else {
+          //   this.$message.error("请上传文件");
+          //   return;
+          // }
+          // if (this.dataForm.coType === "1") {
+          //   if (this.cusRCommProductVOS.length === 0) {
+          //     this.$message.error("请选择订单产品明细");
+          //     return;
+          //   }
+          // }
+          this.dataForm.cusRCommProductVOS = this.cusRCommProductVOS;
+          this.dataForm.workInfoList = this.workInfoList;
           this.$http({
             url: !this.id
               ? this.$http.adornUrl(`/biz-service/cusCommunication/save`)
@@ -576,6 +614,7 @@ export default {
     },
     //添加工单
     addWorderItem(item) {
+      console.log(item);
       this.workInfoList.push({ ...item });
     },
     uploadSuccessTechnical(fileList) {
@@ -606,6 +645,14 @@ export default {
         this.$refs.worder.init();
       });
     },
+    attachDetails(attachList) {
+      console.log(22222222222);
+      console.log(attachList);
+      attachList.forEach((item) => {
+        item.fileName = item.name;
+      });
+      this.$refs.attachDetail.init(attachList);
+    },
   },
 };
 </script>

+ 6 - 3
src/views/modules/worder/add-or-update.vue

@@ -115,7 +115,7 @@
         <el-row class="my-row">
           <el-col :span="24">
             <el-form-item label="工单附件" prop="attachList">
-              <upload-component-v2
+              <upload-component
                 :display="display"
                 :displayStar="true"
                 :title="'工单附件'"
@@ -136,11 +136,11 @@
 </template>
 
 <script>
-import uploadComponentV2 from "../common/upload-component-v2";
+import uploadComponent from "../common/upload-component-v2";
 import { getUserList } from "@/api/user";
 export default {
   name: "worder-add-or-update",
-  components: { uploadComponentV2 },
+  components: { uploadComponent },
   data() {
     return {
       id: 0,
@@ -212,6 +212,9 @@ export default {
       this.$refs["dataForm"].validate((valid) => {
         if (valid) {
           this.visible = false;
+          this.dataForm.taskTypeName = this.taskTypeOption.find(t => t.value == this.dataForm.taskType).label;
+          this.dataForm.rankTypeName = this.rankTypeOption.find(t => t.value == this.dataForm.rank).label;
+          this.dataForm.receiverName = this.userList.find(t => t.userId == this.dataForm.receiver).name;
           this.$emit("submit", this.dataForm);
         }
       });