widget.js
8.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
var self = new Vue({
el: '#app',
data() {
return {
search: '',
flowid: 't1001_8a8610de737b99270173937337e00133',
userid: 't0101_8a8610de737b99270173941e5c50017e',
pageNum:1,
pageSize:10,
total:0,
// 表格数据
tabaledata: [],
isActive: 1,
}
},
mounted(){
this.getData();
},
methods: {
getData() {
axios.get(CONF_NEWGHSC_SERVERURL + '/ghjg/backlog/'+this.pageNum+'/'+this.pageSize, {
params: {
flowid: this.flowid,
userId: this.userid,
keyword: this.search
}
}).then(res => {
this.total=res.data.data.total;
this.tabaledata = res.data.data.list;
}).catch();
}
,
handleSizeChange() {
},
handleCurrentChange() {
},
click(val) {
this.isActive = val
},
openHandleJumpUrl(flowId, itemTypeId, _stats = 'create') {
var unique = uuid();
let url = CONF_FRONT_SERVERURL + 'view/projecttask/detailproject.jsp?';
url += 'stats=' + _stats;
url += '&flowid=' + flowId;
url += '&create=' + (projectId ? 1 : 0);
url += '&projectid=' + (projectId || "");
url += '&flowItemTypeId=' + (itemTypeId || "");
url += '&uniquePath=' + unique;
window.open(this.handleJumpUrl(url));
this.addFlowUserCount(flowId);
},
addFlowUserCount(flowId) {
if (flowId === null || flowId === undefined) {
return false;
}
ajaxPromise({
data: JSON.stringify({"flowId": flowId, "userId": userId}),
contentType: "application/json",
url: CONF_BACK_SERVERURL + "/mvc/flow/saveFlowUserCount.do"
}).catch((error) => {
console.error(error);
});
},
handleJumpUrl(url) {
var myid = "guid" + guid();
var tempArr = url.split("?");
var returnStr = tempArr[0] + "?guid=" + myid;
var urlValue = tempArr[1];
var cacheUrlValue = null;
var data = {
paramUrl: urlValue,
ftoken: $.cookie('ftoken')
};
if (window.globalLocalCache) {
cacheUrlValue = window.globalLocalCache.AddCache(myid, "", "", data);
}
return returnStr;
},
S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
},
guid() {
return (this.S4() + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + this.S4() + this.S4());
},
clickData(row, column, event) {
// console.log(row, column, event)
this.jumpdetailPage(row);
},// 详情
jumpdetailPage(data) {
var taskid = data.TASKID;
var detailType = data.detailType;
var projectid = data.PROJECTID;
var flowInstanceId =data.INSTANCEID;
var titleEncode = encodeURI(encodeURI(data.PROJECTNAME));
var stats = data.stats ? data.stats : '';
var projecttype = data.FLOWNAME;
var PROJECTSTATUS = encodeURI(encodeURI(data.PROJECTSTATUS));
var FLOWREVISIONID = data.FLOWREVISIONID;
var projectcode = data.PROJECTCODE;
var flowItemTypeKvStr = data.FLOWITEMTYPE?"&flowItemTypeId=" + data.FLOWITEMTYPE:"";
var version = data.FLOWVERSION;
var layerid="";
var coverage="";
var url = CONF_FRONT_SERVERURL
+ 'view/projecttask/detailproject.jsp?projectid=' + 20190 + "&referer=''&stats="
+ stats +"&projectcode="+projectcode+"&taskId=" + taskid + "&flowInstanceId=" + flowInstanceId+'&titleEncode='
+ titleEncode + "&projectStatus=" + PROJECTSTATUS+"&flowRevisionId="+FLOWREVISIONID+flowItemTypeKvStr+"&FLOWVERSION="+version+"&detailType="+detailType;
detailPage = window.open(this.handleJumpUrl(url));
parent.saveOpenNew?parent.saveOpenNew(detailPage):sreachparent(opener,"saveOpenNew",detailPage);
},
openApproveDetail(data) {
var type = this.params.rwListIndex;
if(type == "项目管理") data.stats = "Manage";
else if(type == "项目查询") data.stats = "search" ;
else if(type == "待办项目") data.stats = "projecting";
else if(type == "已办项目") data.stats = "dealedproject";
// create by zys start
else if(type == 0) data.stats = "projecting"; // 待办
else if(type == 1) data.stats = "dealedproject"; // 已办
this.jumpdetailPage(data);
},
openHandleJumpUrl(flowId, itemTypeId, _stats = 'create') {
// debugger
var unique = this.uuid();
let url = CONF_FRONT_SERVERURL + 'view/projecttask/detailproject.jsp?';
url += 'stats=' + _stats;
url += '&flowid=' + flowId;
url += '&create=' + (this.projectId ? 1 : 0);
url += '&projectid=' + (this.projectId || "");
url += '&flowItemTypeId=' + (itemTypeId || "");
url += '&uniquePath=' + unique;
window.open(this.handleJumpUrl(url));
this.addFlowUserCount(flowId);
},
addFlowUserCount(flowId) {
if (flowId === null || flowId === undefined) {
return false;
}
this.ajaxPromise({
data: JSON.stringify({"flowId": flowId, "userId": this.userId}),
contentType: "application/json",
url: CONF_BACK_SERVERURL + "/mvc/flow/saveFlowUserCount.do"
}).catch((error) => {
console.error(error);
});
},
handleJumpUrl(url) {
var myid = "guid" + this.guid();
var tempArr = url.split("?");
var returnStr = tempArr[0] + "?guid=" + myid;
var urlValue = tempArr[1];
var cacheUrlValue = null;
var data = {
paramUrl: urlValue,
ftoken: $.cookie('ftoken')
};
if (window.globalLocalCache) {
cacheUrlValue = window.globalLocalCache.AddCache(myid, "", "", data);
}
return returnStr;
},
S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
},
guid() {
return (this.S4() + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + this.S4() + this.S4());
},
uuid() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4";
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
},
ajaxPromise(options) {
return new Promise(function (resolve, reject) {
if (typeof options !== "object") {
return reject("参数错误!");
}
let _type = options.type || "POST";
//'application/json'
$.ajax({
type: _type,
url: options.url,
data: options.data,
dataType: options.dataType,
contentType: options.contentType,
headers: {"token": $.cookie('ftoken')},
success: function (result) {
resolve(result);
},
error: function (error) {
reject(error);
}
});
})
}
}
})