瀏覽代碼

批量审批

damon227 1 年之前
父節點
當前提交
c1221548c1

+ 1 - 1
src/utils/preventReClick.js

@@ -10,7 +10,7 @@ const preventReClick = Vue.directive('reClick', {
         setTimeout(() => {
           el.disabled = false
           el.className = el.className.replace('is-disable', '')
-        }, binding.value || 1000)
+        }, binding.value || 30000)
       }
     })
   }

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

@@ -0,0 +1,102 @@
+<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, businessIds) {
+        // console.log('[approve-component]businessType = ' + businessType)
+        // console.log('[approve-component]businessId = ' + businessId)
+        this.visible = true
+        this.dataForm = {
+          busiType: businessType || '',
+          busiIds: businessIds || []
+        }
+        this.fileList = []
+      },
+      // 表单提交
+      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/batch/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>

+ 27 - 1
src/views/modules/msg-center/approve.vue

@@ -37,6 +37,9 @@
         <el-form-item>
           <el-button @click="queryData()">查询</el-button>
         </el-form-item>
+         <el-form-item>
+          <el-button @click="batchApprove()">批量审批</el-button>
+        </el-form-item>
       </el-form>
       <el-table
         :data="dataList"
@@ -44,6 +47,10 @@
         v-loading="dataListLoading"
         @selection-change="selectionChangeHandle"
         style="width: 100%;">
+         <el-table-column
+          type="selection"
+          width="55">
+        </el-table-column>
         <el-table-column
           label="序号"
           type="index"
@@ -122,6 +129,9 @@
     </template>
     <!-- 弹窗, 新增 / 修改 -->
     <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getApprovalList" @onChose="onChose"/>
+    <el-dialog :visible.sync="approveDialogVisible">
+      <approve-component-batch ref="approve" />
+    </el-dialog>
   </div>
 </template>
 
@@ -131,11 +141,13 @@
   import { readNotices } from '@/utils/msg'
   import { getCusList } from '@/api/cus'
   import { checkStr } from '@/api/util'
+  import ApproveComponentBatch from '../common/approve-component-batch'
   export default {
     name: 'order',
     components: {
       // Detail,
-      AddOrUpdate
+      AddOrUpdate,
+      ApproveComponentBatch
     },
     created () {
       this.optionsState = this.$store.state.common.approveStates
@@ -158,6 +170,7 @@
     },
     data () {
       return {
+        approveDialogVisible: false,
         addOrUpdateVisible: false,
         dataForm: {},
         dataList: [],
@@ -315,6 +328,19 @@
         if (row.noticeIds) {
           readNotices(this, row.noticeIds)
         }
+      },
+      batchApprove () {
+        console.log(this.dataListSelections)
+        if (this.dataListSelections && this.dataListSelections.length > 0) {
+          this.approveDialogVisible = true
+          let businessIds = this.dataListSelections.map(item => item.businessId)
+  
+          this.$nextTick(() => {
+            this.$refs.approve.init(this.dataListSelections[0].businessType, businessIds)
+          })
+        } else {
+  
+        }
       }
     }
   }