1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- let s4 = new SM4Util();
- let base64 = new Base64(); //声明base解码和编码类
- let listVue = new Vue({
- el: "#detailBox",
- data: {
- apiurl:apiurl, //基础的页面请求地址
- userId: "", //用户id
- userName: "", //用户中文名
- token: "",
- id:"",
- tablename:"",
- departname:"",
- detail:{
- },
- array:[]
- },
- methods: {
- dateFtt: (fmt, date) => {
- var o = {
- "M+": date.getMonth() + 1, //月份
- "d+": date.getDate(), //日
- "h+": date.getHours(), //小时
- "m+": date.getMinutes(), //分
- "s+": date.getSeconds(), //秒
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
- "S": date.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt))
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt))
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- },
- getDetail: () => {
- let postData ={
- tablename: _this.tablename,
- colums: "*",
- order: "ID",
- sqlwhere: { ID: _this.id },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: "g2app/dataabase/queryDataByCol",
- data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.token
- }
- }).then(res => {
- let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
- _this.detail = {
- ID: response.data[0].ID,
- GGBK: response.data[0].GGBK,
- FBBM: response.data[0].FBBM,
- FBSJ: _this.dateFtt("yyyy-MM-dd",new Date(response.data[0].FBSJ)),
- FBFW: response.data[0].FBFW,
- GGNR: base64.decode(response.data[0].GGNR),
- GGBT: response.data[0].GGBT
- }
- if (response.data[0].FJSC && response.data[0].FJSC != "") {
- _this.array = JSON.parse(response.data[0].FJSC);
- }
- console.log(_this.array);
- console.log(_this.detail);
- })
- },
- },
- created: function () {
- _this = this;
- let token = localStorage.getItem("mobile-token", _this.token);
- let userName = localStorage.getItem("mobile-userName", _this.userName);
- let userId = localStorage.getItem("mobile-userId", _this.userId);
- _this.userId = userId;
- _this.token = token;
- _this.userName = userName;
- _this.id = _this.utils.getUrlName("id");
- _this.tablename = _this.utils.getUrlName("tablename");
- _this.departname = decodeURI(_this.utils.getUrlName("departname"));
- },
- mounted: function () {
- console.log(_this.id);
- console.log(_this.tablename);
- _this.getDetail();
- }
- })
|