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