123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- let s4 = new SM4Util();
- let listVue = new Vue({
- el: "#listBox",
- data: {
- apiurl: apiurl, //基础的页面请求地址
- userId: "", //用户id
- userName: "", //用户中文名
- token: "",
- nowSort: "ID",
- type: "todo", //todo or done
- pageno: 1,
- itemsPerPage: 10,
- totalCount: 0,
- dataList: [],
- noDataTip: 1,
- tableName: "MOBILE_TZGG_VIEW",
- sqlWhere: {GGBK: "C01", FBZT: "1"},
- typeList: [],
- keyWord: ""
- },
- methods: {
- getData: () => {
- let postData = {
- tablename: _this.tableName,
- pagesize: _this.itemsPerPage,
- pageno: _this.pageno,
- colums: "*",
- order: _this.nowSort,
- sqlwhere: _this.sqlWhere,
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- }
- if (_this.keyWord.trim() != "") {
- if (_this.tableName == "SX_TZGG") {
- postData.sqllikewhere = {GGBT: _this.keyWord}
- }
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: "g2app/dataabase/queryDataByColWithPage",
- 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));
- response.data.forEach(function (item) {
- item.BT = item.WJBT ? item.WJBT : item.GGBT;
- item.FBRQ = item.FBRQ ? item.FBRQ : item.FBSJ;
- item.FBRQ = _this.dateFtt("yyyy-MM-dd", new Date(item.FBRQ));
- _this.typeList.forEach(function (item1) {
- if (item.FBBM == item1.CODE) {
- item.FBBM = item1.CNAME;
- }
- })
- _this.dataList.push(item);
- })
- if (_this.dataList.length == 0) {
- _this.noDataTip = 0;
- } else {
- _this.noDataTip = 1;
- }
- console.log(_this.dataList);
- _this.totalCount = response.totalCount;
- })
- },
- 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;
- },
- loadMore: () => {
- _this.pageno++;
- _this.getData();
- },
- getType: () => {
- let postData = {
- ckey: "CODE_ZRBM",
- routeinfoid: ""
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: "g2app/abase/queryDataCode",
- 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.typeList = response.data.CODE_ZRBM;
- _this.getData();
- })
- },
- goUrl: (obj) => {
- location.href = "detail.html?id=" + obj.ID + "&tablename=" + _this.tableName + "&departname=" + obj.FBBM + "&plnum=" + obj.PL + "&dznum=" + obj.DZ;
- },
- searchKey: () => {
- _this.pageno = 1;
- _this.dataList = [];
- _this.totalCount = 0;
- _this.getData();
- },
- changeSort: (code) => {
- _this.nowSort = code;
- _this.pageno = 1;
- _this.dataList = [];
- _this.totalCount = 0;
- _this.getData();
- }
- },
- 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;
- },
- mounted: function () {
- _this.getType();
- }
- })
|