approve-component-batch.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <el-row style="margin-bottom: 20px">
  3. <el-col :span="16">
  4. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  5. <el-row class="my-row">
  6. <el-form-item label="处理意见" prop="remark">
  7. <el-input type="textarea" v-model="dataForm.remark" placeholder="处理意见"></el-input>
  8. </el-form-item>
  9. </el-row>
  10. <el-row class="my-row">
  11. <upload-component :title="'审批附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
  12. </el-row>
  13. </el-form>
  14. </el-col>
  15. <el-col :span="8">
  16. <el-button style="margin-left: 20px" @click="dataFormSubmit(2)">不同意</el-button>
  17. <el-button type="primary" @click="dataFormSubmit(1)">同意</el-button>
  18. <el-button type="danger" @click="dataFormSubmit(3)">驳回</el-button>
  19. </el-col>
  20. </el-row>
  21. </template>
  22. <script>
  23. import UploadComponent from '../common/upload-component'
  24. export default {
  25. name: 'approve-component',
  26. components: {UploadComponent},
  27. data () {
  28. return {
  29. dataForm: {},
  30. fileList: [],
  31. dataRule: {
  32. remark: [{ required: true, message: '处理意见不能为空', trigger: 'blur' }]
  33. }
  34. }
  35. },
  36. methods: {
  37. async init (businessType, businessIds) {
  38. // console.log('[approve-component]businessType = ' + businessType)
  39. // console.log('[approve-component]businessId = ' + businessId)
  40. this.visible = true
  41. this.dataForm = {
  42. busiType: businessType || '',
  43. busiIds: businessIds || []
  44. }
  45. this.fileList = []
  46. },
  47. // 表单提交
  48. dataFormSubmit (val) {
  49. this.$refs['dataForm'].validate((valid) => {
  50. if (valid) {
  51. // 添加附件
  52. let fList = this.fileList
  53. if (fList.length > 0) {
  54. this.dataForm.attachList = []
  55. for (let i = 0; i < fList.length; i++) {
  56. this.dataForm.attachList.push({
  57. fileName: fList[i].name,
  58. url: fList[i].url
  59. })
  60. }
  61. }
  62. this.$http({
  63. url: this.$http.adornUrl(`/biz-service/business/batch/approval`),
  64. method: 'post',
  65. data: this.$http.adornData(
  66. {...this.dataForm,
  67. approvalType: val,
  68. userName: this.$store.state.user.name,
  69. orgId: this.$store.state.user.orgId
  70. })
  71. }).then(({data}) => {
  72. if (data && data.code === '200') {
  73. this.$message({
  74. message: '操作成功',
  75. type: 'success',
  76. duration: 1500,
  77. onClose: () => {
  78. this.visible = false
  79. this.$emit('approveFinished')
  80. }
  81. })
  82. } else {
  83. this.$message.error(data.msg)
  84. }
  85. })
  86. }
  87. })
  88. },
  89. validateField (type) {
  90. this.$refs.dataForm.validateField(type)
  91. },
  92. uploadSuccess (fileList) {
  93. this.fileList = fileList
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped>
  99. </style>