formedit.js 55 KB

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