Ver Fonte

审批处理

zhengnaiwen_citu há 5 meses atrás
pai
commit
c76d0ebe89

+ 10 - 0
src/utils/dict.js

@@ -1,4 +1,5 @@
 
+// 菜单类型字典
 export const MENU_TYPE = {
   DIRECTORY: 0,
   MENU: 1,
@@ -6,8 +7,17 @@ export const MENU_TYPE = {
   COMPONENT: 3
 }
 
+// 机构类型字典
 export const ORGANIZATION_CATEGORY = [
   { label: '支行', value: '支行' },
   { label: '网点', value: '网点' },
   { label: '部室', value: '部室' }
 ]
+
+// 审批状态字典
+export const APPROVAL_STATUS = [
+  { text: '处理中', color: 'default' },
+  { text: '审批通过', color: 'success' },
+  { text: '审批拒绝', color: 'danger' },
+  { text: '异常结束', color: 'warning' }
+]

+ 41 - 4
src/views/workOrder/approval/index.vue

@@ -1,6 +1,6 @@
 <template>
-  <div>
-    <IndexPage ref="indexPageRefs" :dataType="3">
+  <div v-loading="loading">
+    <IndexPage ref="indexPageRefs" :dataType="dataType">
       <template #actions="{ row }">
         <m-button type="danger" text @click="onDetails(row)">审批</m-button>
         <!-- <m-button  type="primary" text @click="onApproval(row.workFlowInstanceId)">通过审核</m-button>
@@ -8,7 +8,12 @@
       </template>
     </IndexPage>
     <ApprovalReject ref="approvalRejectRefs" @refresh="onRefresh"></ApprovalReject>
-    <ApprovalDetails ref="approvalDetailsRefs" :option="{ textSure: '通过', colorSure: 'success'}" @sure="onApproval(itemData.workFlowInstanceId)">
+    <ApprovalDetails
+      ref="approvalDetailsRefs"
+      :option="{ textSure: '通过', colorSure: 'success'}"
+      @sure="onApproval(itemData.workFlowInstanceId)"
+      @close="onClose"
+    >
       <template #button-after="{ item }">
         <m-button type="danger" @click="onApprovalReject(item)">拒绝</m-button>
       </template>
@@ -22,7 +27,8 @@ import ApprovalDetails from '../components/ApprovalDetails.vue'
 import ApprovalReject from './approvalReject.vue'
 
 import {
-  setApproval
+  setApproval,
+  getApprovalList
 } from '@/api/approval'
 export default {
   name: 'ApprovalPage',
@@ -33,10 +39,41 @@ export default {
   },
   data () {
     return {
+      loading: false,
+      dataType: 3,
       itemData: {}
     }
   },
+  created () {
+    if (this.$route.query.id) {
+      // 获取数据明细
+      this.onGetDetails(this.$route.query.id)
+    }
+  },
   methods: {
+    onClose () {
+      this.$router.push(this.$route.path)
+    },
+    async onGetDetails (workFlowInstanceId) {
+      this.loading = true
+      try {
+        const { data } = await getApprovalList({
+          dataType: this.dataType,
+          entity: {
+            workFlowInstanceId
+          }
+        })
+        if (!data.records.length) {
+          return
+        }
+        // 唤起审批详情
+        this.onDetails(data.records[0])
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
     onRefresh () {
       this.$refs.approvalDetailsRefs.close()
       this.$refs.indexPageRefs.onInit()

+ 12 - 1
src/views/workOrder/components/ApprovalDetails.vue

@@ -4,6 +4,9 @@
       <el-form-item label="审批功能名称">
         <el-tag type="default">{{ itemData.title }}</el-tag>
       </el-form-item>
+      <el-form-item label="审批状态">
+        <el-tag :type="itemData.statusColor">{{ itemData.statusText }}</el-tag>
+      </el-form-item>
       <el-form-item label="申请明细">
         <el-descriptions :column="1" border v-loading="loading">
           <el-descriptions-item
@@ -29,10 +32,14 @@
 import {
   getApprovalApply
 } from '@/api/approval'
+import {
+  APPROVAL_STATUS
+} from '@/utils/dict'
 export default {
   name: 'ApprovalDetails',
   data () {
     return {
+      statusList: APPROVAL_STATUS,
       headers: [],
       items: [],
       itemData: {},
@@ -44,7 +51,11 @@ export default {
       this.$refs.dialog.close()
     },
     async open (item) {
-      this.itemData = item
+      this.itemData = {
+        ...item,
+        statusText: this.statusList[item.status].text,
+        statusColor: this.statusList[item.status].color
+      }
       this.$refs.dialog.open()
       this.loading = true
       try {

+ 4 - 6
src/views/workOrder/components/IndexPage.vue

@@ -27,6 +27,9 @@ import {
   getApprovalList
 } from '@/api/approval'
 import ApprovalProgress from './ApprovalProgress'
+import {
+  APPROVAL_STATUS
+} from '@/utils/dict'
 export default {
   name: 'IndexPage',
   components: {
@@ -40,12 +43,7 @@ export default {
   },
   data () {
     return {
-      statusList: [
-        { text: '处理中', color: 'default' },
-        { text: '审批通过', color: 'success' },
-        { text: '审批拒绝', color: 'danger' },
-        { text: '异常结束', color: 'warning' }
-      ],
+      statusList: APPROVAL_STATUS,
       searchItems: [
         {
           label: '名称',

+ 39 - 3
src/views/workOrder/myOrder/index.vue

@@ -1,12 +1,12 @@
 <template>
-  <div>
+  <div v-loading="loading">
     <IndexPage ref="indexPageRefs" :dataType="1">
       <template #actions="{ row }">
         <m-button type="primary" text @click="onDetails(row)">查看申请单</m-button>
         <m-button text type="danger" @click="onUrgent(row)">加急</m-button>
       </template>
     </IndexPage>
-    <ApprovalDetails ref="approvalDetailsRefs"></ApprovalDetails>
+    <ApprovalDetails ref="approvalDetailsRefs" @close="onClose"></ApprovalDetails>
   </div>
 </template>
 
@@ -14,7 +14,8 @@
 import IndexPage from '../components/IndexPage.vue'
 import ApprovalDetails from '../components/ApprovalDetails.vue'
 import {
-  getApprovalUrge
+  getApprovalUrge,
+  getApprovalList
 } from '@/api/approval'
 export default {
   name: 'myOrder',
@@ -22,8 +23,43 @@ export default {
     IndexPage,
     ApprovalDetails
   },
+  data () {
+    return {
+      loading: false
+    }
+  },
+  created () {
+    if (this.$route.query.id) {
+      // 获取数据明细
+      this.onGetDetails(this.$route.query.id)
+    }
+  },
   methods: {
+    onClose () {
+      this.$router.push(this.$route.path)
+    },
+    async onGetDetails (workFlowInstanceId) {
+      this.loading = true
+      try {
+        const { data } = await getApprovalList({
+          dataType: 1,
+          entity: {
+            workFlowInstanceId
+          }
+        })
+        if (!data.records.length) {
+          return
+        }
+        // 唤起审批详情
+        this.onDetails(data.records[0])
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
     onDetails (item) {
+      console.log(this.$refs.approvalDetailsRefs)
       this.$refs.approvalDetailsRefs.open(item)
     },
     async onUrgent ({ workFlowInstanceId }) {