formedit.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  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. SFXYJD: [],
  27. ZDGKLM: [],
  28. ZDGKZT: [],
  29. readonly: {
  30. JJCD: false,
  31. WLDQFL: false,
  32. WLDSSL: false,
  33. XXGKSH: false,
  34. SFXYJD: false,
  35. ZDGKLM: false,
  36. ZDGKZT: false,
  37. FLSH: false,
  38. GPJZSC: false,
  39. BGSFHYJ: false,
  40. SX: false,
  41. BMFZRYJ: false,
  42. NGR: false,
  43. NGSJ: false,
  44. HBCSYJ: false,
  45. GWZL: false,
  46. YF: false,
  47. BT: false,
  48. ZS: false,
  49. CS: false
  50. },
  51. form: {
  52. ID: "", //多一个id
  53. JJCD: "",
  54. JJCD_NAME: "",
  55. XXGKSH: "",
  56. XXGKSH_NAME: "",
  57. SFXYJD: "",
  58. SFXYJD_NAME: "",
  59. ZDGKLM: "",
  60. ZDGKLM_NAME: "",
  61. ZDGKZT: "",
  62. ZDGKZT_NAME: "",
  63. NGR: "",
  64. NGSJ: "",
  65. GWZL: "",
  66. GWZL_NAME: "",
  67. YF: "",
  68. BT: "",
  69. ZS: "",
  70. CS: ""
  71. },
  72. WLDQFL: [],
  73. WLDSSL: [],
  74. FLSH: [],
  75. GPJZSC: [],
  76. BGSFHYJ: [],
  77. SX: [],
  78. BMFZRYJ: [],
  79. HBCSYJ: [],
  80. WLDQFLEDIT: true,
  81. WLDSSLEDIT: true,
  82. FLSHEDIT: true,
  83. GPJZSCEDIT: true,
  84. BGSFHYJEDIT: true,
  85. SXEDIT: true,
  86. BMFZRYJEDIT: true,
  87. HBCSYJEDIT: true,
  88. optionType: "",
  89. optionContent: "",
  90. showSave: false,
  91. buttonList: [],
  92. departList:[]
  93. },
  94. methods: {
  95. dateFtt: (fmt, date) => {
  96. var o = {
  97. "M+": date.getMonth() + 1, //月份
  98. "d+": date.getDate(), //日
  99. "h+": date.getHours(), //小时
  100. "m+": date.getMinutes(), //分
  101. "s+": date.getSeconds(), //秒
  102. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  103. "S": date.getMilliseconds() //毫秒
  104. };
  105. if (/(y+)/.test(fmt))
  106. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  107. for (var k in o)
  108. if (new RegExp("(" + k + ")").test(fmt))
  109. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  110. return fmt;
  111. },
  112. changeTab: (tabCode) => {
  113. _this.nowTab = tabCode;
  114. if (_this.nowTab == "tab1") {
  115. } else if (_this.nowTab == "tab2") {
  116. _this.getFileList();
  117. } else if (_this.nowTab == "tab3") {
  118. _this.getRouterList();
  119. }
  120. },
  121. getRouterList: () => {
  122. _this.routerList = [];
  123. let postData = {
  124. directionid: _this.directionid,
  125. userid: _this.userId,
  126. routeid: _this.routeid,
  127. routeinfoid: _this.routeinfoid,
  128. }
  129. $http({
  130. method: 'post',
  131. baseURL: _this.apiurl,
  132. url: "g2app/abase/queryDataRouteList",
  133. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  134. headers: {
  135. 'Content-Type': 'application/json',
  136. 'Authorization': "Bearer " + _this.token
  137. }
  138. }).then(res => {
  139. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  140. response.data.forEach(function (item) {
  141. item.mainUser = [];
  142. item.copyUsers = [];
  143. item.isNow = false;
  144. item.USERS.forEach(function (item2) {
  145. if (item2.KIND == 0) {
  146. item.mainUser.push(item2.USERNAME);
  147. } else {
  148. item.copyUsers.push(item2.USERNAME);
  149. }
  150. })
  151. item.NAME = "【" + item.STARTNODENAME + "】转" + "【" + item.ENDNODENAME + "】"
  152. item.mainUser = item.mainUser.join(",");
  153. item.copyUsers = item.copyUsers.join(",");
  154. })
  155. _this.routerList = response.data;
  156. if (_this.routerList[_this.routerList.length - 1].ENDNODENAME == '结束') {
  157. _this.isEnd = true;
  158. _this.routerList[_this.routerList.length - 1].isNow = false;
  159. } else {
  160. _this.routerList[_this.routerList.length - 1].isNow = true;
  161. _this.isEnd = false;
  162. }
  163. })
  164. },
  165. getFileList: () => {
  166. _this.fileList = [];
  167. let postData = {
  168. tablename: "FILE_ATTACH",
  169. colums: "*",
  170. order: "ID desc",
  171. sqlwhere: {ROUTEINFOID: _this.routeinfoid},
  172. sqlinwhere: "",
  173. sqllikewhere: ""
  174. }
  175. $http({
  176. method: 'post',
  177. baseURL: _this.apiurl,
  178. url: "g2app/dataabase/queryDataByCol",
  179. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  180. headers: {
  181. 'Content-Type': 'application/json',
  182. 'Authorization': "Bearer " + _this.token
  183. }
  184. }).then(res => {
  185. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  186. response.data.forEach(function (item) {
  187. item.deleteSlider = "transform:translateX(0px)";
  188. })
  189. _this.fileList = response.data;
  190. })
  191. },
  192. touchStart(e) {
  193. _this.startX = e.touches[0].clientX;
  194. },
  195. touchEnd(e) {
  196. let index = e.currentTarget.dataset.index;
  197. // 当前滑动的父级元素
  198. _this.endX = e.changedTouches[0].clientX;
  199. // 左滑
  200. if (_this.startX - _this.endX > 30) {
  201. _this.fileList.forEach(function (item) {
  202. item.deleteSlider = "transform:translateX(0px)";
  203. })
  204. _this.fileList[index].deleteSlider = "transform:translateX(-120px)";
  205. }
  206. // 右滑
  207. if (_this.startX - _this.endX < -30) {
  208. _this.fileList.forEach(function (item) {
  209. item.deleteSlider = "transform:translateX(0px)";
  210. })
  211. }
  212. _this.startX = 0;
  213. _this.endX = 0;
  214. },
  215. downLoad: (item) => {
  216. window.open(_this.apiurl + "g2work/files/" + item.FILEURL.slice(7));
  217. },
  218. deleteFile: (item) => {
  219. if (_this.dotype != 0) {
  220. _this.$nextTick(() => {
  221. $.confirm("您确定要删除当前附件吗?", "确认删除?", function () {
  222. let postData = {
  223. tablename: "FILE_ATTACH",
  224. id: item.ID
  225. };
  226. $http({
  227. method: 'post',
  228. baseURL: _this.apiurl,
  229. url: "g2app/dataabase/delDataById",
  230. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  231. headers: {
  232. 'Content-Type': 'application/json',
  233. 'Authorization': "Bearer " + _this.token
  234. }
  235. }).then(res => {
  236. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  237. if (response.success) {
  238. _this.getFileList();
  239. } else {
  240. $.alert("删除失败,请联系管理员!", "温馨提示");
  241. }
  242. })
  243. }, function () {
  244. //取消操作
  245. });
  246. })
  247. } else {
  248. _this.$nextTick(() => {
  249. $.alert("当前模式下无法删除附件", "温馨提示");
  250. })
  251. }
  252. },
  253. sendBtn: () => {
  254. if (_this.dotype != 0) {
  255. let formData = {};
  256. for (let key in _this.form) {
  257. if (key.indexOf("_NAME") == -1) {
  258. formData[key] = _this.form[key]
  259. }
  260. }
  261. let arrayData = [];
  262. arrayData.push(formData)
  263. let postData = {
  264. ckey: "FW_WFH",
  265. id: _this.form.ID,
  266. routeid: _this.routeid,
  267. routeinfoid: _this.routeinfoid,
  268. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  269. directionid: _this.directionid,
  270. formeditid: _this.formeditid,
  271. data: JSON.stringify(arrayData)
  272. };
  273. $http({
  274. method: 'post',
  275. baseURL: _this.apiurl,
  276. url: "g2app/abase/saveData",
  277. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  278. headers: {
  279. 'Content-Type': 'application/json',
  280. 'Authorization': "Bearer " + _this.token
  281. }
  282. }).then(res => {
  283. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  284. if (response.success) {
  285. 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;
  286. } else {
  287. $.alert("保存表单失败,无法进行转发,请联系管理员!", "温馨提示");
  288. }
  289. })
  290. } else {
  291. _this.$nextTick(() => {
  292. $.alert("当前模式下无法进行转发", "温馨提示");
  293. })
  294. }
  295. },
  296. getItemCodeTable: (tablename) => {
  297. let postData = {
  298. ckey: tablename,
  299. routeinfoid: _this.routeinfoid
  300. }
  301. return $http({
  302. method: 'post',
  303. baseURL: _this.apiurl,
  304. url: "g2app/abase/queryDataCode",
  305. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  306. headers: {
  307. 'Content-Type': 'application/json',
  308. 'Authorization': "Bearer " + _this.token
  309. }
  310. })
  311. },
  312. getAllCodeTable: () => {
  313. $http.all([_this.getItemCodeTable('CODE_JJCD'),
  314. _this.getItemCodeTable('CODE_XXGKSH'),
  315. _this.getItemCodeTable('CODE_GWTYPE'),
  316. _this.getItemCodeTable('CODE_SFXYJD'),
  317. _this.getItemCodeTable('CODE_ZDGKLM'),
  318. _this.getItemCodeTable('CODE_ZDGKZT'),
  319. _this.getDepartOption()]).then($http.spread((first, second, third, forth, fifth, sixth,seventh) => {
  320. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  321. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  322. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  323. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  324. let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  325. let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data));
  326. let response7 = _this.utils.strToJson(s4.decryptData_CBC(seventh.data.data));
  327. _this.JJCD = response1.data.CODE_JJCD;
  328. _this.XXGKSH = response2.data.CODE_XXGKSH;
  329. _this.GWZL = response3.data.CODE_GWTYPE;
  330. _this.SFXYJD = response4.data.CODE_SFXYJD;
  331. _this.ZDGKLM = response5.data.CODE_ZDGKLM;
  332. _this.ZDGKZT = response6.data.CODE_ZDGKZT;
  333. _this.departList = response7.data;
  334. _this.getFormDetail();
  335. _this.getAllOption();
  336. }))
  337. },
  338. getFormDetail: () => {
  339. let postData = {
  340. ckey: "FW_WFH",
  341. id: 0,
  342. directionid: _this.directionid,
  343. formeditid: _this.formeditid,
  344. routeid: _this.routeid,
  345. routeinfoid: _this.routeinfoid
  346. }
  347. $http({
  348. method: 'post',
  349. baseURL: _this.apiurl,
  350. url: "g2app/abase/queryData",
  351. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  352. headers: {
  353. 'Content-Type': 'application/json',
  354. 'Authorization': "Bearer " + _this.token
  355. }
  356. }).then(res => {
  357. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  358. //0表单禁用
  359. if (_this.dotype == '0') {
  360. _this.readonly = {
  361. JJCD: true,
  362. WLDQFL: true,
  363. WLDSSL: true,
  364. XXGKSH: true,
  365. SFXYJD: true,
  366. ZDGKLM: true,
  367. ZDGKZT: true,
  368. FLSH: true,
  369. GPJZSC: true,
  370. BGSFHYJ: true,
  371. SX: true,
  372. BMFZRYJ: true,
  373. NGR: true,
  374. NGSJ: true,
  375. HBCSYJ: true,
  376. GWZL: true,
  377. YF: true,
  378. BT: true,
  379. ZS: true,
  380. CS: true
  381. }
  382. } else {
  383. _this.readonly = {
  384. JJCD: response.data.FW_WFH["JJCD.EREADONLY"] == "true",
  385. WLDQFL: response.data.FW_WFH["WLDQFL.EREADONLY"] == "true",
  386. WLDSSL: response.data.FW_WFH["WLDSSL.EREADONLY"] == "true",
  387. XXGKSH: response.data.FW_WFH["XXGKSH.EREADONLY"] == "true",
  388. SFXYJD: response.data.FW_WFH["SFXYJD.EREADONLY"] == "true",
  389. ZDGKLM: response.data.FW_WFH["ZDGKLM.EREADONLY"] == "true",
  390. ZDGKZT: response.data.FW_WFH["ZDGKZT.EREADONLY"] == "true",
  391. FLSH: response.data.FW_WFH["FLSH.EREADONLY"] == "true",
  392. GPJZSC: response.data.FW_WFH["GPJZSC.EREADONLY"] == "true",
  393. BGSFHYJ: response.data.FW_WFH["BGSFHYJ.EREADONLY"] == "true",
  394. SX: response.data.FW_WFH["SX.EREADONLY"] == "true",
  395. BMFZRYJ: response.data.FW_WFH["BMFZRYJ.EREADONLY"] == "true",
  396. NGR: response.data.FW_WFH["NGR.EREADONLY"] == "true",
  397. NGSJ: response.data.FW_WFH["NGSJ.EREADONLY"] == "true",
  398. HBCSYJ: response.data.FW_WFH["HBCSYJ.EREADONLY"] == "true",
  399. GWZL: response.data.FW_WFH["GWZL.EREADONLY"] == "true",
  400. YF: response.data.FW_WFH["YF.EREADONLY"] == "true",
  401. BT: response.data.FW_WFH["BT.EREADONLY"] == "true",
  402. ZS: response.data.FW_WFH["ZS.EREADONLY"] == "true",
  403. CS: response.data.FW_WFH["CS.EREADONLY"] == "true",
  404. }
  405. }
  406. _this.form = {
  407. ID: response.data.FW_WFH.ID,
  408. JJCD: response.data.FW_WFH.JJCD == "" ? _this.JJCD[0].CODE : response.data.FW_WFH.JJCD,
  409. XXGKSH: response.data.FW_WFH.XXGKSH == "" ? _this.XXGKSH[0].CODE : response.data.FW_WFH.XXGKSH,
  410. SFXYJD: response.data.FW_WFH.SFXYJD == "" ? _this.SFXYJD[0].CODE : response.data.FW_WFH.SFXYJD,
  411. ZDGKLM: response.data.FW_WFH.ZDGKLM == "" ? _this.ZDGKLM[0].CODE : response.data.FW_WFH.ZDGKLM,
  412. ZDGKZT: response.data.FW_WFH.ZDGKZT == "" ? _this.ZDGKZT[0].CODE : response.data.FW_WFH.ZDGKZT,
  413. GWZL: response.data.FW_WFH.GWZL == "" ? _this.GWZL[0].CODE : response.data.FW_WFH.GWZL,
  414. NGSJ: (response.data.FW_WFH.NGSJ == "" || response.data.FW_WFH.NGSJ == null || response.data.FW_WFH.NGSJ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.FW_WFH.NGSJ),
  415. NGR: response.data.FW_WFH.NGR,
  416. YF: response.data.FW_WFH.YF,
  417. BT: response.data.FW_WFH.BT,
  418. ZS: response.data.FW_WFH.ZS,
  419. CS: response.data.FW_WFH.CS
  420. }
  421. if (response.data.FW_WFH.JJCD == "") {
  422. _this.form.JJCD_NAME = _this.JJCD[0].CNAME;
  423. } else {
  424. _this.JJCD.forEach(function (item) {
  425. if (item.CODE == response.data.FW_WFH.JJCD) {
  426. _this.form.JJCD_NAME = item.CNAME;
  427. }
  428. })
  429. }
  430. if (response.data.FW_WFH.XXGKSH == "") {
  431. _this.form.XXGKSH_NAME = _this.XXGKSH[0].CNAME;
  432. } else {
  433. _this.XXGKSH.forEach(function (item) {
  434. if (item.CODE == response.data.FW_WFH.XXGKSH) {
  435. _this.form.XXGKSH_NAME = item.CNAME;
  436. }
  437. })
  438. }
  439. if (response.data.FW_WFH.SFXYJD == "") {
  440. _this.form.SFXYJD_NAME = _this.SFXYJD[0].CNAME;
  441. } else {
  442. _this.SFXYJD.forEach(function (item) {
  443. if (item.CODE == response.data.FW_WFH.SFXYJD) {
  444. _this.form.SFXYJD_NAME = item.CNAME;
  445. }
  446. })
  447. }
  448. if (response.data.FW_WFH.ZDGKLM == "") {
  449. _this.form.ZDGKLM_NAME = _this.ZDGKLM[0].CNAME;
  450. } else {
  451. _this.ZDGKLM.forEach(function (item) {
  452. if (item.CODE == response.data.FW_WFH.ZDGKLM) {
  453. _this.form.ZDGKLM_NAME = item.CNAME;
  454. }
  455. })
  456. }
  457. if (response.data.FW_WFH.ZDGKZT == "") {
  458. _this.form.ZDGKZT_NAME = _this.ZDGKZT[0].CNAME;
  459. } else {
  460. _this.ZDGKZT.forEach(function (item) {
  461. if (item.CODE == response.data.FW_WFH.ZDGKZT) {
  462. _this.form.ZDGKZT_NAME = item.CNAME;
  463. }
  464. })
  465. }
  466. if (response.data.FW_WFH.GWZL == "") {
  467. _this.form.GWZL_NAME = _this.GWZL[0].CNAME;
  468. } else {
  469. _this.GWZL.forEach(function (item) {
  470. if (item.CODE == response.data.FW_WFH.GWZL) {
  471. _this.form.GWZL_NAME = item.CNAME;
  472. }
  473. })
  474. }
  475. _this.$nextTick(() => {
  476. _this.initInputPlug();
  477. })
  478. })
  479. },
  480. initInputPlug: () => {
  481. $("#NGSJ").calendar({
  482. onChange: function (p, values, displayValues) {
  483. _this.form.NGSJ = values[0];
  484. }
  485. });
  486. let listJJCD = [];
  487. let listXXGKSH = [];
  488. let listGWZL = [];
  489. let listSFXYJD = [];
  490. let listZDGKLM = [];
  491. let listZDGKZT = [];
  492. _this.JJCD.forEach(function (item) {
  493. listJJCD.push(item.CNAME);
  494. })
  495. _this.XXGKSH.forEach(function (item) {
  496. listXXGKSH.push(item.CNAME);
  497. })
  498. _this.GWZL.forEach(function (item) {
  499. listGWZL.push(item.CNAME);
  500. })
  501. _this.SFXYJD.forEach(function (item) {
  502. listSFXYJD.push(item.CNAME);
  503. })
  504. _this.ZDGKLM.forEach(function (item) {
  505. listZDGKLM.push(item.CNAME);
  506. })
  507. _this.ZDGKZT.forEach(function (item) {
  508. listZDGKZT.push(item.CNAME);
  509. })
  510. $("#JJCD").picker({
  511. title: "请选择紧急程度",
  512. cols: [
  513. {
  514. textAlign: 'center',
  515. values: listJJCD
  516. }
  517. ],
  518. onChange: function (p, v, dv) {
  519. _this.form.JJCD_NAME = v[0];
  520. _this.JJCD.forEach(function (item) {
  521. if (item.CNAME == v[0]) {
  522. _this.form.JJCD = item.CODE;
  523. }
  524. })
  525. },
  526. });
  527. $("#XXGKSH").picker({
  528. title: "请选择信息公开审核",
  529. cols: [
  530. {
  531. textAlign: 'center',
  532. values: listXXGKSH
  533. }
  534. ],
  535. onChange: function (p, v, dv) {
  536. _this.form.XXGKSH_NAME = v[0];
  537. _this.XXGKSH.forEach(function (item) {
  538. if (item.CNAME == v[0]) {
  539. _this.form.XXGKSH = item.CODE;
  540. }
  541. })
  542. },
  543. });
  544. $("#GWZL").picker({
  545. title: "请选择公文种类",
  546. cols: [
  547. {
  548. textAlign: 'center',
  549. values: listGWZL
  550. }
  551. ],
  552. onChange: function (p, v, dv) {
  553. _this.form.GWZL_NAME = v[0];
  554. _this.GWZL.forEach(function (item) {
  555. if (item.CNAME == v[0]) {
  556. _this.form.GWZL = item.CODE;
  557. }
  558. })
  559. },
  560. });
  561. $("#SFXYJD").picker({
  562. title: "请选择是否需要解读",
  563. cols: [
  564. {
  565. textAlign: 'center',
  566. values: listSFXYJD
  567. }
  568. ],
  569. onChange: function (p, v, dv) {
  570. _this.form.SFXYJD_NAME = v[0];
  571. _this.SFXYJD.forEach(function (item) {
  572. if (item.CNAME == v[0]) {
  573. _this.form.SFXYJD = item.CODE;
  574. }
  575. })
  576. },
  577. });
  578. $("#ZDGKLM").picker({
  579. title: "请选择主动公开栏目",
  580. cols: [
  581. {
  582. textAlign: 'center',
  583. values: listZDGKLM
  584. }
  585. ],
  586. onChange: function (p, v, dv) {
  587. _this.form.ZDGKLM_NAME = v[0];
  588. _this.ZDGKLM.forEach(function (item) {
  589. if (item.CNAME == v[0]) {
  590. _this.form.ZDGKLM = item.CODE;
  591. }
  592. })
  593. },
  594. });
  595. $("#ZDGKZT").picker({
  596. title: "请选择主动公开主题",
  597. cols: [
  598. {
  599. textAlign: 'center',
  600. values: listZDGKZT
  601. }
  602. ],
  603. onChange: function (p, v, dv) {
  604. _this.form.ZDGKZT_NAME = v[0];
  605. _this.ZDGKZT.forEach(function (item) {
  606. if (item.CNAME == v[0]) {
  607. _this.form.ZDGKZT = item.CODE;
  608. }
  609. })
  610. },
  611. });
  612. let optionDepart=[];
  613. _this.departList.forEach(function (item) {
  614. optionDepart.push({
  615. title: item.DEP,
  616. value: item.DEPCODE,
  617. description: item.DEP
  618. })
  619. })
  620. $("#ZS").select({
  621. title: "请选择主送",
  622. multi: true,
  623. items:optionDepart,
  624. onChange: function(d) {
  625. },
  626. onClose: function (d) {
  627. _this.form.ZS=d.data.titles;
  628. }
  629. });
  630. $("#CS").select({
  631. title: "请选择抄送",
  632. multi: true,
  633. items:optionDepart,
  634. onChange: function(d) {
  635. },
  636. onClose: function (d) {
  637. _this.form.CS=d.data.titles;
  638. }
  639. });
  640. },
  641. saveBtn: () => {
  642. if (_this.dotype != 0) {
  643. let formData = {};
  644. for (let key in _this.form) {
  645. if (key.indexOf("_NAME") == -1) {
  646. formData[key] = _this.form[key]
  647. }
  648. }
  649. let arrayData = [];
  650. arrayData.push(formData)
  651. let postData = {
  652. ckey: "FW_WFH",
  653. id: _this.form.ID,
  654. routeid: _this.routeid,
  655. routeinfoid: _this.routeinfoid,
  656. routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  657. directionid: _this.directionid,
  658. formeditid: _this.formeditid,
  659. data: JSON.stringify(arrayData)
  660. };
  661. $http({
  662. method: 'post',
  663. baseURL: _this.apiurl,
  664. url: "g2app/abase/saveData",
  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. if (response.success) {
  673. $.alert("保存成功!", "温馨提示");
  674. _this.getFormDetail();
  675. } else {
  676. $.alert("保存失败,请联系管理员!", "温馨提示");
  677. }
  678. })
  679. } else {
  680. _this.$nextTick(() => {
  681. $.alert("当前模式下无法进行保存", "温馨提示");
  682. })
  683. }
  684. },
  685. getItemOption: (code) => {
  686. let postData = {
  687. cmanid: _this.userId,
  688. routeinfoid: _this.routeinfoid,
  689. routeid: _this.routeid,
  690. tableid: "FW_WFH",
  691. colid: code
  692. }
  693. return $http({
  694. method: 'post',
  695. baseURL: _this.apiurl,
  696. url: "g2app/abase/queryDataOpinion",
  697. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  698. headers: {
  699. 'Content-Type': 'application/json',
  700. 'Authorization': "Bearer " + _this.token
  701. }
  702. })
  703. },
  704. getAllOption: () => {
  705. _this.WLDQFL = [];
  706. _this.WLDSSL = [];
  707. _this.FLSH = [];
  708. _this.GPJZSC = [];
  709. _this.BGSFHYJ = [];
  710. _this.SX = [];
  711. _this.BMFZRYJ = [];
  712. _this.HBCSYJ = [];
  713. $http.all([_this.getItemOption('WLDQFL'),
  714. _this.getItemOption('WLDSSL'),
  715. _this.getItemOption('FLSH'),
  716. _this.getItemOption('GPJZSC'),
  717. _this.getItemOption('BGSFHYJ'),
  718. _this.getItemOption('SX'),
  719. _this.getItemOption('BMFZRYJ'),
  720. _this.getItemOption('HBCSYJ')]).then($http.spread((first, second, third, forth, fifth, sixth, seventh, eighth) => {
  721. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  722. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  723. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  724. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  725. let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  726. let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data));
  727. let response7 = _this.utils.strToJson(s4.decryptData_CBC(seventh.data.data));
  728. let response8 = _this.utils.strToJson(s4.decryptData_CBC(eighth.data.data));
  729. _this.WLDQFL = response1.data;
  730. _this.WLDSSL = response2.data;
  731. _this.FLSH = response3.data;
  732. _this.GPJZSC = response4.data;
  733. _this.BGSFHYJ = response5.data;
  734. _this.SX = response6.data;
  735. _this.BMFZRYJ = response7.data;
  736. _this.HBCSYJ = response8.data;
  737. _this.dealOption('WLDQFL');
  738. _this.dealOption('WLDSSL');
  739. _this.dealOption('FLSH');
  740. _this.dealOption('GPJZSC');
  741. _this.dealOption('BGSFHYJ');
  742. _this.dealOption('SX');
  743. _this.dealOption('BMFZRYJ');
  744. _this.dealOption('HBCSYJ');
  745. }))
  746. },
  747. deleteOption: (code) => {
  748. $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
  749. let postData = {
  750. cmanid: _this.userId,
  751. routeid: _this.routeid,
  752. tableid: "FW_WFH",
  753. colid: code,
  754. };
  755. $http({
  756. method: 'post',
  757. baseURL: _this.apiurl,
  758. url: "g2app/abase/deleteDataOpinion",
  759. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  760. headers: {
  761. 'Content-Type': 'application/json',
  762. 'Authorization': "Bearer " + _this.token
  763. }
  764. }).then(res => {
  765. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  766. if (response.success) {
  767. _this.getAllOption();
  768. } else {
  769. $.alert("删除失败,请联系管理员!", "温馨提示");
  770. }
  771. })
  772. }, function () {
  773. //取消操作
  774. });
  775. },
  776. editOption: (type, index) => {
  777. _this.optionType = type;
  778. let nowEditObj = _this[type][index];
  779. if (_this.optionType == "") {
  780. $.alert("初始化失败,请联系管理员!", "温馨提示");
  781. } else {
  782. _this.optionContent = nowEditObj.OPINION;
  783. $(".open-popup").eq(0).click();
  784. }
  785. },
  786. addOption: (type) => {
  787. _this.optionType = type;
  788. _this.optionContent = "";
  789. if (_this.optionType == "") {
  790. $.alert("初始化失败,请联系管理员!", "温馨提示");
  791. } else {
  792. $(".open-popup").eq(0).click();
  793. }
  794. },
  795. saveOption: () => {
  796. $(".close-popup").eq(0).click();
  797. let postData = {
  798. cmanid: _this.userId,
  799. routeinfoid: _this.routeinfoid,
  800. routeid: _this.routeid,
  801. tableid: "FW_WFH",
  802. colid: _this.optionType,
  803. opiniontype: 0,
  804. cresult: "",
  805. opinion: _this.optionContent,
  806. opinionimage: ""
  807. };
  808. $http({
  809. method: 'post',
  810. baseURL: _this.apiurl,
  811. url: "g2app/abase/saveDataOpinion",
  812. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  813. headers: {
  814. 'Content-Type': 'application/json',
  815. 'Authorization': "Bearer " + _this.token
  816. }
  817. }).then(res => {
  818. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  819. if (response.success) {
  820. _this.getAllOption();
  821. } else {
  822. $.alert("删除失败,请联系管理员!", "温馨提示");
  823. }
  824. })
  825. },
  826. getBtnList: () => {
  827. let postData = {
  828. ckey: "FW_WFH",
  829. id: 0,
  830. directionid: _this.directionid,
  831. formeditid: _this.formeditid,
  832. routeid: _this.routeid,
  833. routeinfoid: _this.routeinfoid
  834. }
  835. $http({
  836. method: 'post',
  837. baseURL: _this.apiurl,
  838. url: "g2app/abase/queryData",
  839. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  840. headers: {
  841. 'Content-Type': 'application/json',
  842. 'Authorization': "Bearer " + _this.token
  843. }
  844. }).then(res => {
  845. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  846. _this.buttonList = _this.dotype == 0 ? [] : response.data["FW_WFH.FUNCLIST"];
  847. _this.buttonList.forEach(function (item) {
  848. if (item.CODE == "SAVEITEM") {
  849. _this.showSave = true;
  850. }
  851. })
  852. })
  853. },
  854. //增补一个函数
  855. dealOption: (key) => {
  856. let num = 0;
  857. let keyEdit = key + "EDIT";
  858. _this[key].forEach(function (item) {
  859. if (item.ROUTEID == _this.routeid) {
  860. num++
  861. }
  862. })
  863. if (num > 0) {
  864. _this[keyEdit] = true;
  865. } else {
  866. _this[keyEdit] = false;
  867. }
  868. },
  869. //拿回主动抄送的部门选项,和加载滚动选项一起执行
  870. getDepartOption: () => {
  871. return $http({
  872. method: 'post',
  873. baseURL: _this.apiurl,
  874. url: "g2app/dataabase/getDpList",
  875. data: {data: s4.encryptData_CBC(JSON.stringify(""))},
  876. headers: {
  877. 'Content-Type': 'application/json',
  878. 'Authorization': "Bearer " + _this.token
  879. }
  880. })
  881. },
  882. },
  883. created: function () {
  884. _this = this;
  885. let token = localStorage.getItem("mobile-token", _this.token);
  886. let userName = localStorage.getItem("mobile-userName", _this.userName);
  887. let userId = localStorage.getItem("mobile-userId", _this.userId);
  888. _this.userId = userId;
  889. _this.token = token;
  890. _this.userName = userName;
  891. _this.routeid = _this.utils.getUrlName("routeid");
  892. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  893. _this.directionid = _this.utils.getUrlName("directionid");
  894. _this.formeditid = _this.utils.getUrlName("formeditid");
  895. _this.docmode = _this.utils.getUrlName("docmode");
  896. _this.dotype = _this.utils.getUrlName("dotype");
  897. _this.type = _this.utils.getUrlName("type");
  898. },
  899. mounted: function () {
  900. _this.getAllCodeTable();
  901. _this.getBtnList();
  902. }
  903. })