formedit.js 45 KB

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