transfer.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="mx3" style="padding-bottom: 100rpx">
  3. <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
  4. <view class="p3 bg-color-white" style="margin-top: -50rpx; border-radius: 20rpx">
  5. <!-- 与 PC 端 TransferForm 一致:提示当前维修人及转派审批说明 -->
  6. <view v-if="model.repairUserName" class="p2 mb-2"
  7. style="background: #e6f7ff; border-radius: 10rpx; font-size: 26rpx; color: #0082ff">
  8. 当前维修人:{{ model.repairUserName }},转派后将进入转派审批中状态,审批通过后更换维修人。
  9. </view>
  10. <u-form :model="form" ref="uForm" :label-width="180">
  11. <u-form-item label="新维修负责人" required prop="repairUserId">
  12. <my-select :list="userList" v-model="form.repairUserId" />
  13. </u-form-item>
  14. <u-form-item label="转派备注" required prop="repairDispatchRemark">
  15. <u-input type="textarea" v-model="form.repairDispatchRemark" placeholder="请填写转派原因" />
  16. </u-form-item>
  17. </u-form>
  18. <view class="p-fixed d-flex j-around a-center footer">
  19. <view class="main-color-bg text-color-white common" :loading="confirmLoading" @tap="submit">提交转派
  20. </view>
  21. </view>
  22. </view>
  23. <u-toast ref="uToast" />
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. form: {
  31. id: '',
  32. repairUserId: '',
  33. repairDispatchRemark: ''
  34. },
  35. rules: {
  36. repairUserId: [
  37. {
  38. required: true,
  39. message: '请选择新维修负责人',
  40. trigger: ['blur', 'change']
  41. }
  42. ],
  43. repairDispatchRemark: [
  44. {
  45. required: true,
  46. message: '转派备注不能为空',
  47. trigger: ['blur', 'change']
  48. }
  49. ]
  50. },
  51. confirmLoading: false,
  52. userList: [],
  53. model: {}
  54. };
  55. },
  56. onReady() {
  57. this.$refs.uForm.setRules(this.rules);
  58. },
  59. onLoad(options) {
  60. this.form.id = options.id
  61. this.getInfo()
  62. this.getDeptUsers()
  63. },
  64. methods: {
  65. getInfo() {
  66. this.$Http
  67. .fetchRepairApplicationForm({
  68. id: this.form.id
  69. }).then((res) => {
  70. this.model = res.data
  71. })
  72. },
  73. // 与 PC 端 TransferForm 一致:候选人为现场维修组 + 场内维修组的启用用户
  74. getDeptUsers() {
  75. this.$Http
  76. .queryUserDept({
  77. deptCode: this.$DictCache.VALUE.SYS_DEPT_CODE.SYS_DEPT_CODE_XIAN_CHANG_WEI_XIU_ZU,
  78. userStatus: 1
  79. })
  80. .then((res) => {
  81. this.$Http
  82. .queryUserDept({
  83. deptCode: this.$DictCache.VALUE.SYS_DEPT_CODE.SYS_DEPT_CODE_CHANG_NEI_WEI_XIU_ZU,
  84. userStatus: 1
  85. })
  86. .then((res2) => {
  87. const list = (res.data || []).concat(res2.data || [])
  88. this.userList = list.map(item => ({
  89. label: item.realName,
  90. value: item.userId
  91. }))
  92. })
  93. })
  94. },
  95. // 提交
  96. submit() {
  97. this.$refs.uForm.validate(valid => {
  98. if (valid) {
  99. this.$Http.transferRepair({
  100. id: this.form.id,
  101. repairUserId: this.form.repairUserId,
  102. repairDispatchRemark: this.form.repairDispatchRemark
  103. })
  104. .then((res) => {
  105. this.confirmLoading = false
  106. this.$refs.uToast.show({
  107. title: '转派已提交,等待审批',
  108. type: 'success',
  109. back: true
  110. })
  111. }).catch(() => {
  112. this.confirmLoading = false
  113. })
  114. } else {
  115. console.log('验证失败');
  116. }
  117. });
  118. },
  119. }
  120. };
  121. </script>
  122. <style lang="less">
  123. page {
  124. background-color: #f4f4f4;
  125. }
  126. .footer {
  127. bottom: 0;
  128. left: 0;
  129. right: 0;
  130. background-color: #fff;
  131. z-index: 10000;
  132. border-top: 1rpx solid #f4f4f4;
  133. height: 100rpx;
  134. .common {
  135. padding: 15rpx 200rpx;
  136. border-radius: 30rpx;
  137. background-color: #0082ff;
  138. color: #fff;
  139. }
  140. }
  141. </style>