formedit.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. let s4 = new SM4Util();
  2. let detailVue = new Vue({
  3. el: "#detailBox",
  4. data: {
  5. apiurl: apiurl,//基础的页面请求地址
  6. userId: "", //用户id
  7. userName: "", //用户中文名
  8. token: "",
  9. nowTab: "tab1",
  10. routeid: "",
  11. routeinfoid: "",
  12. directionid: "",
  13. formeditid: "",
  14. docmode: "",
  15. dotype: "",
  16. type: "",
  17. routerList: [],
  18. fileList: [],
  19. isEnd: false,
  20. startX: 0,
  21. endX: 0,
  22. deleteSlider: '',//滑动时的效果
  23. JJCD: [],
  24. XXGKSH: [],
  25. GWZL: [],
  26. SFXYJD: [],
  27. readonly: {
  28. JJCD: false,
  29. WLDQFL: false,
  30. WLDSSL: false,
  31. XXGKSH: false,
  32. SFXYJD: false,
  33. FLSH: false,
  34. GPJZSC: false,
  35. BGSFHYJ: false,
  36. SX: false,
  37. BMFZRYJ: false,
  38. NGR: false,
  39. NGSJ: false,
  40. HBCSYJ: false,
  41. GWZL: false,
  42. YF: false,
  43. BT: false,
  44. ZS: false,
  45. CS: false
  46. },
  47. form: {
  48. ID: "", //多一个id
  49. JJCD: "",
  50. JJCD_NAME: "",
  51. XXGKSH: "",
  52. XXGKSH_NAME: "",
  53. SFXYJD: "",
  54. SFXYJD_NAME: "",
  55. NGR: "",
  56. NGSJ: "",
  57. GWZL: "",
  58. GWZL_NAME: "",
  59. YF: "",
  60. BT: "",
  61. ZS: "",
  62. CS: ""
  63. },
  64. WLDQFL: [],
  65. WLDSSL: [],
  66. FLSH: [],
  67. GPJZSC: [],
  68. BGSFHYJ: [],
  69. SX: [],
  70. BMFZRYJ: [],
  71. HBCSYJ: [],
  72. WLDQFLEDIT: true,
  73. WLDSSLEDIT: true,
  74. FLSHEDIT: true,
  75. GPJZSCEDIT: true,
  76. BGSFHYJEDIT: true,
  77. SXEDIT: true,
  78. BMFZRYJEDIT: true,
  79. HBCSYJEDIT: true,
  80. optionType: "",
  81. optionContent: "",
  82. showSave: false,
  83. buttonList: [],
  84. departList:[],
  85. fileData1: [],
  86. fileData2: [],
  87. fileData3: []
  88. },
  89. methods: {
  90. dateFtt: (fmt, date) => {
  91. var o = {
  92. "M+": date.getMonth() + 1, //月份
  93. "d+": date.getDate(), //日
  94. "h+": date.getHours(), //小时
  95. "m+": date.getMinutes(), //分
  96. "s+": date.getSeconds(), //秒
  97. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  98. "S": date.getMilliseconds() //毫秒
  99. };
  100. if (/(y+)/.test(fmt))
  101. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  102. for (var k in o)
  103. if (new RegExp("(" + k + ")").test(fmt))
  104. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  105. return fmt;
  106. },
  107. changeTab: (tabCode) => {
  108. _this.nowTab = tabCode;
  109. if (_this.nowTab == "tab1") {
  110. } else if (_this.nowTab == "tab2") {
  111. _this.getFileList();
  112. } else if (_this.nowTab == "tab3") {
  113. _this.getRouterList();
  114. } else if (_this.nowTab == "tab4") {
  115. _this.getAllFile();
  116. }
  117. },
  118. getRouterList: () => {
  119. _this.routerList = [];
  120. let postData = {
  121. directionid: _this.directionid,
  122. userid: _this.userId,
  123. routeid: _this.routeid,
  124. routeinfoid: _this.routeinfoid,
  125. }
  126. $http({
  127. method: 'post',
  128. baseURL: _this.apiurl,
  129. url: "g2app/abase/queryDataRouteList",
  130. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  131. headers: {
  132. 'Content-Type': 'application/json',
  133. 'Authorization': "Bearer " + _this.token
  134. }
  135. }).then(res => {
  136. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  137. response.data.forEach(function (item) {
  138. item.mainUser = [];
  139. item.copyUsers = [];
  140. item.isNow = false;
  141. item.USERS.forEach(function (item2) {
  142. if (item2.KIND == 0) {
  143. item.mainUser.push(item2.USERNAME);
  144. } else {
  145. item.copyUsers.push(item2.USERNAME);
  146. }
  147. })
  148. item.NAME = "【" + item.STARTNODENAME + "】转" + "【" + item.ENDNODENAME + "】"
  149. item.mainUser = item.mainUser.join(",");
  150. item.copyUsers = item.copyUsers.join(",");
  151. })
  152. _this.routerList = response.data;
  153. if (_this.routerList[_this.routerList.length - 1].ENDNODENAME == '结束') {
  154. _this.isEnd = true;
  155. _this.routerList[_this.routerList.length - 1].isNow = false;
  156. } else {
  157. _this.routerList[_this.routerList.length - 1].isNow = true;
  158. _this.isEnd = false;
  159. }
  160. })
  161. },
  162. getFileList: () => {
  163. _this.fileList = [];
  164. let postData = {
  165. tablename: "FILE_ATTACH",
  166. colums: "*",
  167. order: "ID desc",
  168. sqlwhere: {ROUTEINFOID: _this.routeinfoid},
  169. sqlinwhere: "",
  170. sqllikewhere: ""
  171. }
  172. $http({
  173. method: 'post',
  174. baseURL: _this.apiurl,
  175. url: "g2app/dataabase/queryDataByCol",
  176. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  177. headers: {
  178. 'Content-Type': 'application/json',
  179. 'Authorization': "Bearer " + _this.token
  180. }
  181. }).then(res => {
  182. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  183. response.data.forEach(function (item) {
  184. item.deleteSlider = "transform:translateX(0px)";
  185. })
  186. _this.fileList = response.data;
  187. })
  188. },
  189. touchStart(e) {
  190. _this.startX = e.touches[0].clientX;
  191. },
  192. touchEnd(e) {
  193. let index = e.currentTarget.dataset.index;
  194. // 当前滑动的父级元素
  195. _this.endX = e.changedTouches[0].clientX;
  196. // 左滑
  197. if (_this.startX - _this.endX > 30) {
  198. _this.fileList.forEach(function (item) {
  199. item.deleteSlider = "transform:translateX(0px)";
  200. })
  201. _this.fileList[index].deleteSlider = "transform:translateX(-120px)";
  202. }
  203. // 右滑
  204. if (_this.startX - _this.endX < -30) {
  205. _this.fileList.forEach(function (item) {
  206. item.deleteSlider = "transform:translateX(0px)";
  207. })
  208. }
  209. _this.startX = 0;
  210. _this.endX = 0;
  211. },
  212. downLoad: (item) => {
  213. window.open(_this.apiurl + "g2work/files/" + item.FILEURL.slice(7));
  214. },
  215. deleteFile: (item) => {
  216. if (_this.dotype != 0) {
  217. _this.$nextTick(() => {
  218. $.confirm("您确定要删除当前附件吗?", "确认删除?", function () {
  219. let postData = {
  220. tablename: "FILE_ATTACH",
  221. id: item.ID
  222. };
  223. $http({
  224. method: 'post',
  225. baseURL: _this.apiurl,
  226. url: "g2app/dataabase/delDataById",
  227. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  228. headers: {
  229. 'Content-Type': 'application/json',
  230. 'Authorization': "Bearer " + _this.token
  231. }
  232. }).then(res => {
  233. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  234. if (response.success) {
  235. _this.getFileList();
  236. } else {
  237. $.alert("删除失败,请联系管理员!", "温馨提示");
  238. }
  239. })
  240. }, function () {
  241. //取消操作
  242. });
  243. })
  244. } else {
  245. _this.$nextTick(() => {
  246. $.alert("当前模式下无法删除附件", "温馨提示");
  247. })
  248. }
  249. },
  250. sendBtn: () => {
  251. if (_this.dotype != 0) {
  252. let formData = {};
  253. for (let key in _this.form) {
  254. if (key.indexOf("_NAME") == -1) {
  255. formData[key] = _this.form[key]
  256. }
  257. }
  258. let arrayData = [];
  259. arrayData.push(formData)
  260. let postData = {
  261. ckey: "FW_SPJ",
  262. id: _this.form.ID,
  263. routeid: _this.routeid,
  264. routeinfoid: _this.routeinfoid,
  265. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  266. directionid: _this.directionid,
  267. formeditid: _this.formeditid,
  268. data: JSON.stringify(arrayData)
  269. };
  270. $http({
  271. method: 'post',
  272. baseURL: _this.apiurl,
  273. url: "g2app/abase/saveData",
  274. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  275. headers: {
  276. 'Content-Type': 'application/json',
  277. 'Authorization': "Bearer " + _this.token
  278. }
  279. }).then(res => {
  280. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  281. if (response.success) {
  282. location.href = "sendedit.html?routeid=" + _this.routeid + "&routeinfoid=" + _this.routeinfoid + "&directionid=" + _this.directionid + "&formeditid=" + _this.formeditid + "&docmode=" + _this.docmode + "&dotype=" + _this.dotype + "&type" + _this.type;
  283. } else {
  284. $.alert("保存表单失败,无法进行转发,请联系管理员!", "温馨提示");
  285. }
  286. })
  287. } else {
  288. _this.$nextTick(() => {
  289. $.alert("当前模式下无法进行转发", "温馨提示");
  290. })
  291. }
  292. },
  293. getItemCodeTable: (tablename) => {
  294. let postData = {
  295. ckey: tablename,
  296. routeinfoid: _this.routeinfoid
  297. }
  298. return $http({
  299. method: 'post',
  300. baseURL: _this.apiurl,
  301. url: "g2app/abase/queryDataCode",
  302. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  303. headers: {
  304. 'Content-Type': 'application/json',
  305. 'Authorization': "Bearer " + _this.token
  306. }
  307. })
  308. },
  309. getAllCodeTable: () => {
  310. $http.all([_this.getItemCodeTable('CODE_JJCD'),
  311. _this.getItemCodeTable('CODE_XXGKSH'),
  312. _this.getItemCodeTable('CODE_GWTYPE'),
  313. _this.getItemCodeTable('CODE_SFXYJD'),
  314. _this.getDepartOption()]).then($http.spread((first, second, third, forth, fifth) => {
  315. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  316. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  317. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  318. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  319. let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  320. _this.JJCD = response1.data.CODE_JJCD;
  321. _this.XXGKSH = response2.data.CODE_XXGKSH;
  322. _this.GWZL = response3.data.CODE_GWTYPE;
  323. _this.SFXYJD = response4.data.CODE_SFXYJD;
  324. _this.departList = response5.data;
  325. _this.getFormDetail();
  326. _this.getAllOption();
  327. }))
  328. },
  329. getFormDetail: () => {
  330. let postData = {
  331. ckey: "FW_SPJ",
  332. id: 0,
  333. directionid: _this.directionid,
  334. formeditid: _this.formeditid,
  335. routeid: _this.routeid,
  336. routeinfoid: _this.routeinfoid
  337. }
  338. $http({
  339. method: 'post',
  340. baseURL: _this.apiurl,
  341. url: "g2app/abase/queryData",
  342. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  343. headers: {
  344. 'Content-Type': 'application/json',
  345. 'Authorization': "Bearer " + _this.token
  346. }
  347. }).then(res => {
  348. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  349. //0表单禁用
  350. if (_this.dotype == '0') {
  351. _this.readonly = {
  352. JJCD: true,
  353. WLDQFL: true,
  354. WLDSSL: true,
  355. XXGKSH: true,
  356. SFXYJD: true,
  357. FLSH: true,
  358. GPJZSC: true,
  359. BGSFHYJ: true,
  360. SX: true,
  361. BMFZRYJ: true,
  362. NGR: true,
  363. NGSJ: true,
  364. HBCSYJ: true,
  365. GWZL: true,
  366. YF: true,
  367. BT: true,
  368. ZS: true,
  369. CS: true
  370. }
  371. } else {
  372. _this.readonly = {
  373. JJCD: response.data.FW_SPJ["JJCD.EREADONLY"] == "true",
  374. WLDQFL: response.data.FW_SPJ["WLDQFL.EREADONLY"] == "true",
  375. WLDSSL: response.data.FW_SPJ["WLDSSL.EREADONLY"] == "true",
  376. XXGKSH: response.data.FW_SPJ["XXGKSH.EREADONLY"] == "true",
  377. SFXYJD: response.data.FW_SPJ["SFXYJD.EREADONLY"] == "true",
  378. FLSH: response.data.FW_SPJ["FLSH.EREADONLY"] == "true",
  379. GPJZSC: response.data.FW_SPJ["GPJZSC.EREADONLY"] == "true",
  380. BGSFHYJ: response.data.FW_SPJ["BGSFHYJ.EREADONLY"] == "true",
  381. SX: response.data.FW_SPJ["SX.EREADONLY"] == "true",
  382. BMFZRYJ: response.data.FW_SPJ["BMFZRYJ.EREADONLY"] == "true",
  383. NGR: response.data.FW_SPJ["NGR.EREADONLY"] == "true",
  384. NGSJ: response.data.FW_SPJ["NGSJ.EREADONLY"] == "true",
  385. HBCSYJ: response.data.FW_SPJ["HBCSYJ.EREADONLY"] == "true",
  386. GWZL: response.data.FW_SPJ["GWZL.EREADONLY"] == "true",
  387. YF: response.data.FW_SPJ["YF.EREADONLY"] == "true",
  388. BT: response.data.FW_SPJ["BT.EREADONLY"] == "true",
  389. ZS: response.data.FW_SPJ["ZS.EREADONLY"] == "true",
  390. CS: response.data.FW_SPJ["CS.EREADONLY"] == "true",
  391. }
  392. }
  393. _this.form = {
  394. ID: response.data.FW_SPJ.ID,
  395. JJCD: response.data.FW_SPJ.JJCD == "" ? _this.JJCD[0].CODE : response.data.FW_SPJ.JJCD,
  396. XXGKSH: response.data.FW_SPJ.XXGKSH == "" ? _this.XXGKSH[0].CODE : response.data.FW_SPJ.XXGKSH,
  397. SFXYJD: response.data.FW_SPJ.SFXYJD == "" ? _this.SFXYJD[0].CODE : response.data.FW_SPJ.SFXYJD,
  398. GWZL: response.data.FW_SPJ.GWZL == "" ? _this.GWZL[0].CODE : response.data.FW_SPJ.GWZL,
  399. NGSJ: (response.data.FW_SPJ.NGSJ == "" || response.data.FW_SPJ.NGSJ == null || response.data.FW_SPJ.NGSJ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.FW_SPJ.NGSJ),
  400. NGR: response.data.FW_SPJ.NGR,
  401. YF: response.data.FW_SPJ.YF,
  402. BT: response.data.FW_SPJ.BT,
  403. ZS: response.data.FW_SPJ.ZS,
  404. CS: response.data.FW_SPJ.CS
  405. }
  406. if (response.data.FW_SPJ.JJCD == "") {
  407. _this.form.JJCD_NAME = _this.JJCD[0].CNAME;
  408. } else {
  409. _this.JJCD.forEach(function (item) {
  410. if (item.CODE == response.data.FW_SPJ.JJCD) {
  411. _this.form.JJCD_NAME = item.CNAME;
  412. }
  413. })
  414. }
  415. if (response.data.FW_SPJ.XXGKSH == "") {
  416. _this.form.XXGKSH_NAME = _this.XXGKSH[0].CNAME;
  417. } else {
  418. _this.XXGKSH.forEach(function (item) {
  419. if (item.CODE == response.data.FW_SPJ.XXGKSH) {
  420. _this.form.XXGKSH_NAME = item.CNAME;
  421. }
  422. })
  423. }
  424. if (response.data.FW_SPJ.SFXYJD == "") {
  425. _this.form.SFXYJD_NAME = _this.SFXYJD[0].CNAME;
  426. } else {
  427. _this.SFXYJD.forEach(function (item) {
  428. if (item.CODE == response.data.FW_SPJ.SFXYJD) {
  429. _this.form.SFXYJD_NAME = item.CNAME;
  430. }
  431. })
  432. }
  433. if (response.data.FW_SPJ.GWZL == "") {
  434. _this.form.GWZL_NAME = _this.GWZL[0].CNAME;
  435. } else {
  436. _this.GWZL.forEach(function (item) {
  437. if (item.CODE == response.data.FW_SPJ.GWZL) {
  438. _this.form.GWZL_NAME = item.CNAME;
  439. }
  440. })
  441. }
  442. _this.$nextTick(() => {
  443. _this.initInputPlug();
  444. })
  445. })
  446. },
  447. initInputPlug: () => {
  448. $("#NGSJ").calendar({
  449. onChange: function (p, values, displayValues) {
  450. _this.form.NGSJ = values[0];
  451. }
  452. });
  453. let listJJCD = [];
  454. let listXXGKSH = [];
  455. let listGWZL = [];
  456. let listSFXYJD = [];
  457. _this.JJCD.forEach(function (item) {
  458. listJJCD.push(item.CNAME);
  459. })
  460. _this.XXGKSH.forEach(function (item) {
  461. listXXGKSH.push(item.CNAME);
  462. })
  463. _this.GWZL.forEach(function (item) {
  464. listGWZL.push(item.CNAME);
  465. })
  466. _this.SFXYJD.forEach(function (item) {
  467. listSFXYJD.push(item.CNAME);
  468. })
  469. $("#JJCD").picker({
  470. title: "请选择紧急程度",
  471. cols: [
  472. {
  473. textAlign: 'center',
  474. values: listJJCD
  475. }
  476. ],
  477. onChange: function (p, v, dv) {
  478. _this.form.JJCD_NAME = v[0];
  479. _this.JJCD.forEach(function (item) {
  480. if (item.CNAME == v[0]) {
  481. _this.form.JJCD = item.CODE;
  482. }
  483. })
  484. },
  485. });
  486. $("#XXGKSH").picker({
  487. title: "请选择信息公开审核",
  488. cols: [
  489. {
  490. textAlign: 'center',
  491. values: listXXGKSH
  492. }
  493. ],
  494. onChange: function (p, v, dv) {
  495. _this.form.XXGKSH_NAME = v[0];
  496. _this.XXGKSH.forEach(function (item) {
  497. if (item.CNAME == v[0]) {
  498. _this.form.XXGKSH = item.CODE;
  499. }
  500. })
  501. },
  502. });
  503. $("#GWZL").picker({
  504. title: "请选择公文种类",
  505. cols: [
  506. {
  507. textAlign: 'center',
  508. values: listGWZL
  509. }
  510. ],
  511. onChange: function (p, v, dv) {
  512. _this.form.GWZL_NAME = v[0];
  513. _this.GWZL.forEach(function (item) {
  514. if (item.CNAME == v[0]) {
  515. _this.form.GWZL = item.CODE;
  516. }
  517. })
  518. },
  519. });
  520. $("#SFXYJD").picker({
  521. title: "请选择是否需要解读",
  522. cols: [
  523. {
  524. textAlign: 'center',
  525. values: listSFXYJD
  526. }
  527. ],
  528. onChange: function (p, v, dv) {
  529. _this.form.SFXYJD_NAME = v[0];
  530. _this.SFXYJD.forEach(function (item) {
  531. if (item.CNAME == v[0]) {
  532. _this.form.SFXYJD = item.CODE;
  533. }
  534. })
  535. },
  536. });
  537. let optionDepart=[];
  538. _this.departList.forEach(function (item) {
  539. optionDepart.push({
  540. title: item.DEP,
  541. value: item.DEPCODE,
  542. description: item.DEP
  543. })
  544. })
  545. $("#ZS").select({
  546. title: "请选择主送",
  547. multi: true,
  548. items:optionDepart,
  549. onChange: function(d) {
  550. },
  551. onClose: function (d) {
  552. _this.form.ZS=d.data.titles;
  553. }
  554. });
  555. $("#CS").select({
  556. title: "请选择抄送",
  557. multi: true,
  558. items:optionDepart,
  559. onChange: function(d) {
  560. },
  561. onClose: function (d) {
  562. _this.form.CS=d.data.titles;
  563. }
  564. });
  565. },
  566. saveBtn: () => {
  567. if (_this.dotype != 0) {
  568. let formData = {};
  569. for (let key in _this.form) {
  570. if (key.indexOf("_NAME") == -1) {
  571. formData[key] = _this.form[key]
  572. }
  573. }
  574. let arrayData = [];
  575. arrayData.push(formData)
  576. let postData = {
  577. ckey: "FW_SPJ",
  578. id: _this.form.ID,
  579. routeid: _this.routeid,
  580. routeinfoid: _this.routeinfoid,
  581. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  582. directionid: _this.directionid,
  583. formeditid: _this.formeditid,
  584. data: JSON.stringify(arrayData)
  585. };
  586. $http({
  587. method: 'post',
  588. baseURL: _this.apiurl,
  589. url: "g2app/abase/saveData",
  590. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  591. headers: {
  592. 'Content-Type': 'application/json',
  593. 'Authorization': "Bearer " + _this.token
  594. }
  595. }).then(res => {
  596. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  597. if (response.success) {
  598. $.alert("保存成功!", "温馨提示");
  599. _this.getFormDetail();
  600. } else {
  601. $.alert("保存失败,请联系管理员!", "温馨提示");
  602. }
  603. })
  604. } else {
  605. _this.$nextTick(() => {
  606. $.alert("当前模式下无法进行保存", "温馨提示");
  607. })
  608. }
  609. },
  610. getItemOption: (code) => {
  611. let postData = {
  612. cmanid: _this.userId,
  613. routeinfoid: _this.routeinfoid,
  614. routeid: _this.routeid,
  615. tableid: "FW_SPJ",
  616. colid: code
  617. }
  618. return $http({
  619. method: 'post',
  620. baseURL: _this.apiurl,
  621. url: "g2app/abase/queryDataOpinion",
  622. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  623. headers: {
  624. 'Content-Type': 'application/json',
  625. 'Authorization': "Bearer " + _this.token
  626. }
  627. })
  628. },
  629. getAllOption: () => {
  630. _this.WLDQFL = [];
  631. _this.WLDSSL = [];
  632. _this.FLSH = [];
  633. _this.GPJZSC = [];
  634. _this.BGSFHYJ = [];
  635. _this.SX = [];
  636. _this.BMFZRYJ = [];
  637. _this.HBCSYJ = [];
  638. $http.all([_this.getItemOption('WLDQFL'),
  639. _this.getItemOption('WLDSSL'),
  640. _this.getItemOption('FLSH'),
  641. _this.getItemOption('GPJZSC'),
  642. _this.getItemOption('BGSFHYJ'),
  643. _this.getItemOption('SX'),
  644. _this.getItemOption('BMFZRYJ'),
  645. _this.getItemOption('HBCSYJ')]).then($http.spread((first, second, third, forth, fifth, sixth, seventh, eighth) => {
  646. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  647. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  648. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  649. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  650. let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  651. let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data));
  652. let response7 = _this.utils.strToJson(s4.decryptData_CBC(seventh.data.data));
  653. let response8 = _this.utils.strToJson(s4.decryptData_CBC(eighth.data.data));
  654. _this.WLDQFL = response1.data;
  655. _this.WLDSSL = response2.data;
  656. _this.FLSH = response3.data;
  657. _this.GPJZSC = response4.data;
  658. _this.BGSFHYJ = response5.data;
  659. _this.SX = response6.data;
  660. _this.BMFZRYJ = response7.data;
  661. _this.HBCSYJ = response8.data;
  662. _this.dealOption('WLDQFL');
  663. _this.dealOption('WLDSSL');
  664. _this.dealOption('FLSH');
  665. _this.dealOption('GPJZSC');
  666. _this.dealOption('BGSFHYJ');
  667. _this.dealOption('SX');
  668. _this.dealOption('BMFZRYJ');
  669. _this.dealOption('HBCSYJ');
  670. }))
  671. },
  672. deleteOption: (code) => {
  673. $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
  674. let postData = {
  675. cmanid: _this.userId,
  676. routeid: _this.routeid,
  677. tableid: "FW_SPJ",
  678. colid: code,
  679. };
  680. $http({
  681. method: 'post',
  682. baseURL: _this.apiurl,
  683. url: "g2app/abase/deleteDataOpinion",
  684. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  685. headers: {
  686. 'Content-Type': 'application/json',
  687. 'Authorization': "Bearer " + _this.token
  688. }
  689. }).then(res => {
  690. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  691. if (response.success) {
  692. _this.getAllOption();
  693. } else {
  694. $.alert("删除失败,请联系管理员!", "温馨提示");
  695. }
  696. })
  697. }, function () {
  698. //取消操作
  699. });
  700. },
  701. editOption: (type, index) => {
  702. _this.optionType = type;
  703. let nowEditObj = _this[type][index];
  704. if (_this.optionType == "") {
  705. $.alert("初始化失败,请联系管理员!", "温馨提示");
  706. } else {
  707. _this.optionContent = nowEditObj.OPINION;
  708. $(".open-popup").eq(0).click();
  709. }
  710. },
  711. addOption: (type) => {
  712. _this.optionType = type;
  713. _this.optionContent = "";
  714. if (_this.optionType == "") {
  715. $.alert("初始化失败,请联系管理员!", "温馨提示");
  716. } else {
  717. $(".open-popup").eq(0).click();
  718. }
  719. },
  720. saveOption: () => {
  721. $(".close-popup").eq(0).click();
  722. let postData = {
  723. cmanid: _this.userId,
  724. routeinfoid: _this.routeinfoid,
  725. routeid: _this.routeid,
  726. tableid: "FW_SPJ",
  727. colid: _this.optionType,
  728. opiniontype: 0,
  729. cresult: "",
  730. opinion: _this.optionContent,
  731. opinionimage: ""
  732. };
  733. $http({
  734. method: 'post',
  735. baseURL: _this.apiurl,
  736. url: "g2app/abase/saveDataOpinion",
  737. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  738. headers: {
  739. 'Content-Type': 'application/json',
  740. 'Authorization': "Bearer " + _this.token
  741. }
  742. }).then(res => {
  743. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  744. if (response.success) {
  745. _this.getAllOption();
  746. } else {
  747. $.alert("删除失败,请联系管理员!", "温馨提示");
  748. }
  749. })
  750. },
  751. getBtnList: () => {
  752. let postData = {
  753. ckey: "FW_SPJ",
  754. id: 0,
  755. directionid: _this.directionid,
  756. formeditid: _this.formeditid,
  757. routeid: _this.routeid,
  758. routeinfoid: _this.routeinfoid
  759. }
  760. $http({
  761. method: 'post',
  762. baseURL: _this.apiurl,
  763. url: "g2app/abase/queryData",
  764. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  765. headers: {
  766. 'Content-Type': 'application/json',
  767. 'Authorization': "Bearer " + _this.token
  768. }
  769. }).then(res => {
  770. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  771. _this.buttonList = _this.dotype == 0 ? [] : response.data["FW_SPJ.FUNCLIST"];
  772. _this.buttonList.forEach(function (item) {
  773. if (item.CODE == "SAVEITEM") {
  774. _this.showSave = true;
  775. }
  776. })
  777. })
  778. },
  779. //增补一个函数
  780. dealOption: (key) => {
  781. let num = 0;
  782. let keyEdit = key + "EDIT";
  783. _this[key].forEach(function (item) {
  784. if (item.ROUTEID == _this.routeid) {
  785. num++
  786. }
  787. })
  788. if (num > 0) {
  789. _this[keyEdit] = true;
  790. } else {
  791. _this[keyEdit] = false;
  792. }
  793. },
  794. //拿回主动抄送的部门选项,和加载滚动选项一起执行
  795. getDepartOption: () => {
  796. return $http({
  797. method: 'post',
  798. baseURL: _this.apiurl,
  799. url: "g2app/dataabase/getDpList",
  800. data: {data: s4.encryptData_CBC(JSON.stringify(""))},
  801. headers: {
  802. 'Content-Type': 'application/json',
  803. 'Authorization': "Bearer " + _this.token
  804. }
  805. })
  806. },
  807. //获取单个文稿列表
  808. getItemFile: (code) => {
  809. let postData = {
  810. dockind: code,
  811. routeinfoid: _this.routeinfoid
  812. }
  813. return $http({
  814. method: 'post',
  815. baseURL: _this.apiurl,
  816. url: "g2app/fawenfiles/queryDataList",
  817. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  818. headers: {
  819. 'Content-Type': 'application/json',
  820. 'Authorization': "Bearer " + _this.token
  821. }
  822. })
  823. },
  824. //获取全部类型文稿列表
  825. getAllFile: () => {
  826. $http.all([_this.getItemFile('D01'),
  827. _this.getItemFile('D02'),
  828. _this.getItemFile('D03')]).then($http.spread((first, second, third) => {
  829. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  830. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  831. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  832. _this.fileData1 = response1.data;
  833. _this.fileData2 = response2.data;
  834. _this.fileData3 = response3.data;
  835. }))
  836. },
  837. //调用打开永中的嵌入页
  838. openOfficePage: (item, type) => {
  839. let postData={
  840. type:type,
  841. obj:item
  842. }
  843. let dataString = s4.encryptData_CBC(JSON.stringify(postData));
  844. let goUrl = "officeedit.html?dataString=" + dataString;
  845. location.href = goUrl;
  846. }
  847. },
  848. created: function () {
  849. _this = this;
  850. let token = localStorage.getItem("mobile-token", _this.token);
  851. let userName = localStorage.getItem("mobile-userName", _this.userName);
  852. let userId = localStorage.getItem("mobile-userId", _this.userId);
  853. _this.userId = userId;
  854. _this.token = token;
  855. _this.userName = userName;
  856. _this.routeid = _this.utils.getUrlName("routeid");
  857. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  858. _this.directionid = _this.utils.getUrlName("directionid");
  859. _this.formeditid = _this.utils.getUrlName("formeditid");
  860. _this.docmode = _this.utils.getUrlName("docmode");
  861. _this.dotype = _this.utils.getUrlName("dotype");
  862. _this.type = _this.utils.getUrlName("type");
  863. },
  864. mounted: function () {
  865. _this.getAllCodeTable();
  866. _this.getBtnList();
  867. }
  868. })