formedit.js 50 KB

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