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