formedit.js 33 KB

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