ソースを参照

feat(质检工单): 新增质检报工页面及相关接口,添加质检标准类型和取样类型字典

yusheng 5 ヶ月 前
コミット
abeb829bf0

+ 20 - 1
api/inspectionWork/index.js

@@ -17,4 +17,23 @@ export async function getList(data) {
 		return res.data;
 	}
 	return Promise.reject(new Error(res.message));
-}
+}
+
+
+export async function getById(id) {
+	const res = await get(Vue.prototype.apiUrl + `/qms/quality_work_order/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 编辑
+export async function update(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/qms/quality_work_order/update`, data);
+	if (res.code == 0) {
+		return res.message;
+	}
+	return Promise.reject(new Error(res.message));
+}
+

+ 54 - 15
enum/dict.js

@@ -8,6 +8,8 @@ export default {
 	物品颜色: 'product_color_key',
 	流程实例的结果: 'bpm_process_instance_result',
 	质检计划类型: 'inspection_plan_type',
+	质检标准类型: 'quality_testing_code',
+	取样类型: 'quality_method_code',
 
 }
 
@@ -62,22 +64,59 @@ export const lbjtList = {
 };
 
 //需求类型
-export const requirementSourceType = [
-  { value: '1', text: '生产性物资采购' },
-  { value: '2', text: '非生产性物资采购' },
-  { value: '3', text: '带料生产委外' },
-  { value: '4', text: '不带料生产委外' },
-  { value: '5', text: '研发委外' },
-  { value: '6', text: '外协自供料采购' },
-  { value: '7', text: '外协客供料采购' },
-  { value: '8', text: '退货委外' },
-  { value: '9', text: '委外返修' },
-  { value: '99', text: '其他' }
+export const requirementSourceType = [{
+		value: '1',
+		text: '生产性物资采购'
+	},
+	{
+		value: '2',
+		text: '非生产性物资采购'
+	},
+	{
+		value: '3',
+		text: '带料生产委外'
+	},
+	{
+		value: '4',
+		text: '不带料生产委外'
+	},
+	{
+		value: '5',
+		text: '研发委外'
+	},
+	{
+		value: '6',
+		text: '外协自供料采购'
+	},
+	{
+		value: '7',
+		text: '外协客供料采购'
+	},
+	{
+		value: '8',
+		text: '退货委外'
+	},
+	{
+		value: '9',
+		text: '委外返修'
+	},
+	{
+		value: '99',
+		text: '其他'
+	}
 ];
 
 // 列表维度
-export const dimensionType = [
-  { value: 1, text: '物品维度' },
-  { value: 2, text: '批次维度' },
-  { value: 3, text: '包装维度' }
+export const dimensionType = [{
+		value: 1,
+		text: '物品维度'
+	},
+	{
+		value: 2,
+		text: '批次维度'
+	},
+	{
+		value: 3,
+		text: '包装维度'
+	}
 ];

+ 1 - 1
manifest.json

@@ -12,7 +12,7 @@
                     // "target" : "http://192.168.1.110:18086/",
                     // "target" : "http://192.168.1.251:18086/",
                     // "target" : "http://192.168.1.251:18086/",
-                    "target" : "http://192.168.1.251:18186",
+                    "target" : "http://192.168.1.251:18086",
                     // "target": "http://116.63.185.248:80/api",
                     "changeOrigin" : true,
                     "secure" : false,

+ 8 - 0
pages.json

@@ -2406,6 +2406,14 @@
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
+		},
+		{
+			"path": "pages/qms/inspectionWork/inspectionProjectReport",
+			"style": {
+				"navigationBarTitleText": "质检报工",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
 		}
 	],
 	"tabBar": {

+ 25 - 16
pages/qms/inspectionWork/index.vue

@@ -13,7 +13,7 @@
 		<div style="height:100rpx;width: 475rpx;"></div>
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
-				<view v-for="(item, index) in tableList" :key="item.id" style="position: relative;" >
+				<view v-for="(item, index) in tableList" :key="item.id" style="position: relative;">
 					<view class="item">
 						<view class="herder_item">
 							<view class="herder_text"></view>
@@ -23,8 +23,10 @@
 						</view>
 						<view class="text">检验项目:</view>
 						<view class="item_value">
-							<view v-for="(row,_index) in item.templateList" :key="index+'_'+_index" :style="{background:row.status==1?'#19be6b':row.status==2?'#ff9900':row.status==3?'#ff9900':'#909399'}">
-								  {{row.inspectionName}}
+							<view @click="goTo(item.id,row.id)" v-for="(row,_index) in item.templateList"
+								:key="index+'_'+_index"
+								:style="{background:row.status==1?'#19be6b':row.status==2?'#ff9900':row.status==3?'#ff9900':'#909399'}">
+								{{row.inspectionName}}
 							</view>
 						</view>
 					</view>
@@ -98,7 +100,7 @@
 					pageNum: this.page,
 					size: this.size,
 					partaName: this.searchVal,
-					recordingMethod:1
+					recordingMethod: 1
 				}
 				getList(data).then(res => {
 					if (this.page === 1) {
@@ -112,7 +114,12 @@
 					uni.hideLoading()
 				})
 			},
+			goTo(workId, projectId) {
 
+				uni.navigateTo({
+					url: '/pages/qms/inspectionWork/inspectionProjectReport?workId='+workId+'&projectId='+projectId
+				})
+			},
 
 			scrolltolower() {
 				if (this.isEnd) {
@@ -177,25 +184,28 @@
 		margin: 20rpx auto 0;
 		padding: 26rpx;
 		border-radius: 30rpx;
-		.text{
-			margin-top:20rpx;
+
+		.text {
+			margin-top: 20rpx;
 		}
 
 		background: #fff;
 	}
-	.item_value{
+
+	.item_value {
 		width: 100%;
-		display:flex;
+		display: flex;
 		flex-wrap: wrap;
 		margin-left: -10rpx;
-		>view{
+
+		>view {
 			font-size: 24rpx;
-			color:#fff;
-			padding:12rpx;
-			border-radius:10rpx;
-			background:#979797;
+			color: #fff;
+			padding: 12rpx;
+			border-radius: 10rpx;
+			background: #979797;
 			margin-left: 10rpx;
-			margin-top:20rpx;
+			margin-top: 20rpx;
 		}
 	}
 
@@ -208,7 +218,7 @@
 		.herder_view {
 			width: calc(100% - 20rpx);
 			word-break: break-all;
-		
+
 		}
 
 		.herder_text {
@@ -220,5 +230,4 @@
 			margin-top: 5rpx;
 		}
 	}
-	
 </style>

+ 295 - 0
pages/qms/inspectionWork/inspectionProjectReport.vue

@@ -0,0 +1,295 @@
+<template>
+	<view class="mainBox">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="检验项目" @clickLeft="back">
+		</uni-nav-bar>
+
+		<view class="wrapper">
+			<view class="herder_item">
+				<view class="herder_text"></view>
+				<view class="herder_view" style="font-size: 32rpx;">
+					检验信息
+
+				</view>
+			</view>
+			<text class="marginTop20 tag">
+				{{form.inspectionName}}
+			</text>
+			<view class="marginTop20 workValue">
+				{{workData.productName}}/{{workData.code}}/{{workData.productCode}}
+			</view>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					执行标准
+				</view>
+			</view>
+			<u--input suffixIcon="arrow-right" style="background-color:#fff ;" :disabledColor="'#ffffff'"
+				:disabled="true" class="marginTop20" placeholder=" " border="surround"
+				:value="getDictValue('质检标准类型', form.qualityStandardType+'')"></u--input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					工艺参数
+				</view>
+			</view>
+			<view class="marginTop20 defValue">
+				{{form.defaultValue}}
+			</view>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					质检内容
+				</view>
+			</view>
+			<u-input @input="handleInput(form, form.qualityResultContent)" class="marginTop20" placeholder="请输入内容"
+				border="surround" v-model="form.qualityResultContent">
+				<template slot="suffix" v-if="form.unitName">{{form.unitName}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					样品数
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.sampleQuantity">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					合格数
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.qualifiedQuantity">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					不合格数
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.noQualifiedQuantity">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					损耗数(合格品)
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.lossNumber">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					损耗数(不合格品)
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.lossNumberUnqualified">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					留样数(合格品)
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.retainedSampleQuantity">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					留样数(不合格品)
+				</view>
+			</view>
+			<u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
+				v-model="form.retainedSampleUnqualified">
+				<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
+			</u-input>
+			<view class="herder_item marginTop20">
+				<view class="herder_text"></view>
+				<view class="herder_view">
+					质检结果
+				</view>
+			</view>
+			<uni-data-picker class="marginTop20" v-model="form.qualityResults" placeholder="请选择"
+				:localdata="acceptUnpackList">
+			</uni-data-picker>
+
+		</view>
+
+		<view class="footerButton">
+			<u-button type="default" text="返回" @click="back"></u-button>
+			<u-button type="primary" @click="save" text="保存"></u-button>
+		</view>
+		<view style="width:100%;height: 100rpx;"></view>
+
+
+	</view>
+</template>
+
+<script>
+	import dictMixns from '@/mixins/dictMixins'
+	import {
+		getById,
+		update
+	} from '@/api/inspectionWork/index.js'
+	import {
+		handleInput
+	} from './unit.js';
+
+	export default {
+		components: {},
+		mixins: [dictMixns],
+		data() {
+			return {
+				handleInput,
+				show: false,
+				form: {
+
+				},
+				acceptUnpackList: [{
+						text: "合格",
+						value: 1
+					},
+					{
+						text: "不合格",
+						value: 2
+					}, {
+						text: "让步接收",
+						value: 3
+					},
+				],
+
+				workData: {}
+			}
+		},
+		computed: {
+
+		},
+		onLoad(data) {
+			this.requestDict('质检计划类型');
+			this.requestDict('取样类型');
+			this.requestDict('质检标准类型');
+			if (data) {
+				getById(data.workId).then(res => {
+					this.workData = res
+					this.form = res.templateList.find(item => item.id == data.projectId)
+					this.form.measureUnit = res.qualitySampleList[0]?.measureUnit
+
+				})
+			}
+
+		},
+
+		onShow() {
+
+		},
+		methods: {
+
+			update() {
+				let params = JSON.parse(JSON.stringify(this.workData))
+				let index= params.templateList.findIndex(item=>item.id==this.form.id)
+				params.templateList[index]=this.form
+				update(params)
+					.then((msg) => {
+						
+					})
+					.catch((e) => {
+					});
+			},
+
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.mainBox {
+		background-color: #f3f8fb;
+		height: 100vh;
+		font-size: 27rpx;
+		overflow-y: auto;
+	}
+
+	.wrapper {
+		width: 720rpx;
+		background: #fff;
+		margin: 20rpx auto 0;
+		border-radius: 30rpx;
+		padding: 26rpx;
+	}
+
+	.footerButton {
+		width: 100%;
+		height: 84rpx;
+		display: flex;
+		position: fixed;
+		bottom: 0;
+		z-index: 10;
+		background-color: #fff;
+
+		/deep/.u-button {
+			height: 100%;
+		}
+
+		>view {
+			flex: 1;
+		}
+	}
+
+	.workValue {
+		word-break: break-all;
+		font-weight: bold;
+
+	}
+
+	.tag {
+		// font-size: 24rpx;
+		color: #fff;
+		padding: 12rpx;
+		border-radius: 10rpx;
+		background: #979797;
+		display: inline-block;
+
+	}
+
+	/deep/.input-value {
+		font-size: 28rpx !important;
+	}
+
+	.defValue {
+		color: #c1353c;
+		text-indent: 2ch;
+	}
+
+	.marginTop20 {
+		margin-top: 30rpx;
+	}
+
+
+	.herder_item {
+		display: flex;
+
+		font-weight: bold;
+		// font-size: 26rpx;
+
+		.herder_text {
+
+			min-width: 10rpx;
+			height: 32rpx;
+			border-radius: 10rpx;
+			background: #00c0a1;
+			margin-right: 12rpx;
+			margin-top: 5rpx;
+		}
+	}
+</style>

+ 133 - 0
pages/qms/inspectionWork/unit.js

@@ -0,0 +1,133 @@
+import Vue from 'vue';
+
+//改变数量
+export function handleInput(item, value, arr) {
+  console.log('进来没有', item, value, arr);
+  if (value) {
+    if (item.textType == '1') {
+      if (!item.symbol) {
+
+        if (item.qualityResultContent != item.defaultValue) {
+          Vue.set(item, 'qualityResults', 2);
+        } else {
+          Vue.set(item, 'qualityResults', 1);
+        }
+        // qualityResultsListChange(arr);
+        return;
+      }
+      let key = mathematicalJudgment(item);
+      Vue.set(item, 'qualityResults', key);
+      // qualityResultsListChange(arr);
+    }
+
+    if (item.textType == '3') {
+      let num = Number(item.qualityResultContent);
+      if (num == NaN) {
+        Vue.set(item, 'qualityResults', 2);
+        // qualityResultsListChange(arr);
+        return;
+      }
+      if (num >= Number(item.minValue) && num <= Number(item.maxValue)) {
+        Vue.set(item, 'qualityResults', 1);
+        qualityResultsListChange(arr);
+      } else {
+        Vue.set(item, 'qualityResults', 2);
+        // qualityResultsListChange(arr);
+      }
+    }
+  } else {
+    Vue.set(item, 'qualityResults', 1);
+    qualityResultsListChange(arr);
+  }
+}
+
+export function qualityResultsListChange(arr) {
+  if (!arr) {
+    return;
+  }
+
+  arr.forEach((item, index) => {
+    Vue.set(
+      arr[index],
+      'qualityResults',
+      getQuality(item.qualitySampleTemplateList)
+    );
+  });
+}
+function getQuality(arr) {
+  let getQualityValue = 1;
+  arr.forEach((item) => {
+    if (item.qualityResults == 2) {
+      getQualityValue = 2;
+    }
+  });
+  return getQualityValue;
+}
+
+// 数学判断
+function mathematicalJudgment(row) {
+  console.log('进来没有', row);
+  let symbol = row.symbol?.trim(); // 符号
+  let Ivalue = Number(row.qualityResultContent); // 输入的值
+  let Dvalue = Number(row.defaultValue); // 判断的值
+  if (Ivalue == NaN || Dvalue == NaN) {
+    return 2;
+  }
+  if (symbol == '±') {
+    if (Math.abs(Ivalue) != Math.abs(Dvalue)) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  if (symbol == '≤' || symbol == '≦') {
+    if (Ivalue <= Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  if (symbol == '≥' || symbol == '≧') {
+    if (Ivalue >= Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  if (symbol == '≈' || symbol == '=') {
+    console.log('进来等于号');
+    if (Ivalue == Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  if (symbol == '≠') {
+    if (Ivalue != Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  if (symbol == '>') {
+    if (Ivalue > Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+  if (symbol == '<') {
+    if (Ivalue < Dvalue) {
+      return 1;
+    } else {
+      return 2;
+    }
+  }
+
+  return 2;
+}