work-confirm.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div>
  3. <div class="my-title">确认</div>
  4. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  5. <el-row class="my-row">
  6. <el-col :span="8">
  7. <el-form-item label="确认状态" prop="confirmState">
  8. <el-select
  9. v-model="dataForm.confirmState"
  10. placeholder="请选择">
  11. <el-option v-for="item in options"
  12. :key="item.value"
  13. :label="item.label"
  14. :value="item.value">
  15. </el-option>
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="16" style="padding-left: 20px">
  20. <el-form-item label="退回说明" prop="backExplain">
  21. <el-input v-model="dataForm.backExplain" placeholder="退回说明"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. </el-form>
  26. <span slot="footer" class="dialog-footer">
  27. <el-button @click="onChose">取消</el-button>
  28. <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
  29. </span>
  30. </div>
  31. </template>
  32. <script>
  33. import {confirm} from '@/api/task'
  34. export default {
  35. name: 'work-confirm',
  36. data () {
  37. return {
  38. options: [{
  39. value: '1',
  40. label: '确认完成'
  41. },
  42. {
  43. value: '2',
  44. label: '退回'
  45. }],
  46. dataForm: {},
  47. dataRule: {
  48. confirmState: [{ required: true, message: '请选择确认状态', trigger: 'change' }]
  49. }
  50. }
  51. },
  52. methods: {
  53. onChose () {
  54. this.$emit('onChose')
  55. },
  56. async init (taskId) {
  57. this.dataForm = {
  58. taskId: taskId
  59. }
  60. },
  61. validateField (type) {
  62. this.$refs.dataForm.validateField(type)
  63. },
  64. // 表单提交
  65. dataFormSubmit () {
  66. this.$refs['dataForm'].validate((valid) => {
  67. if (valid) {
  68. confirm(this.dataForm).then(({data}) => {
  69. if (data && data.code === '200') {
  70. this.$message({
  71. message: '操作成功',
  72. type: 'success',
  73. duration: 1500,
  74. onClose: () => {
  75. this.onChose()
  76. this.$emit('refreshDataList')
  77. }
  78. })
  79. } else {
  80. this.$message.error(data.msg)
  81. }
  82. }).catch(() => {})
  83. }
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style scoped>
  90. </style>