Browse Source

修改导出方式

test
ccsens_zhengzhichuan 1 month ago
parent
commit
3f9a22a72d
  1. 11
      web_client/package-lock.json
  2. 1
      web_client/package.json
  3. 3
      web_client/src/App.vue
  4. 2
      web_client/src/main.js
  5. 19
      web_client/src/util/download.js
  6. 1
      web_client/src/util/uni.webview.js
  7. 116
      web_client/src/views/history/components/scaleInfor.vue
  8. 4
      web_client/vue.config.js

11
web_client/package-lock.json

@ -14,6 +14,7 @@
"core-js": "^3.6.5",
"echarts": "^5.5.0",
"element-ui": "^2.15.14",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"js-audio-recorder": "^1.0.7",
"lamejs": "^1.2.1",
@ -6988,6 +6989,11 @@
"node": ">=4.0.0"
}
},
"node_modules/file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@ -21233,6 +21239,11 @@
}
}
},
"file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",

1
web_client/package.json

@ -14,6 +14,7 @@
"core-js": "^3.6.5",
"echarts": "^5.5.0",
"element-ui": "^2.15.14",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"js-audio-recorder": "^1.0.7",
"lamejs": "^1.2.1",

3
web_client/src/App.vue

@ -133,6 +133,9 @@ export default {
created() {},
mounted() {
const query = this.$route.query;
console.log('query: ', query);
localStorage.setItem("isAPP", query.type === 'app');
if (
["/reportH5", "/reportScaleDetail", "/service"].includes(this.$route.path)
) {

2
web_client/src/main.js

@ -13,6 +13,7 @@ import util from './util/util';
import vueEsign from 'vue-esign';
import moment from 'moment';
import echarts from 'echarts';
import downloadFnc from './util/download'
Vue.config.productionTip = false;
@ -22,6 +23,7 @@ Vue.use(ElementUI);
Vue.prototype.home = home;
Vue.prototype.util = util;
Vue.prototype.$download = downloadFnc.download;
Vue.prototype.$moment = moment;
Vue.prototype.$echarts = echarts;
Vue.prototype.VUE_APP_IMG_VAR = '@@@___';

19
web_client/src/util/download.js

@ -0,0 +1,19 @@
function download (filePath) {
let isAPP = JSON.parse(localStorage.getItem("isAndroid"));
// console.log('isAPP: ', isAPP);
// let isAPP = false;
if(isAPP) {
uni.postMessage({
data: {
filePath,
isAPP
}
})
} else {
window.open(filePath);
}
}
export default {
download
}

1
web_client/src/util/uni.webview.js

File diff suppressed because one or more lines are too long

116
web_client/src/views/history/components/scaleInfor.vue

@ -22,11 +22,25 @@
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport('医生版', true)"
@click="handleExport1('医生版', true)"
>
<i class="el-icon-upload2"></i>导出医生版
<i class="el-icon-upload2"></i>导出方式1
</div>
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport2('医生版', true)"
>
<i class="el-icon-upload2"></i>导出方式2
</div>
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport3('医生版', true)"
>
<i class="el-icon-upload2"></i>导出方式3
</div>
<!-- <div
style="width: 130px; margin-right: 10px"
class="div-print cardRig-but"
@click="handlePrinting('医生版', true)"
@ -50,7 +64,7 @@
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport('个人版')"
@click="handleExport('个人版', true)"
>
<i class="el-icon-upload2"></i>导出个人版
</div>
@ -60,7 +74,7 @@
style="width: 130px"
>
<i class="el-icon-printer"></i>打印个人版
</div>
</div> -->
</div>
</div>
</div>
@ -308,6 +322,7 @@
</switchingSlip>
</template>
<script>
import { saveAs } from 'file-saver';
import switchingSlip from "components/switchingSlip";
import signatureVue from "./signature.vue";
import scaleTable from "./scaleTable.vue";
@ -405,7 +420,7 @@ export default {
this.$router.go(-1);
},
//
async handleExport(_type, _printFlat) {
async handleExport1(_type, _printFlat) {
this.type = _type;
let params = {
evaluationId: this.reportDetail1.patient.evaluationId,
@ -413,20 +428,95 @@ export default {
signId: this.signData.signId,
};
let res = "";
if (_type === "医生版") {
res = await doctorExport(params);
} else if (_type === "个人版") {
res = await personalExport(params);
} else if (_type === "阳性版") {
res = await positiveExport(params);
}
res = await doctorExport(params);
const { code, msg, data } = res;
if (code === 200) {
// true
if (_printFlat) {
//
window.open(this.apiUrl + data.path);
this.$download( this.apiUrl + data.path);
} else {
this.open = false;
this.handleInvoke(
`${this.apiUrl}${data.path}?time${new Date().getTime()}`,
);
}
this.$forceUpdate();
} else {
this.$message.error(msg);
}
},
downloadFileH5WithFS(url, fileName) {
fetch(url)
.then(response => response.blob())
.then(blob => {
alert('成功1')
saveAs(blob, fileName || 'default_filename');
})
.catch(error => {
alert('下载失败',error)
console.error('下载失败:', error)
});
},
//
async handleExport2(_type, _printFlat) {
this.type = _type;
let params = {
evaluationId: this.reportDetail1.patient.evaluationId,
reportId: this.reportDetail1.patient.id,
signId: this.signData.signId,
};
let res = "";
res = await doctorExport(params);
const { code, msg, data } = res;
if (code === 200) {
// true
let url = this.apiUrl + data.path;
if (_printFlat) {
//
// window.open(this.apiUrl + data.path);
let url = this.apiUrl + data.path;
const response = await fetch(url);
const blob = await response.blob();
} else {
this.open = false;
this.handleInvoke(
`${this.apiUrl}${data.path}?time${new Date().getTime()}`,
);
}
this.$forceUpdate();
} else {
this.$message.error(msg);
}
},
//
async handleExport3(_type, _printFlat) {
this.type = _type;
let params = {
evaluationId: this.reportDetail1.patient.evaluationId,
reportId: this.reportDetail1.patient.id,
signId: this.signData.signId,
};
let res = "";
res = await doctorExport(params);
const { code, msg, data } = res;
if (code === 200) {
// true
if (_printFlat) {
let url = this.apiUrl + data.path;
const link = document.createElement("a");
link.href = url;
link.download = "11";
link.target = "_blank"; //
document.body.appendChild(link);
link.click();
setTimeout(() => document.body.removeChild(link), 100);
plus.runtime.openURL(url); //
console.log("方式去3");
} else {
this.open = false;
this.handleInvoke(

4
web_client/vue.config.js

@ -23,7 +23,7 @@ module.exports = {
outputDir: process.env.NODE_ENV === "production" ? "clientapi" : "clienttest",
lintOnSave: true,
publicPath:
process.env.NODE_ENV === "development" ? "/" : settings.publicPath,
process.env.NODE_ENV === "development" ? "/cga/v2/client/" : settings.publicPath,
transpileDependencies: ["vuetify"],
devServer: {
open: true,
@ -33,7 +33,7 @@ module.exports = {
},
proxy: {
[settings.proxyUrl]: {
target: "https://www.ylinno.com/cga/v2/api/client/",
target: "http://localhost:19331/",
changeOrigin: true,
pathRewrite: {
["^" + settings.proxyUrl]: "",

Loading…
Cancel
Save