|
@@ -79,6 +79,7 @@
|
|
|
import {mapGetters} from "vuex";
|
|
|
import {gettreedata, objtableList,getstatisticaldata} from "@/api/system/dict/type";
|
|
|
import * as echarts from "echarts";
|
|
|
+import CryptoJS from 'crypto-js'
|
|
|
require("echarts/theme/macarons"); //引入主题
|
|
|
export default {
|
|
|
name: 'Demo',
|
|
@@ -118,6 +119,35 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ encrypt(data){
|
|
|
+ let key="1234567887654321";
|
|
|
+ let iv=key;
|
|
|
+ const dataHex = CryptoJS.enc.Utf8.parse( data ) // 需要加密的数据
|
|
|
+ const keyHex = CryptoJS.enc.Utf8.parse( key ) // 秘钥
|
|
|
+ const ivHex = CryptoJS.enc.Utf8.parse( iv ) // 偏移量
|
|
|
+ const encrypted = CryptoJS.AES.encrypt( dataHex , keyHex , {
|
|
|
+ iv: ivHex,
|
|
|
+ mode: CryptoJS.mode.CBC,
|
|
|
+ padding: CryptoJS.pad.Pkcs7
|
|
|
+ });
|
|
|
+ let encryptedVal = encrypted.ciphertext.toString();
|
|
|
+ return encryptedVal;
|
|
|
+ },
|
|
|
+ decrypt(data){
|
|
|
+ let key="1234567887654321";
|
|
|
+ let iv=key;
|
|
|
+ let encryptedHexStr = CryptoJS.enc.Hex.parse( data );
|
|
|
+ let srcs = CryptoJS.enc.Base64.stringify( encryptedHexStr );
|
|
|
+ const keyHex = CryptoJS.enc.Utf8.parse( key ) // 秘钥
|
|
|
+ const ivHex = CryptoJS.enc.Utf8.parse( iv ) // 偏移量
|
|
|
+ let decrypt = CryptoJS.AES.decrypt( srcs , keyHex , {
|
|
|
+ iv: ivHex,
|
|
|
+ mode: CryptoJS.mode.CBC,
|
|
|
+ padding: CryptoJS.pad.Pkcs7
|
|
|
+ });
|
|
|
+ let decryptedStr = decrypt.toString( CryptoJS.enc.Utf8 );
|
|
|
+ return decryptedStr.toString();
|
|
|
+ },
|
|
|
indexMethod(index)
|
|
|
{
|
|
|
let curpage=this.currentPage;
|
|
@@ -199,6 +229,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleqx() {
|
|
|
+ var tesdata=['220122197601247014','220125195509094254','22012219511102701x'];
|
|
|
+ for (let i = 0; i <tesdata.length ; i++) {
|
|
|
+ let desc=this.encrypt(tesdata[i]);
|
|
|
+ console.log(desc);
|
|
|
+ console.log(this.decrypt(desc));
|
|
|
+ }
|
|
|
var para = {};
|
|
|
para.dictType = "qx";
|
|
|
para.outType = "0";
|