|
@@ -118,7 +118,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-<!-- 拍照上传部分 -->
|
|
|
+ <!-- 拍照上传部分 -->
|
|
|
<view class="title unfit-title uni-row">
|
|
|
<text>拍照上传</text>
|
|
|
</view>
|
|
@@ -126,7 +126,8 @@
|
|
|
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>
|
|
|
+ <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>
|
|
@@ -151,16 +152,13 @@
|
|
|
<view class="title">快速关联</view>
|
|
|
<view class="consultation-container ">
|
|
|
<view class="title unfit-title uni-row">
|
|
|
- <view class="add-btn" style="background-color: #409eff;" @click="handleAddLot">关联批次</view>
|
|
|
+ <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 >
|
|
|
- <zb-table
|
|
|
- :columns="relateColumn"
|
|
|
- :stripe="true"
|
|
|
- :fit="true"
|
|
|
- @dele="dele"
|
|
|
- :data="processInspecion.relateList"></zb-table>
|
|
|
- </view>
|
|
|
</view>
|
|
|
<!-- 报工部分 -->
|
|
|
<view class="daywork-container">
|
|
@@ -173,11 +171,12 @@
|
|
|
</view> -->
|
|
|
<view class="result resu uni-row" style="margin-top: 20rpx;">
|
|
|
<view class="label" style="width: 170rpx;">外协检状态</view>
|
|
|
- <uni-data-checkbox v-if="editable()" v-model="processInspecion.status" :localdata="range"></uni-data-checkbox>
|
|
|
+ <uni-data-checkbox v-if="editable()" v-model="processInspecion.status"
|
|
|
+ :localdata="range"></uni-data-checkbox>
|
|
|
<view v-else class="value">{{ processInspecion.status == 1 ? '合格' : '不合格' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-if="editable()">
|
|
|
+ <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;"
|
|
@@ -233,7 +232,9 @@
|
|
|
selectOutsourcedInspecion,
|
|
|
saveOutsourceInspectionWithRelate
|
|
|
} from '@/api/business/processInspection.js'
|
|
|
- import {getURL} from '@/api/sys/user.js'
|
|
|
+ import {
|
|
|
+ getURL
|
|
|
+ } from '@/api/sys/user.js'
|
|
|
const lot = ref({})
|
|
|
const unfitInfos = ref([]) //废品信息
|
|
|
const oldUnfitInfos = ref([])
|
|
@@ -250,38 +251,60 @@
|
|
|
examiningNum: 0,
|
|
|
status: 0,
|
|
|
})
|
|
|
+ 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
|
|
|
+ width: 60,
|
|
|
+ height: 60
|
|
|
+ }
|
|
|
+ const relateColumn = ref([{
|
|
|
+ name: 'lotCode',
|
|
|
+ label: '批号',
|
|
|
+ align: 'center',
|
|
|
+ width: 200
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'allCarriers',
|
|
|
+ label: '箱号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'isMaster',
|
|
|
+ label: '主检查单',
|
|
|
+ align: 'center',
|
|
|
+ filters: {
|
|
|
+ 0: '否',
|
|
|
+ 1: '是'
|
|
|
}
|
|
|
- const relateColumn = [
|
|
|
- { name: 'lotCode', label: '批号',align:'center', width: 200},
|
|
|
- { name: 'carrierCode', label: '箱号',align:'center', width: 200 },
|
|
|
- { name: 'operation', type:'operation',label: '关联',align:'center',renders:[
|
|
|
- {
|
|
|
- name:'删除',
|
|
|
- type:'warn',
|
|
|
- func:"dele",
|
|
|
- class:"buttonOp"
|
|
|
- },
|
|
|
- ]},
|
|
|
- ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'operation',
|
|
|
+ type: 'operation',
|
|
|
+ label: '关联',
|
|
|
+ align: 'center',
|
|
|
+ renders: [{
|
|
|
+ name: '删除',
|
|
|
+ type: 'warn',
|
|
|
+ func: "dele",
|
|
|
+ class: "buttonOp"
|
|
|
+ }, ]
|
|
|
+ },
|
|
|
+ ])
|
|
|
const initStatus = ref(0)
|
|
|
-
|
|
|
- function dele(ite,index) {
|
|
|
- if(ite.isMaster == 1){
|
|
|
+
|
|
|
+ function dele(ite, index) {
|
|
|
+ if (ite.isMaster == 1) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
title: '主检查单,不可删除'
|
|
|
})
|
|
|
- }else{
|
|
|
- processInspecion.value.relateList.splice(index, 1);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ processInspecion.value.relateList.splice(index, 1);
|
|
|
+ }
|
|
|
}
|
|
|
const editable = () => {
|
|
|
if (processInspecion.value.auditStatus == 1) {
|
|
@@ -299,6 +322,17 @@
|
|
|
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: "待确认",
|
|
@@ -343,7 +377,7 @@
|
|
|
})
|
|
|
|
|
|
onLoad(() => {
|
|
|
- uni.$off('addWasteInfoEvent');
|
|
|
+ // uni.$off('addWasteInfoEvent');
|
|
|
if (!flag.value) {
|
|
|
if (store.processInspection != null) {
|
|
|
uni.showLoading({
|
|
@@ -359,9 +393,20 @@
|
|
|
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 };
|
|
|
+ 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()
|
|
@@ -388,47 +433,54 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-function upLoadImageHandler(arg) {
|
|
|
- getURL(arg).then(res =>{
|
|
|
+
|
|
|
+ function upLoadImageHandler(arg) {
|
|
|
+ getURL(arg).then(res => {
|
|
|
let data = JSON.parse(res)
|
|
|
- selectedPhotos.value.push({
|
|
|
- url:data.fileName,
|
|
|
- pictureName:data.originalFilename
|
|
|
- })
|
|
|
- console.log(selectedPhotos.value)
|
|
|
- })
|
|
|
+ selectedPhotos.value.push({
|
|
|
+ url: data.fileName,
|
|
|
+ pictureName: data.originalFilename
|
|
|
+ })
|
|
|
+ console.log(selectedPhotos.value)
|
|
|
+ })
|
|
|
}
|
|
|
- function select (e) {
|
|
|
+
|
|
|
+ function select(e) {
|
|
|
console.log(e)
|
|
|
const {
|
|
|
tempFilePaths,
|
|
|
tempFiles
|
|
|
- } = e
|
|
|
- tempFiles.forEach((item,index)=>{
|
|
|
- upLoadImageHandler({ filePath: tempFilePaths[index],name:item.name})
|
|
|
+ } = e
|
|
|
+ tempFiles.forEach((item, index) => {
|
|
|
+ upLoadImageHandler({
|
|
|
+ filePath: tempFilePaths[index],
|
|
|
+ name: item.name
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
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)
|
|
|
+ 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)
|
|
|
}
|
|
|
|
|
|
//打开电子图纸
|
|
@@ -613,19 +665,22 @@ function upLoadImageHandler(arg) {
|
|
|
} 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
|
|
|
- });
|
|
|
+ // 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
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ uni.navigateBack()
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
@@ -642,19 +697,22 @@ function upLoadImageHandler(arg) {
|
|
|
console.log(processInspecion.value)
|
|
|
saveOutsourcedInspecion(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
|
|
|
- });
|
|
|
+ // 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
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ uni.navigateBack()
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
@@ -692,6 +750,7 @@ function upLoadImageHandler(arg) {
|
|
|
})
|
|
|
consultations.value = consultations.value.concat(info)
|
|
|
isEventTriggered.value = true; // 更新标志位状态
|
|
|
+ uni.$off('wasteConsultationEvent')
|
|
|
}
|
|
|
|
|
|
/***************************** 定义了一些事件 *****************************/
|
|
@@ -737,6 +796,8 @@ function upLoadImageHandler(arg) {
|
|
|
}
|
|
|
unfitInfos.value.push(info)
|
|
|
console.log(data)
|
|
|
+
|
|
|
+ uni.$off('addWasteInfoEvent')
|
|
|
}
|
|
|
// 删除不合格信息
|
|
|
const handleDelWaste = (index) => {
|
|
@@ -756,21 +817,22 @@ function upLoadImageHandler(arg) {
|
|
|
|
|
|
const addRelate = (relates) => {
|
|
|
processInspecion.value.relateList = relates
|
|
|
+ uni.$off('relateEvent')
|
|
|
}
|
|
|
|
|
|
const handleAddLot = () => {
|
|
|
console.log('添加关联')
|
|
|
uni.$once('relateEvent', (data) => {
|
|
|
- if (!isEventTriggered.value) {
|
|
|
- // 如果事件尚未触发,则执行事件触发逻辑
|
|
|
- addRelate(data)
|
|
|
- }
|
|
|
- uni.$off('relateEvent')
|
|
|
+ // if (!isEventTriggered.value) {
|
|
|
+ // 如果事件尚未触发,则执行事件触发逻辑
|
|
|
+ addRelate(data)
|
|
|
+ // }
|
|
|
+ // uni.$off('relateEvent')
|
|
|
})
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/outsourcedInspection/relate",
|
|
|
success: (res) => {
|
|
|
- res.eventChannel.emit("outsourcedInspectionRelation",
|
|
|
+ res.eventChannel.emit("outsourcedInspectionRelation",
|
|
|
processInspecion.value
|
|
|
)
|
|
|
}
|
|
@@ -782,11 +844,11 @@ function upLoadImageHandler(arg) {
|
|
|
isEventTriggered.value = false;
|
|
|
// 监听事件
|
|
|
uni.$once('wasteConsultationEvent', (data) => {
|
|
|
- if (!isEventTriggered.value) {
|
|
|
- // 如果事件尚未触发,则执行事件触发逻辑
|
|
|
- addConsultation(data)
|
|
|
- }
|
|
|
- uni.$off('wasteConsultationEvent')
|
|
|
+ // if (!isEventTriggered.value) {
|
|
|
+ // 如果事件尚未触发,则执行事件触发逻辑
|
|
|
+ addConsultation(data)
|
|
|
+ // }
|
|
|
+ // uni.$off('wasteConsultationEvent')
|
|
|
})
|
|
|
|
|
|
uni.navigateTo({
|
|
@@ -1077,16 +1139,17 @@ function upLoadImageHandler(arg) {
|
|
|
.uni-input-input:disabled {
|
|
|
background-color: #f5f7fa;
|
|
|
}
|
|
|
+
|
|
|
.my-files {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
-
|
|
|
+
|
|
|
:deep(.uni-file-picker__container) {
|
|
|
- flex-direction: row;
|
|
|
-
|
|
|
+ flex-direction: row;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.consultation-container {
|
|
|
margin: 0 16rpx;
|
|
|
padding: 24rpx;
|
|
@@ -1122,7 +1185,8 @@ function upLoadImageHandler(arg) {
|
|
|
margin-top: 24rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.zb-table .item-tr {
|
|
|
- flex-direction: row;
|
|
|
- }
|
|
|
+ flex-direction: row;
|
|
|
+ }
|
|
|
</style>
|