startApproval.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. import Global from '@/layout/components/global'
  38. export default {
  39. name: 'startApproval',
  40. data () {
  41. return {
  42. dataForm: {
  43. id: null,
  44. actId: null,
  45. auditMsg: null,
  46. auditUserId: this.$store.state.user.id
  47. },
  48. visible: false,
  49. optionsBranch: [{
  50. id: this.$store.state.user.id,
  51. cname: this.$store.state.user.actualname
  52. }]
  53. }
  54. },
  55. components: {
  56. },
  57. methods: {
  58. init (id,actId) {
  59. // 默认录入人
  60. queryUserVal().then((response)=>{
  61. this.dataForm.auditUserId = response.user.userName
  62. })
  63. this.visible = true
  64. if (typeof id === 'undefined' || typeof actId === 'undefined') {
  65. this.$message.error('未检测到对应信息,请选择')
  66. return false
  67. }
  68. this.dataForm.id = id
  69. this.dataForm.actId = actId
  70. this.dataForm.billId = id
  71. },
  72. approved () {
  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. this.visible = true
  91. // this.homePage()
  92. } else {
  93. this.$message.error(data.msg)
  94. }
  95. })
  96. },
  97. // homePage(){
  98. // let view = {
  99. // fullPath: "/finance/charge",
  100. // hash: "",
  101. // matched: Array(2),
  102. // meta: Object,
  103. // name: "Charge",
  104. // params: Object,
  105. // path: "/finance/charge",
  106. // query: Object,
  107. // title: "收费"
  108. // }
  109. // this.$router.push({ path: '/index'})
  110. // this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  111. // if (this.isActive(view)) {
  112. // this.toLastView(visitedViews, view)
  113. // }
  114. // })
  115. // Global.$emit("removeCache", "closeSelectedTag", view);
  116. // },
  117. approvalRejected () {
  118. this.dataForm.auditUserId = ''
  119. this.$confirm(`是否驳回审批?`, '提示', {
  120. confirmButtonText: '确定',
  121. cancelButtonText: '取消',
  122. type: 'warning'
  123. }).then(() => {
  124. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  125. }).then(data => {
  126. if (data && data.code == 200) {
  127. this.$message({
  128. message: '驳回审批',
  129. type: 'success',
  130. duration: 600,
  131. // onClose: () => {
  132. // this.closeDia()
  133. // }
  134. })
  135. this.visible = true
  136. this.closeDia()
  137. // this.homePage()
  138. } else {
  139. this.$message.error(data.msg)
  140. }
  141. })
  142. },
  143. closeDialog (done) {
  144. this.visible = false
  145. this.$emit('returnApproval', this.dataForm.id, false)
  146. Object.assign(this.$data, this.$options.data.call(this))
  147. },
  148. closeDia () {
  149. this.visible = false
  150. this.$emit('refreshDataList', this.dataForm.id, false)
  151. Object.assign(this.$data, this.$options.data.call(this))
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped>
  157. </style>