Quellcode durchsuchen

新增沟通公共组件

damon227 vor 1 Jahr
Ursprung
Commit
731f4362fb

+ 9 - 1
src/views/modules/common/upload-component-v2.vue

@@ -84,6 +84,10 @@ export default {
       type: Boolean,
       default: true,
     },
+    value: {
+      type: Array,
+      default: () => []
+    }
   },
   watch: {
     fileList(newVal) {
@@ -100,6 +104,7 @@ export default {
       previewPath: "",
       previewName: "",
       previewVisible: false,
+      uploadFileList: [], //已经上传过的文件列表
     };
   },
   methods: {
@@ -117,7 +122,7 @@ export default {
         //需要return才会显示上传成功状态,不加return不好使
         // 开始上传
         const formData = new FormData();
-        formData.append("file", file.raw);
+        formData.append("file", file.file);
         uploadFiles(formData).then(({ data }) => {
           if (data && data.code === "200") {
             data.data.forEach((item) => {
@@ -125,7 +130,10 @@ export default {
                 (file) => file.name === item.originFileName
               );
               fileData.url = item.fileUrl;
+              this.uploadFileList.push(fileData);
             });
+
+            this.$emit('input', this.uploadFileList);
             this.$message.success("上传成功");
           } else {
             this.$message.error("上传失败");

+ 2 - 1
src/views/modules/common/upload-component.vue

@@ -108,6 +108,7 @@ export default {
   },
   methods: {
     handleUpload(file) {
+      console.log(file)
       function getBase64(file) {
         return new Promise((resolve, reject) => {
           const reader = new FileReader();
@@ -121,7 +122,7 @@ export default {
         //需要return才会显示上传成功状态,不加return不好使
         // 开始上传
         const formData = new FormData();
-        formData.append("file", file.raw);
+        formData.append("file", file.file);
         uploadFiles(formData).then(({ data }) => {
           if (data && data.code === "200") {
             data.data.forEach((item) => {

+ 57 - 16
src/views/modules/cus/communicate-add-or-update.vue

@@ -15,7 +15,7 @@
               :disabled="display"
               remote
               placeholder="请选择"
-              style="width:100%"
+              style="width: 100%"
             >
               <el-option
                 v-for="item in optionsCus"
@@ -56,7 +56,7 @@
               remote
               @change="typeChanged"
               placeholder="请选择"
-              style="width:100%"
+              style="width: 100%"
             >
               <el-option
                 v-for="item in options"
@@ -72,12 +72,20 @@
       <el-row class="my-row">
         <el-col :span="12">
           <el-form-item label="沟通主要内容" prop="content">
-            <el-input v-model="dataForm.content" :disabled="display" type="textarea"></el-input>
+            <el-input
+              v-model="dataForm.content"
+              :disabled="display"
+              type="textarea"
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="备注">
-            <el-input v-model="dataForm.notes" :disabled="display" type="textarea"></el-input>
+            <el-input
+              v-model="dataForm.notes"
+              :disabled="display"
+              type="textarea"
+            ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -85,7 +93,7 @@
         <el-col :span="12">
           <upload-component
             :display="display"
-            :displayStar=false
+            :displayStar="false"
             :title="'技术资料'"
             :accept="'*'"
             :file-obj-list="attachListTechnical"
@@ -95,7 +103,7 @@
         <el-col :span="12">
           <upload-component
             :display="display"
-            :displayStar=false
+            :displayStar="false"
             :title="'数模/图纸'"
             :accept="'*'"
             :file-obj-list="attachListDrawing"
@@ -103,11 +111,11 @@
           />
         </el-col>
       </el-row>
-      <el-row class="my-row" style="margin:10px 0">
+      <el-row class="my-row" style="margin: 10px 0">
         <el-col :span="12">
           <upload-component
             :display="display"
-            :displayStar=false
+            :displayStar="false"
             :title="'沟通表原件'"
             :accept="'*'"
             :file-obj-list="attachList"
@@ -117,7 +125,7 @@
         <el-col :span="12">
           <upload-component
             :display="display"
-            :displayStar=false
+            :displayStar="false"
             :title="'其他附件'"
             :accept="'*'"
             :file-obj-list="attachListOther"
@@ -258,6 +266,12 @@
               :show-tooltip-when-overflow="true"
               label="工单类型"
             >
+              <template slot-scope="scope">
+                <span>{{
+                  taskTypeOption.find((t) => t.value == scope.row.taskType)
+                    .label
+                }}</span>
+              </template>
             </el-table-column>
             <el-table-column
               prop="taskName"
@@ -273,6 +287,12 @@
               align="center"
               label="级别"
             >
+            <template slot-scope="scope">
+                <span>{{
+                  rankTypeOption.find((t) => t.value == scope.row.rank)
+                    .label
+                }}</span>
+              </template>
             </el-table-column>
             <el-table-column
               prop="content"
@@ -351,7 +371,11 @@
       >
     </span>
     <add-or-update v-if="inboundVisible" ref="inbound" @addItem="addItem" />
-    <worder-add-or-update v-if="worderVisible" ref="worder" />
+    <worder-add-or-update
+      v-if="worderVisible"
+      ref="worder"
+      @submit="addWorderItem"
+    />
   </div>
 </template>
 
@@ -383,14 +407,27 @@ export default {
       options: [],
       optionsCus: [],
       dataList: [],
-      attachListTechnical: [],//技术资料
-      attachListDrawing: [],//数模/图纸
-      attachList: [],//沟通表原件
-      attachListOther: [],//其他附件
+      attachListTechnical: [], //技术资料
+      attachListDrawing: [], //数模/图纸
+      attachList: [], //沟通表原件
+      attachListOther: [], //其他附件
       id: 0,
       cusRCommProductVOS: [],
       workInfoList: [],
       dataForm: {},
+      taskTypeOption: [
+        { label: "开始", value: "start" },
+        { label: "生产", value: "produce" },
+        { label: "检验", value: "check" },
+        { label: "总检", value: "t-check" },
+        { label: "结束", value: "end" },
+        { label: "常规", value: "routine" },
+      ],
+      rankTypeOption: [
+        { label: "普通", value: 1 },
+        { label: "紧急", value: 2 },
+        { label: "加急", value: 3 },
+      ],
       dataRule: {
         cusId: [
           { required: true, message: "客户名称不能为空", trigger: "blur" },
@@ -537,6 +574,10 @@ export default {
         });
       }
     },
+    //添加工单
+    addWorderItem(item) {
+      this.workInfoList.push({ ...item });
+    },
     uploadSuccessTechnical(fileList) {
       this.attachListTechnical = fileList;
     },
@@ -559,12 +600,12 @@ export default {
         1
       );
     },
-    worderAdd (){
+    worderAdd() {
       this.worderVisible = true;
       this.$nextTick(() => {
         this.$refs.worder.init();
       });
-    }
+    },
   },
 };
 </script>

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

@@ -114,13 +114,13 @@
         <el-row class="my-row"> </el-row>
         <el-row class="my-row">
           <el-col :span="24">
-            <el-form-item label="工单附件" prop="attchList">
+            <el-form-item label="工单附件" prop="attachList">
               <upload-component-v2
                 :display="display"
                 :displayStar="true"
                 :title="'工单附件'"
                 :accept="'*'"
-                :file-obj-list="attachList"
+                v-model="dataForm.attachList"
                 @uploadSuccess="uploadSuccess"
               />
             </el-form-item>
@@ -150,6 +150,7 @@ export default {
       bizType: 1,
       dataForm: {},
       attachList: [],
+      attachListV2: [],
       userList: [],
       taskTypeOption: [
         { label: "开始", value: "start" },
@@ -186,6 +187,9 @@ export default {
         receiver: [
           { required: true, message: "请输入工单任务接收人", trigger: "blur" },
         ],
+        attachList: [
+          { required: true, message: "请上传附件", trigger: "blur" },
+        ],
       },
     };
   },
@@ -208,7 +212,7 @@ export default {
       this.$refs["dataForm"].validate((valid) => {
         if (valid) {
           this.visible = false;
-          this.$emit("addItem", this.dataForm);
+          this.$emit("submit", this.dataForm);
         }
       });
     },