formeditFL.js 107 KB

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