123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- let s4 = new SM4Util();
- let listVue = new Vue({
- el: "#listBox",
- data: {
- apiurl:apiurl, //基础的页面请求地址
- userId: "", //用户id
- userName: "", //用户中文名
- token: "",
- nowTab: "tab1",
- dotype: 1, //0 or 1
- type: "todo", //todo or done
- pageno: 1,
- itemsPerPage: 10,
- totalCount: 0,
- flowId: "AA18|AA16|AA02|AA17",
- dataList: [],
- noDataTip: 1
- },
- methods: {
- getData: () => {
- let methodName = "";
- if (_this.nowTab == 'tab1') {
- methodName = "g2work/routeinfo/queryDataTodoWithPage";
- } else if (_this.nowTab == 'tab2') {
- methodName = "g2work/routeinfo/queryDataDoneWithPage";
- }
- let postData = {
- flowid: _this.flowId,
- userid: _this.userId,
- pageno: _this.pageno,
- pagesize: _this.itemsPerPage
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: methodName,
- 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.RECEIVEDATE = _this.dateFtt("yyyy-MM-dd hh:mm", new Date(item.RECEIVEDATE));
- if (item.FILEN != "") {
- item.FILEN = item.FILEN.indexOf("dotype") > -1 ? item.FILEN.replace("dotype=1", "dotype=" + _this.dotype) + "&type=" + _this.type : item.FILEN + "&dotype=" + _this.dotype + "&type=" + _this.type ;
- } else {
- item.FILEN = "#";
- }
- _this.dataList.push(item);
- })
- console.log(_this.dataList);
- 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) => {
- _this.pageno = 1;
- _this.dataList = [];
- _this.totalCount = 0;
- _this.nowTab = tabCode;
- if (_this.nowTab == "tab1") {
- _this.dotype = 1;
- _this.type = "todo";
- } else {
- _this.dotype = 0;
- _this.type = "done";
- }
- _this.getData();
- },
- loadMore: () => {
- _this.pageno++;
- _this.getData();
- },
- toDetail:(item)=>{
- location.href = item.FILEN;
- }
- },
- 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.getData();
- }
- })
|