formeditFL.js 115 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$interval", "$sce", function ($scope, $http, $timeout, $interval, $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.lastrouteinfoid = sp.getUrlName("lastrouteinfoid");
  13. self.copyrightid = sp.getUrlName("copyrightid");
  14. self.directionid = sp.getUrlName("directionid");
  15. self.formeditid = sp.getUrlName("formeditid");
  16. self.mbid = sp.getUrlName("mbid");
  17. self.fjid = sp.getUrlName("fjid");
  18. self.docmode = sp.getUrlName("docmode");
  19. self.dotype = sp.getUrlName("dotype");
  20. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  21. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  22. self.get_type = sp.getUrlName("type");
  23. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  24. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  25. if (self.deviceType != "pad") {
  26. self.photo = $.cookie("GlWorkPlatform-photo").indexOf("AFrontEnd") > -1 ? "../../../" + $.cookie("GlWorkPlatform-photo") : $.cookie("GlWorkPlatform-photo");
  27. }
  28. var postCfg = {
  29. headers: {
  30. 'Content-Type': 'application/json',
  31. 'Authorization': "Bearer " + self.get_AccessToken
  32. }
  33. };
  34. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  35. //初始化右上角按钮
  36. self.buttonList = []
  37. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  38. return item.CNAME
  39. })
  40. self.upload_zw = function () {
  41. self.newMoBanFlag = true;
  42. if (self.gaoTypeArrayFirst.length > 0) {
  43. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  44. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  45. 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>";
  46. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  47. sp.openCenter(".sp-dialog");
  48. ///取消按钮
  49. $('.sp-closeDialog').click(function (event) {
  50. sp.closeCenter(".sp-dialog");
  51. event.preventDefault();
  52. event.stopPropagation();
  53. });
  54. //post消息的id
  55. $("#delDataTrue").click(function () {
  56. sp.closeCenter(".sp-dialog");
  57. $('#fileupload-zw').fileupload({
  58. url: apiurljs.login + 'g2app/fawenfiles/uploadFileWithForm',
  59. dataType: 'json',
  60. beforeSend: function (xhr, data) {
  61. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  62. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
  63. },
  64. add: function (e, data) {
  65. var num = 0;
  66. var acceptFileTypes = eval('/(' + apiurljs.zwType.join("|") + ')$/i')
  67. //文件类型判断
  68. $.each(data.originalFiles, function (index, item) {
  69. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  70. sp.dialog("您好,请上传" + apiurljs.zwType.join("/") + "格式的文件!");
  71. return;
  72. } else {
  73. num++
  74. }
  75. })
  76. if (num == data.originalFiles.length) {
  77. self.uploading_zw = true;
  78. data.submit();
  79. $scope.$apply();
  80. }
  81. },
  82. // 上传完成后的执行逻辑
  83. done: function (e, data) {
  84. self.uploading_zw = false;
  85. self.newMoBanFlag = false;
  86. self.getGCG(1)
  87. }
  88. })
  89. $timeout(function () {
  90. $("#fileupload-zw").trigger("click")
  91. }, 1)
  92. })
  93. } else {
  94. $('#fileupload-zw').fileupload({
  95. url: apiurljs.login + 'g2app/fawenfiles/uploadFileWithForm',
  96. dataType: 'json',
  97. beforeSend: function (xhr, data) {
  98. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  99. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
  100. },
  101. add: function (e, data) {
  102. var num = 0;
  103. var acceptFileTypes = eval('/(' + apiurljs.zwType.join("|") + ')$/i')
  104. //文件类型判断
  105. $.each(data.originalFiles, function (index, item) {
  106. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  107. sp.dialog("您好,请上传" + apiurljs.zwType.join("/") + "格式的文件!");
  108. return;
  109. } else {
  110. num++
  111. }
  112. })
  113. if (num == data.originalFiles.length) {
  114. self.uploading_zw = true;
  115. data.submit();
  116. $scope.$apply();
  117. }
  118. },
  119. // 上传完成后的执行逻辑
  120. done: function (e, data) {
  121. self.uploading_zw = false;
  122. self.newMoBanFlag = false;
  123. self.getGCG(1)
  124. }
  125. })
  126. $timeout(function () {
  127. $("#fileupload-zw").trigger("click")
  128. }, 1)
  129. }
  130. }
  131. //上层附件、业务参考、共享沟通组件
  132. self.uploading = false;
  133. self.upload = function () {
  134. $('#fileupload').fileupload({
  135. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  136. dataType: 'json',
  137. beforeSend: function (xhr, data) {
  138. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  139. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=正式文(上行文)"));
  140. },
  141. add: function (e, data) {
  142. var num = 0;
  143. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  144. //文件类型判断
  145. $.each(data.originalFiles, function (index, item) {
  146. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  147. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  148. return;
  149. } else {
  150. num++
  151. }
  152. })
  153. if (num == data.originalFiles.length) {
  154. self.uploading = true;
  155. data.submit();
  156. $scope.$apply();
  157. }
  158. },
  159. // 上传完成后的执行逻辑
  160. done: function (e, data) {
  161. self.uploading = false;
  162. self.getOther()
  163. }
  164. })
  165. }
  166. self.downLoad = function (item) {
  167. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  168. }
  169. self.deleteFile = function (file) {
  170. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  171. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  172. 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>";
  173. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  174. sp.openCenter(".sp-dialog");
  175. ///取消按钮
  176. $('.sp-closeDialog').click(function (event) {
  177. sp.closeCenter(".sp-dialog");
  178. event.preventDefault();
  179. event.stopPropagation();
  180. });
  181. //post消息的id
  182. $("#delDataTrue").click(function () {
  183. var data = {
  184. tablename: "FILE_ATTACH",
  185. id: file.ID
  186. };
  187. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  188. .success(function (obj) {
  189. var res = strToJson(s4.decryptData_CBC(obj.data));
  190. sp.dialoghide();
  191. if (res.success) {
  192. $.each(self.iframeList, function (index, item) {
  193. if (item.filename == file.FILENAMES && item.source == apiurljs.login + "g2work/files2/inline/" + file.FILEURL.slice(7)) {
  194. self.closeItem(index);
  195. return false;
  196. }
  197. })
  198. self.getOther();
  199. } else {
  200. sp.dialog("删除失败,请联系管理员!");
  201. }
  202. });
  203. });
  204. }
  205. self.creatFLOW = function (file) {
  206. var data = {
  207. copyrightid: self.copyrightid,
  208. directionid: self.directionid,
  209. routeinfoid: self.routeinfoid,
  210. userid: self.userId,
  211. relateid: file.ID
  212. }
  213. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  214. .success(function (obj) {
  215. var res = strToJson(s4.decryptData_CBC(obj.data));
  216. sp.dialoghide();
  217. if (res.success) {
  218. self.getGLFLOW();
  219. } else {
  220. sp.dialog("删除失败,请联系管理员!");
  221. }
  222. });
  223. }
  224. self.deleteWG = function (file) {
  225. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  226. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  227. 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>";
  228. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  229. sp.openCenter(".sp-dialog");
  230. ///取消按钮
  231. $('.sp-closeDialog').click(function (event) {
  232. sp.closeCenter(".sp-dialog");
  233. event.preventDefault();
  234. event.stopPropagation();
  235. });
  236. //post消息的id
  237. $("#delDataTrue").click(function () {
  238. var data = {
  239. id: file.ID
  240. };
  241. $http.post(apiurljs.login + "g2app/fawenfilesrelate/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  242. .success(function (obj) {
  243. var res = strToJson(s4.decryptData_CBC(obj.data));
  244. sp.dialoghide();
  245. if (res.success) {
  246. $.each(self.iframeList, function (index, item) {
  247. if (item.filename == file.FILENAMES && item.source == apiurljs.login.split("glwork/")[0] + "glworkweb/" + file.FILEURL) {
  248. self.closeItem(index);
  249. return false;
  250. }
  251. })
  252. self.getGLJ(1);
  253. } else {
  254. sp.dialog("删除失败,请联系管理员!");
  255. }
  256. });
  257. });
  258. }
  259. self.openGL = function (item) {
  260. var data = {
  261. tablename: "SYS_DESKTOP_PLUGIN_TODO",
  262. colums: "*",
  263. order: "SORTID",
  264. sqlwhere: "",
  265. sqlorwhere: "",
  266. sqlinwhere: "",
  267. sqllikewhere: { FLOWID: item.FLOWID }
  268. }
  269. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  270. .success(function (obj) {
  271. var res = strToJson(s4.decryptData_CBC(obj.data));
  272. sp.openNewWindow("../../" + res.data[0].FILEN.split("/")[1] + "/" + item.FILEN + "&flowid=" + item.FLOWID + "&dotype=1", item.TITLE)
  273. });
  274. }
  275. self.downLoaDWG = function (item) {
  276. if (item.FILEURL.indexOf("files") > -1) {
  277. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  278. } else {
  279. window.open(apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL)
  280. }
  281. }
  282. self.readonly = {
  283. HYWH: false,
  284. FHSJ: false,
  285. CHDWMC: false,
  286. KHYJ: false,
  287. HYSJ: false,
  288. DD: false,
  289. HYNR: false,
  290. WLDXM: false,
  291. WLDZW: false,
  292. CJFW: false,
  293. ZYYC: false,
  294. HYYQ: false,
  295. LXR: false,
  296. LXFS: false,
  297. SJ: false
  298. }
  299. self.getSwenList = function (n) {
  300. self.SwenList = [];
  301. var data = {
  302. directionid: self.directionid,
  303. userid: self.userId,
  304. routeinfoid: self.routeinfoid,
  305. routeid: self.routeid,
  306. formeditid: ""
  307. }
  308. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  309. .success(function (obj) {
  310. var res = strToJson(s4.decryptData_CBC(obj.data));
  311. if (self.copyrightid == "") {
  312. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  313. }
  314. $.each(res.data.LINKS, function (index, item) {
  315. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  316. self.Title = item.VNAME;
  317. }
  318. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  319. if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
  320. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  321. } else {
  322. item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  323. }
  324. } else {
  325. item.TEMPFORM = "#";
  326. }
  327. self.SwenList.push(item)
  328. })
  329. self.SwenList.push({
  330. VNAME: "流程图",
  331. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  332. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  333. })
  334. if (n == 0) {
  335. self.getFLOW()
  336. } else {
  337. self.getData()
  338. }
  339. })
  340. }
  341. self.getSwenList(0)
  342. self.getFLOW = function () {
  343. var data = {
  344. copyrightid: self.copyrightid
  345. }
  346. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  347. .success(function (obj) {
  348. var res = strToJson(s4.decryptData_CBC(obj.data));
  349. self.flowTitle = res.data.CNAME;
  350. self.getGWZL()
  351. })
  352. }
  353. self.getGWZL = function () {
  354. var data = {
  355. tablename: "CODE_GWTYPE",
  356. colums: "ID,CODE,CNAME,FLOWID,DOCFILE,REDFILE",
  357. order: "SORTID desc",
  358. sqlwhere: {
  359. USEMARK: 1,
  360. FLOWID: sp.getUrlName("flowid")
  361. },
  362. sqlinwhere: "",
  363. sqllikewhere: ""
  364. }
  365. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  366. .success(function (obj) {
  367. var res = strToJson(s4.decryptData_CBC(obj.data));
  368. self.GWZL = res.data;
  369. self.getUserList()
  370. })
  371. }
  372. self.getUserList = function () {
  373. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  374. .success(function (obj) {
  375. var res = strToJson(s4.decryptData_CBC(obj.data));
  376. self.userList = res.data;
  377. self.userList.forEach(function (item) {
  378. item.checked = false;
  379. item.USER.forEach(function (item1) {
  380. item1.checked = false;
  381. item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
  382. item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
  383. })
  384. })
  385. self.UserList = {
  386. CJFW: JSON.parse(JSON.stringify(self.userList))
  387. };
  388. self.AllChecked = {};
  389. self.UserLength = {};
  390. self.selectList = {};
  391. self.getData()
  392. })
  393. }
  394. //获取数据
  395. self.getData = function () {
  396. var data = {
  397. ckey: "SX_HYTZDW",
  398. id: 0,
  399. directionid: self.directionid,
  400. formeditid: self.formeditid,
  401. routeid: self.routeid,
  402. routeinfoid: self.routeinfoid
  403. }
  404. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  405. .success(function (obj) {
  406. var res = strToJson(s4.decryptData_CBC(obj.data));
  407. self.data = {
  408. ID: res.data.SX_HYTZDW.ID,
  409. APPCODE: res.data.SX_HYTZDW.APPCODE,
  410. BT: res.data.SX_HYTZDW.BT,
  411. HYSJ: res.data.SX_HYTZDW.HYSJ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_HYTZDW.HYSJ),
  412. DD: res.data.SX_HYTZDW.DD,
  413. CJFW: res.data.SX_HYTZDW.CJFW,
  414. CJFWUSERID: res.data.SX_HYTZDW.CJFWUSERID,
  415. BMZGYJ: res.data.SX_HYTZDW.BMZGYJ,
  416. WLDYJ: res.data.SX_HYTZDW.WLDYJ,
  417. GWZL: res.data.SX_HYTZDW.GWZL == "" ? self.GWZL[0].CODE : res.data.SX_HYTZDW.GWZL,
  418. NGRUSERID: res.data.SX_HYTZDW.NGRUSERID == "" ? self.userId : res.data.SX_HYTZDW.NGRUSERID,
  419. NGRBM: res.data.SX_HYTZDW.NGRBM == "" ? self.userDpName : res.data.SX_HYTZDW.NGRBM,
  420. NGRBMID: res.data.SX_HYTZDW.NGRBMID == "" ? self.userDpCode : res.data.SX_HYTZDW.NGRBMID,
  421. }
  422. self.readonly = {
  423. BT: res.data.SX_HYTZDW["BT.EREADONLY"] == "true",
  424. HYSJ: res.data.SX_HYTZDW["HYSJ.EREADONLY"] == "true",
  425. DD: res.data.SX_HYTZDW["DD.EREADONLY"] == "true",
  426. CJFW: res.data.SX_HYTZDW["CJFW.EREADONLY"] == "true",
  427. BMZGYJ: res.data.SX_HYTZDW["BMZGYJ.EREADONLY"] == "true",
  428. WLDYJ: res.data.SX_HYTZDW["WLDYJ.EREADONLY"] == "true"
  429. }
  430. if (self.data.ID == 0) {
  431. self.filedChange = true;
  432. } else {
  433. self.filedChange = false;
  434. }
  435. var n = {}, all = {};
  436. for (var i in self.UserList) {
  437. self.AllChecked[i] = false;
  438. self.UserLength[i] = 0;
  439. self.selectList[i] = []
  440. n[i] = [];
  441. all[i] = 0;
  442. $.each(self.UserList[i], function (index, item) {
  443. n[i].push(0)
  444. $.each(item.USER, function (index1, item1) {
  445. self.UserLength[i]++
  446. if (self.data.CJFWUSERID.indexOf(item1.USERID) != -1 && i == "CJFW") {
  447. n[i][index]++;
  448. item1.checked = true;
  449. self.selectList[i].push(item1);
  450. }
  451. })
  452. if (n[i][index] == item.USER.length && n[i][index] != 0) {
  453. item.checked = true;
  454. all[i]++;
  455. } else {
  456. item.checked == false;
  457. }
  458. })
  459. if (all[i] == self.UserList[i].length) {
  460. self.AllChecked[i] = true;
  461. } else {
  462. self.AllChecked[i] = false;
  463. }
  464. }
  465. self.buttonList = res.data["SX_HYTZDW.FUNCLIST"];
  466. self.getOpinion1()
  467. self.getOther()
  468. self.getGCG(0)
  469. //watermark({
  470. // "watermarl_element": "app",
  471. // "watermark_txt": "测试水印内容",
  472. // "watermark_width": 150,
  473. // "watermark_height": 110,
  474. // "watermark_angle": 345
  475. //})
  476. })
  477. }
  478. //docmode=='zihao'时加载
  479. self.getFWZH = function () {
  480. var data = {
  481. flowid: sp.getUrlName("flowid"),
  482. code: "",
  483. cyear: self.data.FWZH == "" ? sp.currentYear() : self.data.FWZH.slice(self.data.FWZH.indexOf("〔") + 1, self.data.FWZH.indexOf("〕")),
  484. routeinfoidmark: self.routeinfoid,
  485. zihao: self.data.FWZH
  486. }
  487. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  488. .success(function (obj) {
  489. var res = strToJson(s4.decryptData_CBC(obj.data));
  490. self.FWZH = res.data.map(function (item) {
  491. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  492. });
  493. if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE }
  494. })
  495. }
  496. //生成左侧合并文件
  497. self.getHB = function () {
  498. var data = {
  499. routeinfoid: self.routeinfoid
  500. }
  501. $http.post(apiurljs.login + "g2app/dataabase/mergeFileByLastRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  502. .success(function (obj) {
  503. var res = strToJson(s4.decryptData_CBC(obj.data));
  504. if (res.data.result != "") {
  505. let postData = {
  506. convertType: res.data.mark == "ofd" ? 570 : 20,
  507. isDownload: 1,
  508. isPrint: 1,
  509. fileUrl: res.data.result
  510. };
  511. var postCfg_transfer = {
  512. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  513. transformRequest: function (data) {
  514. return $.param(data);
  515. }
  516. };
  517. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  518. .success(function (res) {
  519. if (res.errorcode === 0) {
  520. self.iframeList = [{ id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } }];
  521. self.iframeLast = self.iframeList.length - 1;
  522. self.iframeShow = self.iframeList.length;
  523. self.iframeHide = self.iframeList.length - self.iframeShow;
  524. } else {
  525. sp.dialog(res.message);
  526. }
  527. });
  528. } else {
  529. var data = {
  530. routeinfoid: self.routeinfoid
  531. }
  532. $http.post(apiurljs.login + "g2app/dataabase/mergePDFByLastRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  533. .success(function (obj) {
  534. var res = strToJson(s4.decryptData_CBC(obj.data));
  535. if (res.data.result != "") {
  536. let postData = {
  537. convertType: res.data.mark == "ofd" ? 570 : 20,
  538. isDownload: 1,
  539. isPrint: 1,
  540. fileUrl: res.data.result
  541. };
  542. var postCfg_transfer = {
  543. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  544. transformRequest: function (data) {
  545. return $.param(data);
  546. }
  547. };
  548. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  549. .success(function (res) {
  550. if (res.errorcode === 0) {
  551. self.iframeList = [{ id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } }];
  552. self.iframeLast = self.iframeList.length - 1;
  553. self.iframeShow = self.iframeList.length;
  554. self.iframeHide = self.iframeList.length - self.iframeShow;
  555. } else {
  556. sp.dialog(res.message);
  557. }
  558. });
  559. }
  560. })
  561. }
  562. })
  563. }
  564. //获取关联文稿
  565. self.getGLJ = function (n) {
  566. var data = {
  567. dockind: "D01",
  568. routeinfoid: self.routeinfoid
  569. }
  570. $http.post(apiurljs.login + "g2app/fawenfilesrelate/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  571. .success(function (obj) {
  572. var res = strToJson(s4.decryptData_CBC(obj.data));
  573. self.guanlian = res.data;
  574. console.log(self.guanlian)
  575. if (n == 0) {
  576. self.getGLFLOW()
  577. }
  578. if (n == 2) {
  579. self.editFile(self.guanlian[self.guanlian.length - 1], 2)
  580. }
  581. })
  582. }
  583. self.seeGLJ = function () {
  584. if ($(".formedit2").find("iframe").attr("src") == "") {
  585. if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
  586. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
  587. } else {
  588. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
  589. }
  590. var data = {
  591. method: 1,
  592. params: {
  593. userId: self.userName,
  594. fileId: "",
  595. fileName: "",
  596. filePath: "",
  597. userRight: self.dotype != 1 ? 1 : 0,
  598. callbackUrl: ""
  599. }
  600. };
  601. if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
  602. data.params.fileId = self.guanlian[0].FILEURL.split("/")[2];
  603. data.params.fileName = self.guanlian[0].FILEURL.split("/")[3];
  604. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
  605. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  606. } else {
  607. data.params.fileId = self.guanlian[0].ID;
  608. data.params.fileName = self.guanlian[0].FILENAMES;
  609. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
  610. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  611. }
  612. $.ajax({
  613. url: apiurljs.yzFileWo + "api.do",
  614. data: {
  615. jsonParams: encodeURIComponent(JSON.stringify(data))
  616. },
  617. type: "POST",
  618. dataType: "json",
  619. general: false,
  620. async: false,
  621. success: function (data) {
  622. if (data) {
  623. if (data.errorCode === "0") {
  624. let rst = data.result;
  625. if (rst && rst.urls) {
  626. var get_urls = rst.urls;
  627. if (typeof (get_urls) === "string") {
  628. $(".formedit2").find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", self.guanlian[0].ID)
  629. }
  630. }
  631. }
  632. }
  633. },
  634. });
  635. }
  636. }
  637. //获取关联流程
  638. self.getGLFLOW = function () {
  639. var data = {
  640. userid: self.userId,
  641. routeinfoid: self.routeinfoid
  642. }
  643. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelatedFlow", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  644. .success(function (obj) {
  645. var res = strToJson(s4.decryptData_CBC(obj.data));
  646. res.data.FLOWIN.forEach(function (item) {
  647. item.type = "FLOWIN"
  648. })
  649. res.data.FLOWOUT.forEach(function (item) {
  650. item.type = "FLOWOUT"
  651. })
  652. self.glList = res.data.FLOWIN.concat(res.data.FLOWOUT);
  653. console.log(self.glList)
  654. })
  655. }
  656. //获取意见(不上表)
  657. self.getOpinion1 = function (n) {
  658. var data = {
  659. cmanid: self.userId,
  660. routeinfoid: self.routeinfoid,
  661. routeid: "",//self.routeid,
  662. tableid: "SX_HYTZDW",
  663. colid: "",
  664. opiniontype: "",//self.opiniontype,
  665. orderbycol: "CDATE desc"
  666. }
  667. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  668. .success(function (obj) {
  669. var res = strToJson(s4.decryptData_CBC(obj.data));
  670. if (res.success == true) {
  671. for (var i in self.YJ) {
  672. if (typeof (self.YJ[i]) == "object") {
  673. self.YJ[i] = [];
  674. res.data.forEach(function (item) {
  675. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  676. if (i == item.COLID) {
  677. self.YJ[i].push(item)
  678. if (item.ROUTEID == self.routeid) {
  679. self.data[i] = item.OPINION;
  680. self.YJ[i + "STATUS"] = true;
  681. }
  682. }
  683. })
  684. }
  685. }
  686. self.YJ.nulla = res.data.filter(function (item) {
  687. return item.COLID == "";
  688. });
  689. self.YJ.nullaSTATUS = false;
  690. self.YJ.nulla.forEach(function (item) {
  691. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  692. if (self.activeOpinion != null) {
  693. self.activeOpinion.FILEDATA = item.FILEDATA
  694. }
  695. })
  696. //if (n == 1 && self.lastrouteinfoid != 0) {
  697. // self.getHB()
  698. //}
  699. } else {
  700. sp.dialog(res.message)
  701. }
  702. })
  703. }
  704. //获取附件
  705. self.getOther = function () {
  706. var data = {
  707. tablename: "FILE_ATTACH",
  708. colums: "*",
  709. order: "ID asc",
  710. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  711. sqlinwhere: "",
  712. sqllikewhere: ""
  713. }
  714. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  715. .success(function (obj) {
  716. var res = strToJson(s4.decryptData_CBC(obj.data));
  717. self.arrayFile1 = [];
  718. if (res.data.length > 0) {
  719. res.data.forEach(function (item) {
  720. if (item.ATTACHTYPE.indexOf("-正文") == -1) {
  721. self.arrayFile1.push(item)
  722. }
  723. })
  724. }
  725. })
  726. }
  727. //发文打开过程稿在线编辑
  728. self.getGCG = function (n) {
  729. var data = {
  730. dockind: "D01",
  731. routeinfoid: self.routeinfoid
  732. }
  733. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  734. .success(function (obj) {
  735. var res = strToJson(s4.decryptData_CBC(obj.data));
  736. self.gaoTypeArrayFirst = res.data;
  737. self.gaoTypeArrayFirst.forEach(function (item) {
  738. if (item.FILENAMES.split(".").length == 1) {
  739. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  740. }
  741. })
  742. if (self.gaoTypeArrayFirst.length > 0 && self.lastrouteinfoid == 0 && n == 0) {
  743. self.seeGCG()
  744. }
  745. if (n > 0) {
  746. self.editFile(self.gaoTypeArrayFirst[0], 1, "正文");
  747. }
  748. if (self.gaoTypeArrayFirst.length > 1) {
  749. var data = {
  750. id: self.gaoTypeArrayFirst[0].ID
  751. }
  752. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  753. .success(function (obj) {
  754. var res = strToJson(s4.decryptData_CBC(obj.data));
  755. if (res.success) {
  756. self.getGCG(2)
  757. }
  758. });
  759. }
  760. })
  761. }
  762. self.seeGCG = function () {
  763. if ($(".formedit1").find("iframe").attr("src") == "") {
  764. if (self.gaoTypeArrayFirst[0].FILEURL.indexOf("files") > -1) {
  765. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + self.gaoTypeArrayFirst[0].FILEURL.slice(7);
  766. } else {
  767. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL;
  768. }
  769. var data = {
  770. method: 1,
  771. params: {
  772. userId: self.userName,
  773. fileId: "",
  774. fileName: "",
  775. filePath: "",
  776. userRight: self.dotype != 1 ? 1 : 0,
  777. callbackUrl: ""
  778. }
  779. };
  780. if (self.gaoTypeArrayFirst[0].FILEURL.indexOf("files") > -1) {
  781. data.params.fileId = self.gaoTypeArrayFirst[0].FILEURL.split("/")[2];
  782. data.params.fileName = self.gaoTypeArrayFirst[0].FILEURL.split("/")[3];
  783. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + self.gaoTypeArrayFirst[0].FILEURL.slice(7);
  784. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  785. } else {
  786. data.params.fileId = self.gaoTypeArrayFirst[0].ID;
  787. data.params.fileName = self.gaoTypeArrayFirst[0].FILENAMES;
  788. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL;
  789. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  790. }
  791. $.ajax({
  792. url: apiurljs.yzFileWo + "api.do",
  793. data: {
  794. jsonParams: encodeURIComponent(JSON.stringify(data))
  795. },
  796. type: "POST",
  797. dataType: "json",
  798. general: false,
  799. async: false,
  800. success: function (data) {
  801. if (data) {
  802. if (data.errorCode === "0") {
  803. let rst = data.result;
  804. if (rst && rst.urls) {
  805. var get_urls = rst.urls;
  806. if (typeof (get_urls) === "string") {
  807. $(".formedit1").find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", self.gaoTypeArrayFirst[0].ID)
  808. }
  809. }
  810. }
  811. }
  812. },
  813. });
  814. }
  815. }
  816. //成文稿
  817. self.getCWG = function () {
  818. var data = {
  819. dockind: "D02",
  820. routeinfoid: self.routeinfoid
  821. }
  822. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  823. .success(function (obj) {
  824. var res = strToJson(s4.decryptData_CBC(obj.data));
  825. self.gaoTypeArraySecond = res.data;
  826. self.gaoTypeArraySecond.forEach(function (item) {
  827. if (item.FILENAMES.split(".").length == 1) {
  828. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  829. }
  830. })
  831. })
  832. }
  833. //签章稿
  834. self.getQZG = function () {
  835. var data = {
  836. dockind: "D03",
  837. routeinfoid: self.routeinfoid
  838. }
  839. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  840. .success(function (obj) {
  841. var res = strToJson(s4.decryptData_CBC(obj.data));
  842. self.gaoTypeArrayThird = res.data;
  843. self.gaoTypeArrayThird.forEach(function (item) {
  844. if (item.FILENAMES.split(".").length == 1) {
  845. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  846. }
  847. })
  848. })
  849. }
  850. //下载正文/终稿/签章
  851. self.downloadWG = function (item) {
  852. //window.open(apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL)
  853. window.open(apiurljs.login + "g2work/gaizhangfiles/" + encodeURIComponent(self.data.BT) + "/" + item.FILENAMES)
  854. }
  855. //删除正文/终稿/签章
  856. self.btnDeleteWG = function (obj, n) {
  857. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  858. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  859. 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>";
  860. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  861. sp.openCenter(".sp-dialog");
  862. ///取消按钮
  863. $('.sp-closeDialog').click(function (event) {
  864. sp.closeCenter(".sp-dialog");
  865. event.preventDefault();
  866. event.stopPropagation();
  867. });
  868. //post消息的id
  869. $("#delDataTrue").click(function () {
  870. var data = {
  871. id: obj.ID
  872. }
  873. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  874. .success(function (obj) {
  875. var res = strToJson(s4.decryptData_CBC(obj.data));
  876. sp.dialoghide();
  877. if (res.success) {
  878. if (n == 2) {
  879. self.getCWG()
  880. } else if (n == 3) {
  881. self.getQZG()
  882. }
  883. } else {
  884. sp.dialog("创建失败,请联系管理员!");
  885. }
  886. ///
  887. });
  888. });
  889. };
  890. //生成正文三种方式:空白模板,红头模板,上传本地文件
  891. self.newMoBanFlag = false;
  892. self.newMoBan1 = function () {
  893. self.newMoBanFlag = true;
  894. if (self.gaoTypeArrayFirst.length > 0) {
  895. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  896. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  897. 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>";
  898. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  899. sp.openCenter(".sp-dialog");
  900. ///取消按钮
  901. $('.sp-closeDialog').click(function (event) {
  902. sp.closeCenter(".sp-dialog");
  903. event.preventDefault();
  904. event.stopPropagation();
  905. });
  906. //post消息的id
  907. $("#delDataTrue").click(function () {
  908. sp.closeCenter(".sp-dialog");
  909. var data = {
  910. id: self.gaoTypeArrayFirst[0].ID
  911. }
  912. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  913. .success(function (obj) {
  914. var res = strToJson(s4.decryptData_CBC(obj.data));
  915. if (res.success) {
  916. var data = {
  917. dockind: "D01",
  918. routeinfoid: self.routeinfoid,
  919. gwtype: self.data.GWZL,
  920. filekind: "DOCFILE"
  921. }
  922. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  923. .success(function (obj) {
  924. var res = strToJson(s4.decryptData_CBC(obj.data));
  925. if (res.success) {
  926. self.getGCG(1)
  927. } else {
  928. sp.dialog("创建失败,请联系管理员!");
  929. }
  930. });
  931. } else {
  932. sp.dialog("创建失败,请联系管理员!");
  933. }
  934. self.newMoBanFlag = false;
  935. });
  936. })
  937. } else {
  938. var data = {
  939. dockind: "D01",
  940. routeinfoid: self.routeinfoid,
  941. gwtype: self.data.GWZL,
  942. filekind: "DOCFILE"
  943. }
  944. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  945. .success(function (obj) {
  946. var res = strToJson(s4.decryptData_CBC(obj.data));
  947. if (res.success) {
  948. self.getGCG(1)
  949. } else {
  950. sp.dialog("创建失败,请联系管理员!");
  951. }
  952. self.newMoBanFlag = false;
  953. });
  954. }
  955. }
  956. self.newMoBan2 = function () {
  957. self.newMoBanFlag = true;
  958. if (self.gaoTypeArrayFirst.length > 0) {
  959. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  960. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  961. 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>";
  962. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  963. sp.openCenter(".sp-dialog");
  964. ///取消按钮
  965. $('.sp-closeDialog').click(function (event) {
  966. sp.closeCenter(".sp-dialog");
  967. event.preventDefault();
  968. event.stopPropagation();
  969. });
  970. //post消息的id
  971. $("#delDataTrue").click(function () {
  972. sp.closeCenter(".sp-dialog");
  973. var data = {
  974. id: self.gaoTypeArrayFirst[0].ID
  975. }
  976. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  977. .success(function (obj) {
  978. var res = strToJson(s4.decryptData_CBC(obj.data));
  979. if (res.success) {
  980. var data = {
  981. dockind: "D01",
  982. routeinfoid: self.routeinfoid,
  983. gwtype: self.data.GWZL,
  984. filekind: "REDFILE"
  985. }
  986. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  987. .success(function (obj) {
  988. var res = strToJson(s4.decryptData_CBC(obj.data));
  989. if (res.success) {
  990. self.getGCG(1)
  991. } else {
  992. sp.dialog("创建失败,请联系管理员!");
  993. }
  994. });
  995. } else {
  996. sp.dialog("创建失败,请联系管理员!");
  997. }
  998. self.newMoBanFlag = false;
  999. });
  1000. })
  1001. } else {
  1002. var data = {
  1003. dockind: "D01",
  1004. routeinfoid: self.routeinfoid,
  1005. gwtype: self.data.GWZL,
  1006. filekind: "REDFILE"
  1007. }
  1008. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1009. .success(function (obj) {
  1010. var res = strToJson(s4.decryptData_CBC(obj.data));
  1011. if (res.success) {
  1012. self.getGCG(1)
  1013. } else {
  1014. sp.dialog("创建失败,请联系管理员!");
  1015. }
  1016. self.newMoBanFlag = false;
  1017. });
  1018. }
  1019. }
  1020. //判断页面字段是否只读readonly、是否隐藏show
  1021. self.hide = function (type, field) {
  1022. if (self.dotype == 0 && type == "readonly") {
  1023. return true;
  1024. } else {
  1025. if (self[type][field] == true) {
  1026. return true;
  1027. } else {
  1028. return false;
  1029. }
  1030. }
  1031. }
  1032. //右上角按钮调用方法
  1033. self.btnEvent = function (item) {
  1034. switch (item.CODE) {
  1035. case "SAVEITEM": self.btnSave(0); break;
  1036. case "PRINTITEM": self.btnPrint(); break;
  1037. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  1038. case "SAVEOFD": self.toOFD(); break;
  1039. case "GAIZITEM": self.qianZ(); break;
  1040. case "MEETITEM": self.Meet(); break;
  1041. case "SENDLOG": self.RouteList(); break;
  1042. case "YUGUIDANG": self.YGD(); break;
  1043. case "array": return;
  1044. default: self.forward(item); break;
  1045. }
  1046. }
  1047. //生成终稿
  1048. self.toOFD = function () {
  1049. if (self.gaoTypeArraySecond.length != 0) {
  1050. sp.dialog("请删除成文稿后,点击文件保存!")
  1051. $timeout(function () {
  1052. sp.dialoghide()
  1053. }, 1000)
  1054. return
  1055. }
  1056. var data = {
  1057. routeinfoid: self.routeinfoid,
  1058. gwtype: self.data.GWZL,
  1059. dockind: "D02"
  1060. }
  1061. $http.post(apiurljs.login + "g2app/fawenfiles/convertDataFinalOFDFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1062. .success(function (obj) {
  1063. var res = strToJson(s4.decryptData_CBC(obj.data));
  1064. if (res.success == true) {
  1065. self.getCWG()
  1066. }
  1067. })
  1068. }
  1069. //签章
  1070. self.qianZ = function () {
  1071. if (self.gaoTypeArrayThird.length != 0 || self.gaoTypeArraySecond.length != 0) {
  1072. sp.dialog("请删除成文稿和签章稿后,点击签章!")
  1073. $timeout(function () {
  1074. sp.dialoghide()
  1075. }, 1000)
  1076. return
  1077. }
  1078. var data = {
  1079. //srcpath: "/opt/TongWeb7.0/applications/glworkweb/UploadAttach/" + self.gaoTypeArraySecond[0].FILENAMES,
  1080. //outpath: "/opt/TongWeb7.0/applications/glworkweb/UploadAttach",
  1081. routeinfoid: self.routeinfoid,
  1082. gwtype: self.data.GWZL,
  1083. dockind: "D02"
  1084. }
  1085. //$http.post(apiurljs.login + "g2app/signature/getSignature", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1086. $http.post(apiurljs.login + "g2app/signature/convertDataFinalOFDFileAndgetSignature", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1087. .success(function (obj) {
  1088. var res = strToJson(s4.decryptData_CBC(obj.data));
  1089. if (res.success == true) {
  1090. sp.dialog("生成成功!")
  1091. self.getCWG()
  1092. self.getQZG()
  1093. }
  1094. })
  1095. }
  1096. //打开公文模板弹窗
  1097. self.openGLJ = function () {
  1098. $("#GLJWin").attr("src", "../../forward/GLJ.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&cookie=shouwenbg")
  1099. sp.layer("#GLJ")
  1100. }
  1101. self.openUserList = function (str) {
  1102. if (self.hide("readonly", str) == true) {
  1103. return
  1104. } else {
  1105. self.filed = str;
  1106. //self.AllChecked[self.filed] = false;
  1107. sp.layer("#userList")
  1108. $("#userList .sp-page").eq(0).scrollTop(0);
  1109. }
  1110. }
  1111. self.checkAllUser = function () {
  1112. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  1113. $.each(self.UserList[self.filed], function (index, item) {
  1114. item.checked = self.AllChecked[self.filed];
  1115. $.each(item.USER, function (index1, item1) {
  1116. item1.checked = self.AllChecked[self.filed];
  1117. })
  1118. })
  1119. self.submitUserList(1)
  1120. }
  1121. self.checkUserItem = function (item) {
  1122. item.checked = !item.checked;
  1123. $.each(item.USER, function (index, item1) {
  1124. item1.checked = item.checked;
  1125. })
  1126. var n = 0;
  1127. $.each(self.UserList[self.filed], function (index, item) {
  1128. if (item.checked == true) {
  1129. n++
  1130. }
  1131. })
  1132. if (n == self.UserList[self.filed].length) {
  1133. self.AllChecked[self.filed] = true;
  1134. } else {
  1135. self.AllChecked[self.filed] = false;
  1136. }
  1137. self.submitUserList(1)
  1138. }
  1139. self.checkUser = function (item) {
  1140. item.checked = !item.checked;
  1141. var n = [], all = 0;
  1142. $.each(self.UserList[self.filed], function (x, y) {
  1143. n.push(0);
  1144. $.each(y.USER, function (x1, y1) {
  1145. if (y1.checked == true) {
  1146. n[x]++
  1147. }
  1148. })
  1149. if (n[x] == y.USER.length && n[x] != 0) {
  1150. y.checked = true;
  1151. all++
  1152. } else {
  1153. y.checked = false;
  1154. }
  1155. })
  1156. if (all == self.UserList[self.filed].length) {
  1157. self.AllChecked[self.filed] = true;
  1158. } else {
  1159. self.AllChecked[self.filed] = false;
  1160. }
  1161. self.submitUserList(1)
  1162. }
  1163. self.submitUserList = function (n) {
  1164. var AllCheckedLength = 0;
  1165. self.selectList[self.filed] = [];
  1166. $.each(self.UserList[self.filed], function (index, item) {
  1167. $.each(item.USER, function (index1, item1) {
  1168. if (item1.checked == true) {
  1169. AllCheckedLength++;
  1170. self.selectList[self.filed].push(item1)
  1171. }
  1172. })
  1173. })
  1174. self.data[self.filed] = self.selectList[self.filed].map(function (item) {
  1175. return item.USHOWNAME
  1176. }).join(",")
  1177. if (self.data[self.filed + "USERID"] != undefined) {
  1178. self.data[self.filed + "USERID"] = self.selectList[self.filed].map(function (item) {
  1179. return item.USERID
  1180. }).join(",")
  1181. }
  1182. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  1183. self.changeFiled(self.filed)
  1184. if (n == 0) {
  1185. sp.layerhide();
  1186. }
  1187. }
  1188. //保存提交
  1189. self.btnSave = function (n) {
  1190. if (spngvld.submit(".formedit")) {
  1191. if (self.docmode == 'zihao' && self.data.FWZH != "") {
  1192. var data = {
  1193. data: {
  1194. CYEAR: sp.currentYear(),
  1195. FLOWID: sp.getUrlName("flowid"),
  1196. ZIHAO: "",
  1197. CNAMEMARK: "",
  1198. ROUTEINFOIDMARK: self.routeinfoid
  1199. }
  1200. }
  1201. self.FWZH.forEach(function (item) {
  1202. if (item.CODE == self.data.FWZH) {
  1203. data.data.ZIHAO = item.CODE;
  1204. data.data.CNAMEMARK = item.CNAMEMARK
  1205. }
  1206. })
  1207. $http.post(apiurljs.login + "g2app/fawen/saveWenHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1208. .success(function (obj) { })
  1209. }
  1210. var dataArray = [];
  1211. dataArray.push(self.data);
  1212. var data = {
  1213. ckey: "SX_HYTZDW",
  1214. id: self.data.ID,
  1215. routeid: self.routeid,
  1216. routeinfoid: self.routeinfoid,
  1217. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.ZT,
  1218. directionid: self.directionid,
  1219. formeditid: self.formeditid,
  1220. data: JSON.stringify(dataArray)
  1221. }
  1222. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1223. .success(function (obj) {
  1224. var res = strToJson(s4.decryptData_CBC(obj.data));
  1225. if (res.code == 0) {
  1226. self.data.ID = res.data.ID;
  1227. self.routeid = res.data.ROUTEID;
  1228. self.routeinfoid = res.data.ROUTEINFOID;
  1229. //if (self.lastrouteinfoid != 0) {
  1230. // self.getHB()
  1231. //}
  1232. self.filedChange = false;
  1233. if (self.gaoTypeArrayFirst.length == 0) {
  1234. var data = {
  1235. dockind: "D01",
  1236. routeinfoid: self.routeinfoid,
  1237. gwtype: self.data.GWZL,
  1238. filekind: "DOCFILE"
  1239. }
  1240. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1241. .success(function (obj) {
  1242. var res = strToJson(s4.decryptData_CBC(obj.data));
  1243. if (res.success) {
  1244. if (n == 0) {
  1245. sp.dialog("保存成功!");
  1246. $timeout(function () {
  1247. sp.dialoghide()
  1248. }, 1500)
  1249. self.getSwenList(1)
  1250. } else if (n == 1) {
  1251. self.forward(self.btnItem);
  1252. } else if (n == 2) {
  1253. self.sendAll();
  1254. } else if (n == 3) {
  1255. self.btnPrint();
  1256. } else if (n == 4) {
  1257. sp.layer("#print")
  1258. }
  1259. } else {
  1260. sp.dialog("文稿创建失败,请联系管理员!");
  1261. }
  1262. });
  1263. } else {
  1264. var YZdata = {
  1265. method: 2,
  1266. params: {
  1267. fileId: self.gaoTypeArrayFirst[0].ID
  1268. }
  1269. };
  1270. $.ajax({
  1271. url: apiurljs.yzFileWo + "api.do",
  1272. data: {
  1273. jsonParams: encodeURIComponent(JSON.stringify(YZdata))
  1274. },
  1275. type: "POST",
  1276. dataType: "json",
  1277. general: false,
  1278. async: false,
  1279. success: function (resp) {
  1280. if (n == 0) {
  1281. sp.dialog("保存成功!");
  1282. $timeout(function () {
  1283. sp.dialoghide()
  1284. }, 1500)
  1285. self.getSwenList(1)
  1286. } else if (n == 1) {
  1287. self.forward(self.btnItem);
  1288. } else if (n == 2) {
  1289. self.sendAll();
  1290. } else if (n == 3) {
  1291. self.btnPrint();
  1292. } else if (n == 4) {
  1293. sp.layer("#print")
  1294. }
  1295. }
  1296. });
  1297. }
  1298. } else {
  1299. sp.dialog(res.message)
  1300. }
  1301. })
  1302. }
  1303. }
  1304. /*综合打印*/
  1305. self.printFiled = 1;
  1306. self.btnPrint1 = function () {
  1307. if (self.filedChange == true) {
  1308. self.btnSave(4)
  1309. } else {
  1310. sp.layer("#print")
  1311. }
  1312. }
  1313. self.printSubmit = function () {
  1314. if (self.printFiled == 1) {
  1315. var templatefilename = "moban_hytzww"
  1316. } else if (self.printFiled == 2) {
  1317. var templatefilename = "mobanoption"
  1318. } else {
  1319. var templatefilename = "moban_hytzww_all"
  1320. }
  1321. var data = {
  1322. templatefilename: templatefilename + ".ftl",
  1323. outfilepath: "/tmp/正式文(上行文)" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  1324. routeinfoid: self.routeinfoid,
  1325. tablename: "SX_HYTZDW",
  1326. printtype: self.printFiled,
  1327. printdate: "HYSJ"
  1328. }
  1329. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  1330. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1331. .success(function (obj) {
  1332. var res = strToJson(s4.decryptData_CBC(obj.data));
  1333. if (self.deviceType == "pad") {
  1334. window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
  1335. } else {
  1336. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  1337. }
  1338. })
  1339. sp.layerhide()
  1340. }
  1341. //签写意见编辑状态
  1342. self.opinion = {
  1343. BMZGYJ: false,
  1344. BMZGYJImg: false,
  1345. WLDYJ: false,
  1346. WLDYJImg: false,
  1347. nulla: false
  1348. }
  1349. self.YJ = {
  1350. BMZGYJ: [],
  1351. BMZGYJSTATUS: false,
  1352. WLDYJ: [],
  1353. WLDYJSTATUS: false,
  1354. nulla: [],
  1355. nullaSTATUS: false
  1356. }
  1357. //意见(下表)
  1358. self.openOptionList = function () {
  1359. if (self.routeinfoid == 0 && self.routeid == 0) {
  1360. sp.dialog("请先保存!")
  1361. return;
  1362. }
  1363. if (self.dotype == 0) {
  1364. return
  1365. }
  1366. if (self.opinion.nulla == true) {
  1367. return;
  1368. }
  1369. self.nulla = "";
  1370. self.opinion.nulla = true;
  1371. }
  1372. self.openOptionList1 = function () {
  1373. self.openOptionList()
  1374. self.activeOpinion = null;
  1375. self.showBottom = "opinion";
  1376. self.YJ.nulla.forEach(function (item) {
  1377. if (item.ROUTEID == self.routeid) {
  1378. self.activeOpinion = item;
  1379. self.nulla = item.OPINION;
  1380. }
  1381. })
  1382. }
  1383. self.closeOptionList = function () {
  1384. self.opinion.nulla = false;
  1385. self.activeOpinion = null;
  1386. $(".toggle").trigger("click")
  1387. }
  1388. self.submitOptionList = function () {
  1389. var data = {
  1390. cmanid: self.userId,
  1391. routeinfoid: self.routeinfoid,
  1392. routeid: self.routeid,
  1393. tableid: "SX_HYTZDW",
  1394. colid: "",
  1395. opiniontype: 99,
  1396. cresult: "",
  1397. opinion: self.nulla,
  1398. opinionimage: ""
  1399. }
  1400. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1401. .success(function (obj) {
  1402. var res = strToJson(s4.decryptData_CBC(obj.data));
  1403. if (res.success == true) {
  1404. self.getOpinion1(2);
  1405. self.opinion.nulla = false;
  1406. $(".toggle").trigger("click")
  1407. } else {
  1408. sp.dialog(res.message)
  1409. }
  1410. })
  1411. }
  1412. self.changeOptionList = function (item) {
  1413. self.showBottom = "opinion";
  1414. self.opinion.nulla = true;
  1415. self.nulla = item.OPINION;
  1416. self.activeOpinion = item;
  1417. }
  1418. //意见附件(下表)
  1419. self.uploading1 = false;
  1420. self.upload1 = function () {
  1421. $('#fileupload1').fileupload({
  1422. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1423. dataType: 'json',
  1424. beforeSend: function (xhr, data) {
  1425. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1426. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1427. + ",routeid=" + self.routeid + ",tableid=SX_HYTZDW,colid="));
  1428. },
  1429. // 上传完成后的执行逻辑
  1430. done: function (e, data) {
  1431. self.uploading1 = false;
  1432. self.getOpinion1(2)
  1433. }
  1434. })
  1435. }
  1436. //意见附件(下表)
  1437. self.uploading2 = false;
  1438. self.upload2 = function (str) {
  1439. $('#fileupload-' + str).fileupload({
  1440. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1441. dataType: 'json',
  1442. beforeSend: function (xhr, data) {
  1443. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1444. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1445. + ",routeid=" + self.routeid + ",tableid=SX_HYTZDW,colid=" + str));
  1446. },
  1447. // 上传完成后的执行逻辑
  1448. done: function (e, data) {
  1449. self.uploading1 = false;
  1450. self.getOpinion1(2)
  1451. }
  1452. })
  1453. }
  1454. //下载意见表附件
  1455. self.downLoadOption = function (item) {
  1456. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  1457. }
  1458. //删除意见表附件
  1459. self.deleteOptionFile = function (file) {
  1460. var data = {
  1461. routeid: file.ROUTEID,
  1462. tableid: "SX_HYTZDW",
  1463. colid: file.COLID,
  1464. fileid: file.FILEID
  1465. };
  1466. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1467. .success(function (obj) {
  1468. var res = strToJson(s4.decryptData_CBC(obj.data));
  1469. sp.dialoghide();
  1470. if (res.success) {
  1471. self.getOpinion1(2);
  1472. } else {
  1473. sp.dialog("删除失败,请联系管理员!");
  1474. }
  1475. });
  1476. }
  1477. //签写意见
  1478. self.openOpinion = function (str) {
  1479. if (self.routeinfoid == 0 && self.routeid == 0) {
  1480. sp.dialog("请先保存!")
  1481. return;
  1482. }
  1483. self.opinion[str] = true;
  1484. }
  1485. //修改意见
  1486. self.changeOpinion = function (str) {
  1487. self.data[str] = self.YJ[str][0].OPINION;
  1488. self.opinion[str] = true;
  1489. }
  1490. self.changeOpinionItem = function (str, item) {
  1491. if (item.OPINIONIMAGE != "") {
  1492. self.QianZi(str);
  1493. self.opinion[str + "Img"] = true;
  1494. }
  1495. self.data[str] = item.OPINION;
  1496. self.opinion[str] = true;
  1497. }
  1498. //提交意见
  1499. self.Sopinion = function (str) {
  1500. if (self.opinion[str + "Img"] == true) {
  1501. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  1502. } else {
  1503. self.data[str] = $("#" + str).val();
  1504. }
  1505. var data = {
  1506. cmanid: self.userId,
  1507. routeinfoid: self.routeinfoid,
  1508. routeid: self.routeid,
  1509. tableid: "SX_HYTZDW",
  1510. colid: str,
  1511. opiniontype: 0,
  1512. cresult: "",
  1513. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  1514. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  1515. }
  1516. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1517. .success(function (obj) {
  1518. var res = strToJson(s4.decryptData_CBC(obj.data));
  1519. if (res.success == true) {
  1520. self.getOpinion1(1);
  1521. self.opinion[str] = false;
  1522. self.opinion[str + "Img"] = false;
  1523. self.data[str] = "";
  1524. self.changeFiled(str)
  1525. } else {
  1526. sp.dialog(res.message)
  1527. }
  1528. })
  1529. }
  1530. //删除意见
  1531. self.Dopinion = function (str) {
  1532. var data = {
  1533. cmanid: self.userId,
  1534. routeid: self.routeid,
  1535. tableid: "SX_HYTZDW",
  1536. colid: str
  1537. }
  1538. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1539. .success(function (obj) {
  1540. var res = strToJson(s4.decryptData_CBC(obj.data));
  1541. if (res.success == true) {
  1542. self.getOpinion1(1);
  1543. self.nulla = "";
  1544. self.activeOpinion = null;
  1545. self.changeFiled(str)
  1546. } else {
  1547. sp.dialog(res.message)
  1548. }
  1549. })
  1550. }
  1551. self.phraseText = "";//添加常用语
  1552. self.phraseList = []//常用语列表
  1553. //获取常用语库
  1554. self.phrase = function (colid) {
  1555. sp.layer("#phrase");
  1556. self.colid = colid;
  1557. self.getPhrase();
  1558. }
  1559. //添加常用语到常用语库
  1560. self.Aphrase = function () {
  1561. if (self.phraseText == "") {
  1562. return;
  1563. }
  1564. var data = {
  1565. cmanid: self.userId,
  1566. tableid: "SX_HYTZDW",
  1567. colid: self.colid,
  1568. contents: self.phraseText
  1569. }
  1570. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1571. .success(function (obj) {
  1572. var res = strToJson(s4.decryptData_CBC(obj.data));
  1573. if (res.success == true) {
  1574. self.phraseText = "";
  1575. self.getPhrase();
  1576. } else {
  1577. sp.dialog(res.message)
  1578. }
  1579. })
  1580. }
  1581. //获取常用语库
  1582. self.getPhrase = function () {
  1583. var data = {
  1584. cmanid: self.userId,
  1585. tableid: "SX_HYTZDW",
  1586. colid: self.colid
  1587. }
  1588. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1589. .success(function (obj) {
  1590. var res = strToJson(s4.decryptData_CBC(obj.data));
  1591. self.phraseList = res.data;
  1592. self.phraseSelect = self.phraseList[0].CONTENTS;
  1593. })
  1594. }
  1595. //从常用语库删除
  1596. self.Dphrase = function () {
  1597. var id = null;
  1598. $.each(self.phraseList, function (index, item) {
  1599. if (item.CONTENTS == self.phraseSelect) {
  1600. id = item.ID;
  1601. }
  1602. })
  1603. var data = {
  1604. id: id
  1605. }
  1606. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1607. .success(function (obj) {
  1608. var res = strToJson(s4.decryptData_CBC(obj.data));
  1609. self.getPhrase();
  1610. })
  1611. }
  1612. //常用语确认为意见
  1613. self.btnPhrase = function () {
  1614. if (!self.colid) {
  1615. self.nulla = self.phraseSelect;
  1616. } else {
  1617. self.data[self.colid] = self.phraseSelect;
  1618. }
  1619. sp.layerhide();
  1620. }
  1621. //签字—手写
  1622. self.QianZi = function (str) {
  1623. if (self.opinion[str + "Img"] == true) { return; }
  1624. self.opinion[str + "Img"] = true;
  1625. $timeout(function () {
  1626. new lineCanvas(str + "QZ")
  1627. }, 1)
  1628. }
  1629. //清除手写
  1630. self.canvasClear = function (str) {
  1631. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  1632. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  1633. }
  1634. self.selectUSAGE = function (item) {
  1635. item.checked = !item.checked;
  1636. self.selectUSAGEs = [];
  1637. $.each(self.USAGE, function (index, item) {
  1638. if (item.checked == true) {
  1639. self.selectUSAGEs.push(item.CODE)
  1640. }
  1641. })
  1642. self.changeFiled('USAGE')
  1643. }
  1644. //发生修改
  1645. self.changeFiled = function (str) {
  1646. self.filedChange = true;
  1647. }
  1648. //转发
  1649. self.forward = function (obj) {
  1650. self.btnItem = obj;
  1651. if (self.filedChange == true) {
  1652. self.btnSave(1)
  1653. } else {
  1654. $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=fawenbg")
  1655. sp.layer("#forward")
  1656. }
  1657. }
  1658. //预归档
  1659. self.YGD = function () {
  1660. $.cookie("GlWorkPlatform-gdsp", JSON.stringify({ FLOWID: sp.getUrlName("flowid"), FLOWNAME: self.flowTitle, TITLE: self.data.BT, MOBANNAME: "moban63.ftl", TABLENAME: "SX_HYTZDW" }), { path: '/', expires: 1 });
  1661. $("#YGDWin").attr("src", "../../forward/yuguidang.html?routeinfoid=" + self.routeinfoid + "&id=0")
  1662. sp.layer("#yuguidang")
  1663. }
  1664. //查看流转记录
  1665. self.RouteList = function () {
  1666. if (self.deviceType == "pad") {
  1667. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  1668. } else {
  1669. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1670. }
  1671. }
  1672. self.showCol = function ($event, ele) {
  1673. $('.show-col').not(ele).not("#ziliao").hide();
  1674. $(ele).toggle("fast", function () {
  1675. $(ele).css('overflow-y', 'auto')
  1676. }).autoHide();
  1677. $event.stopPropagation();
  1678. }
  1679. self.iframeList = []
  1680. self.iframeLast = self.iframeList.length - 1;
  1681. self.iframeShow = self.iframeList.length;
  1682. self.iframeHide = self.iframeList.length - self.iframeShow;
  1683. //num为1时为附件表附件,为2时为文稿表附件
  1684. self.seeFile = function (obj, num, str) {
  1685. $('.show-col').hide();
  1686. if (!obj) {
  1687. sp.dialog("文件不存在!")
  1688. return
  1689. }
  1690. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  1691. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  1692. return
  1693. }
  1694. var n = 0;
  1695. self.iframeList.forEach(function (item) {
  1696. if (item.filename == obj.FILENAMES) {
  1697. n++
  1698. }
  1699. })
  1700. if (n == 0) {
  1701. var set_convertType = 0;
  1702. if (obj.FILEEXT == "doc") {
  1703. set_convertType = 0;
  1704. } else if (obj.FILEEXT == "pdf") {
  1705. set_convertType = 20;
  1706. } else if (obj.FILEEXT == "ofd") {
  1707. set_convertType = 570;
  1708. } else if ("png,jpg,jpeg,gif,bmp,jfif,svg,tif,tiff".indexOf(obj.FILEEXT) > -1) {
  1709. set_convertType = 23;
  1710. } else {
  1711. set_convertType = 0;
  1712. }
  1713. let postData = {
  1714. convertType: set_convertType,
  1715. isSignature: 1,
  1716. fileUrl: num == 1 ? (obj.FILEPATH ? apiurljs.yzFcscloud + "g2work" + obj.FILEPATH : apiurljs.yzFcscloud + "g2work/files2/inline/" + obj.FILEURL.slice(7)) : apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL
  1717. };
  1718. var postCfg_transfer = {
  1719. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  1720. transformRequest: function (data) {
  1721. return $.param(data);
  1722. }
  1723. };
  1724. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  1725. .success(function (res) {
  1726. if (res.errorcode === 0) {
  1727. if (num == 1) {
  1728. if (obj.FILEPATH) {
  1729. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work" + obj.FILEPATH, str, obj.FILENAMES, false)
  1730. } else {
  1731. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7), str, obj.FILENAMES, false)
  1732. }
  1733. } else {
  1734. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login.split("glwork/")[0] + "glworkweb/" + obj.FILEURL, str, obj.FILENAMES, false)
  1735. }
  1736. } else {
  1737. sp.dialog(res.message);
  1738. }
  1739. });
  1740. }
  1741. }
  1742. self.seeZW = function () {
  1743. self.activeFormedit = 0;
  1744. if ($(".rightBox").outerWidth() == 15) {
  1745. showRightBox()
  1746. }
  1747. $("#rightList").css("margin-left", 0);
  1748. }
  1749. self.editFile = function (obj, n, str) {
  1750. if (self.newMoBanFlag == true) {
  1751. return
  1752. }
  1753. $('.show-col').hide();
  1754. if (!obj) {
  1755. sp.dialog("文件不存在!")
  1756. return
  1757. }
  1758. self.activeFormedit = n;
  1759. if ($(".rightBox").outerWidth() == 15) {
  1760. showRightBox()
  1761. }
  1762. if ($(".formedit" + n).find("iframe").attr("data-id") == obj.ID) {
  1763. if (self.iframeList.length == 0) {
  1764. if (n == 0) {
  1765. $("#rightList").css("margin-left", 0);
  1766. } else {
  1767. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1768. }
  1769. } else if (self.iframeHide == self.iframeList.length) {
  1770. if (n == 0) {
  1771. console.log(n)
  1772. $("#rightList").css("margin-left", 0);
  1773. } else {
  1774. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1775. }
  1776. } else {
  1777. $("#rightList").css("margin-left", n * $(".formedit").width() * -1);
  1778. }
  1779. } else {
  1780. if (obj.FILEURL.indexOf("files") > -1) {
  1781. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
  1782. } else {
  1783. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
  1784. }
  1785. var data = {
  1786. method: 1,
  1787. params: {
  1788. userId: self.userName,
  1789. fileId: "",
  1790. fileName: "",
  1791. filePath: "",
  1792. userRight: self.dotype != 1 ? 1 : 0,
  1793. callbackUrl: ""
  1794. }
  1795. };
  1796. if (obj.FILEURL.indexOf("files") > -1) {
  1797. data.params.fileId = obj.FILEURL.split("/")[2];
  1798. data.params.fileName = obj.FILEURL.split("/")[3];
  1799. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
  1800. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  1801. } else {
  1802. data.params.fileId = obj.ID;
  1803. data.params.fileName = obj.FILENAMES;
  1804. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
  1805. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  1806. }
  1807. $.ajax({
  1808. url: apiurljs.yzFileWo + "api.do",
  1809. data: {
  1810. jsonParams: encodeURIComponent(JSON.stringify(data))
  1811. },
  1812. type: "POST",
  1813. dataType: "json",
  1814. general: false,
  1815. async: false,
  1816. success: function (data) {
  1817. if (data) {
  1818. if (data.errorCode === "0") {
  1819. let rst = data.result;
  1820. if (rst && rst.urls) {
  1821. var get_urls = rst.urls;
  1822. if (typeof (get_urls) === "string") {
  1823. $(".formedit" + n).find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", obj.ID)
  1824. if (self.iframeList.length == 0) {
  1825. if (n == 0) {
  1826. $("#rightList").css("margin-left", 0);
  1827. } else {
  1828. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1829. }
  1830. } else if (self.iframeHide == self.iframeList.length) {
  1831. if (n == 0) {
  1832. console.log(n)
  1833. $("#rightList").css("margin-left", 0);
  1834. } else {
  1835. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1836. }
  1837. } else {
  1838. $("#rightList").css("margin-left", n * $(".formedit").width() * -1);
  1839. }
  1840. }
  1841. }
  1842. }
  1843. }
  1844. },
  1845. })
  1846. }
  1847. }
  1848. self.btnSaveFile = function (id) {
  1849. var data = {
  1850. method: 2,
  1851. params: {
  1852. fileId: id
  1853. }
  1854. };
  1855. $.ajax({
  1856. url: apiurljs.yzFileWo + "api.do",
  1857. data: {
  1858. jsonParams: encodeURIComponent(JSON.stringify(data))
  1859. },
  1860. type: "POST",
  1861. dataType: "json",
  1862. general: false,
  1863. async: false,
  1864. success: function (data) {
  1865. if (data && data.errorCode === "0") {
  1866. sp.dialog("保存成功");
  1867. }
  1868. }
  1869. });
  1870. }
  1871. self.addItem = function (url, source, name, filename, edit, fileid) {
  1872. var n = 0;
  1873. self.iframeList.forEach(function (item) {
  1874. if (item.filename == filename && item.source == source) {
  1875. n++
  1876. }
  1877. })
  1878. if (n == 0) {
  1879. if (edit == false) {
  1880. self.iframeList.push({ id: self.iframeList.length + 1, title: name, filename: filename, url: $sce.trustAsResourceUrl(url), source: source, edit: edit, show: 1 })
  1881. } else {
  1882. self.iframeList.push({ id: self.iframeList.length + 1, title: name, filename: filename, url: $sce.trustAsResourceUrl(url), source: source, edit: edit, show: 1, fileid: fileid })
  1883. }
  1884. self.changeSize(1)
  1885. }
  1886. }
  1887. self.hideItem = function (n) {
  1888. self.iframeList[n].show = 2;
  1889. self.iframeList[n].boxStyle = { width: 0, float: "left" };
  1890. self.changeIframeSize()
  1891. }
  1892. self.showItem = function (n) {
  1893. self.iframeList[n].show = 1;
  1894. self.changeIframeSize()
  1895. }
  1896. self.changeIframeSize = function () {
  1897. if (self.iframeList.length == 0) {
  1898. } else {
  1899. var n = 0;
  1900. self.iframeList.forEach(function (item, index) {
  1901. if (item.show == 1) {
  1902. self.iframeLast = index;
  1903. }
  1904. if (item.show == 2) {
  1905. n = n + 1;
  1906. }
  1907. })
  1908. self.iframeHide = n;
  1909. self.iframeShow = self.iframeList.length - self.iframeHide;
  1910. for (var i = 0; i < self.iframeList.length; i++) {
  1911. if (self.iframeHide != self.iframeList.length) {
  1912. if (self.iframeList[i].show == 1) {
  1913. self.iframeList[i].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
  1914. self.iframeList[i].iframeStyle = { width: self.iframeList[i].boxStyle.width - 10 }
  1915. }
  1916. if ($(".rightBox").outerWidth() == 15) {
  1917. $(".leftBox").css("width", "calc(100% - 15px)");
  1918. $(".border-left-right").show()
  1919. $(".border-left-right").prev().show()
  1920. } else {
  1921. showRightBox()
  1922. }
  1923. } else {
  1924. self.iframeList[i].show = 2
  1925. self.iframeList[i].boxStyle = { width: 0, float: "left" };
  1926. self.seeGCG()
  1927. $(".leftBox").css("width", 36)
  1928. $(".border-left-right").hide()
  1929. $(".border-left-right").prev().hide()
  1930. $(".rightBox").css("width", "calc(100% - 36px)")
  1931. $("#rightList").show();
  1932. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1933. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1934. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1935. self.formeditSize()
  1936. var marginLeft = $("#rightList").css("margin-left")
  1937. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  1938. } else {
  1939. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  1940. }
  1941. }
  1942. }
  1943. if (self.iframeShow == 1) {
  1944. self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) - 1 }
  1945. self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
  1946. } else {
  1947. self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2) - 1 }
  1948. self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
  1949. }
  1950. }
  1951. }
  1952. self.changeSize = function (n) {
  1953. if (self.iframeList.length == 0) {
  1954. $(".rightBox").show();
  1955. $("#rightList").show();
  1956. $(".rightBox").css("width", $(window).width())
  1957. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1958. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1959. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1960. self.formeditSize()
  1961. var marginLeft = $("#rightList").css("margin-left")
  1962. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  1963. } else {
  1964. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  1965. }
  1966. } else {
  1967. if (n == 1 && $(".fa-angle-left").is(":hidden") == false) {
  1968. showRightBox()
  1969. }
  1970. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  1971. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  1972. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  1973. self.formeditSize()
  1974. var marginLeft = $("#rightList").css("margin-left")
  1975. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  1976. } else {
  1977. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  1978. }
  1979. }
  1980. var num = 0;
  1981. self.iframeList.forEach(function (item, index) {
  1982. self.reSize(index)
  1983. if (item.show == 1) {
  1984. num = num + 1;
  1985. self.iframeLast = index;
  1986. }
  1987. })
  1988. self.iframeShow = num;
  1989. self.iframeHide = self.iframeList.length - self.iframeShow;
  1990. if (self.iframeList.length == 0) {
  1991. } else {
  1992. if (self.iframeShow == self.iframeList.length) {
  1993. self.iframeList.forEach(function (item) {
  1994. item.boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
  1995. item.iframeStyle = { width: item.boxStyle.width - 10 }
  1996. })
  1997. self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() / (self.iframeShow == 1 ? 1 : 2)) - 1 }
  1998. self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
  1999. } else {
  2000. for (var i = 0; i < self.iframeList.length; i++) {
  2001. if (self.iframeHide != self.iframeList.length) {
  2002. if (self.iframeList[i].show == 1) {
  2003. self.iframeList[i].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2 / (self.iframeList.length - 1 - self.iframeHide)) }
  2004. self.iframeList[i].iframeStyle = { width: self.iframeList[i].boxStyle.width - 10 }
  2005. }
  2006. if (n == 1) {
  2007. if ($(".rightBox").outerWidth() == 15) {
  2008. $(".leftBox").css("width", "calc(100% - 15px)");
  2009. $(".border-left-right").show()
  2010. $(".border-left-right").prev().show()
  2011. } else {
  2012. showRightBox()
  2013. }
  2014. }
  2015. } else {
  2016. self.iframeList[i].show = 2
  2017. self.iframeList[i].boxStyle = { width: 0, float: "left" };
  2018. self.seeGCG()
  2019. $(".leftBox").css("width", 36)
  2020. $(".border-left-right").hide()
  2021. $(".border-left-right").prev().hide()
  2022. $(".rightBox").css("width", "calc(100% - 36px)")
  2023. $("#rightList").show();
  2024. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2025. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2026. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2027. var marginLeft = $("#rightList").css("margin-left")
  2028. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  2029. } else {
  2030. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  2031. }
  2032. }
  2033. }
  2034. if (self.iframeShow == 1) {
  2035. self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) - 1 }
  2036. self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
  2037. } else {
  2038. self.iframeList[self.iframeLast].boxStyle = { width: Math.trunc(($(".leftBox").width() - 36 * (self.iframeHide > 0 ? 1 : 0)) / 2) - 1 }
  2039. self.iframeList[self.iframeLast].iframeStyle = { width: self.iframeList[self.iframeLast].boxStyle.width - 10 }
  2040. }
  2041. }
  2042. }
  2043. }
  2044. self.openItem = function (obj) {
  2045. window.open(obj.url)
  2046. }
  2047. self.closeItem = function (n) {
  2048. self.iframeList.splice(n, 1)
  2049. self.changeSize(1)
  2050. }
  2051. self.reSize = function (n) {
  2052. $timeout(function () {
  2053. var leftbox = document.getElementsByClassName("iframe-item")[n];
  2054. var rightbox;
  2055. var line = document.getElementsByClassName("iframe-border-right")[n];
  2056. document.getElementsByClassName("iframe-border-right")[n].addEventListener("mousedown", function (event) {
  2057. for (var i = n + 1; i < self.iframeList.length; i++) {
  2058. if (self.iframeList[i].show == 1) {
  2059. rightbox = document.getElementsByClassName("iframe-item")[i];
  2060. break
  2061. }
  2062. }
  2063. $(".mousemove").show()
  2064. var leftboxW = leftbox.style.width.slice(0, leftbox.style.width.length - 2);
  2065. var rightboxW = rightbox.style.width.slice(0, rightbox.style.width.length - 2);
  2066. var x = event.pageX - (line.offsetLeft - leftboxW) - 10;
  2067. document.addEventListener("mousemove", boxMove)
  2068. function boxMove(event) {
  2069. if (leftboxW * 1 + (event.pageX - x) * 1 <= 36) {
  2070. //leftbox.children[0].style.display = "none"
  2071. self.hideItem(n)
  2072. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 5) {
  2073. //rightbox.children[0].style.display = "none"
  2074. self.hideItem(i)
  2075. } else {
  2076. leftbox.children[0].style.display = "block"
  2077. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  2078. leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  2079. self.iframeList[n].boxStyle.width = leftboxW * 1 + (event.pageX - x) * 1;
  2080. self.iframeList[n].iframeStyle.width = leftboxW * 1 + (event.pageX - x) * 1 - 10;
  2081. rightbox.children[0].style.display = "block"
  2082. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  2083. rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
  2084. self.iframeList[i].boxStyle.width = rightboxW * 1 - (event.pageX - x) * 1;
  2085. self.iframeList[i].iframeStyle.width = rightboxW * 1 - (event.pageX - x) * 1 - 10;
  2086. }
  2087. }
  2088. document.addEventListener("mouseup", function () {
  2089. $(".mousemove").hide()
  2090. $scope.$apply();
  2091. document.removeEventListener("mousemove", boxMove)
  2092. })
  2093. })
  2094. }, 1)
  2095. }
  2096. self.reSizeLR = function (n) {
  2097. var leftbox = document.getElementsByClassName("page-item")[n - 1];
  2098. var rightbox = document.getElementsByClassName("page-item")[n];
  2099. var line = document.getElementsByClassName("left-right")[n - 1];
  2100. document.getElementsByClassName("left-right")[n - 1].addEventListener("mousedown", function (event) {
  2101. $(".mousemove").show()
  2102. var leftboxW = leftbox.clientWidth;
  2103. var rightboxW = rightbox.clientWidth;
  2104. var x = event.pageX - line.offsetLeft;
  2105. document.addEventListener("mousemove", boxMove)
  2106. function boxMove(event) {
  2107. if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
  2108. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
  2109. } else {
  2110. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  2111. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  2112. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2113. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2114. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2115. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2116. $scope.changeSize()
  2117. }
  2118. }
  2119. document.addEventListener("mouseup", function () {
  2120. $(".mousemove").hide()
  2121. document.removeEventListener("mousemove", boxMove)
  2122. })
  2123. })
  2124. }
  2125. /*右侧formedit折叠*/
  2126. self.formeditList = [];
  2127. self.hideFormedit = function (num, title) {
  2128. $(".formedit" + num).hide();
  2129. $(".formedit" + num).siblings().css("width", $(".formedit" + num).width() - (self.iframeHide == self.iframeList.length ? 18 : 36));
  2130. self.formeditList.push({ index: num, title: title });
  2131. if (self.iframeHide == self.iframeList.length) {
  2132. if (self.formeditList.length == 2) {
  2133. $(".formedit" + num).siblings().each(function () {
  2134. if ($(this).is(":hidden") == false) {
  2135. if ($(this).is(":hidden") == false) {
  2136. $(this).width("calc(100% - 46px)")
  2137. }
  2138. }
  2139. })
  2140. }
  2141. self.seeGLJ()
  2142. } else {
  2143. if ($(".formedit1").find("iframe").attr("src") == "") {
  2144. self.seeGCG()
  2145. } else {
  2146. self.seeGLJ()
  2147. }
  2148. }
  2149. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2150. }
  2151. self.showFormedit = function (num, obj) {
  2152. $(".formedit" + obj.index).show();
  2153. self.formeditList.splice(num, 1);
  2154. if (self.iframeHide == self.iframeList.length) {
  2155. if (self.formeditList.length == 2) {
  2156. $(".formedit" + obj.index).width("calc(100% - 46px)")
  2157. } else if (self.formeditList.length == 1) {
  2158. $(".formedit" + obj.index).width(($(".rightBox").width() - 36) / 2)
  2159. $(".formedit" + obj.index).siblings().width(($(".rightBox").width() - 36) / 2)
  2160. } else {
  2161. $(".formedit" + obj.index).width($(".rightBox").width() / 2)
  2162. $(".formedit" + obj.index).siblings().width($(".rightBox").width() / 2)
  2163. }
  2164. } else {
  2165. if (self.formeditList.length > 0) {
  2166. $(".formedit" + obj.index).width($(".rightBox").width() - 36)
  2167. $(".formedit" + obj.index).siblings().width($(".rightBox").width() - 36)
  2168. } else {
  2169. $(".formedit" + obj.index).width($(".rightBox").width())
  2170. $(".formedit" + obj.index).siblings().width($(".rightBox").width())
  2171. }
  2172. }
  2173. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2174. }
  2175. self.formeditSize = function () {
  2176. if (self.iframeHide == self.iframeList.length) {
  2177. if (self.formeditList.length == 2) {
  2178. $("#rightList").children().each(function () {
  2179. if ($(this).is(":hidden") == false) {
  2180. $(this).css("width", "calc(100% - 36px)")
  2181. }
  2182. })
  2183. } else if (self.formeditList.length == 1) {
  2184. $("#rightList").children().each(function () {
  2185. $(this).width(($(".rightBox").width() - 36) / 2)
  2186. })
  2187. }
  2188. } else {
  2189. if (self.formeditList.length > 0) {
  2190. $("#rightList").children().each(function () {
  2191. $(this).width($(".rightBox").width() - 36)
  2192. })
  2193. }
  2194. }
  2195. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2196. }
  2197. self.getMeetMsg = function () {
  2198. var data = {
  2199. routeid: self.routeid,
  2200. routeinfoid: self.routeinfoid
  2201. }
  2202. $http.post(apiurljs.login + "g2work/meetcoop/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2203. .success(function (obj) {
  2204. var res = strToJson(s4.decryptData_CBC(obj.data));
  2205. self.meetList = res.data;
  2206. self.meetNum = 0;
  2207. self.meetList.forEach(function (item) {
  2208. self.meetNum++
  2209. item.FILES.forEach(function (item1) {
  2210. self.meetNum++
  2211. item1.WATCHLIMIT = sp.format(item1.WATCHLIMIT);
  2212. })
  2213. })
  2214. //self.getNumMeet()
  2215. })
  2216. }
  2217. self.getNumMeet = function () {
  2218. var data = {
  2219. routeinfoid: self.routeinfoid
  2220. }
  2221. $http.post(apiurljs.login + "g2work/meetcoop/queryDataListCount", data, postCfg)
  2222. .success(function (obj) {
  2223. var res = strToJson(s4.decryptData_CBC(obj.data));
  2224. if (res.data != self.meetNum) {
  2225. self.getMeetMsg()
  2226. }
  2227. })
  2228. }
  2229. self.Meeting = function () {
  2230. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  2231. .success(function (obj) {
  2232. var res = strToJson(s4.decryptData_CBC(obj.data));
  2233. self.dpList = res.data;
  2234. self.dpList1 = [];
  2235. self.dpList.forEach(function (item) {
  2236. self.dpList1.push(item)
  2237. item.USER.forEach(function (item1) {
  2238. item1.show = true;
  2239. })
  2240. })
  2241. self.activeDep = 0;
  2242. self.userList = self.dpList1[0].USER;
  2243. self.meetUser = [];
  2244. sp.layer("#meet")
  2245. })
  2246. }
  2247. self.searchName = "";
  2248. self.searchPerson = function () {
  2249. self.dpList1 = [];
  2250. self.dpList.forEach(function (item) {
  2251. if (item.DEP.indexOf(self.searchName) > -1) {
  2252. self.dpList1.push(item)
  2253. }
  2254. })
  2255. self.activeDep = 0;
  2256. self.userList = self.dpList1[0].USER;
  2257. }
  2258. self.addmeet = function () {
  2259. self.dpList.forEach(function (item) {
  2260. item.USER.forEach(function (item1) {
  2261. if (item1.checked == true && item1.show == true) {
  2262. self.meetUser.push(item1);
  2263. item1.checked = false;
  2264. item1.show = false;
  2265. }
  2266. })
  2267. })
  2268. }
  2269. self.delmeet = function () {
  2270. self.meetUser.forEach(function (item) {
  2271. if (item.checked == true) {
  2272. item.checked = false;
  2273. item.show = true;
  2274. }
  2275. })
  2276. self.meetUser = self.meetUser.filter(function (item) {
  2277. return item.show == false;
  2278. })
  2279. }
  2280. self.joinMeet = function () {
  2281. var data = {
  2282. tablename: "SX_HYTZDW",
  2283. colums: "*",
  2284. order: "ID desc",
  2285. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  2286. sqlinwhere: "",
  2287. sqllikewhere: ""
  2288. }
  2289. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2290. .success(function (obj) {
  2291. var res = strToJson(s4.decryptData_CBC(obj.data));
  2292. var data1 = {
  2293. routeid: self.routeid,
  2294. routeinfoid: self.routeinfoid,
  2295. cman: self.userId,
  2296. cname: res.data[0].BT + "—共享沟通",
  2297. userids: self.meetUser.map(function (item) {
  2298. return item.USERID
  2299. }).join(",")
  2300. }
  2301. $http.post(apiurljs.login + "g2work/meetcoop/createMeetcoop", data1, postCfg)
  2302. .success(function (res1) {
  2303. sp.layerhide()
  2304. if (res1.success == true) {
  2305. self.getMeetMsg()
  2306. } else {
  2307. sp.dialog(res1.message)
  2308. }
  2309. })
  2310. })
  2311. }
  2312. self.updateCname = function (item) {
  2313. self.meeting = {
  2314. type: 1,
  2315. updateTitle: "修改会议标题",
  2316. meetid: item.MEETID,
  2317. cname: item.CNAME
  2318. }
  2319. sp.layer("#meetUpdate")
  2320. }
  2321. self.deleteMeet = function (meet) {
  2322. var data = {
  2323. meetid: meet.MEETID
  2324. }
  2325. $http.post(apiurljs.login + "g2work/meetcoop/deleteDataByID", data, postCfg)
  2326. .success(function (res) {
  2327. if (res.success == true) {
  2328. $.each(self.iframeList, function (index, item) {
  2329. $.each(meet.FILES, function (index1, item1) {
  2330. if (item.title == item1.WATCHLIMIT && item.source == item1.FILEURL) {
  2331. self.closeItem(index1)
  2332. }
  2333. })
  2334. })
  2335. self.getMeetMsg()
  2336. } else {
  2337. sp.dialog(res.message)
  2338. }
  2339. })
  2340. }
  2341. self.updateWatchlimit = function (item) {
  2342. self.meeting = {
  2343. type: 2,
  2344. updateTitle: "修改查看时限",
  2345. fileid: item.FILEID,
  2346. watchlimit: item.WATCHLIMIT
  2347. }
  2348. sp.layer("#meetUpdate")
  2349. }
  2350. self.deleteMFile = function (mfile) {
  2351. var data = {
  2352. fileid: mfile.MEETID
  2353. }
  2354. $http.post(apiurljs.login + "g2work/meetcoop/deleteDataFilesByFileID", data, postCfg)
  2355. .success(function (res) {
  2356. if (res.success == true) {
  2357. $.each(self.iframeList, function (index, item) {
  2358. if (item.title == mfile.WATCHLIMIT && item.source == mfile.FILEURL) {
  2359. self.closeItem(index)
  2360. }
  2361. })
  2362. self.getMeetMsg()
  2363. } else {
  2364. sp.dialog(res.message)
  2365. }
  2366. })
  2367. }
  2368. self.meetUpdate = function () {
  2369. if (self.meeting.type == 1) {
  2370. var data = {
  2371. meetid: self.meeting.meetid,
  2372. cname: self.meeting.cname
  2373. }
  2374. $http.post(apiurljs.login + "g2work/meetcoop/updateCnameByID", data, postCfg)
  2375. .success(function (res) {
  2376. sp.layerhide()
  2377. if (res.success == true) {
  2378. self.getMeetMsg()
  2379. } else {
  2380. sp.dialog(res.message)
  2381. }
  2382. })
  2383. } else {
  2384. var data = {
  2385. fileid: self.meeting.fileid,
  2386. watchlimit: self.meeting.watchlimit
  2387. }
  2388. $http.post(apiurljs.login + "g2work/meetcoop/updateWatchlimitByFileID", data, postCfg)
  2389. .success(function (res) {
  2390. sp.layerhide()
  2391. if (res.success == true) {
  2392. self.getMeetMsg()
  2393. } else {
  2394. sp.dialog(res.message)
  2395. }
  2396. })
  2397. }
  2398. }
  2399. ////头部关键字搜索---20230905
  2400. self.headBtnSearchKeyword = "";
  2401. self.headSearchResult = [];
  2402. self.headSearchResult_view = false;
  2403. self.headBtnSearch = function () {
  2404. if (sp.isval(self.headBtnSearchKeyword)) {
  2405. self.headSearchResult = [];
  2406. var data = {
  2407. "url": "/basic/api/StatSelect/selectCodeList",
  2408. "data": { "keyWord": self.headBtnSearchKeyword }
  2409. }
  2410. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2411. .success(function (obj) {
  2412. var res = strToJson(s4.decryptData_CBC(obj.data));
  2413. self.headSearchResult = res.data.build;
  2414. if (sp.isval(self.headSearchResult)) {
  2415. self.headSearchResult_view = true;
  2416. } else {
  2417. self.headSearchResult_view = false;
  2418. }
  2419. })
  2420. } else {
  2421. self.headSearchResult_view = false;
  2422. }
  2423. };
  2424. self.headKeywordPage = function (itemdata) {
  2425. var get_token = localStorage.getItem("main-token");
  2426. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  2427. self.addItem(set_url, set_url, '一张图', false);
  2428. self.headSearchResult_view = false;
  2429. };
  2430. self.onePic = function () {
  2431. self.addItem(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索", false)
  2432. }
  2433. $scope.changeSize = function (n) {
  2434. self.changeSize(2)
  2435. if (n == 1) {
  2436. $scope.$apply();
  2437. }
  2438. }
  2439. $scope.openOptionList1 = function () {
  2440. $timeout(function () {
  2441. self.openOptionList1()
  2442. })
  2443. }
  2444. $scope.closeToggle = function () {
  2445. $timeout(function () {
  2446. self.opinion.nulla = false;
  2447. self.activeOpinion = null;
  2448. })
  2449. }
  2450. $scope.refreshGLJ = function (n) {
  2451. if (n == 1) {
  2452. self.getGLJ(2)
  2453. } else {
  2454. self.getGLFLOW()
  2455. }
  2456. }
  2457. //头部下滚冻结
  2458. $(function () {
  2459. //页面高度撑满
  2460. setTimeout(function () {
  2461. $(".rightBox").css("height", $(window).height() - 115)
  2462. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  2463. if (self.lastrouteinfoid == 0) {
  2464. $(".rightBox").css("width", $(window).width())
  2465. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2466. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2467. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2468. } else {
  2469. $(".rightBox").css("width", "50%")
  2470. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2471. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2472. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2473. }
  2474. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2475. }, 1)
  2476. $(window).resize(function () {
  2477. $(".rightBox").css("height", $(window).height() - 115)
  2478. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  2479. if (self.iframeList.length == 0) {
  2480. $(".rightBox").css("width", $(window).width())
  2481. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2482. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2483. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2484. self.formeditSize()
  2485. } else if (self.iframeList.length > 0 && self.iframeHide == self.iframeList.length) {
  2486. $(".rightBox").css("width", "calc(100% - 36px)")
  2487. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2488. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2489. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2490. self.formeditSize()
  2491. } else {
  2492. $(".rightBox").css("width", "50%")
  2493. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2494. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2495. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2496. self.formeditSize()
  2497. }
  2498. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2499. if (self.iframeList.length > 0) {
  2500. $("#iframeList").css("height", $(window).height() - 115)
  2501. if (self.iframeList.length == 1) {
  2502. self.iframeList[0].boxStyle = { width: $(".leftBox").width() }
  2503. self.iframeList[0].iframeStyle = { width: $(".leftBox").width() - 10 }
  2504. } else {
  2505. self.iframeList.forEach(function (item) {
  2506. item.boxStyle = { width: Math.trunc($(".leftBox").width() / 2 / (self.iframeList.length - 1)) }
  2507. item.iframeStyle = { width: item.boxStyle.width - 10 }
  2508. })
  2509. self.iframeList[self.iframeList.length - 1].boxStyle = { width: Math.trunc($(".leftBox").width() / 2) - 1 }
  2510. self.iframeList[self.iframeList.length - 1].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
  2511. }
  2512. $scope.$apply();
  2513. }
  2514. })
  2515. })
  2516. }])
  2517. app.directive("repeatFinish", function () {
  2518. return {
  2519. link: function (scope) {
  2520. if (scope.$last == true) {
  2521. $("#iframeList").css("height", $(window).height() - 115)
  2522. }
  2523. }
  2524. };
  2525. });
  2526. app.directive("spCheckboxBlueItem", function () {
  2527. return {
  2528. restrict: "A",
  2529. link: function (scope, elem, attrs) {
  2530. if (!scope == false) {
  2531. spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
  2532. }
  2533. }
  2534. }
  2535. });
  2536. app.filter('trustHtml', function ($sce) {
  2537. return function (input) {
  2538. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  2539. };
  2540. });
  2541. //canvas画布签字
  2542. function lineCanvas(obj) {
  2543. var self = this;
  2544. self.linewidth = 1;
  2545. self.color = "#000000";
  2546. self.background = "#ffffff";
  2547. self.canvas = document.createElement("canvas");
  2548. document.getElementById(obj).appendChild(self.canvas);
  2549. self.cxt = self.canvas.getContext("2d");
  2550. self.canvas.width = document.getElementById(obj).clientWidth;
  2551. self.canvas.height = document.getElementById(obj).scrollHeight;
  2552. self.cxt.fillStyle = self.background;
  2553. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  2554. self.cxt.strokeStyle = self.color;
  2555. self.cxt.lineWidth = self.linewidth;
  2556. self.cxt.lineCap = "round";
  2557. //开始绘制
  2558. self.canvas.addEventListener("mousedown", function (e) {
  2559. self.cxt.beginPath();
  2560. self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
  2561. self.canvas.addEventListener("mousemove", move)
  2562. }.bind(self), false);
  2563. //绘制中
  2564. function move() {
  2565. var e = window.event;
  2566. self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
  2567. self.cxt.stroke();
  2568. }
  2569. //结束绘制
  2570. self.canvas.addEventListener("mouseup", up)
  2571. function up() {
  2572. self.cxt.closePath();
  2573. self.canvas.removeEventListener("mousemove", move)
  2574. }
  2575. };
  2576. function showRightBox() {
  2577. $(".leftBox").css("width", "50%");
  2578. $(".rightBox").css("width", "50%")
  2579. $(".rightBox").show();
  2580. $("#rightList").show();
  2581. $(".border-left-right").show()
  2582. $(".border-left-right").prev().show()
  2583. $(".border-left-right").prev().find(".fa-angle-right").show()
  2584. $(".border-left-right").prev().find(".fa-angle-left").hide()
  2585. if ($("#rightList").prev().is(":hidden") == true) {
  2586. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2587. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2588. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2589. } else {
  2590. $(".formedit").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
  2591. $(".formedit1").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
  2592. $(".formedit2").css("width", $(".rightBox").width() - 36).css("height", $(".rightBox").height())
  2593. }
  2594. angular.element(document.getElementById("app")).scope().changeSize(2)
  2595. }
  2596. function showRight(e) {
  2597. if ($(e).children(".fa-angle-left").is(":hidden")) {
  2598. $(".leftBox").css("width", "calc(100% - 15px)");
  2599. $(".rightBox").css("width", "15px");
  2600. $(e).siblings().hide()
  2601. $(e).children(".fa-angle-left").show()
  2602. $(e).children(".fa-angle-right").hide()
  2603. } else {
  2604. $(".leftBox").css("width", "50%");
  2605. $(".rightBox").css("width", "50%");
  2606. $(e).siblings().show()
  2607. $(e).children(".fa-angle-left").hide()
  2608. $(e).children(".fa-angle-right").show()
  2609. }
  2610. angular.element(document.getElementById("app")).scope().changeSize(1)
  2611. }
  2612. function showToggle(e) {
  2613. document.getElementById("selectDiv").style.top = e.style.top;
  2614. //document.getElementById("selectDiv").toggle();
  2615. $(e).children().toggle()
  2616. $(e).next().toggle()
  2617. }
  2618. function toggleYJL(e) {
  2619. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  2620. $(e).parent().css("height", 420)
  2621. angular.element(document.getElementById("app")).scope().openOptionList1()
  2622. } else {
  2623. $(e).parent().css("height", 10)
  2624. angular.element(document.getElementById("app")).scope().closeToggle()
  2625. }
  2626. $(e).children().toggle()
  2627. }
  2628. function toggleForm(e) {
  2629. $(e).children().toggle()
  2630. $(".toggleForm").toggle()
  2631. }
  2632. function refreshGLJ(n) {
  2633. angular.element(document.getElementById("app")).scope().refreshGLJ(n)
  2634. }
  2635. //文字不可被选中
  2636. document.body.onselectstart = function () {
  2637. return false;
  2638. }