formedit.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. let s4 = new SM4Util();
  2. let detailVue = new Vue({
  3. el: "#detailBox",
  4. data: {
  5. apiurl: apiurl,//基础的页面请求地址
  6. userId: "", //用户id
  7. userName: "", //用户中文名
  8. token: "",
  9. nowTab: "tab1",
  10. routeid: "",
  11. routeinfoid: "",
  12. directionid: "",
  13. formeditid: "",
  14. docmode: "",
  15. dotype: "",
  16. type: "",
  17. routerList: [],
  18. fileList: [],
  19. isEnd: false,
  20. startX: 0,
  21. endX: 0,
  22. deleteSlider: '',//滑动时的效果
  23. JJCD: [],
  24. XXGKSH: [],
  25. GWZL: [],
  26. readonly: {
  27. JJCD: false,
  28. WLDQFL: false,
  29. WLDSSL: false,
  30. XXGKSH: false,
  31. BMFZRYJ: false,
  32. NGR: false,
  33. NGSJ: false,
  34. GWZL: false,
  35. YF: false,
  36. BT: false,
  37. ZS: false,
  38. CS: false,
  39. },
  40. form: {
  41. ID: "", //多一个id
  42. JJCD: "",
  43. JJCD_NAME: "",
  44. XXGKSH: "",
  45. XXGKSH_NAME: "",
  46. NGR: "",
  47. NGSJ: "",
  48. GWZL: "",
  49. GWZL_NAME: "",
  50. YF: "",
  51. BT: "",
  52. ZS: "",
  53. CS: "",
  54. },
  55. WLDQFL: [],
  56. WLDSSL: [],
  57. BMFZRYJ: [],
  58. WLDQFLEDIT: true,
  59. WLDSSLEDIT: true,
  60. BMFZRYJEDIT: true,
  61. optionType: "",
  62. optionContent: "",
  63. showSave: false,
  64. buttonList: [],
  65. departList: [],
  66. fileData1: [],
  67. fileData2: [],
  68. fileData3: []
  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. } else if (_this.nowTab == "tab4") {
  96. _this.getAllFile();
  97. }
  98. },
  99. getRouterList: () => {
  100. _this.routerList = [];
  101. let postData = {
  102. directionid: _this.directionid,
  103. userid: _this.userId,
  104. routeid: _this.routeid,
  105. routeinfoid: _this.routeinfoid,
  106. }
  107. $http({
  108. method: 'post',
  109. baseURL: _this.apiurl,
  110. url: "g2app/abase/queryDataRouteList",
  111. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  112. headers: {
  113. 'Content-Type': 'application/json',
  114. 'Authorization': "Bearer " + _this.token
  115. }
  116. }).then(res => {
  117. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  118. response.data.forEach(function (item) {
  119. item.mainUser = [];
  120. item.copyUsers = [];
  121. item.isNow = false;
  122. item.USERS.forEach(function (item2) {
  123. if (item2.KIND == 0) {
  124. item.mainUser.push(item2.USERNAME);
  125. } else {
  126. item.copyUsers.push(item2.USERNAME);
  127. }
  128. })
  129. item.NAME = "【" + item.STARTNODENAME + "】转" + "【" + item.ENDNODENAME + "】"
  130. item.mainUser = item.mainUser.join(",");
  131. item.copyUsers = item.copyUsers.join(",");
  132. })
  133. _this.routerList = response.data;
  134. if (_this.routerList[_this.routerList.length - 1].ENDNODENAME == '结束') {
  135. _this.isEnd = true;
  136. _this.routerList[_this.routerList.length - 1].isNow = false;
  137. } else {
  138. _this.routerList[_this.routerList.length - 1].isNow = true;
  139. _this.isEnd = false;
  140. }
  141. })
  142. },
  143. getFileList: () => {
  144. _this.fileList = [];
  145. let postData = {
  146. tablename: "FILE_ATTACH",
  147. colums: "*",
  148. order: "ID desc",
  149. sqlwhere: {ROUTEINFOID: _this.routeinfoid},
  150. sqlinwhere: "",
  151. sqllikewhere: ""
  152. }
  153. $http({
  154. method: 'post',
  155. baseURL: _this.apiurl,
  156. url: "g2app/dataabase/queryDataByCol",
  157. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  158. headers: {
  159. 'Content-Type': 'application/json',
  160. 'Authorization': "Bearer " + _this.token
  161. }
  162. }).then(res => {
  163. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  164. response.data.forEach(function (item) {
  165. item.deleteSlider = "transform:translateX(0px)";
  166. })
  167. _this.fileList = response.data;
  168. })
  169. },
  170. touchStart(e) {
  171. _this.startX = e.touches[0].clientX;
  172. },
  173. touchEnd(e) {
  174. let index = e.currentTarget.dataset.index;
  175. // 当前滑动的父级元素
  176. _this.endX = e.changedTouches[0].clientX;
  177. // 左滑
  178. if (_this.startX - _this.endX > 30) {
  179. _this.fileList.forEach(function (item) {
  180. item.deleteSlider = "transform:translateX(0px)";
  181. })
  182. _this.fileList[index].deleteSlider = "transform:translateX(-120px)";
  183. }
  184. // 右滑
  185. if (_this.startX - _this.endX < -30) {
  186. _this.fileList.forEach(function (item) {
  187. item.deleteSlider = "transform:translateX(0px)";
  188. })
  189. }
  190. _this.startX = 0;
  191. _this.endX = 0;
  192. },
  193. downLoad: (item) => {
  194. window.open(_this.apiurl + "g2work/files/" + item.FILEURL.slice(7));
  195. },
  196. deleteFile: (item) => {
  197. if (_this.dotype != 0) {
  198. _this.$nextTick(() => {
  199. $.confirm("您确定要删除当前附件吗?", "确认删除?", function () {
  200. let postData = {
  201. tablename: "FILE_ATTACH",
  202. id: item.ID
  203. };
  204. $http({
  205. method: 'post',
  206. baseURL: _this.apiurl,
  207. url: "g2app/dataabase/delDataById",
  208. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  209. headers: {
  210. 'Content-Type': 'application/json',
  211. 'Authorization': "Bearer " + _this.token
  212. }
  213. }).then(res => {
  214. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  215. if (response.success) {
  216. _this.getFileList();
  217. } else {
  218. $.alert("删除失败,请联系管理员!", "温馨提示");
  219. }
  220. })
  221. }, function () {
  222. //取消操作
  223. });
  224. })
  225. } else {
  226. _this.$nextTick(() => {
  227. $.alert("当前模式下无法删除附件", "温馨提示");
  228. })
  229. }
  230. },
  231. sendBtn: () => {
  232. if (_this.dotype != 0) {
  233. let formData = {};
  234. for (let key in _this.form) {
  235. if (key.indexOf("_NAME") == -1) {
  236. formData[key] = _this.form[key]
  237. }
  238. }
  239. let arrayData = [];
  240. arrayData.push(formData)
  241. let postData = {
  242. ckey: "FW_ZFGJJFWCLD",
  243. id: _this.form.ID,
  244. routeid: _this.routeid,
  245. routeinfoid: _this.routeinfoid,
  246. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  247. directionid: _this.directionid,
  248. formeditid: _this.formeditid,
  249. data: JSON.stringify(arrayData)
  250. };
  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. if (response.success) {
  263. 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;
  264. } else {
  265. $.alert("保存表单失败,无法进行转发,请联系管理员!", "温馨提示");
  266. }
  267. })
  268. } else {
  269. _this.$nextTick(() => {
  270. $.alert("当前模式下无法进行转发", "温馨提示");
  271. })
  272. }
  273. },
  274. getItemCodeTable: (tablename) => {
  275. let postData = {
  276. ckey: tablename,
  277. routeinfoid: _this.routeinfoid
  278. }
  279. return $http({
  280. method: 'post',
  281. baseURL: _this.apiurl,
  282. url: "g2app/abase/queryDataCode",
  283. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  284. headers: {
  285. 'Content-Type': 'application/json',
  286. 'Authorization': "Bearer " + _this.token
  287. }
  288. })
  289. },
  290. getAllCodeTable: () => {
  291. $http.all([_this.getItemCodeTable('CODE_JJCD'),
  292. _this.getItemCodeTable('CODE_XXGKSH'),
  293. _this.getItemCodeTable('CODE_GWTYPE'),
  294. _this.getDepartOption()]).then($http.spread((first, second, third, forth, fifth) => {
  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. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  299. _this.JJCD = response1.data.CODE_JJCD;
  300. _this.XXGKSH = response2.data.CODE_XXGKSH;
  301. _this.GWZL = response3.data.CODE_GWTYPE;
  302. _this.departList = response4.data;
  303. _this.getFormDetail();
  304. _this.getAllOption();
  305. }))
  306. },
  307. getFormDetail: () => {
  308. let postData = {
  309. ckey: "FW_ZFGJJFWCLD",
  310. id: 0,
  311. directionid: _this.directionid,
  312. formeditid: _this.formeditid,
  313. routeid: _this.routeid,
  314. routeinfoid: _this.routeinfoid
  315. }
  316. $http({
  317. method: 'post',
  318. baseURL: _this.apiurl,
  319. url: "g2app/abase/queryData",
  320. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  321. headers: {
  322. 'Content-Type': 'application/json',
  323. 'Authorization': "Bearer " + _this.token
  324. }
  325. }).then(res => {
  326. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  327. //0表单禁用
  328. if (_this.dotype == '0') {
  329. _this.readonly = {
  330. JJCD: true,
  331. WLDQFL: true,
  332. WLDSSL: true,
  333. XXGKSH: true,
  334. BMFZRYJ: true,
  335. NGR: true,
  336. NGSJ: true,
  337. GWZL: true,
  338. YF: true,
  339. BT: true,
  340. ZS: true,
  341. CS: true,
  342. }
  343. } else {
  344. _this.readonly = {
  345. JJCD: response.data.FW_ZFGJJFWCLD["JJCD.EREADONLY"] == "true",
  346. WLDQFL: response.data.FW_ZFGJJFWCLD["WLDQFL.EREADONLY"] == "true",
  347. WLDSSL: response.data.FW_ZFGJJFWCLD["WLDSSL.EREADONLY"] == "true",
  348. XXGKSH: response.data.FW_ZFGJJFWCLD["XXGKSH.EREADONLY"] == "true",
  349. BMFZRYJ: response.data.FW_ZFGJJFWCLD["BMFZRYJ.EREADONLY"] == "true",
  350. NGR: response.data.FW_ZFGJJFWCLD["NGR.EREADONLY"] == "true",
  351. NGSJ: response.data.FW_ZFGJJFWCLD["NGSJ.EREADONLY"] == "true",
  352. GWZL: response.data.FW_ZFGJJFWCLD["GWZL.EREADONLY"] == "true",
  353. YF: response.data.FW_ZFGJJFWCLD["YF.EREADONLY"] == "true",
  354. BT: response.data.FW_ZFGJJFWCLD["BT.EREADONLY"] == "true",
  355. ZS: response.data.FW_ZFGJJFWCLD["ZS.EREADONLY"] == "true",
  356. CS: response.data.FW_ZFGJJFWCLD["CS.EREADONLY"] == "true",
  357. }
  358. }
  359. _this.form = {
  360. ID: response.data.FW_ZFGJJFWCLD.ID,
  361. JJCD: response.data.FW_ZFGJJFWCLD.JJCD == "" ? _this.JJCD[0].CODE : response.data.FW_ZFGJJFWCLD.JJCD,
  362. XXGKSH: response.data.FW_ZFGJJFWCLD.XXGKSH == "" ? _this.XXGKSH[0].CODE : response.data.FW_ZFGJJFWCLD.XXGKSH,
  363. GWZL: response.data.FW_ZFGJJFWCLD.GWZL == "" ? _this.GWZL[0].CODE : response.data.FW_ZFGJJFWCLD.GWZL,
  364. NGSJ: (response.data.FW_ZFGJJFWCLD.NGSJ == "" || response.data.FW_ZFGJJFWCLD.NGSJ == null || response.data.FW_ZFGJJFWCLD.NGSJ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.FW_ZFGJJFWCLD.NGSJ),
  365. NGR: response.data.FW_ZFGJJFWCLD.NGR,
  366. YF: response.data.FW_ZFGJJFWCLD.YF,
  367. BT: response.data.FW_ZFGJJFWCLD.BT,
  368. ZS: response.data.FW_ZFGJJFWCLD.ZS,
  369. CS: response.data.FW_ZFGJJFWCLD.CS,
  370. }
  371. if (response.data.FW_ZFGJJFWCLD.JJCD == "") {
  372. _this.form.JJCD_NAME = _this.JJCD[0].CNAME;
  373. } else {
  374. _this.JJCD.forEach(function (item) {
  375. if (item.CODE == response.data.FW_ZFGJJFWCLD.JJCD) {
  376. _this.form.JJCD_NAME = item.CNAME;
  377. }
  378. })
  379. }
  380. if (response.data.FW_ZFGJJFWCLD.XXGKSH == "") {
  381. _this.form.XXGKSH_NAME = _this.XXGKSH[0].CNAME;
  382. } else {
  383. _this.XXGKSH.forEach(function (item) {
  384. if (item.CODE == response.data.FW_ZFGJJFWCLD.XXGKSH) {
  385. _this.form.XXGKSH_NAME = item.CNAME;
  386. }
  387. })
  388. }
  389. if (response.data.FW_ZFGJJFWCLD.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_ZFGJJFWCLD.GWZL) {
  394. _this.form.GWZL_NAME = item.CNAME;
  395. }
  396. })
  397. }
  398. _this.$nextTick(() => {
  399. _this.initInputPlug();
  400. })
  401. })
  402. },
  403. initInputPlug: () => {
  404. $("#NGSJ").calendar({
  405. onChange: function (p, values, displayValues) {
  406. _this.form.NGSJ = values[0];
  407. }
  408. });
  409. let listJJCD = [];
  410. let listXXGKSH = [];
  411. let listGWZL = [];
  412. _this.JJCD.forEach(function (item) {
  413. listJJCD.push(item.CNAME);
  414. })
  415. _this.XXGKSH.forEach(function (item) {
  416. listXXGKSH.push(item.CNAME);
  417. })
  418. _this.GWZL.forEach(function (item) {
  419. listGWZL.push(item.CNAME);
  420. })
  421. $("#JJCD").picker({
  422. title: "请选择紧急程度",
  423. cols: [
  424. {
  425. textAlign: 'center',
  426. values: listJJCD
  427. }
  428. ],
  429. onChange: function (p, v, dv) {
  430. _this.form.JJCD_NAME = v[0];
  431. _this.JJCD.forEach(function (item) {
  432. if (item.CNAME == v[0]) {
  433. _this.form.JJCD = item.CODE;
  434. }
  435. })
  436. },
  437. });
  438. $("#XXGKSH").picker({
  439. title: "请选择信息公开审核",
  440. cols: [
  441. {
  442. textAlign: 'center',
  443. values: listXXGKSH
  444. }
  445. ],
  446. onChange: function (p, v, dv) {
  447. _this.form.XXGKSH_NAME = v[0];
  448. _this.XXGKSH.forEach(function (item) {
  449. if (item.CNAME == v[0]) {
  450. _this.form.XXGKSH = item.CODE;
  451. }
  452. })
  453. },
  454. });
  455. $("#GWZL").picker({
  456. title: "请选择公文种类",
  457. cols: [
  458. {
  459. textAlign: 'center',
  460. values: listGWZL
  461. }
  462. ],
  463. onChange: function (p, v, dv) {
  464. _this.form.GWZL_NAME = v[0];
  465. _this.GWZL.forEach(function (item) {
  466. if (item.CNAME == v[0]) {
  467. _this.form.GWZL = item.CODE;
  468. }
  469. })
  470. },
  471. });
  472. let optionDepart = [];
  473. _this.departList.forEach(function (item) {
  474. optionDepart.push({
  475. title: item.DEP,
  476. value: item.DEPCODE,
  477. description: item.DEP
  478. })
  479. })
  480. $("#ZS").select({
  481. title: "请选择主送",
  482. multi: true,
  483. items: optionDepart,
  484. onChange: function (d) {
  485. },
  486. onClose: function (d) {
  487. _this.form.ZS = d.data.titles;
  488. }
  489. });
  490. $("#CS").select({
  491. title: "请选择抄送",
  492. multi: true,
  493. items: optionDepart,
  494. onChange: function (d) {
  495. },
  496. onClose: function (d) {
  497. _this.form.CS = d.data.titles;
  498. }
  499. });
  500. },
  501. saveBtn: () => {
  502. if (_this.dotype != 0) {
  503. let formData = {};
  504. for (let key in _this.form) {
  505. if (key.indexOf("_NAME") == -1) {
  506. formData[key] = _this.form[key]
  507. }
  508. }
  509. let arrayData = [];
  510. arrayData.push(formData)
  511. let postData = {
  512. ckey: "FW_ZFGJJFWCLD",
  513. id: _this.form.ID,
  514. routeid: _this.routeid,
  515. routeinfoid: _this.routeinfoid,
  516. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  517. directionid: _this.directionid,
  518. formeditid: _this.formeditid,
  519. data: JSON.stringify(arrayData)
  520. };
  521. $http({
  522. method: 'post',
  523. baseURL: _this.apiurl,
  524. url: "g2app/abase/saveData",
  525. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  526. headers: {
  527. 'Content-Type': 'application/json',
  528. 'Authorization': "Bearer " + _this.token
  529. }
  530. }).then(res => {
  531. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  532. if (response.success) {
  533. $.alert("保存成功!", "温馨提示");
  534. _this.getFormDetail();
  535. } else {
  536. $.alert("保存失败,请联系管理员!", "温馨提示");
  537. }
  538. })
  539. } else {
  540. _this.$nextTick(() => {
  541. $.alert("当前模式下无法进行保存", "温馨提示");
  542. })
  543. }
  544. },
  545. getItemOption: (code) => {
  546. let postData = {
  547. cmanid: _this.userId,
  548. routeinfoid: _this.routeinfoid,
  549. routeid: _this.routeid,
  550. tableid: "FW_ZFGJJFWCLD",
  551. colid: code
  552. }
  553. return $http({
  554. method: 'post',
  555. baseURL: _this.apiurl,
  556. url: "g2app/abase/queryDataOpinion",
  557. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  558. headers: {
  559. 'Content-Type': 'application/json',
  560. 'Authorization': "Bearer " + _this.token
  561. }
  562. })
  563. },
  564. getAllOption: () => {
  565. _this.WLDQFL = [];
  566. _this.WLDSSL = [];
  567. _this.BMFZRYJ = [];
  568. $http.all([_this.getItemOption('WLDQFL'),
  569. _this.getItemOption('WLDSSL'),
  570. _this.getItemOption('BMFZRYJ')]).then($http.spread((first, second, third) => {
  571. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  572. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  573. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  574. _this.WLDQFL = response1.data;
  575. _this.WLDSSL = response2.data;
  576. _this.BMFZRYJ = response3.data;
  577. _this.dealOption('WLDQFL');
  578. _this.dealOption('WLDSSL');
  579. _this.dealOption('BMFZRYJ');
  580. }))
  581. },
  582. deleteOption: (code) => {
  583. $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
  584. let postData = {
  585. cmanid: _this.userId,
  586. routeid: _this.routeid,
  587. tableid: "FW_ZFGJJFWCLD",
  588. colid: code,
  589. };
  590. $http({
  591. method: 'post',
  592. baseURL: _this.apiurl,
  593. url: "g2app/abase/deleteDataOpinion",
  594. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  595. headers: {
  596. 'Content-Type': 'application/json',
  597. 'Authorization': "Bearer " + _this.token
  598. }
  599. }).then(res => {
  600. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  601. if (response.success) {
  602. _this.getAllOption();
  603. } else {
  604. $.alert("删除失败,请联系管理员!", "温馨提示");
  605. }
  606. })
  607. }, function () {
  608. //取消操作
  609. });
  610. },
  611. editOption: (type, index) => {
  612. _this.optionType = type;
  613. let nowEditObj = _this[type][index];
  614. if (_this.optionType == "") {
  615. $.alert("初始化失败,请联系管理员!", "温馨提示");
  616. } else {
  617. _this.optionContent = nowEditObj.OPINION;
  618. $(".open-popup").eq(0).click();
  619. }
  620. },
  621. addOption: (type) => {
  622. _this.optionType = type;
  623. _this.optionContent = "";
  624. if (_this.optionType == "") {
  625. $.alert("初始化失败,请联系管理员!", "温馨提示");
  626. } else {
  627. $(".open-popup").eq(0).click();
  628. }
  629. },
  630. saveOption: () => {
  631. $(".close-popup").eq(0).click();
  632. let postData = {
  633. cmanid: _this.userId,
  634. routeinfoid: _this.routeinfoid,
  635. routeid: _this.routeid,
  636. tableid: "FW_ZFGJJFWCLD",
  637. colid: _this.optionType,
  638. opiniontype: 0,
  639. cresult: "",
  640. opinion: _this.optionContent,
  641. opinionimage: ""
  642. };
  643. $http({
  644. method: 'post',
  645. baseURL: _this.apiurl,
  646. url: "g2app/abase/saveDataOpinion",
  647. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  648. headers: {
  649. 'Content-Type': 'application/json',
  650. 'Authorization': "Bearer " + _this.token
  651. }
  652. }).then(res => {
  653. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  654. if (response.success) {
  655. _this.getAllOption();
  656. } else {
  657. $.alert("删除失败,请联系管理员!", "温馨提示");
  658. }
  659. })
  660. },
  661. getBtnList: () => {
  662. let postData = {
  663. ckey: "FW_ZFGJJFWCLD",
  664. id: 0,
  665. directionid: _this.directionid,
  666. formeditid: _this.formeditid,
  667. routeid: _this.routeid,
  668. routeinfoid: _this.routeinfoid
  669. }
  670. $http({
  671. method: 'post',
  672. baseURL: _this.apiurl,
  673. url: "g2app/abase/queryData",
  674. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  675. headers: {
  676. 'Content-Type': 'application/json',
  677. 'Authorization': "Bearer " + _this.token
  678. }
  679. }).then(res => {
  680. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  681. _this.buttonList = _this.dotype == 0 ? [] : response.data["FW_ZFGJJFWCLD.FUNCLIST"];
  682. _this.buttonList.forEach(function (item) {
  683. if (item.CODE == "SAVEITEM") {
  684. _this.showSave = true;
  685. }
  686. })
  687. })
  688. },
  689. //增补一个函数
  690. dealOption: (key) => {
  691. let num = 0;
  692. let keyEdit = key + "EDIT";
  693. _this[key].forEach(function (item) {
  694. if (item.ROUTEID == _this.routeid) {
  695. num++
  696. }
  697. })
  698. if (num > 0) {
  699. _this[keyEdit] = true;
  700. } else {
  701. _this[keyEdit] = false;
  702. }
  703. },
  704. //拿回主动抄送的部门选项,和加载滚动选项一起执行
  705. getDepartOption: () => {
  706. return $http({
  707. method: 'post',
  708. baseURL: _this.apiurl,
  709. url: "g2app/dataabase/getDpList",
  710. data: {data: s4.encryptData_CBC(JSON.stringify(""))},
  711. headers: {
  712. 'Content-Type': 'application/json',
  713. 'Authorization': "Bearer " + _this.token
  714. }
  715. })
  716. },
  717. //获取单个文稿列表
  718. getItemFile: (code) => {
  719. let postData = {
  720. dockind: code,
  721. routeinfoid: _this.routeinfoid
  722. }
  723. return $http({
  724. method: 'post',
  725. baseURL: _this.apiurl,
  726. url: "g2app/fawenfiles/queryDataList",
  727. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  728. headers: {
  729. 'Content-Type': 'application/json',
  730. 'Authorization': "Bearer " + _this.token
  731. }
  732. })
  733. },
  734. //获取全部类型文稿列表
  735. getAllFile: () => {
  736. $http.all([_this.getItemFile('D01'),
  737. _this.getItemFile('D02'),
  738. _this.getItemFile('D03')]).then($http.spread((first, second, third) => {
  739. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  740. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  741. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  742. _this.fileData1 = response1.data;
  743. _this.fileData2 = response2.data;
  744. _this.fileData3 = response3.data;
  745. }))
  746. },
  747. //调用打开永中的嵌入页
  748. openOfficePage: (item, type) => {
  749. let postData={
  750. type:type,
  751. obj:item
  752. }
  753. let dataString = s4.encryptData_CBC(JSON.stringify(postData));
  754. let goUrl = "officeedit.html?dataString=" + dataString;
  755. location.href = goUrl;
  756. }
  757. },
  758. created: function () {
  759. _this = this;
  760. let token = localStorage.getItem("mobile-token", _this.token);
  761. let userName = localStorage.getItem("mobile-userName", _this.userName);
  762. let userId = localStorage.getItem("mobile-userId", _this.userId);
  763. _this.userId = userId;
  764. _this.token = token;
  765. _this.userName = userName;
  766. _this.routeid = _this.utils.getUrlName("routeid");
  767. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  768. _this.directionid = _this.utils.getUrlName("directionid");
  769. _this.formeditid = _this.utils.getUrlName("formeditid");
  770. _this.docmode = _this.utils.getUrlName("docmode");
  771. _this.dotype = _this.utils.getUrlName("dotype");
  772. _this.type = _this.utils.getUrlName("type");
  773. },
  774. mounted: function () {
  775. _this.getAllCodeTable();
  776. _this.getBtnList();
  777. }
  778. })