formedit.js 38 KB

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