formedit.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  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 base64 = new Base64(); //声明base解码和编码类
  25. var postCfg = {
  26. headers: {
  27. 'Content-Type': 'application/json',
  28. 'Authorization': "Bearer " + self.get_AccessToken
  29. }
  30. };
  31. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  32. //初始化参数数组
  33. self.data = {
  34. ID: 0,
  35. APPCODE: "",
  36. WJBH:"",
  37. FBRQ:"",
  38. FBR:"",
  39. FBNR:"",
  40. FBBM:"",
  41. FJ:"",
  42. WJBT:"",
  43. LX:"",
  44. FBZT:""
  45. }
  46. //初始化只读数组
  47. self.readonly = {
  48. WJBH:false,
  49. FBRQ:false,
  50. FBR:false,
  51. FBNR:false,
  52. FBBM:false,
  53. FJ:false,
  54. WJBT:false,
  55. LX:false,
  56. FBZT:false
  57. }
  58. self.LX=[];
  59. self.FBBM=[];
  60. self.FBZT=[];
  61. //初始化右上角按钮
  62. self.buttonList = []
  63. //上传附件
  64. self.arrayFile = [];
  65. self.beforeUpload = function () {
  66. if (self.data.ID == 0) {
  67. var getContent = editor2.html();
  68. var getContent_base64 = base64.encode(getContent);
  69. self.data.FBNR = getContent_base64;
  70. var dataArray = [];
  71. dataArray.push(self.data);
  72. var data = {
  73. ckey: "WJFB_CB",
  74. id: self.data.ID,
  75. routeid: self.routeid,
  76. routeinfoid: self.routeinfoid,
  77. routeinfotitle: self.data.WJBT,
  78. directionid: self.directionid,
  79. formeditid: self.formeditid,
  80. data: JSON.stringify(dataArray)
  81. }
  82. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  83. .success(function (obj) {
  84. var res = strToJson(s4.decryptData_CBC(obj.data));
  85. if (res.code == 0) {
  86. self.data.ID = res.data.ID;
  87. self.routeid = res.data.ROUTEID;
  88. self.routeinfoid = res.data.ROUTEINFOID;
  89. self.getSwenList(1)
  90. self.upload3()
  91. } else {
  92. sp.dialog(res.message)
  93. }
  94. })
  95. } else {
  96. self.upload3()
  97. }
  98. }
  99. //上层附件、业务参考、共享沟通组件
  100. self.uploading = false;
  101. self.upload = function () {
  102. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  103. return item.CNAME
  104. })
  105. $('#fileupload').fileupload({
  106. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  107. dataType: 'json',
  108. beforeSend: function (xhr, data) {
  109. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  110. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=文件发布"));
  111. },
  112. add: function (e, data) {
  113. var num = 0;
  114. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  115. //文件类型判断
  116. $.each(data.originalFiles, function (index, item) {
  117. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  118. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  119. return;
  120. } else {
  121. num++
  122. }
  123. })
  124. if (num == data.originalFiles.length) {
  125. self.uploading = true;
  126. data.submit();
  127. $scope.$apply();
  128. }
  129. },
  130. // 上传完成后的执行逻辑
  131. done: function (e, data) {
  132. self.uploading = false;
  133. self.getOther()
  134. }
  135. })
  136. }
  137. self.upload3 = function () {
  138. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  139. return item.CNAME
  140. })
  141. $('#fileupload2').fileupload({
  142. url: apiurljs.login + 'g2app/abase/saveUploadFileName',
  143. dataType: 'json',
  144. beforeSend: function (xhr, data) {
  145. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  146. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=WJFB_CB,column=FJ,routeinfoid=" + self.routeinfoid + ",loaded=" + data.loaded + ",total=" + data.total));
  147. },
  148. // 上传完成后的执行逻辑
  149. done: function (e, data) {
  150. var arrayFile = strToJson(s4.decryptData_CBC(data.result.data).slice(0, s4.decryptData_CBC(data.result.data).lastIndexOf("}") + 1))
  151. self.arrayFile = arrayFile.data;
  152. self.arrayFile.forEach(function (item) {
  153. item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
  154. })
  155. $scope.$apply();//绑定数据局部刷新
  156. }
  157. })
  158. $timeout(function () {
  159. $("#fileupload2").trigger("click")
  160. }, 1)
  161. }
  162. self.downLoad = function (item) {
  163. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  164. }
  165. //获取附件和插件
  166. self.getOther = function () {
  167. var data = {
  168. tablename: "FILE_ATTACH",
  169. colums: "*",
  170. order: "ID desc",
  171. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  172. sqlinwhere: "",
  173. sqllikewhere: ""
  174. }
  175. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  176. .success(function (obj) {
  177. var res = strToJson(s4.decryptData_CBC(obj.data));
  178. console.log(res)
  179. self.arrayFile1 = [];
  180. if (res.data.length > 0) {
  181. res.data.forEach(function (item) {
  182. self.arrayFile1.push(item)
  183. })
  184. }
  185. })
  186. }
  187. self.getFLOW = function () {
  188. var data = {
  189. copyrightid: self.copyrightid
  190. }
  191. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  192. .success(function (obj) {
  193. var res = strToJson(s4.decryptData_CBC(obj.data));
  194. self.flowTitle = res.data.CNAME;
  195. // self.getJJCD()
  196. })
  197. }
  198. self.deleteFile = function (file) {
  199. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  200. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  201. 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>";
  202. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  203. sp.openCenter(".sp-dialog");
  204. ///取消按钮
  205. $('.sp-closeDialog').click(function (event) {
  206. sp.closeCenter(".sp-dialog");
  207. event.preventDefault();
  208. event.stopPropagation();
  209. });
  210. //post消息的id
  211. $("#delDataTrue").click(function () {
  212. var data = {
  213. tablename: "FILE_ATTACH",
  214. id: file.ID
  215. };
  216. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  217. .success(function (obj) {
  218. var res = strToJson(s4.decryptData_CBC(obj.data));
  219. sp.dialoghide();
  220. if (res.success) {
  221. self.getOther();
  222. } else {
  223. sp.dialog("删除失败,请联系管理员!");
  224. }
  225. });
  226. });
  227. }
  228. self.goAttach = function (obj) {
  229. if (obj) {
  230. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  231. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  232. return
  233. }
  234. $("#attachlist")[0].contentWindow.openFile(obj)
  235. if ($(".fa-chevron-down").is(":hidden") == true) {
  236. showToggle(document.getElementById("toggleButton"))
  237. }
  238. } else {
  239. if ($("#attachlist").attr("src") == '') {
  240. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  241. }
  242. }
  243. }
  244. self.getSwenList = function (n) {
  245. self.SwenList = [];
  246. var data = {
  247. directionid: self.directionid,
  248. userid: self.userId,
  249. routeinfoid: self.routeinfoid,
  250. routeid: self.routeid,
  251. formeditid: ""
  252. }
  253. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  254. .success(function (obj) {
  255. var res = strToJson(s4.decryptData_CBC(obj.data));
  256. $.each(res.data.LINKS, function (index, item) {
  257. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  258. self.Title = item.VNAME;
  259. }
  260. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  261. if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
  262. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  263. } else {
  264. item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  265. }
  266. } else {
  267. item.TEMPFORM = "#";
  268. }
  269. self.SwenList.push(item)
  270. })
  271. self.SwenList.push({
  272. VNAME: "流程图",
  273. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  274. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  275. })
  276. if (n == 0) {
  277. self.getZRBM()
  278. self.getFLOW()
  279. self.getOther()
  280. } else {
  281. self.getData()
  282. }
  283. })
  284. }
  285. self.getSwenList(0)
  286. self.getZRBM = function () {
  287. var data = {
  288. ckey: "CODE_ZRBM",
  289. routeinfoid: self.routeinfoid
  290. }
  291. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  292. .success(function (obj) {
  293. var res = strToJson(s4.decryptData_CBC(obj.data));
  294. self.ZRBM = res.data.CODE_ZRBM;
  295. self.getLM()
  296. })
  297. }
  298. self.getLM = function () {
  299. var data = {
  300. tablename: "CODE_LM"
  301. }
  302. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  303. .success(function (obj) {
  304. var res = strToJson(s4.decryptData_CBC(obj.data));
  305. self.LX = [];
  306. res.data[0].C_H_I_L_D_DATA.forEach(function (item) {
  307. if (self.directionid == "SequenceFlow_0gqlk33_af78f780-9140-42c4-81c5-34fd14fcf9b3") {
  308. if (item.CNAME != "新闻动态" && item.CNAME != "通知公告" && ((item.MKUSERID != null && item.MKUSERID.indexOf(self.userId) != -1) || item.MKUSERID == null || item.MKUSERID == "")) {
  309. self.LX.push(item)
  310. }
  311. } else {
  312. if (item.CNAME != "新闻动态" && item.CNAME != "通知公告") {
  313. self.LX.push(item)
  314. }
  315. }
  316. })
  317. self.getDP()
  318. })
  319. }
  320. self.getDP = function () {
  321. var data = {
  322. userid: self.userId
  323. }
  324. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  325. .success(function (obj) {
  326. var res = strToJson(s4.decryptData_CBC(obj.data));
  327. self.userDp = res.data.length == 0 ? "" : res.data[0].CODE;
  328. self.getData()
  329. })
  330. }
  331. //获取数据
  332. self.getData = function () {
  333. var data = {
  334. ckey: "WJFB_CB",
  335. id: 0,
  336. directionid: self.directionid,
  337. formeditid: self.formeditid,
  338. routeid: self.routeid,
  339. routeinfoid: self.routeinfoid
  340. }
  341. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  342. .success(function (obj) {
  343. var res = strToJson(s4.decryptData_CBC(obj.data));
  344. self.data = {
  345. ID: res.data.WJFB_CB.ID,
  346. WJBH: res.data.WJFB_CB.WJBH,
  347. FBR: res.data.WJFB_CB.FBR == "" ? self.userName : res.data.WJFB_CB.FBR,
  348. FBNR: res.data.WJFB_CB.FBNR == null ? "" : res.data.WJFB_CB.FBNR,
  349. FBRQ: res.data.WJFB_CB.FBRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.WJFB_CB.FBRQ),
  350. LX: res.data.WJFB_CB.LX == "" ? self.LX[0].CODE : res.data.WJFB_CB.LX,
  351. LXNAME: res.data.WJFB_CB.LXNAME == "" ? self.LX[0].CNAME : res.data.WJFB_CB.LXNAME,
  352. //FBZT: res.data.WJFB_CB.FBZT == "" ? self.LX[0].CODE : res.data.WJFB_CB.FBZT,
  353. FBLX: "文件发布",
  354. FBBM: res.data.WJFB_CB.FBBM == "" ? self.userDp : res.data.WJFB_CB.FBBM,
  355. WJBT:res.data.WJFB_CB.WJBT
  356. }
  357. self.WJBTROWS = Math.ceil(self.data.WJBT.length / 34);
  358. $scope.data = self.data;
  359. self.readonly = {
  360. WJBH: res.data.WJFB_CB["WJBH.EREADONLY"] == "true",
  361. FBR: res.data.WJFB_CB["FBR.EREADONLY"] == "true",
  362. FBNR: res.data.WJFB_CB["FBNR.EREADONLY"] == "true",
  363. FBRQ: res.data.WJFB_CB["FBRQ.EREADONLY"] == "true",
  364. LX: res.data.WJFB_CB["LX.EREADONLY"] == "true",
  365. FBBM: res.data.WJFB_CB["FBBM.EREADONLY"] == "true",
  366. //FBZT: res.data.WJFB_CB["FBZT.EREADONLY"] == "true",
  367. FJ: res.data.WJFB_CB["FJ.EREADONLY"] == "true",
  368. WJBT: res.data.WJFB_CB["WJBT.EREADONLY"] == "true"
  369. }
  370. self.ZRBM.forEach(function (item) {
  371. if (self.data.FBBM == item.CODE) {
  372. self.userDpName = item.CNAME
  373. console.log(self.userDpName)
  374. }
  375. })
  376. if (self.data.ID == 0) {
  377. self.filedChange = true;
  378. } else {
  379. self.filedChange = false;
  380. }
  381. if (res.data.WJFB_CB.FJ && res.data.WJFB_CB.FJ != "") {
  382. self.arrayFile = JSON.parse(res.data.WJFB_CB.FJ);
  383. self.arrayFile.forEach(function (item) {
  384. item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
  385. })
  386. }
  387. editor2.html(base64.decode(self.data.FBNR));
  388. self.buttonList = res.data["WJFB_CB.FUNCLIST"];
  389. self.getOpinion("YJ")
  390. self.getOpinion1()
  391. //watermark({
  392. // "watermarl_element": "app",
  393. // "watermark_txt": "测试水印内容",
  394. // "watermark_width": 150,
  395. // "watermark_height": 110,
  396. // "watermark_angle": 345
  397. //})
  398. })
  399. }
  400. //获取意见
  401. self.getOpinion = function (str) {
  402. var data = {
  403. cmanid: self.userId,
  404. routeinfoid: self.routeinfoid,
  405. routeid: "",//self.routeid,
  406. tableid: "WJFB_CB",
  407. colid: str,
  408. opiniontype: 0,
  409. orderbycol: "CDATE desc"
  410. }
  411. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  412. .success(function (obj) {
  413. var res = strToJson(s4.decryptData_CBC(obj.data));
  414. if (res.success == true) {
  415. self.YJ[str] = res.data;
  416. self.YJ[str + "STATUS"] = false;
  417. self.YJ[str].forEach(function (item) {
  418. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  419. if (item.ROUTEID == self.routeid) {
  420. self.YJ[str + "STATUS"] = true;
  421. }
  422. })
  423. } else {
  424. sp.dialog(res.message)
  425. }
  426. })
  427. }
  428. //获取意见(不上表)
  429. self.opiniontype = 99;
  430. self.getOpinion1 = function () {
  431. var data = {
  432. cmanid: self.userId,
  433. routeinfoid: self.routeinfoid,
  434. routeid: "",//self.routeid,
  435. tableid: "WJFB_CB",
  436. colid: "",
  437. opiniontype: self.opiniontype,
  438. orderbycol: "CDATE desc"
  439. }
  440. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  441. .success(function (obj) {
  442. var res = strToJson(s4.decryptData_CBC(obj.data));
  443. if (res.success == true) {
  444. self.YJ.nulla = res.data;
  445. self.YJ.nullaSTATUS = false;
  446. self.YJ.nulla.forEach(function (item) {
  447. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  448. //if (item.ROUTEID == self.routeid && item.COLID == "") {
  449. // self.YJ.nullaSTATUS = true;
  450. //}
  451. })
  452. } else {
  453. sp.dialog(res.message)
  454. }
  455. })
  456. }
  457. //判断页面字段是否只读readonly、是否隐藏show
  458. self.hide = function (type, field) {
  459. if (self.dotype == 0 && type == "readonly") {
  460. return true;
  461. } else {
  462. if (self[type][field] == true) {
  463. return true;
  464. } else {
  465. return false;
  466. }
  467. }
  468. }
  469. //右上角按钮调用方法
  470. self.btnEvent = function (item) {
  471. switch (item.CODE) {
  472. case "SAVEITEM": self.btnSave(0); break;
  473. case "PRINTITEM": self.btnPrint(); break;
  474. case "MEETITEM": self.Meet(); break;
  475. case "SENDLOG": self.RouteList(); break;
  476. default: self.forward(item); break;
  477. }
  478. }
  479. //保存提交,0直接保存,1保存后转发,2保存后对多人转发,3保存后跳转浏览
  480. self.btnSave = function (n) {
  481. if (spngvld.submit(".sp-page-center")) {
  482. var getContent = editor2.html();
  483. var getContent_base64 = base64.encode(getContent);
  484. self.data.FBNR = getContent_base64;
  485. var dataArray = [];
  486. self.data.YJ = "";
  487. self.data.FBRQ = self.data.FBRQ + " " + sp.datefmt("HH:mm:ss", sp.getLocalDate())
  488. dataArray.push(self.data);
  489. var data = {
  490. ckey: "WJFB_CB",
  491. id: self.data.ID,
  492. routeid: self.routeid,
  493. routeinfoid: self.routeinfoid,
  494. routeinfotitle: self.data.WJBT,
  495. directionid: self.directionid,
  496. formeditid: self.formeditid,
  497. data: JSON.stringify(dataArray)
  498. }
  499. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  500. .success(function (obj) {
  501. var res = strToJson(s4.decryptData_CBC(obj.data));
  502. if (res.code == 0) {
  503. self.data.ID = res.data.ID;
  504. self.routeid = res.data.ROUTEID;
  505. self.routeinfoid = res.data.ROUTEINFOID;
  506. self.filedChange = false;
  507. if (n == 0) {
  508. sp.dialog("保存成功!");
  509. $timeout(function () {
  510. sp.dialoghide()
  511. }, 1500)
  512. self.getSwenList(1)
  513. } else if (n == 1) {
  514. self.forward(self.btnItem);
  515. } else if (n == 2) {
  516. self.sendAll();
  517. } else if (n == 3) {
  518. self.browse();
  519. }
  520. } else {
  521. sp.dialog(res.message)
  522. }
  523. })
  524. }
  525. }
  526. //浏览
  527. self.browse = function () {
  528. sp.openNewWindow(window.location.pathname.replace("formedit", "detail") + "?id=" + self.data.ID + "&formPage=formedit", "预览")
  529. }
  530. //打印
  531. self.btnPrint = function () {
  532. // 创建隐藏的可下载链接
  533. var eleLink = document.createElement('a');
  534. eleLink.download = "";
  535. eleLink.style.display = 'none';
  536. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=XZYGQJ.ftl&tablename=WJFB_CB&outfilepath=/tmp/市住建委干部因公请假申请表.wps&prtdate=TBSJ,QJSJKS,QJSJJS&routeinfoid=" + self.routeinfoid));
  537. // 触发点击
  538. document.body.appendChild(eleLink);
  539. eleLink.click();
  540. // 然后移除
  541. document.body.removeChild(eleLink);
  542. //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=WJFB_CB&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
  543. }
  544. //下载附件
  545. self.download = function (item) {
  546. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  547. }
  548. //删除附件
  549. self.deleteFile1 = function (item, str) {
  550. var data = {
  551. tablename: "WJFB_CB",
  552. column: str,
  553. routeinfoid: self.routeinfoid,
  554. fileid: item.FILEID,
  555. filenames: item.FILEOLDNAME
  556. }
  557. $http.post(apiurljs.login + "g2app/abase/deleteUploadFileName", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  558. .success(function (obj) {
  559. var res = strToJson(s4.decryptData_CBC(obj.data));
  560. if (res.success == true) {
  561. self.arrayFile = res.data;
  562. self.arrayFile.forEach(function (item) {
  563. item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
  564. })
  565. } else {
  566. sp.dialog(res.message)
  567. }
  568. })
  569. }
  570. self.showCol = function ($event, ele) {
  571. $('.detail-col').not(ele).hide();
  572. //$(ele).toggle("slow", function () {
  573. // $(ele).css('overflow-y', 'auto')
  574. //}).autoHide();
  575. $(ele).toggle("slow").autoHide();
  576. $event.stopPropagation();
  577. }
  578. self.selectLX = function (item) {
  579. self.data.LX = item.CODE
  580. self.data.LXNAME = item.CNAME
  581. self.filedChange = true;
  582. $(".detail-col").toggle("slow");
  583. }
  584. self.selectLX1 = function (item) {
  585. self.data.LX = item.CODE
  586. self.data.LXNAME = self.secodeName + "-" + item.CNAME;
  587. self.filedChange = true;
  588. $(".detail-col").toggle("slow");
  589. }
  590. self.showSecond = function (obj, n) {
  591. self.LX1 = [];
  592. self.secodeName = obj.CNAME;
  593. obj.C_H_I_L_D_DATA.forEach(function (item) {
  594. if ((item.MKUSERID != null && item.MKUSERID.indexOf(self.userId) != -1) || item.MKUSERID == null || item.MKUSERID == "") {
  595. self.LX1.push(item)
  596. }
  597. })
  598. $(".detail-col").eq(1).css("top", (n + 2) * 30 + n);
  599. $(".detail-col").eq(1).show().autoHide()
  600. }
  601. //签写意见编辑状态
  602. self.opinion = {
  603. YJ: false,
  604. YJImg: false,
  605. nulla: false
  606. }
  607. self.YJ = {
  608. YJ: [],
  609. YJSTATUS: false,
  610. nulla: [],
  611. nullaSTATUS: false
  612. }
  613. //意见(下表)
  614. self.openOptionList = function () {
  615. console.log(12312)
  616. if (self.routeinfoid == 0 && self.routeid == 0) {
  617. sp.dialog("请先保存!")
  618. return;
  619. }
  620. if (self.opinion.nulla == true) {
  621. return;
  622. }
  623. self.nulla = "";
  624. $(".optionList").css("height", 149)
  625. self.opinion.nulla = true;
  626. }
  627. self.closeOptionList = function () {
  628. $(".optionList").css("height", 389)
  629. self.opinion.nulla = false;
  630. }
  631. self.submitOptionList = function () {
  632. var data = {
  633. cmanid: self.userId,
  634. routeinfoid: self.routeinfoid,
  635. routeid: self.routeid,
  636. tableid: "WJFB_CB",
  637. colid: "",
  638. opiniontype: 99,
  639. cresult: "",
  640. opinion: self.nulla,
  641. opinionimage: ""
  642. }
  643. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  644. .success(function (obj) {
  645. var res = strToJson(s4.decryptData_CBC(obj.data));
  646. if (res.success == true) {
  647. self.getOpinion1();
  648. self.opinion.nulla = false;
  649. $(".optionList").css("height", 389)
  650. } else {
  651. sp.dialog(res.message)
  652. }
  653. })
  654. }
  655. self.changeOptionList = function (item) {
  656. self.nulla = item.OPINION;
  657. self.opinion.nulla = true;
  658. }
  659. //意见附件(下表)
  660. self.uploading1 = false;
  661. self.upload1 = function () {
  662. $('#fileupload1').fileupload({
  663. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  664. dataType: 'json',
  665. beforeSend: function (xhr, data) {
  666. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  667. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  668. + ",routeid=" + self.routeid + ",tableid=WJFB_CB"));
  669. },
  670. // 上传完成后的执行逻辑
  671. done: function (e, data) {
  672. self.uploading1 = false;
  673. self.getOpinion1()
  674. }
  675. })
  676. }
  677. //意见附件(上表)
  678. self.upload2 = function (str) {
  679. $('#fileupload-' + str).fileupload({
  680. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  681. dataType: 'json',
  682. beforeSend: function (xhr, data) {
  683. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  684. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  685. + ",routeid=" + self.routeid + ",tableid=WJFB_CB,colid=" + str));
  686. },
  687. // 上传完成后的执行逻辑
  688. done: function (e, data) {
  689. self.uploading1 = false;
  690. self.getOpinion(str)
  691. }
  692. })
  693. }
  694. //下载意见表附件
  695. self.downLoadOption = function (item) {
  696. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  697. }
  698. //删除意见表附件
  699. self.deleteOptionFile = function (file, str) {
  700. var data = {
  701. routeid: file.ROUTEID,
  702. tableid: "WJFB_CB",
  703. colid: str,
  704. fileid: file.FILEID
  705. };
  706. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  707. .success(function (obj) {
  708. var res = strToJson(s4.decryptData_CBC(obj.data));
  709. sp.dialoghide();
  710. if (res.success) {
  711. if (str != "") {
  712. self.getOpinion(str);
  713. } else {
  714. self.getOpinion1();
  715. }
  716. } else {
  717. sp.dialog("删除失败,请联系管理员!");
  718. }
  719. });
  720. }
  721. //签写意见
  722. self.openOpinion = function (str) {
  723. if (self.routeinfoid == 0 && self.routeid == 0) {
  724. sp.dialog("请先保存!")
  725. return;
  726. }
  727. self.opinion[str] = true;
  728. }
  729. //修改意见
  730. self.changeOpinion = function (str) {
  731. self.data[str] = self.YJ[str][0].OPINION;
  732. self.opinion[str] = true;
  733. }
  734. self.changeOpinionItem = function (str, item) {
  735. if (item.OPINIONIMAGE != "") {
  736. self.QianZi(str);
  737. self.opinion[str + "Img"] = true;
  738. }
  739. self.data[str] = item.OPINION;
  740. self.opinion[str] = true;
  741. }
  742. //提交意见
  743. self.Sopinion = function (str) {
  744. if (self.opinion[str + "Img"] == true) {
  745. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  746. } else {
  747. self.data[str] = $("#" + str).val();
  748. }
  749. var data = {
  750. cmanid: self.userId,
  751. routeinfoid: self.routeinfoid,
  752. routeid: self.routeid,
  753. tableid: "WJFB_CB",
  754. colid: str,
  755. opiniontype: 0,
  756. cresult: "",
  757. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  758. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  759. }
  760. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  761. .success(function (obj) {
  762. var res = strToJson(s4.decryptData_CBC(obj.data));
  763. if (res.success == true) {
  764. sp.dialog("保存成功!");
  765. self.getOpinion(str);
  766. self.opinion[str] = false;
  767. self.opinion[str + "Img"] = false;
  768. self.data[str] = "";
  769. self.changeFiled(str)
  770. } else {
  771. sp.dialog(res.message)
  772. }
  773. })
  774. }
  775. //删除意见
  776. self.Dopinion = function (str, item) {
  777. var data = {
  778. cmanid: self.userId,
  779. routeid: self.routeid,
  780. tableid: "WJFB_CB",
  781. colid: str,
  782. }
  783. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  784. .success(function (obj) {
  785. var res = strToJson(s4.decryptData_CBC(obj.data));
  786. if (res.success == true) {
  787. if (str != "") {
  788. self.getOpinion(str);
  789. } else {
  790. self.getOpinion1();
  791. }
  792. self.changeFiled(str)
  793. } else {
  794. sp.dialog(res.message)
  795. }
  796. })
  797. }
  798. self.phraseText = "";//添加常用语
  799. self.phraseList = []//常用语列表
  800. //获取常用语库
  801. self.phrase = function (colid) {
  802. sp.layer("#phrase");
  803. self.colid = colid;
  804. self.getPhrase();
  805. }
  806. //添加常用语到常用语库
  807. self.Aphrase = function () {
  808. if (self.phraseText == "") {
  809. return;
  810. }
  811. var data = {
  812. cmanid: self.userId,
  813. tableid: "WJFB_CB",
  814. colid: self.colid,
  815. contents: self.phraseText
  816. }
  817. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  818. .success(function (obj) {
  819. var res = strToJson(s4.decryptData_CBC(obj.data));
  820. if (res.success == true) {
  821. self.phraseText = "";
  822. self.getPhrase();
  823. } else {
  824. sp.dialog(res.message)
  825. }
  826. })
  827. }
  828. //获取常用语库
  829. self.getPhrase = function () {
  830. var data = {
  831. cmanid: self.userId,
  832. tableid: "WJFB_CB",
  833. colid: self.colid
  834. }
  835. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  836. .success(function (obj) {
  837. var res = strToJson(s4.decryptData_CBC(obj.data));
  838. self.phraseList = res.data;
  839. self.phraseSelect = self.phraseList[0].CONTENTS;
  840. })
  841. }
  842. //从常用语库删除
  843. self.Dphrase = function () {
  844. var id = null;
  845. $.each(self.phraseList, function (index, item) {
  846. if (item.CONTENTS == self.phraseSelect) {
  847. id = item.ID;
  848. }
  849. })
  850. var data = {
  851. id: id
  852. }
  853. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  854. .success(function (obj) {
  855. var res = strToJson(s4.decryptData_CBC(obj.data));
  856. self.getPhrase();
  857. })
  858. }
  859. //常用语确认为意见
  860. self.btnPhrase = function () {
  861. if (!self.colid) {
  862. self.nulla = self.phraseSelect;
  863. } else {
  864. self.data[self.colid] = self.phraseSelect;
  865. }
  866. sp.layerhide();
  867. }
  868. //签字—手写
  869. self.QianZi = function (str) {
  870. self.opinion[str + "Img"] = true;
  871. setTimeout(function () {
  872. new lineCanvas(str + "QZ")
  873. }, 1)
  874. }
  875. //清除手写
  876. self.canvasClear = function (str) {
  877. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  878. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  879. }
  880. //发生修改
  881. self.changeFiled = function (str) {
  882. self.filedChange = true;
  883. if (str == "FBBM") {
  884. self.ZRBM.forEach(function (item) {
  885. if (self.data.FBBM == item.CODE) {
  886. self.userDpName = item.CNAME
  887. console.log(self.userDpName)
  888. }
  889. })
  890. }
  891. }
  892. //转发
  893. self.forward = function (obj) {
  894. self.btnItem = obj;
  895. if (self.filedChange == true) {
  896. self.btnSave(1)
  897. } else {
  898. $("#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=wenjianbg")
  899. sp.layer("#forward")
  900. }
  901. }
  902. //查看流转记录
  903. self.RouteList = function () {
  904. if (self.deviceType == "pad") {
  905. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  906. } else {
  907. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  908. }
  909. //var data = {
  910. // directionid: self.directionid,
  911. // userid: self.userId,
  912. // routeid: self.routeid,
  913. // routeinfoid: self.routeinfoid,
  914. //}
  915. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  916. // .success(function (obj) {
  917. // var res = strToJson(s4.decryptData_CBC(obj.data));
  918. // self.routeList = res.data;
  919. // $.each(self.routeList, function (index, item) {
  920. // item.mainUser = [];
  921. // item.copyUsers = [];
  922. // $.each(item.USERS, function (index1, item1) {
  923. // if (item1.KIND == 0) {
  924. // item.mainUser.push(item1.USERNAME);
  925. // } else {
  926. // item.copyUsers.push(item1.USERNAME);
  927. // }
  928. // })
  929. // item.mainUser = item.mainUser.join(",");
  930. // item.copyUsers = item.copyUsers.join(",");
  931. // })
  932. // setTimeout(function (item) {
  933. // sp.layer("#RouteList");
  934. // }, 100);
  935. // })
  936. }
  937. self.reSizeRow = function () {
  938. var bodybox = document.getElementById("bodyDiv");
  939. var topbox = document.getElementById("topDiv");
  940. var bottombox = document.getElementById("bottomDiv");
  941. var line = document.getElementById("lineDiv");
  942. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  943. $(".mousemove").show()
  944. var bodyboxH = bodybox.clientHeight;
  945. var topboxH = topbox.clientHeight;
  946. var bottomboxH = bottombox.clientHeight;
  947. //var y = event.pageY - line.offsetTop;
  948. var y = event.pageY - line.clientHeight;
  949. document.addEventListener("mousemove", boxMove)
  950. function boxMove(event) {
  951. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  952. //
  953. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  954. //
  955. } else {
  956. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  957. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  958. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  959. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  960. }
  961. }
  962. document.addEventListener("mouseup", function () {
  963. $(".mousemove").hide()
  964. document.removeEventListener("mousemove", boxMove)
  965. })
  966. })
  967. }
  968. ////头部关键字搜索---20230905
  969. self.headBtnSearchKeyword = "";
  970. self.headSearchResult = [];
  971. self.headSearchResult_view = false;
  972. self.headBtnSearch = function () {
  973. if (sp.isval(self.headBtnSearchKeyword)) {
  974. self.headSearchResult = [];
  975. var data = {
  976. "url": "/basic/api/StatSelect/selectCodeList",
  977. "data": { "keyWord": self.headBtnSearchKeyword }
  978. }
  979. //console.log(JSON.stringify(data));
  980. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  981. .success(function (obj) {
  982. var res = strToJson(s4.decryptData_CBC(obj.data));
  983. //console.log(JSON.stringify(res.data));
  984. self.headSearchResult = res.data.build;
  985. if (sp.isval(self.headSearchResult)) {
  986. self.headSearchResult_view = true;
  987. } else {
  988. self.headSearchResult_view = false;
  989. }
  990. })
  991. } else {
  992. self.headSearchResult_view = false;
  993. }
  994. };
  995. self.headKeywordPage = function (itemdata) {
  996. var get_token = localStorage.getItem("main-token");
  997. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  998. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  999. self.headSearchResult_view = false;
  1000. };
  1001. self.onePic = function () {
  1002. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1003. }
  1004. //头部下滚冻结
  1005. $(function () {
  1006. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1007. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  1008. //$("body").bind("scroll", function () {
  1009. // var scrollTop = $("body").scrollTop();
  1010. // if (scrollTop == 0) {
  1011. // $(".FixTop").removeClass("FixTop");
  1012. // }
  1013. // if (scrollTop > 35) {
  1014. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1015. // }
  1016. //});
  1017. //页面高度撑满
  1018. setTimeout(function () {
  1019. if ($(".ibox-content").height() < $(window).height() - 31) {
  1020. $(".ibox-content").css("height", $(window).height() - 31)
  1021. }
  1022. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1023. }, 1)
  1024. })
  1025. var editor2;
  1026. self.setKindEditor2 = function () {
  1027. var options = {
  1028. uploadJson: apiurljs.login + "g2app/abase/uploadFileKindeditorImage/" + s4.encryptData_CBC(JSON.stringify("FILEKINDEDITOR_ATTACH")),
  1029. fileManagerJson: apiurljs.login + 'g2app/abase/uploadFileKindeditorImage/' + s4.encryptData_CBC(JSON.stringify("FILEKINDEDITOR_ATTACH")),
  1030. filterMode: true,//过滤HTML代码
  1031. allowImageUpload: true,
  1032. allowFlashUpload: false,
  1033. allowMediaUpload: false,
  1034. allowFileManager: false,
  1035. themeType: 'simple',
  1036. items: ['source', '|', 'undo', 'redo', '|', 'preview', 'template', '|',
  1037. 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
  1038. 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|',
  1039. 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|',
  1040. 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
  1041. 'image', '|', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', '|',
  1042. 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|',
  1043. 'table', 'hr', 'emoticons', '|', 'pagebreak', 'anchor', '|', 'about',
  1044. 'table', 'insertfile', 'hr', 'emoticons', 'baidumap', '|',
  1045. 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about'],
  1046. afterUpload: function (url, data, name) {
  1047. this.sync();
  1048. }, //图片上传后,将上传内容同步到textarea中
  1049. afterBlur: function () {
  1050. this.sync();
  1051. }, ////失去焦点时,将内容同步到textarea中
  1052. afterCreate: function () {
  1053. this.sync();
  1054. }
  1055. }
  1056. editor2 = KindEditor.create('#kindEditor_Content', options);
  1057. };
  1058. self.setKindEditor2();
  1059. }])
  1060. app.filter('trustHtml', function ($sce) {
  1061. return function (input) {
  1062. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1063. };
  1064. });
  1065. //canvas画布签字
  1066. function lineCanvas(obj) {
  1067. var self = this;
  1068. self.linewidth = 1;
  1069. self.color = "#000000";
  1070. self.background = "#ffffff";
  1071. self.canvas = document.createElement("canvas");
  1072. document.getElementById(obj).appendChild(self.canvas);
  1073. self.cxt = self.canvas.getContext("2d");
  1074. self.canvas.width = document.getElementById(obj).clientWidth;
  1075. self.canvas.height = document.getElementById(obj).scrollHeight;
  1076. self.cxt.fillStyle = self.background;
  1077. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1078. self.cxt.strokeStyle = self.color;
  1079. self.cxt.lineWidth = self.linewidth;
  1080. self.cxt.lineCap = "round";
  1081. //开始绘制
  1082. self.canvas.addEventListener("mousedown", function (e) {
  1083. self.cxt.beginPath();
  1084. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1085. self.canvas.addEventListener("mousemove", move)
  1086. }.bind(self), false);
  1087. //绘制中
  1088. function move() {
  1089. var e = window.event;
  1090. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1091. self.cxt.stroke();
  1092. }
  1093. //结束绘制
  1094. self.canvas.addEventListener("mouseup", up)
  1095. function up() {
  1096. self.cxt.closePath();
  1097. self.canvas.removeEventListener("mousemove", move)
  1098. }
  1099. };
  1100. var parentData = {}
  1101. function getData() {
  1102. parentData = angular.element(document.getElementById("app")).scope().data
  1103. return parentData
  1104. }
  1105. function showToggle(e) {
  1106. $(e).children().toggle()
  1107. $(e).next().toggle()
  1108. }
  1109. function toggleYJL(e) {
  1110. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1111. $("#topDiv").css("height", 160)
  1112. $(e).parent().css("height", 450)
  1113. $("#attachlist").css("height", 200)
  1114. $("#bottomDiv").css("height", "")
  1115. } else {
  1116. $("#topDiv").css("height", 600)
  1117. $(e).parent().css("height", 10)
  1118. }
  1119. $(e).children().toggle()
  1120. }