Browse Source

bug fix: 137,142

chrislee 1 year ago
parent
commit
36ae919e83

+ 9 - 0
src/api/cus.js

@@ -116,3 +116,12 @@ export function getCustomerInfo (customerId) {
     method: 'get'
   })
 }
+
+// 撤销沟通
+export function revokeComm (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/cusCommunication/revoke`),
+    method: 'post',
+    data: data
+  })
+}

+ 54 - 7
src/views/modules/cus/communicate-detail.vue

@@ -7,6 +7,27 @@
   <div>
     <div class="my-title">查看</div>
     <div style="margin-left: 20px; margin-right: 20px">
+      <!-- 工作流 -->
+      <div v-show="dataForm.workFlowBusinessExt">
+        <el-steps :active="dataForm.workFlowBusinessExt&&dataForm.workFlowBusinessExt.workFlowProcessStepList?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
+          <template v-for="(item, i) in stepList">
+            <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
+          </template>
+        </el-steps>
+        <el-collapse style="margin-bottom: 20px">
+          <el-collapse-item>
+            <template slot="title">
+              <span style="color: red">审批日志(展开查看更多):</span>
+            </template>
+            <template v-for="(item, i) in logList">
+              <div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
+            </template>
+          </el-collapse-item>
+        </el-collapse>
+      </div>
+      <div v-if="isFlow">
+        <approve-component ref="approve" @approveFinished="approveFinished"/>
+      </div>
       <e-desc title="基本信息" column="3">
         <e-desc-item label="沟通编码">{{ dataForm.coCode }}</e-desc-item>
         <e-desc-item label="客户名称">{{ dataForm.customerName }}</e-desc-item>
@@ -117,7 +138,7 @@
           >
             <template slot-scope="scope">
               <span>{{
-                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1 
+                taskTypeOption.findIndex((t) => t.value == scope.row.taskType) > -1
                 ? taskTypeOption.find((t) => t.value == scope.row.taskType).label
                 : ''
               }}</span>
@@ -140,7 +161,7 @@
           >
             <template slot-scope="scope">
               <span>{{
-                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1 
+                rankTypeOption.findIndex((t) => t.value == scope.row.ranks) > -1
                 ? rankTypeOption.find((t) => t.value == scope.row.ranks).label
                 : ''
               }}</span>
@@ -211,9 +232,12 @@ 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'
+import {dealStepData, dealStepLogs} from '@/api/util'
+import ApproveComponent from '@/views/modules/common/approve-component'
 export default {
   name: 'communicate-detail',
   components: {
+    ApproveComponent,
     EDesc,
     EDescItem,
     uploadComponent,
@@ -227,22 +251,26 @@ export default {
       cusRCommProductVOS: [],
       fileList: [],
       taskTypeOption: taskTypeOption,
-      rankTypeOption: rankTypeOption
+      rankTypeOption: rankTypeOption,
+      isFlow: false,
+      stepList: [],
+      logList: []
     }
   },
   methods: {
     onChose () {
       this.$emit('onChose')
     },
-    async init (id) {
+    async init (id, businessType) {
       this.visible = true
+      this.isFlow = !!(businessType && businessType !== '')
       this.id = id || 0
       this.dataForm = {}
       this.cusRCommProductVOS = []
       this.fileList = []
-      this.getDetails()
+      this.getDetails(businessType)
     },
-    getDetails () {
+    getDetails (businessType) {
       getCoDetail(this.id).then(({ data }) => {
         if (data && data.code === '200') {
           this.dataForm = data.data
@@ -272,7 +300,6 @@ export default {
               item.id = item.url
             })
           }
-
           if (data.data.cusRCommProductVOS) {
             data.data.cusRCommProductVOS.forEach((item) => {
               this.cusRCommProductVOS.push({
@@ -280,11 +307,31 @@ export default {
               })
             })
           }
+
+          // 流程图展示
+          dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
+          dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
+
+          // 初始化审批Form
+          this.showApproveForm(businessType, this.id)
         }
       })
     },
     attachDetails (attachList) {
       this.$refs.attachDetail.init(attachList)
+    },
+    // 初始化审批Form
+    showApproveForm (businessType, businessId) {
+      if (this.isFlow) {
+        this.$nextTick(() => {
+          this.$refs.approve.init(businessType, businessId)
+        })
+      }
+    },
+    // 审批完成
+    approveFinished () {
+      this.onChose()
+      this.$emit('approveFinished')
     }
   }
 }

+ 39 - 6
src/views/modules/cus/communicate.vue

@@ -24,7 +24,6 @@
                 :label="item.value"
                 :value="item.id"
               >
-              </el-option>
             </el-option>
           </el-select>
         </el-form-item>
@@ -121,6 +120,7 @@
         <el-table-column
           prop="state"
           header-align="center"
+          :formatter="formatState"
           align="center"
           label="审核状态"
           :show-tooltip-when-overflow="true"
@@ -133,8 +133,9 @@
           label="操作">
           <template slot-scope="scope">
             <el-button v-if="isAuth('cus:communication:info')" type="text" size="small" @click="detailHandle(scope.row.coId)">查看</el-button>
-            <el-button v-if="isAuth('cus:communication:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.coId, false)">编辑</el-button>
-            <el-button v-if="isAuth('cus:communication:delete')" style="color: red" type="text" size="small" @click="deleteHandle(scope.row.coId)">删除</el-button>
+            <el-button v-if="isAuth('cus:communication:update') && scope.row.state === '0'" type="text" size="small" @click="addOrUpdateHandle(scope.row.coId, false)">编辑</el-button>
+            <el-button v-if="isAuth('cus:communication:revoke') && (scope.row.state === '1')" type="text" size="small" @click="cancelHandle(scope.row)">撤回</el-button>
+            <el-button v-if="isAuth('cus:communication:delete') && scope.row.state === '0'" style="color: red" type="text" size="small" @click="deleteHandle(scope.row.coId)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -162,8 +163,9 @@
   import { getDictList } from '@/api/dict'
   import { downloadUrl } from '@/api/file'
   import PreviewComponent from '../common/preview-component'
-import OrgComponent from '../common/org-component'
-  export default {
+  import OrgComponent from '../common/org-component'
+  import {revokeComm} from '@/api/cus'
+export default {
     name: 'communicate',
     components: {
       PreviewComponent,
@@ -186,10 +188,12 @@ import OrgComponent from '../common/org-component'
         pageSize: 10,
         totalPage: 0,
         dataListLoading: false,
-        dataListSelections: []
+        dataListSelections: [],
+        optionsState: []
       }
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.getCoType()
       this.getDataList()
     },
@@ -292,6 +296,12 @@ import OrgComponent from '../common/org-component'
           }
         }
       },
+      // 转换属性“状态”
+      formatState (row) {
+        if (!row.state) return ''
+        const item1 = this.optionsState.find((item) => item.code === row.state.toString())
+        return item1 ? item1.value : ''
+      },
       detailHandle (id) {
         this.detailVisible = true
         this.$nextTick(() => {
@@ -304,6 +314,29 @@ import OrgComponent from '../common/org-component'
         this.$nextTick(() => {
           this.$refs.preview.init(fileName, url)
         })
+      },
+      // 撤回评审
+      cancelHandle (row) {
+        this.$confirm(`确定撤回沟通${row.coCode}?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          revokeComm({id: row.coId}).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '撤回成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.getDataList()
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }).catch(() => {})
       }
     }
   }

