formeditZW_vue.js 143 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843
  1. 'use strict';
  2. // let s4 = new SM4Util();
  3. const vm = new Vue({
  4. el:"#appvue",
  5. data:{
  6. userId :"",
  7. userName :"",
  8. get_AccessToken :"",
  9. routeid:"",
  10. routeinfoid :"",
  11. copyrightid :"",
  12. directionid :"",
  13. formeditid :"",
  14. mbid :"",
  15. fjid :"",
  16. docmode :"",
  17. dotype :"",
  18. get_lastReturnPageno :"",
  19. get_lastReturnPage :"",
  20. get_type :"",
  21. return:"",
  22. deviceType :"",
  23. FormTitle:"",
  24. //右上角按钮
  25. buttonList:[],
  26. s4 : new SM4Util(),
  27. //上层附件、业务参考、共享沟通组件
  28. arrayFile : null,
  29. arrayFile1 : [],
  30. uploading_zw : false,
  31. uploading : false,
  32. readonly:{
  33. CPSX: true,
  34. JJCD: false,
  35. MIJI: false,
  36. SWLB: false,
  37. SWBH: false,
  38. LWDW: false,
  39. LWRQ: false,
  40. LWWH: false,
  41. SFDB: false,
  42. BT: false,
  43. DBSX: false,
  44. CDCS: false,
  45. ZBCS: false,
  46. SFBJ: false,
  47. BJQK: false,
  48. BZ: false,
  49. NGR: false,
  50. ZBRQ: false,
  51. USAGE: false
  52. },
  53. show:{
  54. CPSX: false,
  55. JJCD: false,
  56. MIJI: false,
  57. SWLB: false,
  58. SWBH: false,
  59. LWDW: false,
  60. LWRQ: false,
  61. LWWH: false,
  62. SFDB: false,
  63. BT: false,
  64. DBSX: false,
  65. CDCS: false,
  66. ZBCS: false,
  67. SFBJ: false,
  68. BJQK: false,
  69. BZ: false,
  70. NGR: false,
  71. ZBRQ: false,
  72. USAGE: false
  73. },
  74. Loaling:false,
  75. pdfContent:[],
  76. itemNode:{
  77. level: "",
  78. id: "",
  79. name: "",
  80. code: "",
  81. child_title: ""
  82. },
  83. rightFlag :0,
  84. printFiled:1,
  85. opinion:{
  86. BGSNBYJ: false,
  87. BGSNBYJImg: false,
  88. WLDPS: false,
  89. WLDPSImg: false,
  90. FGLDBJQR: false,
  91. FGLDBJQRImg: false,
  92. CBCSCLQK: false,
  93. CBCSCLQKImg: false,
  94. nulla: false
  95. },
  96. YJ:{
  97. BGSNBYJ: [],
  98. BGSNBYJSTATUS: false,
  99. WLDPS: [],
  100. WLDPSSTATUS: false,
  101. FGLDBJQR: [],
  102. FGLDBJQRSTATUS: false,
  103. CBCSCLQK: [],
  104. CBCSCLQKSTATUS: false,
  105. nulla: [],
  106. nullaSTATUS: false
  107. },
  108. uploading1:false,
  109. uploading2:false,
  110. phraseText:"",//添加常用语
  111. phraseList:[],//常用语列表
  112. repeat:false,
  113. headBtnSearchKeyword :"",
  114. headSearchResult:[],
  115. headSearchResult_view:false,
  116. data:{},
  117. flowTitle:""
  118. },
  119. created() {
  120. this.userId = $.cookie("GlWorkPlatform-userid");
  121. this.userName = $.cookie("GlWorkPlatform-chineseName");
  122. this.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  123. this.routeid = sp.getUrlName("routeid");
  124. this.routeinfoid = sp.getUrlName("routeinfoid");
  125. this.copyrightid = sp.getUrlName("copyrightid");
  126. this.directionid = sp.getUrlName("directionid");
  127. this.formeditid = sp.getUrlName("formeditid");
  128. this.mbid = sp.getUrlName("mbid");
  129. this.fjid = sp.getUrlName("fjid");
  130. this.docmode = sp.getUrlName("docmode");
  131. this.dotype = sp.getUrlName("dotype");
  132. this.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  133. this.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  134. this.get_type = sp.getUrlName("type");
  135. this.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  136. this.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  137. this.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  138. },
  139. mounted() {
  140. this.getSwenList(0)
  141. },
  142. methods:{
  143. //上传正文
  144. upload_zw(){
  145. let uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  146. return item.CNAME
  147. })
  148. $('#fileupload-zw').fileupload({
  149. url: apiurljs.login + (this.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : 'g2app/abase/uploadFileWithFormAndGetPage'),//'g2app/abase/uploadFileWithForm'),
  150. dataType: 'json',
  151. beforeSend: function (xhr, data) {
  152. xhr.setRequestHeader("Authorization", "Bearer " + this.get_AccessToken);
  153. if (self.routeinfoid == 0) {
  154. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("copyrightid=" + self.copyrightid + ",directionid=" + self.directionid + ",formeditid=" + self.formeditid + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tablename=FILE_ATTACH,ATTACHTYPE=行政公文-正文"));
  155. } else {
  156. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=行政公文-正文"));
  157. }
  158. },
  159. add: function (e, data) {
  160. var num = 0;
  161. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  162. //文件类型判断
  163. $.each(data.originalFiles, function (index, item) {
  164. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  165. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  166. return;
  167. } else {
  168. num++
  169. }
  170. })
  171. if (num == data.originalFiles.length) {
  172. self.uploading_zw = true;
  173. data.submit();
  174. $scope.$apply();
  175. }
  176. },
  177. // 上传完成后的执行逻辑
  178. done: function (e, data) {
  179. self.uploading_zw = false;
  180. if (self.routeinfoid == 0) {
  181. var res = strToJson(s4.decryptData_CBC(data.result.data));
  182. self.data.ID = res.data2.ID;
  183. self.routeid = res.data2.ROUTEID;
  184. self.routeinfoid = res.data2.ROUTEINFOID;
  185. self.getSwenList(0)
  186. } else {
  187. self.getOther1()
  188. }
  189. }
  190. })
  191. },
  192. upload(){
  193. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  194. return item.CNAME
  195. })
  196. $('#fileupload').fileupload({
  197. url: apiurljs.login + 'g2app/abase/uploadFileWithFormAndGetPage',//'g2app/abase/uploadFileWithForm',
  198. dataType: 'json',
  199. beforeSend: function (xhr, data) {
  200. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  201. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=行政公文"));
  202. },
  203. add: function (e, data) {
  204. var num = 0;
  205. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  206. //文件类型判断
  207. $.each(data.originalFiles, function (index, item) {
  208. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  209. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  210. return;
  211. } else {
  212. num++
  213. }
  214. })
  215. if (num == data.originalFiles.length) {
  216. self.uploading = true;
  217. data.submit();
  218. $scope.$apply();
  219. }
  220. },
  221. // 上传完成后的执行逻辑
  222. done: function (e, data) {
  223. self.uploading = false;
  224. self.getOther()
  225. }
  226. })
  227. },
  228. downLoad(item){
  229. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  230. },
  231. deleteFile(file){
  232. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  233. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  234. 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>";
  235. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  236. sp.openCenter(".sp-dialog");
  237. ///取消按钮
  238. $('.sp-closeDialog').click(function (event) {
  239. sp.closeCenter(".sp-dialog");
  240. event.preventDefault();
  241. event.stopPropagation();
  242. });
  243. //post消息的id
  244. $("#delDataTrue").click(function () {
  245. var data = {
  246. tablename: "FILE_ATTACH",
  247. id: file.ID
  248. };
  249. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  250. .success(function (obj) {
  251. var res = strToJson(s4.decryptData_CBC(obj.data));
  252. sp.dialoghide();
  253. if (res.success) {
  254. self.getOther();
  255. } else {
  256. sp.dialog("删除失败,请联系管理员!");
  257. }
  258. });
  259. });
  260. },
  261. seeFile(obj){
  262. self.seeFileItem = obj;
  263. var set_convertType = 0;
  264. if (obj.FILEEXT == "doc") {
  265. set_convertType = 0;
  266. } else if (obj.FILEEXT == "pdf") {
  267. set_convertType = 20;
  268. } else if (obj.FILEEXT == "ofd") {
  269. set_convertType = 570;
  270. } else {
  271. set_convertType = 0;
  272. }
  273. let postData = {
  274. convertType: set_convertType,
  275. isSignature: 1,
  276. signCallback: "g2app/fawenfiles/uploadFileFCS/" + obj.FILEURL.slice(7),
  277. fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
  278. };
  279. var postCfg_transfer = {
  280. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  281. transformRequest: function (data) {
  282. return $.param(data);
  283. }
  284. };
  285. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  286. .success(function (res) {
  287. if (res.errorcode === 0) {
  288. //$("#iframe_book").css("height", $(".ibox-content").height() - 123)
  289. $("#iframe_book").attr("src", res.data.viewUrl)
  290. } else {
  291. sp.dialog(res.message);
  292. }
  293. });
  294. },
  295. goAttach(){
  296. if (obj) {
  297. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  298. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  299. return
  300. }
  301. $("#attachlist")[0].contentWindow.openFile(obj)
  302. if ($(".fa-chevron-down").is(":hidden") == true) {
  303. showToggle(document.getElementById("toggleButton"))
  304. }
  305. } else {
  306. $("#attachlist").attr("src", "attachlist.html?routeinfoid=" + self.routeinfoid)
  307. }
  308. },
  309. getSwenList(n){
  310. this.SwenList = [];
  311. let data = {
  312. directionid: this.directionid,
  313. userid: this.userId,
  314. routeinfoid: this.routeinfoid,
  315. routeid: this.routeid,
  316. formeditid: ""
  317. }
  318. g2app_abase_queryDataLink(data).then(res=>{
  319. if (this.copyrightid == "") {
  320. this.copyrightid = res.data.LINKS[0].COPYRIGHTID
  321. }
  322. for(let i=0;i<res.data.LINKS.length;i++){
  323. let index = i
  324. let item = res.data.LINKS[i]
  325. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  326. if (item.TEMPFORM.indexOf("formeditZW.html") > -1) {
  327. this.Title = item.VNAME;
  328. }
  329. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  330. item.TEMPFORM = item.TEMPFORM + "&dotype=" + this.dotype + "&type=" + this.get_type + "&lastReturnPageno=" + this.get_lastReturnPageno + "&lastReturnPage=" + this.get_lastReturnPage;
  331. } else {
  332. item.TEMPFORM = "#";
  333. }
  334. this.SwenList.push(item)
  335. }
  336. this.SwenList.push({
  337. VNAME: "流程图",
  338. DIRECTIONID: this.SwenList[0].DIRECTIONID,
  339. TEMPFORM: "modeler_read.html?" + this.SwenList[0].TEMPFORM.split("?")[1]
  340. })
  341. if (n == 0) {
  342. this.getFLOW()
  343. }
  344. // else {
  345. // this.getData()
  346. // }
  347. })
  348. },
  349. getFLOW(){
  350. g2work_flow_queryDataByCopyrightid({copyrightid: this.copyrightid}).then(res=>{
  351. this.flowTitle = res.data.CNAME;
  352. this.getJJQK()
  353. })
  354. },
  355. getJJQK(){
  356. g2app_abase_queryDataCode( {
  357. ckey: "CODE_EMERGENCY",
  358. routeinfoid: this.routeinfoid
  359. }).then(res=>{
  360. this.JJCD = res.data.CODE_EMERGENCY;
  361. this.getCDDB()
  362. })
  363. },
  364. getCDDB(){
  365. g2app_abase_queryDataCode({
  366. ckey: "CODE_DUBAN",
  367. routeinfoid: this.routeinfoid
  368. }).then(res=>{
  369. this.DBTYPE = res.data.CODE_DUBAN;
  370. this.getMIJI()
  371. })
  372. },
  373. getMIJI(){
  374. g2app_abase_queryDataCode({
  375. ckey: "CODE_SECRET",
  376. routeinfoid: this.routeinfoid
  377. }).then(res=>{
  378. this.MIJI = res.data.CODE_SECRET;
  379. this.getSFDB()
  380. })
  381. },
  382. getSFDB(){
  383. g2app_abase_queryDataCode({
  384. ckey: "CODE_SFDB",
  385. routeinfoid: this.routeinfoid
  386. }).then(res=>{
  387. this.SFDB = res.data.CODE_SFDB;
  388. this.getSFBJ()
  389. })
  390. },
  391. getSFBJ(){
  392. g2app_abase_queryDataCode({
  393. ckey: "CODE_SF",
  394. routeinfoid: this.routeinfoid
  395. }).then(res=>{
  396. this.SFBJ = res.data.CODE_SF;
  397. this.getSWLB()
  398. })
  399. },
  400. getSWLB(){
  401. g2app_abase_queryDataCode({
  402. ckey: "CODE_SWLB",
  403. routeinfoid: this.routeinfoid
  404. }).then(res=>{
  405. this.SWLB = res.data.CODE_SWLB;
  406. this.getDpList()
  407. })
  408. },
  409. getDpList(){
  410. g2app_dataabase_querySectByCode({ unitid: "AA"}).then(res=>{
  411. this.dpList = [];
  412. res.data.forEach((item) => {
  413. if (item.CHILD_DATA.length == 0) {
  414. this.dpList.push(item)
  415. } else {
  416. item.CHILD_DATA.forEach( (item1)=> {
  417. if (item1.CHILD_DATA.length == 0) {
  418. this.dpList.push(item1)
  419. } else {
  420. item1.CHILD_DATA.forEach( (item2)=> {
  421. if (item2.CHILD_DATA.length == 0) {
  422. this.dpList.push(item2)
  423. }
  424. })
  425. }
  426. })
  427. }
  428. })
  429. this.dpList.forEach( (item)=> {
  430. item.checked = false;
  431. })
  432. this.DpList = {
  433. ZBCS: JSON.parse(JSON.stringify(this.dpList)),
  434. CDCS: JSON.parse(JSON.stringify(this.dpList))
  435. }
  436. this.AllCheckedDp = {};
  437. this.DpLength = {};
  438. this.selectDpList = {};
  439. this.getUSAGE(0)
  440. })
  441. },
  442. //标签
  443. getUSAGE(n){
  444. g2app_abase_queryDataCode({
  445. ckey: "CODE_SHOUWENLABEL",
  446. routeinfoid: this.routeinfoid
  447. }).then(res=>{
  448. this.USAGE = res.data.CODE_SHOUWENLABEL;
  449. this.USAGE.forEach(item=>{
  450. item.checked = false;
  451. })
  452. if (n == 0) {
  453. this.getSWBH()
  454. }
  455. if (n == 1) {
  456. this.USAGE.forEach(item=>{
  457. if (this.data.USAGE.indexOf(item.CODE) != -1) {
  458. item.checked = true;
  459. }
  460. })
  461. $timeout(function () {
  462. $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  463. if (this.data.USAGE.indexOf($(this).val()) != -1) {
  464. $(this).attr("checked", true);
  465. $(this).parent("label").addClass("chb-blue-checked");
  466. }
  467. })
  468. }, 1)
  469. }
  470. })
  471. },
  472. //管理标签
  473. ManageUSAGE(n) {
  474. self.addUSAGENAME = "";
  475. var data = {
  476. tablename: "CODE_SHOUWENLABEL"
  477. }
  478. $http.post(apiurljs.login + "g2app/shouwen/queryLabelCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  479. .success(function (obj) {
  480. var res = strToJson(s4.decryptData_CBC(obj.data));
  481. self.USAGELIST = res.data;
  482. $.each(self.USAGELIST, function (index, item) {
  483. item.change = false;
  484. item.CNAME1 = item.CNAME;
  485. item.USAGE = item.USAGE == 0 ? "隐藏" : "显示";
  486. })
  487. if (n == 0) {
  488. $timeout(function () {
  489. sp.layer("#USAGE");
  490. }, 1)
  491. }
  492. })
  493. },
  494. //新增标签
  495. addUSAGE() {
  496. if (self.addUSAGENAME == "") {
  497. sp.dialog("标签名称不可为空!");
  498. return;
  499. }
  500. var data = {
  501. tablename: "CODE_SHOUWENLABEL",
  502. data: {
  503. CODE: "C0" + (self.USAGELIST.length + 1),
  504. CNAME: self.addUSAGENAME,
  505. USERID: self.userId,
  506. TABLENAME: "SW_ZJWWJCBD",
  507. USAGE: "1"
  508. }
  509. }
  510. $http.post(apiurljs.login + "g2app/shouwen/insertCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  511. .success(function (obj) {
  512. var res = strToJson(s4.decryptData_CBC(obj.data));
  513. if (res.success) {
  514. self.ManageUSAGE(1);
  515. self.getUSAGE(1);
  516. } else {
  517. sp.dialog(res.message);
  518. }
  519. })
  520. },
  521. //标签排序上下移
  522. btnSort($index, tip) {
  523. var set_id = "";
  524. var set_sortid = "";
  525. if (tip == "上移") {
  526. var set_index = parseInt($index - 1);
  527. set_id = self.USAGELIST[set_index].ID;
  528. set_sortid = self.USAGELIST[set_index].SORTID;
  529. } else {
  530. var set_index = parseInt($index + 1);
  531. set_id = self.USAGELIST[set_index].ID;
  532. set_sortid = self.USAGELIST[set_index].SORTID;
  533. }
  534. var data = {
  535. tablename: "CODE_SHOUWENLABEL",
  536. id: self.USAGELIST[$index].ID,
  537. sortid: self.USAGELIST[$index].SORTID,
  538. id_other: set_id,
  539. sortid_other: set_sortid
  540. };
  541. $http.post(apiurljs.login + "g2app/shouwen/MoveCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  542. .success(function (obj) {
  543. var res = strToJson(s4.decryptData_CBC(obj.data));
  544. if (res.success) {
  545. self.ManageUSAGE(1);
  546. } else {
  547. sp.dialog(res.message);
  548. }
  549. });
  550. },
  551. updataUSAGE(item, str){
  552. if (str == "CNAME") {
  553. var data = {
  554. tablename: "SW_ZJWWJCBD",
  555. code: item.CODE,
  556. }
  557. $http.post(apiurljs.login + "g2app/shouwen/querynumCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  558. .success(function (obj) {
  559. var res = strToJson(s4.decryptData_CBC(obj.data));
  560. if (res.success) {
  561. var data = {
  562. tablename: "CODE_SHOUWENLABEL",
  563. id: item.ID,
  564. data: {
  565. "cname": item.CNAME1
  566. }
  567. }
  568. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  569. .success(function (obj) {
  570. var res = strToJson(s4.decryptData_CBC(obj.data));
  571. if (res.success) {
  572. item.change = false;
  573. self.ManageUSAGE(1);
  574. self.getUSAGE(1);
  575. } else {
  576. sp.dialog(res.message);
  577. }
  578. });
  579. } else {
  580. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  581. var dialogBody = "<div class=\"sp-dialog-body\">该标签已被使用,您确认要修改吗?</div>";
  582. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='upDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  583. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  584. sp.openCenter(".sp-dialog");
  585. $('.sp-closeDialog').click(function (event) {
  586. sp.dialoghide();
  587. $timeout(function () {
  588. item.CNAME1 = item.CNAME;
  589. }, 1)
  590. //sp.closeCenter(".sp-dialog");
  591. event.preventDefault(); event.stopPropagation();
  592. });
  593. $("#upDataTrue").click(function () {
  594. var data = {
  595. tablename: "CODE_SHOUWENLABEL",
  596. id: item.ID,
  597. data: {
  598. "cname": item.CNAME1
  599. }
  600. }
  601. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  602. .success(function (obj) {
  603. var res = strToJson(s4.decryptData_CBC(obj.data));
  604. if (res.success) {
  605. sp.dialoghide();
  606. item.change = false;
  607. self.ManageUSAGE(1);
  608. self.getUSAGE(1);
  609. } else {
  610. sp.dialog(res.message);
  611. }
  612. });
  613. });
  614. }
  615. })
  616. } else if (str == "显示") {
  617. var data = {
  618. tablename: "CODE_SHOUWENLABEL",
  619. id: item.ID,
  620. data: {
  621. "USAGE": "1"
  622. }
  623. }
  624. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  625. .success(function (obj) {
  626. var res = strToJson(s4.decryptData_CBC(obj.data));
  627. if (res.success) {
  628. item.change = false;
  629. self.ManageUSAGE(1);
  630. self.getUSAGE(1);
  631. } else {
  632. sp.dialog(res.message);
  633. }
  634. });
  635. } else {
  636. var data = {
  637. tablename: "CODE_SHOUWENLABEL",
  638. id: item.ID,
  639. data: {
  640. "USAGE": "0"
  641. }
  642. }
  643. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  644. .success(function (obj) {
  645. var res = strToJson(s4.decryptData_CBC(obj.data));
  646. if (res.success) {
  647. item.change = false;
  648. self.ManageUSAGE(1);
  649. self.getUSAGE(1);
  650. } else {
  651. sp.dialog(res.message);
  652. }
  653. });
  654. }
  655. },
  656. deleteUSAGE(item){
  657. var data = {
  658. tablename: "CODE_SHOUWENLABEL",
  659. tablename_form: "SW_ZJWWJCBD",
  660. id: item.ID,
  661. code: item.CODE
  662. }
  663. $http.post(apiurljs.login + "g2app/shouwen/delCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  664. .success(function (obj) {
  665. var res = strToJson(s4.decryptData_CBC(obj.data));
  666. if (res.success) {
  667. self.ManageUSAGE(1);
  668. self.getUSAGE(1);
  669. } else {
  670. sp.dialog("此标签已被使用");
  671. }
  672. });
  673. },
  674. getSWBH(){
  675. g2app_shouwen_querySWCodeByFlowid({flowid: sp.getUrlName("flowid")}).then(res=>{
  676. this.SWBH = res.data;
  677. this.getData()
  678. })
  679. },
  680. getData(){
  681. g2app_abase_queryData({
  682. ckey: "SW_ZJWWJCBD",
  683. id: 0,
  684. directionid: this.directionid,
  685. formeditid: this.formeditid,
  686. routeid: this.routeid,
  687. routeinfoid: this.routeinfoid
  688. }).then(res=>{
  689. this.data = {
  690. CPSX: res.data.SW_ZJWWJCBD.CPSX == "" ? "" : sp.format(res.data.SW_ZJWWJCBD.CPSX),
  691. ID: res.data.SW_ZJWWJCBD.ID,
  692. APPCODE: res.data.SW_ZJWWJCBD.APPCODE,
  693. JJCD: res.data.SW_ZJWWJCBD.JJCD == "" ? this.JJCD[0].CODE : res.data.SW_ZJWWJCBD.JJCD,
  694. MIJI: res.data.SW_ZJWWJCBD.MIJI == "" ? this.MIJI[0].CODE : res.data.SW_ZJWWJCBD.MIJI,
  695. SWLB: res.data.SW_ZJWWJCBD.SWLB == "" ? this.SWLB[0].CODE : res.data.SW_ZJWWJCBD.SWLB,
  696. SWBH: res.data.SW_ZJWWJCBD.SWBH == "" ? this.SWBH.replace("|", "〔 ").replace("|", " 〕") + "号" : res.data.SW_ZJWWJCBD.SWBH,
  697. SWBH1: res.data.SW_ZJWWJCBD.SWBH,
  698. LWDW: res.data.SW_ZJWWJCBD.LWDW,
  699. LWRQ: res.data.SW_ZJWWJCBD.LWRQ == "" || res.data.SW_ZJWWJCBD.LWRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_ZJWWJCBD.LWRQ),
  700. LWWH: res.data.SW_ZJWWJCBD.LWWH == "" ? "〔 " + sp.currentYear() + " 〕号" : res.data.SW_ZJWWJCBD.LWWH,
  701. SFDB: res.data.SW_ZJWWJCBD.SFDB == "" ? "C03" : res.data.SW_ZJWWJCBD.SFDB,
  702. DBLX: res.data.SW_ZJWWJCBD.DBLX == "" ? res.data.SW_ZJWWJCBD.SFDB == "" || res.data.SW_ZJWWJCBD.SFDB == self.SFDB[1].CODE ? "" : self.DBTYPE[0].CODE : res.data.SW_ZJWWJCBD.DBLX,
  703. BT: res.data.SW_ZJWWJCBD.BT,
  704. DBSX: res.data.SW_ZJWWJCBD.DBSX == "" ? "" : sp.format(res.data.SW_ZJWWJCBD.DBSX),
  705. CDCS: res.data.SW_ZJWWJCBD.CDCS,
  706. ZBCS: res.data.SW_ZJWWJCBD.ZBCS,
  707. SFBJ: res.data.SW_ZJWWJCBD.SFBJ == "" ? this.SFBJ[0].CODE : res.data.SW_ZJWWJCBD.SFDB,
  708. BJQK:res.data.SW_ZJWWJCBD.BJQK,
  709. BZ: res.data.SW_ZJWWJCBD.BZ,
  710. NGR: res.data.SW_ZJWWJCBD.NGR == "" ? this.userName : res.data.SW_ZJWWJCBD.NGR,
  711. ZBRQ: res.data.SW_ZJWWJCBD.ZBRQ == "" || res.data.SW_ZJWWJCBD.ZBRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_ZJWWJCBD.ZBRQ),
  712. USAGE: res.data.SW_ZJWWJCBD.USAGE,
  713. ZBCSCODE: res.data.SW_ZJWWJCBD.ZBCSCODE,
  714. FGLDBJQR: res.data.SW_ZJWWJCBD.FGLDBJQR,
  715. SWQXLX: res.data.SW_ZJWWJCBD.SWQXLX == "" ? res.data.SW_ZJWWJCBD.SFDB != "C01" ? "办理" : "督办" : res.data.SW_ZJWWJCBD.SWQXLX
  716. }
  717. this.readonly = {
  718. CPSX: true,
  719. JJCD: res.data.SW_ZJWWJCBD["JJCD.EREADONLY"] == "true",
  720. MIJI: res.data.SW_ZJWWJCBD["MIJI.EREADONLY"] == "true",
  721. SWLB: res.data.SW_ZJWWJCBD["SWLB.EREADONLY"] == "true",
  722. SWBH: res.data.SW_ZJWWJCBD["SWBH.EREADONLY"] == "true",
  723. LWDW: res.data.SW_ZJWWJCBD["LWDW.EREADONLY"] == "true",
  724. LWRQ: res.data.SW_ZJWWJCBD["LWRQ.EREADONLY"] == "true",
  725. LWWH: res.data.SW_ZJWWJCBD["LWWH.EREADONLY"] == "true",
  726. SFDB: res.data.SW_ZJWWJCBD["SFDB.EREADONLY"] == "true",
  727. BT: res.data.SW_ZJWWJCBD["BT.EREADONLY"] == "true",
  728. BGSNBYJ: res.data.SW_ZJWWJCBD["BGSNBYJ.EREADONLY"] == "true",
  729. WLDPS: res.data.SW_ZJWWJCBD["WLDPS.EREADONLY"] == "true",
  730. CBCSCLQK: res.data.SW_ZJWWJCBD["CBCSCLQK.EREADONLY"] == "true",
  731. DBLX: res.data.SW_ZJWWJCBD["DBLX.EREADONLY"] == "true",
  732. CDCS: res.data.SW_ZJWWJCBD["CDCS.EREADONLY"] == "true",
  733. DBSX: res.data.SW_ZJWWJCBD["DBSX.EREADONLY"] == "true",
  734. ZBCS: res.data.SW_ZJWWJCBD["ZBCS.EREADONLY"] == "true",
  735. SFBJ: res.data.SW_ZJWWJCBD["SFBJ.EREADONLY"] == "true",
  736. BJQK: res.data.SW_ZJWWJCBD["BJQK.EREADONLY"] == "true",
  737. FGLDBJQR: res.data.SW_ZJWWJCBD["FGLDBJQR.EREADONLY"] == "true",
  738. BZ: res.data.SW_ZJWWJCBD["BZ.EREADONLY"] == "true",
  739. NGR: res.data.SW_ZJWWJCBD["NGR.EREADONLY"] == "true",
  740. ZBRQ: res.data.SW_ZJWWJCBD["ZBRQ.EREADONLY"] == "true",
  741. USAGE: res.data.SW_ZJWWJCBD["USAGE.EREADONLY"] == "true"
  742. }
  743. this.show = {
  744. CPSX: res.data.SW_ZJWWJCBD["CPSX.ESHOW"] == "true",
  745. JJCD: res.data.SW_ZJWWJCBD["JJCD.ESHOW"] == "true",
  746. MIJI: res.data.SW_ZJWWJCBD["MIJI.ESHOW"] == "true",
  747. SWLB: res.data.SW_ZJWWJCBD["SWLB.ESHOW"] == "true",
  748. SWBH: res.data.SW_ZJWWJCBD["SWBH.ESHOW"] == "true",
  749. LWDW: res.data.SW_ZJWWJCBD["LWDW.ESHOW"] == "true",
  750. LWRQ: res.data.SW_ZJWWJCBD["LWRQ.ESHOW"] == "true",
  751. LWWH: res.data.SW_ZJWWJCBD["LWWH.ESHOW"] == "true",
  752. SFDB: res.data.SW_ZJWWJCBD["SFDB.ESHOW"] == "true",
  753. BT: res.data.SW_ZJWWJCBD["BT.ESHOW"] == "true",
  754. BGSNBYJ: res.data.SW_ZJWWJCBD["BGSNBYJ.ESHOW"] == "true",
  755. WLDPS: res.data.SW_ZJWWJCBD["WLDPS.ESHOW"] == "true",
  756. CBCSCLQK: res.data.SW_ZJWWJCBD["CBCSCLQK.ESHOW"] == "true",
  757. DBLX: res.data.SW_ZJWWJCBD["DBLX.ESHOW"] == "true",
  758. CDCS: res.data.SW_ZJWWJCBD["CDCS.ESHOW"] == "true",
  759. DBSX: res.data.SW_ZJWWJCBD["DBSX.ESHOW"] == "true",
  760. ZBCS: res.data.SW_ZJWWJCBD["ZBCS.ESHOW"] == "true",
  761. SFBJ: res.data.SW_ZJWWJCBD["SFBJ.ESHOW"] == "true",
  762. BJQK: res.data.SW_ZJWWJCBD["BJQK.ESHOW"] == "true",
  763. FGLDBJQR: res.data.SW_ZJWWJCBD["FGLDBJQR.ESHOW"] == "true",
  764. BZ: res.data.SW_ZJWWJCBD["BZ.ESHOW"] == "true",
  765. NGR: res.data.SW_ZJWWJCBD["NGR.ESHOW"] == "true",
  766. ZBRQ: res.data.SW_ZJWWJCBD["ZBRQ.ESHOW"] == "true",
  767. USAGE: res.data.SW_ZJWWJCBD["USAGE.ESHOW"] == "true"
  768. }
  769. this.selectUSAGEs = this.data.USAGE != "" && this.data.USAGE != null ? this.data.USAGE.split(",") : [];
  770. this.USAGE.forEach(item=>{
  771. if (this.data.USAGE.indexOf(item.CODE) != -1) {
  772. item.checked = true;
  773. }
  774. })
  775. // setTimeout(()=>{
  776. // $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  777. // if (this.data.USAGE.indexOf($(this).val()) != -1) {
  778. // $(this).attr("checked", true);
  779. // $(this).parent("label").addClass("chb-blue-checked");
  780. // }
  781. // })
  782. // },0)
  783. this.filedChange = true;
  784. let buttonList = [{ CNAME: "转发", CODE: "array", data: [] }];
  785. res.data["SW_ZJWWJCBD.FUNCLIST"].forEach(function (item) {
  786. if (item.BUTTONGROUP == "FORMITEM") {
  787. buttonList.push(item)
  788. } else {
  789. buttonList[0].data.push(item)
  790. }
  791. })
  792. if (buttonList[0].data.length == 0) {
  793. buttonList = buttonList.slice(1)
  794. } else if (buttonList[0].data.length == 1) {
  795. buttonList[0] = buttonList[0].data[0]
  796. }
  797. console.log(buttonList)
  798. this.buttonList = buttonList;//res.data["SW_ZJWWJCBD.FUNCLIST"];
  799. var n = {}, all = {};
  800. for (var i in this.DpList) {
  801. this.AllCheckedDp[i] = false;
  802. this.DpLength[i] = 0;
  803. this.selectDpList[i] = []
  804. all[i] = 0;
  805. this.DpList[i].forEach(item=>{
  806. this.DpLength[i]++
  807. if (this.data.ZBCS.indexOf(item.SECTION) != -1 && i == "ZBCS") {
  808. all[i]++;
  809. item.checked = true;
  810. this.selectDpList[i].push(item);
  811. }
  812. if (this.data.CDCS.indexOf(item.SECTION) != -1 && i == "CDCS") {
  813. all[i]++;
  814. item.checked = true;
  815. this.selectDpList[i].push(item);
  816. }
  817. })
  818. if (all[i] == this.DpList[i].length) {
  819. this.AllCheckedDp[i] = true;
  820. } else {
  821. this.AllCheckedDp[i] = false;
  822. }
  823. }
  824. // this.getOpinion1()
  825. // this.getOther1()
  826. // this.getOther()
  827. this.opinionList = [{
  828. name: "拟办意见",
  829. col: "BGSNBYJ",
  830. show: !this.hide("show", "BGSNBYJ") && !this.hide("readonly", "BGSNBYJ")
  831. }, {
  832. name: "领导批示",
  833. col: "WLDPS",
  834. show: !this.hide("show", "WLDPS") && !this.hide("readonly", "WLDPS")
  835. }, {
  836. name: "分管领导办结确认",
  837. col: "FGLDBJQR",
  838. show: !this.hide("show", "FGLDBJQR") && !this.hide("readonly", "FGLDBJQR")
  839. }, {
  840. name: "承办处室处理情况",
  841. col: "CBCSCLQK",
  842. show: !this.hide("show", "CBCSCLQK") && !this.hide("readonly", "CBCSCLQK")
  843. }]
  844. this.opinionList1 = [];
  845. this.opinionList.forEach( (item)=> {
  846. if (item.show == true) {
  847. this.opinionList1.push(item)
  848. }
  849. })
  850. if (this.opinionList1.length > 0) {
  851. this.opiniontype = this.opinionList1[0].col;
  852. }
  853. })
  854. },
  855. getContent(){
  856. if (self.Loaling == true) {
  857. return;
  858. }
  859. self.Loaling = true;
  860. $("#pdfContent").nextAll("div").addClass("sp-page-loading")
  861. self.pdfContent = [];
  862. var data = {
  863. fileurl: self.seeFileItem.FILEURL
  864. }
  865. $http.post(apiurljs.login + "g2app/dataabase/queryPDFContent", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  866. .success(function (obj) {
  867. var res = strToJson(s4.decryptData_CBC(obj.data));
  868. self.Loaling = false;
  869. $("#pdfContent").nextAll("div").removeClass("sp-page-loading")
  870. for (var i in res.data) {
  871. self.pdfContent.push({ id: parseInt(i.slice(i.indexOf("_") + 1)), content: res.data[i] })
  872. }
  873. self.pdfContent.sort(function (a, b) {
  874. return a.id - b.id;
  875. })
  876. })
  877. },
  878. getOpinion1(){
  879. var data = {
  880. cmanid: self.userId,
  881. routeinfoid: self.routeinfoid,
  882. routeid: "",//self.routeid,
  883. tableid: "SW_ZJWWJCBD",
  884. colid: "",
  885. opiniontype: "",//self.opiniontype,
  886. orderbycol: "CDATE desc"
  887. }
  888. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  889. .success(function (obj) {
  890. var res = strToJson(s4.decryptData_CBC(obj.data));
  891. if (res.success == true) {
  892. self.YJ.nulla = res.data;
  893. self.YJ.nullaSTATUS = false;
  894. self.YJ.nulla.forEach(function (item) {
  895. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  896. if (self.activeOpinion != null) {
  897. self.activeOpinion.FILEDATA = item.FILEDATA
  898. }
  899. })
  900. } else {
  901. sp.dialog(res.message)
  902. }
  903. })
  904. },
  905. getOther1(){
  906. var data = {
  907. tablename: "FILE_ATTACH",
  908. colums: "*",
  909. order: "ID asc",
  910. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  911. sqlinwhere: "",
  912. sqllikewhere: { ATTACHTYPE: "-正文" }
  913. }
  914. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  915. .success(function (obj) {
  916. var res = strToJson(s4.decryptData_CBC(obj.data));
  917. if (res.data.length > 0) {
  918. res.data.forEach(function (item) {
  919. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  920. self.arrayFile = item;
  921. self.seeFile(self.arrayFile)
  922. }
  923. })
  924. }
  925. })
  926. },
  927. getOther(){
  928. if (self.routeinfoid == 0) { return }
  929. var data = {
  930. tablename: "FILE_ATTACH",
  931. colums: "*",
  932. order: "ID asc",
  933. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  934. sqlinwhere: "",
  935. sqllikewhere: ""
  936. }
  937. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  938. .success(function (obj) {
  939. var res = strToJson(s4.decryptData_CBC(obj.data));
  940. self.arrayFile1 = [];
  941. if (res.data.length > 0) {
  942. res.data.forEach(function (item) {
  943. if (item.ATTACHTYPE.indexOf("-正文") == -1) {
  944. self.arrayFile1.push(item)
  945. }
  946. })
  947. $timeout(function () {
  948. self.goAttach()
  949. },1000)
  950. }
  951. })
  952. },
  953. hide(type, field){
  954. if (this.dotype == 0 && type == "readonly") {
  955. return true;
  956. } else {
  957. if (this[type][field] == true) {
  958. return true;
  959. } else {
  960. return false;
  961. }
  962. }
  963. },
  964. btnEvent(item){
  965. if (item.CODE == "NEWFLOWQB") {
  966. var data = {
  967. flowid: "AA65",
  968. userid: self.userId,
  969. routeinfoid: self.routeinfoid,
  970. directionid: self.directionid,
  971. copyrightid: self.copyrightid
  972. }
  973. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  974. .success(function (obj) {
  975. var res = strToJson(s4.decryptData_CBC(obj.data));
  976. console.log(res)
  977. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/qianbaomgr/" + res.data.FILEN + "&dotype=1&flowid=AA65")
  978. $timeout(function () {
  979. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  980. }, 1000)
  981. })
  982. return
  983. } else if (item.CODE == "NEWFLOWDW") {
  984. var data = {
  985. flowid: "AA95",
  986. userid: self.userId,
  987. routeinfoid: self.routeinfoid,
  988. directionid: self.directionid,
  989. copyrightid: self.copyrightid
  990. }
  991. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  992. .success(function (obj) {
  993. var res = strToJson(s4.decryptData_CBC(obj.data));
  994. console.log(res)
  995. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/DWHYTCB/" + res.data.FILEN + "&dotype=1&flowid=AA95")
  996. window.top.sp.restoreWorkLayer("#" + item.FUNCID)
  997. })
  998. return
  999. } else if (item.CODE == "NEWFLOWXZ") {
  1000. var data = {
  1001. flowid: "AA10",
  1002. userid: self.userId,
  1003. routeinfoid: self.routeinfoid,
  1004. directionid: self.directionid,
  1005. copyrightid: self.copyrightid
  1006. }
  1007. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1008. .success(function (obj) {
  1009. var res = strToJson(s4.decryptData_CBC(obj.data));
  1010. console.log(res)
  1011. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/fawenbg/" + res.data.FILEN + "&dotype=1&flowid=AA10")
  1012. $timeout(function () {
  1013. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  1014. }, 1000)
  1015. })
  1016. return
  1017. }
  1018. switch (item.CODE) {
  1019. case "SAVEITEM": self.btnSave(0); break;
  1020. case "PRINTITEM": self.btnPrint(); break;
  1021. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  1022. case "MEETITEM": self.Meet(); break;
  1023. case "SENDLOG": self.RouteList(); break;
  1024. default: self.forward(item); break;
  1025. }
  1026. },
  1027. openDpList(str){
  1028. if (self.hide("readonly", str) == true) {
  1029. return
  1030. } else {
  1031. self.filed = str;
  1032. //self.AllCheckedDp = false;
  1033. sp.layer("#DpList")
  1034. $("#DpList .sp-page").eq(0).scrollTop(0);
  1035. }
  1036. },
  1037. checkAllDp(){
  1038. self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
  1039. $.each(self.DpList[self.filed], function (index, item) {
  1040. item.checked = self.AllCheckedDp[self.filed];
  1041. })
  1042. self.submitDpList(1)
  1043. },
  1044. checkDpItem(item){
  1045. item.checked = !item.checked;
  1046. var n = 0;
  1047. $.each(self.DpList[self.filed], function (index, item) {
  1048. if (item.checked == true) {
  1049. n++
  1050. }
  1051. })
  1052. if (n == self.DpList[self.filed].length) {
  1053. self.AllCheckedDp[self.filed] = true;
  1054. } else {
  1055. self.AllCheckedDp[self.filed] = false;
  1056. }
  1057. self.submitDpList(1)
  1058. },
  1059. submitDpList(n){
  1060. var AllCheckedLength1 = 0;
  1061. self.selectDpList[self.filed] = [];
  1062. $.each(self.DpList[self.filed], function (index, item) {
  1063. if (item.checked == true) {
  1064. AllCheckedLength1++;
  1065. self.selectDpList[self.filed].push(item)
  1066. }
  1067. })
  1068. self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
  1069. return item.SECTION
  1070. }).join(",")
  1071. if (self.filed == "ZBCS") {
  1072. self.data.ZBCSCODE = self.selectDpList[self.filed].map(function (item) {
  1073. return item.CODE
  1074. }).join(",")
  1075. self.data.CDCS = self.data.CDCS == "" ? self.data.ZBCS : self.data.CDCS;
  1076. }
  1077. self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
  1078. self.changeFiled(self.filed)
  1079. if (n == 0) {
  1080. sp.layerhide();
  1081. }
  1082. },
  1083. openLWDW(){
  1084. var data = {
  1085. tablename: "CODE_LWDWLABEL"
  1086. }
  1087. //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1088. $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
  1089. .success(function (obj) {
  1090. //var res = strToJson(s4.decryptData_CBC(obj.data));
  1091. var res = obj;
  1092. self.getMenuBtnList(res.data);
  1093. self.LWDW = res.data[0].C_H_I_L_D_DATA;
  1094. self.LWDW.forEach(function (item) {
  1095. item.show = true;
  1096. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1097. item1.checked = false;
  1098. if (item1.CNAME == self.data.LWDW) {
  1099. item1.checked = true;
  1100. }
  1101. })
  1102. })
  1103. sp.layer("#openLWDW")
  1104. })
  1105. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  1106. self.treeData = [];
  1107. })
  1108. },
  1109. checkItem(obj){
  1110. self.LWDW.forEach(function (item) {
  1111. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1112. item1.checked = false;
  1113. if (item1.ID == obj.ID) {
  1114. item1.checked=true
  1115. }
  1116. })
  1117. })
  1118. },
  1119. submitLWDW(){
  1120. self.LWDW.forEach(function (item) {
  1121. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1122. if (item1.checked == true) {
  1123. self.data.LWDW = item1.CNAME;
  1124. }
  1125. })
  1126. })
  1127. console.log(self.data.LWDW)
  1128. self.changeFiled('LWDW')
  1129. sp.layerhide();
  1130. },
  1131. setLWDW(n){
  1132. var data = {
  1133. tablename: "CODE_LWDWLABEL"
  1134. }
  1135. //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1136. $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
  1137. .success(function (obj) {
  1138. //var res = strToJson(s4.decryptData_CBC(obj.data));
  1139. var res = obj;
  1140. self.getMenuBtnList(res.data);
  1141. self.treeData = res.data;
  1142. $timeout(function () {
  1143. self.nowNodeCode = self.treeData[0].CODE;
  1144. self.nowNodeName = self.treeData[0].CNAME;
  1145. self.nowNodeID = self.treeData[0].ID;
  1146. self.treeData[0].checked = true;
  1147. if (n == 0) {
  1148. sp.layer("#setLWDW")
  1149. }
  1150. })
  1151. })
  1152. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  1153. self.treeData = [];
  1154. })
  1155. },
  1156. getMenuBtnList(data){
  1157. data.forEach(function (item) {
  1158. item.checked = false;
  1159. item.C_H_I_L_D_DATA_L = data.length;
  1160. if (sp.isval(item.C_H_I_L_D_DATA) && item.C_H_I_L_D_DATA.length > 0) {
  1161. self.getMenuBtnList(item.C_H_I_L_D_DATA);
  1162. } else {
  1163. item.C_H_I_L_D_DATA = [];
  1164. }
  1165. })
  1166. },
  1167. itemAdd($item){
  1168. self.itemNode.level = $item.LEVELS;
  1169. self.itemNode.id = 0;
  1170. self.itemNode.name = $item.CNAME;
  1171. self.itemNode.code = $item.CODE;
  1172. self.itemNode.child_title = "";
  1173. self.rightFlag = 1;
  1174. console.log(self.itemNode)
  1175. },
  1176. itemEdit(){
  1177. self.itemNode.level = $item.LEVELS;
  1178. self.itemNode.id = $item.ID;
  1179. self.itemNode.name = $item.CNAME;
  1180. self.itemNode.code = $item.CODE;
  1181. self.itemNode.child_title = $item.CNAME;
  1182. self.rightFlag = 1;
  1183. console.log(self.itemNode)
  1184. },
  1185. itemDelete($item){
  1186. var data = {
  1187. "id": $item.ID,
  1188. "tablename": "CODE_LWDWLABEL",
  1189. "parentid": $item.PARENTID,
  1190. "formtablename": ""
  1191. }
  1192. $http.post(apiurljs.login + "g2app/dataabase/delNode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1193. .success(function (obj) {
  1194. var res = strToJson(s4.decryptData_CBC(obj.data));
  1195. if (res.success) {
  1196. self.setLWDW(1);
  1197. self.btnCancal();
  1198. } else {
  1199. sp.dialog(res.message);
  1200. }
  1201. })
  1202. },
  1203. btnSetTitle(){
  1204. if (self.itemNode.id != 0) {
  1205. if (spngvld.submit("#LWDW")) {
  1206. let postData = {
  1207. id: self.itemNode.id,
  1208. tablename: "CODE_LWDWLABEL",
  1209. data: {
  1210. CNAME: self.itemNode.level == 2 ? self.itemNode.name : self.itemNode.child_title
  1211. }
  1212. }
  1213. $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  1214. .success(function (obj) {
  1215. var res = strToJson(s4.decryptData_CBC(obj.data));
  1216. if (res.success) {
  1217. self.setLWDW(1);
  1218. self.btnCancal();
  1219. } else {
  1220. sp.dialog(res.message);
  1221. }
  1222. })
  1223. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  1224. })
  1225. }
  1226. } else {
  1227. if (spngvld.submit("#LWDW")) {
  1228. let postData = {
  1229. tablename: "CODE_LWDWLABEL",
  1230. code: self.itemNode.code,
  1231. levels: self.itemNode.level,
  1232. cname: self.itemNode.level == 1 ? self.itemNode.name : self.itemNode.child_title,
  1233. userid: self.userId
  1234. }
  1235. $http.post(apiurljs.login + "g2app/shouwen/TreeAdd", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  1236. .success(function (obj) {
  1237. var res = strToJson(s4.decryptData_CBC(obj.data));
  1238. if (res.success) {
  1239. self.setLWDW(1);
  1240. self.btnCancal();
  1241. } else {
  1242. sp.dialog(res.message);
  1243. }
  1244. })
  1245. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  1246. })
  1247. }
  1248. }
  1249. },
  1250. btnCancal(){
  1251. self.itemNode = {
  1252. level: "",
  1253. id: "",
  1254. name: "",
  1255. code: "",
  1256. child_title: ""
  1257. }
  1258. self.rightFlag = 0;
  1259. },
  1260. //保存提交
  1261. btnSave(n){
  1262. if (self.repeat == true) {
  1263. return
  1264. }
  1265. if (spngvld.submit(".formedit")) {
  1266. if (self.data.SFDB == "C01" && self.data.DBSX == "") {
  1267. sp.dialog("请填写督办时限!");
  1268. return
  1269. }
  1270. if (self.data.DBSX == "") {
  1271. sp.dialog("督办时限不能为空!已为您设为来文日期后15天!")
  1272. self.data.DBSX = sp.getNextDate(self.data.LWRQ, 15);
  1273. self.data.CPSX = sp.getNextDate(self.data.LWRQ, 13);
  1274. return
  1275. }
  1276. if (self.data.SWBH1 == "") {
  1277. var postData = {
  1278. swcode: self.SWBH,
  1279. cuserid: self.userId,
  1280. flowid: sp.getUrlName("flowid")
  1281. }
  1282. $http.post(apiurljs.login + "g2app/shouwen/saveSWCodeBySWCode", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  1283. .success(function (obj1) {
  1284. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  1285. if (res1.success) {
  1286. if (res1.data == "-1") {
  1287. sp.dialog("保存失败!");
  1288. return;
  1289. }
  1290. var dataArray = [];
  1291. self.data.USAGE = self.selectUSAGEs.join(",")
  1292. dataArray.push(self.data);
  1293. var data = {
  1294. ckey: "SW_ZJWWJCBD",
  1295. id: self.data.ID,
  1296. routeid: self.routeid,
  1297. routeinfoid: self.routeinfoid,
  1298. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  1299. directionid: self.directionid,
  1300. formeditid: self.formeditid,
  1301. data: JSON.stringify(dataArray)
  1302. }
  1303. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1304. .success(function (obj) {
  1305. var res = strToJson(s4.decryptData_CBC(obj.data));
  1306. if (res.code == 0) {
  1307. self.data.ID = res.data.ID;
  1308. self.routeid = res.data.ROUTEID;
  1309. self.routeinfoid = res.data.ROUTEINFOID;
  1310. self.filedChange = false;
  1311. if (n == 0) {
  1312. if (res1.data != self.SWBH.split("|")[2]) {
  1313. sp.dialog("收文编号已改变!")
  1314. } else {
  1315. sp.dialog("保存成功!");
  1316. }
  1317. $timeout(function () {
  1318. sp.dialoghide()
  1319. }, 1500)
  1320. self.getSwenList(1)
  1321. } else if (n == 1) {
  1322. self.forward(self.btnItem);
  1323. } else if (n == 2) {
  1324. self.sendAll();
  1325. } else if (n == 3) {
  1326. self.btnPrint();
  1327. }
  1328. } else {
  1329. sp.dialog(res.message)
  1330. }
  1331. })
  1332. } else {
  1333. sp.dialog(res1.message)
  1334. }
  1335. })
  1336. } else {
  1337. var dataArray = [];
  1338. self.data.USAGE = self.selectUSAGEs.join(",")
  1339. dataArray.push(self.data);
  1340. var data = {
  1341. ckey: "SW_ZJWWJCBD",
  1342. id: self.data.ID,
  1343. routeid: self.routeid,
  1344. routeinfoid: self.routeinfoid,
  1345. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  1346. directionid: self.directionid,
  1347. formeditid: self.formeditid,
  1348. data: JSON.stringify(dataArray)
  1349. }
  1350. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1351. .success(function (obj) {
  1352. var res = strToJson(s4.decryptData_CBC(obj.data));
  1353. if (res.code == 0) {
  1354. self.data.ID = res.data.ID;
  1355. self.routeid = res.data.ROUTEID;
  1356. self.routeinfoid = res.data.ROUTEINFOID;
  1357. self.filedChange = false;
  1358. if (n == 0) {
  1359. sp.dialog("保存成功!");
  1360. $timeout(function () {
  1361. sp.dialoghide()
  1362. }, 1500)
  1363. self.getSwenList(1)
  1364. } else if (n == 1) {
  1365. self.forward(self.btnItem);
  1366. } else if (n == 2) {
  1367. self.sendAll();
  1368. } else if (n == 3) {
  1369. self.btnPrint();
  1370. }
  1371. } else {
  1372. sp.dialog(res.message)
  1373. }
  1374. })
  1375. }
  1376. }
  1377. },
  1378. btnPrint(){
  1379. if (self.filedChange == true) {
  1380. self.btnSave(3)
  1381. } else {
  1382. // 创建隐藏的可下载链接
  1383. var eleLink = document.createElement('a');
  1384. eleLink.download = "";
  1385. eleLink.style.display = 'none';
  1386. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban33.ftl&tablename=SW_ZJWWJCBD&outfilepath=/tmp/行政公文.wps&printdate=LWRQ,DBSX,ZBRQ&routeinfoid=" + self.routeinfoid));
  1387. // 触发点击
  1388. document.body.appendChild(eleLink);
  1389. eleLink.click();
  1390. // 然后移除
  1391. document.body.removeChild(eleLink);
  1392. }
  1393. },
  1394. /*综合打印*/
  1395. btnPrint1(){
  1396. if (self.filedChange == true) {
  1397. self.btnSave(3)
  1398. } else {
  1399. sp.layer("#print")
  1400. }
  1401. },
  1402. printSubmit(){
  1403. if (self.printFiled == 1) {
  1404. var templatefilename = "moban33"
  1405. } else if (self.printFiled == 2) {
  1406. var templatefilename = "mobanoption"
  1407. } else {
  1408. var templatefilename = "moban33_all"
  1409. }
  1410. var data = {
  1411. templatefilename: templatefilename + ".ftl",
  1412. outfilepath: "/tmp/行政公文" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  1413. routeinfoid: self.routeinfoid,
  1414. tablename: "SW_ZJWWJCBD",
  1415. printtype: self.printFiled,
  1416. printdate: "LWRQ,DBSX,ZBRQ"
  1417. }
  1418. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1419. .success(function (obj) {
  1420. var res = strToJson(s4.decryptData_CBC(obj.data));
  1421. if (self.deviceType == "pad") {
  1422. window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
  1423. } else {
  1424. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  1425. }
  1426. })
  1427. sp.layerhide()
  1428. },
  1429. openOptionList(){
  1430. if (self.routeinfoid == 0 && self.routeid == 0) {
  1431. sp.dialog("请先保存!")
  1432. return;
  1433. }
  1434. if (self.dotype == 0) {
  1435. return
  1436. }
  1437. if (self.opinion.nulla == true) {
  1438. return;
  1439. }
  1440. self.nulla = "";
  1441. self.opinion.nulla = true;
  1442. },
  1443. openOptionList1(){
  1444. self.openOptionList()
  1445. self.activeOpinion = null;
  1446. self.showBottom = "opinion";
  1447. self.YJ.nulla.forEach(function (item) {
  1448. if (item.ROUTEID == self.routeid) {
  1449. self.activeOpinion = item;
  1450. self.nulla = item.OPINION;
  1451. }
  1452. })
  1453. $(".toggle").trigger("click")
  1454. },
  1455. closeOptionList(){
  1456. self.opinion.nulla = false;
  1457. self.activeOpinion = null;
  1458. $(".toggle").trigger("click")
  1459. },
  1460. submitOptionList(){
  1461. var data = {
  1462. cmanid: self.userId,
  1463. routeinfoid: self.routeinfoid,
  1464. routeid: self.routeid,
  1465. tableid: "SW_ZJWWJCBD",
  1466. colid: self.opiniontype,
  1467. opiniontype: self.opiniontype == "nulla" ? 99 : 0,
  1468. cresult: "",
  1469. opinion: self.nulla,
  1470. opinionimage: ""
  1471. }
  1472. if (self.opiniontype == "BGSNBYJ") {
  1473. data.cmans = "王勇";
  1474. }
  1475. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1476. .success(function (obj) {
  1477. var res = strToJson(s4.decryptData_CBC(obj.data));
  1478. if (res.success == true) {
  1479. self.getOpinion1();
  1480. self.opinion.nulla = false;
  1481. $(".toggle").trigger("click")
  1482. } else {
  1483. sp.dialog(res.message)
  1484. }
  1485. })
  1486. },
  1487. changeOptionList(item){
  1488. self.showBottom = "opinion";
  1489. self.opinion.nulla = true;
  1490. self.nulla = item.OPINION;
  1491. self.activeOpinion = item;
  1492. $(".toggle").trigger("click")
  1493. },
  1494. //意见附件(下表)
  1495. upload1(){
  1496. $('#fileupload1').fileupload({
  1497. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1498. dataType: 'json',
  1499. beforeSend: function (xhr, data) {
  1500. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1501. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1502. + ",routeid=" + self.routeid + ",tableid=SW_ZJWWJCBD,colid=" + self.opiniontype));
  1503. },
  1504. // 上传完成后的执行逻辑
  1505. done: function (e, data) {
  1506. self.uploading1 = false;
  1507. self.getOpinion1()
  1508. }
  1509. })
  1510. },
  1511. upload2(str){
  1512. $('#fileupload2').fileupload({
  1513. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1514. dataType: 'json',
  1515. beforeSend: function (xhr, data) {
  1516. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1517. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1518. + ",routeid=" + self.routeid + ",tableid=SW_ZJWWJCBD,colid=" + str));
  1519. },
  1520. // 上传完成后的执行逻辑
  1521. done: function (e, data) {
  1522. self.uploading1 = false;
  1523. self.getOpinion1()
  1524. }
  1525. })
  1526. },
  1527. //下载意见表附件
  1528. downLoadOption(item){
  1529. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  1530. },
  1531. //删除意见表附件
  1532. deleteOptionFile(file){
  1533. var data = {
  1534. routeid: file.ROUTEID,
  1535. tableid: "SW_ZJWWJCBD",
  1536. colid: file.COLID,
  1537. fileid: file.FILEID
  1538. };
  1539. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1540. .success(function (obj) {
  1541. var res = strToJson(s4.decryptData_CBC(obj.data));
  1542. sp.dialoghide();
  1543. if (res.success) {
  1544. self.getOpinion1();
  1545. } else {
  1546. sp.dialog("删除失败,请联系管理员!");
  1547. }
  1548. });
  1549. },
  1550. //删除意见
  1551. Dopinion(item){
  1552. var data = {
  1553. cmanid: self.userId,
  1554. routeid: self.routeid,
  1555. tableid: "SW_ZJWWJCBD",
  1556. colid: item.COLID,
  1557. }
  1558. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1559. .success(function (obj) {
  1560. var res = strToJson(s4.decryptData_CBC(obj.data));
  1561. if (res.success == true) {
  1562. self.getOpinion1();
  1563. self.nulla = "";
  1564. self.activeOpinion = null;
  1565. self.changeFiled(item.COLID)
  1566. } else {
  1567. sp.dialog(res.message)
  1568. }
  1569. })
  1570. },
  1571. phrase(colid){
  1572. sp.layer("#phrase");
  1573. self.colid = colid;
  1574. self.getPhrase();
  1575. },
  1576. Aphrase(){
  1577. if (self.phraseText == "") {
  1578. return;
  1579. }
  1580. var data = {
  1581. cmanid: self.userId,
  1582. tableid: "SW_ZJWWJCBD",
  1583. colid: self.colid,
  1584. contents: self.phraseText
  1585. }
  1586. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1587. .success(function (obj) {
  1588. var res = strToJson(s4.decryptData_CBC(obj.data));
  1589. if (res.success == true) {
  1590. self.phraseText = "";
  1591. self.getPhrase();
  1592. } else {
  1593. sp.dialog(res.message)
  1594. }
  1595. })
  1596. },
  1597. //获取常用语库
  1598. getPhrase(){
  1599. var data = {
  1600. cmanid: self.userId,
  1601. tableid: "SW_ZJWWJCBD",
  1602. colid: self.colid
  1603. }
  1604. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1605. .success(function (obj) {
  1606. var res = strToJson(s4.decryptData_CBC(obj.data));
  1607. self.phraseList = res.data;
  1608. self.phraseSelect = self.phraseList[0].CONTENTS;
  1609. })
  1610. },
  1611. //从常用语库删除
  1612. Dphrase(){
  1613. var id = null;
  1614. $.each(self.phraseList, function (index, item) {
  1615. if (item.CONTENTS == self.phraseSelect) {
  1616. id = item.ID;
  1617. }
  1618. })
  1619. var data = {
  1620. id: id
  1621. }
  1622. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1623. .success(function (obj) {
  1624. var res = strToJson(s4.decryptData_CBC(obj.data));
  1625. self.getPhrase();
  1626. })
  1627. },
  1628. btnPhrase(){
  1629. self.nulla = self.phraseSelect;
  1630. sp.layerhide();
  1631. },
  1632. selectUSAGE(item){
  1633. item.checked = !item.checked;
  1634. self.selectUSAGEs = [];
  1635. $.each(self.USAGE, function (index, item) {
  1636. if (item.checked == true) {
  1637. self.selectUSAGEs.push(item.CODE)
  1638. }
  1639. })
  1640. self.changeFiled('USAGE')
  1641. },
  1642. changeFiled(str){
  1643. self.filedChange = true;
  1644. if (self.data.SFDB != "C01") {
  1645. self.data.DBLX = "";
  1646. self.data.SWQXLX = "办理";
  1647. } else {
  1648. self.data.SWQXLX = "督办";
  1649. //self.data.DBLX = self.DBTYPE[0].CODE;
  1650. }
  1651. if(str == "DBSX"){
  1652. let objDate = new Date()
  1653. let DBSXDate = new Date(self.data.DBSX)
  1654. let dif_t = DBSXDate.getTime() - objDate.getTime();
  1655. let Day_dif_t = dif_t/(1000*60*60*24)
  1656. if(Day_dif_t>10){
  1657. self.data.CPSX = sp.getNextDate(self.data.DBSX, -2);
  1658. }else{
  1659. self.data.CPSX = sp.getNextDate(self.data.DBSX, -1);
  1660. }
  1661. }
  1662. },
  1663. verify(str){
  1664. if (self.data[str] == "") { return; }
  1665. var data = {
  1666. tablename: "SW_ZJWWJCBD",
  1667. colums: "*",
  1668. order: "ID desc",
  1669. sqlwhere: {},
  1670. sqlinwhere: "",
  1671. sqllikewhere: ""
  1672. }
  1673. data.sqlwhere[str] = self.data[str]
  1674. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1675. .success(function (obj) {
  1676. var res = strToJson(s4.decryptData_CBC(obj.data));
  1677. if (res.data.length > 0 && self.data.ID != res.data[0].ID) {
  1678. self.repeat = true;
  1679. sp.dialog("标题已存在,请修改后重试!")
  1680. } else {
  1681. self.repeat = false;
  1682. }
  1683. })
  1684. },
  1685. //转发
  1686. forward(){
  1687. self.btnItem = obj;
  1688. if (self.filedChange == true) {
  1689. self.btnSave(1)
  1690. } else {
  1691. $("#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=shouwenbg")
  1692. sp.layer("#forward")
  1693. }
  1694. },
  1695. //查看流转记录
  1696. RouteList(){
  1697. if (self.deviceType == "pad") {
  1698. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  1699. } else {
  1700. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1701. }
  1702. },
  1703. reSize(n){
  1704. var leftbox = document.getElementsByClassName("page-item")[n - 1];
  1705. var rightbox = document.getElementsByClassName("page-item")[n];
  1706. var line = document.getElementsByClassName("iframe-border-right")[n - 1];
  1707. document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
  1708. $(".mousemove").show()
  1709. var leftboxW = leftbox.clientWidth;//leftbox.style.width.slice(0, leftbox.style.width.length - 2);
  1710. var rightboxW = rightbox.clientWidth;//rightbox.style.width.slice(0, rightbox.style.width.length - 2);
  1711. var x = event.pageX - line.offsetLeft;
  1712. document.addEventListener("mousemove", boxMove)
  1713. function boxMove(event) {
  1714. if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
  1715. //$(".leftBox").children().not(".iframe-border-right").hide()
  1716. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
  1717. //$(".rightBox").children().not(".iframe-border-right").hide()
  1718. } else {
  1719. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  1720. leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
  1721. //$(".leftBox").children().not(".iframe-border-right").show()
  1722. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  1723. //rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
  1724. //$(".rightBox").children().not(".iframe-border-right").show()
  1725. }
  1726. }
  1727. document.addEventListener("mouseup", function () {
  1728. $(".mousemove").hide()
  1729. document.removeEventListener("mousemove", boxMove)
  1730. })
  1731. })
  1732. },
  1733. reSizeRow(){
  1734. var bodybox = document.getElementById("bodyDiv");
  1735. var topbox = document.getElementById("topDiv");
  1736. var bottombox = document.getElementById("bottomDiv");
  1737. var line = document.getElementById("lineDiv");
  1738. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  1739. $(".mousemove").show()
  1740. var bodyboxH = bodybox.clientHeight;
  1741. var topboxH = topbox.clientHeight;
  1742. var bottomboxH = bottombox.clientHeight;
  1743. //var y = event.pageY - line.offsetTop;
  1744. var y = event.pageY - line.clientHeight;
  1745. document.addEventListener("mousemove", boxMove)
  1746. function boxMove(event) {
  1747. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1748. //
  1749. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1750. //
  1751. } else {
  1752. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1753. topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1754. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 45 + "px";
  1755. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 75 + "px";
  1756. }
  1757. }
  1758. document.addEventListener("mouseup", function () {
  1759. $(".mousemove").hide()
  1760. document.removeEventListener("mousemove", boxMove)
  1761. })
  1762. })
  1763. },
  1764. headBtnSearch(){
  1765. if (sp.isval(self.headBtnSearchKeyword)) {
  1766. self.headSearchResult = [];
  1767. var data = {
  1768. "url": "/basic/api/StatSelect/selectCodeList",
  1769. "data": { "keyWord": self.headBtnSearchKeyword }
  1770. }
  1771. //console.log(JSON.stringify(data));
  1772. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1773. .success(function (obj) {
  1774. var res = strToJson(s4.decryptData_CBC(obj.data));
  1775. //console.log(JSON.stringify(res.data));
  1776. self.headSearchResult = res.data.build;
  1777. if (sp.isval(self.headSearchResult)) {
  1778. self.headSearchResult_view = true;
  1779. } else {
  1780. self.headSearchResult_view = false;
  1781. }
  1782. })
  1783. } else {
  1784. self.headSearchResult_view = false;
  1785. }
  1786. },
  1787. headKeywordPage(){
  1788. var get_token = localStorage.getItem("main-token");
  1789. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1790. sp.openNewWindow(set_url, '一张图');
  1791. self.headSearchResult_view = false;
  1792. },
  1793. onePic(){
  1794. sp.openNewWindow(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1795. },
  1796. closeToggle(){
  1797. $timeout(function () {
  1798. self.opinion.nulla = false;
  1799. self.activeOpinion = null;
  1800. })
  1801. }
  1802. }
  1803. })
  1804. var app = angular.module('app', [
  1805. ]);
  1806. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
  1807. var self = this;
  1808. var s4 = new SM4Util();
  1809. self.userId = $.cookie("GlWorkPlatform-userid");
  1810. self.userName = $.cookie("GlWorkPlatform-chineseName");
  1811. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  1812. self.routeid = sp.getUrlName("routeid");
  1813. self.routeinfoid = sp.getUrlName("routeinfoid");
  1814. self.copyrightid = sp.getUrlName("copyrightid");
  1815. self.directionid = sp.getUrlName("directionid");
  1816. self.formeditid = sp.getUrlName("formeditid");
  1817. self.mbid = sp.getUrlName("mbid");
  1818. self.fjid = sp.getUrlName("fjid");
  1819. self.docmode = sp.getUrlName("docmode");
  1820. self.dotype = sp.getUrlName("dotype");
  1821. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  1822. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  1823. self.get_type = sp.getUrlName("type");
  1824. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  1825. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  1826. var postCfg = {
  1827. headers: {
  1828. 'Content-Type': 'application/json',
  1829. 'Authorization': "Bearer " + self.get_AccessToken
  1830. }
  1831. };
  1832. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  1833. //初始化右上角按钮
  1834. self.buttonList = []
  1835. //上层附件、业务参考、共享沟通组件
  1836. self.arrayFile = null;
  1837. self.arrayFile1 = [];
  1838. self.uploading_zw = false;
  1839. self.uploading = false;
  1840. self.upload_zw = function () {
  1841. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  1842. return item.CNAME
  1843. })
  1844. $('#fileupload-zw').fileupload({
  1845. url: apiurljs.login + (self.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : 'g2app/abase/uploadFileWithFormAndGetPage'),//'g2app/abase/uploadFileWithForm'),
  1846. dataType: 'json',
  1847. beforeSend: function (xhr, data) {
  1848. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1849. if (self.routeinfoid == 0) {
  1850. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("copyrightid=" + self.copyrightid + ",directionid=" + self.directionid + ",formeditid=" + self.formeditid + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tablename=FILE_ATTACH,ATTACHTYPE=行政公文-正文"));
  1851. } else {
  1852. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=行政公文-正文"));
  1853. }
  1854. },
  1855. add: function (e, data) {
  1856. var num = 0;
  1857. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  1858. //文件类型判断
  1859. $.each(data.originalFiles, function (index, item) {
  1860. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  1861. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  1862. return;
  1863. } else {
  1864. num++
  1865. }
  1866. })
  1867. if (num == data.originalFiles.length) {
  1868. self.uploading_zw = true;
  1869. data.submit();
  1870. $scope.$apply();
  1871. }
  1872. },
  1873. // 上传完成后的执行逻辑
  1874. done: function (e, data) {
  1875. self.uploading_zw = false;
  1876. if (self.routeinfoid == 0) {
  1877. var res = strToJson(s4.decryptData_CBC(data.result.data));
  1878. self.data.ID = res.data2.ID;
  1879. self.routeid = res.data2.ROUTEID;
  1880. self.routeinfoid = res.data2.ROUTEINFOID;
  1881. self.getSwenList(0)
  1882. } else {
  1883. self.getOther1()
  1884. }
  1885. }
  1886. })
  1887. }
  1888. self.upload = function () {
  1889. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  1890. return item.CNAME
  1891. })
  1892. $('#fileupload').fileupload({
  1893. url: apiurljs.login + 'g2app/abase/uploadFileWithFormAndGetPage',//'g2app/abase/uploadFileWithForm',
  1894. dataType: 'json',
  1895. beforeSend: function (xhr, data) {
  1896. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1897. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=行政公文"));
  1898. },
  1899. add: function (e, data) {
  1900. var num = 0;
  1901. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  1902. //文件类型判断
  1903. $.each(data.originalFiles, function (index, item) {
  1904. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  1905. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  1906. return;
  1907. } else {
  1908. num++
  1909. }
  1910. })
  1911. if (num == data.originalFiles.length) {
  1912. self.uploading = true;
  1913. data.submit();
  1914. $scope.$apply();
  1915. }
  1916. },
  1917. // 上传完成后的执行逻辑
  1918. done: function (e, data) {
  1919. self.uploading = false;
  1920. self.getOther()
  1921. }
  1922. })
  1923. }
  1924. self.downLoad = function (item) {
  1925. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  1926. }
  1927. self.deleteFile = function (file) {
  1928. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  1929. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  1930. 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>";
  1931. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  1932. sp.openCenter(".sp-dialog");
  1933. ///取消按钮
  1934. $('.sp-closeDialog').click(function (event) {
  1935. sp.closeCenter(".sp-dialog");
  1936. event.preventDefault();
  1937. event.stopPropagation();
  1938. });
  1939. //post消息的id
  1940. $("#delDataTrue").click(function () {
  1941. var data = {
  1942. tablename: "FILE_ATTACH",
  1943. id: file.ID
  1944. };
  1945. delDataById(data).then(res=>{
  1946. sp.dialoghide();
  1947. if (res.success) {
  1948. self.getOther();
  1949. } else {
  1950. sp.dialog("删除失败,请联系管理员!");
  1951. }
  1952. })
  1953. });
  1954. }
  1955. self.seeFile = function (obj) {
  1956. self.seeFileItem = obj;
  1957. var set_convertType = 0;
  1958. if (obj.FILEEXT == "doc") {
  1959. set_convertType = 0;
  1960. } else if (obj.FILEEXT == "pdf") {
  1961. set_convertType = 20;
  1962. } else if (obj.FILEEXT == "ofd") {
  1963. set_convertType = 570;
  1964. } else {
  1965. set_convertType = 0;
  1966. }
  1967. let postData = {
  1968. convertType: set_convertType,
  1969. isSignature: 1,
  1970. signCallback: "g2app/fawenfiles/uploadFileFCS/" + obj.FILEURL.slice(7),
  1971. fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
  1972. };
  1973. var postCfg_transfer = {
  1974. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  1975. transformRequest: function (data) {
  1976. return $.param(data);
  1977. }
  1978. };
  1979. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  1980. .success(function (res) {
  1981. if (res.errorcode === 0) {
  1982. //$("#iframe_book").css("height", $(".ibox-content").height() - 123)
  1983. $("#iframe_book").attr("src", res.data.viewUrl)
  1984. } else {
  1985. sp.dialog(res.message);
  1986. }
  1987. });
  1988. }
  1989. self.goAttach = function (obj) {
  1990. if (obj) {
  1991. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  1992. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  1993. return
  1994. }
  1995. $("#attachlist")[0].contentWindow.openFile(obj)
  1996. if ($(".fa-chevron-down").is(":hidden") == true) {
  1997. showToggle(document.getElementById("toggleButton"))
  1998. }
  1999. } else {
  2000. $("#attachlist").attr("src", "attachlist.html?routeinfoid=" + self.routeinfoid)
  2001. }
  2002. }
  2003. self.readonly = {
  2004. CPSX: true,
  2005. JJCD: false,
  2006. MIJI: false,
  2007. SWLB: false,
  2008. SWBH: false,
  2009. LWDW: false,
  2010. LWRQ: false,
  2011. LWWH: false,
  2012. SFDB: false,
  2013. BT: false,
  2014. DBSX: false,
  2015. CDCS: false,
  2016. ZBCS: false,
  2017. SFBJ: false,
  2018. BJQK: false,
  2019. BZ: false,
  2020. NGR: false,
  2021. ZBRQ: false,
  2022. USAGE: false
  2023. }
  2024. self.show = {
  2025. CPSX: false,
  2026. JJCD: false,
  2027. MIJI: false,
  2028. SWLB: false,
  2029. SWBH: false,
  2030. LWDW: false,
  2031. LWRQ: false,
  2032. LWWH: false,
  2033. SFDB: false,
  2034. BT: false,
  2035. DBSX: false,
  2036. CDCS: false,
  2037. ZBCS: false,
  2038. SFBJ: false,
  2039. BJQK: false,
  2040. BZ: false,
  2041. NGR: false,
  2042. ZBRQ: false,
  2043. USAGE: false
  2044. }
  2045. self.getSwenList = function (n) {
  2046. self.SwenList = [];
  2047. var data = {
  2048. directionid: self.directionid,
  2049. userid: self.userId,
  2050. routeinfoid: self.routeinfoid,
  2051. routeid: self.routeid,
  2052. formeditid: ""
  2053. }
  2054. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2055. .success(function (obj) {
  2056. var res = strToJson(s4.decryptData_CBC(obj.data));
  2057. if (self.copyrightid == "") {
  2058. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  2059. }
  2060. $.each(res.data.LINKS, function (index, item) {
  2061. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  2062. if (item.TEMPFORM.indexOf("formeditZW.html") > -1) {
  2063. self.Title = item.VNAME;
  2064. }
  2065. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  2066. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  2067. } else {
  2068. item.TEMPFORM = "#";
  2069. }
  2070. self.SwenList.push(item)
  2071. })
  2072. self.SwenList.push({
  2073. VNAME: "流程图",
  2074. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  2075. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  2076. })
  2077. if (n == 0) {
  2078. self.getFLOW()
  2079. } else {
  2080. self.getData()
  2081. }
  2082. })
  2083. }
  2084. self.getSwenList(0)
  2085. self.getFLOW = function () {
  2086. var data = {
  2087. copyrightid: self.copyrightid
  2088. }
  2089. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2090. .success(function (obj) {
  2091. var res = strToJson(s4.decryptData_CBC(obj.data));
  2092. self.flowTitle = res.data.CNAME;
  2093. self.getJJQK()
  2094. })
  2095. }
  2096. self.getJJQK = function () {
  2097. var data = {
  2098. ckey: "CODE_EMERGENCY",
  2099. routeinfoid: self.routeinfoid
  2100. }
  2101. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2102. .success(function (obj) {
  2103. var res = strToJson(s4.decryptData_CBC(obj.data));
  2104. self.JJCD = res.data.CODE_EMERGENCY;
  2105. self.getCDDB()
  2106. })
  2107. }
  2108. self.getCDDB = function () {
  2109. var data = {
  2110. ckey: "CODE_DUBAN",
  2111. routeinfoid: self.routeinfoid
  2112. }
  2113. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2114. .success(function (obj) {
  2115. var res = strToJson(s4.decryptData_CBC(obj.data));
  2116. self.DBTYPE = res.data.CODE_DUBAN;
  2117. self.getMIJI()
  2118. })
  2119. }
  2120. self.getMIJI = function () {
  2121. var data = {
  2122. ckey: "CODE_SECRET",
  2123. routeinfoid: self.routeinfoid
  2124. }
  2125. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2126. .success(function (obj) {
  2127. var res = strToJson(s4.decryptData_CBC(obj.data));
  2128. self.MIJI = res.data.CODE_SECRET;
  2129. self.getSFDB()
  2130. })
  2131. }
  2132. self.getSFDB = function () {
  2133. var data = {
  2134. ckey: "CODE_SFDB",
  2135. routeinfoid: self.routeinfoid
  2136. }
  2137. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2138. .success(function (obj) {
  2139. var res = strToJson(s4.decryptData_CBC(obj.data));
  2140. self.SFDB = res.data.CODE_SFDB;
  2141. self.getSFBJ()
  2142. })
  2143. }
  2144. self.getSFBJ = function () {
  2145. var data = {
  2146. ckey: "CODE_SF",//"CODE_SFBJ",
  2147. routeinfoid: self.routeinfoid
  2148. }
  2149. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2150. .success(function (obj) {
  2151. var res = strToJson(s4.decryptData_CBC(obj.data));
  2152. self.SFBJ = res.data.CODE_SF;
  2153. self.getSWLB()
  2154. })
  2155. }
  2156. self.getSWLB = function () {
  2157. var data = {
  2158. ckey: "CODE_SWLB",
  2159. routeinfoid: self.routeinfoid
  2160. }
  2161. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2162. .success(function (obj) {
  2163. var res = strToJson(s4.decryptData_CBC(obj.data));
  2164. self.SWLB = res.data.CODE_SWLB;
  2165. self.getDpList()
  2166. })
  2167. }
  2168. self.getDpList = function () {
  2169. var data = {
  2170. unitid: "AA"
  2171. }
  2172. $http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2173. .success(function (obj) {
  2174. var res = strToJson(s4.decryptData_CBC(obj.data));
  2175. self.dpList = [];
  2176. res.data.forEach(function (item) {
  2177. if (item.CHILD_DATA.length == 0) {
  2178. self.dpList.push(item)
  2179. } else {
  2180. item.CHILD_DATA.forEach(function (item1) {
  2181. if (item1.CHILD_DATA.length == 0) {
  2182. self.dpList.push(item1)
  2183. } else {
  2184. item1.CHILD_DATA.forEach(function (item2) {
  2185. if (item2.CHILD_DATA.length == 0) {
  2186. self.dpList.push(item2)
  2187. }
  2188. })
  2189. }
  2190. })
  2191. }
  2192. })
  2193. self.dpList.forEach(function (item) {
  2194. item.checked = false;
  2195. })
  2196. self.DpList = {
  2197. ZBCS: JSON.parse(JSON.stringify(self.dpList)),
  2198. CDCS: JSON.parse(JSON.stringify(self.dpList))
  2199. }
  2200. self.AllCheckedDp = {};
  2201. self.DpLength = {};
  2202. self.selectDpList = {};
  2203. self.getUSAGE(0)
  2204. })
  2205. }
  2206. //标签
  2207. self.getUSAGE = function (n) {
  2208. var data = {
  2209. ckey: "CODE_SHOUWENLABEL",
  2210. routeinfoid: self.routeinfoid
  2211. }
  2212. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2213. .success(function (obj) {
  2214. var res = strToJson(s4.decryptData_CBC(obj.data));
  2215. self.USAGE = res.data.CODE_SHOUWENLABEL;
  2216. $.each(self.USAGE, function (index, item) {
  2217. item.checked = false;
  2218. })
  2219. if (n == 0) {
  2220. self.getSWBH()
  2221. }
  2222. if (n == 1) {
  2223. $.each(self.USAGE, function (index, item) {
  2224. if (self.data.USAGE.indexOf(item.CODE) != -1) {
  2225. item.checked = true;
  2226. }
  2227. })
  2228. $timeout(function () {
  2229. $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  2230. if (self.data.USAGE.indexOf($(this).val()) != -1) {
  2231. $(this).attr("checked", true);
  2232. $(this).parent("label").addClass("chb-blue-checked");
  2233. }
  2234. })
  2235. }, 1)
  2236. }
  2237. })
  2238. }
  2239. //管理标签
  2240. self.ManageUSAGE = function (n) {
  2241. self.addUSAGENAME = "";
  2242. var data = {
  2243. tablename: "CODE_SHOUWENLABEL"
  2244. }
  2245. $http.post(apiurljs.login + "g2app/shouwen/queryLabelCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2246. .success(function (obj) {
  2247. var res = strToJson(s4.decryptData_CBC(obj.data));
  2248. self.USAGELIST = res.data;
  2249. $.each(self.USAGELIST, function (index, item) {
  2250. item.change = false;
  2251. item.CNAME1 = item.CNAME;
  2252. item.USAGE = item.USAGE == 0 ? "隐藏" : "显示";
  2253. })
  2254. if (n == 0) {
  2255. $timeout(function () {
  2256. sp.layer("#USAGE");
  2257. }, 1)
  2258. }
  2259. })
  2260. }
  2261. //新增标签
  2262. self.addUSAGE = function () {
  2263. if (self.addUSAGENAME == "") {
  2264. sp.dialog("标签名称不可为空!");
  2265. return;
  2266. }
  2267. var data = {
  2268. tablename: "CODE_SHOUWENLABEL",
  2269. data: {
  2270. CODE: "C0" + (self.USAGELIST.length + 1),
  2271. CNAME: self.addUSAGENAME,
  2272. USERID: self.userId,
  2273. TABLENAME: "SW_ZJWWJCBD",
  2274. USAGE: "1"
  2275. }
  2276. }
  2277. $http.post(apiurljs.login + "g2app/shouwen/insertCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2278. .success(function (obj) {
  2279. var res = strToJson(s4.decryptData_CBC(obj.data));
  2280. if (res.success) {
  2281. self.ManageUSAGE(1);
  2282. self.getUSAGE(1);
  2283. } else {
  2284. sp.dialog(res.message);
  2285. }
  2286. })
  2287. }
  2288. //标签排序上下移
  2289. self.btnSort = function ($index, tip) {
  2290. var set_id = "";
  2291. var set_sortid = "";
  2292. if (tip == "上移") {
  2293. var set_index = parseInt($index - 1);
  2294. set_id = self.USAGELIST[set_index].ID;
  2295. set_sortid = self.USAGELIST[set_index].SORTID;
  2296. } else {
  2297. var set_index = parseInt($index + 1);
  2298. set_id = self.USAGELIST[set_index].ID;
  2299. set_sortid = self.USAGELIST[set_index].SORTID;
  2300. }
  2301. var data = {
  2302. tablename: "CODE_SHOUWENLABEL",
  2303. id: self.USAGELIST[$index].ID,
  2304. sortid: self.USAGELIST[$index].SORTID,
  2305. id_other: set_id,
  2306. sortid_other: set_sortid
  2307. };
  2308. $http.post(apiurljs.login + "g2app/shouwen/MoveCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2309. .success(function (obj) {
  2310. var res = strToJson(s4.decryptData_CBC(obj.data));
  2311. if (res.success) {
  2312. self.ManageUSAGE(1);
  2313. } else {
  2314. sp.dialog(res.message);
  2315. }
  2316. });
  2317. };
  2318. //更新标签
  2319. self.updataUSAGE = function (item, str) {
  2320. if (str == "CNAME") {
  2321. var data = {
  2322. tablename: "SW_ZJWWJCBD",
  2323. code: item.CODE,
  2324. }
  2325. $http.post(apiurljs.login + "g2app/shouwen/querynumCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2326. .success(function (obj) {
  2327. var res = strToJson(s4.decryptData_CBC(obj.data));
  2328. if (res.success) {
  2329. var data = {
  2330. tablename: "CODE_SHOUWENLABEL",
  2331. id: item.ID,
  2332. data: {
  2333. "cname": item.CNAME1
  2334. }
  2335. }
  2336. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2337. .success(function (obj) {
  2338. var res = strToJson(s4.decryptData_CBC(obj.data));
  2339. if (res.success) {
  2340. item.change = false;
  2341. self.ManageUSAGE(1);
  2342. self.getUSAGE(1);
  2343. } else {
  2344. sp.dialog(res.message);
  2345. }
  2346. });
  2347. } else {
  2348. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2349. var dialogBody = "<div class=\"sp-dialog-body\">该标签已被使用,您确认要修改吗?</div>";
  2350. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='upDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  2351. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2352. sp.openCenter(".sp-dialog");
  2353. $('.sp-closeDialog').click(function (event) {
  2354. sp.dialoghide();
  2355. $timeout(function () {
  2356. item.CNAME1 = item.CNAME;
  2357. }, 1)
  2358. //sp.closeCenter(".sp-dialog");
  2359. event.preventDefault(); event.stopPropagation();
  2360. });
  2361. $("#upDataTrue").click(function () {
  2362. var data = {
  2363. tablename: "CODE_SHOUWENLABEL",
  2364. id: item.ID,
  2365. data: {
  2366. "cname": item.CNAME1
  2367. }
  2368. }
  2369. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2370. .success(function (obj) {
  2371. var res = strToJson(s4.decryptData_CBC(obj.data));
  2372. if (res.success) {
  2373. sp.dialoghide();
  2374. item.change = false;
  2375. self.ManageUSAGE(1);
  2376. self.getUSAGE(1);
  2377. } else {
  2378. sp.dialog(res.message);
  2379. }
  2380. });
  2381. });
  2382. }
  2383. })
  2384. } else if (str == "显示") {
  2385. var data = {
  2386. tablename: "CODE_SHOUWENLABEL",
  2387. id: item.ID,
  2388. data: {
  2389. "USAGE": "1"
  2390. }
  2391. }
  2392. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2393. .success(function (obj) {
  2394. var res = strToJson(s4.decryptData_CBC(obj.data));
  2395. if (res.success) {
  2396. item.change = false;
  2397. self.ManageUSAGE(1);
  2398. self.getUSAGE(1);
  2399. } else {
  2400. sp.dialog(res.message);
  2401. }
  2402. });
  2403. } else {
  2404. var data = {
  2405. tablename: "CODE_SHOUWENLABEL",
  2406. id: item.ID,
  2407. data: {
  2408. "USAGE": "0"
  2409. }
  2410. }
  2411. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2412. .success(function (obj) {
  2413. var res = strToJson(s4.decryptData_CBC(obj.data));
  2414. if (res.success) {
  2415. item.change = false;
  2416. self.ManageUSAGE(1);
  2417. self.getUSAGE(1);
  2418. } else {
  2419. sp.dialog(res.message);
  2420. }
  2421. });
  2422. }
  2423. }
  2424. //删除标签
  2425. self.deleteUSAGE = function (item) {
  2426. var data = {
  2427. tablename: "CODE_SHOUWENLABEL",
  2428. tablename_form: "SW_ZJWWJCBD",
  2429. id: item.ID,
  2430. code: item.CODE
  2431. }
  2432. $http.post(apiurljs.login + "g2app/shouwen/delCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2433. .success(function (obj) {
  2434. var res = strToJson(s4.decryptData_CBC(obj.data));
  2435. if (res.success) {
  2436. self.ManageUSAGE(1);
  2437. self.getUSAGE(1);
  2438. } else {
  2439. sp.dialog("此标签已被使用");
  2440. }
  2441. });
  2442. }
  2443. self.getSWBH = function () {
  2444. var data = {
  2445. flowid: sp.getUrlName("flowid")
  2446. }
  2447. $http.post(apiurljs.login + "g2app/shouwen/querySWCodeByFlowid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2448. .success(function (obj) {
  2449. var res = strToJson(s4.decryptData_CBC(obj.data));
  2450. self.SWBH = res.data;
  2451. self.getData()
  2452. })
  2453. }
  2454. //获取数据
  2455. self.getData = function () {
  2456. let data = {
  2457. ckey: "SW_ZJWWJCBD",
  2458. id: 0,
  2459. directionid: self.directionid,
  2460. formeditid: self.formeditid,
  2461. routeid: self.routeid,
  2462. routeinfoid: self.routeinfoid
  2463. }
  2464. g2app_abase_queryData(data).then(res=>{
  2465. console.log(res.data.SW_ZJWWJCBD)
  2466. self.data = {
  2467. CPSX: res.data.SW_ZJWWJCBD.CPSX == "" ? "" : sp.format(res.data.SW_ZJWWJCBD.CPSX),
  2468. ID: res.data.SW_ZJWWJCBD.ID,
  2469. APPCODE: res.data.SW_ZJWWJCBD.APPCODE,
  2470. JJCD: res.data.SW_ZJWWJCBD.JJCD == "" ? self.JJCD[0].CODE : res.data.SW_ZJWWJCBD.JJCD,
  2471. MIJI: res.data.SW_ZJWWJCBD.MIJI == "" ? self.MIJI[0].CODE : res.data.SW_ZJWWJCBD.MIJI,
  2472. SWLB: res.data.SW_ZJWWJCBD.SWLB == "" ? self.SWLB[0].CODE : res.data.SW_ZJWWJCBD.SWLB,
  2473. SWBH: res.data.SW_ZJWWJCBD.SWBH == "" ? self.SWBH.replace("|", "〔 ").replace("|", " 〕") + "号" : res.data.SW_ZJWWJCBD.SWBH,
  2474. SWBH1: res.data.SW_ZJWWJCBD.SWBH,
  2475. LWDW: res.data.SW_ZJWWJCBD.LWDW,
  2476. LWRQ: res.data.SW_ZJWWJCBD.LWRQ == "" || res.data.SW_ZJWWJCBD.LWRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_ZJWWJCBD.LWRQ),
  2477. LWWH: res.data.SW_ZJWWJCBD.LWWH == "" ? "〔 " + sp.currentYear() + " 〕号" : res.data.SW_ZJWWJCBD.LWWH,
  2478. SFDB: res.data.SW_ZJWWJCBD.SFDB == "" ? "C03" : res.data.SW_ZJWWJCBD.SFDB,
  2479. DBLX: res.data.SW_ZJWWJCBD.DBLX == "" ? res.data.SW_ZJWWJCBD.SFDB == "" || res.data.SW_ZJWWJCBD.SFDB == self.SFDB[1].CODE ? "" : self.DBTYPE[0].CODE : res.data.SW_ZJWWJCBD.DBLX,
  2480. BT: res.data.SW_ZJWWJCBD.BT,
  2481. DBSX: res.data.SW_ZJWWJCBD.DBSX == "" ? "" : sp.format(res.data.SW_ZJWWJCBD.DBSX),
  2482. CDCS: res.data.SW_ZJWWJCBD.CDCS,
  2483. ZBCS: res.data.SW_ZJWWJCBD.ZBCS,
  2484. SFBJ: res.data.SW_ZJWWJCBD.SFBJ == "" ? self.SFBJ[0].CODE : res.data.SW_ZJWWJCBD.SFDB,
  2485. BJQK:res.data.SW_ZJWWJCBD.BJQK,
  2486. BZ: res.data.SW_ZJWWJCBD.BZ,
  2487. NGR: res.data.SW_ZJWWJCBD.NGR == "" ? self.userName : res.data.SW_ZJWWJCBD.NGR,
  2488. ZBRQ: res.data.SW_ZJWWJCBD.ZBRQ == "" || res.data.SW_ZJWWJCBD.ZBRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_ZJWWJCBD.ZBRQ),
  2489. USAGE: res.data.SW_ZJWWJCBD.USAGE,
  2490. ZBCSCODE: res.data.SW_ZJWWJCBD.ZBCSCODE,
  2491. FGLDBJQR: res.data.SW_ZJWWJCBD.FGLDBJQR,
  2492. SWQXLX: res.data.SW_ZJWWJCBD.SWQXLX == "" ? res.data.SW_ZJWWJCBD.SFDB != "C01" ? "办理" : "督办" : res.data.SW_ZJWWJCBD.SWQXLX
  2493. }
  2494. self.readonly = {
  2495. CPSX: true,
  2496. JJCD: res.data.SW_ZJWWJCBD["JJCD.EREADONLY"] == "true",
  2497. MIJI: res.data.SW_ZJWWJCBD["MIJI.EREADONLY"] == "true",
  2498. SWLB: res.data.SW_ZJWWJCBD["SWLB.EREADONLY"] == "true",
  2499. SWBH: res.data.SW_ZJWWJCBD["SWBH.EREADONLY"] == "true",
  2500. LWDW: res.data.SW_ZJWWJCBD["LWDW.EREADONLY"] == "true",
  2501. LWRQ: res.data.SW_ZJWWJCBD["LWRQ.EREADONLY"] == "true",
  2502. LWWH: res.data.SW_ZJWWJCBD["LWWH.EREADONLY"] == "true",
  2503. SFDB: res.data.SW_ZJWWJCBD["SFDB.EREADONLY"] == "true",
  2504. BT: res.data.SW_ZJWWJCBD["BT.EREADONLY"] == "true",
  2505. BGSNBYJ: res.data.SW_ZJWWJCBD["BGSNBYJ.EREADONLY"] == "true",
  2506. WLDPS: res.data.SW_ZJWWJCBD["WLDPS.EREADONLY"] == "true",
  2507. CBCSCLQK: res.data.SW_ZJWWJCBD["CBCSCLQK.EREADONLY"] == "true",
  2508. DBLX: res.data.SW_ZJWWJCBD["DBLX.EREADONLY"] == "true",
  2509. CDCS: res.data.SW_ZJWWJCBD["CDCS.EREADONLY"] == "true",
  2510. DBSX: res.data.SW_ZJWWJCBD["DBSX.EREADONLY"] == "true",
  2511. ZBCS: res.data.SW_ZJWWJCBD["ZBCS.EREADONLY"] == "true",
  2512. SFBJ: res.data.SW_ZJWWJCBD["SFBJ.EREADONLY"] == "true",
  2513. BJQK: res.data.SW_ZJWWJCBD["BJQK.EREADONLY"] == "true",
  2514. FGLDBJQR: res.data.SW_ZJWWJCBD["FGLDBJQR.EREADONLY"] == "true",
  2515. BZ: res.data.SW_ZJWWJCBD["BZ.EREADONLY"] == "true",
  2516. NGR: res.data.SW_ZJWWJCBD["NGR.EREADONLY"] == "true",
  2517. ZBRQ: res.data.SW_ZJWWJCBD["ZBRQ.EREADONLY"] == "true",
  2518. USAGE: res.data.SW_ZJWWJCBD["USAGE.EREADONLY"] == "true"
  2519. }
  2520. self.show = {
  2521. CPSX: res.data.SW_ZJWWJCBD["CPSX.ESHOW"] == "true",
  2522. JJCD: res.data.SW_ZJWWJCBD["JJCD.ESHOW"] == "true",
  2523. MIJI: res.data.SW_ZJWWJCBD["MIJI.ESHOW"] == "true",
  2524. SWLB: res.data.SW_ZJWWJCBD["SWLB.ESHOW"] == "true",
  2525. SWBH: res.data.SW_ZJWWJCBD["SWBH.ESHOW"] == "true",
  2526. LWDW: res.data.SW_ZJWWJCBD["LWDW.ESHOW"] == "true",
  2527. LWRQ: res.data.SW_ZJWWJCBD["LWRQ.ESHOW"] == "true",
  2528. LWWH: res.data.SW_ZJWWJCBD["LWWH.ESHOW"] == "true",
  2529. SFDB: res.data.SW_ZJWWJCBD["SFDB.ESHOW"] == "true",
  2530. BT: res.data.SW_ZJWWJCBD["BT.ESHOW"] == "true",
  2531. BGSNBYJ: res.data.SW_ZJWWJCBD["BGSNBYJ.ESHOW"] == "true",
  2532. WLDPS: res.data.SW_ZJWWJCBD["WLDPS.ESHOW"] == "true",
  2533. CBCSCLQK: res.data.SW_ZJWWJCBD["CBCSCLQK.ESHOW"] == "true",
  2534. DBLX: res.data.SW_ZJWWJCBD["DBLX.ESHOW"] == "true",
  2535. CDCS: res.data.SW_ZJWWJCBD["CDCS.ESHOW"] == "true",
  2536. DBSX: res.data.SW_ZJWWJCBD["DBSX.ESHOW"] == "true",
  2537. ZBCS: res.data.SW_ZJWWJCBD["ZBCS.ESHOW"] == "true",
  2538. SFBJ: res.data.SW_ZJWWJCBD["SFBJ.ESHOW"] == "true",
  2539. BJQK: res.data.SW_ZJWWJCBD["BJQK.ESHOW"] == "true",
  2540. FGLDBJQR: res.data.SW_ZJWWJCBD["FGLDBJQR.ESHOW"] == "true",
  2541. BZ: res.data.SW_ZJWWJCBD["BZ.ESHOW"] == "true",
  2542. NGR: res.data.SW_ZJWWJCBD["NGR.ESHOW"] == "true",
  2543. ZBRQ: res.data.SW_ZJWWJCBD["ZBRQ.ESHOW"] == "true",
  2544. USAGE: res.data.SW_ZJWWJCBD["USAGE.ESHOW"] == "true"
  2545. }
  2546. self.selectUSAGEs = self.data.USAGE != "" && self.data.USAGE != null ? self.data.USAGE.split(",") : [];
  2547. $.each(self.USAGE, function (index, item) {
  2548. if (self.data.USAGE.indexOf(item.CODE) != -1) {
  2549. item.checked = true;
  2550. }
  2551. })
  2552. $timeout(function () {
  2553. $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  2554. if (self.data.USAGE.indexOf($(this).val()) != -1) {
  2555. $(this).attr("checked", true);
  2556. $(this).parent("label").addClass("chb-blue-checked");
  2557. }
  2558. })
  2559. }, 0)
  2560. self.filedChange = true;
  2561. //if (self.data.ID == 0) {
  2562. // self.filedChange = true;
  2563. //} else {
  2564. // self.filedChange = false;
  2565. //}
  2566. var buttonList = [{ CNAME: "转发", CODE: "array", data: [] }];
  2567. res.data["SW_ZJWWJCBD.FUNCLIST"].forEach(function (item) {
  2568. if (item.BUTTONGROUP == "FORMITEM") {
  2569. buttonList.push(item)
  2570. } else {
  2571. buttonList[0].data.push(item)
  2572. }
  2573. })
  2574. if (buttonList[0].data.length == 0) {
  2575. buttonList = buttonList.slice(1)
  2576. } else if (buttonList[0].data.length == 1) {
  2577. buttonList[0] = buttonList[0].data[0]
  2578. }
  2579. console.log(buttonList)
  2580. self.buttonList = buttonList;//res.data["SW_ZJWWJCBD.FUNCLIST"];
  2581. var n = {}, all = {};
  2582. for (var i in self.DpList) {
  2583. self.AllCheckedDp[i] = false;
  2584. self.DpLength[i] = 0;
  2585. self.selectDpList[i] = []
  2586. all[i] = 0;
  2587. $.each(self.DpList[i], function (index, item) {
  2588. self.DpLength[i]++
  2589. if (self.data.ZBCS.indexOf(item.SECTION) != -1 && i == "ZBCS") {
  2590. all[i]++;
  2591. item.checked = true;
  2592. self.selectDpList[i].push(item);
  2593. }
  2594. if (self.data.CDCS.indexOf(item.SECTION) != -1 && i == "CDCS") {
  2595. all[i]++;
  2596. item.checked = true;
  2597. self.selectDpList[i].push(item);
  2598. }
  2599. })
  2600. if (all[i] == self.DpList[i].length) {
  2601. self.AllCheckedDp[i] = true;
  2602. } else {
  2603. self.AllCheckedDp[i] = false;
  2604. }
  2605. }
  2606. self.getOpinion1()
  2607. self.getOther1()
  2608. self.getOther()
  2609. self.opinionList = [{
  2610. name: "拟办意见",
  2611. col: "BGSNBYJ",
  2612. show: !self.hide("show", "BGSNBYJ") && !self.hide("readonly", "BGSNBYJ")
  2613. }, {
  2614. name: "领导批示",
  2615. col: "WLDPS",
  2616. show: !self.hide("show", "WLDPS") && !self.hide("readonly", "WLDPS")
  2617. }, {
  2618. name: "分管领导办结确认",
  2619. col: "FGLDBJQR",
  2620. show: !self.hide("show", "FGLDBJQR") && !self.hide("readonly", "FGLDBJQR")
  2621. }, {
  2622. name: "承办处室处理情况",
  2623. col: "CBCSCLQK",
  2624. show: !self.hide("show", "CBCSCLQK") && !self.hide("readonly", "CBCSCLQK")
  2625. }]
  2626. self.opinionList1 = [];
  2627. self.opinionList.forEach(function (item) {
  2628. if (item.show == true) {
  2629. self.opinionList1.push(item)
  2630. }
  2631. })
  2632. if (self.opinionList1.length > 0) {
  2633. self.opiniontype = self.opinionList1[0].col;
  2634. }
  2635. })
  2636. }
  2637. //转换
  2638. self.Loaling = false;
  2639. self.pdfContent = [];
  2640. self.getContent = function () {
  2641. if (self.Loaling == true) {
  2642. return;
  2643. }
  2644. self.Loaling = true;
  2645. $("#pdfContent").nextAll("div").addClass("sp-page-loading")
  2646. self.pdfContent = [];
  2647. var data = {
  2648. fileurl: self.seeFileItem.FILEURL
  2649. }
  2650. $http.post(apiurljs.login + "g2app/dataabase/queryPDFContent", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2651. .success(function (obj) {
  2652. var res = strToJson(s4.decryptData_CBC(obj.data));
  2653. self.Loaling = false;
  2654. $("#pdfContent").nextAll("div").removeClass("sp-page-loading")
  2655. for (var i in res.data) {
  2656. self.pdfContent.push({ id: parseInt(i.slice(i.indexOf("_") + 1)), content: res.data[i] })
  2657. }
  2658. self.pdfContent.sort(function (a, b) {
  2659. return a.id - b.id;
  2660. })
  2661. })
  2662. }
  2663. //获取意见(不上表)
  2664. self.getOpinion1 = function () {
  2665. var data = {
  2666. cmanid: self.userId,
  2667. routeinfoid: self.routeinfoid,
  2668. routeid: "",//self.routeid,
  2669. tableid: "SW_ZJWWJCBD",
  2670. colid: "",
  2671. opiniontype: "",//self.opiniontype,
  2672. orderbycol: "CDATE desc"
  2673. }
  2674. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2675. .success(function (obj) {
  2676. var res = strToJson(s4.decryptData_CBC(obj.data));
  2677. if (res.success == true) {
  2678. self.YJ.nulla = res.data;
  2679. self.YJ.nullaSTATUS = false;
  2680. self.YJ.nulla.forEach(function (item) {
  2681. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  2682. if (self.activeOpinion != null) {
  2683. self.activeOpinion.FILEDATA = item.FILEDATA
  2684. }
  2685. })
  2686. } else {
  2687. sp.dialog(res.message)
  2688. }
  2689. })
  2690. }
  2691. //获取正文
  2692. self.getOther1 = function () {
  2693. var data = {
  2694. tablename: "FILE_ATTACH",
  2695. colums: "*",
  2696. order: "ID asc",
  2697. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  2698. sqlinwhere: "",
  2699. sqllikewhere: { ATTACHTYPE: "-正文" }
  2700. }
  2701. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2702. .success(function (obj) {
  2703. var res = strToJson(s4.decryptData_CBC(obj.data));
  2704. if (res.data.length > 0) {
  2705. res.data.forEach(function (item) {
  2706. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  2707. self.arrayFile = item;
  2708. self.seeFile(self.arrayFile)
  2709. }
  2710. })
  2711. }
  2712. })
  2713. }
  2714. //获取附件
  2715. self.getOther = function () {
  2716. if (self.routeinfoid == 0) { return }
  2717. var data = {
  2718. tablename: "FILE_ATTACH",
  2719. colums: "*",
  2720. order: "ID asc",
  2721. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  2722. sqlinwhere: "",
  2723. sqllikewhere: ""
  2724. }
  2725. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2726. .success(function (obj) {
  2727. var res = strToJson(s4.decryptData_CBC(obj.data));
  2728. self.arrayFile1 = [];
  2729. if (res.data.length > 0) {
  2730. res.data.forEach(function (item) {
  2731. if (item.ATTACHTYPE.indexOf("-正文") == -1) {
  2732. self.arrayFile1.push(item)
  2733. }
  2734. })
  2735. $timeout(function () {
  2736. self.goAttach()
  2737. },1000)
  2738. }
  2739. })
  2740. }
  2741. //判断页面字段是否只读readonly、是否隐藏show
  2742. self.hide = function (type, field) {
  2743. if (self.dotype == 0 && type == "readonly") {
  2744. return true;
  2745. } else {
  2746. if (self[type][field] == true) {
  2747. return true;
  2748. } else {
  2749. return false;
  2750. }
  2751. }
  2752. }
  2753. //右上角按钮调用方法
  2754. self.btnEvent = function (item) {
  2755. if (item.CODE == "NEWFLOWQB") {
  2756. var data = {
  2757. flowid: "AA65",
  2758. userid: self.userId,
  2759. routeinfoid: self.routeinfoid,
  2760. directionid: self.directionid,
  2761. copyrightid: self.copyrightid
  2762. }
  2763. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2764. .success(function (obj) {
  2765. var res = strToJson(s4.decryptData_CBC(obj.data));
  2766. console.log(res)
  2767. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/qianbaomgr/" + res.data.FILEN + "&dotype=1&flowid=AA65")
  2768. $timeout(function () {
  2769. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  2770. }, 1000)
  2771. })
  2772. return
  2773. } else if (item.CODE == "NEWFLOWDW") {
  2774. var data = {
  2775. flowid: "AA95",
  2776. userid: self.userId,
  2777. routeinfoid: self.routeinfoid,
  2778. directionid: self.directionid,
  2779. copyrightid: self.copyrightid
  2780. }
  2781. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2782. .success(function (obj) {
  2783. var res = strToJson(s4.decryptData_CBC(obj.data));
  2784. console.log(res)
  2785. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/DWHYTCB/" + res.data.FILEN + "&dotype=1&flowid=AA95")
  2786. window.top.sp.restoreWorkLayer("#" + item.FUNCID)
  2787. })
  2788. return
  2789. } else if (item.CODE == "NEWFLOWXZ") {
  2790. var data = {
  2791. flowid: "AA10",
  2792. userid: self.userId,
  2793. routeinfoid: self.routeinfoid,
  2794. directionid: self.directionid,
  2795. copyrightid: self.copyrightid
  2796. }
  2797. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2798. .success(function (obj) {
  2799. var res = strToJson(s4.decryptData_CBC(obj.data));
  2800. console.log(res)
  2801. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/fawenbg/" + res.data.FILEN + "&dotype=1&flowid=AA10")
  2802. $timeout(function () {
  2803. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  2804. }, 1000)
  2805. })
  2806. return
  2807. }
  2808. switch (item.CODE) {
  2809. case "SAVEITEM": self.btnSave(0); break;
  2810. case "PRINTITEM": self.btnPrint(); break;
  2811. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  2812. case "MEETITEM": self.Meet(); break;
  2813. case "SENDLOG": self.RouteList(); break;
  2814. default: self.forward(item); break;
  2815. }
  2816. }
  2817. self.openDpList = function (str) {
  2818. if (self.hide("readonly", str) == true) {
  2819. return
  2820. } else {
  2821. self.filed = str;
  2822. //self.AllCheckedDp = false;
  2823. sp.layer("#DpList")
  2824. $("#DpList .sp-page").eq(0).scrollTop(0);
  2825. }
  2826. }
  2827. self.checkAllDp = function () {
  2828. self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
  2829. $.each(self.DpList[self.filed], function (index, item) {
  2830. item.checked = self.AllCheckedDp[self.filed];
  2831. })
  2832. self.submitDpList(1)
  2833. }
  2834. self.checkDpItem = function (item) {
  2835. item.checked = !item.checked;
  2836. var n = 0;
  2837. $.each(self.DpList[self.filed], function (index, item) {
  2838. if (item.checked == true) {
  2839. n++
  2840. }
  2841. })
  2842. if (n == self.DpList[self.filed].length) {
  2843. self.AllCheckedDp[self.filed] = true;
  2844. } else {
  2845. self.AllCheckedDp[self.filed] = false;
  2846. }
  2847. self.submitDpList(1)
  2848. }
  2849. self.submitDpList = function (n) {
  2850. var AllCheckedLength1 = 0;
  2851. self.selectDpList[self.filed] = [];
  2852. $.each(self.DpList[self.filed], function (index, item) {
  2853. if (item.checked == true) {
  2854. AllCheckedLength1++;
  2855. self.selectDpList[self.filed].push(item)
  2856. }
  2857. })
  2858. self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
  2859. return item.SECTION
  2860. }).join(",")
  2861. if (self.filed == "ZBCS") {
  2862. self.data.ZBCSCODE = self.selectDpList[self.filed].map(function (item) {
  2863. return item.CODE
  2864. }).join(",")
  2865. self.data.CDCS = self.data.CDCS == "" ? self.data.ZBCS : self.data.CDCS;
  2866. }
  2867. self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
  2868. self.changeFiled(self.filed)
  2869. if (n == 0) {
  2870. sp.layerhide();
  2871. }
  2872. }
  2873. self.openLWDW = function () {
  2874. var data = {
  2875. tablename: "CODE_LWDWLABEL"
  2876. }
  2877. //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2878. $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
  2879. .success(function (obj) {
  2880. //var res = strToJson(s4.decryptData_CBC(obj.data));
  2881. var res = obj;
  2882. self.getMenuBtnList(res.data);
  2883. self.LWDW = res.data[0].C_H_I_L_D_DATA;
  2884. self.LWDW.forEach(function (item) {
  2885. item.show = true;
  2886. item.C_H_I_L_D_DATA.forEach(function (item1) {
  2887. item1.checked = false;
  2888. if (item1.CNAME == self.data.LWDW) {
  2889. item1.checked = true;
  2890. }
  2891. })
  2892. })
  2893. sp.layer("#openLWDW")
  2894. })
  2895. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  2896. self.treeData = [];
  2897. })
  2898. }
  2899. self.checkItem = function (obj) {
  2900. self.LWDW.forEach(function (item) {
  2901. item.C_H_I_L_D_DATA.forEach(function (item1) {
  2902. item1.checked = false;
  2903. if (item1.ID == obj.ID) {
  2904. item1.checked=true
  2905. }
  2906. })
  2907. })
  2908. }
  2909. self.submitLWDW = function () {
  2910. self.LWDW.forEach(function (item) {
  2911. item.C_H_I_L_D_DATA.forEach(function (item1) {
  2912. if (item1.checked == true) {
  2913. self.data.LWDW = item1.CNAME;
  2914. }
  2915. })
  2916. })
  2917. console.log(self.data.LWDW)
  2918. self.changeFiled('LWDW')
  2919. sp.layerhide();
  2920. }
  2921. self.setLWDW = function (n) {
  2922. var data = {
  2923. tablename: "CODE_LWDWLABEL"
  2924. }
  2925. //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2926. $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
  2927. .success(function (obj) {
  2928. //var res = strToJson(s4.decryptData_CBC(obj.data));
  2929. var res = obj;
  2930. self.getMenuBtnList(res.data);
  2931. self.treeData = res.data;
  2932. $timeout(function () {
  2933. self.nowNodeCode = self.treeData[0].CODE;
  2934. self.nowNodeName = self.treeData[0].CNAME;
  2935. self.nowNodeID = self.treeData[0].ID;
  2936. self.treeData[0].checked = true;
  2937. if (n == 0) {
  2938. sp.layer("#setLWDW")
  2939. }
  2940. })
  2941. })
  2942. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  2943. self.treeData = [];
  2944. })
  2945. }
  2946. self.getMenuBtnList = function (data) {
  2947. data.forEach(function (item) {
  2948. item.checked = false;
  2949. item.C_H_I_L_D_DATA_L = data.length;
  2950. if (sp.isval(item.C_H_I_L_D_DATA) && item.C_H_I_L_D_DATA.length > 0) {
  2951. self.getMenuBtnList(item.C_H_I_L_D_DATA);
  2952. } else {
  2953. item.C_H_I_L_D_DATA = [];
  2954. }
  2955. })
  2956. }
  2957. self.itemNode = {
  2958. level: "",
  2959. id: "",
  2960. name: "",
  2961. code: "",
  2962. child_title: ""
  2963. }
  2964. self.rightFlag = 0;
  2965. //添加目录树形非一级
  2966. self.itemAdd = function ($item) {
  2967. self.itemNode.level = $item.LEVELS;
  2968. self.itemNode.id = 0;
  2969. self.itemNode.name = $item.CNAME;
  2970. self.itemNode.code = $item.CODE;
  2971. self.itemNode.child_title = "";
  2972. self.rightFlag = 1;
  2973. console.log(self.itemNode)
  2974. };
  2975. //修改目录
  2976. self.itemEdit = function ($item) {
  2977. self.itemNode.level = $item.LEVELS;
  2978. self.itemNode.id = $item.ID;
  2979. self.itemNode.name = $item.CNAME;
  2980. self.itemNode.code = $item.CODE;
  2981. self.itemNode.child_title = $item.CNAME;
  2982. self.rightFlag = 1;
  2983. console.log(self.itemNode)
  2984. };
  2985. //删除底稿
  2986. self.itemDelete = function ($item) {
  2987. var data = {
  2988. "id": $item.ID,
  2989. "tablename": "CODE_LWDWLABEL",
  2990. "parentid": $item.PARENTID,
  2991. "formtablename": ""
  2992. }
  2993. $http.post(apiurljs.login + "g2app/dataabase/delNode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2994. .success(function (obj) {
  2995. var res = strToJson(s4.decryptData_CBC(obj.data));
  2996. if (res.success) {
  2997. self.setLWDW(1);
  2998. self.btnCancal();
  2999. } else {
  3000. sp.dialog(res.message);
  3001. }
  3002. })
  3003. }
  3004. self.btnSetTitle = function () {
  3005. if (self.itemNode.id != 0) {
  3006. if (spngvld.submit("#LWDW")) {
  3007. let postData = {
  3008. id: self.itemNode.id,
  3009. tablename: "CODE_LWDWLABEL",
  3010. data: {
  3011. CNAME: self.itemNode.level == 2 ? self.itemNode.name : self.itemNode.child_title
  3012. }
  3013. }
  3014. $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  3015. .success(function (obj) {
  3016. var res = strToJson(s4.decryptData_CBC(obj.data));
  3017. if (res.success) {
  3018. self.setLWDW(1);
  3019. self.btnCancal();
  3020. } else {
  3021. sp.dialog(res.message);
  3022. }
  3023. })
  3024. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  3025. })
  3026. }
  3027. } else {
  3028. if (spngvld.submit("#LWDW")) {
  3029. let postData = {
  3030. tablename: "CODE_LWDWLABEL",
  3031. code: self.itemNode.code,
  3032. levels: self.itemNode.level,
  3033. cname: self.itemNode.level == 1 ? self.itemNode.name : self.itemNode.child_title,
  3034. userid: self.userId
  3035. }
  3036. $http.post(apiurljs.login + "g2app/shouwen/TreeAdd", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  3037. .success(function (obj) {
  3038. var res = strToJson(s4.decryptData_CBC(obj.data));
  3039. if (res.success) {
  3040. self.setLWDW(1);
  3041. self.btnCancal();
  3042. } else {
  3043. sp.dialog(res.message);
  3044. }
  3045. })
  3046. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  3047. })
  3048. }
  3049. }
  3050. }
  3051. self.btnCancal = function () {
  3052. self.itemNode = {
  3053. level: "",
  3054. id: "",
  3055. name: "",
  3056. code: "",
  3057. child_title: ""
  3058. }
  3059. self.rightFlag = 0;
  3060. }
  3061. //保存提交
  3062. self.btnSave = function (n) {
  3063. if (self.repeat == true) {
  3064. return
  3065. }
  3066. if (spngvld.submit(".formedit")) {
  3067. if (self.data.SFDB == "C01" && self.data.DBSX == "") {
  3068. sp.dialog("请填写督办时限!");
  3069. return
  3070. }
  3071. if (self.data.DBSX == "") {
  3072. sp.dialog("督办时限不能为空!已为您设为来文日期后15天!")
  3073. self.data.DBSX = sp.getNextDate(self.data.LWRQ, 15);
  3074. self.data.CPSX = sp.getNextDate(self.data.LWRQ, 13);
  3075. return
  3076. }
  3077. if (self.data.SWBH1 == "") {
  3078. var postData = {
  3079. swcode: self.SWBH,
  3080. cuserid: self.userId,
  3081. flowid: sp.getUrlName("flowid")
  3082. }
  3083. $http.post(apiurljs.login + "g2app/shouwen/saveSWCodeBySWCode", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  3084. .success(function (obj1) {
  3085. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  3086. if (res1.success) {
  3087. if (res1.data == "-1") {
  3088. sp.dialog("保存失败!");
  3089. return;
  3090. }
  3091. var dataArray = [];
  3092. self.data.USAGE = self.selectUSAGEs.join(",")
  3093. dataArray.push(self.data);
  3094. var data = {
  3095. ckey: "SW_ZJWWJCBD",
  3096. id: self.data.ID,
  3097. routeid: self.routeid,
  3098. routeinfoid: self.routeinfoid,
  3099. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  3100. directionid: self.directionid,
  3101. formeditid: self.formeditid,
  3102. data: JSON.stringify(dataArray)
  3103. }
  3104. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3105. .success(function (obj) {
  3106. var res = strToJson(s4.decryptData_CBC(obj.data));
  3107. if (res.code == 0) {
  3108. self.data.ID = res.data.ID;
  3109. self.routeid = res.data.ROUTEID;
  3110. self.routeinfoid = res.data.ROUTEINFOID;
  3111. self.filedChange = false;
  3112. if (n == 0) {
  3113. if (res1.data != self.SWBH.split("|")[2]) {
  3114. sp.dialog("收文编号已改变!")
  3115. } else {
  3116. sp.dialog("保存成功!");
  3117. }
  3118. $timeout(function () {
  3119. sp.dialoghide()
  3120. }, 1500)
  3121. self.getSwenList(1)
  3122. } else if (n == 1) {
  3123. self.forward(self.btnItem);
  3124. } else if (n == 2) {
  3125. self.sendAll();
  3126. } else if (n == 3) {
  3127. self.btnPrint();
  3128. }
  3129. } else {
  3130. sp.dialog(res.message)
  3131. }
  3132. })
  3133. } else {
  3134. sp.dialog(res1.message)
  3135. }
  3136. })
  3137. } else {
  3138. var dataArray = [];
  3139. self.data.USAGE = self.selectUSAGEs.join(",")
  3140. dataArray.push(self.data);
  3141. var data = {
  3142. ckey: "SW_ZJWWJCBD",
  3143. id: self.data.ID,
  3144. routeid: self.routeid,
  3145. routeinfoid: self.routeinfoid,
  3146. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  3147. directionid: self.directionid,
  3148. formeditid: self.formeditid,
  3149. data: JSON.stringify(dataArray)
  3150. }
  3151. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3152. .success(function (obj) {
  3153. var res = strToJson(s4.decryptData_CBC(obj.data));
  3154. if (res.code == 0) {
  3155. self.data.ID = res.data.ID;
  3156. self.routeid = res.data.ROUTEID;
  3157. self.routeinfoid = res.data.ROUTEINFOID;
  3158. self.filedChange = false;
  3159. if (n == 0) {
  3160. sp.dialog("保存成功!");
  3161. $timeout(function () {
  3162. sp.dialoghide()
  3163. }, 1500)
  3164. self.getSwenList(1)
  3165. } else if (n == 1) {
  3166. self.forward(self.btnItem);
  3167. } else if (n == 2) {
  3168. self.sendAll();
  3169. } else if (n == 3) {
  3170. self.btnPrint();
  3171. }
  3172. } else {
  3173. sp.dialog(res.message)
  3174. }
  3175. })
  3176. }
  3177. }
  3178. }
  3179. //打印
  3180. self.btnPrint = function () {
  3181. if (self.filedChange == true) {
  3182. self.btnSave(3)
  3183. } else {
  3184. // 创建隐藏的可下载链接
  3185. var eleLink = document.createElement('a');
  3186. eleLink.download = "";
  3187. eleLink.style.display = 'none';
  3188. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban33.ftl&tablename=SW_ZJWWJCBD&outfilepath=/tmp/行政公文.wps&printdate=LWRQ,DBSX,ZBRQ&routeinfoid=" + self.routeinfoid));
  3189. // 触发点击
  3190. document.body.appendChild(eleLink);
  3191. eleLink.click();
  3192. // 然后移除
  3193. document.body.removeChild(eleLink);
  3194. }
  3195. }
  3196. /*综合打印*/
  3197. self.printFiled = 1;
  3198. self.btnPrint1 = function () {
  3199. if (self.filedChange == true) {
  3200. self.btnSave(3)
  3201. } else {
  3202. sp.layer("#print")
  3203. }
  3204. }
  3205. self.printSubmit = function () {
  3206. if (self.printFiled == 1) {
  3207. var templatefilename = "moban33"
  3208. } else if (self.printFiled == 2) {
  3209. var templatefilename = "mobanoption"
  3210. } else {
  3211. var templatefilename = "moban33_all"
  3212. }
  3213. var data = {
  3214. templatefilename: templatefilename + ".ftl",
  3215. outfilepath: "/tmp/行政公文" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  3216. routeinfoid: self.routeinfoid,
  3217. tablename: "SW_ZJWWJCBD",
  3218. printtype: self.printFiled,
  3219. printdate: "LWRQ,DBSX,ZBRQ"
  3220. }
  3221. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3222. .success(function (obj) {
  3223. var res = strToJson(s4.decryptData_CBC(obj.data));
  3224. if (self.deviceType == "pad") {
  3225. window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
  3226. } else {
  3227. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  3228. }
  3229. })
  3230. sp.layerhide()
  3231. }
  3232. //签写意见编辑状态
  3233. self.opinion = {
  3234. BGSNBYJ: false,
  3235. BGSNBYJImg: false,
  3236. WLDPS: false,
  3237. WLDPSImg: false,
  3238. FGLDBJQR: false,
  3239. FGLDBJQRImg: false,
  3240. CBCSCLQK: false,
  3241. CBCSCLQKImg: false,
  3242. nulla: false
  3243. }
  3244. self.YJ = {
  3245. BGSNBYJ: [],
  3246. BGSNBYJSTATUS: false,
  3247. WLDPS: [],
  3248. WLDPSSTATUS: false,
  3249. FGLDBJQR: [],
  3250. FGLDBJQRSTATUS: false,
  3251. CBCSCLQK: [],
  3252. CBCSCLQKSTATUS: false,
  3253. nulla: [],
  3254. nullaSTATUS: false
  3255. }
  3256. //意见(下表)
  3257. self.openOptionList = function () {
  3258. if (self.routeinfoid == 0 && self.routeid == 0) {
  3259. sp.dialog("请先保存!")
  3260. return;
  3261. }
  3262. if (self.dotype == 0) {
  3263. return
  3264. }
  3265. if (self.opinion.nulla == true) {
  3266. return;
  3267. }
  3268. self.nulla = "";
  3269. self.opinion.nulla = true;
  3270. }
  3271. self.openOptionList1 = function () {
  3272. self.openOptionList()
  3273. self.activeOpinion = null;
  3274. self.showBottom = "opinion";
  3275. self.YJ.nulla.forEach(function (item) {
  3276. if (item.ROUTEID == self.routeid) {
  3277. self.activeOpinion = item;
  3278. self.nulla = item.OPINION;
  3279. }
  3280. })
  3281. $(".toggle").trigger("click")
  3282. }
  3283. self.closeOptionList = function () {
  3284. self.opinion.nulla = false;
  3285. self.activeOpinion = null;
  3286. $(".toggle").trigger("click")
  3287. }
  3288. self.submitOptionList = function () {
  3289. var data = {
  3290. cmanid: self.userId,
  3291. routeinfoid: self.routeinfoid,
  3292. routeid: self.routeid,
  3293. tableid: "SW_ZJWWJCBD",
  3294. colid: self.opiniontype,
  3295. opiniontype: self.opiniontype == "nulla" ? 99 : 0,
  3296. cresult: "",
  3297. opinion: self.nulla,
  3298. opinionimage: ""
  3299. }
  3300. if (self.opiniontype == "BGSNBYJ") {
  3301. data.cmans = "王勇";
  3302. }
  3303. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3304. .success(function (obj) {
  3305. var res = strToJson(s4.decryptData_CBC(obj.data));
  3306. if (res.success == true) {
  3307. self.getOpinion1();
  3308. self.opinion.nulla = false;
  3309. $(".toggle").trigger("click")
  3310. } else {
  3311. sp.dialog(res.message)
  3312. }
  3313. })
  3314. }
  3315. self.changeOptionList = function (item) {
  3316. self.showBottom = "opinion";
  3317. self.opinion.nulla = true;
  3318. self.nulla = item.OPINION;
  3319. self.activeOpinion = item;
  3320. $(".toggle").trigger("click")
  3321. }
  3322. //意见附件(下表)
  3323. self.uploading1 = false;
  3324. self.upload1 = function () {
  3325. $('#fileupload1').fileupload({
  3326. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  3327. dataType: 'json',
  3328. beforeSend: function (xhr, data) {
  3329. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  3330. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  3331. + ",routeid=" + self.routeid + ",tableid=SW_ZJWWJCBD,colid=" + self.opiniontype));
  3332. },
  3333. // 上传完成后的执行逻辑
  3334. done: function (e, data) {
  3335. self.uploading1 = false;
  3336. self.getOpinion1()
  3337. }
  3338. })
  3339. }
  3340. //意见附件(上表)
  3341. self.uploading2 = false;
  3342. self.upload2 = function (str) {
  3343. $('#fileupload2').fileupload({
  3344. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  3345. dataType: 'json',
  3346. beforeSend: function (xhr, data) {
  3347. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  3348. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  3349. + ",routeid=" + self.routeid + ",tableid=SW_ZJWWJCBD,colid=" + str));
  3350. },
  3351. // 上传完成后的执行逻辑
  3352. done: function (e, data) {
  3353. self.uploading1 = false;
  3354. self.getOpinion1()
  3355. }
  3356. })
  3357. }
  3358. //下载意见表附件
  3359. self.downLoadOption = function (item) {
  3360. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  3361. }
  3362. //删除意见表附件
  3363. self.deleteOptionFile = function (file) {
  3364. var data = {
  3365. routeid: file.ROUTEID,
  3366. tableid: "SW_ZJWWJCBD",
  3367. colid: file.COLID,
  3368. fileid: file.FILEID
  3369. };
  3370. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3371. .success(function (obj) {
  3372. var res = strToJson(s4.decryptData_CBC(obj.data));
  3373. sp.dialoghide();
  3374. if (res.success) {
  3375. self.getOpinion1();
  3376. } else {
  3377. sp.dialog("删除失败,请联系管理员!");
  3378. }
  3379. });
  3380. }
  3381. //删除意见
  3382. self.Dopinion = function (item) {
  3383. var data = {
  3384. cmanid: self.userId,
  3385. routeid: self.routeid,
  3386. tableid: "SW_ZJWWJCBD",
  3387. colid: item.COLID,
  3388. }
  3389. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3390. .success(function (obj) {
  3391. var res = strToJson(s4.decryptData_CBC(obj.data));
  3392. if (res.success == true) {
  3393. self.getOpinion1();
  3394. self.nulla = "";
  3395. self.activeOpinion = null;
  3396. self.changeFiled(item.COLID)
  3397. } else {
  3398. sp.dialog(res.message)
  3399. }
  3400. })
  3401. }
  3402. self.phraseText = "";//添加常用语
  3403. self.phraseList = []//常用语列表
  3404. //获取常用语库
  3405. self.phrase = function (colid) {
  3406. sp.layer("#phrase");
  3407. self.colid = colid;
  3408. self.getPhrase();
  3409. }
  3410. //添加常用语到常用语库
  3411. self.Aphrase = function () {
  3412. if (self.phraseText == "") {
  3413. return;
  3414. }
  3415. var data = {
  3416. cmanid: self.userId,
  3417. tableid: "SW_ZJWWJCBD",
  3418. colid: self.colid,
  3419. contents: self.phraseText
  3420. }
  3421. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3422. .success(function (obj) {
  3423. var res = strToJson(s4.decryptData_CBC(obj.data));
  3424. if (res.success == true) {
  3425. self.phraseText = "";
  3426. self.getPhrase();
  3427. } else {
  3428. sp.dialog(res.message)
  3429. }
  3430. })
  3431. }
  3432. //获取常用语库
  3433. self.getPhrase = function () {
  3434. var data = {
  3435. cmanid: self.userId,
  3436. tableid: "SW_ZJWWJCBD",
  3437. colid: self.colid
  3438. }
  3439. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3440. .success(function (obj) {
  3441. var res = strToJson(s4.decryptData_CBC(obj.data));
  3442. self.phraseList = res.data;
  3443. self.phraseSelect = self.phraseList[0].CONTENTS;
  3444. })
  3445. }
  3446. //从常用语库删除
  3447. self.Dphrase = function () {
  3448. var id = null;
  3449. $.each(self.phraseList, function (index, item) {
  3450. if (item.CONTENTS == self.phraseSelect) {
  3451. id = item.ID;
  3452. }
  3453. })
  3454. var data = {
  3455. id: id
  3456. }
  3457. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3458. .success(function (obj) {
  3459. var res = strToJson(s4.decryptData_CBC(obj.data));
  3460. self.getPhrase();
  3461. })
  3462. }
  3463. //常用语确认为意见
  3464. self.btnPhrase = function () {
  3465. self.nulla = self.phraseSelect;
  3466. sp.layerhide();
  3467. }
  3468. self.selectUSAGE = function (item) {
  3469. item.checked = !item.checked;
  3470. self.selectUSAGEs = [];
  3471. $.each(self.USAGE, function (index, item) {
  3472. if (item.checked == true) {
  3473. self.selectUSAGEs.push(item.CODE)
  3474. }
  3475. })
  3476. self.changeFiled('USAGE')
  3477. }
  3478. //发生修改
  3479. self.changeFiled = function (str) {
  3480. self.filedChange = true;
  3481. if (self.data.SFDB != "C01") {
  3482. self.data.DBLX = "";
  3483. self.data.SWQXLX = "办理";
  3484. } else {
  3485. self.data.SWQXLX = "督办";
  3486. //self.data.DBLX = self.DBTYPE[0].CODE;
  3487. }
  3488. if(str == "DBSX"){
  3489. let objDate = new Date()
  3490. let DBSXDate = new Date(self.data.DBSX)
  3491. let dif_t = DBSXDate.getTime() - objDate.getTime();
  3492. let Day_dif_t = dif_t/(1000*60*60*24)
  3493. if(Day_dif_t>10){
  3494. self.data.CPSX = sp.getNextDate(self.data.DBSX, -2);
  3495. }else{
  3496. self.data.CPSX = sp.getNextDate(self.data.DBSX, -1);
  3497. }
  3498. }
  3499. }
  3500. //验证是否重复
  3501. self.repeat = false;
  3502. self.verify = function (str) {
  3503. if (self.data[str] == "") { return; }
  3504. var data = {
  3505. tablename: "SW_ZJWWJCBD",
  3506. colums: "*",
  3507. order: "ID desc",
  3508. sqlwhere: {},
  3509. sqlinwhere: "",
  3510. sqllikewhere: ""
  3511. }
  3512. data.sqlwhere[str] = self.data[str]
  3513. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3514. .success(function (obj) {
  3515. var res = strToJson(s4.decryptData_CBC(obj.data));
  3516. if (res.data.length > 0 && self.data.ID != res.data[0].ID) {
  3517. self.repeat = true;
  3518. sp.dialog("标题已存在,请修改后重试!")
  3519. } else {
  3520. self.repeat = false;
  3521. }
  3522. })
  3523. }
  3524. //转发
  3525. self.forward = function (obj) {
  3526. self.btnItem = obj;
  3527. if (self.filedChange == true) {
  3528. self.btnSave(1)
  3529. } else {
  3530. $("#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=shouwenbg")
  3531. sp.layer("#forward")
  3532. }
  3533. }
  3534. //查看流转记录
  3535. self.RouteList = function () {
  3536. if (self.deviceType == "pad") {
  3537. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  3538. } else {
  3539. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  3540. }
  3541. //var data = {
  3542. // directionid: self.directionid,
  3543. // userid: self.userId,
  3544. // routeid: self.routeid,
  3545. // routeinfoid: self.routeinfoid,
  3546. //}
  3547. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3548. //.success(function (obj) {
  3549. // var res = strToJson(s4.decryptData_CBC(obj.data));
  3550. // self.routeList = res.data;
  3551. // $.each(self.routeList, function (index, item) {
  3552. // item.mainUser = [];
  3553. // item.copyUsers = [];
  3554. // $.each(item.USERS, function (index1, item1) {
  3555. // if (item1.KIND == 0) {
  3556. // item.mainUser.push(item1.USERNAME);
  3557. // } else {
  3558. // item.copyUsers.push(item1.USERNAME);
  3559. // }
  3560. // })
  3561. // item.mainUser = item.mainUser.join(",");
  3562. // item.copyUsers = item.copyUsers.join(",");
  3563. // })
  3564. // setTimeout(function (item) {
  3565. // sp.layer("#RouteList");
  3566. // }, 100);
  3567. //})
  3568. }
  3569. self.reSize = function (n) {
  3570. var leftbox = document.getElementsByClassName("page-item")[n - 1];
  3571. var rightbox = document.getElementsByClassName("page-item")[n];
  3572. var line = document.getElementsByClassName("iframe-border-right")[n - 1];
  3573. document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
  3574. $(".mousemove").show()
  3575. var leftboxW = leftbox.clientWidth;//leftbox.style.width.slice(0, leftbox.style.width.length - 2);
  3576. var rightboxW = rightbox.clientWidth;//rightbox.style.width.slice(0, rightbox.style.width.length - 2);
  3577. var x = event.pageX - line.offsetLeft;
  3578. document.addEventListener("mousemove", boxMove)
  3579. function boxMove(event) {
  3580. if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
  3581. //$(".leftBox").children().not(".iframe-border-right").hide()
  3582. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
  3583. //$(".rightBox").children().not(".iframe-border-right").hide()
  3584. } else {
  3585. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  3586. leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
  3587. //$(".leftBox").children().not(".iframe-border-right").show()
  3588. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  3589. //rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
  3590. //$(".rightBox").children().not(".iframe-border-right").show()
  3591. }
  3592. }
  3593. document.addEventListener("mouseup", function () {
  3594. $(".mousemove").hide()
  3595. document.removeEventListener("mousemove", boxMove)
  3596. })
  3597. })
  3598. }
  3599. self.reSizeRow = function () {
  3600. var bodybox = document.getElementById("bodyDiv");
  3601. var topbox = document.getElementById("topDiv");
  3602. var bottombox = document.getElementById("bottomDiv");
  3603. var line = document.getElementById("lineDiv");
  3604. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  3605. $(".mousemove").show()
  3606. var bodyboxH = bodybox.clientHeight;
  3607. var topboxH = topbox.clientHeight;
  3608. var bottomboxH = bottombox.clientHeight;
  3609. //var y = event.pageY - line.offsetTop;
  3610. var y = event.pageY - line.clientHeight;
  3611. document.addEventListener("mousemove", boxMove)
  3612. function boxMove(event) {
  3613. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  3614. //
  3615. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  3616. //
  3617. } else {
  3618. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  3619. topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  3620. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 45 + "px";
  3621. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 75 + "px";
  3622. }
  3623. }
  3624. document.addEventListener("mouseup", function () {
  3625. $(".mousemove").hide()
  3626. document.removeEventListener("mousemove", boxMove)
  3627. })
  3628. })
  3629. }
  3630. ////头部关键字搜索---20230905
  3631. self.headBtnSearchKeyword = "";
  3632. self.headSearchResult = [];
  3633. self.headSearchResult_view = false;
  3634. self.headBtnSearch = function () {
  3635. if (sp.isval(self.headBtnSearchKeyword)) {
  3636. self.headSearchResult = [];
  3637. var data = {
  3638. "url": "/basic/api/StatSelect/selectCodeList",
  3639. "data": { "keyWord": self.headBtnSearchKeyword }
  3640. }
  3641. //console.log(JSON.stringify(data));
  3642. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  3643. .success(function (obj) {
  3644. var res = strToJson(s4.decryptData_CBC(obj.data));
  3645. //console.log(JSON.stringify(res.data));
  3646. self.headSearchResult = res.data.build;
  3647. if (sp.isval(self.headSearchResult)) {
  3648. self.headSearchResult_view = true;
  3649. } else {
  3650. self.headSearchResult_view = false;
  3651. }
  3652. })
  3653. } else {
  3654. self.headSearchResult_view = false;
  3655. }
  3656. };
  3657. self.headKeywordPage = function (itemdata) {
  3658. var get_token = localStorage.getItem("main-token");
  3659. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  3660. sp.openNewWindow(set_url, '一张图');
  3661. self.headSearchResult_view = false;
  3662. };
  3663. self.onePic = function () {
  3664. sp.openNewWindow(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  3665. }
  3666. $scope.closeToggle = function () {
  3667. $timeout(function () {
  3668. self.opinion.nulla = false;
  3669. self.activeOpinion = null;
  3670. })
  3671. }
  3672. //头部下滚冻结
  3673. $(function () {
  3674. //页面高度撑满
  3675. setTimeout(function () {
  3676. $(".formedit").css("height", $(window).height() - 70)
  3677. //$("#iframe_book").css("height", $(window).height() - 135)
  3678. $(".iframe-border-right").css("height", $(window).height() - 34)
  3679. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  3680. }, 1)
  3681. })
  3682. }])
  3683. app.directive('treeView', [function () {
  3684. return {
  3685. restrict: 'EA',
  3686. templateUrl: '/treeView.html',
  3687. scope: {
  3688. treeData: '=',///声明数据
  3689. textField: '@',
  3690. itemAdd: '&', ///声明新增变量
  3691. itemEdit: '&',///声明修改变量
  3692. itemCheck: '&',///声明修改变量
  3693. itemDelete: '&',///声明修改变量
  3694. itemUp: '&',
  3695. itemDown: '&'
  3696. },
  3697. controller: ['$scope', function ($scope) {
  3698. $scope.itemExpended = function (item, $event) {
  3699. item.$$isExpend = !item.$$isExpend;
  3700. $event.stopPropagation();
  3701. };
  3702. ///展开折叠图标设置
  3703. $scope.getItemIcon = function (item) {
  3704. var isEnd = $scope.isEnd(item);
  3705. if (isEnd) {
  3706. return 'fa fa-paper-plane-o';
  3707. }
  3708. return item.$$isExpend ? 'fa fa-plus-square-o' : 'fa fa-minus-square-o';
  3709. };
  3710. ///判断是否是最后一级菜单
  3711. $scope.isEnd = function (item) {
  3712. return !item.C_H_I_L_D_DATA || !item.C_H_I_L_D_DATA.length;
  3713. };
  3714. ///事件调用返回
  3715. $scope.warpCallback = function (callback, item, $index, $event) {
  3716. ($scope[callback] || angular.noop)({
  3717. $item: item,
  3718. $index: $index,
  3719. $event: $event
  3720. });
  3721. };
  3722. }]
  3723. };
  3724. }]);
  3725. app.directive("repeatFinish", function () {
  3726. return {
  3727. link: function (scope) {
  3728. if (scope.$last == true) {
  3729. $(".toggle").trigger("click")
  3730. }
  3731. }
  3732. };
  3733. });
  3734. app.directive("spCheckboxBlueItem", function () {
  3735. return {
  3736. restrict: "A",
  3737. link: function (scope, elem, attrs) {
  3738. if (!scope == false) {
  3739. spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
  3740. }
  3741. }
  3742. }
  3743. });
  3744. app.filter('trustHtml', function ($sce) {
  3745. return function (input) {
  3746. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  3747. };
  3748. });
  3749. function showRight(e) {
  3750. if ($(e).children(".fa-angle-left").is(":hidden")) {
  3751. $(".leftBox").css("width", "99.5%");
  3752. $("#iframe_book").css("width", "100%")
  3753. $(".rightBox").css("width", "0%");
  3754. $(".rightBox").hide()
  3755. $(e).children(".fa-angle-left").show()
  3756. $(e).children(".fa-angle-right").hide()
  3757. } else {
  3758. $(".leftBox").css("width", "69.5%");
  3759. $("#iframe_book").css("width", "100%")
  3760. $(".rightBox").css("width", "30%");
  3761. $(".rightBox").show()
  3762. $(e).children(".fa-angle-left").hide()
  3763. $(e).children(".fa-angle-right").show()
  3764. }
  3765. }
  3766. function showToggle(e) {
  3767. document.getElementById("selectDiv").style.top = e.style.top;
  3768. //document.getElementById("selectDiv").toggle();
  3769. $(e).children().toggle()
  3770. $(e).next().toggle()
  3771. }
  3772. function toggleYJL(e) {
  3773. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  3774. $(e).parent().css("height", 320)
  3775. } else {
  3776. $(e).parent().css("height", 10)
  3777. angular.element(document.getElementById("app")).scope().closeToggle()
  3778. }
  3779. $(e).children().toggle()
  3780. }
  3781. function toggleForm(e) {
  3782. $(e).children().toggle()
  3783. $(".toggleForm").toggle()
  3784. }
  3785. //文字不可被选中
  3786. //document.body.onselectstart = function () {
  3787. // return true;
  3788. //}