consultation.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="consultation-container uni-column">
  4. <view class="title uni-row">咨询</view>
  5. <view class="info-row uni-row">
  6. <view class="label">批次号</view>
  7. <view class="value">{{ lot.lotCode }}</view>
  8. </view>
  9. <view class="info-row uni-row">
  10. <view class="label">技术负责人</view>
  11. <view class="value">{{ lot.product.technicianName }}</view>
  12. </view>
  13. <view class="info-row uni-row">
  14. <view class="label">产品描述</view>
  15. <view class="value">{{ lot.productDescription }}</view>
  16. </view>
  17. <view class="info-row uni-column">
  18. <view class="label" style="margin-bottom: 16rpx;">问题描述</view>
  19. <view class="value uni-row">
  20. <textarea v-model="lot.question"></textarea>
  21. </view>
  22. </view>
  23. <view class="btn uni-row" @click.stop="handleSubmit">提交</view>
  24. </view>
  25. </view>
  26. </template>
  27. <script setup>
  28. import {
  29. ref,
  30. onMounted,
  31. getCurrentInstance
  32. } from 'vue'
  33. import {
  34. onLoad,
  35. onReady,
  36. onUnload,
  37. onShow
  38. } from '@dcloudio/uni-app'
  39. import {
  40. store
  41. } from '@/store/index.js'
  42. import {
  43. getProductConsult
  44. } from '@/api/business/processInspection.js'
  45. const lot = ref({});
  46. const daywork = ref({
  47. lot_code: 'D35400554012',
  48. product_description: '电机-254.364.14552',
  49. question: ''
  50. })
  51. // 页面生命周期函数
  52. onMounted(() => {
  53. const instance = getCurrentInstance().proxy
  54. const eventChannel = instance.getOpenerEventChannel();
  55. eventChannel.on('outsourcedInspectionConsultation', function(data) {
  56. console.log('outsourcedInspectionConsultation', data)
  57. // 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
  58. if (data && data.data) {
  59. getProductConsult(data.data).then(res => {
  60. console.log("res", res);
  61. if (res.code == 200) {
  62. lot.value = data.data
  63. lot.value.product = res.data
  64. }
  65. })
  66. }
  67. })
  68. })
  69. onLoad(() => {
  70. })
  71. const handleSubmit = () => {
  72. if (lot.value.question == null || lot.value.question == '') {
  73. uni.showToast({
  74. icon: 'none',
  75. title: '请输入问题描述'
  76. })
  77. return
  78. }
  79. store.processInspection = null;
  80. uni.$emit('addWasteConsultationEvent', {
  81. question: lot.value.question
  82. })
  83. uni.navigateBack()
  84. }
  85. </script>
  86. <style lang="scss">
  87. .page-container {
  88. height: 100%;
  89. background-color: #ececec;
  90. font-size: 28rpx;
  91. padding: 24rpx;
  92. box-sizing: border-box;
  93. }
  94. .consultation-container {
  95. background-color: #ffffff;
  96. padding: 24rpx;
  97. border-radius: 12rpx;
  98. .title {
  99. justify-content: center;
  100. font-size: 32rpx;
  101. font-weight: 700;
  102. }
  103. .info-row {
  104. margin-top: 24rpx;
  105. .label {
  106. width: 160rpx;
  107. }
  108. .value {
  109. flex: 1;
  110. textarea {
  111. flex: 1;
  112. border: 1px solid #888888;
  113. box-sizing: border-box;
  114. padding: 16rpx;
  115. }
  116. }
  117. }
  118. .btn {
  119. background-color: #00D068;
  120. color: #ffffff;
  121. border-radius: 8rpx;
  122. margin: 24rpx;
  123. height: 64rpx;
  124. justify-content: center;
  125. align-items: center;
  126. }
  127. }
  128. </style>