12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $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.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");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
- //上层附件、业务参考、共享沟通组件
- self.uploading = false;
- self.upload = function () {
- var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
- return item.CNAME
- })
- $('#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.openOptionList = function () {
- if (self.routeinfoid == 0 && self.routeid == 0) {
- sp.dialog("请先保存!")
- return;
- }
- if (self.opinion.nulla == true) {
- return;
- }
- self.nulla = "";
- $(".optionList").css("height", 149)
- self.opinion.nulla = true;
- }
- self.closeOptionList = function () {
- $(".optionList").css("height", 389)
- self.opinion.nulla = false;
- }
- self.submitOptionList = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: "FW_ZB",
- 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();
- self.opinion.nulla = false;
- $(".optionList").css("height", 389)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.changeOptionList = function (item) {
- self.nulla = item.OPINION;
- self.opinion.nulla = true;
- }
- self.deleteFile = function (file) {
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.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) {
- self.getOther();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- });
- }
- self.goAttach = function (obj) {
- if (obj) {
- if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
- sp.dialog("文件暂不支持在线预览,请点击下载查看!")
- return
- }
- $("#attachlist")[0].contentWindow.openFile(obj)
- if ($(".fa-chevron-down").is(":hidden") == true) {
- showToggle(document.getElementById("toggleButton"))
- }
- } else {
- if ($("#attachlist").attr("src") == '') {
- $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
- }
- }
- }
-
-
- self.readonly = {
- NF: false,
- YF: false,
- SQDW: false,
- TWODAY: false,
- LSH: false,
- ZB: false,
- ZBREMARK: false,
- SPYJ: false
- }
- self.show = {
- ZBREMARK: false,
- SPYJ: false
- }
- //初始化右上角按钮
- self.buttonList = []
- self.yearList = [];
- for (var i = 0; i < 11; i++) {
- if (i < 5) {
- self.yearList.push(sp.currentYear() * 1 - 5 + i)
- } else if (i == 5) {
- self.yearList.push(sp.currentYear())
- } else if (i > 5) {
- self.yearList.push(sp.currentYear() * 1 + i - 5)
- }
- }
- self.times = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12",
- "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"]
- 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.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) {
- if (item.TEMPFORM.indexOf("formedit.html") > -1) {
- self.Title = item.VNAME;
- }
- if (item.TEMPFORM.indexOf("?docmode") > 0) {
- if (item.TEMPFORM.indexOf("attachlist") > -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.getDP()
- self.getFLOW()
- self.getOther()
- } else {
- self.getData()
- }
- })
- }
- self.getSwenList(0)
- 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.getYF1();
- })
- }
- self.getYF1 = function () {
- var data = {
- tablename: "SX_YFZBB",
- colums: "YF",
- order: "ID",
- sqlwhere: { SQDWCODE: self.userDpCode },
- 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.YF1 = res.data;
- self.getYF()
- })
- }
- self.getYF = function () {
- var data = {
- ckey: "CODE_ZBYF",
- 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.YF = res.data.CODE_ZBYF;
- self.nextYF = self.YF[0].CODE
- self.YF.forEach(function (item) {
- //item.disabled = false;
- //self.YF1.forEach(function (item1) {
- // if(item.CODE==item1.YF){
- // item.disabled = true;
- // }
- //})
- if (item.CNAME == sp.currentMonth() + 1 && sp.currentMonth() < 12) {
- self.nextYF = item.CODE;
- }
- })
- self.getXQ()
- })
- }
- self.getXQ = function () {
- var data = {
- ckey: "CODE_ZBXQ",
- 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.XQ = res.data.CODE_ZBXQ;
- self.getZBSJ()
- })
- }
- self.getZBSJ = function () {
- var data = {
- ckey: "CODE_ZHIBANTIMEZSDW",
- 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.ZBSJ = res.data.CODE_ZHIBANTIMEZSDW;
- self.getDBLD()
- })
- }
- self.getDBLD = function () {
- var data = {
- tablename: "SX_ZHIBANRYGL",
- colums: "*",
- order: "ID",
- sqlwhere: { "MANMARK": "C01" },
- 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.DBLD = res.data;
- self.getUserList()
- })
- }
- self.getUserList = function () {
- $http.post(apiurljs.login + "g2work/datazu/queryDataUserList", { data: s4.encryptData_CBC(JSON.stringify({ "zid": "AA", "levels": "0" })) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.userList = res.data;
- self.userList.forEach(function (item) {
- item.users.forEach(function (item1) {
- item1.checked = false;
- item1.ushowname1 = item1.ushowname.length > 3 ? item1.ushowname.slice(0, 3) + "..." : item1.ushowname;
- item1.ushowname2 = item1.ushowname.length > 10 ? item1.ushowname.slice(0, 10) + "..." : item1.ushowname
- })
- })
- self.getData()
- })
- }
- self.getZBXZ = function () {
- $http.get("../js/zbxz2.txt")
- .success(function (res) {
- self.zbxzMR = res.NR;
- self.getData()
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "SX_YFZBB",
- 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_YFZBB.ID,
- NF: res.data.SX_YFZBB.NF == "" ? (self.nextYF == "C01" ? parseInt(sp.currentYear()) + 1 : parseInt(sp.currentYear())) : res.data.SX_YFZBB.NF,
- YF: res.data.SX_YFZBB.YF == "" ? self.nextYF : res.data.SX_YFZBB.YF,
- SQDW: res.data.SX_YFZBB.SQDW == "" ? self.userDpName : res.data.SX_YFZBB.SQDW,
- TWODAY: res.data.SX_YFZBB.TWODAY == "true",
- LSH: res.data.SX_YFZBB.LSH == "" ? "" : res.data.SX_YFZBB.LSH,
- //ZBREMARK: res.data.SX_YFZBB.ZBREMARK == "" ? self.zbxzMR : res.data.SX_YFZBB.ZBREMARK,
- ZBSJREMARK: res.data.SX_YFZBB.ZBSJREMARK == "" ? "上午08:00—14;00;下午14:00—20:00;夜间20:00—08:00" : res.data.SX_YFZBB.ZBSJREMARK,
- ZBDH: res.data.SX_YFZBB.ZBDH,
- ZBCZ: res.data.SX_YFZBB.ZBCZ,
- YJJJRZBDH: res.data.SX_YFZBB.YJJJRZBDH,
- YJJJRZBCZ: res.data.SX_YFZBB.YJJJRZBCZ,
- ZBDD: res.data.SX_YFZBB.ZBDD,
- TBR: res.data.SX_YFZBB.TBR == "" ? self.userName : res.data.SX_YFZBB.TBR,
- REMARK: res.data.SX_YFZBB.REMARK,
- SQRUSERID: res.data.SX_YFZBB.SQRUSERID == "" ? self.userId : res.data.SX_YFZBB.SQRUSERID,
- SQDWCODE: res.data.SX_YFZBB.SQDWCODE == "" ? self.userDpCode : res.data.SX_YFZBB.SQDWCODE
- };
- self.YF.forEach(function (item) {
- if (self.data.YF == item.CODE) {
- self.data.YF1 = item.CNAME;
- }
- })
- self.readonly = {
- NF: res.data.SX_YFZBB["NF.EREADONLY"] == "true",
- YF: res.data.SX_YFZBB["YF.EREADONLY"] == "true",
- SQDW: res.data.SX_YFZBB["SQDW.EREADONLY"] == "true",
- TWODAY: res.data.SX_YFZBB["TWODAY.EREADONLY"] == "true",
- LSH: res.data.SX_YFZBB["LSH.EREADONLY"] == "true",
- ZB: res.data.SX_YFZBB["ZB.EREADONLY"] == "true",
- ZBSJREMARK: res.data.SX_YFZBB["ZBSJREMARK.EREADONLY"] == "true",
- ZBDH: res.data.SX_YFZBB["ZBDH.EREADONLY"] == "true",
- ZBCZ: res.data.SX_YFZBB["ZBCZ.EREADONLY"] == "true",
- YJJJRZBDH: res.data.SX_YFZBB["YJJJRZBDH.EREADONLY"] == "true",
- YJJJRZBCZ: res.data.SX_YFZBB["YJJJRZBCZ.EREADONLY"] == "true",
- ZBDD: res.data.SX_YFZBB["ZBDD.EREADONLY"] == "true",
- //TBR: res.data.SX_YFZBB["TBR.EREADONLY"] == "true",
- REMARK: res.data.SX_YFZBB["REMARK.EREADONLY"] == "true",
- //ZBREMARK: res.data.SX_YFZBB["ZBREMARK.EREADONLY"] == "true",
- SPYJ: res.data.SX_YFZBB["SPYJ.EREADONLY"] == "true"
- }
- self.show = {
- ZBREMARK: res.data.SX_YFZBB["ZBREMARK.ESHOW"] == "true",
- SPYJ: res.data.SX_YFZBB["SPYJ.ESHOW"] == "true"
- }
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- self.buttonList = res.data["SX_YFZBB.FUNCLIST"];
- self.getChildList()
- self.getOpinion('SPYJ')
- })
- }
- self.getLSH = function () {
- var data = {
- length: 3,
- cyear: sp.currentYear(),
- cmonth: self.data.YF1
- }
- $http.post(apiurljs.login + "g2app/ZhiBan/queryZhiBanLSH_ZSDW", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.LSH = res.data;
- self.data.LSH = self.LSH.YEAR + self.LSH.MONTH + self.LSH.NUMBER
- })
- }
- //获取附件和插件
- self.getOther = function () {
- var data = {
- tablename: "FILE_ATTACH",
- 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));
- self.arrayFile1 = [];
- if (res.data.length > 0) {
- res.data.forEach(function (item) {
- if (item.ATTACHTYPE.indexOf("-正文") > -1) {
- self.arrayFile = item;
- } else {
- self.arrayFile1.push(item)
- }
- })
- }
- })
- }
-
- self.getChildList = function () {
- var data = {
- tablename: "SX_YFZBB_01",
- colums: "*",
- order: "ID",
- sqlwhere: { PID: self.data.ID },
- 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.list = res.data;
- self.AddFlag = false;
- self.EditFlag = false;
- self.list.forEach(function (item) {
- item.editFlag = false;
- item.RIQI = formate(item.RIQI);
- //self.XQ.forEach(function (item1) {
- // if (item.XINGQI == item1.CODE) {
- // item.XINGQI1 = item1.CNAME
- // }
- //})
- self.ZBSJ.forEach(function (item1) {
- if (item.ZBSJ == item1.CODE) {
- item.ZBSJ2 = item1.CNAME
- }
- })
- })
- self.getRiQiList()
- })
- }
- //导入
- self.upload3 = function () {
- $('#fileupload3').fileupload({
- url: apiurljs.login + 'g2app/ZhiBan/impExecl_PRZB_ZSDW',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SX_YFZBB,id=" + self.data.ID + ",code_table=CODE_ZHIBANTIMEZSDW,mobanname=mobanzsdw.xlsx,cyear=" + self.data.NF + ",cmonth=" + formate(self.data.YF1)));
- },
- add: function (e, data) {
- self.uploading = true;
- data.submit();
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading = false;
- self.getSwenList(1)
- sp.layerhide()
- }
- })
- }
- //下载当月模板
- self.downloadMonth = function () {
- var eleLink = document.createElement('a');
- eleLink.download = "";
- eleLink.style.display = 'none';
- console.log(s4.encryptData_CBC("mobanname=mobanzsdw.xlsx&code_table=CODE_ZHIBANTIMEZSDW&title=市住房城乡建设委直属单位" + self.data.NF + "年" + self.data.YF1 + "月份值班表&id=" + self.data.ID + "&cyear=" + self.data.NF + "&cmonth=" + formate(self.data.YF1)))
- eleLink.href = apiurljs.login + "g2app/zhiban/ExpZhiBanMoBan?data=" + encodeURIComponent(s4.encryptData_CBC("mobanname=mobanzsdw.xlsx&code_table=CODE_ZHIBANTIMEZSDW&title=市住房城乡建设委直属单位" + self.data.NF + "年" + self.data.YF1 + "月份值班表&id=" + self.data.ID + "&cyear=" + self.data.NF + "&cmonth=" + formate(self.data.YF1)));
- // 触发点击
- document.body.appendChild(eleLink);
- eleLink.click();
- // 然后移除
- document.body.removeChild(eleLink);
- }
- //初始化子表
- self.childInit = function () {
- self.cyearList = [];
- for (var i = 0; i < 6; i++) {
- if (i < 5) {
- self.cyearList.push(sp.currentYear() * 1 - 5 + i)
- } else if (i == 5) {
- self.cyearList.push(sp.currentYear())
- }
- }
- self.target = {
- cyear: sp.currentMonth() == 1 ? sp.currentYear() * 1 - 1 : sp.currentYear() * 1,
- cmonth: sp.currentMonth() == 1 ? 12 : sp.currentMonth() * 1
- }
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">您确认要初始化" + self.data.NF + "年" + self.data.YF1 + "月值班信息吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='DataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.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
- $("#DataTrue").click(function () {
- sp.dialoghide()
- self.btnSave(4)
- });
- }
- self.btnInit = function () {
- var data = {
- tablename: "SX_YFZBB_01",
- columns: "NYBIAOSHI",
- sqlwhere: { NYBIAOSHI: self.data.NF + "-" + formate(self.data.YF1), PID: self.data.ID },
- sqlinwhere: {},
- sqllikewhere: {}
- }
- $http.post(apiurljs.login + "g2app/Data/QueryCountByTablenameWithCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.data > 0) {
- sp.dialog("当月已有数据!")
- } else {
- var data = {
- cyear: self.data.NF,
- cmonth: self.data.YF1,
- id: self.data.ID
- }
- $http.post(apiurljs.login + "g2app/zhiban/InitPRZBZSDWZhibanMan", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- self.getChildList()
- })
- }
- })
- }
- //获取意见(上表)
- self.getOpinion = function (str) {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SX_YFZBB",
- colid: str,
- opiniontype: 0,
- 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) {
- self.YJ[str] = res.data;
- self.YJ[str + "STATUS"] = false;
- self.YJ[str].forEach(function (item) {
- item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
- if (item.ROUTEID == self.routeid) {
- self.YJ[str + "STATUS"] = true;
- }
- })
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //判断页面字段是否只读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 "MEETITEM": self.Meet(); break;
- case "SENDLOG": self.RouteList(); break;
- default: self.forward(item); break;
- }
- }
- //保存提交
- self.btnSave = function (n) {
- if (spngvld.submit("#topDiv")) {
- var dataArray = [];
- dataArray.push(self.data);
- var data = {
- ckey: "SX_YFZBB",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.NF + "年" + self.data.YF1 + "月月份值班",//self.data.TITLE,
- 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;
- self.filedChange = false;
- 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.RYADD()
- } else if (n == 4) {
- self.btnInit()
- }
- } else {
- sp.dialog(res.message)
- }
- })
- }
- }
- //获取所选年月所有日期
- self.getRiQiList = function () {
- self.RiQiList = [];
- self.YF.forEach(function (item) {
- if (self.data.YF == item.CODE) {
- self.data.YF1 = item.CNAME;
- }
- })
- var lastDay = sp.getLastDayOfMonth(self.data.NF, self.data.YF1);
- var n = lastDay.slice(lastDay.length - 2, lastDay.length)
- for (var i = 1; i <= n; i++) {
- self.RiQiList.push({ date: formate(i) })
- }
- if (self.data.LSH == "") {
- self.getLSH()
- }
- }
- //值班人员添加
- self.RYADD = function () {
- self.AddFlag = true;
- self.editFlag = true;
- self.edit = {
- ID: 0,
- RIQI: formate(new Date().getDate()),
- DBLDXM: "",
- ZW: "",
- BGGH: "",
- SJHM: "",
- ZBGBXM1: "",
- ZBGBXM1SJHM: "",
- ZBGBXM2: "",
- ZBGBXM2SJHM: "",
- ZBSJ: self.ZBSJ[0].CODE,
- XINGQI: ""
- };
- self.checkDate()
- if (self.data.ID == 0) {
- self.btnSave(3)
- }
- }
- //值班人员编辑
- self.RYEDIT = function (item) {
- self.EditFlag = true;
- item.editFlag = true;
- self.edit = {
- ID: item.ID,
- RIQI: item.RIQI,
- DBLDXM: item.DBLDXM,
- ZW: item.ZW,
- BGGH: item.BGGH,
- SJHM: item.SJHM,
- ZBGBXM1: item.ZBGBXM1,
- ZBGBXM1SJHM: item.ZBGBXM1SJHM,
- ZBGBXM2: item.ZBGBXM2,
- ZBGBXM2SJHM: item.ZBGBXM2SJHM,
- ZBSJ: item.ZBSJ,
- XINGQI: item.XINGQI
- };
- //self.XQ.forEach(function (item1) {
- // if (item1.CNAME == self.edit.XINGQI) {
- // self.edit.XINGQI = item1.CODE
- // }
- //})
- }
- self.RYSAVE = function () {
- var ushowname = [self.edit.DBLDXM, self.edit.ZBGBXM1, self.edit.ZBGBXM2].filter(function (item) {
- return item != ""
- })
- var data = {
- ushowname: ushowname.join("|")
- }
- $http.post(apiurljs.login + "g2app/ZhiBan/queryManUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- for (var i in res.data) {
- if (i == self.edit.DBLDXM) {
- self.edit.DBLDXMUSERID = res.data[i];
- } else if (i == self.edit.ZBGBXM1) {
- self.edit.ZBGBXMUSERID1 = res.data[i];
- } else if (i == self.edit.ZBGBXM2) {
- self.edit.ZBGBXMUSERID2 = res.data[i];
- }
- }
- if (self.edit.ID == 0) {
- var text = JSON.stringify({
- PID: self.data.ID,
- RIQI: self.edit.RIQI,
- DBLDXM: self.edit.DBLDXM,
- DBLDXMUSERID: self.edit.DBLDXMUSERID,
- ZW: self.edit.ZW,
- BGGH: self.edit.BGGH,
- SJHM: self.edit.SJHM,
- ZBGBXM1: self.edit.ZBGBXM1,
- ZBGBXMUSERID1: self.edit.ZBGBXMUSERID1,
- ZBGBXM1SJHM: self.edit.ZBGBXM1SJHM,
- ZBGBXM2: self.edit.ZBGBXM2,
- ZBGBXMUSERID2: self.edit.ZBGBXMUSERID2,
- ZBGBXM2SJHM: self.edit.ZBGBXM2SJHM,
- ZBSJ: self.edit.ZBSJ,
- XINGQI: self.edit.XINGQI
- })
- var data = {
- tablename: "SX_YFZBB_01",
- id: 0,
- data: text
- }
- $http.post(apiurljs.login + "g2app/dataabase/saveChildData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getChildList();
- sp.dialog("添加成功!")
- $timeout(function () {
- sp.dialoghide()
- }, 2000)
- } else {
- sp.dialog(res.message)
- }
- })
- } else {
- var text = JSON.stringify({
- RIQI: self.edit.RIQI,
- DBLDXM: self.edit.DBLDXM,
- DBLDXMUSERID: self.edit.DBLDXMUSERID,
- ZW: self.edit.ZW,
- BGGH: self.edit.BGGH,
- SJHM: self.edit.SJHM,
- ZBGBXM1: self.edit.ZBGBXM1,
- ZBGBXMUSERID1: self.edit.ZBGBXMUSERID1,
- ZBGBXM1SJHM: self.edit.ZBGBXM1SJHM,
- ZBGBXM2: self.edit.ZBGBXM2,
- ZBGBXMUSERID2: self.edit.ZBGBXMUSERID2,
- ZBGBXM2SJHM: self.edit.ZBGBXM2SJHM,
- ZBSJ: self.edit.ZBSJ,
- XINGQI: self.edit.XINGQI
- })
- var data = {
- tablename: "SX_YFZBB_01",
- id: self.edit.ID,
- data: text
- }
- $http.post(apiurljs.login + "g2app/dataabase/saveChildData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- var data1 = {
- tablename: "SX_YFZBB",
- id: self.data.ID,
- data: {
- LSH: (parseInt(self.data.LSH) + 1).toString()
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.success == true) {
- self.getData();
- sp.dialog("编辑成功!")
- $timeout(function () {
- sp.dialoghide()
- }, 2000)
- } else {
- sp.dialog(res.message)
- }
- })
- $timeout(function () {
- sp.dialoghide()
- }, 2000)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- })
- }
- self.btnDel = function (item) {
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.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: "SX_YFZBB_01",
- id: item.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) {
- self.getChildList();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- });
- }
- self.openUserList = function (str) {
- self.filed = str;
- self.userList.forEach(function (item) {
- item.users.forEach(function (item1) {
- item1.checked = false;
- if (item1.ushowname == self.edit[self.filed]) {
- item1.checked = true;
- }
- })
- })
- sp.layer("#userList")
- $("#userList .sp-page").eq(0).scrollTop(0);
- }
- self.checkUser = function (item) {
- $.each(self.userList, function (x, y) {
- $.each(y.users, function (x1, y1) {
- y1.checked = y1.userid == item.userid;
- if (y1.checked == true) {
- self.edit[self.filed] = y1.ushowname;
- if (self.filed == "DBLDXM") {
- self.edit.ZW = y.section
- self.edit.DBLDXMUSERID = y1.userid;
- } else if (self.filed == "ZBGBXM1") {
- self.edit.ZBGBXMUSERID1 = y1.userid;
- } else if (self.filed == "ZBGBXM2") {
- self.edit.ZBGBXMUSERID2 = y1.userid;
- }
- }
- })
- })
- }
- self.openDateList = function () {
- self.RiQiList.forEach(function (item) {
- item.checked = false;
- if (item.date == self.edit.RIQI) {
- item.checked = true;
- }
- })
- sp.layer("#dateList")
- }
- self.checkDate = function () {
- var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
- //self.XQ.forEach(function (item) {
- // if (item.CNAME == weeks[new Date(self.data.NF + "-" + self.data.YF1 + "-" + self.edit.RIQI).getDay()]) {
- // self.edit.XINGQI = item.CODE;
- // }
- //})
- }
- self.changeLD = function () {
- self.DBLD.forEach(function (item) {
- if (item.CNAME == self.edit.DBLDXM) {
- self.edit.DBLDXMUSERID = item.USERID;
- self.edit.ZW = item.ZHIWU;
- self.edit.BGGH = item.TEL;
- self.edit.SJHM = item.MOBILEPHONE;
- }
- })
- }
- //前端导出
- self.printOut = function () {
- if (self.canExportExcel) {
- $('#printOut td').attr('t', 's')
- var defaultCellStyle = {
- font: {
- name: 'Times New Roman',
- sz: 12,
- color: {
- rgb: "000000"
- },
- bold: false, italic: false,
- underline: false
- },
- alignment: {
- vertical: "center",
- horizontal: "center", indent: 0, wrapText: true
- },
- border: {
- top: {
- style: "thin",
- color: {
- rgb: "000000"
- }
- },
- right: {
- style: "thin",
- color: {
- rgb: "000000"
- }
- },
- bottom: {
- style: "thin",
- color: {
- rgb: "000000"
- }
- },
- left: {
- style: "thin",
- color: {
- rgb: "000000"
- }
- }
- }
- };
- var cell = { defaultCellStyle: defaultCellStyle };
- var wb = XLSX.utils.table_to_book_addtitle(document.querySelector('#printOut'), cell, "市住房城乡建设委机关" + self.data.NF + "年" + self.data.YF1 + "月份值班表")
-
- //设置表格的样式
- var wbout = XLSX.write(wb, {
- bookType: 'xlsx',
- bookSST: false,
- type: 'binary',
- cellStyles: true,
- defaultCellStyle: defaultCellStyle,
- showGridLines: false
- });
- var s2ab = function (s) {
- var buf = new ArrayBuffer(s.length);
- var view = new Uint8Array(buf);
- for (var i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
- return buf;
- };
- try {
- saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), '市住房城乡建设委机关' + self.data.NF + '年' + self.data.YF1 + '月份值班表.et')
- } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout) }
- return wbout
- } else {
- sp.dialog('数据还未加载完成,请稍等...')
- }
- }
-
- //签写意见编辑状态
- self.opinion = {
- SPYJ: false,
- SPYJImg: false
- }
- self.YJ = {
- SPYJ: [],
- SPYJSTATUS: false
- }
- //下载意见表附件
- self.downLoadOption = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
- }
- //删除意见表附件
- self.deleteOptionFile = function (file, str) {
- var data = {
- routeid: file.ROUTEID,
- tableid: "SX_YFZBB",
- colid: str,
- 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) {
- if (str != "") {
- self.getOpinion(str);
- } else {
- self.getOpinion1();
- }
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- }
- //意见附件(上表)
- 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_YFZBB,colid=" + str));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading1 = false;
- self.getOpinion(str)
- }
- })
- }
- //签写意见
- 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();
- }
- //opiniontype:0上表,99不上表
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: "SX_YFZBB",
- 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.getOpinion(str);
- self.opinion[str] = false;
- self.opinion[str + "Img"] = false;
- self.data[str] = "";
- self.changeFiled(str)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //删除意见
- self.Dopinion = function (str, item) {
- var data = {
- cmanid: self.userId,
- routeid: self.routeid,
- tableid: "SX_YFZBB",
- 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) {
- if (str != "") {
- self.getOpinion(str);
- } else {
- self.getOpinion1();
- }
- 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_YFZBB",
- 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_YFZBB",
- 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) {
- self.opinion[str + "Img"] = true;
- setTimeout(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.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=zhibanmgr")
- sp.layer("#forward")
- }
- }
- //查看流转记录
- 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], "流程图")
- }
- //var data = {
- // directionid: self.directionid,
- // userid: self.userId,
- // routeid: self.routeid,
- // routeinfoid: self.routeinfoid,
- //}
- //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- //.success(function (obj) {
- // var res = strToJson(s4.decryptData_CBC(obj.data));
- // self.routeList = res.data;
- // $.each(self.routeList, function (index, item) {
- // item.mainUser = [];
- // item.copyUsers = [];
- // $.each(item.USERS, function (index1, item1) {
- // if (item1.KIND == 0) {
- // item.mainUser.push(item1.USERNAME);
- // } else {
- // item.copyUsers.push(item1.USERNAME);
- // }
- // })
- // item.mainUser = item.mainUser.join(",");
- // item.copyUsers = item.copyUsers.join(",");
- // })
- // setTimeout(function (item) {
- // sp.layer("#RouteList");
- // }, 100);
- //})
- }
-
- self.active = null;
- self.activeItem = function (obj,str,n) {
- if (self.active == null) {
- self.active = obj;
- } else {
- self.active = null;
- }
- console.log(obj, str, n)
- }
- self.reSizeRow = function () {
- var bodybox = document.getElementById("bodyDiv");
- var topbox = document.getElementById("topDiv");
- var bottombox = document.getElementById("bottomDiv");
- var line = document.getElementById("lineDiv");
- document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
- $(".mousemove").show()
- var bodyboxH = bodybox.clientHeight;
- var topboxH = topbox.clientHeight;
- var bottomboxH = bottombox.clientHeight;
- //var y = event.pageY - line.offsetTop;
- var y = event.pageY - line.clientHeight;
- document.addEventListener("mousemove", boxMove)
- function boxMove(event) {
- if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
- //
- } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
- //
- } else {
- topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
- //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
-
- bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
- bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
- }
- }
- document.addEventListener("mouseup", function () {
- $(".mousemove").hide()
- document.removeEventListener("mousemove", boxMove)
- })
- })
- }
- ////头部关键字搜索---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 }
- }
- //console.log(JSON.stringify(data));
- $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));
- //console.log(JSON.stringify(res.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;
- $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
- self.headSearchResult_view = false;
- };
- self.onePic = function () {
- $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
- }
-
- //头部下滚冻结
- $(function () {
- $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
- $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
-
- //$("body").bind("scroll", function () {
- // var scrollTop = $("body").scrollTop();
- // if (scrollTop == 0) {
- // $(".FixTop").removeClass("FixTop");
- // }
- // if (scrollTop > 35) {
- // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
- // }
- //});
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
- }, 1)
- })
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$last == true) {
- setTimeout(function () {
- $(".zb-table").rowspan(1)
- $(".zb-table").rowspan(0)
- }, 10);
- }
- }
- };
- });
- app.filter('trustHtml', function ($sce) {
- return function (input) {
- return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').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 - document.getElementById(obj).offsetLeft, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop());
- self.canvas.addEventListener("mousemove", move)
- }.bind(self), false);
- //绘制中
- function move() {
- var e = window.event;
- self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop());
- self.cxt.stroke();
- }
- //结束绘制
- self.canvas.addEventListener("mouseup", up)
- function up() {
- self.cxt.closePath();
- self.canvas.removeEventListener("mousemove", move)
- }
- };
- function formate(n) {
- return n * 1 > 9 ? n * 1 : "0" + n * 1;
- }
- function getNum(arr, name) {
- var n = -1;
- $.each(arr, function (index, item) {
- if (item.CNAME == name) {
- n = index
- }
- })
- return n
- }
- function isNull(str) {
- if (str == "" || str == null || str == undefined) {
- return false
- } else {
- return true
- }
- }
- jQuery.fn.rowspan = function (colIdx) { //封装的一个JQuery小插件
- return this.each(function () {
- var that;
- $('tr', this).each(function (row) {
- $('td:eq(' + colIdx + ')', this).filter(':visible').each(function (col) {
- if (that != null && $(this).html() == $(that).html()) {
- var rowspan = $(that).attr("rowSpan");
- if (rowspan == undefined) {
- $(that).attr("rowSpan", 1);
- rowspan = $(that).attr("rowSpan");
- }
- rowspan = Number(rowspan) + 1;
- $(that).attr("rowSpan", rowspan);
- $(this).remove();
- } else {
- that = this;
- }
- });
- });
- });
- }
- function showToggle(e) {
- $(e).children().toggle()
- $(e).next().toggle()
- }
- function toggleYJL(e) {
- if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
- $("#topDiv").css("height", 160)
- $(e).parent().css("height", 450)
- $("#attachlist").css("height", 200)
- $("#bottomDiv").css("height", "")
- } else {
- $("#topDiv").css("height", 600)
- $(e).parent().css("height", 10)
- }
- $(e).children().toggle()
- }
|