12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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));
- console.log(response);
- _this.detail = {
- ID: response.data[0].ID,
- WJBH: response.data[0].WJBH,
- FBR: response.data[0].FBR,
- FBNR: (response.data[0].FBNR != "" && response.data[0].FBNR != undefined && response.data[0].FBNR != null) ? base64.decode(response.data[0].FBNR) : "",
- FBRQ: _this.dateFtt("yyyy-MM-dd", new Date(response.data[0].FBRQ)),
- LX: response.data[0].LX,
- FBBM: response.data[0].FBBM,
- FJ: response.data[0].FJ,
- WJBT: response.data[0].WJBT
- }
- if (response.data[0].FJ && response.data[0].FJ != "") {
- _this.array = JSON.parse(response.data[0].FJ);
- _this.array.forEach(function (item) {
- item.FILEURL = _this.apiurl + "/g2work" + item.FILEURL;
- })
- }
- })
- },
- },
- 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();
- }
- })
|