diff --git a/src/views/archive/archive_new.vue b/src/views/archive/archive_new.vue deleted file mode 100644 index 1f7545f..0000000 --- a/src/views/archive/archive_new.vue +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - 查询 - - - 加入购物车 - - - - - - 归档所选报告 - - - 清空购物车 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/views/archive/archive_old.vue b/src/views/archive/archive_old.vue deleted file mode 100644 index 3281fa0..0000000 --- a/src/views/archive/archive_old.vue +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - 查询 - - - 加入购物车 - - - - - - 归档所选报告 - - - 清空购物车 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/views/archive/archive_scan.vue b/src/views/archive/archive_scan.vue index e8b151f..d238f0e 100644 --- a/src/views/archive/archive_scan.vue +++ b/src/views/archive/archive_scan.vue @@ -1,5 +1,5 @@ - + @@ -12,19 +12,19 @@ - + - + - + @@ -65,7 +65,7 @@ export default { type: Array, required: true }, - isEdit: { + isAppend: { type: Boolean, default: false }, @@ -89,7 +89,7 @@ export default { doInit() { this.$nextTick(() => { this.jianyijiahao = this.frameNums - if (this.isEdit) { + if (this.isAppend) { this.server({ url: '/archive/archive/getArchiveInfo/' + this.id, method: 'get' @@ -102,159 +102,46 @@ export default { }, // 扫码 handleKeyUpEnter() { - // 判断是否第一次进行录入 - if (this.paramList.length === 0) { - this.unknownScan() + // 判断新录入的报告编号是否存在 + if (this.paramList.every(param => param.baogaobianhao !== this.baogaobianhao)) { + // 进行查询 + this.getYsjlByBgbh() } else { - // ------ 第二条及之后的逻辑 - // 生成报告编号数组,用来判断新录入的报告编号是否存在 - const bgbhArray = [] - this.paramList.forEach(data => bgbhArray.push(data.baogaobianhao)) - // 判断所有元素确定是哪个系统的报告数据 - // 有三种情况 1、16版机电类 2、18版承压类 3、未在系统内的报告 - if (bgbhArray.indexOf(this.baogaobianhao) < 0) { - if (this.isJd) { - // 去16版机电类查询 - this.server.defaults.headers.common['projectMark'] = 'OLD' - this.server({ - url: '/archive/report/getReportByBgbh/' + this.baogaobianhao, - method: 'get' - }).then(data => { - this.server.defaults.headers.common['projectMark'] = '' - if (data != null && data !== '') { - this.addJdData() - } else { - // 去18版承压类进行查询 - this.server({ - url: '/archive/ysjl/getYsjlByBgbh/' + this.baogaobianhao, - method: 'get' - }).then(data => { - if (data != null && data !== '') { - this.$message.error('请选择机电类纸质报告进行扫描!') - this.baogaobianhao = '' - } else { - this.addUnknownData() - } - }) - } - }).catch(() => { - this.baogaobianhao = '' - this.server.defaults.headers.common['projectMark'] = '' - }) - } else if (this.isCy) { - // 去18版承压类进行查询 - this.server({ - url: '/archive/ysjl/getYsjlByBgbh/' + this.baogaobianhao, - method: 'get' - }).then(data => { - if (data != null && data !== '') { - this.addCyData() - } else { - // 去16版机电类查询 - this.server.defaults.headers.common['projectMark'] = 'OLD' - this.server({ - url: '/archive/report/getReportByBgbh/' + this.baogaobianhao, - method: 'get' - }).then(data => { - this.server.defaults.headers.common['projectMark'] = '' - if (data != null && data !== '') { - this.$message.error('请选择承压类纸质报告进行扫描!') - this.baogaobianhao = '' - } else { - this.addUnknownData() - } - }).catch(() => { - this.baogaobianhao = '' - this.server.defaults.headers.common['projectMark'] = '' - }) - } - }).catch(() => { - this.baogaobianhao = '' - }) - } else { - this.unknownScan() - } - } else { - this.baogaobianhao = '' - } + this.baogaobianhao = '' } }, - // 当未确定下来时 - unknownScan() { + /** + * 查询报告 + */ + getYsjlByBgbh() { // 先去18版承压类进行查询 this.server({ url: '/archive/ysjl/getYsjlByBgbh/' + this.baogaobianhao, method: 'get' }).then(data => { if (data != null && data !== '') { - this.isCy = true - this.addCyData(data) - } else { - // 去16版机电类查询 - this.server.defaults.headers.common['projectMark'] = 'OLD' - this.server({ - url: '/archive/report/getReportByBgbh/' + this.baogaobianhao, - method: 'get' - }).then(data => { - this.server.defaults.headers.common['projectMark'] = '' - if (data != null && data !== '') { - this.isJd = true - this.addJdData(data) - } else { - this.addUnknownData() - } - }).catch(() => { - this.server.defaults.headers.common['projectMark'] = '' - this.baogaobianhao = '' + this.paramList.unshift({ + id: data.id, + baogaobianhao: data.baogaobianhao, + shebeizhonglei: data.shebeizhonglei, + shiyongdanwei: data.shiyongdanwei, + zhucedaima: data.zhucedaima, + shiyongdengjibianhao: data.shiyongdengjibianhao, + chanpinbianhao: data.chanpinbianhao }) } }).catch(() => { - this.baogaobianhao = '' }) + this.baogaobianhao = '' }, // 禁止扫码框粘贴 handlePaste() { return false }, - addUnknownData() { - this.server({ - url: '/archive/archive/checkArchiveState/' + this.baogaobianhao, - method: 'get' - }).then(() => { - this.paramList.unshift({ baogaobianhao: this.baogaobianhao }) - this.baogaobianhao = '' - }).catch(() => { - this.baogaobianhao = '' - }) - }, - addCyData(data) { - this.paramList.unshift({ - id: data.id, - baogaobianhao: data.baogaobianhao, - shebeizhonglei: data.shebeizhonglei, - shiyongdanwei: data.shiyongdanwei, - zhucedaima: data.zhucedaima, - shiyongdengjibianhao: data.shiyongdengjibianhao, - chanpinbianhao: data.chanpinbianhao - }) - this.baogaobianhao = '' - }, - addJdData(data) { - this.paramList.unshift({ - annalid: data.annalid, - baogaobianhao: data.baogaobianhao, - shebeizhonglei: data.shebeizhonglei, - shiyongdanwei: data.shiyongdanwei, - zhucedaima: data.zhucedaima, - shiyongdengjibianhao: data.shiyongdengjibianhao, - chanpinbianhao: data.chanpinbianhao - }) - this.baogaobianhao = '' - }, // 执行归档报告 doSubmit() { let archiveParamList = Object.assign([], this.paramList) - if (this.isEdit) { + if (this.isAppend) { archiveParamList = archiveParamList.filter(archiveParam => !archiveParam.archiveId) } if (!this.archive.frameNum) { @@ -269,62 +156,20 @@ export default { if (valid) { this.archive.archiveUser = this.$store.getters.nickname this.archive.archiveCount = this.paramList.length - if (this.isCy) { - this.server({ - url: '/archive/archive/addNew', - method: 'post', - data: { - archive: this.archive, - params: archiveParamList, - isEdit: this.isEdit - } - }).then(() => { - this.$message.success('添加成功。') - Utils.$emit('archive-list') - this.dialog = false - }) - } else if (this.isJd) { - this.server({ - url: '/archive/archive/addOld', - method: 'post', - data: { - archive: this.archive, - params: archiveParamList, - isEdit: this.isEdit - } - }).then(() => { - this.server.defaults.headers.common['projectMark'] = 'OLD' - archiveParamList = archiveParamList.filter(archiveParam => archiveParam.annalid) - this.server({ - url: '/archive/report/updateReportState', - method: 'post', - data: { - params: archiveParamList - } - }).then(() => { - this.$message.success('添加成功。') - this.dialog = false - this.$nextTick(() => { - this.server.defaults.headers.common['projectMark'] = '' - Utils.$emit('archive-list') - }) - }) - }) - } else { - this.server({ - url: '/archive/archive/addOld', - method: 'post', - data: { - archive: this.archive, - params: archiveParamList, - isEdit: this.isEdit - } - }).then(() => { - this.$message.success('添加成功。') - this.dialog = false - Utils.$emit('archive-list') - }) - } + + this.server({ + url: '/archive/archive/addNew', + method: 'post', + data: { + archive: this.archive, + params: archiveParamList, + isAppend: this.isAppend + } + }).then(() => { + this.$message.success('添加成功。') + Utils.$emit('archive-list') + this.dialog = false + }) } else { return false } diff --git a/src/views/archive/list.vue b/src/views/archive/list.vue index 75ab026..038f7b0 100644 --- a/src/views/archive/list.vue +++ b/src/views/archive/list.vue @@ -3,19 +3,11 @@ - - 承压类归档 - - - 机电类归档 - 扫码归档 - - - + @@ -85,13 +77,11 @@