startApproval.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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, addMblno} 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. numData:{
  53. fId:null,
  54. fMblno:null,
  55. },
  56. dataForm: {
  57. id: null,
  58. actId: null,
  59. auditMsg: null,
  60. auditUserId: null,
  61. auditItem: null,
  62. refno3:null
  63. },
  64. visible: false,
  65. optionsBranch: []
  66. }
  67. },
  68. components: {
  69. },
  70. methods: {
  71. // changefMblno(fId,fMblno){
  72. // console.log(fId,fMblno)
  73. // this.numData.fId = fId
  74. // this.numData.fMblno = fMblno
  75. // },
  76. init (id,actId,fMblno) {
  77. this.optionsBranch = []
  78. // 默认录入人
  79. queryUserVal().then((response)=>{
  80. this.dataForm.auditUserId = response.user.userId
  81. this.optionsBranch.push(response.user)
  82. })
  83. this.visible = true
  84. if (typeof id === 'undefined' || typeof actId === 'undefined') {
  85. this.$message.error('未检测到对应信息,请选择')
  86. return false
  87. }
  88. this.dataForm.id = id
  89. this.dataForm.billId = id
  90. this.dataForm.actId = actId
  91. if(fMblno){
  92. this.dataForm.refno3 = fMblno
  93. }
  94. this.$set(this.dataForm, 'auditItem', Date.parse(new Date()))
  95. },
  96. getTime(){
  97. var date = new Date(this.dataForm.auditItem)
  98. var y = date.getFullYear()
  99. var m = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  100. var d = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  101. this.$set(this.dataForm, 'auditItem', y + '-' + m + '-' + d)
  102. },
  103. approved () {
  104. this.$confirm(`是否通过审批?`, '提示', {
  105. confirmButtonText: '确定',
  106. cancelButtonText: '取消',
  107. type: 'warning'
  108. }).then(() => {
  109. this.getTime()
  110. return listCharge(this.dataForm,'/warehouse/paths/approved')
  111. }).then(data => {
  112. if (data && data.code == 200) {
  113. this.$message({
  114. message: '审核通过',
  115. type: 'success',
  116. duration: 600,
  117. onClose: () => {
  118. this.closeDia()
  119. }
  120. })
  121. this.visible = true
  122. // this.homePage()
  123. } else {
  124. this.$message.error(data.msg)
  125. }
  126. })
  127. },
  128. // homePage(){
  129. // let view = {
  130. // fullPath: "/finance/charge",
  131. // hash: "",
  132. // matched: Array(2),
  133. // meta: Object,
  134. // name: "Charge",
  135. // params: Object,
  136. // path: "/finance/charge",
  137. // query: Object,
  138. // title: "收费"
  139. // }
  140. // this.$router.push({ path: '/index'})
  141. // this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  142. // if (this.isActive(view)) {
  143. // this.toLastView(visitedViews, view)
  144. // }
  145. // })
  146. // Global.$emit("removeCache", "closeSelectedTag", view);
  147. // },
  148. approvalRejected () {
  149. this.$confirm(`是否驳回审批?`, '提示', {
  150. confirmButtonText: '确定',
  151. cancelButtonText: '取消',
  152. type: 'warning'
  153. }).then(() => {
  154. this.dataForm.createTime = ''
  155. return listCharge(this.dataForm,'/warehouse/paths/approvalRejected')
  156. }).then(data => {
  157. if (data && data.code == 200) {
  158. this.$message({
  159. message: '驳回审批',
  160. type: 'success',
  161. duration: 600,
  162. // onClose: () => {
  163. // this.closeDia()
  164. // }
  165. })
  166. this.visible = true
  167. this.closeDia()
  168. // this.homePage()
  169. } else {
  170. this.$message.error(data.msg)
  171. }
  172. })
  173. },
  174. closeDialog (done) {
  175. this.visible = false
  176. this.$emit('returnApproval', this.dataForm.id, false)
  177. Object.assign(this.$data, this.$options.data.call(this))
  178. },
  179. closeDia () {
  180. this.visible = false
  181. this.$emit('refreshDataList', this.dataForm.id, false)
  182. Object.assign(this.$data, this.$options.data.call(this))
  183. }
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. </style>