formeditFL.js 103 KB

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