123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="page-container uni-column">
- <view class="consultation-container uni-column">
- <view class="title uni-row">咨询</view>
- <view class="info-row uni-row">
- <view class="label">批次号</view>
- <view class="value">{{ lot.lotCode }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">技术负责人</view>
- <view class="value">{{ lot.product.technicianName }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">产品描述</view>
- <view class="value">{{ lot.productDescription }}</view>
- </view>
- <view class="info-row uni-column">
- <view class="label" style="margin-bottom: 16rpx;">问题描述</view>
- <view class="value uni-row">
- <textarea v-model="lot.question"></textarea>
- </view>
- </view>
- <view class="btn uni-row" @click.stop="handleSubmit">提交</view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,
- onMounted,
- onBeforeUnmount,
- onUnload,
- getCurrentInstance
- } from 'vue'
- import {
- onLoad,
- onReady,
- onShow
- } from '@dcloudio/uni-app'
- import {
- store
- } from '@/store/index.js'
- import {
- getProductConsult
- } from '@/api/business/processInspection.js'
- const lot = ref({});
- // 创建一个引用来存储最后一次请求的时间戳
- const lastRequestTimestamp = ref(0);
- // 页面生命周期函数
- onMounted(() => {
- console.log("咨询页面打开");
- const instance = getCurrentInstance().proxy
- const eventChannel = instance.getOpenerEventChannel();
- eventChannel.on('processInspectionConsultation', function(data) {
- console.log('processInspectionConsultation', data)
- // 传入当前报工信息 通过当前报工的产品和工序获取检查指导书和分选标准
- if (data && data.data) {
- getProductConsult(data.data).then(res => {
- console.log("res", res);
- if (res.code == 200) {
- lot.value = data.data
- lot.value.product = res.data
- lot.value.question = "";
- }
- })
- }
- })
- })
- onLoad(() => {
- })
- const handleSubmit = () => {
- if (lot.value.question == null || lot.value.question == '') {
- uni.showToast({
- icon: 'none',
- title: '请输入问题描述'
- })
- return
- }
- const currentTime = Date.now();
- // 检查是否已经过去了 2 秒
- if (currentTime - lastRequestTimestamp.value < 2000) {
- // 如果在 2 秒 内已经点击,那么不执行
- uni.showToast({
- icon: 'none',
- title: `请勿重复点击`,
- duration: 2000
- })
- return;
- }
- store.processInspection = null;
- uni.$emit('addWasteConsultationEvent', {
- question: lot.value.question
- })
- lot.value = {};
- uni.navigateBack();
- }
- </script>
- <style lang="scss">
- .page-container {
- height: 100%;
- background-color: #ececec;
- font-size: 28rpx;
- padding: 24rpx;
- box-sizing: border-box;
- }
- .consultation-container {
- background-color: #ffffff;
- padding: 24rpx;
- border-radius: 12rpx;
- .title {
- justify-content: center;
- font-size: 32rpx;
- font-weight: 700;
- }
- .info-row {
- margin-top: 24rpx;
- .label {
- width: 160rpx;
- }
- .value {
- flex: 1;
- textarea {
- flex: 1;
- border: 1px solid #888888;
- box-sizing: border-box;
- padding: 16rpx;
- }
- }
- }
- .btn {
- background-color: #00D068;
- color: #ffffff;
- border-radius: 8rpx;
- margin: 24rpx;
- height: 64rpx;
- justify-content: center;
- align-items: center;
- }
- }
- </style>
|