+ 7 - 0
src/views/modules/msg-center/approve-add-or-update.vue

@@ -36,6 +36,9 @@
     <div v-show="businessType === 'work_damage_flow'">
       <damage-details ref="damageDetail" @approveFinished="approveFinished" @onChose="onChose"/>
     </div>
+    <div v-show="businessType === 'cus_communicate_flow'">
+      <communicate-detail ref="communicateDetail" @approveFinished="approveFinished" @onChose="onChose"/>
+    </div>
   </div>
 </template>
 
@@ -52,9 +55,11 @@
   import OutsourceDetail from '../sale/outsource-detail'
   import ExpenseDetail from '../finance/expense-detail'
   import damageDetails from '../production/damage-details'
+  import CommunicateDetail from '@/views/modules/cus/communicate-detail'
 export default {
     name: 'approve-add-or-update',
     components: {
+      CommunicateDetail,
       InventoryDetail,
       stockOrderDetail,
       contractDetail,
@@ -107,6 +112,8 @@ export default {
           this.display ? this.$refs.expenseDetail.init(this.businessId) : this.$refs.expenseDetail.init(this.businessId, businessType)
         } else if (this.businessType === 'work_damage_flow') {
           this.display ? this.$refs.damageDetail.init(this.businessId) : this.$refs.damageDetail.init(this.businessId, businessType)
+        } else if (this.businessType === 'cus_communicate_flow') {
+          this.display ? this.$refs.communicateDetail.init(this.businessId) : this.$refs.communicateDetail.init(this.businessId, businessType)
         } else {
           this.$message.error('流程类别不支持,请联系管理员!')
         }

+ 3 - 0
src/views/modules/msg-center/approve.vue

@@ -209,6 +209,9 @@
           },
           {
             code: 'work_damage_flow', value: '报损审批'
+          },
+          {
+            code: 'cus_communicate_flow', value: '沟通审批'
           }
         ],
         optionsCustomer: []

