startApproval.vue 4.8 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. console.log(this.dataForm)
  74. this.$confirm(`是否通过审批?`, '提示', {
  75. confirmButtonText: '确定',
  76. cancelButtonText: '取消',
  77. type: 'warning'
  78. }).then(() => {
  79. return listCharge(this.dataForm,'/warehouse/paths/approved')
  80. }).then(data => {
  81. console.log(data)
  82. if (data && data.code == 200) {
  83. this.$message({
  84. message: '审核通过',
  85. type: 'success',
  86. duration: 600,
  87. onClose: () => {
  88. this.closeDia()
  89. }
  90. })
  91. this.visible = true
  92. this.homePage()
  93. } else {
  94. this.$message.error(data.msg)
  95. }
  96. })
  97. },
  98. homePage(){
  99. let view = {
  100. fullPath: "/finance/charge",
  101. hash: "",
  102. matched: Array(2),
  103. meta: Object,
  104. name: "Charge",
  105. params: Object,
  106. path: "/finance/charge",
  107. query: Object,
  108. title: "收费"
  109. }
  110. this.$router.push({ path: '/index'})
  111. this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  112. if (this.isActive(view)) {
  113. this.toLastView(visitedViews, view)
  114. }
  115. })
  116. Global.$emit("removeCache", "closeSelectedTag", view);
  117. },
  118. approvalRejected () {
  119. this.dataForm.auditUserId = ''
  120. this.$confirm(`是否驳回审批?`, '提示', {
  121. confirmButtonText: '确定',
  122. cancelButtonText: '取消',
  123. type: 'warning'
  124. }).then(() => {
  125. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  126. }).then(data => {
  127. if (data && data.code == 200) {
  128. this.$message({
  129. message: '驳回审批',
  130. type: 'success',
  131. duration: 600,
  132. onClose: () => {
  133. this.closeDia()
  134. }
  135. })
  136. this.visible = true
  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('returnApproval', this.dataForm.id, false)
  151. Object.assign(this.$data, this.$options.data.call(this))
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped>
  157. </style>