diff --git a/src/utils/common.js b/src/utils/common.js index f01b0a2..7106a25 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -30,10 +30,10 @@ export default { }) }, /** - * 预览原始资料 - * 如果给的是路径就直接预览,如果给的是任务ID,就先查询路径再预览 - * @param id 任务ID - */ + * 预览原始资料 + * 如果给的是路径就直接预览,如果给的是任务ID,就先查询路径再预览 + * @param id 任务ID + */ viewRawRecords(id) { preview({ url: '/download/pullRawRecordsPath', @@ -53,9 +53,9 @@ export default { }) }, /** - * 预览相关鉴证文件 - * @param id 文件主键 - */ + * 预览相关鉴证文件 + * @param id 文件主键 + */ viewProve(id) { preview.defaults.withCredentials = true preview({ @@ -73,10 +73,10 @@ export default { }) }, /** - * 预览驳回附件 - * @param id 驳回记录主键 - * @param fileName 驳回附件名称 - */ + * 预览驳回附件 + * @param id 驳回记录主键 + * @param fileName 驳回附件名称 + */ viewReject(id, fileName) { if (id && fileName && fileName !== '') { const suffixName = fileName.substring(fileName.indexOf('.')) @@ -151,11 +151,12 @@ export default { console.info('重新生成成功') }) }, + /** - * 检验员签名方法 - * @param {*} id : 原始记录/报告主键 - * @param {*} jyry :检验人员 - */ + * 检验员签名方法 + * @param {*} id : 原始记录/报告主键 + * @param {*} jyry :检验人员 + */ signName(id, jyry) { if (!id) { return @@ -189,15 +190,15 @@ export default { return chineseName }, /** - * 删除检验方案 - * @param jyxm 检验项目简写。例如:bhcd - * @param jianyanxiangmu 检验项目。例如:壁厚测定 - * @param bglx 报告类型。例如:[2, 3] - * @param ysjlId 无损或分项的原始记录Id - * @param mainYsjlId 主原始记录Id - * @param sblbdm 设备类别代码。例如:2100 - * @param nblb 内部类别。例如:DQ - */ + * 删除检验方案 + * @param jyxm 检验项目简写。例如:bhcd + * @param jianyanxiangmu 检验项目。例如:壁厚测定 + * @param bglx 报告类型。例如:[2, 3] + * @param ysjlId 无损或分项的原始记录Id + * @param mainYsjlId 主原始记录Id + * @param sblbdm 设备类别代码。例如:2100 + * @param nblb 内部类别。例如:DQ + */ delJyfa(jyxm, jianyanxiangmu, bglx, ysjlId, mainYsjlId, sblbdm, nblb) { api({ url: '/ysjl/delJyfa', @@ -216,13 +217,12 @@ export default { message: '删除成功', type: 'success' }) - }).catch(e => { - }) + }).catch(e => {}) }, /** - * 下载导入模板 - * @param templateName 例如:模板名字.xlsx - */ + * 下载导入模板 + * @param templateName 例如:模板名字.xlsx + */ downloadTemplate(templateName) { if (!templateName) { Vue.prototype.$message({ @@ -242,12 +242,12 @@ export default { }) }, /** - * 上传数据 - * @param file 上传的文件信息 - * @param tableData 上传前的数据 - * @returns {boolean} - * @constructor - */ + * 上传数据 + * @param file 上传的文件信息 + * @param tableData 上传前的数据 + * @returns {boolean} + * @constructor + */ uploadTableData(file, tableData) { const isExcel = file.type === 'application/vnd.ms-excel' || file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' const isExcel2 = file.name.endsWith('.xls') || file.name.endsWith('.xlsx') @@ -280,10 +280,10 @@ export default { }) }, /** - * 深拷贝 - * @param o - * @returns {Array|*} - */ + * 深拷贝 + * @param o + * @returns {Array|*} + */ deepCopy(o) { if (o instanceof Array) { var n = [] @@ -302,9 +302,9 @@ export default { } }, /** - * 根据报告ID查看驳回原因 - * @param ysjlId - */ + * 根据报告ID查看驳回原因 + * @param ysjlId + */ viewRejection(ysjlId) { api({ url: '/taskinfo/viewRejection', @@ -323,9 +323,9 @@ export default { }) }, /** - * 下载无损分项附件 - * @param renwuId - */ + * 下载无损分项附件 + * @param renwuId + */ downloadWsFxFile(renwuId) { preview({ url: '/download/pullWsFxFilePath', @@ -340,8 +340,8 @@ export default { }) }, /** - * 判断日期格式是否为yyyy-MM-dd - * */ + * 判断日期格式是否为yyyy-MM-dd + * */ checkDateFormat(checkDate) { if (checkDate !== null) { checkDate = checkDate.replace(/\s+/g, '').replace('00:00:00', '').replace('年', '-').replace('月', '-').replace('日', '') @@ -353,8 +353,8 @@ export default { return checkDate }, /** - * 删除当前路由 - */ + * 删除当前路由 + */ delCurrentViews() { store.dispatch('delCurrentViews', { view: router.history.current, @@ -362,11 +362,11 @@ export default { }) }, /** - * 构建编辑原始记录页面路由参数 - * @param ysjl - * @param obj 需要将特殊参数补充到路由的参数里面 - * @returns {{modelId: null, departmentId: *, renwuId: null, sbzldm, sbpzdm, jyxm: null, jylb: *, sblbdm, id: null, state: null, neibuleibie, jianyanrenyuan: null}} - */ + * 构建编辑原始记录页面路由参数 + * @param ysjl + * @param obj 需要将特殊参数补充到路由的参数里面 + * @returns {{modelId: null, departmentId: *, renwuId: null, sbzldm, sbpzdm, jyxm: null, jylb: *, sblbdm, id: null, state: null, neibuleibie, jianyanrenyuan: null}} + */ buildEditYsjlRouterParam(ysjl, obj) { const routerParam = { id: ysjl.id, @@ -390,29 +390,29 @@ export default { return routerParam }, /** - * 重新加载页面到更新报检单页面 - * @param bjd - */ + * 重新加载页面到更新报检单页面 + * @param bjd + */ reloadViewToUpdateBjd(bjd) { this.delCurrentViews() router.push({ path: '/bjd/bjd-' + bjd.jianyanleibie.toLowerCase() + '-input/' + bjd.id + '/' + bjd.shebeizhongleidaima + '/update' }) }, /** - * 重新加载页面到更新原始记录页面 - * @param ysjl - * @param obj 需要将特殊参数补充到路由的参数里面 - */ + * 重新加载页面到更新原始记录页面 + * @param ysjl + * @param obj 需要将特殊参数补充到路由的参数里面 + */ reloadViewToUpdateYsjl(ysjl, obj) { const path = router.history.current.path.replace('/null', '/' + ysjl.id) this.delCurrentViews() router.push({ path: path, query: this.buildEditYsjlRouterParam(ysjl, obj) }) }, /** - * 记录、报告编号判重 - * @param bianhao - * @param id - * @returns {Promise} - */ + * 记录、报告编号判重 + * @param bianhao + * @param id + * @returns {Promise} + */ judgeRepeat(bianhao, id) { return new Promise(resolve => { api({ @@ -443,11 +443,11 @@ export default { }) }, /** - * 根据原始记录id查询参数 - * @param ysjlId - * @param sbzldm - * @returns {AxiosPromise} - */ + * 根据原始记录id查询参数 + * @param ysjlId + * @param sbzldm + * @returns {AxiosPromise} + */ getParam(ysjlId, sbzldm) { return api({ url: '/ysjl/getParamByYsjlId', @@ -459,12 +459,12 @@ export default { }) }, /** - * 获取检验项目 - * @param modelId 模板主键(起草时使用) - * @param ysjlId 原始记录主键(更新时使用) - * @param sort 序号 - * @returns {AxiosPromise} - */ + * 获取检验项目 + * @param modelId 模板主键(起草时使用) + * @param ysjlId 原始记录主键(更新时使用) + * @param sort 序号 + * @returns {AxiosPromise} + */ getJyxm(modelId, ysjlId, sort, state) { let url = '' let data = {} @@ -489,22 +489,22 @@ export default { }) }, /** - * 精确乘法 - * @param arg1 乘数 - * @param arg2 被乘数 - * @param decimalPlaces 保留的小数位数 - * @returns {number} - */ + * 精确乘法 + * @param arg1 乘数 + * @param arg2 被乘数 + * @param decimalPlaces 保留的小数位数 + * @returns {number} + */ accMul(arg1, arg2, decimalPlaces = 2) { const percentage = Math.pow(10, decimalPlaces) return Math.round(arg1 * arg2 * percentage) / percentage }, /** - * 精确加法 - * @param arg1 - * @param arg2 - * @returns {number} - */ + * 精确加法 + * @param arg1 + * @param arg2 + * @returns {number} + */ accAdd(arg1, arg2) { let r1, r2, m, c try { @@ -537,10 +537,10 @@ export default { return (arg1 + arg2) / m }, /** - * 删除数组中指定元素 - * @param arr 数据 - * @param val 元素 - */ + * 删除数组中指定元素 + * @param arr 数据 + * @param val 元素 + */ deleteElement(arr, val) { for (var i = 0; i < arr.length; i++) { if (arr[i] === val) { @@ -551,10 +551,10 @@ export default { return arr }, /** - * 修复由于Vue的$on可能会多次绑定,导致多次调用$on的回调方法 - * @param event - * @param callback - */ + * 修复由于Vue的$on可能会多次绑定,导致多次调用$on的回调方法 + * @param event + * @param callback + */ $on(event, callback) { Utils.$off(event) Utils.$on(event, callback) diff --git a/src/views/dic/category.vue b/src/views/dic/category.vue index bb088df..c2b702b 100644 --- a/src/views/dic/category.vue +++ b/src/views/dic/category.vue @@ -74,8 +74,8 @@ width="80" /> @@ -106,6 +106,15 @@
字典详情
+ + 删除 + import Pagination from '@/components/Pagination' +import qs from 'qs' export default { name: 'Category', components: { Pagination }, @@ -251,7 +260,8 @@ export default { sbzlList: [], species: [], parentList: [], - leftList: [] + leftList: [], + detailSeletArr: [] } }, created() { @@ -284,6 +294,9 @@ export default { handleSelectionChange: function(val) { this.multipleSelection = val }, + detailHandleSelectionChange(val) { + this.detailSeletArr = val + }, showCreate() { this.tempCategory = {} this.dialogStatus = 'create' @@ -292,9 +305,9 @@ export default { createCategory() { this.$refs['tempCategory'].validate((valid) => { if (valid) { - this.tempCategory.species = JSON.stringify(this.species) + this.tempCategory.species = this.species.join(',') this.api({ - url: '/category/addCategory', + url: '/category', method: 'post', data: this.tempCategory }).then(() => { @@ -404,8 +417,25 @@ export default { closeDialog() { this.species = [] }, + deleteCategoryDetail() { + if (this.detailSeletArr.length === 0) { + return this.$message.warning('请选择数据') + } + this.api({ + url: '/category/delete', + method: 'delete', + params: { + integers: this.detailSeletArr.map(item => item.id) + }, + paramsSerializer: function(params) { + return qs.stringify(params, { indices: false }) + } + }).then(res => { + this.$message({ message: '成功删除', type: 'success' }) + }) + }, formatSpecies(row, column, cellValue) { - const value = JSON.parse(cellValue) + const value = cellValue.split(',') let lable = '' for (let i = 0; i < value.length; i++) { for (let j = 0; j < this.sbzlList.length; j++) { diff --git a/src/views/document/index.vue b/src/views/document/index.vue index 57baa4a..2370c67 100644 --- a/src/views/document/index.vue +++ b/src/views/document/index.vue @@ -86,6 +86,7 @@ import Pagination from '@/components/Crud/Pagination' import CrudDocumentArchives from '@/api/document_archives' import { uploadFileFn, updateInspectionSystemFile } from '@/api/common' import { downloadFileUrl } from '@/utils' +import download from 'downloadjs' import preview from '@/utils/preview' // crud交由presenter持有 @@ -194,13 +195,17 @@ export default { return false }, downLoad(item) { - window.open(this.url + '/' + item.id + item.suffix) + const data = this.url + '/' + item.id + item.suffix + this.$router.push({ + path: '/preview/document?src=' + this.$store.getters.prodName + '/static/web/viewer.html?file=' + encodeURIComponent(data) + }) }, viewHistoryFile(item) { downloadFileUrl(this.url + '/' + item.inspectionSystemFileId + '_' + item.id + item.suffix, item.filename, item.suffix) }, downLoadFn(item) { - downloadFileUrl(this.url + '/' + item.id + item.suffix, item.filename, item.suffix) + const data = this.url + '/' + item.id + item.suffix + download(data, item.filename) }, beforeRemove(file, fileList) { return this.$confirm(`确定移除 ${file.name}?`) diff --git a/src/views/preview/document.vue b/src/views/preview/document.vue new file mode 100644 index 0000000..fda25ef --- /dev/null +++ b/src/views/preview/document.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/views/ysjl/4000/dj/common/index.vue b/src/views/ysjl/4000/dj/common/index.vue index a3f3208..aea5212 100644 --- a/src/views/ysjl/4000/dj/common/index.vue +++ b/src/views/ysjl/4000/dj/common/index.vue @@ -822,22 +822,13 @@ @@ -880,6 +871,7 @@ export default { sybjSData: [], tableData: [], tree: [], + jybgData: [], // 检验报告数组 checkedTab: 'first', ysjlId: this.$route.query.id, // 表格合并相关 @@ -906,7 +898,8 @@ export default { return row.jianyanneirong } } - ] + ], + jyjgList: [{ value: '√' }, { value: 'X' }, { value: '/' }] } }, computed: {}, @@ -926,12 +919,10 @@ 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() }, @@ -1008,6 +999,7 @@ export default { } }).then((data) => { this.ysjl = data.ysjl + this.getJyxm(1) this.departmentId = this.ysjl.departmentId this.param = data.param !== null && data.param !== undefined ? data.param : {} @@ -1027,6 +1019,29 @@ export default { // this.param.shangcijianyanriqi = this.common.checkDateFormat(this.param.shangcijianyanriqi) }) }, + querySearchJyjg: function(queryString, cb, $index) { + cb(this.jyjgList) + }, + changeFn(val, row) { + const jybgJyjgJyxm = this.jybgData[row.jybgJyjgIndex - 1] + let beizhu = '' + if (val.length > 1) { + beizhu = val.substr(1) + } + if (val.indexOf('X') === 0) { + jybgJyjgJyxm.jianyanjieguo = '不符合' + beizhu + } else if (val.indexOf('√') === 0) { + let jyjg = '符合' + if (row.xiangmuleibie === 'C') { + jyjg = '资料确认符合' + } + jybgJyjgJyxm.jianyanjieguo = jyjg + beizhu + } else if (val.indexOf('/') === 0) { + jybgJyjgJyxm.jianyanjieguo = '无此项' + beizhu + } else { + jybgJyjgJyxm.jianyanjieguo = '' + } + }, getYsjl(id) { this.api({ url: '/ysjl', @@ -1036,6 +1051,7 @@ export default { } }).then((data) => { this.ysjl = data + this.getJyxm(1) this.departmentId = this.ysjl.departmentId if ( this.ysjl.jianyanrenyuan !== null && @@ -1072,10 +1088,15 @@ export default { 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, undefined, 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 { this.jyxmService @@ -1084,12 +1105,36 @@ export default { data.forEach((row) => { row.dicJyxmId = row.id }) - this.sybjSData = data - this.tableJs.getData(this.cols, undefined, 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 }) } }, + 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) { if (operation === 'add') { if (this.jlbh3.trim() === '') { @@ -1100,6 +1145,16 @@ export default { return false } } + const subArr = this.sortClass(this.sybjSData) + subArr.forEach((item) => { + if (item.some((k) => k.jianyanjieguo.indexOf('X') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('√') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('/') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项' + } + }) // 把第一个检验项目表中的检验结果单独放到字段中 const tableData = [] this.sybjSData.forEach((row) => { @@ -1116,6 +1171,19 @@ export default { cjState: 0 }) }) + this.jybgData.forEach((row) => { + tableData.push({ + ysjlId: this.ysjlId, + beizhu: row.beizhu, + dicJyxmId: row.dicJyxmId, + jianyanjieguo: row.jianyanjieguo || '', + jianyanjielun: row.jianyanjielun || '', + jyxmMode: 0, + sort: row.sort, + orders: row.orders, + cjState: 1 + }) + }) let method = '' this.ysjl.bglx = 1 this.ysjl.cjState = 'ysjl' @@ -1167,7 +1235,8 @@ export default { ysjl: this.ysjl, param: this.param, cyJyxm: {}, - jdJyxm: jyxm + jdJyxm: jyxm, + state: operation } }).then((data) => { Utils.$emit('task-list') diff --git a/src/views/ysjl/4000/jj/common/index.vue b/src/views/ysjl/4000/jj/common/index.vue index ecdb890..5debc7c 100644 --- a/src/views/ysjl/4000/jj/common/index.vue +++ b/src/views/ysjl/4000/jj/common/index.vue @@ -901,21 +901,13 @@
@@ -991,7 +983,9 @@ export default { return row.jianyanneirong } } - ] + ], + jyjgList: [{ value: '√' }, { value: 'X' }, { value: '/' }], + jybgData: []// 检验报告数组 } }, computed: {}, @@ -1011,12 +1005,10 @@ 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() }, @@ -1094,6 +1086,7 @@ export default { }).then((data) => { this.ysjl = data.ysjl this.departmentId = this.ysjl.departmentId + this.getJyxm(1) this.param = data.param !== null && data.param !== undefined ? data.param : {} this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd') @@ -1129,6 +1122,7 @@ export default { }).then((data) => { this.ysjl = data this.departmentId = this.ysjl.departmentId + this.getJyxm(1) if ( this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan.length > 0 @@ -1165,10 +1159,15 @@ export default { 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, undefined, 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 { this.jyxmService @@ -1177,12 +1176,59 @@ export default { data.forEach((row) => { row.dicJyxmId = row.id }) - this.sybjSData = data - this.tableJs.getData(this.cols, undefined, 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 + }) + } + }, + querySearchJyjg: function(queryString, cb, $index) { + cb(this.jyjgList) + }, + changeFn(val, row) { + const jybgJyjgJyxm = this.jybgData[row.jybgJyjgIndex - 1] + let beizhu = '' + if (val.length > 1) { + beizhu = val.substr(1) + } + if (val.indexOf('X') === 0) { + jybgJyjgJyxm.jianyanjieguo = '不符合' + beizhu + } else if (val.indexOf('√') === 0) { + let jyjg = '符合' + if (row.xiangmuleibie === 'C') { + jyjg = '资料确认符合' + } + jybgJyjgJyxm.jianyanjieguo = jyjg + beizhu + } else if (val.indexOf('/') === 0) { + jybgJyjgJyxm.jianyanjieguo = '无此项' + beizhu + } else { + jybgJyjgJyxm.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) { if (operation === 'add') { if (this.jlbh3.trim() === '') { @@ -1193,6 +1239,16 @@ export default { return false } } + const subArr = this.sortClass(this.sybjSData) + subArr.forEach((item) => { + if (item.some((k) => k.jianyanjieguo.indexOf('X') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('√') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('/') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项' + } + }) // 把第一个检验项目表中的检验结果单独放到字段中 const tableData = [] this.sybjSData.forEach((row) => { @@ -1208,6 +1264,19 @@ export default { cjState: 0 }) }) + this.jybgData.forEach((row) => { + tableData.push({ + ysjlId: this.ysjlId, + beizhu: row.beizhu, + dicJyxmId: row.dicJyxmId, + jianyanjieguo: row.jianyanjieguo || '', + jianyanjielun: row.jianyanjielun || '', + jyxmMode: 0, + sort: row.sort, + orders: row.orders, + cjState: 1 + }) + }) let method = '' this.ysjl.bglx = 1 this.ysjl.cjState = 'ysjl' @@ -1259,7 +1328,8 @@ export default { ysjl: this.ysjl, param: this.param, cyJyxm: {}, - jdJyxm: jyxm + jdJyxm: jyxm, + state: operation } }).then((data) => { Utils.$emit('task-list') diff --git a/src/views/ysjl/5000/dj/jdgy-cl/index.vue b/src/views/ysjl/5000/dj/jdgy-cl/index.vue index 49a2e19..5df5153 100644 --- a/src/views/ysjl/5000/dj/jdgy-cl/index.vue +++ b/src/views/ysjl/5000/dj/jdgy-cl/index.vue @@ -368,12 +368,13 @@ @@ -411,7 +412,7 @@ export default { tableData: [], checkedTab: 'first', ysjlId: this.$route.query.id, - jybgData: [], + jybgData: [], // 检验报告数组 // 表格合并相关 // 参与列合并的字段,在这里增加即可 cols: [ @@ -441,7 +442,8 @@ export default { return row.jianyanneirong } } - ] + ], + jyjgList: [{ value: '√' }, { value: 'X' }, { value: '/' }] } }, computed: { @@ -632,24 +634,27 @@ export default { }) } }, + querySearchJyjg: function(queryString, cb, $index) { + cb(this.jyjgList) + }, 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 = '无此项' + const jybgJyjgJyxm = this.jybgData[row.jybgJyjgIndex - 1] + let beizhu = '' + if (val.length > 1) { + beizhu = val.substr(1) + } + if (val.indexOf('X') === 0) { + jybgJyjgJyxm.jianyanjieguo = '不符合' + beizhu + } else if (val.indexOf('√') === 0) { + let jyjg = '符合' + if (row.xiangmuleibie === 'C') { + jyjg = '资料确认符合' } + jybgJyjgJyxm.jianyanjieguo = jyjg + beizhu + } else if (val.indexOf('/') === 0) { + jybgJyjgJyxm.jianyanjieguo = '无此项' + beizhu } else { - if (val === 'X') { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认不符合' - } else if (val === '√') { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认符合' - } else { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项' - } + jybgJyjgJyxm.jianyanjieguo = '' } }, sortClass(sortData) { @@ -670,40 +675,25 @@ export default { 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 = '无此项' + const subArr = this.sortClass(this.sybjSData) + subArr.forEach((item) => { + if (item.some((k) => k.jianyanjieguo.indexOf('X') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('√') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('/') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项' } }) - arr = arr.concat(this.sybjSData, this.jybgData) // 把第一个检验项目表中的检验结果单独放到字段中 const tableData = [] - arr.forEach((row) => { + this.sybjSData.forEach((row) => { tableData.push({ ysjlId: this.ysjlId, beizhu: row.beizhu, @@ -716,6 +706,19 @@ export default { cjState: 0 }) }) + this.jybgData.forEach((row) => { + tableData.push({ + ysjlId: this.ysjlId, + beizhu: row.beizhu, + dicJyxmId: row.dicJyxmId, + jianyanjieguo: row.jianyanjieguo || '', + jianyanjielun: row.jianyanjielun || '', + jyxmMode: 0, + sort: row.sort, + orders: row.orders, + cjState: 1 + }) + }) let method = '' this.ysjl.bglx = 1 this.ysjl.cjState = 'ysjl' @@ -761,7 +764,8 @@ export default { ysjl: this.ysjl, param: this.param, cyJyxm: {}, - jdJyxm: jyxm + jdJyxm: jyxm, + state: operation } }).then(data => { Utils.$emit('task-list') diff --git a/src/views/ysjl/5000/dj/lygg-cl/index.vue b/src/views/ysjl/5000/dj/lygg-cl/index.vue index 3fecbea..7bf2a21 100644 --- a/src/views/ysjl/5000/dj/lygg-cl/index.vue +++ b/src/views/ysjl/5000/dj/lygg-cl/index.vue @@ -361,12 +361,13 @@ @@ -435,7 +436,8 @@ export default { return row.jianyanneirong } } - ] + ], + jyjgList: [{ value: '√' }, { value: 'X' }, { value: '/' }] } }, computed: { @@ -535,6 +537,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() @@ -548,7 +551,6 @@ export default { // 制造日期、投用日期、上次检验日期设置成正确的日期格式 this.ysjl.zhizaoriqi = this.common.checkDateFormat(this.ysjl.zhizaoriqi) this.ysjl.gaizaoriqi = this.common.checkDateFormat(this.ysjl.gaizaoriqi) - this.getJyxm(1) }) }, getYsjl(id) { @@ -560,6 +562,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) @@ -569,7 +572,6 @@ export default { this.getMaxBh() } this.getParam(this.ysjl.id, this.ysjl.shebeizhongleidaima) - this.getJyxm(1) }) }, handleChange(v) { @@ -615,24 +617,27 @@ export default { }) } }, + querySearchJyjg: function(queryString, cb, $index) { + cb(this.jyjgList) + }, 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 = '无此项' + const jybgJyjgJyxm = this.jybgData[row.jybgJyjgIndex - 1] + let beizhu = '' + if (val.length > 1) { + beizhu = val.substr(1) + } + if (val.indexOf('X') === 0) { + jybgJyjgJyxm.jianyanjieguo = '不符合' + beizhu + } else if (val.indexOf('√') === 0) { + let jyjg = '符合' + if (row.xiangmuleibie === 'C') { + jyjg = '资料确认符合' } + jybgJyjgJyxm.jianyanjieguo = jyjg + beizhu + } else if (val.indexOf('/') === 0) { + jybgJyjgJyxm.jianyanjieguo = '无此项' + beizhu } else { - if (val === 'X') { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认不符合' - } else if (val === '√') { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认符合' - } else { - this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项' - } + jybgJyjgJyxm.jianyanjieguo = '' } }, sortClass(sortData) { @@ -653,40 +658,25 @@ export default { 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 = '无此项' + const subArr = this.sortClass(this.sybjSData) + subArr.forEach((item) => { + if (item.some((k) => k.jianyanjieguo.indexOf('X') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('√') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格' + } else if (item.every((k) => k.jianyanjieguo.indexOf('/') === 0)) { + this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项' } }) - arr = arr.concat(this.sybjSData, this.jybgData) // 把第一个检验项目表中的检验结果单独放到字段中 const tableData = [] - arr.forEach((row) => { + this.sybjSData.forEach((row) => { tableData.push({ ysjlId: this.ysjlId, beizhu: row.beizhu, @@ -699,6 +689,19 @@ export default { cjState: 0 }) }) + this.jybgData.forEach((row) => { + tableData.push({ + ysjlId: this.ysjlId, + beizhu: row.beizhu, + dicJyxmId: row.dicJyxmId, + jianyanjieguo: row.jianyanjieguo || '', + jianyanjielun: row.jianyanjielun || '', + jyxmMode: 0, + sort: row.sort, + orders: row.orders, + cjState: 1 + }) + }) let method = '' this.ysjl.bglx = 1 this.ysjl.cjState = 'ysjl' @@ -744,7 +747,8 @@ export default { ysjl: this.ysjl, param: this.param, cyJyxm: {}, - jdJyxm: jyxm + jdJyxm: jyxm, + state: operation } }).then(data => { Utils.$emit('task-list')