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">{{ dayworkItem.lotCode }}</view>
  8. </view>
  9. <view class="info-row uni-row">
  10. <view class="label">产品描述</view>
  11. <view class="value">{{ dayworkItem.productDescription }}</view>
  12. </view>
  13. <view class="info-row uni-row">
  14. <view class="label">技术负责人</view>
  15. <view class="value">{{ dayworkItem.technicianName }}</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="data.content"></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. } from 'vue'
  31. import {
  32. onLoad,
  33. onReady,
  34. onUnload,
  35. onShow
  36. } from '@dcloudio/uni-app'
  37. import {
  38. onMounted,
  39. getCurrentInstance
  40. } from 'vue';
  41. const dayworkItem = ref({})
  42. const data = ref({
  43. content: ''
  44. })
  45. const lastExecutionTime = ref(0);
  46. onMounted(() => {
  47. const instance = getCurrentInstance().proxy
  48. const eventChannel = instance.getOpenerEventChannel();
  49. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  50. console.log('acceptDataFromOpenerPage', data)
  51. // 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
  52. if (data && data.data) {
  53. dayworkItem.value = data.data
  54. }
  55. })
  56. })
  57. // 页面生命周期函数
  58. onLoad(() => {
  59. })
  60. const handleSubmit = () => {
  61. if (data.value.content == null || data.value.content == '') {
  62. uni.showToast({
  63. icon: 'none',
  64. title: '请输入问题描述'
  65. })
  66. return
  67. }
  68. const currentTime = Date.now();
  69. // 检查是否已经过去了 2 秒
  70. if (currentTime - lastRequestTimestamp.value < 2000) {
  71. // 如果在 2 秒 内已经点击,那么不执行
  72. uni.showToast({
  73. icon: 'none',
  74. title: `请勿重复点击`,
  75. duration: 2000
  76. })
  77. return;
  78. }
  79. uni.$emit('addConsulttationEvent', {
  80. content: data.value.content
  81. })
  82. uni.navigateBack()
  83. }
  84. </script>
  85. <style lang="scss">
  86. .page-container {
  87. height: 100%;
  88. background-color: #ececec;
  89. font-size: 28rpx;
  90. padding: 24rpx;
  91. box-sizing: border-box;
  92. }
  93. .consultation-container {
  94. background-color: #ffffff;
  95. padding: 24rpx;
  96. border-radius: 12rpx;
  97. .title {
  98. justify-content: center;
  99. font-size: 32rpx;
  100. font-weight: 700;
  101. }
  102. .info-row {
  103. margin-top: 24rpx;
  104. .label {
  105. width: 160rpx;
  106. }
  107. .value {
  108. flex: 1;
  109. textarea {
  110. flex: 1;
  111. border: 1px solid #888888;
  112. box-sizing: border-box;
  113. padding: 16rpx;
  114. }
  115. }
  116. }
  117. .btn {
  118. background-color: #00D068;
  119. color: #ffffff;
  120. border-radius: 8rpx;
  121. margin: 24rpx;
  122. height: 64rpx;
  123. justify-content: center;
  124. align-items: center;
  125. }
  126. }
  127. </style>