chris 3 anni fa
parent
commit
31245928ae

+ 99 - 0
src/views/modules/common/approve-component.vue

@@ -0,0 +1,99 @@
+<template>
+    <el-row style="margin-bottom: 20px">
+      <el-col :span="16">
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-form-item label="处理意见" prop="remark">
+              <el-input type="textarea" v-model="dataForm.remark" placeholder="处理意见"></el-input>
+            </el-form-item>
+          </el-row>
+          <el-row class="my-row">
+            <upload-component :title="'审批附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+          </el-row>
+        </el-form>
+      </el-col>
+      <el-col :span="8">
+        <el-button style="margin-left: 20px" @click="dataFormSubmit(2)">不同意</el-button>
+        <el-button type="primary" @click="dataFormSubmit(1)">同意</el-button>
+        <el-button type="danger" @click="dataFormSubmit(3)">驳回</el-button>
+      </el-col>
+    </el-row>
+</template>
+
+<script>
+  import UploadComponent from '../common/upload-component'
+  export default {
+    name: 'approve-component',
+    components: {UploadComponent},
+    data () {
+      return {
+        dataForm: {},
+        fileList: [],
+        dataRule: {
+          remark: [{ required: true, message: '处理意见不能为空', trigger: 'blur' }]
+        }
+      }
+    },
+    methods: {
+      async init (businessType, businessId) {
+        this.visible = true
+        this.dataForm = {
+          busiType: businessType || '',
+          busiId: businessId || 0
+        }
+      },
+      // 表单提交
+      dataFormSubmit (val) {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            // 添加附件
+            let fList = this.fileList
+            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
+                })
+              }
+            }
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/business/approval`),
+              method: 'post',
+              data: this.$http.adornData(
+                {...this.dataForm,
+                  approvalType: val,
+                  userName: this.$store.state.user.name,
+                  orgId: this.$store.state.user.orgId
+                })
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.visible = false
+                    this.$emit('approveFinished')
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      uploadSuccess (fileList) {
+        this.fileList = fileList
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 4 - 2
src/views/modules/cus/contract-detail.vue

@@ -84,8 +84,10 @@
           if (data && data.code === '200') {
             this.dataForm = data.data
             // 流程图展示
-            dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
-            dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
+            if (data.data.workFlowBusinessExt) {
+              dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
+              dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
+            }
             // 附件显示
             this.fileList = []
             data.data.attachList.forEach((item) => {

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

@@ -0,0 +1,45 @@
+<template>
+  <div>
+    <div v-show="businessType === 'warehouse_flow_in'">
+      <stock-order-detail ref="stockOrderDetail" @approveFinished="approveFinished"/>
+    </div>
+  </div>
+</template>
+
+<script>
+  import stockOrderDetail from '../warehouse/stock-order-detail'
+  export default {
+    name: 'approve-add-or-update',
+    components: {
+      stockOrderDetail
+    },
+    data () {
+      return {
+        businessType: 0,
+        businessId: 0
+      }
+    },
+    methods: {
+      async init (businessType, businessId) {
+        this.businessType = businessType || ''
+        this.businessId = businessId || 0
+        if (this.businessType === 'warehouse_flow_in') {
+          this.$refs.stockOrderDetail.init(this.businessId, businessType)
+        }
+      },
+      approveFinished () {
+        this.$emit('refreshDataList')
+      }
+    }
+  }
+</script>
+
+<style scoped>
+.my-line{
+  border-bottom: 1px solid #c0c4cc;
+  margin-bottom: 10px;
+}
+.title{
+  padding: 10px 0 ;
+}
+</style>

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

@@ -0,0 +1,42 @@
+<template>
+  <div>
+    <div v-show="businessType === 'warehouse_flow_in'">
+      <stock-order-detail ref="stockOrderDetail"/>
+    </div>
+  </div>
+</template>
+
+<script>
+  import stockOrderDetail from '../warehouse/stock-order-detail'
+  export default {
+    name: 'approve-detail',
+    components: {
+      stockOrderDetail
+    },
+    data () {
+      return {
+        businessType: '',
+        businessId: 0
+      }
+    },
+    methods: {
+      async init (businessType, businessId) {
+        this.businessType = businessType || ''
+        this.businessId = businessId || 0
+        if (this.businessType === 'warehouse_flow_in') {
+          this.$refs.stockOrderDetail.init(this.businessId)
+        }
+      }
+    }
+  }
+</script>
+
+<style scoped>
+.my-line{
+  border-bottom: 1px solid #c0c4cc;
+  margin-bottom: 10px;
+}
+.title{
+  padding: 10px 0 ;
+}
+</style>

+ 18 - 17
src/views/modules/msg-center/approve.vue

@@ -95,8 +95,8 @@
         width="80"
         label="操作">
         <template slot-scope="scope">
-          <el-button v-if="Number(scope.row.state) !== 3 && checkUser(scope.row)" type="text" size="small" @click="addOrUpdateHandle1(scope.row.businessId)">处理</el-button>
-          <el-button v-else type="text" size="small" @click="addOrUpdateHandle(scope.row.businessId)">查看</el-button>
+          <el-button v-if="Number(scope.row.state) !== 3 && checkUser(scope.row)" type="text" size="small" @click="addOrUpdateHandle(scope.row.businessType, scope.row.businessId)">处理</el-button>
+          <el-button v-else type="text" size="small" @click="detailHandle(scope.row.businessType, scope.row.businessId)">查看</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -110,22 +110,22 @@
       layout="total, sizes, prev, pager, next, jumper">
     </el-pagination>
     <!-- 弹窗, 新增 / 修改 -->
-    <look-approve v-if="addOrUpdateVisible" ref="addOrUpdate" ></look-approve>
-    <approve-to v-if="addOrUpdateVisible1" ref="addOrUpdate1" @refreshDataList="getApprovalList" />
+    <detail v-if="detailVisible" ref="detail"/>
+    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getApprovalList"/>
   </div>
 </template>
 
 <script>
-  import LookApprove from './look-approve'
-  import ApproveTo from './approveTo'
+  import Detail from './approve-detail'
+  import AddOrUpdate from './approve-add-or-update'
   import { getApprovalList } from '@/api/msg'
   import { getCusList } from '@/api/cus'
   import { checkStr } from '@/api/util'
   export default {
     name: 'order',
     components: {
-      LookApprove,
-      ApproveTo
+      Detail,
+      AddOrUpdate
     },
     created () {
       this.queryData()
@@ -133,7 +133,7 @@
     data () {
       return {
         addOrUpdateVisible: false,
-        addOrUpdateVisible1: false,
+        detailVisible: false,
         dataForm: {},
         dataList: [],
         pageIndex: 1,
@@ -223,21 +223,22 @@
         })
       },
       // 新增 / 修改
-      addOrUpdateHandle (id) {
+      addOrUpdateHandle (businessType, businessId) {
         this.addOrUpdateVisible = true
         this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id)
-        })
-      },
-      addOrUpdateHandle1 (id) {
-        this.addOrUpdateVisible1 = true
-        this.$nextTick(() => {
-          this.$refs.addOrUpdate1.init(id)
+          this.$refs.addOrUpdate.init(businessType, businessId)
         })
       },
       checkUser (row) {
         let currentUser = this.$store.state.user.name
         return checkStr(currentUser, row.approver)
+      },
+      // 详情
+      detailHandle (businessType, businessId) {
+        this.detailVisible = true
+        this.$nextTick(() => {
+          this.$refs.detail.init(businessType, businessId)
+        })
       }
     }
   }

+ 151 - 110
src/views/modules/warehouse/stock-order-detail.vue

@@ -5,110 +5,128 @@
       :close-on-click-modal="false"
       :visible.sync="visible">
       <div style="margin-left: 20px;margin-right: 20px">
-        <e-desc title="基本信息">
-          <e-desc-item label="编码">{{dataForm.recordCode}}</e-desc-item>
-          <e-desc-item label="出入库申请人">{{dataForm.applicant}}</e-desc-item>
-          <e-desc-item label="申请人部门">{{dataForm.orgName}}</e-desc-item>
-        </e-desc>
-        <e-desc title="出入库详情">
-          <el-table
-            border
-            :data="dataList">
-            <el-table-column
-              label="序号"
-              type="index"
-              align="center"
-              width="50"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="materialName"
-              header-align="center"
-              align="center"
-              width="160"
-              :show-tooltip-when-overflow="true"
-              label="名称">
-            </el-table-column>
-            <el-table-column
-              prop="categoryName"
-              header-align="center"
-              align="center"
-              label="类别">
-            </el-table-column>
-            <el-table-column
-              prop="unitName"
-              header-align="center"
-              align="center"
-              label="单位">
-            </el-table-column>
-            <el-table-column
-              prop="specifications"
-              header-align="center"
-              align="center"
-              label="规格">
-            </el-table-column>
-            <el-table-column
-              prop="batchNumber"
-              header-align="center"
-              align="center"
-              width="140"
-              :show-tooltip-when-overflow="true"
-              label="批次号">
-            </el-table-column>
-            <el-table-column
-              prop="unitName"
-              header-align="center"
-              align="center"
-              label="单位">
-            </el-table-column>
-            <el-table-column
-              prop="price"
-              header-align="center"
-              align="center"
-              label="单价">
-            </el-table-column>
-            <el-table-column
-              prop="cnt"
-              header-align="center"
-              align="center"
-              label="数量">
-            </el-table-column>
-            <el-table-column
-              prop="-"
-              header-align="center"
-              align="center"
-              label="金额">
-              <template slot-scope="scope">
-                <span>{{ scope.row.price * scope.row.cnt }}</span>
+        <!-- 工作流 -->
+        <div v-show="dataForm.workFlowBusinessExt">
+          <el-steps :active="dataForm.workFlowBusinessExt?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>
-            </el-table-column>
-            <el-table-column
-              prop="source"
-              header-align="center"
-              align="center"
-              width="140"
-              :show-tooltip-when-overflow="true"
-              label="来源">
-            </el-table-column>
-            <el-table-column
-              prop="conversionName"
-              header-align="center"
-              align="center"
-              width="140"
-              :show-tooltip-when-overflow="true"
-              label="是否换算">
-            </el-table-column>
-            <el-table-column
-              prop="notes"
-              header-align="center"
-              align="center"
-              width="140"
-              :show-tooltip-when-overflow="true"
-              label="备注">
-            </el-table-column>
-          </el-table>
-        </e-desc>
-      </div><span slot="footer" class="dialog-footer">
+              <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-show="isFlow">
+          <approve-component ref="approve" @approveFinished="approveFinished"/>
+        </div>
+        <div>
+          <e-desc title="基本信息">
+            <e-desc-item label="编码">{{dataForm.recordCode}}</e-desc-item>
+            <e-desc-item label="出入库申请人">{{dataForm.applicant}}</e-desc-item>
+            <e-desc-item label="申请人部门">{{dataForm.orgName}}</e-desc-item>
+          </e-desc>
+          <e-desc title="出入库详情">
+            <el-table
+              border
+              :data="dataList">
+              <el-table-column
+                label="序号"
+                type="index"
+                align="center"
+                width="50"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="materialName"
+                header-align="center"
+                align="center"
+                width="160"
+                :show-tooltip-when-overflow="true"
+                label="名称">
+              </el-table-column>
+              <el-table-column
+                prop="categoryName"
+                header-align="center"
+                align="center"
+                label="类别">
+              </el-table-column>
+              <el-table-column
+                prop="unitName"
+                header-align="center"
+                align="center"
+                label="单位">
+              </el-table-column>
+              <el-table-column
+                prop="specifications"
+                header-align="center"
+                align="center"
+                label="规格">
+              </el-table-column>
+              <el-table-column
+                prop="batchNumber"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="批次号">
+              </el-table-column>
+              <el-table-column
+                prop="price"
+                header-align="center"
+                align="center"
+                label="单价">
+              </el-table-column>
+              <el-table-column
+                prop="cnt"
+                header-align="center"
+                align="center"
+                label="数量">
+              </el-table-column>
+              <el-table-column
+                prop="-"
+                header-align="center"
+                align="center"
+                label="金额">
+                <template slot-scope="scope">
+                  <span>{{ scope.row.price * scope.row.cnt }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="source"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="来源">
+              </el-table-column>
+              <el-table-column
+                prop="conversionName"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="是否换算">
+              </el-table-column>
+              <el-table-column
+                prop="notes"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="备注">
+              </el-table-column>
+            </el-table>
+          </e-desc>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
         <el-button @click="visible = false">取消</el-button>
       </span>
 
@@ -119,35 +137,58 @@
   import EDesc from '../common/e-desc'
   import EDescItem from '../common/e-desc-item'
   import { getBoundDetails } from '@/api/warehouse'
+  import { dealStepData, dealStepLogs } from '@/api/util'
+  import UploadComponent from '../common/upload-component'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'stock-order-detail',
     components: {
-      EDesc, EDescItem
+      EDesc, EDescItem, UploadComponent, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         dataForm: {},
-        dataList: []
+        dataList: [],
+        stepList: [],
+        logList: []
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
         this.dataForm = {}
         this.dataList = []
         await getBoundDetails(id).then(({data}) => {
           if (data && data.code === '200') {
             if (data.data[0]) {
-              this.dataForm = {
-                recordCode: data.data[0].recordCode,
-                applicant: data.data[0].applicant,
-                orgName: data.data[0].orgName
+              this.dataForm = data.data[0]
+              // 流程图展示
+              if (data.data[0].workFlowBusinessExt) {
+                dealStepData(data.data[0].workFlowBusinessExt.workFlowProcessStepList, this.stepList)
+                dealStepLogs(data.data[0].workFlowBusinessExt.processLogList, this.logList)
               }
             }
             this.dataList = data.data
+            // 初始化审批Form
+            this.showApproveForm(businessType, id)
           }
         })
+      },
+      // 初始化审批Form
+      showApproveForm (businessType, businessId) {
+        if (this.isFlow) {
+          this.$nextTick(() => {
+            this.$refs.approve.init(businessType, businessId)
+          })
+        }
+      },
+      // 审批完成
+      approveFinished () {
+        this.visible = false
+        this.$emit('approveFinished')
       }
     }
   }