1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- 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");
- var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
- return item.CNAME
- })
-
- //上层附件、业务参考、共享沟通组件
- self.uploading = false;
- self.upload = function () {
- $('#fileupload').fileupload({
- url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=督办公文延期"));
- },
- add: function (e, data) {
- var num = 0;
- var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
- //文件类型判断
- $.each(data.originalFiles, function (index, item) {
- if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
- sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
- return;
- } else {
- num++
- }
- })
- if (num == data.originalFiles.length) {
- self.uploading = true;
- data.submit();
- $scope.$apply();
- }
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading = false;
- self.getOther()
- }
- })
- }
- self.downLoad = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
- }
- self.deleteFile = function (file) {
- var dialogHead = "<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 {
- $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
- }
- }
-
- self.readonly = {
- SQSJ: false,
- SQSM: false,
- HJ: false,
- ZB: false
- }
- //初始化右上角按钮
- self.buttonList = []
-
- 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));
- $.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)
- })
- if (n == 0) {
- self.getDP()
- } 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.userDp = res.data.length == 0 ? "" : res.data[0];
- self.getData()
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "SX_BGYP",
- 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_BGYP.ID,
- SQR: res.data.SX_BGYP.SQR == "" ? self.userName : res.data.SX_BGYP.SQR,
- SQSJ: res.data.SX_BGYP.SQSJ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_BGYP.SQSJ),
- SQBM: res.data.SX_BGYP.SQBM == "" ? self.userDp.SECTION : res.data.SX_BGYP.SQBM,
- SQSM: res.data.SX_BGYP.SQSM,
- HJ: res.data.SX_BGYP.HJ,
- LYZT: res.data.SX_BGYP.LYZT == "" ? "待领取" : res.data.SX_BGYP.LYZT,
- };
- self.readonly = {
- SQSJ: res.data.SX_BGYP["SQSJ.EREADONLY"] == "true",
- SQSM: res.data.SX_BGYP["SQSM.EREADONLY"] == "true",
- HJ: res.data.SX_BGYP["HJ.EREADONLY"] == "true",
- ZB: res.data.SX_BGYP["ZB.EREADONLY"] == "true"
- }
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- self.buttonList = res.data["SX_BGYP.FUNCLIST"];
- self.getChildList()
- self.getOpinion1()
- })
- }
- self.getChildList = function () {
- var data = {
- id: self.data.ID,
- tablename: "SX_BGYP_01"
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryChildList", { 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.FL = item.YPFL;
- item.GG = item.YPGG;
- item.DJ = item.PJDJ;
- item.editFlag = false;
- })
- self.getAllBGYP()
- })
- }
- //获取意见(不上表)
- self.getOpinion1 = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SX_BGYP",
- colid: "",
- opiniontype: 99,
- 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.nulla = res.data;
- self.YJ.nullaSTATUS = false;
- self.YJ.nulla.forEach(function (item) {
- item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
- })
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.bgypListTotal = [];
- self.getAllBGYP = function () {
- var data = {
- code: "YP01",
- data_col: "YPBH",
- order: "id",
- pageno: 0,
- pagesize: 0,
- sqllikewhere: "",
- sqlwhere: "",
- tablename_code: "CODE_YPTYPE",
- tablename_data: "SX_BGYPMGR"
- }
- $http.post(apiurljs.login + "g2app/richang/queryFormDataBySqlWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.bgypListTotal = res.data;
- self.bgypListTotal.forEach(function (item) {
- item.JLDW = item.JDLW;
- })
- })
- }
- //判断页面字段是否只读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(".sp-page-center")) {
- var dataArray = [];
- dataArray.push(self.data);
- var data = {
- ckey: "SX_BGYP",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.SQSJ + self.data.SQR + "办公用品申请",//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 {
- sp.dialog(res.message)
- }
- })
- }
- }
- //领取
- self.btnLQ = function () {
- var data = {
- tablename: "SX_BGYP",
- id: self.data.ID,
- data: {
- LYZT:"已领取"
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getData()
- self.upDataKC(self.list, 0)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //扣除库存
- self.upDataKC = function (arr, i) {
- if (i == arr.length) {
- return
- } else {
- var data = {
- tablename: "SX_BGYPMGR",
- colums: "*",
- order: "ID desc",
- sqlwhere: { YPBH: arr[i].YPBH, GG: arr[i].YPGG },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var data = {
- tablename: "SX_BGYPMGR",
- id: res.data[0].ID,
- data: {
- KC: res.data[0].KC - arr[i].SQSL
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.upDataKC(arr, i + 1);
- } else {
- sp.dialog(res.message)
- }
- })
- })
- }
- }
- //新建
- self.addList = [];
- self.temporary = [];
- self.RYADD = function () {
- if (self.EditFlag == true) {
- sp.dialog("请先保存或取消编辑申请!")
- return
- }
- self.AddFlag = true;
- self.getLeftTreeData()
- if (self.data.ID == 0) {
- self.btnSave(3)
- }
- }
- //编辑
- self.RYEDIT = function (item) {
- if (self.AddFlag == true) {
- sp.dialog("请先保存或取消添加申请!")
- return
- }
- self.EditFlag = true;
- item.editFlag = true;
- self.edit = {
- ID: item.ID,
- YPBH1: item.YPBH1,
- PP: item.PP,
- YPMC: item.YPMC,
- YPBH: item.YPBH,
- YPFL: item.YPFL,
- YPGG: item.YPGG,
- PJDJ: item.PJDJ,
- KC: item.KC,
- SQSL: item.SQSL,
- JLDW: item.JLDW,
- YPK: item.YPK,
- GLY: item.GLY,
- YPZJ: item.YPZJ
- };
- }
- self.RYSAVE = function () {
- var text = JSON.stringify({
- YPBH1: self.edit.YPBH1,
- PP: self.edit.PP,
- YPMC:self.edit.YPMC,
- YPBH:self.edit.YPBH,
- YPFL:self.edit.YPFL,
- YPGG:self.edit.YPGG,
- PJDJ:self.edit.PJDJ,
- KC:self.edit.KC,
- SQSL:self.edit.SQSL,
- JLDW:self.edit.JLDW,
- YPK:self.edit.YPK,
- GLY:self.edit.GLY,
- YPZJ:self.edit.YPZJ
- })
- var data = {
- tablename: "SX_BGYP_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) {
- self.getChildList();
- sp.dialog("编辑成功!")
- $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_BGYP_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.treeData = [];
- self.getLeftTreeData = function () {
- var postData = {
- "tablename": "CODE_YPTYPE",
- "sql_data": "YPBH",
- "tablename_data": "SX_BGYPMGR"
- }
- $http.post(apiurljs.login + "g2app/richang/getTreeList", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.getMenuBtnList(res.data);
- self.treeData = res.data;
- setTimeout(function () {
- self.nowNodeCode = self.treeData[0].CODE;
- self.nowNodeName = self.treeData[0].CNAME;
- self.nowNodeID = self.treeData[0].ID;
- self.treeData[0].checked = true;
- self.openList(1,0);
- })
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- self.treeData = [];
- })
- }
- self.getMenuBtnList = function (data) {
- data.forEach(function (item) {
- item.checked = false;
- if (sp.isval(item.C_H_I_L_D_DATA) && item.C_H_I_L_D_DATA.length > 0) {
- self.getMenuBtnList(item.C_H_I_L_D_DATA);
- } else {
- item.C_H_I_L_D_DATA = [];
- }
- })
- }
- self.itemCheck = function ($item) {
- self.treeData.forEach(function (item) {
- if (item.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item.checked = false;
- }
- if (item.C_H_I_L_D_DATA != "" && item.C_H_I_L_D_DATA != null && item.C_H_I_L_D_DATA != null) {
- item.C_H_I_L_D_DATA.forEach(function (item2) {
- if (item2.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item2.checked = false;
- }
- if (item2.C_H_I_L_D_DATA != "" && item2.C_H_I_L_D_DATA != null && item2.C_H_I_L_D_DATA != null) {
- item2.C_H_I_L_D_DATA.forEach(function (item3) {
- if (item3.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item3.checked = false;
- }
- if (item3.C_H_I_L_D_DATA != "" && item3.C_H_I_L_D_DATA != null && item3.C_H_I_L_D_DATA != null) {
- item3.C_H_I_L_D_DATA.forEach(function (item4) {
- if (item4.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item4.checked = false;
- }
- if (item4.C_H_I_L_D_DATA != "" && item4.C_H_I_L_D_DATA != null && item4.C_H_I_L_D_DATA != null) {
- item4.C_H_I_L_D_DATA.forEach(function (item5) {
- if (item5.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item5.checked = false;
- }
- if (item5.C_H_I_L_D_DATA != "" && item5.C_H_I_L_D_DATA != null && item5.C_H_I_L_D_DATA != null) {
- item5.C_H_I_L_D_DATA.forEach(function (item6) {
- if (item6.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item6.checked = false;
- }
- if (item6.C_H_I_L_D_DATA != "" && item6.C_H_I_L_D_DATA != null && item6.C_H_I_L_D_DATA != null) {
- item6.C_H_I_L_D_DATA.forEach(function (item7) {
- if (item7.ID == $item.ID) {
- $item.checked = !$item.checked;
- } else {
- item7.checked = false;
- }
- })
- }
- })
- }
- })
- }
- })
- }
- })
- }
- })
- }
- })
- if ($item.checked) {
- self.nowNodeCode = $item.CODE;
- self.openList(1);
- } else {
- self.nowNodeCode = self.treeData[0].CODE;
- self.treeData[0].checked = true;
- }
- }
- self.pageno = 1;
- self.nameBGYP = "";
- self.openList = function (pageno, n) {
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno;
- var data = {
- code: self.nowNodeCode,
- data_col: "YPBH",
- order: "id",
- pageno: self.pageno,
- pagesize: 6,
- sqllikewhere: { YPMC: self.nameBGYP },
- sqlwhere: "",
- tablename_code: "CODE_YPTYPE",
- tablename_data: "SX_BGYPMGR"
- }
- $http.post(apiurljs.login + "g2app/richang/queryFormDataBySqlWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.bgypList = res.data;
- self.total_count = res.totalCount;
- if (n == 0) {
- self.temporary = JSON.parse(JSON.stringify(self.addList.concat(self.list)));
- sp.layer("#bgypList", 1)
- }
- self.bgypList.forEach(function (item) {
- item.checked = false;
- if (self.EditFlag == true) {
- if (item.YPMC == self.edit.YPMC) {
- item.checked = true;
- }
- } else {
- self.bgypListTotal.forEach(function (item1) {
- item1.checked = false;
- self.temporary.forEach(function (item2) {
- if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
- item1.checked = true;
- }
- })
- if (item.ID == item1.ID) {
- item.checked = item1.checked;
- }
- })
- }
- })
- })
- }
- self.changeSQSL = function (item) {
- item.YPZJ = item.SQSL * item.DJ
- if (item.SQSL > item.KC) {
- item.SQSL = item.KC;
- }
- }
- self.AddList = function () {
- var data = {
- tablename: "SX_BGYP_01",
- sqlwhere: "PID=" + self.data.ID
- };
- $http.post(apiurljs.login + "g2app/dataabase/deletBywhere", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.addList = self.temporary.map(function (item) {
- return {
- PID: self.data.ID,
- YPBH1: item.YPBH1,
- PP: item.PP,
- YPMC: item.YPMC,
- YPBH: item.YPBH,
- YPFL: item.FL,
- YPGG: item.GG,
- PJDJ: item.DJ,
- KC: item.KC,
- SQSL: item.SQSL,
- JLDW: item.JDLW,
- YPK: item.YPK,
- GLY: item.GLY,
- YPZJ: item.YPZJ
- }
- })
- var data = {
- tablename: "SX_BGYP_01",
- data: self.addList
- }
- $http.post(apiurljs.login + "g2app/Data/insertChildDataList2", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.closeAdd()
- self.getChildList();
- sp.dialog("添加成功!")
- $timeout(function () {
- sp.dialoghide()
- }, 2000)
- } else {
- sp.dialog(res.message)
- }
- })
- sp.closeCenter("#bgypList")
- })
- }
- self.closeAdd = function () {
- self.AddFlag = false;
- self.addList = [];
- self.temporary = [];
- sp.closeCenter("#bgypList")
- }
- //n等于1时为新增,n等于2时为编辑
- self.checkItem = function (item, n) {
- if (n == 1) {
- self.bgypListTotal.forEach(function (item1) {
- self.temporary.forEach(function (item2) {
- if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
- item2.checked = item1.checked;
- }
- })
- if (item1.YPBH == item.YPBH && item1.GG == item.GG && item1.YPBH1 == item.YPBH1) {
- item1.checked = item.checked;
- if (item1.checked == true) {
- self.temporary.push(item1)
- } else {
- self.temporary = self.temporary.filter(function (item2) {
- return item2.checked == true
- })
- }
- }
- })
- } else {
- self.edit.YPBH1 = item.YPBH1
- self.edit.YPMC = item.YPMC
- self.edit.YPBH = item.YPBH
- self.edit.PP = item.PP,
- self.edit.YPFL = item.FL
- self.edit.YPGG = item.GG
- self.edit.PJDJ = item.DJ
- self.edit.KC = item.KC
- self.edit.SQSL = ""
- self.edit.JLDW = item.JDLW
- self.edit.YPK = ""
- self.edit.GLY = ""
- self.edit.YPZJ = ""
- }
- }
- self.deleteItem = function (item) {
- item.checked = false;
- self.bgypListTotal.forEach(function (item1) {
- if (item1.YPBH == item.YPBH && item1.GG == item.GG) {
- item1.checked = item.checked;
- }
- self.bgypList.forEach(function (item2) {
- if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
- item2.checked = item1.checked;
- }
- })
- })
- self.temporary = self.temporary.filter(function (item) {
- return item.checked != false
- })
- }
- //签写意见编辑状态
- self.opinion = {
- nulla: false
- }
- self.YJ = {
- nulla: [],
- nullaSTATUS: false
- }
- //意见(下表)
- 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: "SX_BGYP",
- 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.uploading1 = false;
- self.upload1 = function () {
- $('#fileupload1').fileupload({
- url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
- + ",routeid=" + self.routeid + ",tableid=SX_BGYP,colid="));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading1 = false;
- self.getOpinion1()
- }
- })
- }
- //下载意见表附件
- 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_BGYP",
- 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) {
- self.getOpinion1();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- }
- //删除意见
- self.Dopinion = function (str, item) {
- var data = {
- cmanid: self.userId,
- routeid: self.routeid,
- tableid: "SX_BGYP",
- colid: str,
- }
- $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getOpinion1();
- } 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_BGYP",
- 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_BGYP",
- 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.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=bangongbg")
- 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.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"), "地图搜索")
- }
- //公开
- self.PUBLICITEM = 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));
- var data1 = {
- tablename: "CODE_LM"
- }
- $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- self.LM = res1.data[0].C_H_I_L_D_DATA;
- self.LM.forEach(function (item) {
- item.show = true;
- if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
- item.show = false;
- }
- item.C_H_I_L_D_DATA.forEach(function (item1) {
- item1.show = true;
- if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
- item1.show = false;
- }
- })
- })
- self.filed = "GKFW";
- self.msgGK = {
- WJLY: "FW",
- FLOWID: "AA88",
- FORMROUTEINFOID: self.routeinfoid,
- FBUSERID: self.userId,
- FBNAME: self.userName,
- GKFW: "",
- LM: "P0103",
- LM1: "委发文件",
- FBRQ: sp.getLocalDate(),
- FBBM: res.data[0].SECTION,
- WJBT: self.data.FWBT
- }
- sp.layer("#PUBLICITEM")
- $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
- })
- })
- }
- self.showCol = function ($event, ele) {
- $('.detail-col').not(ele).hide();
- $(ele).toggle("slow").autoHide();
- $event.stopPropagation();
- }
- self.selectLM = function (item) {
- self.msgGK.LM = item.CODE
- self.msgGK.LM1 = item.CNAME
- console.log(self.msgGK)
- $(".detail-col").toggle("slow");
- }
- self.showSecond = function (obj, n) {
- self.LM1 = obj.C_H_I_L_D_DATA;
- $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
- $(".detail-col").eq(1).show().autoHide()
- }
- self.checkAllUser1 = function () {
- self.AllChecked[self.filed] = !self.AllChecked[self.filed];
- $.each(self.UserList[self.filed], function (index, item) {
- item.checked = self.AllChecked[self.filed];
- $.each(item.USER, function (index1, item1) {
- item1.checked = self.AllChecked[self.filed];
- })
- })
- self.submitGK(1)
- }
- self.checkUserItem1 = function (item) {
- item.checked = !item.checked;
- $.each(item.USER, function (index, item1) {
- item1.checked = item.checked;
- })
- var n = 0;
- $.each(self.UserList[self.filed], function (index, item) {
- if (item.checked == true) {
- n++
- }
- })
- if (n == self.UserList[self.filed].length) {
- self.AllChecked[self.filed] = true;
- } else {
- self.AllChecked[self.filed] = false;
- }
- self.submitGK(1)
- }
- self.checkUser1 = function (item) {
- item.checked = !item.checked;
- var n = [], all = 0;
- $.each(self.UserList[self.filed], function (x, y) {
- n.push(0);
- $.each(y.USER, function (x1, y1) {
- if (y1.checked == true) {
- n[x]++
- }
- })
- if (n[x] == y.USER.length && n[x] != 0) {
- y.checked = true;
- all++
- } else {
- y.checked = false;
- }
- })
- if (all == self.UserList[self.filed].length) {
- self.AllChecked[self.filed] = true;
- } else {
- self.AllChecked[self.filed] = false;
- }
- self.submitGK(1)
- }
- self.submitGK = function (n) {
- var AllCheckedLength = 0;
- self.selectList[self.filed] = [];
- $.each(self.UserList[self.filed], function (index, item) {
- $.each(item.USER, function (index1, item1) {
- if (item1.checked == true) {
- AllCheckedLength++;
- self.selectList[self.filed].push(item1)
- }
- })
- })
- self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
- return item.USERID
- }).join(",")
- self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
- if (n == 0) {
- sp.layerhide();
- var data = {
- tablename: "SX_FBLIST",
- data: {
- WJLY: self.msgGK.WJLY,
- FLOWID: self.msgGK.FLOWID,
- FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
- FBUSERID: self.msgGK.FBUSERID,
- FBNAME: self.msgGK.FBNAME,
- GKFW: self.msgGK.GKFW,
- LM: self.msgGK.LM,
- FBRQ: self.msgGK.FBRQ,
- FBBM: self.msgGK.FBBM,
- WJBT: self.msgGK.WJBT
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- sp.dialog("操作成功!");
- $timeout(function () {
- sp.dialoghide();
- }, 1000)
- } else {
- sp.dialog(res.message);
- }
- })
- }
- }
-
- //头部下滚冻结
- $(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.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 - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- self.canvas.addEventListener("mousemove", move)
- }.bind(self), false);
- //绘制中
- function move() {
- var e = window.event;
- self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- self.cxt.stroke();
- }
- //结束绘制
- self.canvas.addEventListener("mouseup", up)
- function up() {
- self.cxt.closePath();
- self.canvas.removeEventListener("mousemove", move)
- }
- };
- var parentData = {}
- function getData() {
- parentData = angular.element(document.getElementById("app")).scope().data
- return parentData
- }
- 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()
- }
- app.directive('treeView', [function () {
- return {
- restrict: 'EA',
- templateUrl: '/treeView.html',
- scope: {
- treeData: '=',///声明数据
- textField: '@',
- itemAdd: '&', ///声明新增变量
- itemEdit: '&',///声明修改变量
- itemCheck: '&',///声明修改变量
- itemDelete: '&',///声明修改变量
- itemUp: '&',
- itemDown: '&'
- },
- controller: ['$scope', function ($scope) {
- $scope.itemExpended = function (item, $event) {
- item.$$isExpend = !item.$$isExpend;
- $event.stopPropagation();
- };
- ///展开折叠图标设置
- $scope.getItemIcon = function (item) {
- var isEnd = $scope.isEnd(item);
- if (isEnd) {
- return 'fa fa-paper-plane-o';
- }
- return item.$$isExpend ? 'fa fa-plus-square-o' : 'fa fa-minus-square-o';
- };
- ///判断是否是最后一级菜单
- $scope.isEnd = function (item) {
- return !item.C_H_I_L_D_DATA || !item.C_H_I_L_D_DATA.length;
- };
- ///事件调用返回
- $scope.warpCallback = function (callback, item, $event) {
- ($scope[callback] || angular.noop)({
- $item: item,
- $event: $event
- });
- };
- }]
- };
- }]);
- function formate(n) {
- return n > 9 ? n : "0" + n;
- }
- function isNull(str) {
- if (str == "" || str == null || str == undefined) {
- return false
- } else {
- return true
- }
- }
|