'use strict';
var app = angular.module('app', [
]);
app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$interval", "$sce", function ($scope, $http, $timeout, $interval, $sce) {
var self = this;
var s4 = new SM4Util();
self.userId = $.cookie("GlWorkPlatform-userid");
self.userName = $.cookie("GlWorkPlatform-chineseName");
self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
self.routeid = sp.getUrlName("routeid");
self.routeinfoid = sp.getUrlName("routeinfoid");
self.lastrouteinfoid = sp.getUrlName("lastrouteinfoid");
self.copyrightid = sp.getUrlName("copyrightid");
self.directionid = sp.getUrlName("directionid");
self.formeditid = sp.getUrlName("formeditid");
self.mbid = sp.getUrlName("mbid");
self.fjid = sp.getUrlName("fjid");
self.docmode = sp.getUrlName("docmode");
self.dotype = sp.getUrlName("dotype");
self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
self.get_type = sp.getUrlName("type");
self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
if (self.deviceType != "pad") {
self.photo = $.cookie("GlWorkPlatform-photo").indexOf("AFrontEnd") > -1 ? "../../../" + $.cookie("GlWorkPlatform-photo") : $.cookie("GlWorkPlatform-photo");
}
var postCfg = {
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer " + self.get_AccessToken
}
};
self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
//初始化右上角按钮
self.buttonList = []
var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
return item.CNAME
})
self.upload_zw = function () {
$('#fileupload-zw').fileupload({
url: apiurljs.login + 'g2app/fawenfiles/uploadFileWithForm',
dataType: 'json',
beforeSend: function (xhr, data) {
xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
},
add: function (e, data) {
var num = 0;
var acceptFileTypes = eval('/(' + apiurljs.zwType.join("|") + ')$/i')
//文件类型判断
$.each(data.originalFiles, function (index, item) {
if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
sp.dialog("您好,请上传" + apiurljs.zwType.join("/") + "格式的文件!");
return;
} else {
num++
}
})
if (num == data.originalFiles.length) {
self.uploading_zw = true;
data.submit();
$scope.$apply();
}
},
// 上传完成后的执行逻辑
done: function (e, data) {
self.uploading_zw = false;
self.getGCG(1)
}
})
$timeout(function () {
$("#fileupload-zw").trigger("click")
}, 1)
}
//上层附件、业务参考、共享沟通组件
self.uploading = false;
self.upload = function () {
$('#fileupload').fileupload({
url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
dataType: 'json',
beforeSend: function (xhr, data) {
xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=正式文(上行文)"));
},
add: function (e, data) {
var num = 0;
var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
//文件类型判断
$.each(data.originalFiles, function (index, item) {
if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
return;
} else {
num++
}
})
if (num == data.originalFiles.length) {
self.uploading = true;
data.submit();
$scope.$apply();
}
},
// 上传完成后的执行逻辑
done: function (e, data) {
self.uploading = false;
self.getOther()
}
})
}
self.downLoad = function (item) {
window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
}
self.deleteFile = function (file) {
var dialogHead = "温馨提示×";
var dialogBody = "
删除后不可恢复,您确认要删除吗?
";
var dialogFoot = "";
$('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
sp.openCenter(".sp-dialog");
///取消按钮
$('.sp-closeDialog').click(function (event) {
sp.closeCenter(".sp-dialog");
event.preventDefault();
event.stopPropagation();
});
//post消息的id
$("#delDataTrue").click(function () {
var data = {
tablename: "FILE_ATTACH",
id: file.ID
};
$http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
sp.dialoghide();
if (res.success) {
$.each(self.iframeList, function (index, item) {
if (item.filename == file.FILENAMES && item.source == apiurljs.login + "g2work/files2/inline/" + file.FILEURL.slice(7)) {
self.closeItem(index);
return false;
}
})
self.getOther();
} else {
sp.dialog("删除失败,请联系管理员!");
}
});
});
}
self.creatFLOW = function (file) {
var data = {
copyrightid: self.copyrightid,
directionid: self.directionid,
routeinfoid: self.routeinfoid,
userid: self.userId,
relateid: file.ID
}
$http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
sp.dialoghide();
if (res.success) {
self.getGLFLOW();
} else {
sp.dialog("删除失败,请联系管理员!");
}
});
}
self.deleteWG = function (file) {
var dialogHead = "温馨提示×";
var dialogBody = "删除后不可恢复,您确认要删除吗?
";
var dialogFoot = "";
$('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
sp.openCenter(".sp-dialog");
///取消按钮
$('.sp-closeDialog').click(function (event) {
sp.closeCenter(".sp-dialog");
event.preventDefault();
event.stopPropagation();
});
//post消息的id
$("#delDataTrue").click(function () {
var data = {
id: file.ID
};
$http.post(apiurljs.login + "g2app/fawenfilesrelate/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
sp.dialoghide();
if (res.success) {
$.each(self.iframeList, function (index, item) {
if (item.filename == file.FILENAMES && item.source == apiurljs.login.split("glwork/")[0] + "glworkweb/" + file.FILEURL) {
self.closeItem(index);
return false;
}
})
self.getGLJ(1);
} else {
sp.dialog("删除失败,请联系管理员!");
}
});
});
}
self.openGL = function (item) {
var data = {
tablename: "SYS_DESKTOP_PLUGIN_TODO",
colums: "*",
order: "SORTID",
sqlwhere: "",
sqlorwhere: "",
sqlinwhere: "",
sqllikewhere: { FLOWID: item.FLOWID }
}
$http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
sp.openNewWindow("../../" + res.data[0].FILEN.split("/")[1] + "/" + item.FILEN + "&flowid=" + item.FLOWID + "&dotype=1", item.TITLE)
});
}
self.downLoaDWG = function (item) {
if (item.FILEURL.indexOf("files") > -1) {
window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
} else {
window.open(apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL)
}
}
self.readonly = {
CBBM: false,
SQR: false,
HYS: false,
LXFS: false,
KSSJ: false,
JSSJ: false,
SJLD: false,
CHRS: false,
WLD: false,
WNCS: false,
ZSDW: false,
QTDW: false,
HYMC: false,
HYYC: false,
SB: false,
BZ: false
}
self.show = {
CBBM: false,
SQR: false,
HYS: false,
LXFS: false,
KSSJ: false,
JSSJ: false,
SJLD: false,
CHRS: false,
WLD: false,
WNCS: false,
ZSDW: false,
QTDW: false,
HYMC: false,
HYYC: false,
SB: false,
BZ: false
}
self.type = 1;
self.getSwenList = function (n) {
self.SwenList = [];
var data = {
directionid: self.directionid,
userid: self.userId,
routeinfoid: self.routeinfoid,
routeid: self.routeid,
formeditid: ""
}
$http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (self.copyrightid == "") {
self.copyrightid = res.data.LINKS[0].COPYRIGHTID
}
$.each(res.data.LINKS, function (index, item) {
item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
if (item.TEMPFORM.indexOf("?docmode") > 0) {
if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
} else {
item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
}
} else {
item.TEMPFORM = "#";
}
self.SwenList.push(item)
})
self.SwenList.push({
VNAME: "流程图",
DIRECTIONID: self.SwenList[0].DIRECTIONID,
TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
})
if (n == 0) {
self.getFLOW()
} else {
self.getData()
}
})
}
self.getSwenList(0)
self.getFLOW = function () {
var data = {
copyrightid: self.copyrightid
}
$http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.flowTitle = res.data.CNAME;
self.getJJQK()
})
}
self.getJJQK = function () {
var data = {
ckey: "CODE_EMERGENCY",
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.JJCD = res.data.CODE_EMERGENCY;
self.getZDDB()
})
}
self.getZDDB = function () {
var data = {
ckey: "CODE_OVERSEE",
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.ZDDB = res.data.CODE_OVERSEE;
self.getSB()
})
}
self.getSB = function () {
var data = {
ckey: "CODE_HYSB",
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.SB = res.data.CODE_HYSB;
self.getHYS()
})
}
self.getHYS = function () {
var data = {
tablename: "SX_HYSGLB",
colums: "*",
order: "SORTID",
sqlwhere: { ZT: "正常" },
sqlorwhere: "",
sqlinwhere: "",
sqllikewhere: ""
};
$http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.HYS = res.data;
self.getDpList()
})
}
self.getDpList = function () {
var data = {
unitid: "AA"
}
$http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.dpList = [];
res.data.forEach(function (item) {
if (item.CHILD_DATA.length == 0) {
self.dpList.push(item)
} else {
item.CHILD_DATA.forEach(function (item1) {
if (item1.CHILD_DATA.length == 0) {
self.dpList.push(item1)
} else {
item1.CHILD_DATA.forEach(function (item2) {
if (item2.CHILD_DATA.length == 0) {
self.dpList.push(item2)
}
})
}
})
}
})
self.dpList.forEach(function (item) {
item.checked = false;
})
self.DpList = {
CBBM: JSON.parse(JSON.stringify(self.dpList))
}
self.AllCheckedDp = {};
self.DpLength = {};
self.selectDpList = {};
self.getDP()
})
}
self.getDP = function () {
var data = {
userid: self.userId
}
$http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
self.getData();
})
}
//获取数据
self.getData = function () {
var data = {
ckey: "SX_HYSQBZHWY",
id: 0,
directionid: self.directionid,
formeditid: self.formeditid,
routeid: self.routeid,
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.data = {
ID: res.data.SX_HYSQBZHWY.ID,
APPCODE: res.data.SX_HYSQBZHWY.APPCODE,
CBBM: res.data.SX_HYSQBZHWY.CBBM == "" ? self.userDpName : res.data.SX_HYSQBZHWY.CBBM,
SQR: res.data.SX_HYSQBZHWY.SQR == "" ? self.userName : res.data.SX_HYSQBZHWY.SQR,
SQRUSERID: res.data.SX_HYSQBZHWY.SQRUSERID == "" ? self.userName : res.data.SX_HYSQBZHWY.SQRUSERID,
HYS: res.data.SX_HYSQBZHWY.HYS,
LXFS: res.data.SX_HYSQBZHWY.LXFS,
KSSJ: sp.datefmt("yyyy-MM-dd HH:mm:ss", res.data.SX_HYSQBZHWY.KSSJ),
JSSJ: sp.datefmt("yyyy-MM-dd HH:mm:ss", res.data.SX_HYSQBZHWY.JSSJ),
SJLD: res.data.SX_HYSQBZHWY.SJLD,
CHRS: res.data.SX_HYSQBZHWY.CHRS,
WLD: res.data.SX_HYSQBZHWY.WLD,
WNCS: res.data.SX_HYSQBZHWY.WNCS,
ZSDW: res.data.SX_HYSQBZHWY.ZSDW,
QTDW: res.data.SX_HYSQBZHWY.QTDW,
HYMC: res.data.SX_HYSQBZHWY.HYMC,
HYYC: res.data.SX_HYSQBZHWY.HYYC,
SB: res.data.SX_HYSQBZHWY.SB,
SBNAME:res.data.SX_HYSQBZHWY.SBNAME,
BZ: res.data.SX_HYSQBZHWY.BZ
}
self.readonly = {
CBBM: res.data.SX_HYSQBZHWY["CBBM.EREADONLY"] == "true",
SQR: res.data.SX_HYSQBZHWY["SQR.EREADONLY"] == "true",
HYS: res.data.SX_HYSQBZHWY["HYS.EREADONLY"] == "true",
LXFS: res.data.SX_HYSQBZHWY["LXFS.EREADONLY"] == "true",
KSSJ: res.data.SX_HYSQBZHWY["KSSJ.EREADONLY"] == "true",
JSSJ: res.data.SX_HYSQBZHWY["JSSJ.EREADONLY"] == "true",
SJLD: res.data.SX_HYSQBZHWY["SJLD.EREADONLY"] == "true",
CHRS: res.data.SX_HYSQBZHWY["CHRS.EREADONLY"] == "true",
WLD: res.data.SX_HYSQBZHWY["WLD.EREADONLY"] == "true",
WNCS: res.data.SX_HYSQBZHWY["WNCS.EREADONLY"] == "true",
ZSDW: res.data.SX_HYSQBZHWY["ZSDW.EREADONLY"] == "true",
QTDW: res.data.SX_HYSQBZHWY["QTDW.EREADONLY"] == "true",
HYMC: res.data.SX_HYSQBZHWY["HYMC.EREADONLY"] == "true",
HYYC: res.data.SX_HYSQBZHWY["HYYC.EREADONLY"] == "true",
SB: res.data.SX_HYSQBZHWY["SB.EREADONLY"] == "true",
BZ: res.data.SX_HYSQBZHWY["BZ.EREADONLY"] == "true"
}
self.show = {
CBBM: res.data.SX_HYSQBZHWY["CBBM.ESHOW"] == "true",
SQR: res.data.SX_HYSQBZHWY["SQR.ESHOW"] == "true",
HYS: res.data.SX_HYSQBZHWY["HYS.ESHOW"] == "true",
LXFS: res.data.SX_HYSQBZHWY["LXFS.ESHOW"] == "true",
KSSJ: res.data.SX_HYSQBZHWY["KSSJ.ESHOW"] == "true",
JSSJ: res.data.SX_HYSQBZHWY["JSSJ.ESHOW"] == "true",
SJLD: res.data.SX_HYSQBZHWY["SJLD.ESHOW"] == "true",
CHRS: res.data.SX_HYSQBZHWY["CHRS.ESHOW"] == "true",
WLD: res.data.SX_HYSQBZHWY["WLD.ESHOW"] == "true",
WNCS: res.data.SX_HYSQBZHWY["WNCS.ESHOW"] == "true",
ZSDW: res.data.SX_HYSQBZHWY["ZSDW.ESHOW"] == "true",
QTDW: res.data.SX_HYSQBZHWY["QTDW.ESHOW"] == "true",
HYMC: res.data.SX_HYSQBZHWY["HYMC.ESHOW"] == "true",
HYYC: res.data.SX_HYSQBZHWY["HYYC.ESHOW"] == "true",
SB: res.data.SX_HYSQBZHWY["SB.ESHOW"] == "true",
BZ: res.data.SX_HYSQBZHWY["BZ.ESHOW"] == "true"
}
if (self.data.ID == 0) {
self.filedChange = true;
} else {
self.filedChange = false;
}
var buttonList = [{ CNAME: "转发", CODE: "array", data: [] }];
res.data["SX_HYSQBZHWY.FUNCLIST"].forEach(function (item) {
if (item.BUTTONGROUP == "FORMITEM") {
buttonList.push(item)
} else {
buttonList[0].data.push(item)
}
})
if (buttonList[0].data.length == 0) {
buttonList = buttonList.slice(1)
} else if (buttonList[0].data.length == 1) {
buttonList[0] = buttonList[0].data[0]
}
console.log(buttonList)
self.buttonList = buttonList;//res.data["SX_HYSQBZHWY.FUNCLIST"];
self.getOpinion1(0)
self.getOther()
self.getGLJ(0)
self.getMeetMsg()
$interval(function () {
self.getNumMeet()
}, 2000)
})
}
//获取关联文稿
self.getGLJ = function (n) {
var data = {
dockind: "D01",
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2app/fawenfilesrelate/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.guanlian = res.data;
console.log(self.guanlian)
if (n == 0) {
self.getGLFLOW()
}
if (n == 2) {
self.editFile(self.guanlian[self.guanlian.length - 1], 2)
}
})
}
self.seeGLJ = function () {
if ($(".formedit2").find("iframe").attr("src") == "") {
if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
} else {
var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
}
var data = {
method: 1,
params: {
userId: self.userName,
fileId: "",
fileName: "",
filePath: "",
userRight: self.dotype != 1 ? 1 : 0,
callbackUrl: ""
}
};
if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
data.params.fileId = self.guanlian[0].FILEURL.split("/")[2];
data.params.fileName = self.guanlian[0].FILEURL.split("/")[3];
data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
} else {
data.params.fileId = self.guanlian[0].ID;
data.params.fileName = self.guanlian[0].FILENAMES;
data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
}
$.ajax({
url: apiurljs.yzFileWo + "api.do",
data: {
jsonParams: encodeURIComponent(JSON.stringify(data))
},
type: "POST",
dataType: "json",
general: false,
async: false,
success: function (data) {
if (data) {
if (data.errorCode === "0") {
let rst = data.result;
if (rst && rst.urls) {
var get_urls = rst.urls;
if (typeof (get_urls) === "string") {
$(".formedit2").find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", self.guanlian[0].ID)
}
}
}
}
},
});
}
}
//获取关联流程
self.getGLFLOW = function () {
var data = {
userid: self.userId,
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2work/routeinfo/queryDataRelatedFlow", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
res.data.FLOWIN.forEach(function (item) {
item.type = "FLOWIN"
})
res.data.FLOWOUT.forEach(function (item) {
item.type = "FLOWOUT"
})
self.glList = res.data.FLOWIN.concat(res.data.FLOWOUT);
console.log(self.glList)
})
}
//获取意见(不上表)
self.getOpinion1 = function (n) {
self.HWFJ = [];
var data = {
cmanid: self.userId,
routeinfoid: self.routeinfoid,
routeid: "",//self.routeid,
tableid: "SX_HYSQBZHWY",
colid: "",
opiniontype: "",//self.opiniontype,
orderbycol: "CDATE desc"
}
$http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success == true) {
for (var i in self.YJ) {
if (typeof (self.YJ[i]) == "object") {
self.YJ[i] = [];
self.YJ[i + "STATUS"] = false;
res.data.forEach(function (item) {
item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
if (i == item.COLID) {
self.YJ[i].push(item)
if (item.ROUTEID == self.routeid) {
self.data[i] = item.opinion;
self.YJ[i + "STATUS"] = true;
}
}
})
}
}
self.YJ.nulla = res.data.filter(function (item) {
return item.COLID == "";
});
self.YJ.nullaSTATUS = false;
self.YJ.nulla.forEach(function (item) {
item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
if (self.activeOpinion != null) {
self.activeOpinion.FILEDATA = item.FILEDATA
}
})
res.data.forEach(function (item) {
item.FILEDATA.forEach(function (item1) {
self.HWFJ.push(item1)
})
})
//if (n == 1 && self.lastrouteinfoid != 0) {
// self.getHB()
//}
} else {
sp.dialog(res.message)
}
})
}
//获取附件
self.getOther = function () {
var data = {
tablename: "FILE_ATTACH",
colums: "*",
order: "ID asc",
sqlwhere: { ROUTEINFOID: self.routeinfoid },
sqlinwhere: "",
sqllikewhere: ""
}
$http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.arrayFile1 = [];
if (res.data.length > 0) {
res.data.forEach(function (item) {
if (item.ATTACHTYPE.indexOf("-正文") == -1) {
self.arrayFile1.push(item)
}
})
}
})
}
//判断页面字段是否只读readonly、是否隐藏show
self.hide = function (type, field) {
if (self.dotype == 0 && type == "readonly") {
return true;
} else {
if (self[type][field] == true) {
return true;
} else {
return false;
}
}
}
//右上角按钮调用方法
self.btnEvent = function (item) {
switch (item.CODE) {
case "SAVEITEM": self.btnSave(0); break;
case "PRINTITEM": self.btnPrint(); break;
case "PRINTITEMEXTEND": self.btnPrint1(); break;
case "SAVEOFD": self.toOFD(); break;
case "GAIZITEM": self.qianZ(); break;
case "MEETITEM": self.Meet(); break;
case "SENDLOG": self.RouteList(); break;
case "YUGUIDANG": self.YGD(); break;
case "array": return;
default: self.forward(item); break;
}
}
self.openDpList = function (str) {
if (self.hide("readonly", str) == true) {
return
} else {
self.filed = str;
//self.AllCheckedDp = false;
sp.layer("#DpList")
$("#DpList .sp-page").eq(0).scrollTop(0);
}
}
self.checkAllDp = function () {
self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
$.each(self.DpList[self.filed], function (index, item) {
item.checked = self.AllCheckedDp[self.filed];
})
self.submitDpList(1)
}
self.checkDpItem = function (item) {
item.checked = !item.checked;
var n = 0;
$.each(self.DpList[self.filed], function (index, item) {
if (item.checked == true) {
n++
}
})
if (n == self.DpList[self.filed].length) {
self.AllCheckedDp[self.filed] = true;
} else {
self.AllCheckedDp[self.filed] = false;
}
self.submitDpList(1)
}
self.submitDpList = function (n) {
var AllCheckedLength1 = 0;
self.selectDpList[self.filed] = [];
$.each(self.DpList[self.filed], function (index, item) {
if (item.checked == true) {
AllCheckedLength1++;
self.selectDpList[self.filed].push(item)
}
})
self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
return item.SECTION
}).join(",")
self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
self.changeFiled(self.filed)
if (n == 0) {
sp.layerhide();
}
}
self.checkSB = function (obj) {
obj.checked = !obj.checked;
var array = [],array1 = [];
self.SB.forEach(function (item) {
if (item.checked == true) {
array.push(item.CODE)
array1.push(item.CNAME)
}
})
self.data.SB = array.join(",");
self.data.SBNAME = array1.join(",");
self.changeFiled("SB")
}
self.time_h = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
self.time_s = ['00', '15', '30', '45']
self.checkRoom = function () {
if (self.hide("readonly", "HYS") == true) {
return
}
self.select_new = []
self.currentTime = sp.datefmt('yyyy-MM-dd HH:mm', sp.getLocalDate());
self.hy = {
hys: self.data.HYS,
date: sp.format(sp.getLocalDate()),
kssj: "",
jssj: ""
}
self.selectListY = []//数据源
for (let i = 0; i < self.HYS.length; i++) {
let row = []
for (let j = 0; j < self.time_h.length; j++) {
for (let k = 0; k < self.time_s.length; k++) {
row.push({ value: '' + (self.time_h[j] < 10 ? '0' + self.time_h[j] : self.time_h[j]) + self.time_s[k], select: 0 })
}
}
self.selectListY.push({ title: self.HYS[i], row: row })
}
self.getHysyqkList()
// iiitem
sp.layer("#Room")
}
self.getHysyqkList = function () {
if(self.hy.date -1) {
for (let j = 0; j < resDataItem.APPS.length; j++) {
let day = resDataItem.APPS[j].KSSJ.substring(0, 10)
let KsJs = self.getDataListByKsJs(self.getHByDataStr(resDataItem.APPS[j].KSSJ), self.getHByDataStr(resDataItem.APPS[j].JSSJ))
if (self.hy.date == day) {
for (let k = 0; k < self.selectList[titleIndex].row.length; k++) {
if (KsJs.indexOf(self.selectList[titleIndex].row[k].value) > -1) {
self.selectList[titleIndex].row[k].msg = (resDataItem.APPS[j].HYMC == "" ? resDataItem.APPS[j].CBBM : resDataItem.APPS[j].HYMC) + "——" + resDataItem.APPS[j].SQR;
if (self.data.ID == resDataItem.APPS[j].ID) {
self.selectList[titleIndex].row[k].select = 2
select_new.push({value:self.selectList[titleIndex].row[k].value,select:2,titleIndex,k,row:self.selectList[titleIndex].row,title:self.selectList[titleIndex].title})
} else {
self.selectList[titleIndex].row[k].select = 1
}
}
}
}
}
}
}
self.select_new=[{},{}]
if(select_new.length>0){
self.select_new[0]={data:{value:select_new[0].value},hysIndex:select_new[0].titleIndex,dataIndex:select_new[0].k,hys:{row:select_new[0].row,title:select_new[0].title}}
self.select_new[1]={data:{value:select_new[select_new.length-1].value},hysIndex:select_new[select_new.length-1].titleIndex,dataIndex:select_new[select_new.length-1].k,hys:{row:select_new[select_new.length-1].row,title:select_new[select_new.length-1].title}}
}
})
}
self.getHByDataStr = function (dateStr) {
return dateStr.substring(11, 16)
}
self.getDataListByKsJs = function (kssj, jssj) {
let res = []
if (kssj == jssj) {
return []
}
let kssj_arr = kssj.split(":")
let jssj_arr = jssj.split(":")
let kssj_h = +kssj_arr[0]
let kssj_s = +kssj_arr[1]
let jssj_h = +jssj_arr[0]
let jssj_s = +jssj_arr[1]
for (let i = kssj_h; i <= jssj_h; i++) {
for (let j = (i == kssj_h ? kssj_s : 0) ; j <= 45; j = j + 15) {
if (i == jssj_h && j == jssj_s) {
break;
} else {
res.push('' + (i < 10 ? '0' + i : i) + (j == 0 ? j + '0' : j))
}
}
}
return res
}
self.checkTime = function (hys, data, hysIndex, dataIndex) {
var now=sp.datefmt("yyyyMMddHHmm",sp.getLocalDate());
if(sp.datefmt("yyyyMMdd",self.hy.date)+data.value= dataIndex2; i--) {
if (this.selectList[hysIndex].row[i].select == 1) {
return i - 1
} else {
this.selectList[hysIndex].row[i].select = selectValue
index = i
}
}
return index
} else {
let index = dataIndex1
for (let i = dataIndex1; i <= dataIndex2; i++) {
if (this.selectList[hysIndex].row[i].select == 1) {
return i - 1
} else {
this.selectList[hysIndex].row[i].select = selectValue
index = i
}
}
return index
}
}
self.submitRoom = function () {
if (self.select_new.length == 0) {
self.warning = "请选择会议时间";
$timeout(function () {
self.warning = ""
}, 2000)
return
}
let kssj, jssj
if (self.select_new.length == 1) {
let time = self.select_new[0].data.value
let h = time.substring(0, 2)
let s = time.substring(2, 4)
kssj = self.hy.date + " " + h + ":" + s + ":00"
if (+s == 50) {
h = +h + 1
if (h < 10) {
h = '0' + h
}
s = '00'
jssj = self.hy.date + " " + h + ":" + s + ":00"
} else {
s = +s + 10
jssj = self.hy.date + " " + h + ":" + s + ":00"
}
} else if (self.select_new.length == 2) {
let select_new = []
if (self.select_new[0].dataIndex > self.select_new[1].dataIndex) {
select_new.push(self.select_new[1])
select_new.push(self.select_new[0])
} else {
select_new = self.select_new
}
let time1 = select_new[0].data.value
let h1 = time1.substring(0, 2)
let s1 = time1.substring(2, 4)
kssj = self.hy.date + " " + h1 + ":" + s1 + ":00"
let time = select_new[1].data.value
let h = time.substring(0, 2)
let s = time.substring(2, 4)
if (+s == 45) {
h = +h + 1
if (h < 10) {
h = '0' + h
}
s = '00'
jssj = self.hy.date + " " + h + ":" + s + ":00"
} else {
s = +s + 15
jssj = self.hy.date + " " + h + ":" + s + ":00"
}
} else {
self.warning = "未知异常";
$timeout(function () {
self.warning = ""
}, 2000)
return
}
let data = {
hys: self.select_new[0].hys.title.HYSMC,
kssj: kssj,
jssj: jssj
}
self.data.HYS=data.hys;
self.data.KSSJ=data.kssj;
self.data.JSSJ=data.jssj;
if(self.data.HYS=="报告厅"||self.data.HYS=="第一会议室"){
self.data.BZ="请提前和办公室做好沟通,如与重要会议冲突,请自行更换其他会议室!"
}
sp.layerhide()
}
self.changeDate = function () {
if (self.hy.date < sp.format(sp.getLocalDate())) {
self.hy.date = sp.format(sp.getLocalDate())
for (var i in self.times) {
if (self.hy.date + " " + self.times[i] > self.currentTime) {
self.hy.kssj = self.times[i];
self.hy.jssj = self.times[i];
break
}
}
}
}
//打开公文模板弹窗
self.openGLJ = function () {
$("#GLJWin").attr("src", "../../forward/GLJ.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "©rightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&cookie=shouwenbg")
sp.layer("#GLJ")
}
//保存提交
self.btnSave = function (n) {
if (spngvld.submit(".formedit")) {
if (self.docmode == 'zihao' && self.data.FWZH != "") {
var data = {
data: {
CYEAR: sp.currentYear(),
FLOWID: sp.getUrlName("flowid"),
ZIHAO: "",
CNAMEMARK: "",
ROUTEINFOIDMARK: self.routeinfoid
}
}
self.FWZH.forEach(function (item) {
if (item.CODE == self.data.FWZH) {
data.data.ZIHAO = item.CODE;
data.data.CNAMEMARK = item.CNAMEMARK
}
})
$http.post(apiurljs.login + "g2app/fawen/saveWenHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) { })
}
var dataArray = [];
dataArray.push(self.data);
var data = {
ckey: "SX_HYSQBZHWY",
id: self.data.ID,
routeid: self.routeid,
routeinfoid: self.routeinfoid,
routeinfotitle: self.data.HYMC.replace(/\n/g, '').replace(/\s/g, ''),//self.data.ZT,
directionid: self.directionid,
formeditid: self.formeditid,
data: JSON.stringify(dataArray)
}
$http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.code == 0) {
self.data.ID = res.data.ID;
self.routeid = res.data.ROUTEID;
self.routeinfoid = res.data.ROUTEINFOID;
if (n == 0) {
sp.dialog("保存成功!");
$timeout(function () {
sp.dialoghide()
}, 1500)
self.getSwenList(1)
} else if (n == 1) {
self.forward(self.btnItem);
} else if (n == 2) {
self.sendAll();
} else if (n == 3) {
self.btnPrint();
} else if (n == 4) {
sp.layer("#print")
}
} else {
sp.dialog(res.message)
}
})
}
}
/*综合打印*/
self.printFiled = 1;
self.btnPrint1 = function () {
if (self.filedChange == true) {
self.btnSave(4)
} else {
sp.layer("#print")
}
}
self.printSubmit = function () {
if (self.printFiled == 1) {
var templatefilename = "moban_hyssq"
} else if (self.printFiled == 2) {
var templatefilename = "mobanoption"
} else {
var templatefilename = "moban_hyssq_all"
}
var data = {
templatefilename: templatefilename + ".ftl",
outfilepath: "/tmp/会议申请表(知会物业)" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
routeinfoid: self.routeinfoid,
tablename: "SX_HYSQBZHWY",
printtype: self.printFiled,
printdate: "KSSJ,JSSJ"
}
console.log(s4.encryptData_CBC(JSON.stringify(data)))
$http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (self.deviceType == "pad") {
window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
} else {
sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
}
})
sp.layerhide()
}
//签写意见编辑状态
self.opinion = {
NBYJ: false,
NBYJImg: false,
LDPS: false,
LDPSImg: false,
CBYJ: false,
CBYJImg: false,
nulla: false
}
self.YJ = {
NBYJ: [],
NBYJSTATUS: false,
LDPS: [],
LDPSSTATUS: false,
CBYJ: [],
CBYJSTATUS: false,
nulla: [],
nullaSTATUS: false
}
//意见(下表)
self.openOptionList = function () {
if (self.routeinfoid == 0 && self.routeid == 0) {
sp.dialog("请先保存!")
return;
}
if (self.dotype == 0) {
return
}
if (self.opinion.nulla == true) {
return;
}
self.nulla = "";
self.opinion.nulla = true;
}
self.openOptionList1 = function () {
self.openOptionList()
self.activeOpinion = null;
self.showBottom = "opinion";
self.YJ.nulla.forEach(function (item) {
if (item.ROUTEID == self.routeid) {
self.activeOpinion = item;
self.nulla = item.OPINION;
}
})
}
self.closeOptionList = function () {
self.opinion.nulla = false;
self.activeOpinion = null;
$(".toggle").trigger("click")
}
self.submitOptionList = function () {
var data = {
cmanid: self.userId,
routeinfoid: self.routeinfoid,
routeid: self.routeid,
tableid: "SX_HYSQBZHWY",
colid: "",
opiniontype: 99,
cresult: "",
opinion: self.nulla,
opinionimage: ""
}
$http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success == true) {
self.getOpinion1(2);
self.opinion.nulla = false;
$(".toggle").trigger("click")
} else {
sp.dialog(res.message)
}
})
}
self.changeOptionList = function (item) {
self.showBottom = "opinion";
self.opinion.nulla = true;
self.nulla = item.OPINION;
self.activeOpinion = item;
}
//意见附件(下表)
self.uploading1 = false;
self.upload1 = function () {
$('#fileupload1').fileupload({
url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
dataType: 'json',
beforeSend: function (xhr, data) {
xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
+ ",routeid=" + self.routeid + ",tableid=SX_HYSQBZHWY,colid="));
},
// 上传完成后的执行逻辑
done: function (e, data) {
self.uploading1 = false;
self.getOpinion1(2)
}
})
}
//意见附件(下表)
self.uploading2 = false;
self.upload2 = function (str) {
$('#fileupload-' + str).fileupload({
url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
dataType: 'json',
beforeSend: function (xhr, data) {
xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
+ ",routeid=" + self.routeid + ",tableid=SX_HYSQBZHWY,colid=" + str));
},
// 上传完成后的执行逻辑
done: function (e, data) {
self.uploading1 = false;
self.getOpinion1(2)
}
})
}
//下载意见表附件
self.downLoadOption = function (item) {
window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
}
//删除意见表附件
self.deleteOptionFile = function (file) {
var data = {
routeid: file.ROUTEID,
tableid: "SX_HYSQBZHWY",
colid: file.COLID,
fileid: file.FILEID
};
$http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
sp.dialoghide();
if (res.success) {
self.getOpinion1(2);
} else {
sp.dialog("删除失败,请联系管理员!");
}
});
}
//签写意见
self.openOpinion = function (str) {
if (self.routeinfoid == 0 && self.routeid == 0) {
sp.dialog("请先保存!")
return;
}
self.opinion[str] = true;
}
//修改意见
self.changeOpinion = function (str) {
self.data[str] = self.YJ[str][0].OPINION;
self.opinion[str] = true;
}
self.changeOpinionItem = function (str, item) {
if (item.OPINIONIMAGE != "") {
self.QianZi(str);
self.opinion[str + "Img"] = true;
}
self.data[str] = item.OPINION;
self.opinion[str] = true;
}
//提交意见
self.Sopinion = function (str) {
if (self.opinion[str + "Img"] == true) {
self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
} else {
self.data[str] = $("#" + str).val();
}
var data = {
cmanid: self.userId,
routeinfoid: self.routeinfoid,
routeid: self.routeid,
tableid: "SX_HYSQBZHWY",
colid: str,
opiniontype: 0,
cresult: "",
opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
}
$http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success == true) {
self.getOpinion1(1);
self.opinion[str] = false;
self.opinion[str + "Img"] = false;
self.data[str] = "";
self.changeFiled(str)
} else {
sp.dialog(res.message)
}
})
}
//删除意见
self.Dopinion = function (str) {
var data = {
cmanid: self.userId,
routeid: self.routeid,
tableid: "SX_HYSQBZHWY",
colid: str
}
$http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success == true) {
self.getOpinion1(1);
self.nulla = "";
self.activeOpinion = null;
self.changeFiled(str)
} else {
sp.dialog(res.message)
}
})
}
self.phraseText = "";//添加常用语
self.phraseList = []//常用语列表
//获取常用语库
self.phrase = function (colid) {
sp.layer("#phrase");
self.colid = colid;
self.getPhrase();
}
//添加常用语到常用语库
self.Aphrase = function () {
if (self.phraseText == "") {
return;
}
var data = {
cmanid: self.userId,
tableid: "SX_HYSQBZHWY",
colid: self.colid,
contents: self.phraseText
}
$http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success == true) {
self.phraseText = "";
self.getPhrase();
} else {
sp.dialog(res.message)
}
})
}
//获取常用语库
self.getPhrase = function () {
var data = {
cmanid: self.userId,
tableid: "SX_HYSQBZHWY",
colid: self.colid
}
$http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.phraseList = res.data;
self.phraseSelect = self.phraseList[0].CONTENTS;
})
}
//从常用语库删除
self.Dphrase = function () {
var id = null;
$.each(self.phraseList, function (index, item) {
if (item.CONTENTS == self.phraseSelect) {
id = item.ID;
}
})
var data = {
id: id
}
$http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.getPhrase();
})
}
//常用语确认为意见
self.btnPhrase = function () {
if (!self.colid) {
self.nulla = self.phraseSelect;
} else {
self.data[self.colid] = self.phraseSelect;
}
sp.layerhide();
}
//签字—手写
self.QianZi = function (str) {
if (self.opinion[str + "Img"] == true) { return; }
self.opinion[str + "Img"] = true;
$timeout(function () {
new lineCanvas(str + "QZ")
}, 1)
}
//清除手写
self.canvasClear = function (str) {
var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
}
self.selectUSAGE = function (item) {
item.checked = !item.checked;
self.selectUSAGEs = [];
$.each(self.USAGE, function (index, item) {
if (item.checked == true) {
self.selectUSAGEs.push(item.CODE)
}
})
self.changeFiled('USAGE')
}
//发生修改
self.changeFiled = function (str) {
self.filedChange = true;
}
//转发
self.forward = function (obj) {
self.btnItem = obj;
if (self.filedChange == true) {
self.btnSave(1)
} else {
$("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "©rightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=huiyishibg")
sp.layer("#forward")
}
}
//预归档
self.YGD = function () {
$.cookie("GlWorkPlatform-gdsp", JSON.stringify({ FLOWID: sp.getUrlName("flowid"), FLOWNAME: self.flowTitle, TITLE: self.data.HYMC, MOBANNAME: "moban63.ftl", TABLENAME: "SX_HYSQBZHWY" }), { path: '/', expires: 1 });
$("#YGDWin").attr("src", "../../forward/yuguidang.html?routeinfoid=" + self.routeinfoid + "&id=0")
sp.layer("#yuguidang")
}
//查看流转记录
self.RouteList = function () {
if (self.deviceType == "pad") {
window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
} else {
sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
}
}
self.showCol = function ($event, ele) {
$('.show-col').not(ele).not("#ziliao").hide();
$(ele).toggle("fast", function () {
$(ele).css('overflow-y', 'auto')
}).autoHide();
$event.stopPropagation();
}
self.iframeList = []
self.iframeLast = self.iframeList.length - 1;
self.iframeShow = self.iframeList.length;
self.iframeHide = self.iframeList.length - self.iframeShow;
//num为1时为附件表附件,为2时为文稿表附件
self.seeFile = function (obj, num, str) {
$('.show-col').hide();
if (!obj) {
sp.dialog("文件不存在!")
return
}
if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
sp.dialog("文件暂不支持在线预览,请点击下载查看!")
return
}
var n = 0;
self.iframeList.forEach(function (item) {
if (item.filename == obj.FILENAMES) {
n++
}
})
if (n == 0) {
var set_convertType = 0;
if (obj.FILEEXT == "doc") {
set_convertType = 0;
} else if (obj.FILEEXT == "pdf") {
set_convertType = 20;
} else if (obj.FILEEXT == "ofd") {
set_convertType = 570;
} else if ("png,jpg,jpeg,gif,bmp,jfif,svg,tif,tiff".indexOf(obj.FILEEXT) > -1) {
set_convertType = 23;
} else {
set_convertType = 0;
}
let postData = {
convertType: set_convertType,
isSignature: 1,
fileUrl: num == 1 ? (obj.FILEPATH ? apiurljs.yzFcscloud + "g2work" + obj.FILEPATH : apiurljs.yzFcscloud + "g2work/files2/inline/" + obj.FILEURL.slice(7)) : apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL
};
var postCfg_transfer = {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
transformRequest: function (data) {
return $.param(data);
}
};
$http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
.success(function (res) {
if (res.errorcode === 0) {
if (num == 1) {
if (obj.FILEPATH) {
self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work" + obj.FILEPATH, str, obj.FILENAMES, false)
} else {
self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7), str, obj.FILENAMES, false)
}
} else {
self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login.split("glwork/")[0] + "glworkweb/" + obj.FILEURL, str, obj.FILENAMES, false)
}
} else {
sp.dialog(res.message);
}
});
}
}
self.seeZW = function () {
self.activeFormedit = 0;
if ($(".rightBox").outerWidth() == 15) {
showRightBox()
}
$("#rightList").css("margin-left", 0);
}
self.editFile = function (obj, n, str) {
$('.show-col').hide();
if (!obj) {
sp.dialog("文件不存在!")
return
}
self.activeFormedit = n;
if ($(".rightBox").outerWidth() == 15) {
showRightBox()
}
if ($(".formedit" + n).find("iframe").attr("data-id") == obj.ID) {
if (self.iframeList.length == 0) {
if (n == 0) {
$("#rightList").css("margin-left", 0);
} else {
$("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
}
} else if (self.iframeHide == self.iframeList.length) {
if (n == 0) {
console.log(n)
$("#rightList").css("margin-left", 0);
} else {
$("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
}
} else {
$("#rightList").css("margin-left", n * $(".formedit").width() * -1);
}
} else {
if (obj.FILEURL.indexOf("files") > -1) {
var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
} else {
var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
}
var data = {
method: 1,
params: {
userId: self.userName,
fileId: "",
fileName: "",
filePath: "",
userRight: self.dotype != 1 ? 1 : 0,
callbackUrl: ""
}
};
if (obj.FILEURL.indexOf("files") > -1) {
data.params.fileId = obj.FILEURL.split("/")[2];
data.params.fileName = obj.FILEURL.split("/")[3];
data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
} else {
data.params.fileId = obj.ID;
data.params.fileName = obj.FILENAMES;
data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
}
$.ajax({
url: apiurljs.yzFileWo + "api.do",
data: {
jsonParams: encodeURIComponent(JSON.stringify(data))
},
type: "POST",
dataType: "json",
general: false,
async: false,
success: function (data) {
if (data) {
if (data.errorCode === "0") {
let rst = data.result;
if (rst && rst.urls) {
var get_urls = rst.urls;
if (typeof (get_urls) === "string") {
$(".formedit" + n).find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", obj.ID)
if (self.iframeList.length == 0) {
if (n == 0) {
$("#rightList").css("margin-left", 0);
} else {
$("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
}
} else if (self.iframeHide == self.iframeList.length) {
if (n == 0) {
console.log(n)
$("#rightList").css("margin-left", 0);
} else {
$("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
}
} else {
$("#rightList").css("margin-left", n * $(".formedit").width() * -1);
}
}
}
}
}
},
})
}
}
self.btnSaveFile = function (id) {
var data = {
method: 2,
params: {
fileId: id
}
};
$.ajax({
url: apiurljs.yzFileWo + "api.do",
data: {
jsonParams: encodeURIComponent(JSON.stringify(data))
},
type: "POST",
dataType: "json",
general: false,
async: false,
success: function (data) {
if (data && data.errorCode === "0") {
sp.dialog("保存成功");
}
}
});
}
self.addItem = function (url, source, name, filename, edit, fileid) {
var n = 0;
self.iframeList.forEach(function (item) {
if (item.filename == filename && item.source == source) {
n++
}
})
if (n == 0) {
if (edit == false) {
self.iframeList.push({ id: self.iframeList.length + 1, title: name, filename: filename, url: $sce.trustAsResourceUrl(url), source: source, edit: edit, show: 1 })
} else {
self.iframeList.push({ id: self.iframeList.length + 1, title: name, filename: filename, url: $sce.trustAsResourceUrl(url), source: source, edit: edit, show: 1, fileid: fileid })
}
self.changeSize(1)
}
}
self.hideItem = function (n) {
self.iframeList[n].show = 2;
self.iframeList[n].boxStyle = { width: 0, float: "left" };
self.changeIframeSize()
}
self.showItem = function (n) {
self.iframeList[n].show = 1;
self.changeIframeSize()
}
self.changeIframeSize = function () {
if (self.iframeList.length == 0) {
} else {
var n = 0;
self.iframeList.forEach(function (item, index) {
if (item.show == 1) {
self.iframeLast = index;
}
if (item.show == 2) {
n = n + 1;
}
})
self.iframeHide = n;
self.iframeShow = self.iframeList.length - self.iframeHide;
for (var i = 0; i < self.iframeList.length; i++) {
if (self.iframeHide != self.iframeList.length) {
if (self.iframeList[i].show == 1) {
self.iframeList[i].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
self.iframeList[i].iframeStyle = { width: self.iframeList[i].boxStyle.width - 10 }
}
if ($(".rightBox").outerWidth() == 15) {
$(".leftBox").css("width", "calc(100% - 15px)");
$(".border-left-right").show()
$(".border-left-right").prev().show()
} else {
showRightBox()
}
} else {
self.iframeList[i].show = 2
self.iframeList[i].boxStyle = { width: 0, float: "left" };
self.seeGCG()
$(".leftBox").css("width", 36)
$(".border-left-right").hide()
$(".border-left-right").prev().hide()
$(".rightBox").css("width", "calc(100% - 36px)")
$("#rightList").show();
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
self.formeditSize()
var marginLeft = $("#rightList").css("margin-left")
if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
} else {
$("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
}
}
}
if (self.iframeShow == 1) {
self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) - 1 }
self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
} else {
self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2) - 1 }
self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
}
}
}
self.changeSize = function (n) {
if (self.iframeList.length == 0) {
$(".rightBox").show();
$("#rightList").show();
$(".rightBox").css("width", $(window).width())
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
self.formeditSize()
var marginLeft = $("#rightList").css("margin-left")
if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
} else {
$("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
}
} else {
if (n == 1 && $(".fa-angle-left").is(":hidden") == false) {
showRightBox()
}
$(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
self.formeditSize()
var marginLeft = $("#rightList").css("margin-left")
if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
} else {
$("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
}
}
var num = 0;
self.iframeList.forEach(function (item, index) {
self.reSize(index)
if (item.show == 1) {
num = num + 1;
self.iframeLast = index;
}
})
self.iframeShow = num;
self.iframeHide = self.iframeList.length - self.iframeShow;
if (self.iframeList.length == 0) {
} else {
if (self.iframeShow == self.iframeList.length) {
self.iframeList.forEach(function (item) {
item.boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
item.iframeStyle = { width: item.boxStyle.width - 10 }
})
self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() / (self.iframeShow == 1 ? 1 : 2)) - 1 }
self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
} else {
for (var i = 0; i < self.iframeList.length; i++) {
if (self.iframeHide != self.iframeList.length) {
if (self.iframeList[i].show == 1) {
self.iframeList[i].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
self.iframeList[i].iframeStyle = { width: self.iframeList[i].boxStyle.width - 10 }
}
if (n == 1) {
if ($(".rightBox").outerWidth() == 15) {
$(".leftBox").css("width", "calc(100% - 15px)");
$(".border-left-right").show()
$(".border-left-right").prev().show()
} else {
showRightBox()
}
}
} else {
self.iframeList[i].show = 2
self.iframeList[i].boxStyle = { width: 0, float: "left" };
self.seeGCG()
$(".leftBox").css("width", 36)
$(".border-left-right").hide()
$(".border-left-right").prev().hide()
$(".rightBox").css("width", "calc(100% - 36px)")
$("#rightList").show();
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
var marginLeft = $("#rightList").css("margin-left")
if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
} else {
$("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
}
}
}
if (self.iframeShow == 1) {
self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) - 1 }
self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
} else {
self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2) - 1 }
self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
}
}
}
}
self.openItem = function (obj) {
window.open(obj.url)
}
self.closeItem = function (n) {
self.iframeList.splice(n, 1)
self.changeSize(1)
}
self.reSize = function (n) {
$timeout(function () {
var leftbox = document.getElementsByClassName("iframe-item")[n];
var rightbox;
var line = document.getElementsByClassName("iframe-border-right")[n];
document.getElementsByClassName("iframe-border-right")[n].addEventListener("mousedown", function (event) {
for (var i = n + 1; i < self.iframeList.length; i++) {
if (self.iframeList[i].show == 1) {
rightbox = document.getElementsByClassName("iframe-item")[i];
break
}
}
$(".mousemove").show()
var leftboxW = leftbox.style.width.slice(0, leftbox.style.width.length - 2);
var rightboxW = rightbox.style.width.slice(0, rightbox.style.width.length - 2);
var x = event.pageX - (line.offsetLeft - leftboxW) - 10;
document.addEventListener("mousemove", boxMove)
function boxMove(event) {
if (leftboxW * 1 + (event.pageX - x) * 1 <= 36) {
//leftbox.children[0].style.display = "none"
self.hideItem(n)
} else if (rightboxW * 1 - (event.pageX - x) * 1 <= 5) {
//rightbox.children[0].style.display = "none"
self.hideItem(i)
} else {
leftbox.children[0].style.display = "block"
leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
self.iframeList[n].boxStyle.width = leftboxW * 1 + (event.pageX - x) * 1;
self.iframeList[n].iframeStyle.width = leftboxW * 1 + (event.pageX - x) * 1 - 10;
rightbox.children[0].style.display = "block"
rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
self.iframeList[i].boxStyle.width = rightboxW * 1 - (event.pageX - x) * 1;
self.iframeList[i].iframeStyle.width = rightboxW * 1 - (event.pageX - x) * 1 - 10;
}
}
document.addEventListener("mouseup", function () {
$(".mousemove").hide()
$scope.$apply();
document.removeEventListener("mousemove", boxMove)
})
})
}, 1)
}
self.reSizeLR = function (n) {
var leftbox = document.getElementsByClassName("page-item")[n - 1];
var rightbox = document.getElementsByClassName("page-item")[n];
var line = document.getElementsByClassName("left-right")[n - 1];
document.getElementsByClassName("left-right")[n - 1].addEventListener("mousedown", function (event) {
$(".mousemove").show()
var leftboxW = leftbox.clientWidth;
var rightboxW = rightbox.clientWidth;
var x = event.pageX - line.offsetLeft;
document.addEventListener("mousemove", boxMove)
function boxMove(event) {
if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
} else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
} else {
leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
$(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".toggle").parent().css("width", $(".formedit").width() - 12)
$scope.changeSize()
}
}
document.addEventListener("mouseup", function () {
$(".mousemove").hide()
document.removeEventListener("mousemove", boxMove)
})
})
}
/*右侧formedit折叠*/self.formeditList = [];
self.hideFormedit = function (num, title) {
$(".formedit" + num).hide();
$(".formedit" + num).siblings().css("width", $(".formedit" + num).width() - (self.iframeHide == self.iframeList.length ? 18 : 36));
self.formeditList.push({ index: num, title: title });
if (self.iframeHide == self.iframeList.length) {
if (self.formeditList.length == 2) {
$(".formedit" + num).siblings().each(function () {
if ($(this).is(":hidden") == false) {
if ($(this).is(":hidden") == false) {
$(this).width("calc(100% - 46px)")
}
}
})
}
self.seeGLJ()
} else {
if (self.formeditList.length == 2) {
$(".formedit" + num).siblings().each(function () {
if ($(this).is(":hidden") == false) {
if ($(this).is(":hidden") == false) {
$(this).width("calc(100% - 36px)")
}
}
})
}
if ($(".formedit1").find("iframe").attr("src") == "") {
self.seeGCG()
} else {
self.seeGLJ()
}
}
$("#rightList").css("margin-left", 0)
$(".toggle").parent().css("width", $(".formedit").width() - 12)
}
self.showFormedit = function (num, obj) {
$(".formedit" + obj.index).show();
self.formeditList.splice(num, 1);
if (self.iframeHide == self.iframeList.length) {
if (self.formeditList.length == 2) {
$(".formedit" + obj.index).width("calc(100% - 46px)")
$("#rightList").css("margin-left", 0)
} else if (self.formeditList.length == 1) {
$(".formedit" + obj.index).width(($(".rightBox").width() - 36) / 2)
$(".formedit" + obj.index).siblings().width(($(".rightBox").width() - 36) / 2)
$("#rightList").css("margin-left", 0)
} else {
$(".formedit" + obj.index).width($(".rightBox").width() / 2)
$(".formedit" + obj.index).siblings().width($(".rightBox").width() / 2)
$("#rightList").css("margin-left", obj.index == "" ? 0 : (obj.index - 1) * $(".formedit" + obj.index).width() * -1)
}
} else {
if (self.formeditList.length > 0) {
$(".formedit" + obj.index).width($(".rightBox").width() - 36)
$(".formedit" + obj.index).siblings().width($(".rightBox").width() - 36)
} else {
$(".formedit" + obj.index).width($(".rightBox").width())
$(".formedit" + obj.index).siblings().width($(".rightBox").width())
}
$("#rightList").css("margin-left", obj.index == "" ? 0 : obj.index * $(".formedit" + obj.index).width() * -1)
}
$(".toggle").parent().css("width", $(".formedit").width() - 12)
}
self.formeditSize = function () {
if (self.iframeHide == self.iframeList.length) {
if (self.formeditList.length == 2) {
$("#rightList").children().each(function () {
if ($(this).is(":hidden") == false) {
$(this).css("width", "calc(100% - 36px)")
}
})
} else if (self.formeditList.length == 1) {
$("#rightList").children().each(function () {
$(this).width(($(".rightBox").width() - 36) / 2)
})
}
} else {
if (self.formeditList.length > 0) {
$("#rightList").children().each(function () {
$(this).width($(".rightBox").width() - 36)
})
}
}
$(".toggle").parent().css("width", $(".formedit").width() - 12)
}
self.getMeetMsg = function () {
var data = {
routeid: self.routeid,
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2work/meetcoop/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.meetList = res.data;
self.meetNum = 0;
self.meetList.forEach(function (item) {
self.meetNum++
item.FILES.forEach(function (item1) {
self.meetNum++
item1.WATCHLIMIT = sp.format(item1.WATCHLIMIT);
})
})
//self.getNumMeet()
})
}
self.getNumMeet = function () {
var data = {
routeinfoid: self.routeinfoid
}
$http.post(apiurljs.login + "g2work/meetcoop/queryDataListCount", data, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.data != self.meetNum) {
self.getMeetMsg()
}
})
}
self.Meeting = function () {
$http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.dpList = res.data;
self.dpList1 = [];
self.dpList.forEach(function (item) {
self.dpList1.push(item)
item.USER.forEach(function (item1) {
item1.show = true;
})
})
self.activeDep = 0;
self.userList = self.dpList1[0].USER;
self.meetUser = [];
sp.layer("#meet")
})
}
self.searchName = "";
self.searchPerson = function () {
self.dpList1 = [];
self.dpList.forEach(function (item) {
if (item.DEP.indexOf(self.searchName) > -1) {
self.dpList1.push(item)
}
})
self.activeDep = 0;
self.userList = self.dpList1[0].USER;
}
self.addmeet = function () {
self.dpList.forEach(function (item) {
item.USER.forEach(function (item1) {
if (item1.checked == true && item1.show == true) {
self.meetUser.push(item1);
item1.checked = false;
item1.show = false;
}
})
})
}
self.delmeet = function () {
self.meetUser.forEach(function (item) {
if (item.checked == true) {
item.checked = false;
item.show = true;
}
})
self.meetUser = self.meetUser.filter(function (item) {
return item.show == false;
})
}
self.joinMeet = function () {
var data = {
tablename: "SX_HYSQBZHWY",
colums: "*",
order: "ID desc",
sqlwhere: { ROUTEINFOID: self.routeinfoid },
sqlinwhere: "",
sqllikewhere: ""
}
$http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
var data1 = {
routeid: self.routeid,
routeinfoid: self.routeinfoid,
cman: self.userId,
cname: res.data[0].BT + "—共享沟通",
userids: self.meetUser.map(function (item) {
return item.USERID
}).join(",")
}
$http.post(apiurljs.login + "g2work/meetcoop/createMeetcoop", data1, postCfg)
.success(function (res1) {
sp.layerhide()
if (res1.success == true) {
self.getMeetMsg()
} else {
sp.dialog(res1.message)
}
})
})
}
self.updateCname = function (item) {
self.meeting = {
type: 1,
updateTitle: "修改会议标题",
meetid: item.MEETID,
cname: item.CNAME
}
sp.layer("#meetUpdate")
}
self.deleteMeet = function (meet) {
var data = {
meetid: meet.MEETID
}
$http.post(apiurljs.login + "g2work/meetcoop/deleteDataByID", data, postCfg)
.success(function (res) {
if (res.success == true) {
$.each(self.iframeList, function (index, item) {
$.each(meet.FILES, function (index1, item1) {
if (item.title == item1.WATCHLIMIT && item.source == item1.FILEURL) {
self.closeItem(index1)
}
})
})
self.getMeetMsg()
} else {
sp.dialog(res.message)
}
})
}
self.updateWatchlimit = function (item) {
self.meeting = {
type: 2,
updateTitle: "修改查看时限",
fileid: item.FILEID,
watchlimit: item.WATCHLIMIT
}
sp.layer("#meetUpdate")
}
self.deleteMFile = function (mfile) {
var data = {
fileid: mfile.MEETID
}
$http.post(apiurljs.login + "g2work/meetcoop/deleteDataFilesByFileID", data, postCfg)
.success(function (res) {
if (res.success == true) {
$.each(self.iframeList, function (index, item) {
if (item.title == mfile.WATCHLIMIT && item.source == mfile.FILEURL) {
self.closeItem(index)
}
})
self.getMeetMsg()
} else {
sp.dialog(res.message)
}
})
}
self.meetUpdate = function () {
if (self.meeting.type == 1) {
var data = {
meetid: self.meeting.meetid,
cname: self.meeting.cname
}
$http.post(apiurljs.login + "g2work/meetcoop/updateCnameByID", data, postCfg)
.success(function (res) {
sp.layerhide()
if (res.success == true) {
self.getMeetMsg()
} else {
sp.dialog(res.message)
}
})
} else {
var data = {
fileid: self.meeting.fileid,
watchlimit: self.meeting.watchlimit
}
$http.post(apiurljs.login + "g2work/meetcoop/updateWatchlimitByFileID", data, postCfg)
.success(function (res) {
sp.layerhide()
if (res.success == true) {
self.getMeetMsg()
} else {
sp.dialog(res.message)
}
})
}
}
////头部关键字搜索---20230905
self.headBtnSearchKeyword = "";
self.headSearchResult = [];
self.headSearchResult_view = false;
self.headBtnSearch = function () {
if (sp.isval(self.headBtnSearchKeyword)) {
self.headSearchResult = [];
var data = {
"url": "/basic/api/StatSelect/selectCodeList",
"data": { "keyWord": self.headBtnSearchKeyword }
}
$http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.headSearchResult = res.data.build;
if (sp.isval(self.headSearchResult)) {
self.headSearchResult_view = true;
} else {
self.headSearchResult_view = false;
}
})
} else {
self.headSearchResult_view = false;
}
};
self.headKeywordPage = function (itemdata) {
var get_token = localStorage.getItem("main-token");
var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
self.addItem(set_url, set_url, '一张图', false);
self.headSearchResult_view = false;
};
self.onePic = function () {
self.addItem(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索", false)
}
$scope.changeSize = function (n) {
self.changeSize(2)
if (n == 1) {
$scope.$apply();
}
}
$scope.openOptionList1 = function () {
$timeout(function () {
self.openOptionList1()
})
}
$scope.closeToggle = function () {
$timeout(function () {
self.opinion.nulla = false;
self.activeOpinion = null;
})
}
$scope.refreshGLJ = function (n) {
if (n == 1) {
self.getGLJ(2)
} else {
self.getGLFLOW()
}
}
//头部下滚冻结
$(function () {
//页面高度撑满
setTimeout(function () {
$(".rightBox").css("height", $(window).height() - 115)
$(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
if (self.lastrouteinfoid == 0) {
$(".rightBox").css("width", $(window).width())
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
} else {
$(".rightBox").css("width", "50%")
$(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
}
$(".toggle").parent().css("width", $(".formedit").width() - 12)
}, 1)
$(window).resize(function () {
$(".rightBox").css("height", $(window).height() - 115)
$(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
if (self.iframeList.length == 0) {
$(".rightBox").css("width", $(window).width())
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
self.formeditSize()
} else if (self.iframeList.length > 0 && self.iframeHide == self.iframeList.length) {
$(".rightBox").css("width", "calc(100% - 36px)")
$(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
self.formeditSize()
} else {
$(".rightBox").css("width", "50%")
$(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
self.formeditSize()
}
$(".toggle").parent().css("width", $(".formedit").width() - 12)
if (self.iframeList.length > 0) {
$("#iframeList").css("height", $(window).height() - 115)
if (self.iframeList.length == 1) {
self.iframeList[0].boxStyle = { width: $(".leftBox").width() }
self.iframeList[0].iframeStyle = { width: $(".leftBox").width() - 10 }
} else {
self.iframeList.forEach(function (item) {
item.boxStyle = { width: Math.trunc($(".leftBox").width() / 2 / (self.iframeList.length - 1)) }
item.iframeStyle = { width: item.boxStyle.width - 10 }
})
self.iframeList[self.iframeList.length - 1].boxStyle = { width: Math.trunc($(".leftBox").width() / 2) - 1 }
self.iframeList[self.iframeList.length - 1].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
}
$scope.$apply();
}
})
})
}])
app.directive("repeatFinish", function () {
return {
link: function (scope) {
if (scope.$last == true) {
$("#iframeList").css("height", $(window).height() - 115)
}
}
};
});
app.directive("spCheckboxBlueItem", function () {
return {
restrict: "A",
link: function (scope, elem, attrs) {
if (!scope == false) {
spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
}
}
}
});
app.filter('trustHtml', function ($sce) {
return function (input) {
return $sce.trustAsHtml(input.replace(/\n/g, '
').replace(/\s/g, ' '));
};
});
//canvas画布签字
function lineCanvas(obj) {
var self = this;
self.linewidth = 1;
self.color = "#000000";
self.background = "#ffffff";
self.canvas = document.createElement("canvas");
document.getElementById(obj).appendChild(self.canvas);
self.cxt = self.canvas.getContext("2d");
self.canvas.width = document.getElementById(obj).clientWidth;
self.canvas.height = document.getElementById(obj).scrollHeight;
self.cxt.fillStyle = self.background;
self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
self.cxt.strokeStyle = self.color;
self.cxt.lineWidth = self.linewidth;
self.cxt.lineCap = "round";
//开始绘制
self.canvas.addEventListener("mousedown", function (e) {
self.cxt.beginPath();
self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
self.canvas.addEventListener("mousemove", move)
}.bind(self), false);
//绘制中
function move() {
var e = window.event;
self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
self.cxt.stroke();
}
//结束绘制
self.canvas.addEventListener("mouseup", up)
function up() {
self.cxt.closePath();
self.canvas.removeEventListener("mousemove", move)
}
};
function showRightBox() {
$(".leftBox").css("width", "50%");
$(".rightBox").css("width", "50%")
$(".rightBox").show();
$("#rightList").show();
$(".border-left-right").show()
$(".border-left-right").prev().show()
$(".border-left-right").prev().find(".fa-angle-right").show()
$(".border-left-right").prev().find(".fa-angle-left").hide()
if ($("#rightList").prev().is(":hidden") == true) {
$(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
} else {
$(".formedit").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
$(".formedit1").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
$(".formedit2").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
}
angular.element(document.getElementById("app")).scope().changeSize(2)
}
function showRight(e) {
if ($(e).children(".fa-angle-left").is(":hidden")) {
$(".leftBox").css("width", "calc(100% - 15px)");
$(".rightBox").css("width", "15px");
$(e).siblings().hide()
$(e).children(".fa-angle-left").show()
$(e).children(".fa-angle-right").hide()
} else {
$(".leftBox").css("width", "50%");
$(".rightBox").css("width", "50%");
$(e).siblings().show()
$(e).children(".fa-angle-left").hide()
$(e).children(".fa-angle-right").show()
}
angular.element(document.getElementById("app")).scope().changeSize(1)
}
function showToggle(e) {
document.getElementById("selectDiv").style.top = e.style.top;
//document.getElementById("selectDiv").toggle();
$(e).children().toggle()
$(e).next().toggle()
}
function toggleYJL(e) {
if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
$(e).parent().css("height", 420)
angular.element(document.getElementById("app")).scope().openOptionList1()
} else {
$(e).parent().css("height", 10)
angular.element(document.getElementById("app")).scope().closeToggle()
}
$(e).children().toggle()
}
function toggleForm(e) {
$(e).children().toggle()
$(".toggleForm").toggle()
}
function refreshGLJ(n) {
angular.element(document.getElementById("app")).scope().refreshGLJ(n)
}
//文字不可被选中
document.body.onselectstart = function () {
return false;
}