diff --git a/src/views/modules/qc/qcTemplate.vue b/src/views/modules/qc/qcTemplate.vue index cb7d81e..591af77 100644 --- a/src/views/modules/qc/qcTemplate.vue +++ b/src/views/modules/qc/qcTemplate.vue @@ -178,7 +178,7 @@ - + @@ -195,6 +195,7 @@
+ + + + + + + + + + + + + + + + + + { this.detailList = data.rows + this.layoutDetailTable() }) 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 () { + 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 = { site: this.detailData.site, buNo: this.detailData.buNo, @@ -1498,6 +1628,7 @@ refreshDetailList () { templateDetailsSearch(this.detailData).then(({data}) => { this.detailList = data.rows + this.layoutDetailTable() }) }, @@ -1567,6 +1698,7 @@ if (data && data.code === 0) { templateDetailsSearch(this.detailData).then(({data}) => { this.detailList = data.rows + this.layoutDetailTable() for (let i = 0; i < this.detailList.length; i++) { if (this.detailList[i].itemNo === this.currentRow.itemNo) { this.$refs.detailTable.setCurrentRow(this.detailList[i]); @@ -1584,6 +1716,7 @@ if (data && data.code === 0) { templateDetailsSearch(this.detailData).then(({data}) => { this.detailList = data.rows + this.layoutDetailTable() for (let i = 0; i 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; +}