TransferForm.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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="1">
  11. <row-item>
  12. <a-form-item
  13. label="转派对象"
  14. :labelCol="BaseTool.Constant.labelCol2"
  15. :wrapperCol="BaseTool.Constant.wrapperCol2"
  16. >
  17. <a-select
  18. v-decorator="['dispatchUserId']"
  19. placeholder="请选择">
  20. <a-select-option
  21. v-for="item in roleUserMap"
  22. :key="item.userId"
  23. :label="item.realName"
  24. :value="item.userId">{{ item.realName }}
  25. </a-select-option>
  26. </a-select>
  27. </a-form-item>
  28. </row-item>
  29. <row-item>
  30. <a-form-item
  31. label="转派理由"
  32. :labelCol="BaseTool.Constant.labelCol2"
  33. :wrapperCol="BaseTool.Constant.wrapperCol2"
  34. >
  35. <a-textarea
  36. :rows="4"
  37. v-decorator="['repairDispatchRemark', {rules: [{required: true, message: '转派理由不能为空'}]}]"/>
  38. </a-form-item>
  39. </row-item>
  40. </row-list>
  41. </a-form>
  42. <template slot="footer">
  43. <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
  44. </template>
  45. </a-modal>
  46. </template>
  47. <script>
  48. import { transferApplyByDTO } from '@/api/repair/application-form'
  49. import { queryRepairUser } from '@/api/upms/user-dept'
  50. export default {
  51. name: 'TransferForm',
  52. data () {
  53. return {
  54. confirmLoading: false,
  55. modalTitle: null,
  56. form: this.$form.createForm(this),
  57. visible: false,
  58. roleType: null,
  59. // 下拉框map
  60. record: {},
  61. roleUserMap: []
  62. }
  63. },
  64. props: {
  65. },
  66. created () {
  67. // 下拉框map
  68. },
  69. methods: {
  70. base (record, roleType) {
  71. this.visible = true
  72. // 如果是空标识添加
  73. this.modalTitle = '转派申请'
  74. this.record = record
  75. this.roleType = roleType
  76. // 转派工程师集合查询
  77. const params = { roleType: this.roleType, deptId: record.repairDeptId, queryType: 3 }
  78. this.getUsers(params)
  79. },
  80. save () {
  81. const { form: { validateFieldsAndScroll } } = this
  82. this.confirmLoading = true
  83. validateFieldsAndScroll((errors, values) => {
  84. if (errors) {
  85. this.confirmLoading = false
  86. return
  87. }
  88. values.id = this.record.id
  89. values.sbId = this.record.sbId
  90. values.no = this.record.no
  91. // values.dispatchUserId = this.record.dispatchUserId
  92. values.sbCph = this.record.sbCph
  93. values.status = this.record.status
  94. values.content = this.record.content
  95. values.category = this.record.category
  96. values.actualUser = this.record.actualUser
  97. values.roleType = this.roleType
  98. transferApplyByDTO(values)
  99. .then(() => {
  100. this.handleCancel(values)
  101. }).catch(() => {
  102. this.confirmLoading = false
  103. })
  104. })
  105. },
  106. getUsers (params) {
  107. queryRepairUser(params).then(res => {
  108. this.roleUserMap = res.data
  109. })
  110. },
  111. handleCancel (values) {
  112. this.visible = false
  113. this.confirmLoading = false
  114. this.form.resetFields()
  115. if (this.BaseTool.Object.isNotBlank(values)) {
  116. this.$emit('ok')
  117. }
  118. }
  119. }
  120. }
  121. </script>