Commit 6b86682f by WF1020

Merge branch 'settle-test-20230110' of http://114.115.138.98:8900/fukai/vue-gjjs…

Merge branch 'settle-test-20230110' of http://114.115.138.98:8900/fukai/vue-gjjs into settle-test-20230110
parents 1a0017a7 d848c764
...@@ -110,5 +110,13 @@ export default { ...@@ -110,5 +110,13 @@ export default {
concur: model.liaccv.concur, concur: model.liaccv.concur,
}; };
return params return params
},
// 公共组件setmod中dsp字段改变,触发联动时候的入参
buildSetgllAccts (model, trnName, setglg) {
let params = {
...this.buildCommonData(model, trnName),
setglg
};
return params
} }
} }
\ No newline at end of file
import Api from '~/service/Api'; import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js' import commonFunctions from '~/mixin/commonFunctions.js';
import buildFn from './buildCommons.js' import buildFn from './buildCommons.js';
import setmod from '~/components/business/setmod/event' import setmod from '~/components/business/setmod/event';
import glentry from '~/components/business/glentry/event' import glentry from '~/components/business/glentry/event';
import engp from '~/components/business/engp/event' import engp from '~/components/business/engp/event';
import docpan from '~/components/business/docpan/event' import docpan from '~/components/business/docpan/event';
import ccvpan from '~/components/business/ccvpan/event' import ccvpan from '~/components/business/ccvpan/event';
import GitopnRequest from "../model/GitopnRequest"
export default { export default {
mixins: [commonFunctions], mixins: [commonFunctions],
...@@ -29,24 +28,24 @@ export default { ...@@ -29,24 +28,24 @@ export default {
userId: window.sessionStorage.userId || 'ZL', userId: window.sessionStorage.userId || 'ZL',
}); });
if (rtnmsg.respCode === SUCCESS) { if (rtnmsg.respCode === SUCCESS) {
let errorRules = rtnmsg.data let errorRules = rtnmsg.data;
Object.keys(errorRules).map((ruleKey) => { Object.keys(errorRules).map((ruleKey) => {
// 此处判断是为了区分,如果在前端做了校验后端也校验了就不采用自定义校验规则 // 此处判断是为了区分,如果在前端做了校验后端也校验了就不采用自定义校验规则
if (!this.rules[ruleKey]) { if (!this.rules[ruleKey]) {
this.rules[ruleKey] = [ this.rules[ruleKey] = [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
callback(new Error(errorRules[ruleKey])) callback(new Error(errorRules[ruleKey]));
}, },
trigger: ['change', 'blur'] trigger: ['change', 'blur'],
} },
] ];
} }
}) });
console.log('rules', this.rules) console.log('rules', this.rules);
this.$refs['modelForm'].validate((valid) => { this.$refs['modelForm'].validate((valid) => {
console.log('valid', valid) console.log('valid', valid);
}) });
} }
// this.$notify({ // this.$notify({
// title: '成功', // title: '成功',
...@@ -57,16 +56,33 @@ export default { ...@@ -57,16 +56,33 @@ export default {
}, },
// 暂存 // 暂存
async handleStash() { async handleStash() {
const res = await Api.post('/service/gitopn/txnHold', { const loading = this.loading('正在暂存数据');
...this.model, let params = {
transName: this.trnName, transName: this.trnName.toUpperCase(),
userId: window.sessionStorage.userId || 'ZL', userId: window.sessionStorage.userId || 'ZL',
liaccvg: this.model.liaccv.liaccvg,
liaallg: this.model.liaall.liaallg,
setfog: this.model.setmod.setfog,
setfeg: this.model.setmod.setfeg,
setglg: this.model.setmod.setglg,
doceot: this.model.docpan.doceot,
gidgrp: this.model.gidgrp,
gitp: this.model.gitp,
}
const res = await Api.post('/service/gitopn/txnHold', params);
if (res.respCode === SUCCESS) {
this.$notify({
title: '成功',
message: '暂存成功',
type: 'success',
}); });
console.log('暂存', res); loading.close();
this.$router.push('/taskList')
}
}, },
async tabClick(tab) { async tabClick(tab) {
if (this.isInDisplay) { if (this.isInDisplay) {
return return;
} }
let name = tab.name; let name = tab.name;
switch (name) { switch (name) {
...@@ -82,7 +98,7 @@ export default { ...@@ -82,7 +98,7 @@ export default {
let setfegRequest = buildFn.buildSetfeg(this.model, this.trnName); let setfegRequest = buildFn.buildSetfeg(this.model, this.trnName);
// 此处利用回调是为了等setfeg的接口调用完成后才去获取setglg参数,由于setglg参数依赖于setfeg函数的返回值 // 此处利用回调是为了等setfeg的接口调用完成后才去获取setglg参数,由于setglg参数依赖于setfeg函数的返回值
this.processSetpan(setfegRequest, () => { this.processSetpan(setfegRequest, () => {
return buildFn.buildSetglg(this.model, this.trnName) return buildFn.buildSetglg(this.model, this.trnName);
}); });
break; break;
case 'docpan': case 'docpan':
...@@ -169,141 +185,23 @@ export default { ...@@ -169,141 +185,23 @@ export default {
handleChangePurpos() { handleChangePurpos() {
this.queryHndtypCodeTableList(this.root.trnName); this.queryHndtypCodeTableList(this.root.trnName);
}, },
//组GitopnRequest // 公共组件setmod处理方式改变触发联动
buildGitopnRequest() { changeSetmodModel (emitParams) {
let gitopnRequest = new GitopnRequest().data; let reqParams = {}
gitopnRequest.transName = "GITOPN"; switch (emitParams.code) {
gitopnRequest.userId = window.sessionStorage.userId || 'ZL'; case 'processMethods':
gitopnRequest.liaccvg = this.model.liaccv.liaccvg; reqParams = buildFn.buildSetglg(this.model, this.trnName);
gitopnRequest.liaallg = this.model.liaall.liaallg; this.calcPayDetail(reqParams)
gitopnRequest.setfog = this.model.setmod.setfog; break
gitopnRequest.setfeg = this.model.setmod.setfeg; case 'changeDsp':
gitopnRequest.setglg = this.model.setmod.setglg; let setglgRequest = buildFn.buildSetglg(this.model, this.trnName);
gitopnRequest.doceot = this.model.docpan.doceot; setglgRequest.setglg = {setgll: emitParams.list};
gitopnRequest.gidgrp = this.model.gidgrp; this.setgllAccts(setglgRequest, emitParams.index)
gitopnRequest.gitp = this.model.gitp; emitParams.list = this.model.setmod.setglg.setgll;
return gitopnRequest; break
}, default:
// 提交
handleSubmit() {
console.log('提交', this.model)
},
// 检核
async handleCheck() {
// this.$refs['modelForm'].validate((valid) => {
// console.log('valid', valid)
// })
const loading = this.loading("正在校验数据")
const rtnmsg = await Api.post(this.requestPrefix + "/checkAll", {
...this.model,
transName: this.trnName,
userId: window.sessionStorage.userId || 'ZL'
})
if (rtnmsg.respCode === SUCCESS) {
this.updateValueSet(rtnmsg.codeSet)
}
if (rtnmsg.respCode === SUCCESS) {
const fieldErrors = rtnmsg.fieldErrors;
this.updateModel(rtnmsg.data);
if (fieldErrors && Object.keys(fieldErrors).length === 0) {
// 清除之前的校验状态
this.getRoot().$refs.modelForm.clearValidate();
this.$notify({
title: "成功",
message: "校验成功",
type: "success",
});
return return
} }
} }
loading.close()
},
// 暂存
async handleStash() {
const loading = this.loading("正在暂存数据");
let gitopnRequest = this.buildGitopnRequest();
const rtnmsg = await Api.post(this.requestPrefix + "/txnHold", gitopnRequest);
if (rtnmsg.respCode === SUCCESS) {
this.$notify({
title: "成功",
message: "暂存成功",
type: "success",
});
}
loading.close();
},
// 点击获取按钮拉取当前key字段下的表单数据
queryFormData(key) {
console.log(key)
},
// 业务信息=》基本信息=》保函编号-----获取保函编号
async queryOwnref() {
let params = {
ptainr: this.model.gidgrp.apl.pts.ptainr,
businessType: 'LG',
tbl: 'LG'
}
const loading = this.loading()
let res = await Api.post('/service/gitopn/getOwnRef', params)
if (res.respCode == SUCCESS) {
loading.close()
this.model.gidgrp.rec.ownref = res.data
}
},
// 获取gitopn弹框表格数据
async queryGridEtyPromptDialogData(type, ptytyp) {
let params = {
userId: window.sessionStorage.userId || 'ZL',
ptytyp: ptytyp,
extkey: this.model.gidgrp[type.toLowerCase()].pts.extkey
}
let res = await Api.post('/service/ptspta/list', params)
if (res.respCode == SUCCESS) {
this.root.$refs['etyDialog'].show = true
this.root.promptData.data = res.data.ptaInfos
this.root.promptData.type = type
}
},
// 选中gitopn弹框表格的行数据
async selectGridEtyPromptData(row) {
let params = {
...row
}
let res = await Api.post('/service/ptspta/fetch', params)
if (res.respCode == SUCCESS) {
this.$set(this.model.gidgrp, row.role.toLowerCase(), res.data)
}
},
// 业务信息=》基本信息=》支出目的
purposChange(key, value) {
this.handleChangeForm(key, value)
},
// 初始化保函开立类型码表下拉列表
async queryHndtypCodeTableList(trnName) {
let params = {
gitp: {
swiftflg: this.model.gitp.swiftflg
},
gidgrp: {
rec: {
purpos: this.model.gidgrp.rec.purpos
}
},
transName: trnName.toUpperCase()
}
let res = await Api.post('/service/gitopn/initHndtyp', params)
if (res.respCode == SUCCESS) {
this.$set(this.codes, 'voHndtyp', res.data)
}
},
// 是否SWIFT格式修改--联动保函开立类型
handleChangeSwiftflg() {
this.queryHndtypCodeTableList(this.root.trnName)
},
// 支出目的修改--联动保函开立类型
handleChangePurpos() {
this.queryHndtypCodeTableList(this.root.trnName)
}
}, },
}; };
...@@ -168,27 +168,27 @@ export default class Gitopn { ...@@ -168,27 +168,27 @@ export default class Gitopn {
cbs: { cbs: {
cnf: { cnf: {
cur: '', // Confirmation Amount .gidgrp.cbs.cnf.cur cur: '', // Confirmation Amount .gidgrp.cbs.cnf.cur
amt: '', // Balance .gidgrp.cbs.cnf.amt amt: '0.00', // Balance .gidgrp.cbs.cnf.amt
}, },
mac2: { mac2: {
cur: '', cur: '',
amt: '', amt: '0.00',
}, },
mac: { mac: {
cur: '', cur: '',
amt: '', amt: '0.00',
}, },
max: { max: {
cur: '', // Guarantee Amount .gidgrp.cbs.max.cur cur: '', // Guarantee Amount .gidgrp.cbs.max.cur
amt: '', // Guarantee Amount .gidgrp.cbs.max.amt amt: '0.00', // Guarantee Amount .gidgrp.cbs.max.amt
}, },
opc2: { opc2: {
cur: '', cur: '',
amt: '', amt: '0.00',
}, },
opn1: { opn1: {
cur: '', // Open Amount .gidgrp.cbs.opn1.cur cur: '', // Open Amount .gidgrp.cbs.opn1.cur
amt: '', // Balance .gidgrp.cbs.opn1.amt amt: '0.00', // Balance .gidgrp.cbs.opn1.amt
}, },
}, },
blk: { blk: {
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
v-model="model.gidgrp.rec.sndto" v-model="model.gidgrp.rec.sndto"
style="width: 100%" style="width: 100%"
placeholder="请选择发送保函文本" placeholder="请选择发送保函文本"
:code="getValues('gidgrp.rec.sndto')" :code="codes.sndto"
> >
</c-select> </c-select>
</el-form-item> </el-form-item>
......
...@@ -43,7 +43,11 @@ ...@@ -43,7 +43,11 @@
<!--PD000027 --> <!--PD000027 -->
<el-tab-pane label="费用/账务" name="setpan"> <el-tab-pane label="费用/账务" name="setpan">
<c-content> <c-content>
<m-setmod :model="model" :codes="codes" /> <m-setmod
:model="model"
:codes="codes"
@changeSetmodModel="changeSetmodModel"
/>
</c-content> </c-content>
</el-tab-pane> </el-tab-pane>
...@@ -105,6 +109,7 @@ ...@@ -105,6 +109,7 @@
</template> </template>
<script> <script>
import event from '../event' import event from '../event'
import commonProcess from "~/mixin/commonProcess";
import formRules from '../model/check' import formRules from '../model/check'
import CodeTable from "~/config/CodeTable"; import CodeTable from "~/config/CodeTable";
import Gitopn from "../model"; import Gitopn from "../model";
...@@ -184,7 +189,8 @@ export default { ...@@ -184,7 +189,8 @@ export default {
activeNames: ["ovwp"], activeNames: ["ovwp"],
}; };
}, },
mixins: [event], // 里面包含了Default、Check等的公共处理
mixins: [commonProcess, event],
data() { data() {
return { return {
tabVal: "ovwp", tabVal: "ovwp",
......
import Api from '~/service/Api'; import Api from '~/service/Api';
export default { export default {
async processSetpan(setfegRequest, fn) { async processSetpan(setfegRequest, fn) {
let loading = this.loading('正在请求试算费用'); let loading = this.loading('正在请求试算费用');
...@@ -21,5 +20,22 @@ export default { ...@@ -21,5 +20,22 @@ export default {
} }
} }
loading.close() loading.close()
},
async calcPayDetail(setglgRequest) {
let loading = this.loading('正在请求试算账务');
let rtnmsg = await Api.post('/service/gid/setmod/calcPayDetail', setglgRequest);
if (rtnmsg.respCode == SUCCESS) {
this.model.setmod.setglg = rtnmsg.data.setglg;
}
loading.close()
},
async setgllAccts(reqParams, index) {
let loading = this.loading();
let rulePath = '/service/gid/setmod/setgll/' + index + '/accts';
let rtnmsg = await Api.post(rulePath, reqParams);
if (rtnmsg.respCode == SUCCESS) {
this.model.setmod.setglg = rtnmsg.data.setglg;
}
loading.close()
} }
} }
...@@ -372,7 +372,9 @@ export default { ...@@ -372,7 +372,9 @@ export default {
}, },
computed: { computed: {
formData() { formData() {
return this.model.setmod.setfeg.setfel[this.idx] let formDataTmp = this.model.setmod.setfeg.setfel[this.idx];
formDataTmp.fecp1.taxrat = formDataTmp.fecp1.taxrat || '';
return formDataTmp
} }
}, },
methods: { methods: {
......
...@@ -56,16 +56,7 @@ ...@@ -56,16 +56,7 @@
> >
</el-option> </el-option>
</c-select> </c-select>
<template slot="footer"> <template slot="footer"></template>
<c-button
style=""
size="small"
type="primary"
icon="el-icon-info"
@click="onSetmodDet"
>
</c-button>
</template>
</c-fullbox> </c-fullbox>
</el-form-item> </el-form-item>
</c-col> </c-col>
...@@ -366,7 +357,7 @@ ...@@ -366,7 +357,7 @@
<template #default="scope"> <template #default="scope">
<c-select <c-select
v-model="scope.row.dsp" v-model="scope.row.dsp"
@change="dispDefault(scope.$index + 1)" @change="changeProcessMethods('processMethods')"
> >
<el-option <el-option
v-for="item in codes.setfeldsp" v-for="item in codes.setfeldsp"
...@@ -516,7 +507,7 @@ ...@@ -516,7 +507,7 @@
<template #default="scope"> <template #default="scope">
<c-select <c-select
v-model="scope.row.dsp" v-model="scope.row.dsp"
@change="dspChange(scope.$index)" @change="changeDsp(scope.$index, 'changeDsp')"
v-if="scope.row.debcdtflg == 'D'" v-if="scope.row.debcdtflg == 'D'"
> >
<el-option <el-option
...@@ -533,7 +524,7 @@ ...@@ -533,7 +524,7 @@
</c-select> </c-select>
<c-select <c-select
v-model="scope.row.dsp" v-model="scope.row.dsp"
@change="dspChange(scope.$index)" @change="changeDsp(scope.$index, 'changeDsp')"
v-if="scope.row.debcdtflg == 'C'" v-if="scope.row.debcdtflg == 'C'"
> >
<el-option <el-option
...@@ -558,7 +549,7 @@ ...@@ -558,7 +549,7 @@
> >
<c-select v-model="scope.row.act"> <c-select v-model="scope.row.act">
<el-option <el-option
v-for="item in scope.act" v-for="item in scope.row.acts"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
...@@ -569,6 +560,7 @@ ...@@ -569,6 +560,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="借/贷" prop="debcdtflg" width="70px"> <el-table-column label="借/贷" prop="debcdtflg" width="70px">
</el-table-column> </el-table-column>
<el-table-column label="原始币种" prop="cur" width="70px"> <el-table-column label="原始币种" prop="cur" width="70px">
</el-table-column> </el-table-column>
...@@ -1432,7 +1424,7 @@ export default { ...@@ -1432,7 +1424,7 @@ export default {
addRowSetfol() { addRowSetfol() {
let newRow = { ...this.newdialog }; let newRow = { ...this.newdialog };
this.model.setmod.setfog.setfol.splice(0, 0, newRow); this.model.setmod.setfog.setfol.splice(0, 0, newRow);
this.defaultFunction(); // this.defaultFunction();
}, },
removeRowSetfol() { removeRowSetfol() {
this.model.setmod.setfog.setfol.shift(); this.model.setmod.setfog.setfol.shift();
...@@ -1453,27 +1445,37 @@ export default { ...@@ -1453,27 +1445,37 @@ export default {
this.defaultFunction(); this.defaultFunction();
}, },
detail1(index, row) { detail1(index, row) {
this.executeDefault('setfel.det').then((res) => {
this.index = index; this.index = index;
this.dialogVisible = true; this.dialogVisible = true;
this.dialog = row; this.dialog = row;
}); /*this.executeDefault('setfel.det').then((res) => {
this.index = index;
this.dialogVisible = true;
this.dialog = row;
});*/
}, },
dispDefault(index) { // 处理方式改变
this.executeDefault(`setmod.setfeg.setfel(${index}).mac`).then((res) => { changeProcessMethods(code) {
Utils.copyValueFromVO(this.model, res.data); this.$emit('changeSetmodModel', {
}); code
})
// let vm = this;
// vm.root.calcPayDetail();
}, },
// 第二个表格 // 第二个表格
detail2(index, row) { detail2(index, row) {
const that = this; const that = this;
const rule = 'setmod.setfeg.setfel(' + (index + 1) + ').det'; that.index = index;
that.$refs.setpanDialog.visiable = true;
that.dialog2 = row;
/* const rule = 'setmod.setfeg.setfel(' + (index + 1) + ').det';
that.executeRule(rule).then((res) => { that.executeRule(rule).then((res) => {
that.index = index; that.index = index;
that.$refs.setpanDialog.visiable = true; that.$refs.setpanDialog.visiable = true;
// that.$refs.setpanDialog.formData = that.model.setmod.setfeg.setfel[index]; // that.$refs.setpanDialog.formData = that.model.setmod.setfeg.setfel[index];
that.dialog2 = row; that.dialog2 = row;
}); });*/
}, },
// 第三个表格 // 第三个表格
...@@ -1483,13 +1485,11 @@ export default { ...@@ -1483,13 +1485,11 @@ export default {
}, },
async handleDetail(index, row) { async handleDetail(index, row) {
const that = this; const that = this;
const rule = 'setmod.setglg.setgll(' + (index + 1) + ').det';
let rtnmsg = await this.executeRule(rule);
if (rtnmsg.respCode == SUCCESS) {
that.index = index; that.index = index;
that.$refs.detpDialog.visiable = true; that.$refs.detpDialog.visiable = true;
this.detpDialogVisible = true; this.detpDialogVisible = true;
that.dialog3 = that.model.setmod.setglg.setgll[index]; that.dialog3 = that.model.setmod.setglg.setgll[index];
debugger
that.rattyp = that.strCalCode(that.dialog3.rattyp, that.codes.ratetype); that.rattyp = that.strCalCode(that.dialog3.rattyp, that.codes.ratetype);
that.dcbrattyp = that.strCalCode( that.dcbrattyp = that.strCalCode(
that.dialog3.dcbrattyp, that.dialog3.dcbrattyp,
...@@ -1499,7 +1499,24 @@ export default { ...@@ -1499,7 +1499,24 @@ export default {
that.dialog3.scbrattyp, that.dialog3.scbrattyp,
that.codes.ratetype that.codes.ratetype
); );
}
// const rule = "setmod.setglg.setgll(" + (index + 1) + ").det";
// let rtnmsg = await this.executeRule(rule);
// if (rtnmsg.respCode == SUCCESS) {
// that.index = index;
// that.$refs.detpDialog.visiable = true;
// this.detpDialogVisible = true;
// that.dialog3 = that.model.setmod.setglg.setgll[index];
// that.rattyp = that.strCalCode(that.dialog3.rattyp, that.codes.ratetype);
// that.dcbrattyp = that.strCalCode(
// that.dialog3.dcbrattyp,
// that.codes.ratetype
// );
// that.scbrattyp = that.strCalCode(
// that.dialog3.scbrattyp,
// that.codes.ratetype
// );
// }
}, },
strCalCode(str, code) { strCalCode(str, code) {
var result = ''; var result = '';
...@@ -1559,20 +1576,27 @@ export default { ...@@ -1559,20 +1576,27 @@ export default {
}); });
} }
}, },
async dspChange(index) { async changeDsp(index, code) {
let rtnmsg = await this.executeDefault( this.$emit('changeSetmodModel', {
'setmod.setglg.setgll(' + (index + 1) + ').dsp' code,
); index: (index + 1),
if (rtnmsg.respCode == SUCCESS) { list: this.stmData3
//TODO 处理数据逻辑 })
this.updateModel(rtnmsg.data); // this.root.setgllAccts((index + 1), this.stmData3);
this.$nextTick(() => {
this.executeRule('setmod.glemod.glepan').then((res) => { // let rtnmsg = await this.executeDefault(
//TODO 处理数据逻辑 // "setmod.setglg.setgll(" + (index + 1) + ").dsp"
if (res.respCode == SUCCESS) this.updateModel(res.data); // );
}); // if (rtnmsg.respCode == SUCCESS) {
}); // //TODO 处理数据逻辑
} // this.updateModel(rtnmsg.data);
// this.$nextTick(() => {
// this.executeRule("setmod.glemod.glepan").then((res) => {
// //TODO 处理数据逻辑
// if (res.respCode == SUCCESS) this.updateModel(res.data);
// });
// });
// }
}, },
}, },
created: function () {}, created: function () {},
......
...@@ -7717,10 +7717,6 @@ const CodeTable = { ...@@ -7717,10 +7717,6 @@ const CodeTable = {
{ label: "ISCO Issuance of counter-undertaking", value: "ISCO" }, { label: "ISCO Issuance of counter-undertaking", value: "ISCO" },
{ label: "ICCO Issuance of counter-counter-undert", value: "ICCO" }, { label: "ICCO Issuance of counter-counter-undert", value: "ICCO" },
], ],
sndto: [ sndto: []
{ label: "ISSU Issuance of undertaking", value: "ISSU" },
{ label: "ISCO Issuance of counter-undertaking", value: "ISCO" },
{ label: "ICCO Issuance of counter-counter-undert", value: "ICCO" },
]
} }
export default CodeTable; export default CodeTable;
<template> <template>
<div class="width: 100%;height: 100vh;overflow: auto;" ref="file"></div> <div>
<el-button @click="downLoad">点击下载word文件</el-button>
<div class="docWrap">
<!-- 预览文件的地方(用于渲染) -->
<div ref="file"></div>
</div>
</div>
</template> </template>
<script> <script>
...@@ -15,10 +21,10 @@ export default { ...@@ -15,10 +21,10 @@ export default {
}, },
mixins: [commonProcess], mixins: [commonProcess],
mounted() { mounted() {
this.loadWordBlob() this.goPreview ()
}, },
methods: { methods: {
async loadWordBlob () { async goPreview () {
let routeQuery = this.$route.query let routeQuery = this.$route.query
const params = { const params = {
index: routeQuery.idx, index: routeQuery.idx,
...@@ -35,6 +41,30 @@ export default { ...@@ -35,6 +41,30 @@ export default {
let blob = new Blob([u8arr]); let blob = new Blob([u8arr]);
renderAsync(blob, this.$refs.file) renderAsync(blob, this.$refs.file)
} }
},
async downLoad () {
let routeQuery = this.$route.query
const params = {
index: routeQuery.idx,
};
let res = await Api.post('/service/gitopn/executeDocpan', this.wrapper(params));
if (res.respCode == SUCCESS) {
let base64Str = res.data.executeDocpan;
let bstr = window.atob(base64Str); // 解码 base-64 编码的字符串,base-64 编码使用方法是 btoa()
let length = bstr.length;
let u8arr = new Uint8Array(length); // 创建初始化为0的,包含length个元素的无符号整型数组
while (length--) {
u8arr[length] = bstr.charCodeAt(length); // 返回在指定的位置的字符的 Unicode 编码
}
let blob = new Blob([u8arr]);
var a = document.createElement("a"); //创建一个<a></a>标
a.href = URL.createObjectURL(blob); // 将流文件写入a标签的href属性值
a.download = "gitopn.docx"; //设置文件名
a.style.display = "none"; // 障眼法藏起来a标签
document.body.appendChild(a); // 将a标签追加到文档对象中
a.click(); // 模拟点击了a标签,会触发a标签的href的读取,浏览器就会自动下载了
a.remove(); // 一次性的,用完就删除a标签
}
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment