Browse Source

沟通-详情、编辑:完成

damon227 1 year ago
parent
commit
7a012681b8

+ 14 - 0
src/utils/enums.js

@@ -0,0 +1,14 @@
+export const taskTypeOption = [
+    { label: '开始', value: 'start' },
+    { label: '生产', value: 'produce' },
+    { label: '检验', value: 'check' },
+    { label: '总检', value: 't-check' },
+    { label: '结束', value: 'end' },
+    { label: '常规', value: 'routine' }
+]
+
+export const rankTypeOption = [
+    { label: '普通', value: '1' },
+    { label: '紧急', value: '2' },
+    { label: '加急', value: '3' }
+]

+ 5 - 0
src/views/modules/common/upload-component-v2.vue

@@ -95,6 +95,11 @@ export default {
     },
     fileObjList (newVal) {
       this.fileList = newVal
+    },
+    value (newVal) {
+      if (newVal) {
+        this.fileList = this.uploadFileList = newVal
+      }
     }
   },
   data () {

+ 44 - 29
src/views/modules/cus/communicate-add-or-update.vue

@@ -271,7 +271,11 @@
               label="工单类型"
             >
               <template slot-scope="scope">
-                <span>{{ scope.row.taskTypeName }}</span>
+                <span>{{
+                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1 
+                ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
+                : ''
+              }}</span>
               </template>
             </el-table-column>
             <el-table-column
@@ -290,7 +294,11 @@
               label="级别"
             >
               <template slot-scope="scope">
-                <span>{{ scope.row.rankTypeName }}</span>
+                 <span>{{
+                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1 
+                ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
+                : ''
+              }}</span>
               </template>
             </el-table-column>
             <el-table-column
@@ -314,7 +322,7 @@
               </template>
             </el-table-column>
             <el-table-column
-              prop="attachList"
+              prop="attachListVo"
               header-align="center"
               align="center"
               width="150"
@@ -323,11 +331,11 @@
               <template slot-scope="scope">
                 <el-button
                   :disabled="
-                    !scope.row.attachList || scope.row.attachList.length === 0
+                    !scope.row.attachListVo || scope.row.attachListVo.length === 0
                   "
                   type="text"
                   size="small"
-                  @click="attachDetails(scope.row.attachList)"
+                  @click="attachDetails(scope.row.attachListVo)"
                   >查看</el-button
                 >
               </template>
@@ -395,9 +403,10 @@
 import { getCustomer, getCoDetail } from '@/api/cus'
 import { getDictList } from '@/api/dict'
 import uploadComponent from '../common/upload-component-v2'
-import AddOrUpdate from '../product/template-add-or-update'
+import AddOrUpdate from '../product/template-add-or-update-v2'
 import WorderAddOrUpdate from '../worder/add-or-update'
 import AttachDetailDialog from '../common/attach-detail-dialog'
+import { taskTypeOption, rankTypeOption } from '@/utils/enums'
 export default {
   name: 'communicate-add-or-update',
   components: {
@@ -433,19 +442,8 @@ export default {
       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 }
-      ],
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption,
       dataRule: {
         cusId: [
           { required: true, message: '客户名称不能为空', trigger: 'blur' }
@@ -510,14 +508,30 @@ export default {
             this.detailVisible = false
           }
           // 附件显示
-          this.fileList = []
-          data.data.attachList.forEach((item) => {
-            this.fileList.push({
-              name: item.fileName,
-              url: item.url,
-              id: item.url
+          if (this.dataForm.attachListTechnical) {
+            this.dataForm.attachListTechnical.forEach((item) => {
+              item.name = item.fileName
+              item.id = item.url
             })
-          })
+          }
+          if (this.dataForm.attachListDrawing) {
+            this.dataForm.attachListDrawing.forEach((item) => {
+              item.name = item.fileName
+              item.id = item.url
+            })
+          }
+          if (this.dataForm.attachList) {
+            this.dataForm.attachList.forEach((item) => {
+              item.name = item.fileName
+              item.id = item.url
+            })
+          }
+          if (this.dataForm.attachListOther) {
+            this.dataForm.attachListOther.forEach((item) => {
+              item.name = item.fileName
+              item.id = item.url
+            })
+          }
           if (data.data.cusRCommProductVOS) {
             data.data.cusRCommProductVOS.forEach((item) => {
               this.addItem(item)
@@ -655,14 +669,15 @@ export default {
     },
     updateWorderHandle (row) {
       this.worderVisible = true
+      row.attachList = row.attachListVo
       this.$nextTick(() => {
         this.$refs.worder.init(1, row)
       })
     },
     attachDetails (attachList) {
-      attachList.forEach((item) => {
-        item.fileName = item.name
-      })
+      // attachList.forEach((item) => {
+      //   item.fileName = item.name
+      // })
       this.$refs.attachDetail.init(attachList)
     }
   }

+ 140 - 130
src/views/modules/cus/communicate-detail.vue

@@ -11,10 +11,14 @@
         <e-desc-item label="沟通编码">{{ dataForm.coCode }}</e-desc-item>
         <e-desc-item label="客户名称">{{ dataForm.customerName }}</e-desc-item>
         <e-desc-item label="客户联系人">{{ dataForm.contact }}</e-desc-item>
-        <e-desc-item label="客户联系电话">{{ dataForm.contactTel }}</e-desc-item>
+        <e-desc-item label="客户联系电话">{{
+          dataForm.contactTel
+        }}</e-desc-item>
         <e-desc-item label="沟通方式">{{ dataForm.way }}</e-desc-item>
         <e-desc-item label="沟通类别">{{ dataForm.coTypeValue }}</e-desc-item>
-        <e-desc-item label="沟通主要内容" span="3">{{ dataForm.content }}</e-desc-item>
+        <e-desc-item label="沟通主要内容" span="3">{{
+          dataForm.content
+        }}</e-desc-item>
         <e-desc-item label="备注说明" span="3">{{
           dataForm.notes
         }}</e-desc-item>
@@ -56,137 +60,140 @@
           <el-table-column label="序号" type="index" width="50" align="center">
           </el-table-column>
           <el-table-column
-              prop="productName"
-              header-align="center"
-              align="center"
-              min-width="120"
-              :show-tooltip-when-overflow="true"
-              label="物料名称"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="productSpecifications"
-              header-align="center"
-              align="center"
-              :show-tooltip-when-overflow="true"
-              label="规格"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="cnt"
-              header-align="center"
-              align="center"
-              label="数量"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="deliveryDate"
-              header-align="center"
-              align="center"
-              min-width="100"
-              width="150"
-              label="交付日期"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="notes"
-              header-align="center"
-              align="center"
-              min-width="180"
-              :show-tooltip-when-overflow="true"
-              label="备注"
-            >
-            </el-table-column>
+            prop="productName"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="物料名称"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="productSpecifications"
+            header-align="center"
+            align="center"
+            :show-tooltip-when-overflow="true"
+            label="规格"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="cnt"
+            header-align="center"
+            align="center"
+            label="数量"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="deliveryDate"
+            header-align="center"
+            align="center"
+            min-width="100"
+            width="150"
+            label="交付日期"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="notes"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="备注"
+          >
+          </el-table-column>
         </el-table>
       </e-desc>
       <e-desc title="任务工单派发">
         <el-table :data="dataForm.workInfoList" border style="width: 100%">
-            <el-table-column
-              label="序号"
-              type="index"
-              width="50"
-              align="center"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="taskType"
-              header-align="center"
-              align="center"
-              min-width="100"
-              width="120"
-              label="工单类型"
-            >
-              <template slot-scope="scope">
-                <span>{{ scope.row.taskTypeName }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column
-              prop="taskName"
-              header-align="center"
-              align="center"
-              :show-tooltip-when-overflow="true"
-              label="工单名称"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="ranks"
-              header-align="center"
-              align="center"
-              width="120"
-              label="级别"
-            >
-              <template slot-scope="scope">
-                <span>{{ scope.row.rankTypeName }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column
-              prop="content"
-              header-align="center"
-              align="center"
-              min-width="100"
-              label="工单内容"
-              :show-tooltip-when-overflow="true"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="receiver"
-              header-align="center"
-              align="center"
-              width="150"
-              label="任务接收人"
-            >
-              <template slot-scope="scope">
-                <span>{{ scope.row.receiverName }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column
-              prop="attachListVo"
-              header-align="center"
-              align="center"
-              width="150"
-              label="任务附件"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  :disabled="
-                    !scope.row.attachListVo || scope.row.attachListVo.length === 0
-                  "
-                  type="text"
-                  size="small"
-                  @click="attachDetails(scope.row.attachListVo)"
-                  >查看</el-button
-                >
-              </template>
-            </el-table-column>
-            <el-table-column
-              prop="notes"
-              header-align="center"
-              align="center"
-              :show-tooltip-when-overflow="true"
-              label="备注"
-            >
-            </el-table-column>
-          </el-table>
+          <el-table-column label="序号" type="index" width="50" align="center">
+          </el-table-column>
+          <el-table-column
+            prop="taskType"
+            header-align="center"
+            align="center"
+            min-width="100"
+            width="120"
+            label="工单类型"
+          >
+            <template slot-scope="scope">
+              <span>{{
+                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1 
+                ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
+                : ''
+              }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="taskName"
+            header-align="center"
+            align="center"
+            :show-tooltip-when-overflow="true"
+            label="工单名称"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="ranks"
+            header-align="center"
+            align="center"
+            width="120"
+            label="级别"
+          >
+            <template slot-scope="scope">
+              <span>{{
+                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1 
+                ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
+                : ''
+              }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="content"
+            header-align="center"
+            align="center"
+            min-width="100"
+            label="工单内容"
+            :show-tooltip-when-overflow="true"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="receiver"
+            header-align="center"
+            align="center"
+            width="150"
+            label="任务接收人"
+          >
+            <template slot-scope="scope">
+              <span>{{ scope.row.receiverName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="attachListVo"
+            header-align="center"
+            align="center"
+            width="150"
+            label="任务附件"
+          >
+            <template slot-scope="scope">
+              <el-button
+                :disabled="
+                  !scope.row.attachListVo || scope.row.attachListVo.length === 0
+                "
+                type="text"
+                size="small"
+                @click="attachDetails(scope.row.attachListVo)"
+                >查看</el-button
+              >
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="notes"
+            header-align="center"
+            align="center"
+            :show-tooltip-when-overflow="true"
+            label="备注"
+          >
+          </el-table-column>
+        </el-table>
       </e-desc>
     </div>
     <span slot="footer" class="dialog-footer">
@@ -203,6 +210,7 @@ import EDescItem from '../common/e-desc-item'
 import { getCoDetail } from '@/api/cus'
 import uploadComponent from '../common/upload-component-v2'
 import AttachDetailDialog from '../common/attach-detail-dialog'
+import { taskTypeOption, rankTypeOption } from '@/utils/enums'
 export default {
   name: 'communicate-detail',
   components: {
@@ -217,7 +225,9 @@ export default {
       id: 0,
       dataForm: {},
       cusRCommProductVOS: [],
-      fileList: []
+      fileList: [],
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption
     }
   },
   methods: {

+ 107 - 0
src/views/modules/product/template-add-or-update-v2.vue

@@ -0,0 +1,107 @@
+<template>
+  <div class="product-template">
+    <el-dialog
+      :title="!isModify ? '新增':'修改'"
+      width="50%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+        <el-row class="my-row">
+          <el-form-item label="物料名称" prop="productName">
+            <el-input v-model="dataForm.productName" placeholder="物料名称"></el-input>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="规格" prop="productSpecifications">
+            <el-input v-model="dataForm.productSpecifications" placeholder="规格"></el-input>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="数量" prop="cnt">
+            <el-input-number v-model="dataForm.cnt" ></el-input-number>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="交付日期" prop="deliveryDate">
+              <el-date-picker
+                v-model="dataForm.deliveryDate"
+                value-format="yyyy-MM-dd"
+                type="date"
+                style="width: 100%"
+              >
+              </el-date-picker>
+            </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="备注" prop="notes">
+            <el-input type="textarea" v-model="dataForm.notes" placeholder="备注"></el-input>
+          </el-form-item>
+        </el-row>
+      </el-form>
+      <span slot="footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import ProductComponent from '@/views/modules/common/product-component'
+
+  export default {
+    name: 'template-add-or-update',
+    components: {ProductComponent},
+    data () {
+      return {
+        visible: false,
+        isModify: false,
+        bizType: 1,
+        dataForm: {
+        },
+        dataRule: {
+          productName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
+          productSpecifications: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
+          cnt: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
+          price: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.visible = false
+      },
+      // 初始化:type: 1 沟通产品明细/合同台账产品明细,2 订单产品明细
+      init (type, dataForm, techType) {
+        this.bizType = techType ? 3 : type
+        if (dataForm) {
+          this.isModify = true
+          this.dataForm = dataForm
+        } else {
+          this.dataForm = {
+            recordId: Math.round(Math.random() * 1000000),
+            appraisal: 1
+          }
+        }
+        this.visible = true
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.visible = false
+            this.$emit('addItem', this.dataForm)
+          }
+        })
+      },
+      prodSelected (item) {
+        this.dataForm.productId = item.value
+        this.dataForm.relatedProduct = item.label
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 9 - 20
src/views/modules/worder/add-or-update.vue

@@ -138,6 +138,7 @@
 <script>
 import uploadComponent from '../common/upload-component-v2'
 import { getUserList } from '@/api/user'
+import { taskTypeOption, rankTypeOption } from '@/utils/enums'
 export default {
   name: 'worder-add-or-update',
   components: { uploadComponent },
@@ -151,19 +152,8 @@ export default {
       dataForm: {},
       attachList: [],
       userList: [],
-      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 }
-      ],
+      taskTypeOption: taskTypeOption,
+      rankTypeOption: rankTypeOption,
       dataRule: {
         taskCode: [
           { required: true, message: '请输入工单编码', trigger: 'blur' }
@@ -198,10 +188,15 @@ export default {
     },
     // 初始化
     async init (id, item) {
+      console.log(item)
       this.id = id || 0
       if (item) {
         this.isModify = true
-        item.name = item.fileName
+        if (item.attachList) {
+          item.attachList.map(t => {
+            if (t.fileName) { t.name = t.fileName }
+          })
+        }
         this.dataForm = item
       } else {
         this.isModify = false
@@ -223,12 +218,6 @@ 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.ranks
-          ).label
           this.dataForm.receiverName = this.userList.find(
             (t) => t.userId === this.dataForm.receiver
           ).name