PauseForm.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <a-modal
  3. title="转派"
  4. :width="800"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. >
  9. <a-form :form="form">
  10. <a-form-item>
  11. <a-input v-decorator="['id']" type="hidden"/>
  12. </a-form-item>
  13. <a-form-item
  14. label="要求时间"
  15. :labelCol="BaseTool.Constant.labelCol"
  16. :wrapperCol="BaseTool.Constant.wrapperCol"
  17. >
  18. <a-input-number
  19. :min="0"
  20. :formatter="value => `${value}小时`"
  21. :parser="value => value.replace('小时', '')"
  22. v-decorator="['requireHour', {rules: [{required: true, message: '要求时间不能为空'}]}]"/>
  23. </a-form-item>
  24. </a-form>
  25. <template slot="footer">
  26. <a-button :loading="confirmLoading" type="primary" @click="save()">提交</a-button>
  27. </template>
  28. </a-modal>
  29. </template>
  30. <script>
  31. import pick from 'lodash.pick'
  32. import { getQueryUser } from '@/api/fill/gather'
  33. import { pauseFillGatherTask } from '@/api/fill/task'
  34. import RowList from '@/components/custom/RowList.vue'
  35. export default {
  36. components: { RowList },
  37. name: 'BaseFillGather',
  38. data () {
  39. return {
  40. confirmLoading: false,
  41. form: this.$form.createForm(this),
  42. visible: false,
  43. // 下拉框map
  44. ipqcMap: {}
  45. }
  46. },
  47. created () {
  48. this.getUser()
  49. },
  50. methods: {
  51. base (record) {
  52. console.log(record)
  53. this.visible = true
  54. const { form: { setFieldsValue } } = this
  55. // 日期处理
  56. this.$nextTick(() => {
  57. setFieldsValue(Object.assign(pick(record, [
  58. 'id'
  59. ])))
  60. })
  61. },
  62. getUser () {
  63. getQueryUser(this.DictCache.VALUE.QUERY_ROLE_TYPE.IPQC).then(res => {
  64. this.ipqcMap = res.data
  65. })
  66. },
  67. save () {
  68. const { form: { validateFieldsAndScroll } } = this
  69. this.confirmLoading = true
  70. validateFieldsAndScroll((errors, values) => {
  71. if (errors) {
  72. this.confirmLoading = false
  73. return
  74. }
  75. values.pauseType = 2
  76. console.log(values)
  77. pauseFillGatherTask(values).then(res => {
  78. this.handleCancel()
  79. })
  80. // 日期处理
  81. })
  82. },
  83. handleCancel () {
  84. this.visible = false
  85. this.$emit('ok')
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="less" scoped>
  91. </style>