Browse Source

2026-11-03

检验模板增加项目控制维护
master
fengyuan_yang 4 weeks ago
parent
commit
6710a82ba6
  1. 154
      src/views/modules/qc/qcTemplate.vue

154
src/views/modules/qc/qcTemplate.vue

@ -178,7 +178,7 @@
</el-dialog> </el-dialog>
<!-- 检验项目 --> <!-- 检验项目 -->
<el-dialog title="检验项目清单" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="940px">
<el-dialog title="检验项目清单" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1400px">
<el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()"> <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
<el-form-item :label="'检验模板编码'"> <el-form-item :label="'检验模板编码'">
<el-input v-model="detailData.templateId" readonly style="width: 120px"></el-input> <el-input v-model="detailData.templateId" readonly style="width: 120px"></el-input>
@ -195,6 +195,7 @@
<!-- 检验项目展示列表 --> <!-- 检验项目展示列表 -->
<div class="rq "> <div class="rq ">
<el-table <el-table
class="template-detail-table"
:height="400" :height="400"
:data="detailList" :data="detailList"
@row-click="itemClickRow" @row-click="itemClickRow"
@ -249,7 +250,50 @@
<el-input v-else v-model="scope.row.minValue" style="height: 11px;width:98%"></el-input> <el-input v-else v-model="scope.row.minValue" style="height: 11px;width:98%"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column header-align="center" align="center" min-width="120" label="实测值采集控制">
<template slot-scope="scope">
<el-select v-model="scope.row.actualValueCollectFlag" clearable placeholder="跟随项目" style="width: 100%" @change="onTplActualFlagChange(scope.row)">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column header-align="center" align="center" min-width="120" label="实测值填写规则">
<template slot-scope="scope">
<el-select v-model="scope.row.actualValueFillRule" :disabled="scope.row.actualValueCollectFlag !== 'Y'" placeholder="请选择" style="width: 100%" @change="onTplActualRuleChange(scope.row)">
<el-option label="自定义数量" value="自定义数量"></el-option>
<el-option label="按抽样数量" value="按抽样数量"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column header-align="center" align="right" min-width="90" label="实测值数量">
<template slot-scope="scope">
<el-input v-model="scope.row.actualValueQty" type="number" :disabled="scope.row.actualValueCollectFlag !== 'Y' || scope.row.actualValueFillRule !== '自定义数量'"></el-input>
</template>
</el-table-column>
<el-table-column header-align="center" align="center" min-width="120" label="图片采集控制">
<template slot-scope="scope">
<el-select v-model="scope.row.imageCollectFlag" clearable placeholder="跟随项目" style="width: 100%" @change="onTplImageFlagChange(scope.row)">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column header-align="center" align="center" min-width="120" label="图片上传规则">
<template slot-scope="scope">
<el-select v-model="scope.row.imageUploadRule" :disabled="scope.row.imageCollectFlag !== 'Y'" placeholder="请选择" style="width: 100%" @change="onTplImageRuleChange(scope.row)">
<el-option label="自定义数量" value="自定义数量"></el-option>
<el-option label="按抽样数量" value="按抽样数量"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column header-align="center" align="right" min-width="90" label="图片数量">
<template slot-scope="scope">
<el-input v-model="scope.row.imageQty" type="number" :disabled="scope.row.imageCollectFlag !== 'Y' || scope.row.imageUploadRule !== '自定义数量'"></el-input>
</template>
</el-table-column>
<el-table-column <el-table-column
class-name="detail-op-col"
fixed="right" fixed="right"
header-align="center" header-align="center"
align="center" align="center"
@ -907,7 +951,7 @@
sortLv: 0, sortLv: 0,
status: true, status: true,
fixed: '', fixed: '',
columnWidth: 60
columnWidth: 90
}, },
{ {
columnProp: 'itemDesc', columnProp: 'itemDesc',
@ -933,7 +977,7 @@
sortLv: 0, sortLv: 0,
status: true, status: true,
fixed: '', fixed: '',
columnWidth: 60
columnWidth: 90
}, },
], ],
// 快速添加 // 快速添加
@ -1382,12 +1426,98 @@
this.detailData.inspectionTypeName = row.inspectionTypeName this.detailData.inspectionTypeName = row.inspectionTypeName
templateDetailsSearch(this.detailData).then(({data}) => { templateDetailsSearch(this.detailData).then(({data}) => {
this.detailList = data.rows this.detailList = data.rows
this.layoutDetailTable()
}) })
this.detailModelFlag = true this.detailModelFlag = true
this.layoutDetailTable()
},
layoutDetailTable () {
this.$nextTick(() => {
if (this.$refs.detailTable) {
this.$refs.detailTable.doLayout()
}
})
}, },
onTplActualFlagChange (row) {
if (row.actualValueCollectFlag !== 'Y') {
row.actualValueFillRule = ''
row.actualValueQty = ''
} else if (!row.actualValueFillRule) {
row.actualValueFillRule = '自定义数量'
}
},
onTplActualRuleChange (row) {
if (row.actualValueFillRule !== '自定义数量') {
row.actualValueQty = ''
}
},
onTplImageFlagChange (row) {
if (row.imageCollectFlag !== 'Y') {
row.imageUploadRule = ''
row.imageQty = ''
} else if (!row.imageUploadRule) {
row.imageUploadRule = '自定义数量'
}
},
onTplImageRuleChange (row) {
if (row.imageUploadRule !== '自定义数量') {
row.imageQty = ''
}
},
normalizeTemplateCollect (row) {
if (row.actualValueCollectFlag !== 'Y' && row.actualValueCollectFlag !== 'N') {
row.actualValueCollectFlag = null
row.actualValueFillRule = null
row.actualValueQty = null
} else if (row.actualValueCollectFlag !== 'Y') {
row.actualValueFillRule = null
row.actualValueQty = null
} else if (row.actualValueFillRule !== '自定义数量') {
row.actualValueQty = null
} else {
row.actualValueQty = Number(row.actualValueQty)
}
if (row.imageCollectFlag !== 'Y' && row.imageCollectFlag !== 'N') {
row.imageCollectFlag = null
row.imageUploadRule = null
row.imageQty = null
} else if (row.imageCollectFlag !== 'Y') {
row.imageUploadRule = null
row.imageQty = null
} else if (row.imageUploadRule !== '自定义数量') {
row.imageQty = null
} else {
row.imageQty = Number(row.imageQty)
}
},
// 保存模板项目 // 保存模板项目
saveDetail () { saveDetail () {
for (let i = 0; i < this.detailList.length; i++) {
const row = this.detailList[i]
const name = row.itemDesc || row.itemNo
if (row.actualValueCollectFlag === 'Y') {
if (!row.actualValueFillRule) {
this.$message.warning('【' + name + '】请选择实测值填写规则!')
return
}
if (row.actualValueFillRule === '自定义数量' && !(Number(row.actualValueQty) > 0)) {
this.$message.warning('【' + name + '】请输入实测值数量!')
return
}
}
if (row.imageCollectFlag === 'Y') {
if (!row.imageUploadRule) {
this.$message.warning('【' + name + '】请选择图片上传规则!')
return
}
if (row.imageUploadRule === '自定义数量' && !(Number(row.imageQty) > 0)) {
this.$message.warning('【' + name + '】请输入图片数量!')
return
}
}
this.normalizeTemplateCollect(row)
}
let tempData = { let tempData = {
site: this.detailData.site, site: this.detailData.site,
buNo: this.detailData.buNo, buNo: this.detailData.buNo,
@ -1498,6 +1628,7 @@
refreshDetailList () { refreshDetailList () {
templateDetailsSearch(this.detailData).then(({data}) => { templateDetailsSearch(this.detailData).then(({data}) => {
this.detailList = data.rows this.detailList = data.rows
this.layoutDetailTable()
}) })
}, },
@ -1567,6 +1698,7 @@
if (data && data.code === 0) { if (data && data.code === 0) {
templateDetailsSearch(this.detailData).then(({data}) => { templateDetailsSearch(this.detailData).then(({data}) => {
this.detailList = data.rows this.detailList = data.rows
this.layoutDetailTable()
for (let i = 0; i < this.detailList.length; i++) { for (let i = 0; i < this.detailList.length; i++) {
if (this.detailList[i].itemNo === this.currentRow.itemNo) { if (this.detailList[i].itemNo === this.currentRow.itemNo) {
this.$refs.detailTable.setCurrentRow(this.detailList[i]); this.$refs.detailTable.setCurrentRow(this.detailList[i]);
@ -1584,6 +1716,7 @@
if (data && data.code === 0) { if (data && data.code === 0) {
templateDetailsSearch(this.detailData).then(({data}) => { templateDetailsSearch(this.detailData).then(({data}) => {
this.detailList = data.rows this.detailList = data.rows
this.layoutDetailTable()
for (let i = 0; i <this.detailList.length; i++) { for (let i = 0; i <this.detailList.length; i++) {
if (this.detailList[i].itemNo === this.currentRow.itemNo) { if (this.detailList[i].itemNo === this.currentRow.itemNo) {
this.$refs.detailTable.setCurrentRow(this.detailList[i]) this.$refs.detailTable.setCurrentRow(this.detailList[i])
@ -1689,4 +1822,19 @@
height: auto; height: auto;
line-height: 1.5; line-height: 1.5;
} }
/* 右侧固定操作列盖住横向滚动过来的单元格,避免下拉框从操作列透出 */
.template-detail-table /deep/ .el-table__fixed-right,
.template-detail-table /deep/ .el-table__fixed-right-patch {
background-color: #fff;
z-index: 4;
}
.template-detail-table /deep/ .el-table__fixed-right td.detail-op-col {
background-color: #fff;
}
.template-detail-table /deep/ .el-table__fixed-right .el-table__body tr:hover > td.detail-op-col {
background-color: #f5f7fa;
}
.template-detail-table /deep/ .el-table__fixed-right .el-table__body tr.current-row > td.detail-op-col {
background-color: #ecf5ff;
}
</style> </style>
Loading…
Cancel
Save