ezhizao_zx 1 jaar geleden
bovenliggende
commit
3f4614433e
3 gewijzigde bestanden met toevoegingen van 82 en 27 verwijderingen
  1. 60 23
      pages/outsourcedInspection/form.vue
  2. 15 3
      pages/outsourcedInspection/index.vue
  3. 7 1
      pages/outsourcedInspection/scan.vue

+ 60 - 23
pages/outsourcedInspection/form.vue

@@ -19,11 +19,11 @@
 			</view>
 			<view class="info-row uni-row">
 				<view class="label">产品描述</view>
-				<view class="value">{{processInspecion.lot. productDescription }}</view>
+				<view class="value">{{processInspecion.lot.productDescription }}</view>
 			</view>
 			<view class="info-row uni-row">
 				<view class="label">外协工序</view>
-				<view class="value">{{ processInspecion.lot.processAlias }}</view>
+				<view class="value">{{ processInspecion.processNames }}</view>
 			</view>
 			<view class="info-row uni-row">
 				<view class="label">投产数量</view>
@@ -32,14 +32,15 @@
 			<view class="info-row uni-row">
 				<view class="label">检查载具</view>
 				<view class="value">{{ processInspecion.inspectionCarrierCode }}
-					{{ processInspecion.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}</view>
+					{{ processInspecion.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
+				</view>
 			</view>
 		</view>
 
 		<!-- 废品信息 -->
 		<view class="title unfit-title uni-row">
 			<text>废品信息</text>
-			<view class="add-btn" @click="handleAddWaste">添加</view>
+			<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 unfitInfos" :key="index">
@@ -51,8 +52,9 @@
 				<!-- <view class="standard">检查标准:{{ item.standard }}</view> -->
 				<view class="resu uni-row">
 					<view class="label">检查标准</view>
-					<input v-model="item.checkStandard" placeholder="请输入检查标准" maxlength="50" />
-					<uni-icons type="trash" size="24" style="margin-left: 55rpx;" color="#fc6565"
+					<input v-if="editable()" v-model="item.checkStandard" placeholder="请输入检查标准" maxlength="50" />
+					<view v-else class="value">{{ item.checkStandard }}</view>
+					<uni-icons v-if="editable()" type="trash" size="24" style="margin-left: 55rpx;" color="#fc6565"
 						@click="handleDelWaste(index)" />
 				</view>
 
@@ -66,22 +68,27 @@
 				</view> -->
 				<view class="resu uni-row">
 					<view class="label">检查结果</view>
-					<input v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
+					<input v-if="editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
+					<view v-else class="value">{{ item.checkResult }}</view>
 				</view>
 				<view class="resu uni-row">
 					<view class="label">超差范围</view>
-					<input v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
+					<input v-if="editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
+					<view v-else class="value">{{ item.exceedLimits }}</view>
 				</view>
 				<view class="resu uni-row">
-					<view class="label">检查量</view>
-					<input class="number" type="number" @blur="rejectNumberChange" v-model="item.examiningNum"
-						placeholder="" />
-					<view class="label">不良品量</view>
-					<input class="number" type="number" @blur="rejectNumberChange" v-model="item.disqualificationNum"
-						placeholder="" />
-					<view class="label">废品量</view>
-					<input class="number" type="number" @blur="rejectNumberChange" v-model="item.rejectNum"
-						placeholder="" />
+					<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">{{ 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="value">{{ 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="value">{{ item.rejectNum }}</view>
 				</view>
 			</view>
 		</view>
@@ -117,8 +124,9 @@
 			</view> -->
 			<view class="result uni-row">
 				<view class="label" style="margin-top: 20rpx; margin-right: 10rpx;">序检状态</view>
-				<uni-data-checkbox style="margin-top: 20rpx;" v-model="processInspecion.status" :localdata="range"
-					@change="change"></uni-data-checkbox>
+				<uni-data-checkbox v-if="editable()" style="margin-top: 20rpx;" v-model="processInspecion.status"
+					:localdata="range" @change="change"></uni-data-checkbox>
+				<view v-else class="value">{{ processInspecion.status }}</view>
 			</view>
 			<view class="result uni-row">
 				<view class="label">废品总数</view>
@@ -126,17 +134,17 @@
 			</view>
 			<view class="remark uni-row">
 				<view class="label">备注</view>
-				<textarea v-model="processInspecion.remark" />
+				<textarea v-if="editable()" v-model="processInspecion.remark" />
+				<view v-else class="value">{{ processInspecion.remark }}</view>
 			</view>
 
 			<view class="btns-container uni-row">
-				<view class="finished-btn" @click="endWork">结束报工</view>
-				<view class="question-btn uni-column" @click.stop="handleAddConsultation">
+				<view v-if="editable()" 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>
 	</view>
 </template>
@@ -173,6 +181,19 @@
 		examiningNum: 0,
 		status: 0,
 	})
+	const initStatus = ref(0)
+	const editable = () => {
+		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
+	}
 
 	const consul = [{
 		value: 0,
@@ -227,6 +248,7 @@
 				console.log("res", res);
 				if (res.code == 200) {
 					processInspecion.value = res.data;
+					initStatus.value = res.data.status
 					unfitInfos.value = res.data.rejects;
 					consultations.value = res.data.dayworkItemConsults;
 					console.log("res", res);
@@ -545,6 +567,21 @@
 					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 {

+ 15 - 3
pages/outsourcedInspection/index.vue

@@ -20,8 +20,9 @@
 				<text>批次号:{{ item.lotCode }}</text>
 				<text :style="selectType(item)">{{ selectText(item) }}</text>
 				<!-- <uni-icons type="right" size="16" /> -->
-				<text v-if="item.creatorId === userId && item.status == 0" class="fa fa-trash"
-					style="font-size: 16; color: red;" @click.stop="deleteItem(item)"></text>
+				<!-- item.creatorId === userId && item.status == 0 -->
+				<text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
+					@click.stop="deleteItem(item)"></text>
 				<text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
 
 			</view>
@@ -47,7 +48,8 @@
 				<view class="info-row uni-row" style="justify-content: space-between;">
 					<view class="label">检测载具:</view>
 					<view class="value">{{ item.inspectionCarrierCode }}
-						{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}</view>
+						{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
+					</view>
 					<button class="reporting-tag" size="mini" type="primary"
 						@click.stop="changeCheckCarrier(item)">检测载具</button>
 				</view>
@@ -284,6 +286,16 @@
 			}
 		})
 	}
+
+	function delable(item) {
+		if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:remove')) {
+			return true
+		}
+		if (item.creatorId === userId && item.status == 0) {
+			return true
+		}
+		return false
+	}
 </script>
 
 <style lang="scss">

+ 7 - 1
pages/outsourcedInspection/scan.vue

@@ -127,6 +127,7 @@
 											carrierCode.value = result.carrierCode;
 											// console.log("res", res);
 											uni.hideLoading();
+											checkSave()
 										} else {
 											uni.showToast({
 												icon: 'none',
@@ -147,6 +148,7 @@
 								console.log(response)
 								lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
 								lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
+								checkSave()
 							}
 						} else {
 							uni.showToast({
@@ -264,10 +266,14 @@
 	}
 
 	function checkSave() {
+		// uni.showToast({
+		// 	title: 'lotCode:' + lot.value.lotCode + 'inspectionCarrierId: ' + lot.value.inspectionCarrierId,
+		// 	icon: 'none'
+		// })
 		if (lot.value.lotCode == '' || lot.value.lotCode == null) {
 			debounce(handleScanCode, 700)
 		}
-		if (lot.value.inspectionCarrierId == null) {
+		if (lot.value.inspectionCarrierId == null || lot.value.inspectionCarrierId == '') {
 			debounce(handleScanCode, 700)
 		}
 	}