formedit.js 49 KB

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