123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533 |
- '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.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.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_ZHIBANTIME",
- 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_ZHIBANTIME;
- self.getDBLD()
- })
- }
- self.getDBLD = function () {
- var data = {
- tablename: "SX_ZHIBANRYGL",
- colums: "*",
- order: "ID",
- sqlwhere: "",
- sqlorwhere: "",
- sqlinwhere: { "MANMARK": "'C01','C02'" },
- 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.getZBXZ()
- })
- }
- self.getZBXZ = function () {
- $http.get("../js/zbxz1.txt")
- .success(function (res) {
- self.zbxzMR = res.NR;
- self.getData()
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "SX_PRZBB",
- 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_PRZBB.ID,
- NF: res.data.SX_PRZBB.NF == "" ? parseInt(sp.currentYear()) : res.data.SX_PRZBB.NF,
- YF: res.data.SX_PRZBB.YF == "" ? self.YF[0].CODE : res.data.SX_PRZBB.YF,
- SQDW: res.data.SX_PRZBB.SQDW == "" ? self.userDpName : res.data.SX_PRZBB.SQDW,
- TWODAY: res.data.SX_PRZBB.TWODAY == "true",
- LSH: res.data.SX_PRZBB.LSH == "" ? "" : res.data.SX_PRZBB.LSH,
- ZBREMARK: res.data.SX_PRZBB.ZBREMARK == "" ? self.zbxzMR : res.data.SX_PRZBB.ZBREMARK,
- SQRUSERID: res.data.SX_PRZBB.SQRUSERID == "" ? self.userId : res.data.SX_PRZBB.SQRUSERID
- };
- self.YF.forEach(function (item) {
- if (self.data.YF == item.CODE) {
- self.data.YF1 = item.CNAME;
- }
- })
- self.readonly = {
- NF: res.data.SX_PRZBB["NF.EREADONLY"] == "true",
- YF: res.data.SX_PRZBB["YF.EREADONLY"] == "true",
- SQDW: res.data.SX_PRZBB["SQDW.EREADONLY"] == "true",
- TWODAY: res.data.SX_PRZBB["TWODAY.EREADONLY"] == "true",
- LSH: res.data.SX_PRZBB["LSH.EREADONLY"] == "true",
- ZB: res.data.SX_PRZBB["ZB.EREADONLY"] == "true",
- ZBREMARK: res.data.SX_PRZBB["ZBREMARK.EREADONLY"] == "true",
- SPYJ: res.data.SX_PRZBB["SPYJ.EREADONLY"] == "true"
- }
- self.show = {
- ZBREMARK: res.data.SX_PRZBB["ZBREMARK.ESHOW"] == "true",
- SPYJ: res.data.SX_PRZBB["SPYJ.ESHOW"] == "true"
- }
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- self.buttonList = res.data["SX_PRZBB.FUNCLIST"];
- self.getChildList()
- self.getLSH()
- self.getOpinion('SPYJ')
- })
- }
- self.getLSH = function () {
- var data = {
- length: 3,
- cyear: sp.currentYear(),
- cmonth: self.data.YF1
- }
- $http.post(apiurljs.login + "g2app/ZhiBan/queryZhiBanLSH", { 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_PRZBB_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.canExportExcel = true;
- 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.sortList = JSON.parse(JSON.stringify(self.list));
- console.log(self.sortList)
- self.getRiQiList()
- })
- }
- //初始化子表
- self.childInit = function () {
- var data = {
- sqlwhere: "",
- columns: "",
- id: self.data.ID,
- cyear: self.data.NF,
- cmonth: self.data.YF1
- }
- $http.post(apiurljs.login + "g2app/zhiban/queryInitPRZBZhibanMan", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var object = {}
- res.data.MANLIST.forEach(function (item) {
- for (var i in item) {
- object[i] = item[i];
- }
- })
- self.Init = {
- lastDBLDXM: res.data.ITEM.DBLDXM,
- lastZBGBXM1: res.data.ITEM.ZBGBXM1,
- lastZBGBXM2: res.data.ITEM.ZBGBXM2,
- DBLDXM: "",
- ZBGBXM1: "",
- ZBGBXM2: "",
- DBLDXMlist: object.C01,
- ZBGBXM1list: object.C02,
- ZBGBXM2list: object.C03
- }
- self.Init.DBLDXM = self.Init.DBLDXMlist[(getNum(self.Init.DBLDXMlist, self.Init.lastDBLDXM) + 1)].CNAME
- self.Init.ZBGBXM1 = self.Init.ZBGBXM1list[(getNum(self.Init.ZBGBXM1list, self.Init.lastZBGBXM1) + 1)].CNAME
- self.Init.ZBGBXM2 = self.Init.ZBGBXM2list[(getNum(self.Init.ZBGBXM2list, self.Init.lastZBGBXM2) + 1)].CNAME
- sp.layer("#Init")
- })
- }
- self.btnInit = function () {
- var data = {
- id: self.data.ID,
- cyear: self.data.NF,
- cmonth: self.data.YF1,
- dbldxm: self.Init.DBLDXM,
- zbgbxm1: self.Init.ZBGBXM1,
- zbgbxm2: self.Init.ZBGBXM2,
- sqlwhere: ""
- }
- $http.post(apiurljs.login + "g2app/zhiban/InitPRZBZhibanMan",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide()
- if (res.data != -1) {
- self.getChildList()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.childInit1 = 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.btnInit1 = function () {
- var data = {
- tablename: "SX_PRZBB_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,
- cyear_target: "",
- cmonth_target: "",
- tablename: "SX_PRZBB_01",
- id: self.data.ID
- }
- $http.post(apiurljs.login + "g2app/zhiban/initZhibanChild", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- self.getChildList()
- })
- }
- })
- }
- //导入
- self.upload3 = function () {
- $('#fileupload3').fileupload({
- url: apiurljs.login + 'g2app/ZhiBan/impExecl_PRZB',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SX_PRZBB,id=" + self.data.ID + ",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=moban.xlsx&code_table=CODE_ZHIBANTIME&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=moban.xlsx&code_table=CODE_ZHIBANTIME&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.getOpinion = function (str) {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SX_PRZBB",
- 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) {
- var dataArray = [];
- dataArray.push(self.data);
- var data = {
- ckey: "SX_PRZBB",
- 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) })
- }
- 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: "",
- ZBGBXM2: "",
- ZBSJ: self.ZBSJ[0].CODE,
- ZBSJ1: "",
- SJDH: "",
- 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,
- ZBGBXM2: item.ZBGBXM2,
- ZBSJ: item.ZBSJ,
- ZBSJ1: item.ZBSJ1,
- SJDH: item.SJDH,
- 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,
- ZBGBXM2: self.edit.ZBGBXM2,
- ZBGBXMUSERID2: self.edit.ZBGBXMUSERID2,
- ZBSJ: self.edit.ZBSJ,
- ZBSJ1: self.edit.ZBSJ1,
- SJDH: self.edit.SJDH,
- XINGQI: self.edit.XINGQI
- })
- var data = {
- tablename: "SX_PRZBB_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,
- ZBGBXM2: self.edit.ZBGBXM2,
- ZBGBXMUSERID2: self.edit.ZBGBXMUSERID2,
- ZBSJ: self.edit.ZBSJ,
- ZBSJ1: self.edit.ZBSJ1,
- SJDH: self.edit.SJDH,
- XINGQI: self.edit.XINGQI
- })
- var data = {
- tablename: "SX_PRZBB_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_PRZBB",
- 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)
- }
- })
- } 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_PRZBB_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_PRZBB",
- 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_PRZBB,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_PRZBB",
- 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_PRZBB",
- 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_PRZBB",
- 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_PRZBB",
- 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 () {
- 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()
- }
|