feat(IQC检验任务):

1.检验界面:新增按钮【上一项】和【下一项】按钮逻辑;
2.检验界面:检验项目前必填项加红色*;
3.检验界面:点击保存按钮不再做关闭;
4.IQC计数类型-检验界面的保存报空指针异常(注意纳琳威没有计数类型,所以此报错之前不影响,现在已改掉️)
This commit is contained in:
leiqiaozhen 2025-06-09 18:19:18 +08:00
parent a70b59bdbc
commit 6811daebc7
5 changed files with 191 additions and 20 deletions

View File

@ -8,10 +8,13 @@
width="60%"
center
:append-to-body="true"
@close="handleClose"
:show-close="false"
>
<div style="background-color: #f7f7f7; border-radius: 10px; padding: 10px; margin-top: -30px">
<h2>{{ $t('mes.inspectionItem') }} :{{ form.qcItem }} / {{ form.qcItemDesc }}</h2>
<h2>
<span v-if="form.isRequired === 'Y'" style="color: red;">*</span>
{{ $t('mes.inspectionItem') }} :{{ form.qcItem }} / {{ form.qcItemDesc }}
</h2>
<el-row>
<el-col :span="2"> {{ $t('mes.qms.samplingNumber') }}: {{ form.sampleSize }} </el-col>
</el-row>
@ -88,6 +91,13 @@
</el-tab-pane>
</el-tabs>
<div style="width: 100%; display: flex; justify-content: center; margin-top: 20px">
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="previousItem"
>上一项
</el-button>
<el-button
v-if="state !== 'view'"
type="primary"
@ -96,6 +106,13 @@
@click="handleSave"
>{{ $t('el.button.save') }}
</el-button>
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="nextItem"
>下一项
</el-button>
<el-button icon="el-icon-circle-close" size="small" @click="handleClose"
>{{ state == 'view' ? $t('mes.close') : $t('common.cancel') }}
</el-button>
@ -145,6 +162,7 @@ import { saveIqcDetailResult } from '@/api/mes/qms/inspec-job'
import { copyJSON } from '@/util/util'
import { hideLoading, showLoading } from '@/const/loading'
import { setSeq } from '@/util/table'
import {isBlank} from "@/util/string";
export default {
components: { inspecFactor, inspecResult },
name: 'inspec-count',
@ -234,9 +252,29 @@ export default {
this.$set(this.tableData[index].value, `inv`, [])
})
},
handleClose() {
// 上一项
previousItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.handleClose('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.preInspecItem();
},
// 下一项
nextItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.handleClose('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.nextInspecItem(); // 调用父组件的方法打开下一项
},
handleClose(buttonType) {
this.$emit('update:visible', false)
this.$emit('close', 'countModel')
if(isBlank(buttonType)) {
this.$emit('close', 'countModel')
} else {
this.$emit('close', buttonType)
}
},
handleSave() {
this.setData(this.form)
@ -271,6 +309,7 @@ export default {
handle: row.handle,
inspecJobBo: row.inspecJobBo,
inspecResultList: list,
qcItem: row.qcItem,
factorList: box,
}
},
@ -280,7 +319,7 @@ export default {
.then(() => {
hideLoading()
this.$message.success(this.$t('mes.save_successful'))
this.handleClose()
// this.handleClose()
})
.catch((e) => {
hideLoading()

View File

@ -8,13 +8,14 @@
width="60%"
:visible.sync="formVisible"
:title="title"
@close="closeForm"
center
top="50px"
:show-close="false"
>
<el-card class="box-card" :body-style="{ padding: '0px' }">
<div style="background-color: #f5f5f5; padding: 10px">
<h2 style="display: inline">
<span v-if="form.isRequired === 'Y'" style="color: red;">*</span>
{{ $t('mes.inspectionItem') }}: {{ `${form.qcItem} / ${form.qcItemDesc}` }}
</h2>
<div class="iqc-inspec-measure-title">
@ -100,6 +101,13 @@
</el-tabs>
<div style="width: 100%; display: flex; justify-content: center; margin-top: 20px">
<span slot="footer" class="dialog-footer">
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="previousItem"
>上一项
</el-button>
<el-button
v-if="state != 'view'"
type="primary"
@ -108,6 +116,13 @@
@click="handleSave"
>{{ $t('el.button.save') }}
</el-button>
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="nextItem"
>下一项
</el-button>
<el-button icon="el-icon-circle-close" size="small" @click="closeForm"
>{{ state == 'view' ? $t('mes.close') : $t('common.cancel') }}
</el-button>
@ -126,6 +141,7 @@ import { saveIqcDetailResult } from '@/api/mes/qms/inspec-job'
import { numberControl } from '@/util/number'
import { controlMode } from '../init'
import { setSeq } from '@/util/table'
import {isBlank} from "@/util/string";
export default {
components: {
inspecFactor,
@ -334,16 +350,38 @@ export default {
.then(() => {
hideLoading()
this.$message.success(this.$t('mes.save_successful'))
this.closeForm()
// this.closeForm()
})
.catch(() => {
hideLoading()
})
},
closeForm() {
this.$emit('update:visible', false)
this.$emit('close', 'measureModel')
},
// 上一项
previousItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.closeForm('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.preInspecItem();
},
// 下一项
nextItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.closeForm('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.nextInspecItem(); // 调用父组件的方法打开下一项
},
closeForm(buttonType) {
this.$emit('update:visible', false)
if(isBlank(buttonType)) {
this.$emit('close', 'measureModel')
} else {
this.$emit('close', buttonType)
}
},
// 数字输入限制
numInputChange(num, index, row, key) {
let data = {

View File

@ -8,13 +8,14 @@
width="60%"
:visible.sync="formVisible"
:title="title"
@close="closeForm"
center
top="100px"
:show-close="false"
>
<el-card class="box-card" :body-style="{ padding: '0px' }">
<div style="background-color: #f5f5f5; padding: 10px">
<h2 style="display: inline">
<span v-if="form.isRequired === 'Y'" style="color: red;">*</span>
{{ $t('mes.inspectionItem') }}: {{ `${form.qcItem} / ${form.qcItemDesc}` }}
</h2>
<div style="margin: 10px 0">{{ $t('mes.qms.textContentDescription') }}: {{ form.content }}</div>
@ -117,6 +118,13 @@
</el-tabs>
<div style="width: 100%; display: flex; justify-content: center; margin-top: 20px">
<span slot="footer" class="dialog-footer">
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="previousItem"
>上一项
</el-button>
<el-button
v-if="state != 'view'"
type="primary"
@ -125,6 +133,13 @@
@click="handleSave"
>{{ $t('el.button.save') }}
</el-button>
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="nextItem"
>下一项
</el-button>
<el-button icon="el-icon-circle-close" size="small" @click="closeForm"
>{{ state == 'view' ? $t('mes.close') : $t('common.cancel') }}
</el-button>
@ -141,6 +156,7 @@ import inspecFactor from '@/views/mes/qms/inspec/content/inspec-factor.vue'
import inspecResult from './inspec-result.vue'
import { saveIqcDetailResult } from '@/api/mes/qms/inspec-job'
import {numberControl} from "@/util/number";
import {isBlank} from "@/util/string";
export default {
components: {
inspecFactor,
@ -322,7 +338,7 @@ export default {
.then(() => {
hideLoading()
this.$message.success(this.$t('mes.save_successful'))
this.closeForm()
// this.closeForm()
})
.catch(() => {
hideLoading()
@ -334,9 +350,30 @@ export default {
this.setData(this.form)
this.saveAPI(this.reqObj)
},
closeForm() {
// 上一项
previousItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.closeForm('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.preInspecItem();
},
// 下一项
nextItem() {
// 1.关闭当前页面,并把按钮类型传过去 'previousOrNextButton'
this.closeForm('previousOrNextButton');
// 调用父组件的方法打开上一项
this.$parent.nextInspecItem(); // 调用父组件的方法打开下一项
},
closeForm(buttonType) {
this.$emit('update:visible', false)
this.$emit('close', 'textModel')
if(isBlank(buttonType)) {
this.$emit('close', 'textModel')
} else {
this.$emit('close', buttonType)
}
},
},
}

View File

@ -32,6 +32,7 @@ export const closeForm = {
testsampleQty: '0',
}
export const textForm = {
isRequired: '',
qcItem: '',
qcItemDesc: '',
contentDesc: '',
@ -53,6 +54,7 @@ export const textForm = {
}
export const measureForm = {
isRequired: '',
qcItem: '',
qcItemDesc: '',
sampleSize: 5,

View File

@ -402,7 +402,8 @@ export default {
toErp: false,
toOa: false,
toWms: false,
}
currentInspecIndex: -1, // 当前正在处理的检验项索引
}
},
computed: {
...mapGetters(['permissions', 'userInfo']),
@ -743,6 +744,7 @@ export default {
},
//qc table按鈕
async handleCommandQc(e, row, index) {
this.currentInspecIndex = index
switch (e) {
case 'view':
this.state = 'view'
@ -930,11 +932,64 @@ export default {
if (this.tableLoading) return
this.searchChange()
},
// 上一项
preInspecItem() {
// 关闭所有可能的弹窗
this.visibleCount = false;
this.visibleMeasure = false;
this.visibleText = false;
// 移动到上一项
this.currentInspecIndex -= 1;
this.nextOrPreviousItem(this.currentInspecIndex);
},
// 下一项
nextInspecItem() {
// 关闭所有可能的弹窗
this.visibleCount = false;
this.visibleMeasure = false;
this.visibleText = false;
// 移动到下一项
this.currentInspecIndex += 1;
this.nextOrPreviousItem(this.currentInspecIndex);
},
// 打开下一项或上一项数据
async nextOrPreviousItem(index) {
const row = this.qcTable[index];
if (!row) return;
switch (row.itemType) {
case '0':
// 計數
if (this.ncData.length > 0) {
this.ncData.forEach((n) => (n.disabled = this.state === 'view'))
}
await this.getOneDetailResultAPI(row, 'countModel')
this.visibleCount = true
break
case '1':
// 計量
await this.getOneDetailResultAPI(row, 'measureModel')
this.visibleMeasure = true
break
case '2':
// 內文
await this.getOneDetailResultAPI(row, 'textModel')
this.visibleText = true
break
}
},
async afterClose(key) {
this[key] = {}
if (this.tableLoadingQC) return
await this.searchChange()
await this.getOneDetailAPI(this.jobRow)
if (key !== 'previousOrNextButton') {
this[key] = {}
if (this.tableLoadingQC) return
await this.searchChange()
await this.getOneDetailAPI(this.jobRow)
}
},
},
}