Browse Source

Merge remote-tracking branch 'origin/master'

master
李磊 3 years ago
parent
commit
576d874c11
  1. 130
      src/views/ysjl/5000/dj/jdgy-cl/index.vue
  2. 89
      src/views/ysjl/5000/dj/lygg-cl/index.vue

130
src/views/ysjl/5000/dj/jdgy-cl/index.vue

@ -368,7 +368,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="jianyanjieguo" label="检验结果"> <el-table-column align="center" prop="jianyanjieguo" label="检验结果">
<template slot-scope="scope"> <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="○" /> <el-option label="○" value="○" />
<el-option label="×" value="×" /> <el-option label="×" value="×" />
@ -411,6 +411,7 @@ export default {
tableData: [], tableData: [],
checkedTab: 'first', checkedTab: 'first',
ysjlId: this.$route.query.id, ysjlId: this.$route.query.id,
jybgData: [],
// //
// //
cols: [ cols: [
@ -462,12 +463,11 @@ export default {
created() { created() {
if (this.state === 'create') { if (this.state === 'create') {
this.initYsjl() this.initYsjl()
this.getJyxm(1)
// //
this.getMaxBh() this.getMaxBh()
} else { } else {
this.getYsjl(this.$route.query.id) this.getYsjl(this.$route.query.id)
this.getJyxm(1)
} }
this.getDepartment() this.getDepartment()
}, },
@ -541,6 +541,7 @@ export default {
} }
}).then(data => { }).then(data => {
this.ysjl = data.ysjl this.ysjl = data.ysjl
this.getJyxm(1)
this.param = (data.param !== null && data.param !== undefined) ? data.param : {} this.param = (data.param !== null && data.param !== undefined) ? data.param : {}
this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd') this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd')
this.getXcjyrq() this.getXcjyrq()
@ -581,6 +582,7 @@ export default {
this.getMaxBh() this.getMaxBh()
} }
this.getParam(this.ysjl.id, this.ysjl.shebeizhongleidaima) this.getParam(this.ysjl.id, this.ysjl.shebeizhongleidaima)
this.getJyxm(1)
}) })
}, },
getParam(ysjlId, sbzldm) { getParam(ysjlId, sbzldm) {
@ -598,60 +600,110 @@ export default {
}, },
// //
getJyxm(sort) { getJyxm(sort) {
let url = '' if (this.$route.query.state === 'update') {
let data = {} this.jyxmService
if (this.state === 'create') { .getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort, 0)
url = '/jyxm/getCyJyxm' .then((data) => {
data = { this.sybjSData = data
templateId: this.$route.query.templateId, this.tableJs.getData(this.cols, this.rows, this.sybjSData)
order: sort })
} this.jyxmService
.getJdCyJyxm(this.ysjlId, this.ysjl.jybgTemplateId, sort, 1)
.then((data) => {
this.jybgData = data
})
} else { } else {
url = '/jyxm/getCyJyxmByYsjl' this.jyxmService
data = { .getCyJyxm(this.$route.query.templateId, sort)
ysjlId: this.ysjlId, .then((data) => {
isReport: false, data.forEach((row) => {
templateId: this.$route.query.templateId, row.dicJyxmId = row.id
order: sort })
} this.sybjSData = data
} this.tableJs.getData(this.cols, this.rows, this.sybjSData)
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.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 { } else {
data.forEach(row => { this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项'
this.sybjSData.push({ }
id: row.id, }
jianyanxiang: row.jianyanxiang, },
jianyanneirong: row.jianyanneirong, sortClass(sortData) {
D1: row.D1 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) { saveYsjl: function(operation) {
const _this = this
if (operation === 'add') { if (operation === 'add') {
if (this.jlbh3.trim() === '') { if (this.jlbh3.trim() === '') {
this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' }) this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' })
return false 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 = [] const tableData = []
this.sybjSData.forEach((row) => { arr.forEach((row) => {
tableData.push({ tableData.push({
ysjlId: this.ysjlId, ysjlId: this.ysjlId,
beizhu: row.beizhu, beizhu: row.beizhu,

89
src/views/ysjl/5000/dj/lygg-cl/index.vue

@ -361,7 +361,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="jianyanjieguo" label="检验结果"> <el-table-column align="center" prop="jianyanjieguo" label="检验结果">
<template slot-scope="scope"> <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="○" /> <el-option label="○" value="○" />
<el-option label="×" value="×" /> <el-option label="×" value="×" />
@ -405,6 +405,7 @@ export default {
ysjlId: this.$route.query.id, ysjlId: this.$route.query.id,
departmentId: '', departmentId: '',
tree: [], tree: [],
jybgData: [],
// //
// //
cols: [ cols: [
@ -456,12 +457,12 @@ export default {
created() { created() {
if (this.state === 'create') { if (this.state === 'create') {
this.initYsjl() this.initYsjl()
this.getJyxm(1)
// //
this.getMaxBh() this.getMaxBh()
} else { } else {
this.getYsjl(this.$route.query.id) this.getYsjl(this.$route.query.id)
this.getJyxm(1)
} }
this.getDepartment() this.getDepartment()
}, },
@ -535,6 +536,7 @@ export default {
} }
}).then(data => { }).then(data => {
this.ysjl = data.ysjl this.ysjl = data.ysjl
this.getJyxm(1)
this.param = (data.param !== null && data.param !== undefined) ? data.param : {} this.param = (data.param !== null && data.param !== undefined) ? data.param : {}
this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd') this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd')
this.getXcjyrq() this.getXcjyrq()
@ -559,6 +561,7 @@ export default {
} }
}).then(data => { }).then(data => {
this.ysjl = data this.ysjl = data
this.getJyxm(1)
this.departmentId = this.ysjl.departmentId this.departmentId = this.ysjl.departmentId
if (this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan.length > 0) { if (this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan.length > 0) {
this.jianyanrenyuan = this.common.convertCnName(this.ysjl.jianyanrenyuan) this.jianyanrenyuan = this.common.convertCnName(this.ysjl.jianyanrenyuan)
@ -579,14 +582,20 @@ export default {
this.param = data this.param = data
}) })
}, },
//
getJyxm(sort) { getJyxm(sort) {
if (this.$route.query.state === 'update') { if (this.$route.query.state === 'update') {
this.jyxmService this.jyxmService
.getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort) .getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort, 0)
.then((data) => { .then((data) => {
this.sybjSData = data this.sybjSData = data
this.tableJs.getData(this.cols, this.rows, this.sybjSData) 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 { } else {
this.jyxmService this.jyxmService
.getCyJyxm(this.$route.query.templateId, sort) .getCyJyxm(this.$route.query.templateId, sort)
@ -597,18 +606,88 @@ export default {
this.sybjSData = data this.sybjSData = data
this.tableJs.getData(this.cols, this.rows, this.sybjSData) 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 {
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]
})
} }
const sorted = groupBy(sortData, (item) => {
return item.jybgJyjlIndex //
})
return sorted
}, },
saveYsjl: function(operation) { saveYsjl: function(operation) {
const _this = this
if (operation === 'add') { if (operation === 'add') {
if (this.jlbh3.trim() === '') { if (this.jlbh3.trim() === '') {
this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' }) this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' })
return false 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 = [] const tableData = []
this.sybjSData.forEach((row) => { arr.forEach((row) => {
tableData.push({ tableData.push({
ysjlId: this.ysjlId, ysjlId: this.ysjlId,
beizhu: row.beizhu, beizhu: row.beizhu,

Loading…
Cancel
Save