formedit.js 29 KB

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