turn_send.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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="tourTallyDetailFn(worksheetInfo)"></DetailMain>
  12. </template>
  13. </view>
  14. <button class="btn-submit" @click="bindSubmit" :loading="loading">
  15. 提交
  16. </button>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. get,postJ
  22. } from "@/utils/api.js"
  23. import {
  24. tourTallyDetailFn
  25. } from '@/utils/common.js'
  26. import DetailMain from '@/components/DetailMain.vue'
  27. import TurnSendList from '@/components/TurnSendList.vue'
  28. import CellTip from '@/components/CellTip.vue'
  29. import CellInfo from '@/components/CellInfo.vue'
  30. export default {
  31. components: {
  32. DetailMain,
  33. TurnSendList,
  34. CellTip,
  35. CellInfo
  36. },
  37. data() {
  38. return {
  39. pageId:'',
  40. loading:false,
  41. worksheetInfo: null,
  42. tourTallyDetailFn,
  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.tour_tally.executorInfo;
  55. },
  56. methods: {
  57. getInfo(){
  58. get(this.apiUrl + "/patrol/order/getDetail/"+this.pageId).then(res=>{
  59. this.worksheetInfo = res.data;
  60. this.code = this.worksheetInfo.plan.executeDeptCode
  61. })
  62. },
  63. getRedeployCause(e){
  64. this.redeployCause = e.detail.value;
  65. },
  66. bindSubmit(){
  67. if(!this.executorInfo || !this.executorInfo.executorId){
  68. uni.showToast({
  69. title:'请选择转派人员',
  70. icon:'none'
  71. })
  72. return
  73. }
  74. if(!this.redeployCause){
  75. uni.showToast({
  76. title:'请输入转派原因',
  77. icon:'none'
  78. })
  79. return
  80. }
  81. let data = {
  82. userId: this.executorInfo.executorId,
  83. userName: this.executorInfo.executorName,
  84. woId: this.pageId,
  85. }
  86. this.loading=true
  87. postJ(this.apiUrl+ "/patrol/order/transfer",data).then(res=>{
  88. this.loading=false
  89. setTimeout(()=>{
  90. this.back(2)
  91. },2000)
  92. uni.showToast({
  93. title:'转派成功',
  94. })
  95. }).catch(err=>{
  96. uni.showToast({
  97. title:err.message || '转派失败',
  98. icon:'none'
  99. })
  100. })
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. input{
  107. text-align: right;
  108. color: $uni-text-color-grey;
  109. font-size: $uni-font-size-base;
  110. }
  111. </style>