formedit.js 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.routeid = sp.getUrlName("routeid");
  11. self.routeinfoid = sp.getUrlName("routeinfoid");
  12. self.copyrightid = sp.getUrlName("copyrightid");
  13. self.directionid = sp.getUrlName("directionid");
  14. self.formeditid = sp.getUrlName("formeditid");
  15. self.mbid = sp.getUrlName("mbid");
  16. self.fjid = sp.getUrlName("fjid");
  17. self.docmode = sp.getUrlName("docmode");
  18. self.dotype = sp.getUrlName("dotype");
  19. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  20. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  21. self.get_type = sp.getUrlName("type");
  22. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  23. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  24. var postCfg = {
  25. headers: {
  26. 'Content-Type': 'application/json',
  27. 'Authorization': "Bearer " + self.get_AccessToken
  28. }
  29. };
  30. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  31. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  32. return item.CNAME
  33. })
  34. //上层附件、业务参考、共享沟通组件
  35. self.uploading = false;
  36. self.upload = function () {
  37. $('#fileupload').fileupload({
  38. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  39. dataType: 'json',
  40. beforeSend: function (xhr, data) {
  41. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  42. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=党委正式文(上行文)"));
  43. },
  44. add: function (e, data) {
  45. var num = 0;
  46. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  47. //文件类型判断
  48. $.each(data.originalFiles, function (index, item) {
  49. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  50. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  51. return;
  52. } else {
  53. num++
  54. }
  55. })
  56. if (num == data.originalFiles.length) {
  57. self.uploading = true;
  58. data.submit();
  59. $scope.$apply();
  60. }
  61. },
  62. // 上传完成后的执行逻辑
  63. done: function (e, data) {
  64. self.uploading = false;
  65. self.getOther()
  66. }
  67. })
  68. }
  69. self.downLoad = function (item) {
  70. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  71. }
  72. self.deleteFile = function (file) {
  73. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  74. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  75. 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>";
  76. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  77. sp.openCenter(".sp-dialog");
  78. ///取消按钮
  79. $('.sp-closeDialog').click(function (event) {
  80. sp.closeCenter(".sp-dialog");
  81. event.preventDefault();
  82. event.stopPropagation();
  83. });
  84. //post消息的id
  85. $("#delDataTrue").click(function () {
  86. var data = {
  87. tablename: "FILE_ATTACH",
  88. id: file.ID
  89. };
  90. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  91. .success(function (obj) {
  92. var res = strToJson(s4.decryptData_CBC(obj.data));
  93. sp.dialoghide();
  94. if (res.success) {
  95. self.getOther();
  96. } else {
  97. sp.dialog("删除失败,请联系管理员!");
  98. }
  99. });
  100. });
  101. }
  102. self.goAttach = function (obj) {
  103. if (obj) {
  104. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  105. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  106. return
  107. }
  108. $("#attachlist")[0].contentWindow.openFile(obj)
  109. if ($(".fa-chevron-down").is(":hidden") == true) {
  110. showToggle(document.getElementById("toggleButton"))
  111. }
  112. } else {
  113. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  114. }
  115. }
  116. self.getSwenList = function (n) {
  117. self.SwenList = [];
  118. var data = {
  119. directionid: self.directionid,
  120. userid: self.userId,
  121. routeinfoid: self.routeinfoid,
  122. routeid: self.routeid,
  123. formeditid: ""
  124. }
  125. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  126. .success(function (obj) {
  127. var res = strToJson(s4.decryptData_CBC(obj.data));
  128. if (self.copyrightid == "") {
  129. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  130. }
  131. $.each(res.data.LINKS, function (index, item) {
  132. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  133. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  134. self.Title = item.VNAME;
  135. }
  136. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  137. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  138. } else {
  139. item.TEMPFORM = "#";
  140. }
  141. self.SwenList.push(item)
  142. })
  143. self.SwenList.push({
  144. VNAME: "流程图",
  145. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  146. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  147. })
  148. if (n == 0) {
  149. self.getFLOW()
  150. } else {
  151. self.getData()
  152. }
  153. })
  154. }
  155. self.getSwenList(0)
  156. self.getFLOW = function () {
  157. var data = {
  158. copyrightid: self.copyrightid
  159. }
  160. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  161. .success(function (obj) {
  162. var res = strToJson(s4.decryptData_CBC(obj.data));
  163. self.flowTitle = res.data.CNAME;
  164. self.getJJLB()
  165. })
  166. }
  167. self.getJJLB = function () {
  168. var data = {
  169. ckey: "CODE_JJLB",
  170. routeinfoid: self.routeinfoid
  171. }
  172. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  173. .success(function (obj) {
  174. var res = strToJson(s4.decryptData_CBC(obj.data));
  175. self.JJLB = res.data.CODE_JJLB;
  176. self.getGWZL()
  177. })
  178. }
  179. self.getGWZL = function () {
  180. var data = {
  181. tablename: "CODE_GWTYPE",
  182. colums: "ID,CODE,CNAME,FLOWID",
  183. order: "ID desc",
  184. sqlwhere: {
  185. USEMARK: 1,
  186. FLOWID: sp.getUrlName("flowid")
  187. },
  188. sqlinwhere: "",
  189. sqllikewhere: ""
  190. }
  191. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  192. .success(function (obj) {
  193. var res = strToJson(s4.decryptData_CBC(obj.data));
  194. console.log(res.data)
  195. self.GWZL = res.data;
  196. self.getDpList()
  197. })
  198. }
  199. self.getDpList = function () {
  200. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  201. .success(function (obj) {
  202. var res = strToJson(s4.decryptData_CBC(obj.data));
  203. self.dpList = res.data;
  204. self.dpList.forEach(function (item) {
  205. item.checked = false;
  206. item.USER.forEach(function (item1) {
  207. item1.checked = false;
  208. item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
  209. item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
  210. })
  211. })
  212. self.AllChecked = { GKFW: false };
  213. self.UserLength = { GKFW: 0 };
  214. self.selectList = {};
  215. self.dpList.forEach(function (item) {
  216. item.checked = false;
  217. item.USER.forEach(function (item1) {
  218. self.UserLength.GKFW++
  219. })
  220. })
  221. self.UserList = {
  222. GKFW: JSON.parse(JSON.stringify(self.dpList))
  223. };
  224. self.getDP()
  225. })
  226. }
  227. self.getDP = function () {
  228. var data = {
  229. userid: self.userId
  230. }
  231. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  232. .success(function (obj) {
  233. var res = strToJson(s4.decryptData_CBC(obj.data));
  234. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  235. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  236. self.getData();
  237. })
  238. }
  239. self.readonly = {
  240. JJLB: true,
  241. WZYFZTZSQ: true,
  242. FGLDYJ: true,
  243. ZBBMQCR: true,
  244. NGRQ: true,
  245. GWZL:true,
  246. ZBBMFZRSH:true,
  247. HGXSH:true,
  248. HQBMFZRSH:true,
  249. FWBT:true,
  250. FWZH:true,
  251. YF:true,
  252. BGSFHYJ:true,
  253. ZS:true,
  254. CS:true
  255. }
  256. //获取数据
  257. self.getData = function () {
  258. var data = {
  259. ckey: "FW_DWZSWSXW",
  260. id: 0,
  261. directionid: self.directionid,
  262. formeditid: self.formeditid,
  263. routeid: self.routeid,
  264. routeinfoid: self.routeinfoid
  265. }
  266. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  267. .success(function (obj) {
  268. var res = strToJson(s4.decryptData_CBC(obj.data));
  269. self.data = {
  270. ID: res.data.FW_DWZSWSXW.ID,
  271. APPCODE: res.data.FW_DWZSWSXW.APPCODE,
  272. JJLB: res.data.FW_DWZSWSXW.JJLB == "" ? self.JJLB[0].CODE : res.data.FW_DWZSWSXW.JJLB,
  273. WZYFZTZSQ: res.data.FW_DWZSWSXW.WZYFZTZSQ,
  274. FGLDYJ: res.data.FW_DWZSWSXW.FGLDYJ,
  275. GWZL: res.data.FW_DWZSWSXW.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_DWZSWSXW.GWZL,
  276. ZBBMQCR: res.data.FW_DWZSWSXW.ZBBMQCR == "" ? self.userName : res.data.FW_DWZSWSXW.ZBBMQCR,
  277. NGRQ: res.data.FW_DWZSWSXW.NGRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_DWZSWSXW.NGRQ),
  278. ZBBMFZRSH: res.data.FW_DWZSWSXW.ZBBMFZRSH,
  279. HGXSH: res.data.FW_DWZSWSXW.HGXSH,
  280. HQBMFZRSH: res.data.FW_DWZSWSXW.HQBMFZRSH,
  281. FWBT: res.data.FW_DWZSWSXW.FWBT,
  282. FWZH: res.data.FW_DWZSWSXW.FWZH,
  283. FWZH1: res.data.FW_DWZSWSXW.FWZH,
  284. YF: res.data.FW_DWZSWSXW.YF,
  285. BGSFHYJ: res.data.FW_DWZSWSXW.BGSFHYJ,
  286. ZTC: res.data.FW_DWZSWSXW.ZTC,
  287. ZS: res.data.FW_DWZSWSXW.ZS,
  288. CS: res.data.FW_DWZSWSXW.CS,
  289. NGRUSERID: res.data.FW_DWZSWSXW.NGRUSERID == "" ? self.userId : res.data.FW_DWZSWSXW.NGRUSERID,
  290. NGRBM: res.data.FW_DWZSWSXW.NGRBM == "" ? self.userDpName : res.data.FW_DWZSWSXW.NGRBM,
  291. NGRBMID: res.data.FW_DWZSWSXW.NGRBMID == "" ? self.userDpCode : res.data.FW_DWZSWSXW.NGRBMID
  292. }
  293. self.readonly = {
  294. JJLB: res.data.FW_DWZSWSXW["JJLB.EREADONLY"] == "true",
  295. WZYFZTZSQ: res.data.FW_DWZSWSXW["WZYFZTZSQ.EREADONLY"] == "true",
  296. FGLDYJ: res.data.FW_DWZSWSXW["FGLDYJ.EREADONLY"] == "true",
  297. GWZL: res.data.FW_DWZSWSXW["GWZL.EREADONLY"] == "true",
  298. ZBBMQCR: res.data.FW_DWZSWSXW["ZBBMQCR.EREADONLY"] == "true",
  299. NGRQ: res.data.FW_DWZSWSXW["NGRQ.EREADONLY"] == "true",
  300. ZBBMFZRSH: res.data.FW_DWZSWSXW["ZBBMFZRSH.EREADONLY"] == "true",
  301. HGXSH: res.data.FW_DWZSWSXW["HGXSH.EREADONLY"] == "true",
  302. HQBMFZRSH: res.data.FW_DWZSWSXW["HQBMFZRSH.EREADONLY"] == "true",
  303. FWBT: res.data.FW_DWZSWSXW["FWBT.EREADONLY"] == "true",
  304. FWZH: res.data.FW_DWZSWSXW["FWZH.EREADONLY"] == "true",
  305. YF: res.data.FW_DWZSWSXW["YF.EREADONLY"] == "true",
  306. BGSFHYJ: res.data.FW_DWZSWSXW["BGSFHYJ.EREADONLY"] == "true",
  307. ZTC: res.data.FW_DWZSWSXW["ZTC.EREADONLY"] == "true",
  308. ZS: res.data.FW_DWZSWSXW["ZS.EREADONLY"] == "true",
  309. CS: res.data.FW_DWZSWSXW["CS.EREADONLY"] == "true"
  310. }
  311. if (self.data.ID == 0) {
  312. self.filedChange = true;
  313. } else {
  314. self.filedChange = false;
  315. }
  316. self.buttonList = res.data["FW_DWZSWSXW.FUNCLIST"];
  317. self.getOpinion('WZYFZTZSQ')
  318. self.getOpinion('FGLDYJ')
  319. self.getOpinion('ZBBMFZRSH')
  320. self.getOpinion('HGXSH')
  321. self.getOpinion('HQBMFZRSH')
  322. self.getOpinion('BGSFHYJ')
  323. self.getOpinion1()
  324. self.getOther()
  325. self.getGCG()
  326. self.getFWZH()
  327. //watermark({
  328. // "watermarl_element": "app",
  329. // "watermark_txt": "测试水印内容",
  330. // "watermark_width": 150,
  331. // "watermark_height": 110,
  332. // "watermark_angle": 345
  333. //})
  334. $timeout(function () {
  335. var height1 = $(".auto").parent().next("div").height(), height2 = 0;
  336. $(".auto").siblings().each(function () {
  337. height2 = height2 + $(this).outerHeight();
  338. })
  339. $(".auto").css("height", height1 - height2);
  340. }, 100)
  341. })
  342. }
  343. self.getFWZH = function () {
  344. var data = {
  345. flowid: sp.getUrlName("flowid"),
  346. code: "",
  347. cyear: sp.currentYear(),
  348. routeinfoidmark: self.routeinfoid,
  349. zihao: self.data.FWZH
  350. }
  351. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  352. .success(function (obj) {
  353. var res = strToJson(s4.decryptData_CBC(obj.data));
  354. self.FWZH = res.data.map(function (item) {
  355. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  356. });
  357. if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE }
  358. })
  359. }
  360. //获取附件和插件
  361. self.getOther = function () {
  362. var data = {
  363. tablename: "FILE_ATTACH",
  364. colums: "*",
  365. order: "ID desc",
  366. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  367. sqlinwhere: "",
  368. sqllikewhere: ""
  369. }
  370. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  371. .success(function (obj) {
  372. var res = strToJson(s4.decryptData_CBC(obj.data));
  373. self.arrayFile1 = [];
  374. if (res.data.length > 0) {
  375. res.data.forEach(function (item) {
  376. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  377. self.arrayFile = item;
  378. } else {
  379. self.arrayFile1.push(item)
  380. }
  381. })
  382. self.goAttach()
  383. }
  384. })
  385. }
  386. //发文打开过程稿在线编辑
  387. self.getGCG = function () {
  388. var data = {
  389. dockind: "D01",
  390. routeinfoid: self.routeinfoid
  391. }
  392. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  393. .success(function (obj) {
  394. var res = strToJson(s4.decryptData_CBC(obj.data));
  395. self.gaoTypeArrayFirst = res.data;
  396. })
  397. }
  398. //获取意见(上表)
  399. self.getOpinion = function (str) {
  400. var data = {
  401. cmanid: self.userId,
  402. routeinfoid: self.routeinfoid,
  403. routeid: "",//self.routeid,
  404. tableid: "FW_DWZSWSXW",
  405. colid: str,
  406. opiniontype: 0,
  407. orderbycol: "CDATE desc"
  408. }
  409. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  410. .success(function (obj) {
  411. var res = strToJson(s4.decryptData_CBC(obj.data));
  412. if (res.success == true) {
  413. self.YJ[str] = res.data;
  414. self.YJ[str + "STATUS"] = false;
  415. self.YJ[str].forEach(function (item) {
  416. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  417. if (item.ROUTEID == self.routeid) {
  418. self.YJ[str + "STATUS"] = true;
  419. }
  420. })
  421. } else {
  422. sp.dialog(res.message)
  423. }
  424. })
  425. }
  426. //获取意见(不上表)
  427. self.opiniontype = 99;
  428. self.getOpinion1 = function () {
  429. var data = {
  430. cmanid: self.userId,
  431. routeinfoid: self.routeinfoid,
  432. routeid: "",//self.routeid,
  433. tableid: "FW_DWZSWSXW",
  434. colid: "",
  435. opiniontype: self.opiniontype,
  436. orderbycol: "CDATE desc"
  437. }
  438. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  439. .success(function (obj) {
  440. var res = strToJson(s4.decryptData_CBC(obj.data));
  441. if (res.success == true) {
  442. self.YJ.nulla = res.data;
  443. self.YJ.nullaSTATUS = false;
  444. self.YJ.nulla.forEach(function (item) {
  445. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  446. //if (item.ROUTEID == self.routeid && item.COLID == "") {
  447. // self.YJ.nullaSTATUS = true;
  448. //}
  449. })
  450. } else {
  451. sp.dialog(res.message)
  452. }
  453. })
  454. }
  455. //判断页面字段是否只读readonly、是否隐藏show
  456. self.hide = function (type, field) {
  457. console.log()
  458. if (self.dotype == 0 && type == "readonly") {
  459. return true;
  460. } else {
  461. if (self[type][field] == true) {
  462. return true;
  463. } else {
  464. return false;
  465. }
  466. }
  467. }
  468. //右上角按钮调用方法
  469. self.btnEvent = function (item) {
  470. switch (item.CODE) {
  471. case "SAVEITEM": self.btnSave(0); break;
  472. case "PRINTITEM": self.btnPrint(); break;
  473. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  474. case "MEETITEM": self.Meet(); break;
  475. case "SENDLOG": self.RouteList(); break;
  476. case "PUBLICITEM": self.PUBLICITEM(); break;
  477. case "FWZIHAO": return; break;
  478. default: self.forward(item); break;
  479. }
  480. }
  481. self.tiaohao = function () {
  482. var data = {
  483. data: {
  484. CYEAR: sp.currentYear(),
  485. FLOWID: sp.getUrlName("flowid"),
  486. ZIHAO: "",
  487. CNAMEMARK: "",
  488. ROUTEINFOIDMARK: self.routeinfoid,
  489. THMARK: 1
  490. }
  491. }
  492. self.FWZH.forEach(function (item) {
  493. if (item.CODE == self.data.FWZH) {
  494. data.data.ZIHAO = item.CODE;
  495. data.data.CNAMEMARK = item.CNAMEMARK
  496. }
  497. })
  498. $http.post(apiurljs.login + "g2app/fawen/saveZhanHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  499. .success(function (obj) {
  500. var res = strToJson(s4.decryptData_CBC(obj.data));
  501. if (res.success == true) {
  502. var data1 = {
  503. flowid: sp.getUrlName("flowid"),
  504. code: self.userDpCode,
  505. cyear: sp.currentYear(),
  506. routeinfoidmark: self.routeinfoid,
  507. zihao: self.data.FWZH
  508. }
  509. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  510. .success(function (obj1) {
  511. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  512. self.FWZH = res1.data.map(function (item) {
  513. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  514. });
  515. self.data.FWZH = self.FWZH[0].CODE
  516. self.btnSave(0)
  517. })
  518. } else {
  519. sp.dialog(res.message)
  520. }
  521. })
  522. }
  523. self.tiaohaoR = function () {
  524. var data = {
  525. flowid: sp.getUrlName("flowid"),
  526. cnamemark: "",
  527. routeinfoidmark: self.routeinfoid,
  528. cyear: sp.currentYear(),
  529. zihao: self.data.FWZH
  530. }
  531. self.FWZH.forEach(function (item) {
  532. if (item.CODE == self.data.FWZH) {
  533. data.cnamemark = item.CNAMEMARK
  534. }
  535. })
  536. $http.post(apiurljs.login + "g2app/fawen/initZiHaoByRouteinfoidmark", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  537. .success(function (obj) {
  538. var res = strToJson(s4.decryptData_CBC(obj.data));
  539. if (res.success == true) {
  540. if (res.data == 0) {
  541. sp.dialog("此件当前暂无占号记录!")
  542. $timeout(function () {
  543. sp.dialoghide()
  544. }, 1500)
  545. return
  546. }
  547. var data1 = {
  548. flowid: sp.getUrlName("flowid"),
  549. code: self.userDpCode,
  550. cyear: sp.currentYear(),
  551. routeinfoidmark: self.routeinfoid,
  552. zihao: ""
  553. }
  554. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  555. .success(function (obj1) {
  556. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  557. self.FWZH = res1.data.map(function (item) {
  558. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  559. });
  560. self.data.FWZH = self.FWZH[0].CODE
  561. self.btnSave(0)
  562. console.log(self.FWZH)
  563. })
  564. } else {
  565. sp.dialog(res.message)
  566. }
  567. })
  568. }
  569. //保存提交
  570. self.btnSave = function (n) {
  571. if (spngvld.submit(".sp-page-center")) {
  572. var data = {
  573. data: {
  574. CYEAR: sp.currentYear(),
  575. FLOWID: sp.getUrlName("flowid"),
  576. ZIHAO: "",
  577. CNAMEMARK: "",
  578. ROUTEINFOIDMARK: self.routeinfoid
  579. }
  580. }
  581. self.FWZH.forEach(function (item) {
  582. if (item.CODE == self.data.FWZH) {
  583. data.data.ZIHAO = item.CODE;
  584. data.data.CNAMEMARK = item.CNAMEMARK
  585. }
  586. })
  587. $http.post(apiurljs.login + "g2app/fawen/saveWenHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  588. .success(function (obj) { })
  589. var dataArray = [];
  590. self.data.WZYFZTZSQ = "";
  591. self.data.FGLDYJ = "";
  592. self.data.ZBBMFZRSH = "";
  593. self.data.HGXSH = "";
  594. self.data.HQBMFZRSH = "";
  595. self.data.BGSFHYJ = "";
  596. dataArray.push(self.data);
  597. var data = {
  598. ckey: "FW_DWZSWSXW",
  599. id: self.data.ID,
  600. routeid: self.routeid,
  601. routeinfoid: self.routeinfoid,
  602. routeinfotitle: self.data.FWBT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.FWBT,
  603. directionid: self.directionid,
  604. formeditid: self.formeditid,
  605. data: JSON.stringify(dataArray)
  606. }
  607. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  608. .success(function (obj) {
  609. var res = strToJson(s4.decryptData_CBC(obj.data));
  610. if (res.code == 0) {
  611. self.data.ID = res.data.ID;
  612. self.routeid = res.data.ROUTEID;
  613. self.routeinfoid = res.data.ROUTEINFOID;
  614. self.filedChange = false;
  615. if (n == 0) {
  616. sp.dialog("保存成功!");
  617. $timeout(function () {
  618. sp.dialoghide()
  619. }, 1500)
  620. self.getSwenList(1)
  621. } else if (n == 1) {
  622. self.forward(self.btnItem);
  623. } else if (n == 2) {
  624. self.sendAll();
  625. } else if (n == 3) {
  626. self.btnPrint();
  627. }
  628. } else {
  629. sp.dialog(res.message)
  630. }
  631. })
  632. }
  633. }
  634. //打印
  635. self.btnPrint = function () {
  636. if (self.filedChange == true) {
  637. self.btnSave(3)
  638. } else {
  639. // 创建隐藏的可下载链接
  640. var eleLink = document.createElement('a');
  641. eleLink.download = "";
  642. eleLink.style.display = 'none';
  643. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban8.ftl&tablename=FW_DWZSWSXW&outfilepath=/tmp/党委正式文(上行文).wps&printdate=NGRQ&routeinfoid=" + self.routeinfoid));
  644. // 触发点击
  645. document.body.appendChild(eleLink);
  646. eleLink.click();
  647. // 然后移除
  648. document.body.removeChild(eleLink);
  649. //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=FW_DWZSWSXW&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
  650. }
  651. }
  652. /*综合打印*/
  653. self.printFiled = 1;
  654. self.btnPrint1 = function () {
  655. if (self.filedChange == true) {
  656. self.btnSave(3)
  657. } else {
  658. sp.layer("#print")
  659. }
  660. }
  661. self.printSubmit = function () {
  662. if (self.printFiled == 1) {
  663. var templatefilename = "moban8"
  664. } else if (self.printFiled == 2) {
  665. var templatefilename = "mobanoption"
  666. } else {
  667. var templatefilename = "moban8_all"
  668. }
  669. var data = {
  670. templatefilename: templatefilename + ".ftl",
  671. outfilepath: "/tmp/党委正式文(上行文)" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  672. routeinfoid: self.routeinfoid,
  673. tablename: "FW_DWZSWSXW",
  674. printtype: self.printFiled,
  675. printdate: "NGRQ"
  676. }
  677. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  678. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  679. .success(function (obj) {
  680. var res = strToJson(s4.decryptData_CBC(obj.data));
  681. //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
  682. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  683. })
  684. //// 创建隐藏的可下载链接
  685. //var eleLink = document.createElement('a');
  686. //eleLink.download = "";
  687. //eleLink.style.display = 'none';
  688. //eleLink.href = apiurljs.login + "g2app/dataabase/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=" + templatefilename + ".ftl&tablename=SW_DWGWCBD&outfilepath=/tmp/党委公文承办单.wps&printdate=LWRQ,DBSX&routeinfoid=" + self.routeinfoid + "&printtype=" + self.printFiled));
  689. //// 触发点击
  690. //document.body.appendChild(eleLink);
  691. //eleLink.click();
  692. //// 然后移除
  693. //document.body.removeChild(eleLink);
  694. sp.layerhide()
  695. }
  696. //签写意见编辑状态
  697. self.opinion = {
  698. WZYFZTZSQ: false,
  699. WZYFZTZSQImg: false,
  700. FGLDYJ: false,
  701. FGLDYJImg: false,
  702. ZBBMFZRSH: false,
  703. ZBBMFZRSHImg: false,
  704. HGXSH: false,
  705. HGXSHImg: false,
  706. HQBMFZRSH: false,
  707. HQBMFZRSHImg: false,
  708. BGSFHYJ: [],
  709. BGSFHYJSTATUS: false,
  710. nulla: false
  711. }
  712. self.YJ = {
  713. WZYFZTZSQ: [],
  714. WZYFZTZSQSTATUS: false,
  715. FGLDYJ: [],
  716. FGLDYJSTATUS: false,
  717. ZBBMFZRSH: [],
  718. ZBBMFZRSHSTATUS: false,
  719. HGXSH: [],
  720. HGXSHSTATUS: false,
  721. HQBMFZRSH: [],
  722. HQBMFZRSHSTATUS: false,
  723. BGSFHYJ: [],
  724. BGSFHYJSTATUS: false,
  725. nulla: [],
  726. nullaSTATUS: false
  727. }
  728. //意见(下表)
  729. self.openOptionList = function () {
  730. if (self.routeinfoid == 0 && self.routeid == 0) {
  731. sp.dialog("请先保存!")
  732. return;
  733. }
  734. if (self.opinion.nulla == true) {
  735. return;
  736. }
  737. self.nulla = "";
  738. $(".optionList").css("height", 149)
  739. self.opinion.nulla = true;
  740. }
  741. self.closeOptionList = function () {
  742. $(".optionList").css("height", 389)
  743. self.opinion.nulla = false;
  744. }
  745. self.submitOptionList = function () {
  746. var data = {
  747. cmanid: self.userId,
  748. routeinfoid: self.routeinfoid,
  749. routeid: self.routeid,
  750. tableid: "FW_DWZSWSXW",
  751. colid: "",
  752. opiniontype: 99,
  753. cresult: "",
  754. opinion: self.nulla,
  755. opinionimage: ""
  756. }
  757. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  758. .success(function (obj) {
  759. var res = strToJson(s4.decryptData_CBC(obj.data));
  760. if (res.success == true) {
  761. self.getOpinion1();
  762. self.opinion.nulla = false;
  763. $(".optionList").css("height", 389)
  764. } else {
  765. sp.dialog(res.message)
  766. }
  767. })
  768. }
  769. self.changeOptionList = function (item) {
  770. self.nulla = item.OPINION;
  771. self.opinion.nulla = true;
  772. }
  773. //意见附件(下表)
  774. self.uploading1 = false;
  775. self.upload1 = function () {
  776. $('#fileupload1').fileupload({
  777. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  778. dataType: 'json',
  779. beforeSend: function (xhr, data) {
  780. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  781. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  782. + ",routeid=" + self.routeid + ",tableid=FW_DWZSWSXW"));
  783. },
  784. // 上传完成后的执行逻辑
  785. done: function (e, data) {
  786. self.uploading1 = false;
  787. self.getOpinion1()
  788. }
  789. })
  790. }
  791. //下载意见表附件
  792. self.downLoadOption = function (item) {
  793. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  794. }
  795. //删除意见表附件
  796. self.deleteOptionFile = function (file, str) {
  797. var data = {
  798. routeid: file.ROUTEID,
  799. tableid: "FW_DWZSWSXW",
  800. colid: str,
  801. fileid: file.FILEID
  802. };
  803. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  804. .success(function (obj) {
  805. var res = strToJson(s4.decryptData_CBC(obj.data));
  806. sp.dialoghide();
  807. if (res.success) {
  808. if (str != "") {
  809. self.getOpinion(str);
  810. } else {
  811. self.getOpinion1();
  812. }
  813. } else {
  814. sp.dialog("删除失败,请联系管理员!");
  815. }
  816. });
  817. }
  818. //意见附件(上表)
  819. self.upload2 = function (str) {
  820. $('#fileupload-' + str).fileupload({
  821. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  822. dataType: 'json',
  823. beforeSend: function (xhr, data) {
  824. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  825. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  826. + ",routeid=" + self.routeid + ",tableid=FW_DWZSWSXW,colid=" + str));
  827. },
  828. // 上传完成后的执行逻辑
  829. done: function (e, data) {
  830. self.uploading1 = false;
  831. self.getOpinion(str)
  832. }
  833. })
  834. }
  835. //签写意见
  836. self.openOpinion = function (str) {
  837. if (self.routeinfoid == 0 && self.routeid == 0) {
  838. sp.dialog("请先保存!")
  839. return;
  840. }
  841. self.opinion[str] = true;
  842. }
  843. //修改意见
  844. self.changeOpinion = function (str) {
  845. self.data[str] = self.YJ[str][0].OPINION;
  846. self.opinion[str] = true;
  847. }
  848. self.changeOpinionItem = function (str, item) {
  849. if (item.OPINIONIMAGE != "") {
  850. self.QianZi(str);
  851. self.opinion[str + "Img"] = true;
  852. }
  853. self.data[str] = item.OPINION;
  854. self.opinion[str] = true;
  855. }
  856. //提交意见
  857. self.Sopinion = function (str) {
  858. if (self.opinion[str + "Img"] == true) {
  859. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  860. } else {
  861. self.data[str] = $("#" + str).val();
  862. }
  863. var data = {
  864. cmanid: self.userId,
  865. routeinfoid: self.routeinfoid,
  866. routeid: self.routeid,
  867. tableid: "FW_DWZSWSXW",
  868. colid: str,
  869. opiniontype: 0,
  870. cresult: "",
  871. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  872. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  873. }
  874. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  875. .success(function (obj) {
  876. var res = strToJson(s4.decryptData_CBC(obj.data));
  877. if (res.success == true) {
  878. self.getOpinion(str);
  879. self.opinion[str] = false;
  880. self.opinion[str + "Img"] = false;
  881. self.data[str] = "";
  882. self.changeFiled(str)
  883. } else {
  884. sp.dialog(res.message)
  885. }
  886. })
  887. }
  888. //删除意见
  889. self.Dopinion = function (str, item) {
  890. var data = {
  891. cmanid: self.userId,
  892. routeid: self.routeid,
  893. tableid: "FW_DWZSWSXW",
  894. colid: str,
  895. }
  896. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  897. .success(function (obj) {
  898. var res = strToJson(s4.decryptData_CBC(obj.data));
  899. if (res.success == true) {
  900. if (str != "") {
  901. self.getOpinion(str);
  902. } else {
  903. self.getOpinion1();
  904. }
  905. self.changeFiled(str)
  906. } else {
  907. sp.dialog(res.message)
  908. }
  909. })
  910. }
  911. self.phraseText = "";//添加常用语
  912. self.phraseList = []//常用语列表
  913. //获取常用语库
  914. self.phrase = function (colid) {
  915. sp.layer("#phrase");
  916. self.colid = colid;
  917. self.getPhrase();
  918. }
  919. //添加常用语到常用语库
  920. self.Aphrase = function () {
  921. if (self.phraseText == "") {
  922. return;
  923. }
  924. var data = {
  925. cmanid: self.userId,
  926. tableid: "FW_DWZSWSXW",
  927. colid: self.colid,
  928. contents: self.phraseText
  929. }
  930. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  931. .success(function (obj) {
  932. var res = strToJson(s4.decryptData_CBC(obj.data));
  933. if (res.success == true) {
  934. self.phraseText = "";
  935. self.getPhrase();
  936. } else {
  937. sp.dialog(res.message)
  938. }
  939. })
  940. }
  941. //获取常用语库
  942. self.getPhrase = function () {
  943. var data = {
  944. cmanid: self.userId,
  945. tableid: "FW_DWZSWSXW",
  946. colid: self.colid
  947. }
  948. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  949. .success(function (obj) {
  950. var res = strToJson(s4.decryptData_CBC(obj.data));
  951. self.phraseList = res.data;
  952. self.phraseSelect = self.phraseList[0].CONTENTS;
  953. })
  954. }
  955. //从常用语库删除
  956. self.Dphrase = function () {
  957. var id = null;
  958. $.each(self.phraseList, function (index, item) {
  959. if (item.CONTENTS == self.phraseSelect) {
  960. id = item.ID;
  961. }
  962. })
  963. var data = {
  964. id: id
  965. }
  966. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  967. .success(function (obj) {
  968. var res = strToJson(s4.decryptData_CBC(obj.data));
  969. self.getPhrase();
  970. })
  971. }
  972. //常用语确认为意见
  973. self.btnPhrase = function () {
  974. if (!self.colid) {
  975. self.nulla = self.phraseSelect;
  976. } else {
  977. self.data[self.colid] = self.phraseSelect;
  978. }
  979. sp.layerhide();
  980. }
  981. //签字—手写
  982. self.QianZi = function (str) {
  983. self.opinion[str + "Img"] = true;
  984. setTimeout(function () {
  985. new lineCanvas(str + "QZ")
  986. }, 1)
  987. }
  988. //清除手写
  989. self.canvasClear = function (str) {
  990. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  991. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  992. }
  993. //发生修改
  994. self.changeFiled = function (str) {
  995. self.filedChange = true;
  996. }
  997. //转发
  998. self.forward = function (obj) {
  999. self.btnItem = obj;
  1000. if (self.filedChange == true) {
  1001. self.btnSave(1)
  1002. } else {
  1003. $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=fawendw")
  1004. sp.layer("#forward")
  1005. }
  1006. }
  1007. //查看流转记录
  1008. self.RouteList = function () {
  1009. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1010. //var data = {
  1011. // directionid: self.directionid,
  1012. // userid: self.userId,
  1013. // routeid: self.routeid,
  1014. // routeinfoid: self.routeinfoid,
  1015. //}
  1016. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1017. //.success(function (obj) {
  1018. // var res = strToJson(s4.decryptData_CBC(obj.data));
  1019. // self.routeList = res.data;
  1020. // $.each(self.routeList, function (index, item) {
  1021. // item.mainUser = [];
  1022. // item.copyUsers = [];
  1023. // $.each(item.USERS, function (index1, item1) {
  1024. // if (item1.KIND == 0) {
  1025. // item.mainUser.push(item1.USERNAME);
  1026. // } else {
  1027. // item.copyUsers.push(item1.USERNAME);
  1028. // }
  1029. // })
  1030. // item.mainUser = item.mainUser.join(",");
  1031. // item.copyUsers = item.copyUsers.join(",");
  1032. // })
  1033. // setTimeout(function (item) {
  1034. // sp.layer("#RouteList");
  1035. // }, 100);
  1036. //})
  1037. }
  1038. self.reSizeRow = function () {
  1039. var bodybox = document.getElementById("bodyDiv");
  1040. var topbox = document.getElementById("topDiv");
  1041. var bottombox = document.getElementById("bottomDiv");
  1042. var line = document.getElementById("lineDiv");
  1043. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  1044. $(".mousemove").show()
  1045. var bodyboxH = bodybox.clientHeight;
  1046. var topboxH = topbox.clientHeight;
  1047. var bottomboxH = bottombox.clientHeight;
  1048. //var y = event.pageY - line.offsetTop;
  1049. var y = event.pageY - line.clientHeight;
  1050. document.addEventListener("mousemove", boxMove)
  1051. function boxMove(event) {
  1052. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1053. //
  1054. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1055. //
  1056. } else {
  1057. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1058. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1059. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  1060. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  1061. }
  1062. }
  1063. document.addEventListener("mouseup", function () {
  1064. $(".mousemove").hide()
  1065. document.removeEventListener("mousemove", boxMove)
  1066. })
  1067. })
  1068. }
  1069. ////头部关键字搜索---20230905
  1070. self.headBtnSearchKeyword = "";
  1071. self.headSearchResult = [];
  1072. self.headSearchResult_view = false;
  1073. self.headBtnSearch = function () {
  1074. if (sp.isval(self.headBtnSearchKeyword)) {
  1075. self.headSearchResult = [];
  1076. var data = {
  1077. "url": "/basic/api/StatSelect/selectCodeList",
  1078. "data": { "keyWord": self.headBtnSearchKeyword }
  1079. }
  1080. //console.log(JSON.stringify(data));
  1081. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1082. .success(function (obj) {
  1083. var res = strToJson(s4.decryptData_CBC(obj.data));
  1084. //console.log(JSON.stringify(res.data));
  1085. self.headSearchResult = res.data.build;
  1086. if (sp.isval(self.headSearchResult)) {
  1087. self.headSearchResult_view = true;
  1088. } else {
  1089. self.headSearchResult_view = false;
  1090. }
  1091. })
  1092. } else {
  1093. self.headSearchResult_view = false;
  1094. }
  1095. };
  1096. self.headKeywordPage = function (itemdata) {
  1097. var get_token = localStorage.getItem("main-token");
  1098. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1099. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1100. self.headSearchResult_view = false;
  1101. };
  1102. self.onePic = function () {
  1103. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1104. }
  1105. //公开
  1106. self.PUBLICITEM = function () {
  1107. var data = {
  1108. userid: self.userId
  1109. }
  1110. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1111. .success(function (obj) {
  1112. var res = strToJson(s4.decryptData_CBC(obj.data));
  1113. var data1 = {
  1114. tablename: "CODE_LM"
  1115. }
  1116. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  1117. .success(function (obj1) {
  1118. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  1119. self.LM = res1.data[0].C_H_I_L_D_DATA;
  1120. self.LM.forEach(function (item) {
  1121. item.show = true;
  1122. if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
  1123. item.show = false;
  1124. }
  1125. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1126. item1.show = true;
  1127. if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
  1128. item1.show = false;
  1129. }
  1130. })
  1131. })
  1132. self.filed = "GKFW";
  1133. self.msgGK = {
  1134. WJLY: "FW",
  1135. FLOWID: "AA88",
  1136. FORMROUTEINFOID: self.routeinfoid,
  1137. FBUSERID: self.userId,
  1138. FBNAME: self.userName,
  1139. GKFW: "",
  1140. LM: "P0103",
  1141. LM1: "委发文件",
  1142. FBRQ: sp.getLocalDate(),
  1143. FBBM: res.data[0].SECTION,
  1144. WJBT: self.data.FWBT
  1145. }
  1146. sp.layer("#PUBLICITEM")
  1147. $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
  1148. })
  1149. })
  1150. }
  1151. self.showCol = function ($event, ele) {
  1152. $('.detail-col').not(ele).hide();
  1153. $(ele).toggle("slow").autoHide();
  1154. $event.stopPropagation();
  1155. }
  1156. self.selectLM = function (item) {
  1157. self.msgGK.LM = item.CODE
  1158. self.msgGK.LM1 = item.CNAME
  1159. console.log(self.msgGK)
  1160. $(".detail-col").toggle("slow");
  1161. }
  1162. self.showSecond = function (obj, n) {
  1163. self.LM1 = obj.C_H_I_L_D_DATA;
  1164. $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
  1165. $(".detail-col").eq(1).show().autoHide()
  1166. }
  1167. self.checkAllUser1 = function () {
  1168. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  1169. $.each(self.UserList[self.filed], function (index, item) {
  1170. item.checked = self.AllChecked[self.filed];
  1171. $.each(item.USER, function (index1, item1) {
  1172. item1.checked = self.AllChecked[self.filed];
  1173. })
  1174. })
  1175. self.submitGK(1)
  1176. }
  1177. self.checkUserItem1 = function (item) {
  1178. item.checked = !item.checked;
  1179. $.each(item.USER, function (index, item1) {
  1180. item1.checked = item.checked;
  1181. })
  1182. var n = 0;
  1183. $.each(self.UserList[self.filed], function (index, item) {
  1184. if (item.checked == true) {
  1185. n++
  1186. }
  1187. })
  1188. if (n == self.UserList[self.filed].length) {
  1189. self.AllChecked[self.filed] = true;
  1190. } else {
  1191. self.AllChecked[self.filed] = false;
  1192. }
  1193. self.submitGK(1)
  1194. }
  1195. self.checkUser1 = function (item) {
  1196. item.checked = !item.checked;
  1197. var n = [], all = 0;
  1198. $.each(self.UserList[self.filed], function (x, y) {
  1199. n.push(0);
  1200. $.each(y.USER, function (x1, y1) {
  1201. if (y1.checked == true) {
  1202. n[x]++
  1203. }
  1204. })
  1205. if (n[x] == y.USER.length && n[x] != 0) {
  1206. y.checked = true;
  1207. all++
  1208. } else {
  1209. y.checked = false;
  1210. }
  1211. })
  1212. if (all == self.UserList[self.filed].length) {
  1213. self.AllChecked[self.filed] = true;
  1214. } else {
  1215. self.AllChecked[self.filed] = false;
  1216. }
  1217. self.submitGK(1)
  1218. }
  1219. self.submitGK = function (n) {
  1220. var AllCheckedLength = 0;
  1221. self.selectList[self.filed] = [];
  1222. $.each(self.UserList[self.filed], function (index, item) {
  1223. $.each(item.USER, function (index1, item1) {
  1224. if (item1.checked == true) {
  1225. AllCheckedLength++;
  1226. self.selectList[self.filed].push(item1)
  1227. }
  1228. })
  1229. })
  1230. self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
  1231. return item.USERID
  1232. }).join(",")
  1233. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  1234. if (n == 0) {
  1235. sp.layerhide();
  1236. var data = {
  1237. tablename: "SX_FBLIST",
  1238. data: {
  1239. WJLY: self.msgGK.WJLY,
  1240. FLOWID: self.msgGK.FLOWID,
  1241. FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
  1242. FBUSERID: self.msgGK.FBUSERID,
  1243. FBNAME: self.msgGK.FBNAME,
  1244. GKFW: self.msgGK.GKFW,
  1245. LM: self.msgGK.LM,
  1246. FBRQ: self.msgGK.FBRQ,
  1247. FBBM: self.msgGK.FBBM,
  1248. WJBT: self.msgGK.WJBT
  1249. }
  1250. }
  1251. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1252. .success(function (obj) {
  1253. var res = strToJson(s4.decryptData_CBC(obj.data));
  1254. sp.layerhide();
  1255. if (res.success) {
  1256. sp.dialog("操作成功!");
  1257. $timeout(function () {
  1258. sp.dialoghide();
  1259. }, 1000)
  1260. } else {
  1261. sp.dialog(res.message);
  1262. }
  1263. })
  1264. }
  1265. }
  1266. //头部下滚冻结
  1267. $(function () {
  1268. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1269. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  1270. //$("body").bind("scroll", function () {
  1271. // var scrollTop = $("body").scrollTop();
  1272. // if (scrollTop == 0) {
  1273. // $(".FixTop").removeClass("FixTop");
  1274. // }
  1275. // if (scrollTop > 35) {
  1276. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1277. // }
  1278. //});
  1279. //页面高度撑满
  1280. setTimeout(function () {
  1281. if ($(".ibox-content").height() < $(window).height() - 31) {
  1282. $(".ibox-content").css("height", $(window).height() - 31)
  1283. }
  1284. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1285. }, 1)
  1286. })
  1287. }])
  1288. app.filter('trustHtml', function ($sce) {
  1289. return function (input) {
  1290. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1291. };
  1292. });
  1293. //canvas画布签字
  1294. function lineCanvas(obj) {
  1295. var self = this;
  1296. self.linewidth = 1;
  1297. self.color = "#000000";
  1298. self.background = "#ffffff";
  1299. self.canvas = document.createElement("canvas");
  1300. document.getElementById(obj).appendChild(self.canvas);
  1301. self.cxt = self.canvas.getContext("2d");
  1302. self.canvas.width = document.getElementById(obj).clientWidth;
  1303. self.canvas.height = document.getElementById(obj).scrollHeight;
  1304. self.cxt.fillStyle = self.background;
  1305. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1306. self.cxt.strokeStyle = self.color;
  1307. self.cxt.lineWidth = self.linewidth;
  1308. self.cxt.lineCap = "round";
  1309. //开始绘制
  1310. self.canvas.addEventListener("mousedown", function (e) {
  1311. self.cxt.beginPath();
  1312. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1313. self.canvas.addEventListener("mousemove", move)
  1314. }.bind(self), false);
  1315. //绘制中
  1316. function move() {
  1317. var e = window.event;
  1318. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1319. self.cxt.stroke();
  1320. }
  1321. //结束绘制
  1322. self.canvas.addEventListener("mouseup", up)
  1323. function up() {
  1324. self.cxt.closePath();
  1325. self.canvas.removeEventListener("mousemove", move)
  1326. }
  1327. };
  1328. function showToggle(e) {
  1329. $(e).children().toggle()
  1330. $(e).next().toggle()
  1331. }
  1332. function toggleYJL(e) {
  1333. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1334. $("#topDiv").css("height", 160)
  1335. $(e).parent().css("height", 450)
  1336. $("#attachlist").css("height", 200)
  1337. $("#bottomDiv").css("height", "")
  1338. } else {
  1339. $("#topDiv").css("height", 600)
  1340. $(e).parent().css("height", 10)
  1341. }
  1342. $(e).children().toggle()
  1343. }