1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273 |
- <template>
- <view class="page-container uni-column">
- <view class="carrier-info uni-column">
- <view class="carrier-code uni-row">
- <text>箱号</text>
- <text style="margin-left: 24rpx;">{{processInspecion.lot.allCarrierName}}</text>
- </view>
- <view class="info-row uni-row">
- <view class="label">图号</view>
- <view class="value">{{ processInspecion.lot.drawingNumber }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">批次号</view>
- <view class="value">{{ processInspecion.lot.lotCode }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">工艺版本</view>
- <view class="value">{{ processInspecion.lot.technologyVersion }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">产品描述</view>
- <view class="value">{{processInspecion.lot.productDescription }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">外协工序</view>
- <view class="value">{{ processInspecion.processNames }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">投产数量</view>
- <view class="value">{{ processInspecion.lot.pudName }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">检查载具</view>
- <view class="value">{{ processInspecion.inspectionCarrierCode }}
- {{ processInspecion.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
- </view>
- </view>
- <view class="info-row uni-row">
- <view class="drawing-btn" @click="handleDrawingMenu">图纸信息</view>
- </view>
- </view>
- <!-- 废品信息 -->
- <view class="title unfit-title uni-row">
- <text>检查信息</text>
- <view v-if="editable()" class="add-btn" @click="handleAddWaste">添加</view>
- </view>
- <view class="unfit-container">
- <view class="unfit-item-container uni-column" v-for="(item, index) in oldUnfitInfos" :key="index">
- <view class="resu uni-row">
- <view class="label">检查标准</view>
- <view class="value">{{ item.checkStandard }}</view>
- </view>
- <view class="resu uni-row">
- <view class="label">检查结果</view>
- <view class="value">{{ item.checkResult }}</view>
- </view>
- <view class="resu uni-row">
- <view class="label">超差范围</view>
- <view class="value">{{ item.exceedLimits }}</view>
- </view>
- <view class="resu uni-row">
- <view :class="'label'">检查量</view>
- <view class="number value">{{ item.examiningNum }}</view>
- <view :class="'label'">不良品量</view>
- <view class="value">{{ item.disqualificationNum }}</view>
- <view :class="'label'">废品量</view>
- <view class="value">{{ item.rejectNum }}</view>
- </view>
- </view>
- <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
- <!-- 暂时注释,后续会使用 -->
- <!-- <view class="title uni-row">
- <text>检查项-{{ item.title }}</text>
- <uni-icons type="trash" size="24" color="#fc6565" @click="handleDelWaste(index)" />
- </view> -->
- <!-- <view class="standard">检查标准:{{ item.standard }}</view> -->
- <view class="resu uni-row">
- <view class="label">检查标准</view>
- <view class="value" style="margin-left:16rpx;width: 400rpx;">{{ item.checkStandard }}</view>
- <uni-icons v-if="editable()" type="trash" size="24" style="margin-left: 55rpx;" color="#fc6565"
- @click="handleDelWaste(index)" />
- </view>
- <!-- <view class="result uni-row">
- <view class="label">检查结果</view>
- <input v-model="item.checkResult" placeholder="请输入检查结果" />
- <view class="label" style="text-align: right; padding-right: 16rpx;">数量
- </view>
- <input class="number" type="number" @blur="rejectNumberChange" v-model="item.rejectNum"
- placeholder="" />
- </view> -->
- <view class="resu uni-row">
- <view class="label">检查结果</view>
- <input v-if="editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
- <view v-else class="value" style="margin-left:16rpx;">{{ item.checkResult }}</view>
- </view>
- <view class="resu uni-row">
- <view class="label">超差范围</view>
- <input v-if="editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
- <view v-else class="value" style="margin-left:16rpx;">{{ item.exceedLimits }}</view>
- </view>
- <view class="resu uni-row">
- <view :class="!editable() ? 'label' : ''">检查量</view>
- <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
- v-model="item.examiningNum" placeholder="" />
- <view v-else class="number value" style="margin-left:16rpx;">{{ item.examiningNum }}</view>
- <view :class="!editable() ? 'label' : ''">不良品量</view>
- <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
- v-model="item.disqualificationNum" placeholder="" />
- <view v-else class="number value" style="margin-left:16rpx;">{{ item.disqualificationNum }}</view>
- <view :class="!editable() ? 'label' : ''">废品量</view>
- <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
- v-model="item.rejectNum" placeholder="" />
- <view v-else class="number value" style="margin-left:16rpx;">{{ item.rejectNum }}</view>
- </view>
- </view>
- </view>
- <!-- 拍照上传部分 -->
- <view class="title unfit-title uni-row">
- <text>拍照上传</text>
- </view>
- <view class=" uni-row" style="padding: 24rpx;
- margin: 0 16rpx;
- background-color: #ffffff;
- border-radius: 12rpx;">
- <uni-file-picker v-model="photoList" :readonly="!editable()" return-type="array" :image-styles="imageStyles"
- @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto"></uni-file-picker>
- </view>
- <!-- 咨询部分 -->
- <view class="title">咨询</view>
- <view class="consultation-container uni-column">
- <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
- <view class="question uni-column">
- <view class="label uni-row">
- <text>问题描述</text>
- <text :style="selectType(item)">{{item.consultDepartment == 0?'技术':'品管'}}
- {{ selectText(item) }}</text>
- </view>
- <view class="content">{{ item.content }}</view>
- </view>
- <!-- 不需要暂时注释 -->
- <!-- <view v-if="item.answer !== ''" class="answer"
- style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
- <view class="label">回复</view>
- <view class="content">{{ item.answer }}</view>
- </view> -->
- </view>
- </view>
- <view class="title">快速关联</view>
- <view class="consultation-container ">
- <view class="title unfit-title uni-row" style="justify-content: flex-start;">
- <view v-if="editRelate" class="add-btn" style="background-color: #409eff;" @click="handleAddLot">关联批次
- </view>
- </view>
- <view>
- <zb-table :columns="getRelateList()" :stripe="true" :fit="true" @dele="dele"
- :data="processInspecion.relateList"></zb-table>
- </view>
- </view>
- <!-- 报工部分 -->
- <view class="daywork-container">
- <!-- 此处后续要加上条件限制,当状态为合格或不合格的时候不能修改状态,需要有权限的人来进行修改 -->
- <!-- <view class="result uni-row">
- <view class="label">检测量</view>
- <input type="number" v-model="processInspecion.examiningNum" placeholder="请输入检测量" />
- <view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
- <input type="number" v-model="processInspecion.rejectNum" placeholder="请输入废品量" />
- </view> -->
- <view class="result resu uni-row" style="margin-top: 20rpx;">
- <view class="label" style="width: 170rpx;">外协检状态</view>
- <uni-data-checkbox :disabled="!editable()" style="margin-top: 20rpx;"
- v-model="processInspecion.inspectionStatus" :localdata="range"
- @change="handleChangeInspecionStatus"></uni-data-checkbox>
- <!-- <uni-data-checkbox v-if="editable()" v-model="processInspecion.inspectionStatus"
- :localdata="range" @change="handleChangeInspecionStatus"></uni-data-checkbox>
- <view v-else class="value">{{ processInspecion.inspectionStatus == 1 ? '合格' : '不合格' }}
- </view> -->
- </view>
- <view class="result uni-row">
- <view class="label" style="margin-top: 20rpx;width: 170rpx;">放行状态</view>
- <uni-data-checkbox :disabled="true" style="margin-top: 20rpx;" v-model="processInspecion.status"
- :localdata="range"></uni-data-checkbox>
- </view>
- <view v-if="editable() && editRelate">
- <view v-if="showTransfer" class="list-title uni-row" style="margin-top: 16rpx;">
- <text class="label">是否移交仪器室</text><text> 否</text>
- <switch class="switch" @change="switchChange" style="transform:scale(0.7);margin-top: -16rpx;"
- color="rgba(103, 195, 55, 1.0)" />
- <text>是</text>
- </view>
- <view v-else class="list-title uni-row" style="margin-top: 16rpx;">
- <text class="label">已经移交给仪器室</text>
- </view>
- </view>
- <view class="result uni-row">
- <view class="label">废品总数</view>
- <view class="value" style="margin-left: 10px;">{{ processInspecion.rejectNum }}</view>
- </view>
- <view class="remark uni-row">
- <view class="label">备注</view>
- <textarea v-if="editable()" v-model="processInspecion.remark" maxlength="999" />
- <view v-else class="value">{{ processInspecion.remark }}</view>
- </view>
- <view class="btns-container uni-row">
- <view v-if="editable() && navigateOnce== 0" class="finished-btn" @click="endWork">结束报工</view>
- <view v-if="editable()" class="question-btn uni-column" @click.stop="handleAddConsultation">
- <uni-icons type="headphones" size="24" />
- <text>咨询</text>
- </view>
- </view>
- </view>
- <dialog-inspectionChamber ref='selectInspectionChamber'
- @handleSelectInspectionChamber='handleSelectInspectionChamber'></dialog-inspectionChamber>
- </view>
- </template>
- <script setup>
- import {
- ref,
- onMounted,
- getCurrentInstance
- } from 'vue'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- import {
- store
- } from '@/store/index.js'
- import {
- saveOutsourcedInspecion,
- getInstrumentRoomInspection,
- selectOutsourcedInspecion,
- saveOutsourceInspectionWithRelate
- } from '@/api/business/processInspection.js'
- import {
- getURL
- } from '@/api/sys/user.js'
- const lot = ref({})
- const unfitInfos = ref([]) //废品信息
- const oldUnfitInfos = ref([])
- const isEventTriggered = ref(false); // 创建一个标志位
- // 创建一个引用来存储最后一次请求的时间戳
- const lastRequestTimestamp = ref(0);
- const selectInspectionChamber = ref(null)
- const consultations = ref([]) //咨询信息
- const flag = ref(false)
- const showTransfer = ref(true)
- const navigateOnce = ref(0)
- const processInspecion = ref({
- remark: "",
- rejectNum: 0,
- examiningNum: 0,
- status: 0,
- inspectionStatus: 0,
- lot: {}
- })
- const editRelate = ref(false)
- const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
- const webHost = ref(urlList.baseUrl)
- const photoList = ref([])
- const selected = ref([]);
- const selectedPhotos = ref([])
- const imageStyles = {
- width: 60,
- height: 60
- }
- const relateColumn = ref([{
- name: 'lotCode',
- label: '批号',
- align: 'center',
- width: 100
- },
- {
- name: 'allCarriers',
- label: '箱号',
- align: 'center',
- width: 80
- },
- {
- name: 'isMaster',
- label: '主检查单',
- align: 'center',
- width: 60,
- filters: {
- 0: '否',
- 1: '是'
- }
- },
- {
- name: 'operation',
- type: 'operation',
- label: '关联',
- align: 'center',
- width: 60,
- renders: [{
- name: '删除',
- type: 'warn',
- func: "dele",
- class: "buttonOp"
- }, ]
- },
- ])
- const initStatus = ref(0)
- function dele(ite, index) {
- if (ite.isMaster == 1) {
- uni.showToast({
- icon: 'none',
- title: '主检查单,不可删除'
- })
- } else {
- processInspecion.value.relateList.splice(index, 1);
- }
- }
- const editable = () => {
- if (processInspecion.value.auditStatus == 1) {
- return false
- }
- if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:edit')) {
- return true
- }
- if (initStatus.value == 0) {
- return true
- }
- if (processInspecion.value.firstUpdaterId == store.userInfo.userId) {
- return true
- }
- return false
- }
- function getRelateList() {
- // console.log('getRelateList')
- if (editRelate.value) {
- // console.log(relateColumn.value)
- return relateColumn.value
- } else {
- // console.log(relateColumn.value.slice(0, 3))
- return relateColumn.value.slice(0, 3)
- }
- }
- const consul = [{
- value: 0,
- text: "待确认",
- type: "color: #fcab53"
- }, {
- value: 2,
- text: "合格",
- type: "color: #55ff7f"
- }, {
- value: 1,
- text: "不合格",
- type: "color: #ff0c2c"
- }]
- const range = [{
- value: 0,
- text: "待确认",
- type: "color: #fcab53"
- }, {
- value: 1,
- text: "合格",
- type: "color: #55ff7f"
- }, {
- value: 2,
- text: "不合格",
- type: "color: #ff0c2c"
- }]
- /***************************** 页面生命周期函数 *****************************/
- onMounted(() => {
- const instance = getCurrentInstance().proxy
- const eventChannel = instance.getOpenerEventChannel();
- eventChannel.on('outsourcedInspectionFrom', function(data) {
- console.log('outsourcedInspectionFrom', data)
- if (data && data.data) {
- processInspecion.value.lot = data.data;
- }
- })
- })
- onShow(() => {
- uni.$off('addWasteInfoEvent');
- })
- onLoad(() => {
- navigateOnce.value = 0
- uni.$off('addWasteInfoEvent');
- if (!flag.value) {
- if (store.processInspection != null) {
- uni.showLoading({
- title: '加载中'
- });
- console.log(store.processInspection)
- processInspecion.value = {
- ...store.processInspection,
- lot: {}
- }
- selectOutsourcedInspecion(processInspecion.value).then(res => {
- console.log("res", res);
- if (res.code == 200) {
- processInspecion.value = res.data;
- initStatus.value = res.data.inspectionStatus
- unfitInfos.value = res.data.rejects;
- oldUnfitInfos.value = res.data.oldRejects;
- consultations.value = res.data.dayworkItemConsults;
- selectedPhotos.value = res.data.processInspectionPictureList
- photoList.value = res.data.processInspectionPictureList.map(item => {
- return {
- ...item,
- url: webHost.value + item.url
- };
- });
- if (editable() && !processInspecion.value.relateList.some(t => t.isMaster ===
- 1)) {
- editRelate.value = true
- } else {
- editRelate.value = false
- }
- console.log()
- console.log(editRelate.value)
- console.log("res", res);
- //判断是否移交到了仪器室
- getInstrumentRoomInspectionList()
- uni.hideLoading();
- // getInspecion();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- });
- }
- }
- })
- /***************************** 定义了一些方法 *****************************/
- //咨询文本
- function selectText(item) {
- // for (var i = 0; i < consul.length; i++) {
- // if (item.status == consul[i].value) {
- // return consul[i].text
- // }
- // }
- if (item.consultResultId == 0) {
- return '待确认'
- } else {
- return item.result
- }
- }
- function upLoadImageHandler(arg) {
- return getURL(arg).then(res => {
- let data = JSON.parse(res)
- selectedPhotos.value.push({
- url: data.fileName,
- pictureName: data.originalFilename,
- tenantId: store.tenantId
- })
- photoList.value.push({
- url: data.fileName,
- pictureName: data.originalFilename
- })
- console.log(selectedPhotos.value)
- // uni.showToast({
- // icon: 'none',
- // title: selectedPhotos.value.length,
- // duration: 2000
- // })
- })
- }
- function select(e) {
- console.log(e)
- const {
- tempFilePaths,
- tempFiles
- } = e
- uni.showLoading({
- title: '图片上传中',
- mask: true
- });
- // tempFiles.forEach((item, index) => {
- // upLoadImageHandler({
- // filePath: tempFilePaths[index],
- // name: item.name
- // })
- // })
- // 创建一个空的Promise数组
- let uploadPromises = tempFiles.map((item, index) => {
- return upLoadImageHandler({
- filePath: tempFilePaths[index],
- name: item.name
- });
- });
- // 使用Promise.all等待所有图片上传完成
- Promise.all(uploadPromises).then(() => {
- // 上传完成后关闭加载提示
- uni.hideLoading();
- }).catch(() => {
- // 如果有错误发生,也关闭加载提示
- uni.hideLoading();
- });
- }
- function handleDeletedPhoto(e) {
- let fileName = selectedPhotos.value.map(info => info.pictureName)
- const firstSlashIndex = e.tempFile.url.lastIndexOf('/');
- const lastSlashIndex = e.tempFile.url.lastIndexOf('_');
- const type = e.tempFile.url.substring(firstSlashIndex + 1, lastSlashIndex)
- const pictureName = e.tempFile.url.substring(firstSlashIndex + 1, lastSlashIndex) + e.tempFile.url.substring(e
- .tempFile.url.lastIndexOf('.') - 1 + 1);;
- let index = -1; // 初始化 index 为 -1,表示未找到
- // 首先检查 e.tempFile.name 是否存在
- if (fileName.findIndex(name => name === e.tempFile.name) !== -1) {
- index = fileName.findIndex(name => name === e.tempFile.name);
- }
- // 如果 e.tempFile.name 不存在,检查 e.tempFile.pictureName 是否存在
- else if (fileName.findIndex(name => name === e.tempFile.pictureName) !== -1) {
- index = fileName.findIndex(name => name === e.tempFile.pictureName);
- }
- // 如果以上两个都不存在,检查 pictureName 是否存在
- else if (fileName.findIndex(name => name === pictureName) !== -1) {
- index = fileName.findIndex(name => name === pictureName);
- }
- selectedPhotos.value.splice(index, 1)
- }
- //打开电子图纸
- function handleDrawingMenu() {
- var outsourceOrderDetailId = encodeURIComponent(processInspecion.value.outsourceOrderDetailId);
- var lotCode = encodeURIComponent(processInspecion.value.lot.lotCode);
- var technologyVersion = encodeURIComponent(processInspecion.value.lot.technologyVersion)
- // 构建查询参数字符串
- var queryParam =
- `param1=${outsourceOrderDetailId}¶m2=${lotCode}¶m3=${processInspecion.value.lot.productId}¶m4=${technologyVersion}`;
- // 使用模板字符串构建完整的URL
- var navigateUrl = `/pages/outsourcedDrawingMenu/index?${queryParam}`;
- // 导航到指定页面
- uni.navigateTo({
- url: navigateUrl
- });
- }
- function getInstrumentRoomInspectionList() {
- getInstrumentRoomInspection(processInspecion.value).then(res => {
- if (res.data.length > 0) {
- showTransfer.value = false
- } else {
- showTransfer.value = true
- }
- })
- }
- function switchChange(event) {
- if (event.detail.value) {
- processInspecion.value.flag = true
- } else {
- processInspecion.value.flag = false
- }
- }
- const rejectNumberChange = () => {
- let sumReject = 0
- let sumDisqualificationNum = 0
- let sumExaminingNum = 0
- unfitInfos.value.forEach(v => {
- sumReject += (v.rejectNum != null ? Number(v.rejectNum) : 0)
- sumDisqualificationNum += (v.disqualificationNum != null ? Number(v.disqualificationNum) : 0)
- sumExaminingNum += (v.examiningNum != null ? Number(v.examiningNum) : 0)
- })
- processInspecion.value.rejectNum = sumReject
- processInspecion.value.disqualificationNum = sumDisqualificationNum
- processInspecion.value.examiningNum = sumExaminingNum
- console.log(processInspecion.value)
- }
- //查询咨询列表
- function getInspecion() {
- processInspecion.value = store.processInspection
- selectInspecion(processInspecion.value).then(res => {
- console.log("咨询", res);
- if (res.code == 200) {
- console.log("res", res);
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- });
- }
- //结束报工按钮
- function endWork() {
- let unf = unfitInfos.value;
- for (var i = 0; i < unfitInfos.value.length; i++) {
- console.log("废品信息");
- // if (!unf[i].checkStandard && !unf[i].checkResult && !unf[i].rejectNum) {
- // uni.showToast({
- // icon: 'none',
- // title: "废品信息不能为空",
- // duration: 2000
- // })
- // return;
- // }
- if (unf[i].checkStandard == '' || unf[i].checkStandard == null) {
- uni.showToast({
- icon: 'none',
- title: "检查标准不能为空",
- duration: 2000
- })
- return;
- }
- // if (unf[i].checkResult == '' || unf[i].checkResult == null) {
- // uni.showToast({
- // icon: 'none',
- // title: "检查结果不能为空",
- // duration: 2000
- // })
- // return;
- // }
- if (unf[i].rejectNum == null) {
- uni.showToast({
- icon: 'none',
- title: "废品量不能为空",
- duration: 2000
- })
- return;
- }
- if (unf[i].rejectNum < 0 || unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
- uni.showToast({
- icon: 'none',
- title: '检查量,不良品量,废品量不能小于0',
- duration: 2000
- })
- return
- }
- if (unf[i].examiningNum > processInspecion.value.lot.pudName) {
- uni.showToast({
- icon: 'none',
- title: '检查量不能大于投产量'
- })
- return
- }
- }
- let sumReject = 0
- unfitInfos.value.forEach(v => {
- sumReject += Number(v.rejectNum)
- })
- if (processInspecion.value.rejectNum != sumReject) {
- uni.showToast({
- icon: 'none',
- title: "废品量与废品信息不一致",
- duration: 2000
- })
- return;
- }
- if (processInspecion.value.rejectNum > processInspecion.value.lot.pudName) {
- uni.showToast({
- icon: 'none',
- title: '废品量不能大于投产量'
- })
- return
- }
- if (processInspecion.value.disqualificationNum > processInspecion.value.lot.pudName) {
- uni.showToast({
- icon: 'none',
- title: '不良品量不能大于投产量'
- })
- return
- }
- save();
- }
- function save() {
- const currentTime = Date.now();
- // 检查是否已经过去了 2 秒
- if (currentTime - lastRequestTimestamp.value < 2000) {
- // 如果在 2 秒 内已经点击,那么不执行
- uni.showToast({
- icon: 'none',
- title: `请勿重复点击`,
- duration: 2000
- })
- return;
- }
- lastRequestTimestamp.value = currentTime;
- let pages = getCurrentPages();
- processInspecion.value.dayworkItemConsults = consultations.value;
- processInspecion.value.dayworkItemRejects = unfitInfos.value;
- processInspecion.value.user = store.userInfo;
- processInspecion.value.tenantId = store.tenantId
- processInspecion.value.processInspectionPictureList = selectedPhotos.value
- if (processInspecion.value.flag) {
- //打开选择仪器室的弹窗
- selectInspectionChamber.value.open()
- console.log(processInspecion.value)
- } else {
- saveOutsourceInspectionWithRelate(processInspecion.value).then(res => {
- if (res.code == 200) {
- // let index = 0;
- // for (let i = 0; i < pages.length; i++) {
- // if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
- // index = pages.length - i - 1;
- // }
- // }
- // console.log("index", index);
- // uni.navigateBack(
- // {
- // delta: index
- // }
- // );
- if (navigateOnce.value == 0) {
- navigateOnce.value = 1
- uni.navigateBack()
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- });
- }
- }
- function handleSelectInspectionChamber(data) {
- processInspecion.value.inspectionChamberId = data
- console.log(processInspecion.value)
- saveOutsourceInspectionWithRelate(processInspecion.value).then(res => {
- if (res.code == 200) {
- // let index = 0;
- // let pages = getCurrentPages();
- // for (let i = 0; i < pages.length; i++) {
- // if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
- // index = pages.length - i - 1;
- // }
- // }
- // console.log("index", index);
- // uni.navigateBack(
- // {
- // delta: index
- // }
- // );
- if (navigateOnce.value == 0) {
- navigateOnce.value = 1
- uni.navigateBack()
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- });
- }
- //咨询样式
- function selectType(item) {
- for (var i = 0; i < consul.length; i++) {
- if (item.status == consul[i].value) {
- return consul[i].type
- }
- }
- }
- // const addWasteInfo = (data) => {
- // const info = {
- // title: data.title,
- // checkStandard: data.standard
- // }
- // unfitInfos.value.push(info)
- // }
- const addConsultation = (data) => {
- console.log(data)
- let info = data
- info.forEach(item => {
- item.status = 0
- })
- consultations.value = consultations.value.concat(info)
- isEventTriggered.value = true; // 更新标志位状态
- processInspecion.value.status = 0
- uni.$off('wasteConsultationEvent')
- }
- /***************************** 定义了一些事件 *****************************/
- // 添加不合格信息
- // const handleAddWaste = () => {
- // let info = {}
- // unfitInfos.value.push(info)
- // // 监听事件,暂时不用,后续会使用
- // // uni.$once('addWasteInfoEvent', (data) => {
- // // addWasteInfo(data)
- // // })
- // // uni.navigateTo({
- // // url: "/pages/processInspection/options"
- // // })
- // }
- const handleAddWaste = () => {
- flag.value = true
- // 监听事件,暂时不用,后续会使用
- uni.$on('addWasteInfoEvent', (data) => {
- addWasteInfo(data)
- })
- var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
- var enprocessId = encodeURIComponent(processInspecion.value.lot.processId);
- // 构建查询参数字符串
- var queryParam = `param1=${encodedId}¶m2=${enprocessId}`;
- // 使用模板字符串构建完整的URL
- var navigateUrl = `/pages/outsourcedInspection/options?${queryParam}`;
- // 导航到指定页面
- uni.navigateTo({
- url: navigateUrl
- });
- }
- const addWasteInfo = (data) => {
- console.log(data, "55555555")
- flag.value = true
- var info = {
- inspectionStandardsId: data.id,
- checkStandard: data.standard
- }
- unfitInfos.value.push(info)
- console.log(data)
- // uni.$off('addWasteInfoEvent')
- }
- // 删除不合格信息
- const handleDelWaste = (index) => {
- uni.showModal({
- title: '提示',
- content: '确定删除该项?',
- success: function(res) {
- if (res.confirm) {
- unfitInfos.value.splice(index, 1)
- rejectNumberChange()
- } else if (res.cancel) {
- return
- }
- }
- })
- }
- const addRelate = (relates) => {
- isEventTriggered.value = true;
- processInspecion.value.relateList = relates
- // uni.$off('relateEvent')
- }
- function handleChangeInspecionStatus(e) {
- console.log(e.detail.value)
- //没有咨询
- if (consultations.value && consultations.value.length == 0) {
- processInspecion.value.status = e.detail.value
- }
- }
- const handleAddLot = () => {
- console.log('添加关联')
- isEventTriggered.value = false;
- uni.$once('relateEvent', (data) => {
- if (!isEventTriggered.value) {
- // 如果事件尚未触发,则执行事件触发逻辑
- addRelate(data)
- }
- // uni.$off('relateEvent')
- })
- uni.navigateTo({
- url: "/pages/outsourcedInspection/relate",
- success: (res) => {
- res.eventChannel.emit("outsourcedInspectionRelation",
- processInspecion.value
- )
- }
- })
- }
- // 咨询
- const handleAddConsultation = () => {
- isEventTriggered.value = false;
- // 监听事件
- uni.$once('wasteConsultationEvent', (data) => {
- if (!isEventTriggered.value) {
- // 如果事件尚未触发,则执行事件触发逻辑
- addConsultation(data)
- }
- // uni.$off('wasteConsultationEvent')
- })
- uni.navigateTo({
- url: "/pages/outsourcedInspection/consultation",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit("outsourcedInspectionConsultation", {
- data: processInspecion.value.lot
- })
- }
- })
- }
- </script>
- <style lang="scss">
- .buttonOp {
- margin-top: 5px;
- }
- .page-container {
- // height: 100%;
- background-color: #ececec;
- font-size: 28rpx;
- >.title {
- font-weight: 700;
- margin: 24rpx 16rpx;
- }
- }
- .carrier-info {
- margin: 32rpx 16rpx 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- .carrier-code {
- font-size: 32rpx;
- font-weight: 700;
- }
- .info-row {
- margin-top: 16rpx;
- color: #767676;
- .label {
- width: 160rpx;
- }
- .drawing-btn {
- padding: 12rpx 32rpx;
- background-color: #0055ff;
- color: #ffffff;
- border-radius: 12rpx;
- margin-left: auto;
- font-size: 28rpx;
- }
- .value {
- flex: 1;
- textarea {
- flex: 1;
- border: 1px solid #888888;
- box-sizing: border-box;
- padding: 16rpx;
- }
- }
- }
- }
- .unfit-title {
- margin-bottom: 24rpx;
- justify-content: space-between;
- align-items: center;
- text {
- font-size: 28rpx;
- font-weight: 700;
- }
- .add-btn {
- margin-right: 26rpx;
- padding: 12rpx 32rpx;
- background-color: #a4adb3;
- color: #ffffff;
- border-radius: 12rpx;
- font-size: 24rpx;
- }
- }
- .unfit-container {
- padding: 24rpx;
- margin: 0 16rpx;
- background-color: #ffffff;
- border-radius: 12rpx;
- .unfit-item-container {
- position: relative;
- >* {
- margin-bottom: 24rpx;
- }
- .title {
- font-weight: 700;
- justify-content: space-between;
- align-items: center;
- image {
- width: 40rpx;
- height: 40rpx;
- }
- }
- .standard {}
- .resu {
- width: 100%;
- align-items: center;
- input {
- margin-left: 20rpx;
- width: 200rpx;
- height: 56rpx;
- flex: 1;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- }
- .label {
- width: 160rpx;
- }
- .value {
- flex: 1;
- textarea {
- flex: 1;
- border: 1px solid #888888;
- box-sizing: border-box;
- padding: 16rpx;
- }
- }
- }
- .result {
- border-bottom: 1px solid #9f9f9f;
- padding-bottom: 32rpx;
- align-items: center;
- .label {
- width: 160rpx;
- }
- .value {
- flex: 1;
- textarea {
- flex: 1;
- border: 1px solid #888888;
- box-sizing: border-box;
- padding: 16rpx;
- }
- }
- input {
- width: 280rpx;
- height: 56rpx;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- &.number {
- width: 104rpx;
- text-align: center;
- }
- }
- }
- }
- .unfit-item-container:last-child {
- .result {
- border-bottom: none;
- padding-bottom: 0;
- }
- }
- }
- .consultation-container {
- margin: 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- .consultation-item-container {
- margin-bottom: 24rpx;
- border-bottom: 2px solid #888888;
- padding-bottom: 24rpx;
- }
- .consultation-item-container:last-child {
- margin-bottom: 0;
- border-bottom: 0;
- padding-bottom: 0;
- }
- .question,
- .answer {
- .label {
- justify-content: space-between;
- margin-bottom: 16rpx;
- font-weight: 700;
- }
- .content {
- line-height: 40rpx;
- }
- }
- .answer {
- margin-top: 24rpx;
- }
- }
- .daywork-container {
- margin-top: 24rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border: 1px solid #bcbcbc;
- .result {
- align-items: center;
- .label {
- width: 112rpx;
- }
- input {
- flex: 1;
- height: 56rpx;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- text-align: center;
- }
- }
- .remark {
- margin-top: 24rpx;
- .label {
- width: 112rpx;
- }
- textarea {
- flex: 1;
- border: 1px solid #9f9f9f;
- height: 168rpx;
- }
- }
- .btns-container {
- margin-top: 24rpx;
- .finished-btn {
- display: flex;
- flex: 1;
- height: 80rpx;
- background-color: #fc6565;
- color: #ffffff;
- text-align: center;
- justify-content: center;
- align-items: center;
- border-radius: 8rpx;
- }
- .question-btn {
- width: 80rpx;
- align-items: flex-end;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- text {
- font-size: 24rpx;
- }
- }
- }
- }
- .uni-input-input:disabled {
- background-color: #f5f7fa;
- }
- .my-files {
- display: flex;
- justify-content: center;
- :deep(.uni-file-picker__container) {
- flex-direction: row;
- }
- }
- .consultation-container {
- margin: 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- .consultation-item-container {
- margin-bottom: 24rpx;
- border-bottom: 2px solid #888888;
- padding-bottom: 24rpx;
- }
- .consultation-item-container:last-child {
- margin-bottom: 0;
- border-bottom: 0;
- padding-bottom: 0;
- }
- .question,
- .answer {
- .label {
- justify-content: space-between;
- margin-bottom: 16rpx;
- font-weight: 700;
- }
- .content {
- line-height: 40rpx;
- }
- }
- .answer {
- margin-top: 24rpx;
- }
- }
- .zb-table .item-tr .item-td {
- overflow-x: auto;
- }
- </style>
|