formedit.js 39 KB

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