Browse Source

提交审批弹窗

caojunjie 4 years ago
parent
commit
58ed4a17dd

+ 10 - 0
src/api/system/startApproval.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 查询数据
+export function listCharge(data,url) {
+  return request({
+    url: url,
+    method: 'post',
+    data: data
+  })
+}

+ 17 - 6
src/views/index.vue

@@ -116,16 +116,18 @@
     <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
   </span>
     </el-dialog>
-    <el-button type="primary" @click="addOrUpdateHandle">点击我</el-button>
+    <el-button type="primary" @click="addOrUpdateHandle">查看审批</el-button>
+    <el-button type="primary" @click="addOrUpdateHand">审批弹窗</el-button>
     <!-- 弹窗, 新增 / 修改 -->
-    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" :dataForm="editModel"></add-or-update>
+    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate"></add-or-update>
+    <approval-comments v-if="addOrUpdateVisib" ref="ApprovalComments"></approval-comments>
   </div>
 </template>
 
 <script>
 import { listCorps, information, warehouse } from '../../src/api/index'
 import AddOrUpdate from '@/views/viewApproval'
-// import AddOrUpdate from '@/views/system/toConfigure/auditPaths-add-or-update'
+import ApprovalComments from '@/views/startApproval'
 export default {
   name: 'index',
   data() {
@@ -137,6 +139,7 @@ export default {
       text: '',
       dialogVisible: false,
       addOrUpdateVisible: false,
+      addOrUpdateVisib: false,
       tableData: [{
         date: '2020-11-20 12:00',
         name: '某客户账单审核',
@@ -160,7 +163,8 @@ export default {
     }
   },
   components: {
-    AddOrUpdate
+    AddOrUpdate,
+    ApprovalComments
   },
   mounted() {
 
@@ -173,14 +177,21 @@ export default {
   methods: {
     addOrUpdateHandle(){
       this.addOrUpdateVisible = true
+      this.addOrUpdateVisib = false
       let id = '448'
       let actId = '110'
       this.$nextTick(() => {
         this.$refs.addOrUpdate.init(id,actId)
       })
     },
-    getDataList(){
-      this.dataListLoading = true
+    addOrUpdateHand(){
+      this.addOrUpdateVisib = true
+      this.addOrUpdateVisible = false
+      let id = '448'
+      let actId = '110'
+      this.$nextTick(() => {
+        this.$refs.ApprovalComments.init(id,actId)
+      })
     },
     bug(res) {
       this.dialogVisible = true

+ 128 - 0
src/views/startApproval.vue

@@ -0,0 +1,128 @@
+<template>
+  <el-dialog
+    :title="'审批'"
+    :close-on-click-modal="false"
+    :before-close="closeDialog"
+    :visible.sync="visible"
+    :append-to-body="true"
+    :modal="false"
+    width="55%">
+    <el-form v-model="dataForm" :inline="true">
+      <div class="form-group dialog">
+        <el-form-item class="full" label="审批意见" prop="auditMsg">
+          <el-input type="textarea" placeholder="审批意见" v-model="dataForm.auditMsg"></el-input>
+        </el-form-item>
+        <el-form-item label="审批人" class="full" prop="auditUserId">
+          <el-select v-model="dataForm.auditUserId" disabled placeholder="审批人" style="width: 100%;">
+            <el-option
+              v-for="item in optionsBranch"
+              :key="item.id"
+              :label="item.cname"
+              :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </div>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="closeDia">关闭</el-button>
+      <el-button @click="approvalRejected" v-preventReClick>审批驳回</el-button>
+      <el-button @click="approved" v-preventReClick>审批通过</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { listCharge } from '@/api/system/startApproval'
+  export default {
+    name: 'startApproval',
+    data () {
+      return {
+        dataForm: {
+          id: null,
+          actId: null,
+          auditMsg: null,
+          auditUserId: this.$store.state.user.id
+        },
+        visible: false,
+        optionsBranch: [{
+          id: this.$store.state.user.id,
+          cname: this.$store.state.user.actualname
+        }]
+      }
+    },
+    components: {
+    },
+    methods: {
+      init (id,actId) {
+        this.visible = true
+        if (typeof id === 'undefined' || typeof actId === 'undefined') {
+          this.$message.error('未检测到工程信息,请指定工程')
+          return false
+        }
+        this.dataForm.id = id
+        this.dataForm.actId = actId
+      },
+      approved () {
+        this.$confirm(`是否通过审批?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          return  listCharge(this.dataForm,'/warehouse/paths/approved')
+          }).then(({data}) => {
+            if (data && data.code === 200) {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 600,
+                onClose: () => {
+                  this.closeDia()
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+      },
+      approvalRejected () {
+        this.$confirm(`是否驳回审批?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
+          }).then(({data}) => {
+            if (data && data.code === 0) {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 600,
+                onClose: () => {
+                  this.closeDia()
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+      },
+      closeDialog (done) {
+        done()
+        // location.reload()
+        this.visible = false
+        this.$emit('returnApproval', this.dataForm.id, false)
+        Object.assign(this.$data, this.$options.data.call(this))
+      },
+      closeDia () {
+        this.visible = false
+        this.$emit('returnApproval', this.dataForm.id, false)
+        Object.assign(this.$data, this.$options.data.call(this))
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 19
src/views/system/auditConfiguration/index.vue

@@ -169,26 +169,8 @@ export default {
       formData.append('auditPathsActs', JSON.stringify(this.dataList))
       preservation(formData).then(data =>{
         console.log(data)
+        this.$message.success('保存成功');
       })
-
-      // this.$http({
-      //   url: this.$http.adornUrl('/engineering/auditPaths/saveAuditPathAct'),
-      //   method: 'post',
-      //   data: (JSON.stringify(this.dataList))
-      // }).then(({data}) => {
-      //   if (data && data.code === 0) {
-      //     this.$message({
-      //       message: '操作成功',
-      //       type: 'success',
-      //       duration: 600,
-      //       onClose: () => {
-      //         this.getDataList()
-      //       }
-      //     })
-      //   } else {
-      //     this.$message.error(data.msg)
-      //   }
-      // })
     },
     // 每页数
     sizeChangeHandle (val) {