diff --git a/src/views/ysjl/5000/dj/jdgy-cl/index.vue b/src/views/ysjl/5000/dj/jdgy-cl/index.vue
index c809041..49a2e19 100644
--- a/src/views/ysjl/5000/dj/jdgy-cl/index.vue
+++ b/src/views/ysjl/5000/dj/jdgy-cl/index.vue
@@ -368,7 +368,7 @@
-
+ changeFn(v,scope.row)">
@@ -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,
diff --git a/src/views/ysjl/5000/dj/lygg-cl/index.vue b/src/views/ysjl/5000/dj/lygg-cl/index.vue
index 29b9511..ca24aad 100644
--- a/src/views/ysjl/5000/dj/lygg-cl/index.vue
+++ b/src/views/ysjl/5000/dj/lygg-cl/index.vue
@@ -361,7 +361,7 @@
-
+ changeFn(v,scope.row)">
@@ -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,