formedit.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  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. MIJI: [],
  24. JJQK: [],
  25. SFDB: [],
  26. readonly: {
  27. SWBH: false,
  28. LWRQ: false,
  29. MJ: false,
  30. JJQK: false,
  31. LWDW: false,
  32. WH: false,
  33. BT: false,
  34. NBYJ: false,
  35. LDPS: false,
  36. CBYJ: false,
  37. SFDB: false,
  38. DBSX: false,
  39. BZ: false,
  40. CBR: false
  41. },
  42. form: {
  43. ID: "", //多一个id
  44. SWBH: "",
  45. LWRQ: "",
  46. MJ: "",
  47. MJ_NAME: "",
  48. JJQK: "",
  49. JJQK_NAME: "",
  50. LWDW: "",
  51. WH: "",
  52. BT: "",
  53. SFDB: "",
  54. SFDB_NAME: "",
  55. DBSX: "",
  56. BZ: "",
  57. CBR: ""
  58. },
  59. NBYJ: [],
  60. LDPS: [],
  61. CBYJ: [],
  62. NBYJEDIT: true,
  63. LDPSEDIT: true,
  64. CBYJEDIT: true,
  65. optionType: "",
  66. optionContent: "",
  67. showSave: false,
  68. buttonList: []
  69. },
  70. methods: {
  71. dateFtt: (fmt, date) => {
  72. var o = {
  73. "M+": date.getMonth() + 1, //月份
  74. "d+": date.getDate(), //日
  75. "h+": date.getHours(), //小时
  76. "m+": date.getMinutes(), //分
  77. "s+": date.getSeconds(), //秒
  78. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  79. "S": date.getMilliseconds() //毫秒
  80. };
  81. if (/(y+)/.test(fmt))
  82. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  83. for (var k in o)
  84. if (new RegExp("(" + k + ")").test(fmt))
  85. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  86. return fmt;
  87. },
  88. changeTab: (tabCode) => {
  89. _this.nowTab = tabCode;
  90. if (_this.nowTab == "tab1") {
  91. } else if (_this.nowTab == "tab2") {
  92. _this.getFileList();
  93. } else if (_this.nowTab == "tab3") {
  94. _this.getRouterList();
  95. }
  96. },
  97. getRouterList: () => {
  98. _this.routerList = [];
  99. let postData = {
  100. directionid: _this.directionid,
  101. userid: _this.userId,
  102. routeid: _this.routeid,
  103. routeinfoid: _this.routeinfoid,
  104. }
  105. $http({
  106. method: 'post',
  107. baseURL: _this.apiurl,
  108. url: "g2app/abase/queryDataRouteList",
  109. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  110. headers: {
  111. 'Content-Type': 'application/json',
  112. 'Authorization': "Bearer " + _this.token
  113. }
  114. }).then(res => {
  115. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  116. response.data.forEach(function (item) {
  117. item.mainUser = [];
  118. item.copyUsers = [];
  119. item.isNow = false;
  120. item.USERS.forEach(function (item2) {
  121. if (item2.KIND == 0) {
  122. item.mainUser.push(item2.USERNAME);
  123. } else {
  124. item.copyUsers.push(item2.USERNAME);
  125. }
  126. })
  127. item.NAME = "【" + item.STARTNODENAME + "】转" + "【" + item.ENDNODENAME + "】"
  128. item.mainUser = item.mainUser.join(",");
  129. item.copyUsers = item.copyUsers.join(",");
  130. })
  131. _this.routerList = response.data;
  132. if (_this.routerList[_this.routerList.length - 1].ENDNODENAME == '结束') {
  133. _this.isEnd = true;
  134. _this.routerList[_this.routerList.length - 1].isNow = false;
  135. } else {
  136. _this.routerList[_this.routerList.length - 1].isNow = true;
  137. _this.isEnd = false;
  138. }
  139. })
  140. },
  141. getFileList: () => {
  142. _this.fileList = [];
  143. let postData = {
  144. tablename: "FILE_ATTACH",
  145. colums: "*",
  146. order: "ID desc",
  147. sqlwhere: {ROUTEINFOID: _this.routeinfoid},
  148. sqlinwhere: "",
  149. sqllikewhere: ""
  150. }
  151. $http({
  152. method: 'post',
  153. baseURL: _this.apiurl,
  154. url: "g2app/dataabase/queryDataByCol",
  155. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  156. headers: {
  157. 'Content-Type': 'application/json',
  158. 'Authorization': "Bearer " + _this.token
  159. }
  160. }).then(res => {
  161. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  162. response.data.forEach(function (item) {
  163. item.deleteSlider = "transform:translateX(0px)";
  164. })
  165. _this.fileList = response.data;
  166. console.log(_this.fileList);
  167. })
  168. },
  169. touchStart(e) {
  170. _this.startX = e.touches[0].clientX;
  171. },
  172. touchEnd(e) {
  173. let index = e.currentTarget.dataset.index;
  174. // 当前滑动的父级元素
  175. _this.endX = e.changedTouches[0].clientX;
  176. // 左滑
  177. if (_this.startX - _this.endX > 30) {
  178. _this.fileList.forEach(function (item) {
  179. item.deleteSlider = "transform:translateX(0px)";
  180. })
  181. _this.fileList[index].deleteSlider = "transform:translateX(-120px)";
  182. }
  183. // 右滑
  184. if (_this.startX - _this.endX < -30) {
  185. _this.fileList.forEach(function (item) {
  186. item.deleteSlider = "transform:translateX(0px)";
  187. })
  188. }
  189. _this.startX = 0;
  190. _this.endX = 0;
  191. },
  192. downLoad: (item) => {
  193. window.open(_this.apiurl + "g2work/files/" + item.FILEURL.slice(7));
  194. },
  195. deleteFile: (item) => {
  196. if (_this.dotype != 0) {
  197. _this.$nextTick(() => {
  198. $.confirm("您确定要删除当前附件吗?", "确认删除?", function () {
  199. let postData = {
  200. tablename: "FILE_ATTACH",
  201. id: item.ID
  202. };
  203. $http({
  204. method: 'post',
  205. baseURL: _this.apiurl,
  206. url: "g2app/dataabase/delDataById",
  207. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  208. headers: {
  209. 'Content-Type': 'application/json',
  210. 'Authorization': "Bearer " + _this.token
  211. }
  212. }).then(res => {
  213. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  214. if (response.success) {
  215. _this.getFileList();
  216. } else {
  217. $.alert("删除失败,请联系管理员!", "温馨提示");
  218. }
  219. })
  220. }, function () {
  221. //取消操作
  222. });
  223. })
  224. } else {
  225. _this.$nextTick(() => {
  226. $.alert("当前模式下无法删除附件", "温馨提示");
  227. })
  228. }
  229. },
  230. sendBtn: () => {
  231. if (_this.dotype != 0) {
  232. let formData = {};
  233. for (let key in _this.form) {
  234. if (key.indexOf("_NAME") == -1) {
  235. formData[key] = _this.form[key]
  236. }
  237. }
  238. let arrayData = [];
  239. arrayData.push(formData)
  240. let postData = {
  241. ckey: "SW_DWGWCBD",
  242. id: _this.form.ID,
  243. routeid: _this.routeid,
  244. routeinfoid: _this.routeinfoid,
  245. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  246. directionid: _this.directionid,
  247. formeditid: _this.formeditid,
  248. data: JSON.stringify(arrayData)
  249. };
  250. console.log({data: s4.encryptData_CBC(JSON.stringify(postData))})
  251. $http({
  252. method: 'post',
  253. baseURL: _this.apiurl,
  254. url: "g2app/abase/saveData",
  255. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  256. headers: {
  257. 'Content-Type': 'application/json',
  258. 'Authorization': "Bearer " + _this.token
  259. }
  260. }).then(res => {
  261. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  262. console.log(response);
  263. if (response.success) {
  264. 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;
  265. } else {
  266. $.alert("保存表单失败,无法进行转发,请联系管理员!", "温馨提示");
  267. }
  268. })
  269. } else {
  270. _this.$nextTick(() => {
  271. $.alert("当前模式下无法进行转发", "温馨提示");
  272. })
  273. }
  274. },
  275. getItemCodeTable: (tablename) => {
  276. let postData = {
  277. ckey: tablename,
  278. routeinfoid: _this.routeinfoid
  279. }
  280. return $http({
  281. method: 'post',
  282. baseURL: _this.apiurl,
  283. url: "g2app/abase/queryDataCode",
  284. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  285. headers: {
  286. 'Content-Type': 'application/json',
  287. 'Authorization': "Bearer " + _this.token
  288. }
  289. })
  290. },
  291. getAllCodeTable: () => {
  292. $http.all([_this.getItemCodeTable('CODE_SECRET'), _this.getItemCodeTable('CODE_EMERGENCY'), _this.getItemCodeTable('CODE_SFDB')]).then($http.spread((first, second, third) => {
  293. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  294. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  295. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  296. _this.MIJI = response1.data.CODE_SECRET;
  297. _this.JJQK = response2.data.CODE_EMERGENCY;
  298. _this.SFDB = response3.data.CODE_SFDB;
  299. _this.getFormDetail();
  300. }))
  301. },
  302. getFormDetail: () => {
  303. let postData = {
  304. ckey: "SW_DWGWCBD",
  305. id: 0,
  306. directionid: _this.directionid,
  307. formeditid: _this.formeditid,
  308. routeid: _this.routeid,
  309. routeinfoid: _this.routeinfoid
  310. }
  311. $http({
  312. method: 'post',
  313. baseURL: _this.apiurl,
  314. url: "g2app/abase/queryData",
  315. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  316. headers: {
  317. 'Content-Type': 'application/json',
  318. 'Authorization': "Bearer " + _this.token
  319. }
  320. }).then(res => {
  321. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  322. //0表单禁用
  323. if (_this.dotype == '0') {
  324. _this.readonly = {
  325. SWBH: true,
  326. LWRQ: true,
  327. MJ: true,
  328. JJQK: true,
  329. LWDW: true,
  330. WH: true,
  331. BT: true,
  332. NBYJ: true,
  333. LDPS: true,
  334. CBYJ: true,
  335. SFDB: true,
  336. DBSX: true,
  337. BZ: true,
  338. CBR: true
  339. }
  340. } else {
  341. _this.readonly = {
  342. SWBH: response.data.SW_DWGWCBD["SWBH.EREADONLY"] == "true",
  343. LWRQ: response.data.SW_DWGWCBD["LWRQ.EREADONLY"] == "true",
  344. MJ: response.data.SW_DWGWCBD["MJ.EREADONLY"] == "true",
  345. JJQK: response.data.SW_DWGWCBD["JJQK.EREADONLY"] == "true",
  346. LWDW: response.data.SW_DWGWCBD["LWDW.EREADONLY"] == "true",
  347. WH: response.data.SW_DWGWCBD["WH.EREADONLY"] == "true",
  348. BT: response.data.SW_DWGWCBD["BT.EREADONLY"] == "true",
  349. NBYJ: response.data.SW_DWGWCBD["NBYJ.EREADONLY"] == "true",
  350. LDPS: response.data.SW_DWGWCBD["LDPS.EREADONLY"] == "true",
  351. CBYJ: response.data.SW_DWGWCBD["CBYJ.EREADONLY"] == "true",
  352. SFDB: response.data.SW_DWGWCBD["SFDB.EREADONLY"] == "true",
  353. DBSX: response.data.SW_DWGWCBD["DBSX.EREADONLY"] == "true",
  354. BZ: response.data.SW_DWGWCBD["BZ.EREADONLY"] == "true",
  355. CBR: response.data.SW_DWGWCBD["CBR.EREADONLY"] == "true"
  356. }
  357. }
  358. _this.form = {
  359. ID: response.data.SW_DWGWCBD.ID,
  360. SWBH: response.data.SW_DWGWCBD.SWBH,
  361. LWRQ: (response.data.SW_DWGWCBD.LWRQ == "" || response.data.SW_DWGWCBD.LWRQ == null || response.data.SW_DWGWCBD.LWRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.SW_DWGWCBD.LWRQ),
  362. MJ: response.data.SW_DWGWCBD.MJ == "" ? _this.MIJI[0].CODE : response.data.SW_DWGWCBD.MJ,
  363. JJQK: response.data.SW_DWGWCBD.JJQK == "" ? _this.JJQK[0].CODE : response.data.SW_DWGWCBD.JJQK,
  364. LWDW: response.data.SW_DWGWCBD.LWDW,
  365. WH: response.data.SW_DWGWCBD.WH,
  366. BT: response.data.SW_DWGWCBD.BT,
  367. SFDB: response.data.SW_DWGWCBD.SFDB == "" ? _this.SFDB[0].CODE : response.data.SW_DWGWCBD.SFDB,
  368. DBSX: (response.data.SW_DWGWCBD.DBSX == "" || response.data.SW_DWGWCBD.DBSX == null || response.data.SW_DWGWCBD.DBSX == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.SW_DWGWCBD.DBSX),
  369. BZ: response.data.SW_DWGWCBD.BZ,
  370. CBR: response.data.SW_DWGWCBD.CBR,
  371. }
  372. if (response.data.SW_DWGWCBD.MJ == "") {
  373. _this.form.MJ_NAME = _this.MIJI[0].CNAME;
  374. } else {
  375. _this.MIJI.forEach(function (item) {
  376. if (item.CODE == response.data.SW_DWGWCBD.MJ) {
  377. _this.form.MJ_NAME = item.CNAME;
  378. }
  379. })
  380. }
  381. if (response.data.SW_DWGWCBD.JJQK == "") {
  382. _this.form.JJQK_NAME = _this.JJQK[0].CNAME;
  383. } else {
  384. _this.JJQK.forEach(function (item) {
  385. if (item.CODE == response.data.SW_DWGWCBD.JJQK) {
  386. _this.form.JJQK_NAME = item.CNAME;
  387. }
  388. })
  389. }
  390. if (response.data.SW_DWGWCBD.SFDB == "") {
  391. _this.form.SFDB_NAME = _this.SFDB[0].CNAME;
  392. } else {
  393. _this.SFDB.forEach(function (item) {
  394. if (item.CODE == response.data.SW_DWGWCBD.SFDB) {
  395. _this.form.SFDB_NAME = item.CNAME;
  396. }
  397. })
  398. }
  399. _this.getAllOption();
  400. _this.$nextTick(() => {
  401. _this.initInputPlug();
  402. })
  403. })
  404. },
  405. initInputPlug: () => {
  406. $("#LWRQ").calendar({
  407. onChange: function (p, values, displayValues) {
  408. _this.form.LWRQ = values[0];
  409. }
  410. });
  411. $("#DBSX").calendar({
  412. onChange: function (p, values, displayValues) {
  413. _this.form.DBSX = values[0];
  414. }
  415. });
  416. let listMJ = [];
  417. let listJJQK = [];
  418. let listSFDB = [];
  419. _this.MIJI.forEach(function (item) {
  420. listMJ.push(item.CNAME);
  421. })
  422. _this.JJQK.forEach(function (item) {
  423. listJJQK.push(item.CNAME);
  424. })
  425. _this.SFDB.forEach(function (item) {
  426. listSFDB.push(item.CNAME);
  427. })
  428. $("#MJ").picker({
  429. title: "请选择密级",
  430. cols: [
  431. {
  432. textAlign: 'center',
  433. values: listMJ
  434. }
  435. ],
  436. onChange: function (p, v, dv) {
  437. _this.form.MJ_NAME = v[0];
  438. _this.MIJI.forEach(function (item) {
  439. if (item.CNAME == v[0]) {
  440. _this.form.MJ = item.CODE;
  441. }
  442. })
  443. },
  444. });
  445. $("#JJQK").picker({
  446. title: "请选择紧急情况",
  447. cols: [
  448. {
  449. textAlign: 'center',
  450. values: listJJQK
  451. }
  452. ],
  453. onChange: function (p, v, dv) {
  454. _this.form.JJQK_NAME = v[0];
  455. _this.JJQK.forEach(function (item) {
  456. if (item.CNAME == v[0]) {
  457. _this.form.JJQK = item.CODE;
  458. }
  459. })
  460. },
  461. });
  462. $("#SFDB").picker({
  463. title: "请选择是否督办",
  464. cols: [
  465. {
  466. textAlign: 'center',
  467. values: listSFDB
  468. }
  469. ],
  470. onChange: function (p, v, dv) {
  471. _this.form.SFDB_NAME = v[0];
  472. _this.SFDB.forEach(function (item) {
  473. if (item.CNAME == v[0]) {
  474. _this.form.SFDB = item.CODE;
  475. }
  476. })
  477. },
  478. });
  479. },
  480. saveBtn: () => {
  481. if (_this.dotype != 0) {
  482. let formData = {};
  483. for (let key in _this.form) {
  484. if (key.indexOf("_NAME") == -1) {
  485. formData[key] = _this.form[key]
  486. }
  487. }
  488. let arrayData = [];
  489. arrayData.push(formData)
  490. let postData = {
  491. ckey: "SW_DWGWCBD",
  492. id: _this.form.ID,
  493. routeid: _this.routeid,
  494. routeinfoid: _this.routeinfoid,
  495. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  496. directionid: _this.directionid,
  497. formeditid: _this.formeditid,
  498. data: JSON.stringify(arrayData)
  499. };
  500. $http({
  501. method: 'post',
  502. baseURL: _this.apiurl,
  503. url: "g2app/abase/saveData",
  504. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  505. headers: {
  506. 'Content-Type': 'application/json',
  507. 'Authorization': "Bearer " + _this.token
  508. }
  509. }).then(res => {
  510. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  511. if (response.success) {
  512. $.alert("保存成功!", "温馨提示");
  513. _this.getFormDetail();
  514. } else {
  515. $.alert("保存失败,请联系管理员!", "温馨提示");
  516. }
  517. })
  518. } else {
  519. _this.$nextTick(() => {
  520. $.alert("当前模式下无法进行保存", "温馨提示");
  521. })
  522. }
  523. },
  524. getItemOption: (code) => {
  525. let postData = data = {
  526. cmanid: _this.userId,
  527. routeinfoid: _this.routeinfoid,
  528. routeid: _this.routeid,
  529. tableid: "SW_DWGWCBD",
  530. colid: code
  531. }
  532. return $http({
  533. method: 'post',
  534. baseURL: _this.apiurl,
  535. url: "g2app/abase/queryDataOpinion",
  536. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  537. headers: {
  538. 'Content-Type': 'application/json',
  539. 'Authorization': "Bearer " + _this.token
  540. }
  541. })
  542. },
  543. getAllOption: () => {
  544. _this.NBYJ = [];
  545. _this.LDPS = [];
  546. _this.CBYJ = [];
  547. // _this.NBYJEDIT = false;
  548. // _this.LDPSEDIT = false;
  549. // _this.CBYJEDIT = false;
  550. $http.all([_this.getItemOption('NBYJ'), _this.getItemOption('LDPS'), _this.getItemOption('CBYJ')]).then($http.spread((first, second, third) => {
  551. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  552. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  553. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  554. _this.NBYJ = response1.data;
  555. _this.LDPS = response2.data;
  556. _this.CBYJ = response3.data;
  557. let editNBYJ = 0;
  558. let editLDPS = 0;
  559. let editCBYJ = 0;
  560. _this.NBYJ.forEach(function (item) {
  561. if (item.ROUTEID == _this.routeid) {
  562. editNBYJ++
  563. }
  564. });
  565. _this.LDPS.forEach(function (item) {
  566. if (item.ROUTEID == _this.routeid) {
  567. editLDPS++
  568. }
  569. })
  570. _this.CBYJ.forEach(function (item) {
  571. if (item.ROUTEID == _this.routeid) {
  572. editCBYJ++
  573. }
  574. })
  575. if (editNBYJ > 0) {
  576. _this.NBYJEDIT = true;
  577. } else {
  578. _this.NBYJEDIT = false;
  579. }
  580. if (editLDPS > 0) {
  581. _this.LDPSEDIT = true;
  582. } else {
  583. _this.LDPSEDIT = false;
  584. }
  585. if (editCBYJ > 0) {
  586. _this.CBYJEDIT = true;
  587. } else {
  588. _this.CBYJEDIT = false;
  589. }
  590. }))
  591. },
  592. deleteOption: (code) => {
  593. $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
  594. let postData = {
  595. cmanid: _this.userId,
  596. routeid: _this.routeid,
  597. tableid: "SW_DWGWCBD",
  598. colid: code,
  599. };
  600. $http({
  601. method: 'post',
  602. baseURL: _this.apiurl,
  603. url: "g2app/abase/deleteDataOpinion",
  604. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  605. headers: {
  606. 'Content-Type': 'application/json',
  607. 'Authorization': "Bearer " + _this.token
  608. }
  609. }).then(res => {
  610. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  611. if (response.success) {
  612. _this.getAllOption();
  613. } else {
  614. $.alert("删除失败,请联系管理员!", "温馨提示");
  615. }
  616. })
  617. }, function () {
  618. //取消操作
  619. });
  620. },
  621. editOption: (type, index) => {
  622. _this.optionType = type;
  623. let nowEditObj = _this[type][index];
  624. if (_this.optionType == "") {
  625. $.alert("初始化失败,请联系管理员!", "温馨提示");
  626. } else {
  627. _this.optionContent = nowEditObj.OPINION;
  628. $(".open-popup").eq(0).click();
  629. }
  630. },
  631. addOption: (type) => {
  632. _this.optionType = type;
  633. _this.optionContent = "";
  634. if (_this.optionType == "") {
  635. $.alert("初始化失败,请联系管理员!", "温馨提示");
  636. } else {
  637. $(".open-popup").eq(0).click();
  638. }
  639. },
  640. saveOption: () => {
  641. $(".close-popup").eq(0).click();
  642. let postData = {
  643. cmanid: _this.userId,
  644. routeinfoid: _this.routeinfoid,
  645. routeid: _this.routeid,
  646. tableid: "SW_DWGWCBD",
  647. colid: _this.optionType,
  648. opiniontype: 0,
  649. cresult: "",
  650. opinion: _this.optionContent,
  651. opinionimage: ""
  652. };
  653. $http({
  654. method: 'post',
  655. baseURL: _this.apiurl,
  656. url: "g2app/abase/saveDataOpinion",
  657. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  658. headers: {
  659. 'Content-Type': 'application/json',
  660. 'Authorization': "Bearer " + _this.token
  661. }
  662. }).then(res => {
  663. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  664. if (response.success) {
  665. _this.getAllOption();
  666. } else {
  667. $.alert("删除失败,请联系管理员!", "温馨提示");
  668. }
  669. })
  670. },
  671. getBtnList: () => {
  672. let postData = {
  673. ckey: "SW_DWGWCBD",
  674. id: 0,
  675. directionid: _this.directionid,
  676. formeditid: _this.formeditid,
  677. routeid: _this.routeid,
  678. routeinfoid: _this.routeinfoid
  679. }
  680. $http({
  681. method: 'post',
  682. baseURL: _this.apiurl,
  683. url: "g2app/abase/queryData",
  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. _this.buttonList = _this.dotype == 0 ? [] : response.data["SW_DWGWCBD.FUNCLIST"];
  692. _this.buttonList.forEach(function (item) {
  693. if (item.CODE == "SAVEITEM") {
  694. _this.showSave = true;
  695. }
  696. })
  697. })
  698. },
  699. //调用打开永中的嵌入页
  700. openOfficePage: (item, type) => {
  701. let postData={
  702. type:type,
  703. obj:item
  704. }
  705. let dataString = s4.encryptData_CBC(JSON.stringify(postData));
  706. let goUrl = "officeedit.html?dataString=" + dataString;
  707. location.href = goUrl;
  708. }
  709. },
  710. created: function () {
  711. _this = this;
  712. let token = localStorage.getItem("mobile-token", _this.token);
  713. let userName = localStorage.getItem("mobile-userName", _this.userName);
  714. let userId = localStorage.getItem("mobile-userId", _this.userId);
  715. _this.userId = userId;
  716. _this.token = token;
  717. _this.userName = userName;
  718. _this.routeid = _this.utils.getUrlName("routeid");
  719. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  720. _this.directionid = _this.utils.getUrlName("directionid");
  721. _this.formeditid = _this.utils.getUrlName("formeditid");
  722. _this.docmode = _this.utils.getUrlName("docmode");
  723. _this.dotype = _this.utils.getUrlName("dotype");
  724. _this.type = _this.utils.getUrlName("type");
  725. },
  726. mounted: function () {
  727. _this.getAllCodeTable();
  728. _this.getBtnList();
  729. }
  730. })