formedit.js 31 KB

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