formedit.js 115 KB

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