From 5c8aaba66c16b1a143fdec27e29ad36eaefd1e3a Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 31 十二月 2024 14:33:25 +0800 Subject: [PATCH] 无源器件检验开发 --- src/components/view/a7-contract-review.vue | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/components/view/a7-contract-review.vue b/src/components/view/a7-contract-review.vue index ab51485..8ab4cdf 100644 --- a/src/components/view/a7-contract-review.vue +++ b/src/components/view/a7-contract-review.vue @@ -44,11 +44,10 @@ :visible.sync="addDialogVisible" width="400px"> <el-row> - <el-col :span="24" style="margin-bottom: 16px;"> + <!-- <el-col :span="24" style="margin-bottom: 16px;"> <div class="search_thing"> <div class="search_label">鍒ゅ畾瑙勫垯锛�</div> <div class="search_input" style="display: flex;align-items: center;"> - <!-- <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.rule"></el-input> --> <el-radio-group v-model="addInfo.rule" size="small" style="width: 60%;"> <el-radio label="涓嶈�冭檻涓嶇‘瀹氬害">涓嶈�冭檻涓嶇‘瀹氬害</el-radio> <el-radio label="鑰冭檻涓嶇‘瀹氬害">鑰冭檻涓嶇‘瀹氬害</el-radio> @@ -57,7 +56,7 @@ <span v-if="addInfo.rule=='鑰冭檻涓嶇‘瀹氬害'"> %</span> </div> </div> - </el-col> + </el-col> --> <el-col :span="24" style="margin-bottom: 16px;"> <div class="search_thing"> <div class="search_label">缁煎悎瀹ょ鍚嶄汉锛�</div> @@ -545,20 +544,45 @@ // }).catch(err => { // }) this.$axios.post(this.$api.processOrder.exportInspectionOrder,{id:row.id},{responseType: 'blob'}).then(res => { - this.$message.success('瀵煎嚭鎴愬姛') const blob = new Blob([res], { type: 'application/force-download' }) - const filename = decodeURI(row.sample+'-'+row.sampleType+'-'+'妫�楠屽鎵樺崟.docx') - // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� - const elink = document.createElement('a') - elink.download = filename - elink.style.display = 'none' - elink.href = URL.createObjectURL(blob) - document.body.appendChild(elink) - elink.click(); - URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 - document.body.removeChild(elink) + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const filename = decodeURI(row.sample+'-'+row.sampleType+'-'+'妫�楠屽鎵樺崟.docx') + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click(); + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const filename = decodeURI(row.sample+'-'+row.sampleType+'-'+'妫�楠屽鎵樺崟.docx') + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click(); + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + this.$message.success('瀵煎嚭鎴愬姛') + } + } }).catch(err => { }) }, -- Gitblit v1.9.3