Browse Source

修改场车检验报告

master
xiaobai 3 years ago
parent
commit
fbca2cc0e5
  1. 132
      src/views/ysjl/5000/dj/jdgy-cl/index.vue
  2. 89
      src/views/ysjl/5000/dj/lygg-cl/index.vue

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

@ -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)
})
} else {
data.forEach(row => {
this.sybjSData.push({
id: row.id,
jianyanxiang: row.jianyanxiang,
jianyanneirong: row.jianyanneirong,
D1: row.D1
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 = '无此项'
}
this.tableJs.getData(this.cols, this.rows, this.sybjSData)
} 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) {
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,

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

@ -361,7 +361,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="×" />
@ -405,6 +405,7 @@ export default {
ysjlId: this.$route.query.id,
departmentId: '',
tree: [],
jybgData: [],
//
//
cols: [
@ -456,12 +457,12 @@ 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()
},
@ -535,6 +536,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()
@ -559,6 +561,7 @@ export default {
}
}).then(data => {
this.ysjl = data
this.getJyxm(1)
this.departmentId = this.ysjl.departmentId
if (this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan.length > 0) {
this.jianyanrenyuan = this.common.convertCnName(this.ysjl.jianyanrenyuan)
@ -579,14 +582,20 @@ export default {
this.param = data
})
},
//
getJyxm(sort) {
if (this.$route.query.state === 'update') {
this.jyxmService
.getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort)
.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 {
this.jyxmService
.getCyJyxm(this.$route.query.templateId, sort)
@ -597,18 +606,88 @@ export default {
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 {
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) {
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,

Loading…
Cancel
Save