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