/// <reference path="Simple.js" />
var wForm;
var iptCustID;
var iptCustName;
if (!window.om) window.om = {};
function sortField(queryString) {
var url = qc.applicationPath() + "/Common/BaseData/FieldSort.aspx" + queryString;
var frame = "<iframe src=\"" + url + "\" frameborder=\"0\" scrolling=\"no\" height=\"" + (540 - 30) + "px\" width=\"" + (500) + "px\"></iframe>";
wForm = new UI.openForm(517, 540, Language.Sort, frame);
}
/********查询区折叠功能******/
var searchBox = {
hiddenTr: null,
hiddenShow: null,
init: function (hidCurrent, hiddeDivID) {
searchBox.hiddenTr = $(".hiddentr");
if (searchBox.hiddenTr.length == 0)
searchBox.hiddenTr = $("#" + hiddeDivID);
searchBox.hiddenShow = $("#" + hidCurrent);
var moreIcon = $("#moreIcon");
moreIcon.bindEvent("click", function () {
var o = this;
if (o.className == "exp2") {
o.className = "exp1";
o.innerHTML = Language.Folding;
searchBox.hiddenTr.show();
searchBox.hiddenShow.val("1");
}
else {
o.className = "exp2"
o.innerHTML = Language.More;
searchBox.hiddenTr.hide();
searchBox.hiddenShow.val("0");
}
});
if (searchBox.hiddenShow.html() != undefined && searchBox.hiddenShow.val() == "1") {
searchBox.hiddenTr.show();
moreIcon.css("exp1");
moreIcon.html(Language.Folding);
}
}
}
var qc = {
artDialogInstance: null,
getRequest: function (url) {//获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.split("?")[1];
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
}
}
return theRequest;
},
joinStrByItems: function (items, item) {
return items.map(function (o) { return o[item] }).join(',');
},
//手机app发起流程下一步有执行人选择的 fzs 2015-12-25
selecttorFun: function (url) {
var Request = qc.getRequest(url);
//获取参数
var tabs = Request["tabs"];
var index = Request["index"];
var docid = Request["docid"];
var docstepid = Request["docstepid"];
var orgs = '', depts = '', poss = '', roles = '', users = '';//服务端接收需要的参数
var cc = Request["c"];
var app = qc.getApp();
app.dialog.open({
type: 'Selector',
targetId: qc.selectUserViewId,
ok: function (res) {
switch (res.type) {
case '4'://选择了人员
users = qc.joinStrByItems(res.items, 'id');
break;
case '1'://选择了部门
depts = qc.joinStrByItems(res.items, 'dept_id');
break;
case '0'://选择了机构
orgs = qc.joinStrByItems(res.items, 'org_id');
break;
case '2'://选择了职位
poss = qc.joinStrByItems(res.items, 'id');
break;
}
//知会/传阅
if (cc) {
var OrgValue = {};
$sltOrg = jQuery("#_ctl0_WorkForm_sltOrg");
if ($sltOrg[0] != null) {
OrgValue = {
"text": $sltOrg.text(),
"value": $sltOrg.val()
}
}
else {
OrgValue = null;
}
var selectedVal = { text: qc.joinStrByItems(res.items, 'name'), val: qc.joinStrByItems(res.items, 'id') };
switch (cc) {
case '0':
setUser(res.type, selectedVal);
break;
case '1':
setFlowUser(res.type, selectedVal, jQuery("#msg").val()); break; //知会、会签 防止一个页面多个选人时冲突
case '2':
setUserWithContext(res.type, getSelectedValue(), '');
break;
case '3':
setDept(res.type, selectedVal, OrgValue); break;
case '4':
setChuanyueUser(res.type, selectedVal, jQuery("#msg").val()); break;
case '5':
setUser(res.type, selectedVal);
break;
}
return;
}
//提交
qc.post("WebApi.dll", "WebApi.Manager.WF.FlMan", { method: "AddStepExecutor", doc_id: docid, step_id: docstepid, orgs: orgs, depts: depts, poss: poss, roles: roles, users: users }, function (res) {
//跳转到手机app已发流程
qc.getTop().location.hash = '#Cooperation/MyFlow/FlowOutList';
});
},
callback: function (viewId) {
qc.selectUserViewId = viewId;
}
});
},
getToken: function () {
return window.sessionStorage["token"];
},
//获取外壳类型:Android,IOS,Webapp,WeiXin,Desktop
getShellType: function () {
if (!window.om || !window.om.shellType) {
return 'Desktop';
}
return window.om.shellType;
},
//zxg.2015-11-09.判断是否移动设备
isMobile: function () {
var shellType = qc.getShellType();
return (shellType == 'Android' || shellType == 'IOS' || shellType == 'Webapp' || shellType == 'WeiXin');
},
//判断是否在Cordova外壳中
isInCordova: function () {
var shellType = qc.getShellType();
return shellType == 'Android' || shellType == 'IOS';
},
//获取top对象
getTop: function () {
var shellType = qc.getShellType();
switch (shellType) {
case 'Android':
return top.frames[0];
case 'IOS':
return top.frames[1];
default:
return top;
}
},
//zxg.2015-11-06.增加
getOpener: function () {
if (qc.isMobile()) {
return window.parent;
} else {
return window.opener;
}
},
//获取app所在的window对象
getAppWindow: function () {
var shellType = qc.getShellType();
switch (shellType) {
case 'Webapp':
return top;
case 'Android':
return top.frames[0];
case 'IOS':
return top.frames[1];
case 'Desktop':
return top;
}
},
//获取app对象
getApp: function () {
var appWindow = qc.getAppWindow();
if (appWindow)
try {
return appWindow.app;
} catch (e) {
return undefined;
}
},
//构造guid
guid: function () {
var s4 = function () { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }
var list = [];
for (var i = 0; i < 8; i++) list.push(s4());
return list.join('');
},
/*获取虚拟路径*/
applicationPath: function () {
var sPathName = document.location.pathname;
var iCount = sPathName.indexOf("