turn_send.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="转派保养订单" @clickLeft="back"></uni-nav-bar>
  4. <view class="page-bottom-padding">
  5. <template>
  6. <CellTip title="转派信息"> </CellTip>
  7. <TurnSendList :executorInfo="executorInfo" :code="code" @change="getRedeployCause"></TurnSendList>
  8. </template>
  9. <template v-if="worksheetInfo">
  10. <CellTip title="基本信息"> </CellTip>
  11. <DetailMain :detailsInfo="maintainDetailFn(worksheetInfo)"></DetailMain>
  12. </template>
  13. </view>
  14. <view class="btn-submit" @click="bindSubmit">
  15. 提交
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. get,
  22. postJ
  23. } from "@/utils/api.js"
  24. import {
  25. maintainDetailFn
  26. } from '@/utils/common.js'
  27. import DetailMain from '@/components/DetailMain.vue'
  28. import TurnSendList from '@/components/TurnSendList.vue'
  29. import CellTip from '@/components/CellTip.vue'
  30. import CellInfo from '@/components/CellInfo.vue'
  31. export default {
  32. components: {
  33. DetailMain,
  34. TurnSendList,
  35. CellTip,
  36. CellInfo
  37. },
  38. data() {
  39. return {
  40. pageId: '',
  41. worksheetInfo: null,
  42. maintainDetailFn,
  43. executorInfo: null,
  44. redeployCause: '',
  45. code:""
  46. }
  47. },
  48. onLoad(options) {
  49. this.pageId = options.id;
  50. this.getInfo();
  51. },
  52. onShow() {
  53. //转派人员信息
  54. this.executorInfo = this.$store.state.maintenance.executorInfo;
  55. },
  56. methods: {
  57. getInfo() {
  58. get(this.apiUrl + "/maintain/order/getDetail/" + this.pageId).then(res => {
  59. // console.log(res)
  60. this.worksheetInfo = res.data;
  61. this.code = this.worksheetInfo.plan.executeDeptCode
  62. })
  63. },
  64. getRedeployCause(e) {
  65. this.redeployCause = e.detail.value;
  66. },
  67. bindSubmit() {
  68. if (!this.executorInfo || !this.executorInfo.executorId) {
  69. uni.showToast({
  70. title: '请选择转派人员',
  71. icon: 'none'
  72. })
  73. return
  74. }
  75. if (!this.redeployCause) {
  76. uni.showToast({
  77. title: '请输入转派原因',
  78. icon: 'none'
  79. })
  80. return
  81. }
  82. let data = {
  83. userId: this.executorInfo.executorId,
  84. userName: this.executorInfo.executorName,
  85. woId: this.pageId,
  86. }
  87. postJ(this.apiUrl + "/maintain/order/transfer", data).then(res => {
  88. uni.showToast({
  89. title: '转派成功',
  90. })
  91. setTimeout(() => {
  92. this.back(2)
  93. }, 1000)
  94. }).catch(err => {
  95. uni.showToast({
  96. title: err.message || '转派失败',
  97. icon: 'none'
  98. })
  99. })
  100. },
  101. }
  102. }
  103. </script>