formedit.js 49 KB

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