review.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="page-form-container">
  3. <device-detail :product-id="productId" />
  4. <template v-if="type === 'audit'">
  5. <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
  6. <el-form-item label="审核:">
  7. <el-radio-group v-model="auditForm.auditStatus">
  8. <el-radio :label="1">通过</el-radio>
  9. <el-radio :label="0">不通过</el-radio>
  10. </el-radio-group>
  11. </el-form-item>
  12. <el-form-item v-if="auditForm.auditStatus === 0" label="原因:" prop="invalidReason">
  13. <el-input v-model="auditForm.invalidReason" type="textarea" :rows="3" />
  14. </el-form-item>
  15. </el-form>
  16. <div class="control-box">
  17. <el-button type="info" @click="navigateBack">返回</el-button>
  18. <el-button type="primary" @click="submit">提交</el-button>
  19. </div>
  20. </template>
  21. </div>
  22. </template>
  23. <script>
  24. import { auditProduct } from '@/api/product'
  25. import { mapGetters } from 'vuex'
  26. import { DeviceDetail } from '@/views/components'
  27. export default {
  28. components: {
  29. DeviceDetail
  30. },
  31. data() {
  32. return {
  33. type: 'review',
  34. productId: '',
  35. auditForm: {
  36. productId: '',
  37. auditBy: '', // 审核人id
  38. authId: '', // 机构id
  39. auditStatus: 1, // 审核状态
  40. invalidReason: '' // 审核信息
  41. },
  42. rules: {
  43. invalidReason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
  44. }
  45. }
  46. },
  47. computed: {
  48. ...mapGetters(['authUserId'])
  49. },
  50. created() {
  51. this.authId = this.$route.query.authId
  52. this.productId = this.$route.query.productId
  53. this.type = this.$route.query.type
  54. },
  55. methods: {
  56. // 提交审核信息
  57. submit() {
  58. this.auditForm.productId = this.productId
  59. this.$refs.auditForm.validate((valid) => {
  60. if (valid) {
  61. this.isLoading = true
  62. // 指定审核人
  63. this.auditForm.auditBy = this.authUserId
  64. auditProduct(this.auditForm)
  65. .then((res) => {
  66. this.$message.success(res.data)
  67. this.$store.dispatch('tagsView/delView', this.$route)
  68. this.$router.back()
  69. })
  70. .finally(() => {
  71. this.isLoading = false
  72. })
  73. }
  74. })
  75. }
  76. }
  77. }
  78. </script>