yuguidang.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.routeinfoid = sp.getUrlName("routeinfoid");
  11. self.id = sp.getUrlName("id");
  12. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  13. self.lastReturn = sp.getUrlName("lastReturn")
  14. self.info = JSON.parse($.cookie("GlWorkPlatform-gdsp"))
  15. self.guidangList = []
  16. self.show = 1;
  17. var postCfg = {
  18. headers: {
  19. 'Content-Type': 'application/json',
  20. 'Authorization': "Bearer " + self.get_AccessToken
  21. }
  22. };
  23. self.goBack = function () {
  24. window.location.href = "ygdlist.html?lastReturnPageno=" + sp.getUrlName("lastReturnPageno")
  25. }
  26. //初始化右上角按钮
  27. self.buttonList = []
  28. self.readonly = {
  29. LC: false,
  30. BT: false,
  31. WH: false,
  32. GDCS: false,
  33. GDRY: false,
  34. CSYJ: false,
  35. BZ: false
  36. }
  37. self.getDP = function () {
  38. var data = {
  39. userid: self.userId
  40. }
  41. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  42. .success(function (obj) {
  43. var res = strToJson(s4.decryptData_CBC(obj.data));
  44. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  45. self.userDpCode = res.data.length == 0 ? "" : res.data[0].INSTCODE;
  46. self.userDpId = res.data.length == 0 ? "" : res.data[0].INSTCODEID;
  47. console.log(res.data[0])
  48. self.getGDBM();
  49. })
  50. }
  51. self.getDP()
  52. self.getGDBM = function () {
  53. var data = {
  54. unitid: "AA"
  55. }
  56. $http.post(apiurljs.login + "g2app/dataabase/queryDanganSectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  57. .success(function (obj) {
  58. var res = strToJson(s4.decryptData_CBC(obj.data));
  59. self.GDBM = res.data;
  60. if (self.id == 0) {
  61. self.getWENHAO();
  62. } else {
  63. self.getData();
  64. }
  65. })
  66. }
  67. self.getWENHAO = function () {
  68. var data = {
  69. routeinfoid: self.routeinfoid,
  70. flowid:self.info.FLOWID
  71. }
  72. $http.post(apiurljs.login + "g2app/DangAn/queryDataByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  73. .success(function (obj) {
  74. var res = strToJson(s4.decryptData_CBC(obj.data));
  75. if (res.data.length > 0) {
  76. self.WENHAO = res.data[0].WENHAO;
  77. } else {
  78. self.WENHAO = "";
  79. }
  80. self.getNGRQ();
  81. })
  82. }
  83. self.getNGRQ = function () {
  84. var data = {
  85. tablename: self.info.TABLENAME,
  86. colums: "*",
  87. order: "ID",
  88. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  89. sqlinwhere: "",
  90. sqllikewhere: ""
  91. }
  92. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  93. .success(function (obj) {
  94. var res = strToJson(s4.decryptData_CBC(obj.data));
  95. if (res.data.length > 0) {
  96. switch (self.info.TABLENAME) {
  97. case "SW_LDPSCBD": self.NGRQ = res.data[0].LWRQ; break;//领导批示
  98. case "SW_ZJWWJCBD": self.NGRQ = res.data[0].LWRQ; break;//一般收文
  99. case "FW_ZB": self.NGRQ = res.data[0].NGSJ; break;//专报
  100. case "FW_GFXWJXGMRBM": self.NGRQ = res.data[0].NGRQ; break;//规范性文件
  101. case "FW_SPJ": self.NGRQ = res.data[0].NGSJ; break;//审批件
  102. case "FW_WFH": self.NGRQ = res.data[0].NGSJ; break;//委发函
  103. case "FW_ZSWSXW": self.NGRQ = res.data[0].RGRQ; break;//正式文-上行文
  104. case "FW_ZSWPXXW": self.NGRQ = res.data[0].RGRQ; break;//正式文-平、下行文
  105. case "SX_QBD": self.NGRQ = res.data[0].RQ; break;//签报
  106. }
  107. }
  108. self.getData();
  109. })
  110. }
  111. self.getLSH = function () {
  112. var data = {
  113. tablename: "DA_YGD",
  114. colums: "*",
  115. order: "ITEM_NO desc",
  116. sqlwhere: { YEAR_CODE: self.data.YEAR_CODE, FILING_DEPT: self.data.FILING_DEPT, RETENTION_PERIOD: self.data.RETENTION_PERIOD },
  117. sqlinwhere: "",
  118. sqllikewhere: ""
  119. }
  120. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  121. .success(function (obj) {
  122. var res = strToJson(s4.decryptData_CBC(obj.data));
  123. if (res.data.length > 0) {
  124. self.data.ITEM_NO = res.data[0].ITEM_NO * 1 + 1;
  125. } else {
  126. self.data.ITEM_NO = 1
  127. }
  128. self.setDangHao();
  129. })
  130. }
  131. self.setDangHao = function () {
  132. if (self.data.ITEM_NO == 0 || self.data.ITEM_NO == "" || self.data.ITEM_NO == null) {
  133. self.data.ITEM_NO = 1
  134. }
  135. if (self.data.ITEM_NO.toString().indexOf(".") > -1) {
  136. self.data.ITEM_NO = parseInt(self.data.ITEM_NO.toString().slice(0, self.data.ITEM_NO.toString().indexOf(".")))
  137. }
  138. self.data.OFFICE_ARCHIVAL_CODE = "X154-WS·" + self.data.YEAR_CODE + "-" + self.data.RETENTION_PERIOD + "-" + self.userDpCode + "-" + (self.data.ITEM_NO >= 1000 ? self.data.ITEM_NO : self.data.ITEM_NO >= 100 ? "0" + self.data.ITEM_NO : self.data.ITEM_NO >= 10 ? "00" + self.data.ITEM_NO : "000" + self.data.ITEM_NO);
  139. }
  140. self.getITEMNO = function (cyear,deptcode,period) {
  141. var data = {
  142. cyear: cyear,
  143. deptcode:deptcode,
  144. period:period
  145. }
  146. $http.post(apiurljs.login + "g2app/DangAn/queryDataByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  147. .success(function (obj) {
  148. var res = strToJson(s4.decryptData_CBC(obj.data));
  149. if (res.data.length > 0) {
  150. self.WENHAO = res.data[0].WENHAO;
  151. self.WENRQ = res.data[0].WENRQ;
  152. } else {
  153. self.WENHAO = "";
  154. self.WENRQ = "";
  155. }
  156. self.getData();
  157. })
  158. }
  159. //获取数据
  160. self.getData = function () {
  161. var data = {
  162. tablename: "DA_YGD",
  163. colums: "*",
  164. order: "ID",
  165. sqlwhere: { GLROUTEINFOID: self.routeinfoid },
  166. sqlinwhere: "",
  167. sqllikewhere: ""
  168. }
  169. if (self.lastReturn == "list") {
  170. data.sqlwhere = { ID: sp.getUrlName("ID") }
  171. }
  172. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  173. .success(function (obj) {
  174. var res = strToJson(s4.decryptData_CBC(obj.data));
  175. if (res.data[0]) {
  176. self.data = {
  177. ID: res.data[0].ID,
  178. FONDS_CODE: res.data[0].FONDS_CODE,
  179. SERIES_CODE: res.data[0].SERIES_CODE,
  180. FILE_CODE: res.data[0].FILE_CODE,
  181. TITLE_PROPER: res.data[0].TITLE_PROPER,
  182. DATE_OF_CREATION: sp.format(res.data[0].DATE_OF_CREATION),
  183. OA_ID: res.data[0].OA_ID,
  184. OFFICE_ARCHIVAL_CODE: res.data[0].OFFICE_ARCHIVAL_CODE,
  185. AUTHOR: res.data[0].AUTHOR,
  186. AMOUNT_OF_PAGES: res.data[0].AMOUNT_OF_PAGES,
  187. YEAR_CODE: res.data[0].YEAR_CODE,
  188. ITEM_NO: parseInt(res.data[0].ITEM_NO),
  189. ITEM_COUNT: res.data[0].ITEM_COUNT,
  190. RETENTION_PERIOD: res.data[0].RETENTION_PERIOD,
  191. FILING_DEPT: res.data[0].FILING_DEPT,
  192. FILING_DEPTID: res.data[0].FILING_DEPTID,
  193. FILING_DEPTCODE: res.data[0].FILING_DEPTCODE,
  194. FILENAME: res.data[0].FILENAME,
  195. ZHANGTOP: res.data[0].ZHANGTOP,
  196. ZHANGLEFT: res.data[0].ZHANGLEFT,
  197. ZHANGTOP1: res.data[0].ZHANGTOP,
  198. ZHANGLEFT1: res.data[0].ZHANGLEFT,
  199. GLROUTEINFOID: res.data[0].GLROUTEINFOID,
  200. STATUS: res.data[0].STATUS
  201. }
  202. } else {
  203. self.data = {
  204. ID: 0,
  205. FONDS_CODE: "X154",
  206. SERIES_CODE: "WS",
  207. FILE_CODE: self.WENHAO,
  208. TITLE_PROPER: self.info.TITLE,
  209. DATE_OF_CREATION: sp.format(self.NGRQ),
  210. OA_ID: "",
  211. OFFICE_ARCHIVAL_CODE:"",
  212. AUTHOR:"天津市住房和城乡建设委员会",
  213. AMOUNT_OF_PAGES:"",
  214. YEAR_CODE: sp.currentYear(),
  215. ITEM_NO: "",
  216. ITEM_COUNT:"1",
  217. RETENTION_PERIOD:"D10",
  218. FILING_DEPT: self.userDpName,
  219. FILING_DEPTID: self.userDpId,
  220. FILING_DEPTCODE: self.userDpCode,
  221. FILENAME: "",
  222. ZHANGTOP: "430",
  223. ZHANGLEFT: "750",
  224. ZHANGTOP1: "430",
  225. ZHANGLEFT1: "750",
  226. GLROUTEINFOID: self.routeinfoid,
  227. CDATE: sp.getLocalDate(),
  228. STATUS:0
  229. }
  230. self.getLSH()
  231. }
  232. console.log(self.data)
  233. self.gdzFlag = self.data.ZHANGTOP!=-1
  234. self.data.STATUS1 = self.data.STATUS == 0 ? "档案已创建" : self.data.STATUS == 1 ? "已发送档案系统" : "档案系统退回";
  235. self.getYGD()
  236. })
  237. }
  238. self.getYGD = function () {
  239. var data = {
  240. routeinfoid: self.routeinfoid,
  241. converttype: "3"
  242. }
  243. if (self.lastReturn == "list") {
  244. data.routeinfoid = self.data.GLROUTEINFOID
  245. }
  246. $http.post(apiurljs.login + "g2app/DangAn/queryYJYGDWenJianList",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  247. .success(function (obj) {
  248. var res = strToJson(s4.decryptData_CBC(obj.data));
  249. self.fileList = res.data[0].DATA;
  250. self.getGDFile();
  251. })
  252. }
  253. self.getGDFile = function () {
  254. var data = {
  255. tablename: "DA_YJYGDFILEATTACH",
  256. colums: "*",
  257. order: "SORTID",
  258. sqlwhere: { ROUTEINFOID: self.data.ID },
  259. sqlinwhere: "",
  260. sqllikewhere: ""
  261. }
  262. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  263. .success(function (obj) {
  264. var res = strToJson(s4.decryptData_CBC(obj.data));
  265. res.data.forEach(function (item) {
  266. if (item.ATTACHTYPE == "YJYGDGDZ_PDF") {
  267. self.seeFiles(item, 1)
  268. }
  269. //if (item.ATTACHTYPE == "YJYGDMERGE_PDF") {
  270. // self.seeFiles(item, 1)
  271. //}
  272. })
  273. self.guidangList = res.data.filter(function (item) { return item.ATTACHTYPE == "" });
  274. self.fileList.forEach(function (item) {
  275. var n = 0;
  276. self.guidangList.forEach(function (item1) {
  277. if (item.WENJIANMING == item1.FILENAMES) {
  278. item.show = false;
  279. n++
  280. }
  281. })
  282. if (n == 0) {
  283. item.show = true;
  284. }
  285. })
  286. $("#table_tbody").sortable({
  287. cursor: "move",
  288. stop: function (event, ui) {
  289. var index = 1;
  290. $("#table_tbody").children().each(function (x) {
  291. $(this).attr("index", index)
  292. $(this).children().eq(0).html(index)
  293. index++
  294. })
  295. }
  296. }).disableSelection();
  297. })
  298. }
  299. //保存提交
  300. self.btnSave = function () {
  301. if (spngvld.submit(".formedit")) {
  302. var data = {
  303. tablename: "DA_YGD",
  304. id: self.data.ID,
  305. data: {
  306. FONDS_CODE: self.data.FONDS_CODE,
  307. SERIES_CODE: self.data.SERIES_CODE,
  308. FILE_CODE: self.data.FILE_CODE,
  309. TITLE_PROPER: self.data.TITLE_PROPER,
  310. DATE_OF_CREATION: self.data.DATE_OF_CREATION,
  311. OA_ID: self.data.OA_ID,
  312. OFFICE_ARCHIVAL_CODE: self.data.OFFICE_ARCHIVAL_CODE == "" ? danghao(self.data) : self.data.OFFICE_ARCHIVAL_CODE,
  313. AUTHOR: self.data.AUTHOR,
  314. AMOUNT_OF_PAGES: self.data.AMOUNT_OF_PAGES,
  315. YEAR_CODE: self.data.YEAR_CODE,
  316. ITEM_NO: self.data.ITEM_NO,
  317. ITEM_COUNT: self.data.ITEM_COUNT,
  318. RETENTION_PERIOD: self.data.RETENTION_PERIOD,
  319. FILING_DEPT: self.data.FILING_DEPT,
  320. FILING_DEPTID: self.data.FILING_DEPTID,
  321. FILING_DEPTCODE: self.data.FILING_DEPTCODE,
  322. FILENAME: self.data.FILENAME,
  323. ZHANGTOP: self.data.ZHANGTOP,
  324. ZHANGLEFT: self.data.ZHANGLEFT,
  325. GLROUTEINFOID: self.data.GLROUTEINFOID,
  326. CDATE: self.data.CDATE,
  327. STATUS: self.data.STATUS
  328. }
  329. }
  330. console.log(data)
  331. $http.post(apiurljs.login + "g2app/dataabase/saveChildData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  332. .success(function (obj) {
  333. var res = strToJson(s4.decryptData_CBC(obj.data));
  334. if (res.code == 0) {
  335. self.id = res.data.ID;
  336. self.getData()
  337. self.show = 2;
  338. } else {
  339. sp.dialog(res.message)
  340. }
  341. })
  342. }
  343. }
  344. self.addFile = function (obj) {
  345. var data = {
  346. tablename: "DA_YJYGDFILEATTACH",
  347. data: {
  348. FILENAMES: obj.WENJIANMING,
  349. FILEOLDNAME: obj.WENJIANMING,
  350. FILEEXT: obj.PREFIX,
  351. FILESIZE: "",
  352. FILEDATE: obj.RIQI,
  353. FILEID: "",
  354. FILEURL: obj.URL,
  355. FILETBURL: "",
  356. ATTACHTYPE: "",
  357. FILECDATE: "",
  358. CONVERTID: "",
  359. FILEPAGE: obj.YESHU,
  360. ROUTEINFOID: self.data.ID
  361. }
  362. }
  363. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  364. .success(function (obj) {
  365. var res = strToJson(s4.decryptData_CBC(obj.data));
  366. if (res.success) {
  367. self.getYGD();
  368. } else {
  369. sp.dialog(res.message);
  370. }
  371. })
  372. }
  373. self.delFile = function (obj) {
  374. var data = {
  375. tablename: "DA_YJYGDFILEATTACH",
  376. id: obj.ID
  377. };
  378. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  379. .success(function (obj) {
  380. var res = strToJson(s4.decryptData_CBC(obj.data));
  381. if (res.success) {
  382. self.getYGD();
  383. } else {
  384. sp.dialog(res.message);
  385. }
  386. });
  387. }
  388. self.sortUp = function (num) {
  389. var IDS = [{ ID: self.guidangList[num].ID }, { ID: self.guidangList[num - 1].ID }]
  390. var SORTIDS = [{ SORTID: self.guidangList[num - 1].SORTID }, { SORTID: self.guidangList[num].SORTID }]
  391. var data = {
  392. entity: "DA_YJYGDFILEATTACH",
  393. data: SORTIDS,
  394. setwhere: IDS
  395. }
  396. $http.post(apiurljs.login + "g2app/Data/UpdataByWhereList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  397. .success(function (obj) {
  398. var res = strToJson(s4.decryptData_CBC(obj.data));
  399. if (res.success) {
  400. self.getGDFile();
  401. } else {
  402. sp.dialog(res.message);
  403. }
  404. })
  405. }
  406. self.sortDown = function (num) {
  407. var IDS = [{ ID: self.guidangList[num].ID }, { ID: self.guidangList[num + 1].ID }]
  408. var SORTIDS = [{ SORTID: self.guidangList[num + 1].SORTID }, { SORTID: self.guidangList[num].SORTID }]
  409. var data = {
  410. entity: "DA_YJYGDFILEATTACH",
  411. data: SORTIDS,
  412. setwhere: IDS
  413. }
  414. $http.post(apiurljs.login + "g2app/Data/UpdataByWhereList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  415. .success(function (obj) {
  416. var res = strToJson(s4.decryptData_CBC(obj.data));
  417. if (res.success) {
  418. self.getGDFile();
  419. } else {
  420. sp.dialog(res.message);
  421. }
  422. })
  423. }
  424. self.uploading = false;
  425. self.upload = function () {
  426. //var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  427. // return item.CNAME
  428. //})
  429. $('#fileupload').fileupload({
  430. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  431. dataType: 'json',
  432. beforeSend: function (xhr, data) {
  433. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  434. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=DA_YJYGDFILEATTACH,routeinfoid=" + self.data.ID));
  435. },
  436. add: function (e, data) {
  437. var num = 0;
  438. //var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  439. var acceptFileTypes = eval('/(pdf)$/i')
  440. //文件类型判断
  441. $.each(data.originalFiles, function (index, item) {
  442. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  443. //sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  444. sp.dialog("您好,请上传pdf格式的文件!");
  445. return;
  446. } else {
  447. num++
  448. }
  449. })
  450. if (num == data.originalFiles.length) {
  451. self.uploading = true;
  452. data.submit();
  453. $scope.$apply();
  454. }
  455. },
  456. // 上传完成后的执行逻辑
  457. done: function (e, data) {
  458. self.uploading = false;
  459. self.getGDFile()
  460. }
  461. })
  462. }
  463. self.changeGDZ = function () {
  464. if (self.gdzFlag == false) {
  465. self.data.ZHANGTOP = -1
  466. self.data.ZHANGLEFT = -1
  467. } else {
  468. if (self.data.ZHANGTOP = -1) {
  469. self.data.ZHANGTOP = self.data.ZHANGTOP1
  470. self.data.ZHANGLEFT = self.data.ZHANGLEFT1
  471. }
  472. }
  473. }
  474. self.btnSaveFiles = function () {
  475. var IDS = [], SORTIDS = [];
  476. self.guidangList.forEach(function (item) {
  477. $("#table_tbody").children().each(function (index) {
  478. if ($(this).attr("data-col") == item.ID) {
  479. IDS.push({ ID: item.ID })
  480. SORTIDS.push({ SORTID: self.guidangList[$(this).attr("index") - 1].SORTID })
  481. }
  482. })
  483. })
  484. var data = {
  485. entity: "DA_YJYGDFILEATTACH",
  486. data: SORTIDS,
  487. setwhere: IDS
  488. }
  489. $http.post(apiurljs.login + "g2app/Data/UpdataByWhereList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  490. .success(function (obj) {
  491. var res = strToJson(s4.decryptData_CBC(obj.data));
  492. if (res.success) {
  493. self.getGDFile();
  494. } else {
  495. sp.dialog(res.message);
  496. }
  497. })
  498. }
  499. self.MergeByFile = function () {
  500. var data1 = {
  501. tablename: "DA_YGD",
  502. id: self.data.ID,
  503. data: {
  504. ZHANGTOP: self.data.ZHANGTOP,
  505. ZHANGLEFT: self.data.ZHANGLEFT
  506. }
  507. }
  508. $http.post(apiurljs.login + "g2app/dataabase/saveChildData", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  509. .success(function (obj1) {
  510. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  511. if (res1.code == 0) {
  512. var data = {
  513. files: [],
  514. converttype: 3,
  515. routeinfoid: self.data.ID,
  516. gdzdata: ['全宗号', '年度', '件号', "X154", self.data.YEAR_CODE, self.data.ITEM_NO, '机构', '保管期限', '页数', self.data.FILING_DEPT, self.data.RETENTION_PERIOD, self.data.AMOUNT_OF_PAGES],
  517. marginLeft: 755,//self.data.ZHANGLEFT,
  518. marginBottom: 440//self.data.ZHANGTOP
  519. }
  520. self.guidangList.forEach(function (item) {
  521. data.files.push({ fileurl: item.FILEURL })
  522. })
  523. $http.post(apiurljs.login + "g2app/DangAn/queryYJYGDMergeByFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  524. .success(function (obj) {
  525. var res = strToJson(s4.decryptData_CBC(obj.data));
  526. self.seeFiles(res.data.DATA, 1)
  527. self.show = 3;
  528. })
  529. } else {
  530. sp.dialog(res1.message)
  531. }
  532. })
  533. }
  534. self.send = function () {
  535. var data = {
  536. id: self.data.ID
  537. }
  538. $http.post(apiurljs.login + "g2app/DangAn/sendYJYGDXMLData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  539. .success(function (obj) {
  540. if (res.code == 0) {
  541. self.getData()
  542. } else {
  543. sp.dialog(res.message)
  544. }
  545. })
  546. }
  547. // 查看文件
  548. self.seeFiles = function (obj,n) {
  549. var set_convertType = 0;
  550. if (n == 3) {
  551. obj.FILEURL = obj.URL;
  552. obj.FILEEXT = obj.PREFIX;
  553. }
  554. if (obj.FILEEXT == "doc") {
  555. set_convertType = 0;
  556. } else if (obj.FILEEXT == "pdf") {
  557. set_convertType = 20;
  558. } else if (obj.FILEEXT == "ofd") {
  559. set_convertType = 570;
  560. } else {
  561. set_convertType = 0;
  562. }
  563. let postData = {
  564. convertType: set_convertType,
  565. isSignature: 1,
  566. fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
  567. };
  568. var postCfg_transfer = {
  569. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  570. transformRequest: function (data) {
  571. return $.param(data);
  572. }
  573. };
  574. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  575. .success(function (res) {
  576. if (res.errorcode === 0) {
  577. if (n == 1) {
  578. $("#filesId").attr("src", res.data.viewUrl)
  579. } else {
  580. window.open(res.data.viewUrl)
  581. }
  582. } else {
  583. sp.dialog(res.message);
  584. }
  585. });
  586. }
  587. //头部下滚冻结
  588. $(function () {
  589. $(".sp-page-center").css("max-height", $(window).height() - 58).css("height", $(window).height() - 58)
  590. //页面高度撑满
  591. setTimeout(function () {
  592. if ($(".ibox-content").height() < $(window).height() - 31) {
  593. $(".ibox-content").css("height", $(window).height() - 31)
  594. }
  595. }, 1)
  596. })
  597. }])