startApproval.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.userId"
  20. :label="item.userName"
  21. :value="item.userId">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item disabled label="审批日期">
  26. <el-date-picker
  27. v-model="dataForm.auditItem"
  28. size="large"
  29. type="date"
  30. value-format="timestamp"
  31. placeholder="审批日期"
  32. >
  33. </el-date-picker>
  34. </el-form-item>
  35. </div>
  36. </el-form>
  37. <span slot="footer" class="dialog-footer">
  38. <el-button @click="closeDia">关闭</el-button>
  39. <el-button @click="approvalRejected">审批驳回</el-button>
  40. <el-button @click="approved">审批通过</el-button>
  41. </span>
  42. </el-dialog>
  43. </template>
  44. <script>
  45. import { listCharge } from '@/api/system/startApproval'
  46. import { queryUserVal } from '@/api/warehouseBusiness/agreement'
  47. import Global from '@/layout/components/global'
  48. export default {
  49. name: 'startApproval',
  50. data () {
  51. return {
  52. dataForm: {
  53. id: null,
  54. actId: null,
  55. auditMsg: null,
  56. auditUserId: null,
  57. auditItem: null
  58. },
  59. visible: false,
  60. optionsBranch: []
  61. }
  62. },
  63. components: {
  64. },
  65. methods: {
  66. init (id,actId) {
  67. this.optionsBranch = []
  68. // 默认录入人
  69. queryUserVal().then((response)=>{
  70. this.dataForm.auditUserId = response.user.userId
  71. this.optionsBranch.push(response.user)
  72. })
  73. this.visible = true
  74. if (typeof id === 'undefined' || typeof actId === 'undefined') {
  75. this.$message.error('未检测到对应信息,请选择')
  76. return false
  77. }
  78. this.dataForm.id = id
  79. this.dataForm.billId = id
  80. this.dataForm.actId = actId
  81. this.$set(this.dataForm, 'auditItem', Date.parse(new Date()))
  82. },
  83. getTime(){
  84. var date = new Date(this.dataForm.auditItem)
  85. var y = date.getFullYear()
  86. var m = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  87. var d = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  88. this.$set(this.dataForm, 'auditItem', y + '-' + m + '-' + d)
  89. },
  90. approved () {
  91. this.$confirm(`是否通过审批?`, '提示', {
  92. confirmButtonText: '确定',
  93. cancelButtonText: '取消',
  94. type: 'warning'
  95. }).then(() => {
  96. this.getTime()
  97. return listCharge(this.dataForm,'/warehouse/paths/approved')
  98. }).then(data => {
  99. if (data && data.code == 200) {
  100. this.$message({
  101. message: '审核通过',
  102. type: 'success',
  103. duration: 600,
  104. onClose: () => {
  105. this.closeDia()
  106. }
  107. })
  108. this.visible = true
  109. // this.homePage()
  110. } else {
  111. this.$message.error(data.msg)
  112. }
  113. })
  114. },
  115. // homePage(){
  116. // let view = {
  117. // fullPath: "/finance/charge",
  118. // hash: "",
  119. // matched: Array(2),
  120. // meta: Object,
  121. // name: "Charge",
  122. // params: Object,
  123. // path: "/finance/charge",
  124. // query: Object,
  125. // title: "收费"
  126. // }
  127. // this.$router.push({ path: '/index'})
  128. // this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  129. // if (this.isActive(view)) {
  130. // this.toLastView(visitedViews, view)
  131. // }
  132. // })
  133. // Global.$emit("removeCache", "closeSelectedTag", view);
  134. // },
  135. approvalRejected () {
  136. this.$confirm(`是否驳回审批?`, '提示', {
  137. confirmButtonText: '确定',
  138. cancelButtonText: '取消',
  139. type: 'warning'
  140. }).then(() => {
  141. this.dataForm.createTime = ''
  142. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  143. }).then(data => {
  144. if (data && data.code == 200) {
  145. this.$message({
  146. message: '驳回审批',
  147. type: 'success',
  148. duration: 600,
  149. // onClose: () => {
  150. // this.closeDia()
  151. // }
  152. })
  153. this.visible = true
  154. this.closeDia()
  155. // this.homePage()
  156. } else {
  157. this.$message.error(data.msg)
  158. }
  159. })
  160. },
  161. closeDialog (done) {
  162. this.visible = false
  163. this.$emit('returnApproval', this.dataForm.id, false)
  164. Object.assign(this.$data, this.$options.data.call(this))
  165. },
  166. closeDia () {
  167. this.visible = false
  168. this.$emit('refreshDataList', this.dataForm.id, false)
  169. Object.assign(this.$data, this.$options.data.call(this))
  170. }
  171. }
  172. }
  173. </script>
  174. <style scoped>
  175. </style>