AssignForm.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <a-modal
  3. :title="modalTitle"
  4. :width="800"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. >
  9. <a-form :form="form">
  10. <row-list :col="2">
  11. <row-item>
  12. <a-form-item
  13. label="转签人"
  14. :labelCol="BaseTool.Constant.labelCol"
  15. :wrapperCol="BaseTool.Constant.wrapperCol"
  16. >
  17. <a-select v-decorator="['changeUser', {rules: [{required: true, message: '转签人不能为空'}]}]" placeholder="请选择">
  18. <a-select-option
  19. v-for="item in userList"
  20. :key="item.userId"
  21. :label="item.realName"
  22. :value="item.userId">{{ item.realName }}
  23. </a-select-option>
  24. </a-select>
  25. </a-form-item>
  26. </row-item>
  27. </row-list>
  28. </a-form>
  29. <template slot="footer">
  30. <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
  31. </template>
  32. </a-modal>
  33. </template>
  34. <script>
  35. import { queryUser } from '@/api/upms/user'
  36. import { changeSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
  37. export default {
  38. name: 'DispatchBaseForm',
  39. data () {
  40. return {
  41. confirmLoading: false,
  42. modalTitle: null,
  43. form: this.$form.createForm(this),
  44. visible: false,
  45. // 下拉框map
  46. sourceMap: {},
  47. levelMap: {},
  48. statusMap: {},
  49. record: {},
  50. userList: []
  51. }
  52. },
  53. props: {
  54. },
  55. created () {
  56. // 下拉框map
  57. this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
  58. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  59. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  60. this.getUsers()
  61. },
  62. methods: {
  63. base (record) {
  64. this.visible = true
  65. // 如果是空标识添加
  66. this.modalTitle = '派工'
  67. this.record = record
  68. },
  69. getUsers () {
  70. queryUser({ status: 1 }).then(res => {
  71. this.userList = res.data
  72. })
  73. },
  74. save () {
  75. const { form: { validateFieldsAndScroll } } = this
  76. this.confirmLoading = true
  77. validateFieldsAndScroll((errors, values) => {
  78. if (errors) {
  79. this.confirmLoading = false
  80. return
  81. }
  82. values.taskId = this.record.taskId
  83. values.auditModelKey = this.record.remark
  84. changeSbInfoScrapForAudit(values)
  85. .then((res) => {
  86. this.$message.info(res.data)
  87. this.handleCancel(values)
  88. }).catch(() => {
  89. this.confirmLoading = false
  90. })
  91. })
  92. },
  93. handleCancel (values) {
  94. this.visible = false
  95. this.confirmLoading = false
  96. this.form.resetFields()
  97. if (this.BaseTool.Object.isNotBlank(values)) {
  98. this.$emit('ok')
  99. }
  100. }
  101. }
  102. }
  103. </script>