123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946 |
- '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.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");
- self.info = JSON.parse($.cookie("GlWorkPlatform-gdsp"))
- console.log(self.info)
- //$.cookie("GlWorkPlatform-gdsp", null, { path: '/', expires: 1 });
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
- //初始化右上角按钮
- self.buttonList = []
- self.readonly = {
- LC: false,
- BT: false,
- WH: false,
- GDCS: false,
- GDRY: false,
- CSYJ: false,
- BZ: false
- }
- 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)
- })
- self.SwenList.push({
- VNAME: "流程图",
- DIRECTIONID: self.SwenList[0].DIRECTIONID,
- TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
- })
- if (n == 0) {
- self.getDpList()
- } else {
- self.getData()
- }
- })
- }
- self.getSwenList(0)
- self.getDpList = function () {
- var data = {
- unitid: "AA"
- }
- $http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dpList = [];
- res.data.forEach(function (item) {
- if (item.CHILD_DATA.length == 0) {
- self.dpList.push(item)
- } else {
- item.CHILD_DATA.forEach(function (item1) {
- if (item1.CHILD_DATA.length == 0) {
- self.dpList.push(item1)
- } else {
- item1.CHILD_DATA.forEach(function (item2) {
- if (item2.CHILD_DATA.length == 0) {
- self.dpList.push(item2)
- }
- })
- }
- })
- }
- })
- self.dpList.forEach(function (item) {
- item.checked = false;
- })
- self.DpList = {
- GDCS: JSON.parse(JSON.stringify(self.dpList))
- }
- self.AllCheckedDp = {};
- self.DpLength = {};
- self.selectDpList = {};
- self.getUserList()
- })
- }
- self.getUserList = function () {
- $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.userList = res.data;
- self.userList.forEach(function (item) {
- item.checked = false;
- item.USER.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.UserList = {
- GDRY: JSON.parse(JSON.stringify(self.userList))
- };
- self.AllChecked = {};
- self.UserLength = {};
- self.selectList = {};
- self.getDP()
- })
- }
- self.getDP = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
- self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
- self.getGDBM();
- })
- }
- self.getGDBM = function () {
- var data = {
- unitid: "AA"
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDanganSectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.GDBM = res.data;
- if (self.routeinfoid == 0) {
- self.getWENHAO();
- } else {
- self.getData();
- }
- })
- }
- self.getWENHAO = function () {
- var data = {
- routeinfoid: self.info.ROUTEINFOID,
- flowid:self.info.FLOWID
- }
- $http.post(apiurljs.login + "g2app/DangAn/queryDataByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data.length > 0) {
- self.WENHAO = res.data[0].WENHAO;
- } else {
- self.WENHAO = "";
- }
- self.getData();
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "DA_DASP",
- 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.DA_DASP.ID,
- APPCODE: res.data.DA_DASP.APPCODE,
- LC: res.data.DA_DASP.LC == "" ? self.info.FLOWNAME : res.data.DA_DASP.LC,
- BT: res.data.DA_DASP.BT == "" ? self.info.TITLE : res.data.DA_DASP.BT,
- WH: res.data.DA_DASP.WH == "" ? self.WENHAO : res.data.DA_DASP.WH,
- GDCS: res.data.DA_DASP.GDCS == "" ? self.userDpName : res.data.DA_DASP.GDCS,
- GDRY: res.data.DA_DASP.GDRY == "" ? self.userName : res.data.DA_DASP.GDRY,
- BZ: res.data.DA_DASP.BZ,
- ARCHYEAR: res.data.DA_DASP.ARCHYEAR == "" ? sp.currentYear() : res.data.DA_DASP.ARCHYEAR,
- ORGANIZATIONMA: res.data.DA_DASP.ORGANIZATIONMA == "" ? self.userDpCode : res.data.DA_DASP.ORGANIZATIONMA,
- WENHAO: res.data.DA_DASP.WENHAO == "" ? self.WENHAO : res.data.DA_DASP.WENHAO,
- MIJIQIXIAN: res.data.DA_DASP.MIJIQIXIAN == "" ? "10年" : res.data.DA_DASP.MIJIQIXIAN,
- DANGANML: res.data.DA_DASP.DANGANML == "" ? "文书" : res.data.DA_DASP.DANGANML,
- DOCUMENTTYPE: res.data.DA_DASP.DOCUMENTTYPE == "" ? self.info.FLOWNAME : res.data.DA_DASP.DOCUMENTTYPE,
- DOCTITLE: res.data.DA_DASP.DOCTITLE == "" ? self.info.TITLE : res.data.DA_DASP.DOCTITLE,
- ZRZ: res.data.DA_DASP.ZRZ == "" ? "" : res.data.DA_DASP.ZRZ,
- DOCISSUEDDATE: res.data.DA_DASP.DOCISSUEDDATE == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.DA_DASP.DOCISSUEDDATE),
- JIANHAO: res.data.DA_DASP.JIANHAO == "" ? 1 : res.data.DA_DASP.JIANHAO,
- YESHU: res.data.DA_DASP.YESHU == "" ? "" : res.data.DA_DASP.YESHU,
- BEIZHU: res.data.DA_DASP.BEIZHU == "" ? "" : res.data.DA_DASP.BEIZHU,
- ARCHCODE: res.data.DA_DASP.ARCHCODE == "" ? "" : res.data.DA_DASP.ARCHCODE,
- DAROUTEINFOID: res.data.DA_DASP.DAROUTEINFOID == "" ? self.info.ROUTEINFOID : res.data.DA_DASP.DAROUTEINFOID,
- DPNAME: res.data.DA_DASP.DPNAME == "" ? self.userDpName : res.data.DA_DASP.DPNAME,
- DPCODE: res.data.DA_DASP.DPCODE == "" ? self.userDpCode : res.data.DA_DASP.DPCODE,
- MOBANNAME: res.data.DA_DASP.MOBANNAME == "" ? self.info.MOBANNAME : res.data.DA_DASP.MOBANNAME,
- TABLENAME: res.data.DA_DASP.TABLENAME == "" ? self.info.TABLENAME : res.data.DA_DASP.TABLENAME
- }
- $scope.data = self.data;
- self.readonly = {
- LC: res.data.DA_DASP["LC.EREADONLY"] == "true",
- BT: res.data.DA_DASP["BT.EREADONLY"] == "true",
- WH: res.data.DA_DASP["WH.EREADONLY"] == "true",
- GDCS: res.data.DA_DASP["GDCS.EREADONLY"] == "true",
- GDRY: res.data.DA_DASP["GDRY.EREADONLY"] == "true",
- CSYJ: res.data.DA_DASP["CSYJ.EREADONLY"] == "true",
- BZ: res.data.DA_DASP["BZ.EREADONLY"] == "true",
- ARCHYEAR: res.data.DA_DASP["ARCHYEAR.EREADONLY"] == "true",
- ORGANIZATIONMA: res.data.DA_DASP["ORGANIZATIONMA.EREADONLY"] == "true",
- WENHAO: res.data.DA_DASP["WENHAO.EREADONLY"] == "true",
- MIJIQIXIAN: res.data.DA_DASP["MIJIQIXIAN.EREADONLY"] == "true",
- DANGANML: res.data.DA_DASP["DANGANML.EREADONLY"] == "true",
- DOCUMENTTYPE: res.data.DA_DASP["DOCUMENTTYPE.EREADONLY"] == "true",
- DOCTITLE: res.data.DA_DASP["DOCTITLE.EREADONLY"] == "true",
- ZRZ: res.data.DA_DASP["ZRZ.EREADONLY"] == "true",
- DOCISSUEDDATE: res.data.DA_DASP["DOCISSUEDDATE.EREADONLY"] == "true",
- JIANHAO: res.data.DA_DASP["JIANHAO.EREADONLY"] == "true",
- YESHU: res.data.DA_DASP["YESHU.EREADONLY"] == "true",
- BEIZHU: res.data.DA_DASP["BEIZHU.EREADONLY"] == "true",
- ARCHCODE: res.data.DA_DASP["ARCHCODE.EREADONLY"] == "true"
- }
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- self.buttonList = self.dotype == 0 ? [] : res.data["DA_DASP.FUNCLIST"];
- var n = {}, all = {};
- for (var i in self.UserList) {
- self.AllChecked[i] = false;
- self.UserLength[i] = 0;
- self.selectList[i] = []
- n[i] = [];
- all[i] = 0;
- $.each(self.UserList[i], function (index, item) {
- n[i].push(0)
- $.each(item.USER, function (index1, item1) {
- self.UserLength[i]++
- if (self.data.GDRY.indexOf(item1.USHOWNAME) != -1 && i == "GDRY") {
- n[i][index]++;
- item1.checked = true;
- self.selectList[i].push(item1);
- }
- })
- if (n[i][index] == item.USER.length && n[i][index] != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- })
- if (all[i] == self.UserList[i].length) {
- self.AllChecked[i] = true;
- } else {
- self.AllChecked[i] = false;
- }
- }
- for (var i in self.DpList) {
- self.AllCheckedDp[i] = false;
- self.DpLength[i] = 0;
- self.selectDpList[i] = []
- all[i] = 0;
- $.each(self.DpList[i], function (index, item) {
- self.DpLength[i]++
- if (self.data.GDCS.indexOf(item.SECTION) != -1 && i == "GDCS") {
- all[i]++;
- item.checked = true;
- self.selectDpList[i].push(item);
- }
- })
- if (all[i] == self.DpList[i].length) {
- self.AllCheckedDp[i] = true;
- } else {
- self.AllCheckedDp[i] = false;
- }
- }
- self.getOpinion("CSYJ")
- //watermark({
- // "watermarl_element": "app",
- // "watermark_txt": "测试水印内容",
- // "watermark_width": 150,
- // "watermark_height": 110,
- // "watermark_angle": 345
- //})
- })
- }
- //获取意见(上表)
- self.getOpinion = function (str) {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "DA_DASP",
- 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", 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.btnPrint1(); break;
- case "MEETITEM": self.Meet(); break;
- case "SENDLOG": self.RouteList(); break;
- default: self.forward(item); break;
- }
- }
- self.openDpList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllCheckedDp = false;
- sp.layer("#DpList")
- $("#DpList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllDp = function () {
- self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
- $.each(self.DpList[self.filed], function (index, item) {
- item.checked = self.AllCheckedDp[self.filed];
- })
- self.submitDpList(1)
- }
- self.checkDpItem = function (item) {
- item.checked = !item.checked;
- var n = 0;
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- n++
- }
- })
- if (n == self.DpList[self.filed].length) {
- self.AllCheckedDp[self.filed] = true;
- } else {
- self.AllCheckedDp[self.filed] = false;
- }
- self.submitDpList(1)
- }
- self.submitDpList = function (n) {
- var AllCheckedLength1 = 0;
- self.selectDpList[self.filed] = [];
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- AllCheckedLength1++;
- self.selectDpList[self.filed].push(item)
- }
- })
- self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
- return item.SECTION
- }).join(",")
- self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- self.openUserList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllChecked[self.filed] = false;
- sp.layer("#userList")
- $("#userList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllUser = 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.submitUserList(1)
- }
- self.checkUserItem = 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.submitUserList(1)
- }
- self.checkUser = 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.submitUserList(1)
- }
- self.submitUserList = 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.data[self.filed] = self.selectList[self.filed].map(function (item) {
- return item.USHOWNAME
- }).join(",")
- if (self.data[self.filed + "ID"] != undefined) {
- self.data[self.filed + "ID"] = self.selectList[self.filed].map(function (item) {
- return item.USERID
- }).join(",")
- }
- self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
-
- //保存提交
- self.btnSave = function (n) {
- if (spngvld.submit(".sp-page-center")) {
- var dataArray = [];
- self.data.CSYJ = "";
- dataArray.push(self.data);
- var data = {
- ckey: "DA_DASP",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.BT,
- 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) {
- if (self.routeinfoid == 0) {
- var data = {
- routeinfoid: [self.info.ROUTEINFOID],
- flowid: self.info.FLOWID
- }
- $http.post(apiurljs.login + "g2app/DangAn/YJYGDInitAttachListAndConvertPdf", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj1) {})
- }
- 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.btnPrint1();
- }
- } else {
- sp.dialog(res.message)
- }
- })
- }
- }
- //打印
- self.btnPrint = function () {
- // 创建隐藏的可下载链接
- var eleLink = document.createElement('a');
- eleLink.download = "";
- eleLink.style.display = 'none';
- eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=XZGZDT.ftl&tablename=DA_DASP&outfilepath=/tmp/档案审批.wps&prtdate=RIQI&routeinfoid=" + self.routeinfoid));
- // 触发点击
- document.body.appendChild(eleLink);
- eleLink.click();
- // 然后移除
- document.body.removeChild(eleLink);
- //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=DA_DASP&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
- }
- /*综合打印*/
- self.printFiled = 1;
- self.btnPrint1 = function () {
- if (self.filedChange == true) {
- self.btnSave(3)
- } else {
- sp.layer("#print")
- }
- }
- self.printSubmit = function () {
- if (self.printFiled == 1) {
- var templatefilename = "moban30"
- } else if (self.printFiled == 2) {
- var templatefilename = "mobanoption"
- } else {
- var templatefilename = "moban30_all"
- }
- var data = {
- templatefilename: templatefilename + ".ftl",
- outfilepath: "/tmp/档案审批" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
- routeinfoid: self.routeinfoid,
- tablename: "DA_DASP",
- printtype: self.printFiled,
- printdate: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
- window.parent.sp.addTabNav('printPreview', '打印预览', "printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
- })
- //// 创建隐藏的可下载链接
- //var eleLink = document.createElement('a');
- //eleLink.download = "";
- //eleLink.style.display = 'none';
- //eleLink.href = apiurljs.login + "g2app/dataabase/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=" + templatefilename + ".ftl&tablename=DA_DASP&outfilepath=/tmp/档案审批.wps&printdate=LWRQ,DBSX&routeinfoid=" + self.routeinfoid + "&printtype=" + self.printFiled));
- //// 触发点击
- //document.body.appendChild(eleLink);
- //eleLink.click();
- //// 然后移除
- //document.body.removeChild(eleLink);
- sp.layerhide()
- }
- //签写意见编辑状态
- self.opinion = {
- CSYJ: false,
- CSYJImg: false
- }
- self.YJ = {
- CSYJ: [],
- CSYJSTATUS: 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: "DA_DASP",
- 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.getOpinion(str);
- } 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=DA_DASP,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: "DA_DASP",
- 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: "DA_DASP",
- 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.getOpinion(str);
- 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: "DA_DASP",
- 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: "DA_DASP",
- colid: self.colid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.phraseList = res.data;
- self.phraseSelect = self.phraseList[0].CONTENTS;
- })
- }
- //从常用语库删除
- self.Dphrase = function () {
- var id = null;
- $.each(self.phraseList, function (index, item) {
- if (item.CONTENTS == self.phraseSelect) {
- id = item.ID;
- }
- })
- var data = {
- id: id
- }
- $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.getPhrase();
- })
- }
- //常用语确认为意见
- self.btnPhrase = function () {
- if (!self.colid) {
- self.nulla = self.phraseSelect;
- } else {
- self.data[self.colid] = self.phraseSelect;
- }
- sp.layerhide();
- }
- //签字—手写
- self.QianZi = function (str) {
- if (self.opinion[str + "Img"] == true) { return; }
- self.opinion[str + "Img"] = true;
- 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=GUIDANG")
- 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);
- //})
- }
- //头部下滚冻结
- $(function () {
- $(".sp-page-center").css("max-height", $(window).height() - 58).css("height", $(window).height() - 58)
- //$("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)
- }
- }, 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
- }
|