zhengnaiwen_citu 5 miesięcy temu
rodzic
commit
6f082cd35e

+ 6 - 2
src/views/approval/approvalProgress.vue

@@ -5,9 +5,13 @@
         v-for="(item) in items"
         :key="item.id"
         :title="item.title"
-        :description="item.date"
         :status="statusMap[item.status]"
-      ></el-step>
+      >
+        <template #description>
+          <div>{{ item.date }}</div>
+          <div v-if="item.status === 2">拒绝理由: {{ item.msg }}</div>
+        </template>
+      </el-step>
     </el-steps>
   </m-dialog>
 </template>

+ 48 - 0
src/views/approval/approvalReject.vue

@@ -0,0 +1,48 @@
+<template>
+  <m-dialog title="拒绝理由" ref="dialog" @sure="onSure">
+    <el-input v-model="approveRejectText" type="textarea" :rows="3" placeholder="请输入拒绝原因"></el-input>
+  </m-dialog>
+</template>
+
+<script>
+import {
+  setApproval
+} from '@/api/approval'
+export default {
+  name: 'approvalReject',
+  data () {
+    return {
+      workFlowInstanceId: null,
+      approveRejectText: null
+    }
+  },
+  methods: {
+    open (item) {
+      this.workFlowInstanceId = item.workFlowInstanceId
+      this.$refs.dialog.open()
+    },
+    async onSure () {
+      if (!this.approveRejectText) {
+        this.$message.error('请输入拒绝原因')
+        return
+      }
+      try {
+        await setApproval({
+          workFlowInstanceId: this.workFlowInstanceId,
+          status: 2,
+          msg: this.approveRejectText
+        })
+        this.$message.success('拒绝成功')
+        this.$refs.dialog.close()
+        this.$emit('refresh')
+      } catch (error) {
+        this.$message.error(error)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 25 - 5
src/views/approval/index.vue

@@ -15,23 +15,30 @@
       </template>
       <template #actions="{ row }">
         <m-button type="primary" text @click="onDetails(row)">审批进度</m-button>
-        <m-button v-if="row.opType === 1" type="primary" text @click="onApproval(row)">审批</m-button>
+        <template v-if="row.opType === 1">
+          <m-button  type="primary" class="mr-2" text @click="onApproval(row.workFlowInstanceId)">通过审核</m-button>
+          <m-button type="danger" text @click="onApprovalReject(row)">拒绝通过</m-button>
+        </template>
       </template>
     </m-table>
     <ApprovalProgress ref="approvalProgressRefs"></ApprovalProgress>
+    <ApprovalReject ref="approvalRejectRefs" @refresh="onInit"></ApprovalReject>
   </div>
 </template>
 
 <script>
 import {
   getApprovalList,
-  getApprovalProgress
+  getApprovalProgress,
+  setApproval
 } from '@/api/approval'
 import ApprovalProgress from './approvalProgress.vue'
+import ApprovalReject from './approvalReject.vue'
 export default {
   name: 'ApprovalPage',
   components: {
-    ApprovalProgress
+    ApprovalProgress,
+    ApprovalReject
   },
   data () {
     return {
@@ -88,7 +95,7 @@ export default {
             ...this.searchValues
           }
         })
-        this.items = data.records || []
+        this.items = data.records
         this.total = data.total || 0
       } catch (error) {
         this.$message.error(error)
@@ -104,7 +111,20 @@ export default {
         this.$message.error(error)
       }
     },
-    onApproval () {},
+    onApprovalReject (item) {
+      this.$refs.approvalRejectRefs.open(item)
+    },
+    async onApproval (workFlowInstanceId, status) {
+      try {
+        await setApproval({
+          workFlowInstanceId: workFlowInstanceId,
+          status: 1
+        })
+        this.$message.success(status ? '审批通过' : '拒绝成功')
+      } catch (error) {
+        this.$message.error(error)
+      }
+    },
     onSearch () {
       this.pageInfo.current = 1
       this.onInit()