formedit.js 47 KB

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