From 96973dca40a1815e9727160e6b2e6dee839b9f8d Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 31 十二月 2025 13:06:14 +0800
Subject: [PATCH] 质量模具模块页面优化
---
components/ZLGL/InspectValueTemplate.vue | 515 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 462 insertions(+), 53 deletions(-)
diff --git a/components/ZLGL/InspectValueTemplate.vue b/components/ZLGL/InspectValueTemplate.vue
index bbfe0f9..ec6b845 100644
--- a/components/ZLGL/InspectValueTemplate.vue
+++ b/components/ZLGL/InspectValueTemplate.vue
@@ -1,6 +1,6 @@
<template>
<view>
- <view class="inspect-value-content">
+ <view class="InSpect-value-content">
<view class="form-item">
<view class="left">椤圭洰搴忓彿</view>
<view class="right disabled">
@@ -21,7 +21,7 @@
</view>
<view class="form-item">
<view class="left">妫�楠岀粨鏋�</view>
- <view class="right disabled">
+ <view class="right" :class="CheckResultClass">
<input type="text" v-model="checkData.HResult2" disabled />
</view>
</view>
@@ -45,7 +45,7 @@
{{ checkData.HStatus?"鍚堟牸":"涓嶅悎鏍�" }}
</view>
<view>
- <switch style="width: 2em; transform:scale(0.7);" :checked="checkData.HStatus?'checked':''"
+ <switch style="width: 2em; transform:scale(0.7);" :checked="!!checkData.HStatus"
@change="HStatusChange" />
</view>
</view>
@@ -53,56 +53,63 @@
<view class="form-item">
<view class="left">姣旇緝绗�</view>
<view class="right disabled">
- <input type="text" v-model="checkData.HResult2" disabled />
+ <uni-combox :candidates="HCompareSymbolList" v-model="checkData.HCompareSymbol"></uni-combox>
</view>
</view>
<view class="form-item">
<view class="left">鍗曚綅</view>
<view class="right disabled">
- <input type="text" v-model="checkData.HTargetVal" disabled />
+ <uni-combox :candidates="UnitNameList" v-model="checkData.HUnitName"></uni-combox>
+ <!-- <input type="text" v-model="checkData.HTargetVal" /> -->
</view>
</view>
<view class="form-item">
<view class="left">妫�楠屽��</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HInspectVal" disabled />
+ <view class="right">
+ <input type="number" v-model="checkData.HInSpectVal" />
</view>
</view>
<view class="form-item">
<view class="left">鐩爣鍊�</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HTargetVal" disabled />
+ <view class="right ">
+ <input type="number" v-model="checkData.HTargetVal" @blur="CalculateLimitOffset(1)" />
</view>
</view>
<view class="form-item">
<view class="left">涓婇檺鍊�</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HUpLimit" disabled />
+ <view class="right" :class="[AnalysisMethodStatus == 1?'disabled':'']">
+ <input type="number" v-model="checkData.HUpLimit" :disabled="AnalysisMethodStatus == 1" @blur="CalculateLimitOffset(2)" />
</view>
</view>
<view class="form-item">
<view class="left">涓嬮檺鍊�</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HDownLimit" disabled />
+ <view class="right" :class="[AnalysisMethodStatus == 1?'disabled':'']">
+ <input type="number" v-model="checkData.HDownLimit" :disabled="AnalysisMethodStatus == 1" @blur="CalculateLimitOffset(3)" />
</view>
</view>
<view class="form-item">
<view class="left">涓婂亸宸�</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HUpOffset" disabled />
+ <view class="right" :class="[
+ (AnalysisMethodStatus == 1 || AnalysisMethodStatus == 3)?'disabled':''
+ ]">
+ <input type="number" v-model="checkData.HUpOffset"
+ :disabled="AnalysisMethodStatus == 1 || AnalysisMethodStatus == 3" @blur="CalculateLimitOffset(4)" />
</view>
</view>
<view class="form-item">
<view class="left">涓嬪亸宸�</view>
- <view class="right disabled">
- <input type="text" v-model="checkData.HDownOffset" disabled />
+ <view class="right" :class="[
+ (AnalysisMethodStatus == 1 || AnalysisMethodStatus == 3)?'disabled':''
+ ]">
+ <input type="number" v-model="checkData.HDownOffset"
+ :disabled="AnalysisMethodStatus == 1 || AnalysisMethodStatus == 3" @blur="CalculateLimitOffset(5)" />
</view>
</view>
<view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view>
- <view class="inspect-value-list">
- <view style="width: 100%;text-align: right;">
- <button type="default" size="mini" class="btn-a" @click="storeInspectValue">缂撳瓨妫�楠屽��</button>
- </view>
+ <view class="InSpect-value-list">
+ <!-- <view style="width: 100%;text-align: right;">
+ <button type="default" size="mini" class="btn-a" @click="storeInSpectValue">缂撳瓨妫�楠屽��</button>
+ </view> -->
<view class="item" style="border-top: 2px solid #e3e3e3 ;">
<view class="th1">搴忓彿</view>
<view class="th2" style="display: flex; flex-direction: row; align-items: center;">
@@ -112,19 +119,25 @@
妫�楠屽��({{getAnalysisMethodTitle(checkData.HAnalysisMethod)}})
</view>
</view>
- <view class="item" v-for="(item, index) in inspectValues">
+ <view class="item" v-for="(item, index) in InSpectValues">
<view class="th1">{{item.HSEQ}}</view>
<view class="th2" style="display: flex; flex-direction: row; align-items: center;">
<view style="width: 3em; ">
- {{ item.HInspectResult?"鍚堟牸":"涓嶅悎鏍�" }}
+ {{ item.HInSpectResult == 1?"鍚堟牸":"涓嶅悎鏍�" }}
</view>
<view>
- <switch style="width: 3em; transform:scale(0.7);" :checked="item.HInspectResult?'checked':''"
- @change="HInspectResultChange(index, $event)" />
+ <switch style="width: 3em; transform:scale(0.7);" :checked="item.HInSpectResult == 1"
+ @change="HInSpectResultChange(index, $event)" />
</view>
</view>
<view class="th3">
- <input type="number" v-model="item.HInspectValue" />
+ <uni-combox v-if="checkData.HAnalysisMethod == 1" :candidates="InitInSpectValNameList"
+ v-model="item.HInSpectValueB_Text"
+ @update:modelValue="HInSpectValueBChange(index, $event)"></uni-combox>
+ <input v-else-if="checkData.HAnalysisMethod == 2" type="number" v-model="item.HInSpectValue"
+ @blur="InSpectValueChange(item,index)" @confirm="InSpectValueChange(item,index)" @focus="item.HInSpectValue = ''" />
+ <input v-else type="number" v-model="item.HInSpectValueT"
+ @blue="InSpectValueTChange(item, index)" @confirm="InSpectValueTChange(item, index)" @focus="item.HInSpectValueT = ''"/>
</view>
</view>
</view>
@@ -133,17 +146,41 @@
</template>
<script>
+ import {
+ getUserInfo
+ } from '../../utils/auth';
+ import {
+ CommonUtils
+ } from '../../utils/common';
// 妫�楠屽�兼ā鏉�
export default {
- name: "InspectValueTemplate",
+ name: "InSpectValueTemplate",
data() {
return {
+ mode: 0,
checkData: {
HResDec: 2,
HResult2: '',
HStatus: true,
+ HCompareSymbol: "=", // 榛樿涓�=鍙�
+ HUnitName: '',
+ HAnalysisMethod: 0,
+ HTargetVal: 0,
+ HUpOffset: 0,
+ HDownOffset: 0,
+ HUpLimit: 0,
+ HDownLimit: 0,
+ HSampleUnRightQty: 0
},
- inspectValues: []
+ InSpectValues: [],
+ InitInSpectValNameList: [],
+ InitInSpectValList: [],
+ UnitNameList: [],
+ UnitList: [],
+
+ CheckResultClass: 'disable',
+
+ HCompareSymbolList: ["=", ">", ">=", "<", "<=", "<>", "between"]
};
},
props: {
@@ -158,34 +195,355 @@
},
mounted() {
console.log('bingData: ', this.bindData);
- let {data, list} = this.bindData
- this.checkData = Object.assign(data, JSON.parse(JSON.stringify(this.bindData)))
+ let {
+ data,
+ list,
+ mode
+ } = this.bindData
+ Object.assign(this.checkData, data, JSON.parse(JSON.stringify(this.bindData)))
+ // 鍓嶆鑾峰彇HStatus鏃讹紝0鍜�1 鐨勭姸鎬佸潎鍒濆鍖栦负 true锛�2鐘舵�佸垵濮嬪寲涓篺alse
+ if(typeof this.checkData.HStatus == 'number'){
+ this.checkData.HStatus = this.checkData.HStatus <= 1 ? true : false
+ }
+ this.checkData.HResult2 = this.checkData.HResult == 1 ? '鍚堟牸' : '涓嶅悎鏍�'
+ this.mode = mode
// 鍒ゆ柇鏄惁鏈夌紦瀛樻暟鎹垨鑰呯紦瀛樻暟鎹槸鍚︿笌鏍锋湰鏁颁竴鑷�
- if(!list || list.length != this.checkData.HSampleQty ){
+ if (!list || list.length != this.checkData.HSampleQty) {
for (let index = 0; index < this.checkData.HSampleQty; index++) {
- this.inspectValues.push({
+ this.InSpectValues.push({
HSEQ: index + 1,
- HInspectResult: true,
- HInspectValue: 0,
+ HInSpectResult: 1,
+ HInSpectValue: 0, // 瀹氶噺妫�娴嬪��
+ HInSpectValueB: 0, // 瀹氭�ф娴婭D
+ HInSpectValueB_Text: '', // 瀹氭�ф娴�(鍐呭)
+ HInSpectValueT: 0, // 鍏朵粬妫�娴嬪��
})
}
- }else {
- this.inspectValues = list
+ } else {
+ this.InSpectValues = list
}
-
+ this.InitInSpectVal()
+ this.InitUnit()
+ // 瀹炰緥鎸傝浇鍚庯紝鑾峰彇InterID 鍜� EntryID 瀵瑰簲鐨勬楠岄」鐩殑妫�楠屽��
+ this.getValueList()
+
this.$forceUpdate()
},
- methods: {
- storeInspectValue(){
- this.$emit("update", {
- data: this.checkData,
- list: this.inspectValues
+ watch: {
+ "checkData.HResult2"(newVal, oldVal) {
+ if (newVal == '鍚堟牸') {
+ this.CheckResultClass = 'pass-background'
+ } else if (newVal == '涓嶅悎鏍�') {
+ this.CheckResultClass = 'unpass-background'
+ } else {
+ this.CheckResultClass = 'disabled'
+ }
+ // 鍚屾鐖剁粍浠剁殑瀵瑰簲妫�楠岄」鐩殑缁撹
+ this.$emit("syncInspectResult", {
+ HResult2: newVal,
+ bindKey: this.bindKey
})
},
- getAnalysisMethodTitle(type){
- if(type == 1) {
+
+ },
+ computed: {
+ AnalysisMethodStatus: {
+ get() {
+ if (this.checkData.HAnalysisMethod == 1) {
+ return 1
+ } else if (this.checkData.HAnalysisMethod == 2) {
+ return 2
+ }
+ return 3
+ }
+ },
+ currWebUrl: {
+ get(){
+ switch (this.mode){
+ case 1: return {
+ // 棣栨
+ setUrl: '/QC_FirstPieceCheckBill/set_SaveValue',
+ getUrl: '/QC_ValueTable/getValueList'
+ }
+ case 2: return {
+ // 宸℃
+ setUrl: '/QC_PatrolProcCheckOtherBill/set_SaveValue',
+ getUrl: '/QC_PatrolProcCheckOtherBill/getValueList'
+ }
+ case 3: return {
+ // 鐢熶骇鍏ュ簱妫�
+ setUrl: '/QC_LastPieceCheckBill/set_SaveValue',
+ getUrl: '/QC_LastPieceCheckBill_ValueTable/getValueList'
+ }
+ case 4:return{
+ // 鍑哄巶妫�
+ setUrl: '/QC_OutCompCheckBill/set_SaveValue',
+ getUrl: '/QC_OutCompCheckBill_ValueTable/getValueList'
+ }
+ case 5:return{
+ // 鏉ユ枡妫�
+ setUrl: '/QC_POStockInCheckBill/set_SaveValue',
+ getUrl: '/QC_POStockInCheckBill_ValueTable/getValueList'
+ }
+ case 6: return {
+ // 鏈
+ }
+ }
+ }
+ }
+ },
+
+ beforeDestroy() {
+ // 娉ㄩ攢鍓嶏紝鎻愪氦鏁版嵁鐨勬楠屽��
+ this.set_SaveValue()
+ this.$emit("syncCheckData", this.checkData)
+ },
+ methods: {
+ CalculateLimitOffset(mode) { // 閲嶆柊璁$畻涓婇檺鍊肩殑鍋忓樊鍊�
+ switch (mode) {
+ // 鐩爣鍊煎彉鏇�
+ case 1:
+ this.checkData.HUpOffset = 0
+ this.checkData.HUpLimit = this.checkData.HTargetVal
+ this.checkData.HDownOffset = 0
+ this.checkData.HDownLimit = this.checkData.HTargetVal
+ break;
+ // 涓婇檺鍊煎彉鏇�
+ case 2:
+ this.checkData.HUpOffset = eval(`${this.checkData.HUpLimit}-${this.checkData.HTargetVal}`)
+ break;
+ // 涓嬮檺鍊煎彉鏇�
+ case 3:
+ this.checkData.HDownOffset = eval(`${this.checkData.HDownLimit}-${this.checkData.HTargetVal}`)
+ break;
+ // 涓婂亸宸�煎彉鏇�
+ case 4:
+ this.checkData.HUpLimit = eval(`${this.checkData.HUpOffset}-${this.checkData.HTargetVal}`)
+ break;
+ // 涓嬪亸宸�煎彉鏇�
+ case 5:
+ this.checkData.HDownLimit = eval(`${this.checkData.HDownOffset}-${this.checkData.HTargetVal}`)
+ break;
+ }
+ },
+ // 鍏朵粬鍒嗘瀽 妫�楠屽�煎彉鍖栨椂鍒ゆ柇
+ InSpectValueTChange(item, index) {
+ console.log('item,: ', item);
+
+ this.HInSpectResultChange(index, {
+ detail: {
+ value: this.checkValuePass(item.HInSpectValueT)
+ }
+ })
+ },
+ // 瀹氶噺鍒嗘瀽 妫�楠屽�煎彉鍖栨椂鍒ゆ柇
+ InSpectValueChange(item, index) {
+ console.log('item,: ', item);
+
+ this.HInSpectResultChange(index, {
+ detail: {
+ value: this.checkValuePass(item.HInSpectValue)
+ }
+ })
+ },
+ checkValuePass(val) {
+ console.log('val: ', val);
+ console.log('this.checkData.HTargetVal: ', this.checkData.HTargetVal);
+ switch (this.checkData.HCompareSymbol) {
+ case '=':
+ if (val == this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case '>':
+ if (val > this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case '>=':
+ if (val >= this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case '<':
+ if (val < this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case '<=':
+ if (val <= this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case '<>':
+ if (val != this.checkData.HTargetVal) {
+ return true
+ };
+ break;
+ case 'between':
+ if (val >= (this.checkData.HTargetVal - this.checkData.HDownLimit || 0) &&
+ val <= (this.checkData.HTargetVal + this.checkData.HUpLimit || 0)) {
+ return true
+ };
+ break;
+ default:
+ CommonUtils.showTips({
+ message: '璇烽�夋嫨姣旇緝绗�'
+ })
+ }
+ },
+ // 鍒濆鍖� 鍗曚綅
+ async InitUnit() {
+ let res = await CommonUtils.doRequest2Async({
+ url: '/Gy_Unit/list1',
+ data: {
+ sWhere: ` and 绂佺敤鏍囪 = '' and 瀹℃牳浜� != ''`,
+ user: getUserInfo()['Czymc'],
+ Organization: uni.getStorageSync("Organization")
+ }
+ })
+
+ let {
+ data,
+ count,
+ Message
+ } = res.data
+ if (!count) {
+ CommonUtils.showTips({
+ title: '娓╅Θ鎻愮ず',
+ message: `鍒濆鍖栧崟浣嶉敊璇�: ${Message}`
+ })
+ } else {
+ this.UnitNameList = Array.from(data).map(e => e["璁¢噺鍗曚綅鍚嶇О"])
+ this.UnitList = data
+ }
+ },
+ // 鍗曚綅 淇敼 鐩戝惉
+ UnitChange(e) {
+
+ },
+ async set_SaveValue() {
+ await this.$nextTick();
+ console.log("InSpect Values: ", this.InSpectValues)
+ try {
+ let res = await CommonUtils.doRequest2Sync({
+ url: this.currWebUrl.setUrl,
+ data: {
+ msg: `${JSON.stringify(this.InSpectValues)};${this.checkData.HInterID};${this.checkData.num}`
+ },
+ method: "POST"
+ })
+
+ if (!res) {
+ return
+ }
+ let {
+ Message,
+ count
+ } = res.data
+ if (count != 1) {
+ CommonUtils.showTips({
+ title: '娓╅Θ鎻愮ず',
+ message: `淇濆瓨妫�楠屽�奸敊璇�: ${Message}`
+ })
+ }
+ } catch (err) {
+ CommonUtils.showTips({
+ title: '娓╅Θ鎻愮ず',
+ message: `淇濆瓨妫�楠屽�奸敊璇�: ${err}`
+ })
+ }
+ },
+ async getValueList() {
+ console.log('checkData: ', this.checkData);
+ try {
+ let res = await CommonUtils.doRequest2Async({
+ url: this.currWebUrl.getUrl,
+ data: {
+ HInterID: this.checkData.HInterID,
+ HEntryID: this.checkData.num,
+ user: getUserInfo()['Czymc']
+ }
+ })
+
+ let {
+ data,
+ count
+ } = res.data
+ if (count == 1) {
+ console.log('InspectValuesData: ', data);
+ // 褰撳墠 妫�楠屽�奸〉绛句腑 淇濆瓨鐨勬暟鎹釜鏁板拰鏁版嵁搴撲腑鐨勪釜鏁板ぇ 鎴栬�呯浉绛夛紝鍙栨暟鎹簱涓殑鏁版嵁锛屽鐨勮ˉ绌�
+ if (this.InSpectValues.length >= data.length) {
+ let InSpectValuesNew = this.InSpectValues.slice(data.length, this.InSpectValues.length)
+ this.InSpectValues = [...data, ...InSpectValuesNew]
+ } else {
+ // 鎴彇褰撳墠淇濆瓨鐨勬暟鎹�
+ this.InSpectValues = data.slice(0, this.InSpectValues.length)
+ }
+ // this.InSpectValues = data
+
+ }
+ } catch (err) {
+ CommonUtils.showTips({
+ tite: '娓╅Θ鎻愮ず',
+ message: `鑾峰彇妫�娴嬪�奸敊璇�: ${err}`
+ })
+ }
+
+ },
+ async InitInSpectVal() { // 鍒濆鍖栧畾鎬ф娴嬪唴瀹�
+ try {
+ let res = await CommonUtils.doRequest2Async({
+ url: '/Gy_BadReason/Gy_InSpectValueList',
+ data: {
+ sWhere: ` and 浣跨敤缁勭粐鍚嶇О = '${uni.getStorageSync("Organization")}' and 绂佺敤鏍囧織 = '鍚�' and 瀹℃牳浜� !='' `,
+ user: getUserInfo()['Czymc']
+ }
+ })
+
+ let {
+ count,
+ Message,
+ data
+ } = res.data
+
+ if (count == 1) {
+ this.InitInSpectValNameList = Array.from(data).map(e => e["妫�娴嬪�煎悕绉�"])
+ this.InitInSpectValList = data
+ } else {
+ CommonUtils.showTips({
+ title: "娓╅Θ鎻愮ず",
+ message: `妫�娴嬪�煎垵濮嬪寲閿欒: ${Message}`
+ })
+ }
+ } catch (err) {
+ CommonUtils.showTips({
+ title: "娓╅Θ鎻愮ず",
+ message: `妫�娴嬪�煎垵濮嬪寲閿欒: ${err}`
+ })
+ }
+ },
+ // 妫�娴嬪�间慨鏀�
+ HInSpectValueBChange(index, e) {
+ let InSpectVal = this.InitInSpectValList.find(elem => elem["妫�娴嬪�煎悕绉�"] == e)
+ if (!InSpectVal) {
+ this.InSpectValues[index].HInSpectValueB = 0
+ this.InSpectValues[index].HInSpectValueB_Text = ''
+ return
+ }
+ this.InSpectValues[index].HInSpectValueB = InSpectVal["HItemID"]
+ this.InSpectValues[index].HInSpectValueB_Text = InSpectVal["妫�娴嬪�煎悕绉�"]
+ },
+ storeInSpectValue() {
+ this.$emit("update", {
+ data: this.checkData,
+ list: this.InSpectValues
+ })
+ },
+ getAnalysisMethodTitle(type) {
+ if (type == 1) {
return '瀹氭�у垎鏋�'
- }else if(type == 2){
+ } else if (type == 2) {
return '瀹氶噺鍒嗘瀽'
}
return '鍏朵粬鍒嗘瀽'
@@ -193,23 +551,47 @@
HStatusChange(e) {
this.checkData.HStatus = e.detail.value
},
- HInspectResultChange(index, e) {
- console.log('e: ',e.detail.value);
- this.inspectValues[index].HInspectResult = e.detail.value
- },
+ HInSpectResultChange(index, e) {
+ console.log('e: ', e.detail.value);
+ this.InSpectValues[index].HInSpectResult = e.detail.value ? 1 : 2
+ this.CheckPassNum()
- }
+ },
+ CheckPassNum() {
+ let unPassNum = this.InSpectValues.map(elem => elem.HInSpectResult).filter(elem => elem != 1).length
+
+ this.checkData.HSampleUnRightQty = unPassNum
+ let unRightQty = this.checkData.HAcceptQty
+ if (this.checkData.HStatus) { // true 涓� 妫�楠屽悎鏍硷紝 false涓烘楠� 涓嶅悎鏍�
+ if (unPassNum > unRightQty) {
+ this.checkData.HResult2 = '涓嶅悎鏍�'
+
+ } else {
+ this.checkData.HResult2 = '鍚堟牸'
+ }
+ } else {
+ if (this.InSpectValues.length - unPassNum > unRightQty) {
+ this.checkData.HResult2 = '涓嶅悎鏍�'
+ } else {
+ this.checkData.HResult2 = '鍚堟牸'
+ }
+ }
+
+ }
+
+ },
+
}
</script>
-<style lang="scss">
+<style lang="scss" scoped>
input {
height: inherit;
width: inherit;
font-size: 26rpx;
}
- .inspect-value-content {
+ .InSpect-value-content {
box-sizing: border-box;
padding: 20rpx 10rpx;
display: flex;
@@ -244,11 +626,36 @@
display: flex;
flex-direction: row;
align-items: center;
+
+ .uni-combox {
+ padding: 0;
+ height: auto;
+
+ .uni-input-placeholder,
+ .uni-input-input {
+ font-size: 26rpx;
+ }
+ }
+
+ .uni-combox::v-deep input {
+ height: inherit;
+ font-size: 26rpx;
+ }
}
.disabled {
border: 1px solid #e4e4e4;
background-color: #e4e4e4;
+ }
+
+ .pass-background {
+ background-color: #CEE3F2;
+ border: none;
+ }
+
+ .unpass-background {
+ background-color: #F0D6E3;
+ border: none;
}
.none-border {
@@ -257,7 +664,9 @@
}
}
- .inspect-value-list {
+
+
+ .InSpect-value-list {
box-sizing: border-box;
display: flex;
flex-direction: column;
--
Gitblit v1.9.1