startApproval.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. },
  70. approved () {
  71. this.$confirm(`是否通过审批?`, '提示', {
  72. confirmButtonText: '确定',
  73. cancelButtonText: '取消',
  74. type: 'warning'
  75. }).then(() => {
  76. return listCharge(this.dataForm,'/warehouse/paths/approved')
  77. }).then(({data}) => {
  78. if (data && data.code === 200) {
  79. this.$message({
  80. message: '操作成功',
  81. type: 'success',
  82. duration: 600,
  83. onClose: () => {
  84. this.closeDia()
  85. }
  86. })
  87. } else {
  88. this.$message.error(data.msg)
  89. }
  90. })
  91. },
  92. approvalRejected () {
  93. this.$confirm(`是否驳回审批?`, '提示', {
  94. confirmButtonText: '确定',
  95. cancelButtonText: '取消',
  96. type: 'warning'
  97. }).then(() => {
  98. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  99. }).then(({data}) => {
  100. if (data && data.code === 0) {
  101. this.$message({
  102. message: '操作成功',
  103. type: 'success',
  104. duration: 600,
  105. onClose: () => {
  106. this.closeDia()
  107. }
  108. })
  109. } else {
  110. this.$message.error(data.msg)
  111. }
  112. })
  113. },
  114. closeDialog (done) {
  115. done()
  116. // location.reload()
  117. this.visible = false
  118. this.$emit('returnApproval', this.dataForm.id, false)
  119. Object.assign(this.$data, this.$options.data.call(this))
  120. },
  121. closeDia () {
  122. this.visible = false
  123. this.$emit('returnApproval', this.dataForm.id, false)
  124. Object.assign(this.$data, this.$options.data.call(this))
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. </style>