From 284640e6a6e0abe2e3c66c7d6c63a73521a0d703 Mon Sep 17 00:00:00 2001 From: xiaobai <857694115@qq.com> Date: Thu, 26 Aug 2021 11:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jyxm.js | 5 +- src/components/drawerDialog/index.vue | 32 ++++++++++ src/service/jyxmService.js | 4 +- src/views/ysjl/3000/common/index.vue | 60 +++++++++++++++++-- .../ysjl/3000/common/inspection-items.vue | 27 +++++++++ src/views/ysjl/5000/dj/jdgy-cl/index.vue | 8 +-- src/views/ysjl/5000/dj/lygg-cl/index.vue | 2 +- 7 files changed, 124 insertions(+), 14 deletions(-) diff --git a/src/api/jyxm.js b/src/api/jyxm.js index 423c55e..c0b2eb9 100644 --- a/src/api/jyxm.js +++ b/src/api/jyxm.js @@ -11,14 +11,15 @@ export default { } }) }, - getJdCyJyxm: (ysjlId, templateId, orders) => { + getJdCyJyxm: (ysjlId, templateId, orders, cjState) => { return api({ url: '/jyxm/getJdJyxmByYsjl', method: 'get', params: { ysjlId: ysjlId, templateId: templateId, - orders: orders + orders: orders, + cjState } }) }, diff --git a/src/components/drawerDialog/index.vue b/src/components/drawerDialog/index.vue index a55b733..00236bc 100644 --- a/src/components/drawerDialog/index.vue +++ b/src/components/drawerDialog/index.vue @@ -188,6 +188,38 @@ /> + + + + + + + + + + diff --git a/src/service/jyxmService.js b/src/service/jyxmService.js index 2b2fe2d..b97c78e 100644 --- a/src/service/jyxmService.js +++ b/src/service/jyxmService.js @@ -28,8 +28,8 @@ export default { getCyJyxm(modelId, sort) { return jyxm.getCyJyxm(modelId, sort) }, - getJdCyJyxm(ysjlId, templateId, orders) { - return jyxm.getJdCyJyxm(ysjlId, templateId, orders) + getJdCyJyxm(ysjlId, templateId, orders, cjState) { + return jyxm.getJdCyJyxm(ysjlId, templateId, orders, cjState) }, /** * 找到检验项或者检验目开始的第一条数据,并进行签名 diff --git a/src/views/ysjl/3000/common/index.vue b/src/views/ysjl/3000/common/index.vue index fee7dda..f44b7f8 100644 --- a/src/views/ysjl/3000/common/index.vue +++ b/src/views/ysjl/3000/common/index.vue @@ -693,7 +693,7 @@ - + @@ -790,6 +790,7 @@ export default { defaultRlr: [], renlingren: [], xinghaoList: [], + jybgData: [], cols: [ { name: 'jianyanxiang', // 参与计算的列名,必须和el-table-column prop=''值一致 @@ -828,7 +829,8 @@ export default { fubiao1: [], fubiao2: [], fubiao3: [], - tree: [] + tree: [], + jybgTemplateId: '' } }, created() { @@ -858,7 +860,7 @@ export default { this.getJyxmInfoByYsjl() } this.getDepartment() - this.getDicJyxm(1) + // this.getDicJyxm(1) this.userList = this.$store.getters.allUser.filter( (user) => user.departmentId === 74 && user.clientType === 'System' ) @@ -883,6 +885,8 @@ export default { this.departmentId = this.ysjl.departmentId this.getJyxm(1) this.getSbList() + this.jybgTemplateId = this.ysjl.jybgTemplateId + console.log(this.ysjl.jybgTemplateId) }) }, getSbList() { @@ -923,6 +927,7 @@ export default { this.ysjlService.getYsjl(this.ysjlId).then((data) => { this.ysjl = data this.departmentId = this.ysjl.departmentId + this.jybgTemplateId = this.ysjl.jybgTemplateId this.ysjl.imagePath = '' if ( this.ysjl.jianyanrenyuan !== null && @@ -962,13 +967,19 @@ export default { }) }, getJyxm(sort) { + console.log(this.jybgTemplateId, this.ysjl.jybgTemplateId) 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.bgfyData = data this.tableJs.getData(this.cols, this.rows, this.bgfyData) }) + this.jyxmService + .getJdCyJyxm(this.ysjlId, this.ysjl.jybgTemplateId, sort, 1) + .then((data) => { + this.jybgData = data + }) } else { this.jyxmService .getCyJyxm(this.$route.query.templateId, sort) @@ -979,6 +990,14 @@ export default { this.bgfyData = data this.tableJs.getData(this.cols, this.rows, this.bgfyData) }) + this.jyxmService + .getCyJyxm(this.ysjl.jybgTemplateId, sort) + .then((data) => { + data.forEach((row) => { + row.dicJyxmId = row.id + }) + this.jybgData = data + }) } }, /** @@ -1040,8 +1059,26 @@ export default { this.buildSaveData(operation) } }, + 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 + }, buildSaveData(operation) { const tableData = [] + const _this = this let fubiao if (this.fromType === 5 || this.fromType === 6) { console.log(this.$refs.table4.tableData, 5555) @@ -1049,7 +1086,19 @@ export default { } else { fubiao = [this.fubiao1, this.fubiao2, this.fubiao3] } - this.bgfyData.forEach((row) => { + 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.bgfyData, this.jybgData) + arr.forEach((row) => { tableData.push({ ysjlId: this.ysjlId, beizhu: row.beizhu, @@ -1101,6 +1150,7 @@ export default { } }, save(operation, type, jyxm, fubiao) { + console.log(this.jybgData, 2222) if (this.fromType !== 5 && this.fromType !== 6) this.ysjl.imagePath = this.$refs.table1.imgPath // 判断报告编号是否重复 diff --git a/src/views/ysjl/3000/common/inspection-items.vue b/src/views/ysjl/3000/common/inspection-items.vue index d059ae6..ab3bc64 100644 --- a/src/views/ysjl/3000/common/inspection-items.vue +++ b/src/views/ysjl/3000/common/inspection-items.vue @@ -37,6 +37,7 @@