let s4 = new SM4Util(); let listVue = new Vue({ el: "#listBox", data: { apiurl: apiurl, //基础的页面请求地址 userId: "", //用户id userName: "", //用户中文名 token: "", nowTab: "tab2", type: "todo", //todo or done pageno: 1, itemsPerPage: 10, totalCount: 0, dataList: [], noDataTip: 1, tableName: "WJFB_CB", sqlWhere: {LX: "C09", FBZT: "1"}, typeList: [], keyWord: "" }, methods: { getData: () => { let postData = { tablename: _this.tableName, pagesize: _this.itemsPerPage, pageno: _this.pageno, colums: "*", order: "ID", sqlwhere: _this.sqlWhere, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" } if (_this.keyWord.trim() != "") { if (_this.tableName == "WJFB_CB") { postData.sqllikewhere = {WJBT: _this.keyWord} } else 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; } _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; }, changeTab: (tabCode, tabName) => { _this.pageno = 1; _this.dataList = []; _this.totalCount = 0; _this.nowTab = tabCode; _this.tableName = tabName; if (_this.nowTab == "tab2") { _this.sqlWhere = {LX: "C09", FBZT: "1"}; } else if (_this.nowTab == "tab3") { _this.sqlWhere = {GGBK: "C05", FBZT: "1"}; } else if (_this.nowTab == "tab4") { _this.sqlWhere = {GGBK: "C08", FBZT: "1"}; } else if (_this.nowTab == "tab5") { _this.sqlWhere = {LX: "C06", FBZT: "1"}; } else if (_this.nowTab == "tab6") { _this.sqlWhere = {GGBK: "C02", FBZT: "1"}; } else if (_this.nowTab == "tab7") { _this.sqlWhere = {LX: "C01", FBZT: "1"}; } else if (_this.nowTab == "tab8") { _this.sqlWhere = {LX: "C02", FBZT: "1"}; } else if (_this.nowTab == "tab9") { _this.sqlWhere = {LX: "C03", FBZT: "1"}; } else if (_this.nowTab == "tab10") { _this.sqlWhere = {LX: "C04", FBZT: "1"}; } else if (_this.nowTab == "tab11") { _this.sqlWhere = {LX: "C05", FBZT: "1"}; } else if (_this.nowTab == "tab12") { _this.sqlWhere = {GGBK: "C03", FBZT: "1"}; } else if (_this.nowTab == "tab13") { _this.sqlWhere = {GGBK: "C04", FBZT: "1"}; } else if (_this.nowTab == "tab14") { _this.sqlWhere = {GGBK: "C07", FBZT: "1"}; } else if (_this.nowTab == "tab15") { _this.sqlWhere = {LX: "C08", FBZT: "1"}; } else if (_this.nowTab == "tab16") { _this.sqlWhere = {GGBK: "C06", FBZT: "1"}; } else if (_this.nowTab == "tab17") { _this.sqlWhere = {LX: "C10", FBZT: "1"}; } else if (_this.nowTab == "tab18") { _this.sqlWhere = {LX: "C11", FBZT: "1"}; } else if (_this.nowTab == "tab19") { _this.sqlWhere = {LX: "C12", FBZT: "1"}; } _this.getData(); }, 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) => { if (_this.tableName == "SX_TZGG") { location.href = "detail.html?id=" + obj.ID + "&tablename=" + _this.tableName + "&departname=" + obj.FBBM; } else if (_this.tableName == "WJFB_CB") { location.href = "detail2.html?id=" + obj.ID + "&tablename=" + _this.tableName + "&departname=" + obj.FBBM; } }, searchKey: () => { _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(); } })