|
|
@ -368,7 +368,7 @@ |
|
|
|
</el-table-column> |
|
|
|
<el-table-column align="center" prop="jianyanjieguo" label="检验结果"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="scope.row.jianyanjieguo" :disabled="edit" type="text" placeholder="请选择" style="width: 100%;" filterable allow-create default-first-option> |
|
|
|
<el-select v-model="scope.row.jianyanjieguo" :disabled="edit" type="text" placeholder="请选择" style="width: 100%;" filterable allow-create default-first-option @change="v=>changeFn(v,scope.row)"> |
|
|
|
<el-option label="√" value="√" /> |
|
|
|
<el-option label="○" value="○" /> |
|
|
|
<el-option label="×" value="×" /> |
|
|
@ -411,6 +411,7 @@ export default { |
|
|
|
tableData: [], |
|
|
|
checkedTab: 'first', |
|
|
|
ysjlId: this.$route.query.id, |
|
|
|
jybgData: [], |
|
|
|
// 表格合并相关 |
|
|
|
// 参与列合并的字段,在这里增加即可 |
|
|
|
cols: [ |
|
|
@ -462,12 +463,11 @@ export default { |
|
|
|
created() { |
|
|
|
if (this.state === 'create') { |
|
|
|
this.initYsjl() |
|
|
|
this.getJyxm(1) |
|
|
|
|
|
|
|
// 查询最大记录编号 |
|
|
|
this.getMaxBh() |
|
|
|
} else { |
|
|
|
this.getYsjl(this.$route.query.id) |
|
|
|
this.getJyxm(1) |
|
|
|
} |
|
|
|
this.getDepartment() |
|
|
|
}, |
|
|
@ -541,6 +541,7 @@ export default { |
|
|
|
} |
|
|
|
}).then(data => { |
|
|
|
this.ysjl = data.ysjl |
|
|
|
this.getJyxm(1) |
|
|
|
this.param = (data.param !== null && data.param !== undefined) ? data.param : {} |
|
|
|
this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd') |
|
|
|
this.getXcjyrq() |
|
|
@ -581,6 +582,7 @@ export default { |
|
|
|
this.getMaxBh() |
|
|
|
} |
|
|
|
this.getParam(this.ysjl.id, this.ysjl.shebeizhongleidaima) |
|
|
|
this.getJyxm(1) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getParam(ysjlId, sbzldm) { |
|
|
@ -598,60 +600,110 @@ export default { |
|
|
|
}, |
|
|
|
// 查询检验项目 |
|
|
|
getJyxm(sort) { |
|
|
|
let url = '' |
|
|
|
let data = {} |
|
|
|
if (this.state === 'create') { |
|
|
|
url = '/jyxm/getCyJyxm' |
|
|
|
data = { |
|
|
|
templateId: this.$route.query.templateId, |
|
|
|
order: sort |
|
|
|
} |
|
|
|
if (this.$route.query.state === 'update') { |
|
|
|
this.jyxmService |
|
|
|
.getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort, 0) |
|
|
|
.then((data) => { |
|
|
|
this.sybjSData = data |
|
|
|
this.tableJs.getData(this.cols, this.rows, this.sybjSData) |
|
|
|
}) |
|
|
|
this.jyxmService |
|
|
|
.getJdCyJyxm(this.ysjlId, this.ysjl.jybgTemplateId, sort, 1) |
|
|
|
.then((data) => { |
|
|
|
this.jybgData = data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
url = '/jyxm/getCyJyxmByYsjl' |
|
|
|
data = { |
|
|
|
ysjlId: this.ysjlId, |
|
|
|
isReport: false, |
|
|
|
templateId: this.$route.query.templateId, |
|
|
|
order: sort |
|
|
|
} |
|
|
|
} |
|
|
|
this.api({ |
|
|
|
url: url, |
|
|
|
method: 'get', |
|
|
|
params: data |
|
|
|
}).then(data => { |
|
|
|
if (this.state === 'create') { |
|
|
|
data.forEach(row => { |
|
|
|
this.sybjSData.push({ |
|
|
|
id: row.id, |
|
|
|
jianyanxiang: row.jianyanxiang, |
|
|
|
jianyanneirong: row.jianyanneirong, |
|
|
|
D1: row.jianyanjieguo |
|
|
|
this.jyxmService |
|
|
|
.getCyJyxm(this.$route.query.templateId, sort) |
|
|
|
.then((data) => { |
|
|
|
data.forEach((row) => { |
|
|
|
row.dicJyxmId = row.id |
|
|
|
}) |
|
|
|
this.sybjSData = data |
|
|
|
this.tableJs.getData(this.cols, this.rows, this.sybjSData) |
|
|
|
}) |
|
|
|
this.jyxmService |
|
|
|
.getCyJyxm(this.ysjl.jybgTemplateId, sort) |
|
|
|
.then((data) => { |
|
|
|
data.forEach((row) => { |
|
|
|
row.dicJyxmId = row.id |
|
|
|
}) |
|
|
|
this.jybgData = data |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
changeFn(val, row) { |
|
|
|
console.log(row, val) |
|
|
|
if (row.xiangmuleibie === 'A' || row.xiangmuleibie === 'B') { |
|
|
|
if (val === 'X') { |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '不符合' |
|
|
|
} else if (val === '√') { |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '符合' |
|
|
|
} else { |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项' |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (val === 'X') { |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认不符合' |
|
|
|
} else if (val === '√') { |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认符合' |
|
|
|
} else { |
|
|
|
data.forEach(row => { |
|
|
|
this.sybjSData.push({ |
|
|
|
id: row.id, |
|
|
|
jianyanxiang: row.jianyanxiang, |
|
|
|
jianyanneirong: row.jianyanneirong, |
|
|
|
D1: row.D1 |
|
|
|
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
sortClass(sortData) { |
|
|
|
const groupBy = (array, f) => { |
|
|
|
const groups = {} |
|
|
|
array.forEach((o) => { |
|
|
|
const group = JSON.stringify(f(o)) |
|
|
|
groups[group] = groups[group] || [] |
|
|
|
groups[group].push(o) |
|
|
|
}) |
|
|
|
return Object.keys(groups).map((group) => { |
|
|
|
return groups[group] |
|
|
|
}) |
|
|
|
} |
|
|
|
this.tableJs.getData(this.cols, this.rows, this.sybjSData) |
|
|
|
const sorted = groupBy(sortData, (item) => { |
|
|
|
return item.jybgJyjlIndex // 返回需要分组的对象 |
|
|
|
}) |
|
|
|
return sorted |
|
|
|
}, |
|
|
|
saveYsjl: function(operation) { |
|
|
|
const _this = this |
|
|
|
if (operation === 'add') { |
|
|
|
if (this.jlbh3.trim() === '') { |
|
|
|
this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' }) |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
let arr = [] |
|
|
|
const subArr = this.sortClass(this.jybgData) |
|
|
|
subArr.map((item) => { |
|
|
|
if ( |
|
|
|
item.some( |
|
|
|
(k) => k.jianyanjieguo === '不符合' || k.jianyanjieguo === 'X' |
|
|
|
) |
|
|
|
) { |
|
|
|
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格' |
|
|
|
} else if ( |
|
|
|
item.every( |
|
|
|
(k) => k.jianyanjieguo === '符合' || k.jianyanjieguo === '√' |
|
|
|
) |
|
|
|
) { |
|
|
|
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格' |
|
|
|
} else if ( |
|
|
|
item.every( |
|
|
|
(k) => k.jianyanjieguo === '无此项' || k.jianyanjieguo === '/' |
|
|
|
) |
|
|
|
) { |
|
|
|
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项' |
|
|
|
} |
|
|
|
}) |
|
|
|
arr = arr.concat(this.sybjSData, this.jybgData) |
|
|
|
// 把第一个检验项目表中的检验结果单独放到字段中 |
|
|
|
const tableData = [] |
|
|
|
this.sybjSData.forEach((row) => { |
|
|
|
arr.forEach((row) => { |
|
|
|
tableData.push({ |
|
|
|
ysjlId: this.ysjlId, |
|
|
|
beizhu: row.beizhu, |
|
|
|