startApproval.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <el-dialog
  3. :title="'审批'"
  4. :close-on-click-modal="false"
  5. :before-close="closeDialog"
  6. :visible.sync="visible"
  7. :append-to-body="true"
  8. :modal="false"
  9. width="55%">
  10. <el-form v-model="dataForm" :inline="true">
  11. <div class="form-group dialog">
  12. <el-form-item class="full" label="审批意见" prop="auditMsg">
  13. <el-input type="textarea" placeholder="审批意见" v-model="dataForm.auditMsg"></el-input>
  14. </el-form-item>
  15. <el-form-item label="审批人" class="full" prop="auditUserId">
  16. <el-select v-model="dataForm.auditUserId" disabled placeholder="审批人" style="width: 100%;">
  17. <el-option
  18. v-for="item in optionsBranch"
  19. :key="item.id"
  20. :label="item.cname"
  21. :value="item.id">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. </div>
  26. </el-form>
  27. <span slot="footer" class="dialog-footer">
  28. <el-button @click="closeDia">关闭</el-button>
  29. <el-button @click="approvalRejected">审批驳回</el-button>
  30. <el-button @click="approved">审批通过</el-button>
  31. </span>
  32. </el-dialog>
  33. </template>
  34. <script>
  35. import { listCharge } from '@/api/system/startApproval'
  36. import { queryUserVal } from '@/api/warehouseBusiness/agreement'
  37. export default {
  38. name: 'startApproval',
  39. data () {
  40. return {
  41. dataForm: {
  42. id: null,
  43. actId: null,
  44. auditMsg: null,
  45. auditUserId: this.$store.state.user.id
  46. },
  47. visible: false,
  48. optionsBranch: [{
  49. id: this.$store.state.user.id,
  50. cname: this.$store.state.user.actualname
  51. }]
  52. }
  53. },
  54. components: {
  55. },
  56. methods: {
  57. init (id,actId) {
  58. // 默认录入人
  59. queryUserVal().then((response)=>{
  60. this.dataForm.auditUserId = response.user.userName
  61. })
  62. this.visible = true
  63. if (typeof id === 'undefined' || typeof actId === 'undefined') {
  64. this.$message.error('未检测到对应信息,请选择')
  65. return false
  66. }
  67. this.dataForm.id = id
  68. this.dataForm.actId = actId
  69. this.dataForm.billId = id
  70. },
  71. approved () {
  72. console.log(this.dataForm)
  73. this.dataForm.auditUserId = ''
  74. this.$confirm(`是否通过审批?`, '提示', {
  75. confirmButtonText: '确定',
  76. cancelButtonText: '取消',
  77. type: 'warning'
  78. }).then(() => {
  79. return listCharge(this.dataForm,'/warehouse/paths/approved')
  80. }).then(({data}) => {
  81. if (data && data.code === 200) {
  82. this.$message({
  83. message: '操作成功',
  84. type: 'success',
  85. duration: 600,
  86. onClose: () => {
  87. this.closeDia()
  88. }
  89. })
  90. } else {
  91. this.$message.error(data.msg)
  92. }
  93. })
  94. },
  95. approvalRejected () {
  96. this.$confirm(`是否驳回审批?`, '提示', {
  97. confirmButtonText: '确定',
  98. cancelButtonText: '取消',
  99. type: 'warning'
  100. }).then(() => {
  101. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  102. }).then(({data}) => {
  103. if (data && data.code === 0) {
  104. this.$message({
  105. message: '操作成功',
  106. type: 'success',
  107. duration: 600,
  108. onClose: () => {
  109. this.closeDia()
  110. }
  111. })
  112. } else {
  113. this.$message.error(data.msg)
  114. }
  115. })
  116. },
  117. closeDialog (done) {
  118. this.visible = false
  119. this.$emit('returnApproval', this.dataForm.id, false)
  120. Object.assign(this.$data, this.$options.data.call(this))
  121. },
  122. closeDia () {
  123. this.visible = false
  124. this.$emit('returnApproval', this.dataForm.id, false)
  125. Object.assign(this.$data, this.$options.data.call(this))
  126. }
  127. }
  128. }
  129. </script>
  130. <style scoped>
  131. </style>