transfer.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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
  5. class="p3 bg-color-white"
  6. style="margin-top: -50rpx; border-radius: 20rpx"
  7. >
  8. <u-form :model="form" ref="uForm" :label-width="180">
  9. <u-form-item label="第一维修人" >
  10. <view >{{ model.repairUserName }}</view>
  11. </u-form-item>
  12. <u-form-item label="第二维修人" required prop="secondRepairUser">
  13. <my-select :disabled="disabled.includes('secondRepairUser')" :list="zjList" v-model="form.secondRepairUser" />
  14. </u-form-item>
  15. <u-form-item v-show="active>0" label="第三维修人" required prop="threeRepairUser">
  16. <my-select :disabled="disabled.includes('threeRepairUser')" :list="zjList" v-model="form.threeRepairUser" />
  17. </u-form-item>
  18. <u-form-item v-show="active>1" label="第四维修人" required prop="fourRepairUser">
  19. <my-select :list="zjList" v-model="form.fourRepairUser" />
  20. </u-form-item>
  21. <u-form-item v-show="active<2">
  22. <u-button type="primary" @tap="active++">添加维修人</u-button>
  23. </u-form-item>
  24. </u-form>
  25. <view class="p-fixed d-flex j-around a-center footer">
  26. <view
  27. class="main-color-bg text-color-white common"
  28. :loading="confirmLoading"
  29. @tap="submit"
  30. >提交</view
  31. >
  32. </view>
  33. </view>
  34. <u-toast ref="uToast" />
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. form: {
  42. id: '',
  43. secondRepairUser: '',
  44. threeRepairUser: '',
  45. fourRepairUser: '',
  46. },
  47. disabled:[],
  48. rules: {
  49. },
  50. detailId: '',
  51. confirmLoading: false,
  52. zjList: [],
  53. active:0,
  54. model:{}
  55. };
  56. },
  57. onReady() {
  58. this.$refs.uForm.setRules(this.rules);
  59. },
  60. onLoad(options) {
  61. this.form.id = options.id
  62. this.getInfo()
  63. },
  64. methods: {
  65. getInfo() {
  66. this.$Http
  67. .fetchRepairApplicationForm({
  68. id: this.form.id
  69. }).then((res) => {
  70. this.model = res.data
  71. if(res.data.threeRepairUser){
  72. this.active=2
  73. this.disabled.push('secondRepairUser','threeRepairUser')
  74. }else
  75. if(res.data.secondRepairUser){
  76. this.active=1
  77. this.disabled.push('secondRepairUser')
  78. }
  79. this.form.secondRepairUser= res.data.secondRepairUser
  80. this.form.threeRepairUser= res.data.threeRepairUser
  81. this.form.fourRepairUser= res.data.fourRepairUser
  82. })
  83. this.$Http
  84. .queryUserListByRoleCode({
  85. roleCode: 'Maintenance'
  86. })
  87. .then((res) => {
  88. console.log(res.data);
  89. const temp = []
  90. res.data.forEach((item, index) => {
  91. temp.push({
  92. label: item.realName,
  93. value: item.userId
  94. })
  95. })
  96. this.zjList.push(...temp)
  97. });
  98. /* this.$Http
  99. .queryUserListByRoleCode({
  100. roleCode: 'Maintenance'
  101. })
  102. .then((res) => {
  103. console.log(res.data);
  104. const temp = []
  105. res.data.forEach((item, index) => {
  106. temp.push({
  107. label: item.realName,
  108. value: item.userId
  109. })
  110. })
  111. this.zjList.push(...temp)
  112. }); */
  113. },
  114. // 提交
  115. submit() {
  116. this.$refs.uForm.validate(valid => {
  117. if (valid) {
  118. this.$Http.transferRepair(this.form)
  119. .then((res) => {
  120. this.confirmLoading = false
  121. this.$refs.uToast.show({
  122. title: '提交成功!',
  123. type: 'success',
  124. back : true
  125. })
  126. }).catch(() => {
  127. this.confirmLoading = false
  128. })
  129. } else {
  130. console.log('验证失败');
  131. }
  132. });
  133. },
  134. }
  135. };
  136. </script>
  137. <style lang="less">
  138. page {
  139. background-color: #f4f4f4;
  140. }
  141. .footer {
  142. bottom: 0;
  143. left: 0;
  144. right: 0;
  145. background-color: #fff;
  146. z-index: 10000;
  147. border-top: 1rpx solid #f4f4f4;
  148. height: 100rpx;
  149. .common {
  150. padding: 15rpx 200rpx;
  151. border-radius: 30rpx;
  152. background-color: #0082ff;
  153. color: #fff;
  154. }
  155. }
  156. </style>