formedit.js 46 KB

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