| | |
| | | class="codeForm" |
| | | > |
| | | <el-form-item :label="$t('common.passworld')" prop="password"> |
| | | <el-input type="password" v-model="codeForm.password"></el-input> |
| | | <el-input type="password" v-model="codeForm.password" show-password></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('common.SPassword')" prop="repassword"> |
| | | <el-input type="password" v-model="codeForm.repassword"></el-input> |
| | | <el-input type="password" v-model="codeForm.repassword" show-password></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button class="primary" size="small" @click="download('codeForm')" |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <iframe id="downFrame" src="" style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | var encrypt = new JSEncrypt(); |
| | | import $ from 'jquery' |
| | | import { getToken } from '@/utils/auth'; |
| | | import { |
| | |
| | | selectdirTab, |
| | | queryDepTree, |
| | | meta_downloadReq, |
| | | sign_getPublicKey, |
| | | meta_selectDownloadFile |
| | | } from '../../api/api'; |
| | | |
| | | import MyBread from '../../components/MyBread.vue'; |
| | |
| | | this.getSelectDictTab(); |
| | | this.showPermsBtn(); |
| | | this.getQueryDepTree(); |
| | | this.signGetPublicKey(); |
| | | }, |
| | | |
| | | methods: { |
| | | async signGetPublicKey(){ |
| | | const res = await sign_getPublicKey(); |
| | | if (res && res.code == 200) { |
| | | window.encrypt = new JSEncrypt(); |
| | | encrypt.setPublicKey(res.result); |
| | | } |
| | | }, |
| | | //单位列表获取 |
| | | async getQueryDepTree() { |
| | | const res = await queryDepTree(); |
| | |
| | | std.push(this.multipleSelection[i].id) |
| | | } |
| | | var obj = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | pwd: encrypt.encrypt(this.codeForm.repassword), |
| | | ids: std |
| | | }; |
| | | var token = getToken(); |
| | | $.ajax({ |
| | | url:BASE_URL+"/meta/downloadReq?token="+token, |
| | | type: 'post', |
| | | dataType: null, |
| | | data: JSON.stringify(obj), |
| | | success: function (res) { |
| | | debugger |
| | | }, |
| | | error: function () { |
| | | const res = await meta_downloadReq(JSON.stringify(obj)) |
| | | |
| | | } |
| | | }) |
| | | if(res.code!=200){ |
| | | this.$message.error('下载请求失败'); |
| | | return |
| | | } |
| | | |
| | | // |
| | | // $.ajax( BASE_URL+"/meta/downloadReq?token="+token, "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | // console.log(rs); |
| | | // alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | // }); |
| | | // const res = await meta_downloadReq(JSON.stringify(obj)) |
| | | // debugger |
| | | // |
| | | // $.ajax(BASE_URL + '/meta/downloadReq"?token=' + token, { |
| | | // type: 'post', |
| | | // data: JSON.stringify(obj), |
| | | // async: true, |
| | | // cache: false, |
| | | // processData: false, |
| | | // contentType: false, |
| | | // success: (rs) => { |
| | | // debugger |
| | | // }, |
| | | // error: (e) => { |
| | | // console.log(e); |
| | | // }, |
| | | // }); |
| | | var downObj={ |
| | | guid :res.result, |
| | | pwd :encodeURIComponent(encrypt.encrypt(this.codeForm.repassword)) |
| | | } |
| | | const data = await meta_selectDownloadFile(downObj) |
| | | |
| | | if(data.code !=200){ |
| | | this.$message.error('下载请求失败'); |
| | | return |
| | | } |
| | | var token = getToken() |
| | | var url = BASE_URL+"/meta/downloadFile?token=" +token+ "&guid=" + res.result + "&pwd=" +encodeURIComponent(encrypt.encrypt(this.codeForm.repassword)); |
| | | |
| | | $("#downFrame").attr("src", url).click(); |
| | | this.closeDown(); |
| | | }, |
| | | closeDown() { |
| | | this.showCodeBox = false; |