+ 23 - 12
src/views/modules/works/work-center-detail.vue

@@ -53,18 +53,20 @@
 
         <e-desc-item label="备注" span="3">{{ dataForm.remark }}</e-desc-item>
       </e-desc>
-      <e-desc title="附件">
-        <upload-component
-          :display="true"
-          :display-title="false"
-          :accept="'*'"
-          :file-obj-list="dataForm.fileList"
-        />
+      <e-desc>
+        <e-desc-item v-if="dataForm.attachList" label="附件" span="3">
+          <div v-for="(item, index) in dataForm.attachList" style="display: inline">
+            <span v-if="index > 0">,</span>
+            <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+          </div>
+        </e-desc-item>
       </e-desc>
     </div>
     <span slot="footer" class="dialog-footer">
       <el-button @click="handleClose">返回</el-button>
     </span>
+    <!-- 文件预览 -->
+    <preview-component v-if="previewVisible" ref="preview"/>
   </div>
 </template>
 
@@ -72,14 +74,14 @@
 import { getTaskDetail } from '@/api/task'
 import EDesc from '../common/e-desc'
 import EDescItem from '../common/e-desc-item'
-import uploadComponent from '../common/upload-component'
 import { taskTypeOption, rankTypeOption, nodeStateOption } from '@/utils/enums'
+import PreviewComponent from '@/views/modules/common/preview-component'
 export default {
   name: 'work-center-detail',
   components: {
+    PreviewComponent,
     EDesc,
-    EDescItem,
-    uploadComponent
+    EDescItem
   },
   data () {
     return {
@@ -87,7 +89,8 @@ export default {
       dataForm: {},
       taskTypeOption: taskTypeOption,
       rankTypeOption: rankTypeOption,
-      nodeStateOption: nodeStateOption
+      nodeStateOption: nodeStateOption,
+      previewVisible: false
     }
   },
   methods: {
@@ -103,7 +106,15 @@ export default {
       })
     },
     handleClose () {
+      this.previewVisible = false
       this.$emit('onChose')
+    },
+    // 预览
+    previewFile (fileName, url) {
+      this.previewVisible = true
+      this.$nextTick(() => {
+        this.$refs.preview.init(fileName, url)
+      })
     }
   }
 }
@@ -117,4 +128,4 @@ export default {
 .title {
   padding: 10px 0;
 }
-</style>
+</style>