formedit.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  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. BGSFHYJ:[],
  30. readonly: {
  31. JJCD: false,
  32. WLDQFL: false,
  33. WLDSSL: false,
  34. XXGKSH: false,
  35. SFXYJD: false,
  36. ZDGKLM: false,
  37. ZDGKZT: false,
  38. FLSH: false,
  39. GPJZSC: false,
  40. BGSFHYJ: false,
  41. SX: false,
  42. BMFZRYJ: false,
  43. NGR: false,
  44. NGSJ: false,
  45. HBCSYJ: false,
  46. GWZL: false,
  47. YF: false,
  48. ZT: false,
  49. ZS: false,
  50. CS: false
  51. },
  52. form: {
  53. ID: "", //多一个id
  54. JJCD: "",
  55. JJCD_NAME: "",
  56. XXGKSH: "",
  57. XXGKSH_NAME: "",
  58. SFXYJD: "",
  59. SFXYJD_NAME: "",
  60. ZDGKLM: "",
  61. ZDGKLM_NAME: "",
  62. ZDGKZT: "",
  63. ZDGKZT_NAME: "",
  64. NGR: "",
  65. NGSJ: "",
  66. GWZL: "",
  67. GWZL_NAME: "",
  68. YF: "",
  69. ZT: "",
  70. ZS: "",
  71. CS: "",
  72. BGSFHYJ:"",
  73. BGSFHYJ_NAME:"",
  74. },
  75. WLDQFL: [],
  76. WLDSSL: [],
  77. FLSH: [],
  78. GPJZSC: [],
  79. SX: [],
  80. BMFZRYJ: [],
  81. HBCSYJ: [],
  82. WLDQFLEDIT: true,
  83. WLDSSLEDIT: true,
  84. FLSHEDIT: true,
  85. GPJZSCEDIT: true,
  86. SXEDIT: true,
  87. BMFZRYJEDIT: true,
  88. HBCSYJEDIT: true,
  89. optionType: "",
  90. optionContent: "",
  91. showSave: false,
  92. buttonList: [],
  93. departList:[],
  94. fileData1: [],
  95. fileData2: [],
  96. fileData3: []
  97. },
  98. methods: {
  99. dateFtt: (fmt, date) => {
  100. var o = {
  101. "M+": date.getMonth() + 1, //月份
  102. "d+": date.getDate(), //日
  103. "h+": date.getHours(), //小时
  104. "m+": date.getMinutes(), //分
  105. "s+": date.getSeconds(), //秒
  106. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  107. "S": date.getMilliseconds() //毫秒
  108. };
  109. if (/(y+)/.test(fmt))
  110. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  111. for (var k in o)
  112. if (new RegExp("(" + k + ")").test(fmt))
  113. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  114. return fmt;
  115. },
  116. changeTab: (tabCode) => {
  117. _this.nowTab = tabCode;
  118. if (_this.nowTab == "tab1") {
  119. } else if (_this.nowTab == "tab2") {
  120. _this.getFileList();
  121. } else if (_this.nowTab == "tab3") {
  122. _this.getRouterList();
  123. } else if (_this.nowTab == "tab4") {
  124. _this.getAllFile();
  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_ZSWSXW",
  271. id: _this.form.ID,
  272. routeid: _this.routeid,
  273. routeinfoid: _this.routeinfoid,
  274. routeinfotitle: _this.form.ZT.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_ZDGKLM'),
  324. _this.getItemCodeTable('CODE_ZDGKZT'),
  325. _this.getDepartOption(),
  326. _this.getItemCodeTable('CODE_BGSFHYJ')]).then($http.spread((first, second, third, forth, fifth, sixth,seventh,eighth) => {
  327. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  328. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  329. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  330. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  331. let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  332. let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data));
  333. let response7 = _this.utils.strToJson(s4.decryptData_CBC(seventh.data.data));
  334. let response8 = _this.utils.strToJson(s4.decryptData_CBC(eighth.data.data));
  335. _this.JJCD = response1.data.CODE_JJCD;
  336. _this.XXGKSH = response2.data.CODE_XXGKSH;
  337. _this.GWZL = response3.data.CODE_GWTYPE;
  338. _this.SFXYJD = response4.data.CODE_SFXYJD;
  339. _this.ZDGKLM = response5.data.CODE_ZDGKLM;
  340. _this.ZDGKZT = response6.data.CODE_ZDGKZT;
  341. _this.departList = response7.data;
  342. _this.BGSFHYJ = response8.data.CODE_BGSFHYJ;
  343. _this.getFormDetail();
  344. _this.getAllOption();
  345. }))
  346. },
  347. getFormDetail: () => {
  348. let postData = {
  349. ckey: "FW_ZSWSXW",
  350. id: 0,
  351. directionid: _this.directionid,
  352. formeditid: _this.formeditid,
  353. routeid: _this.routeid,
  354. routeinfoid: _this.routeinfoid
  355. }
  356. $http({
  357. method: 'post',
  358. baseURL: _this.apiurl,
  359. url: "g2app/abase/queryData",
  360. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  361. headers: {
  362. 'Content-Type': 'application/json',
  363. 'Authorization': "Bearer " + _this.token
  364. }
  365. }).then(res => {
  366. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  367. console.log(response);
  368. //0表单禁用
  369. if (_this.dotype == '0') {
  370. _this.readonly = {
  371. JJCD: true,
  372. WLDQFL: true,
  373. WLDSSL: true,
  374. XXGKSH: true,
  375. SFXYJD: true,
  376. ZDGKLM: true,
  377. ZDGKZT: true,
  378. FLSH: true,
  379. GPJZSC: true,
  380. BGSFHYJ: true,
  381. SX: true,
  382. BMFZRYJ: true,
  383. NGR: true,
  384. NGSJ: true,
  385. HBCSYJ: true,
  386. GWZL: true,
  387. YF: true,
  388. ZT: true,
  389. ZS: true,
  390. CS: true
  391. }
  392. } else {
  393. _this.readonly = {
  394. JJCD: response.data.FW_ZSWSXW["JJCD.EREADONLY"] == "true",
  395. WLDQFL: response.data.FW_ZSWSXW["WLDQFL.EREADONLY"] == "true",
  396. WLDSSL: response.data.FW_ZSWSXW["WLDSSL.EREADONLY"] == "true",
  397. XXGKSH: response.data.FW_ZSWSXW["XXGKSH.EREADONLY"] == "true",
  398. SFXYJD: response.data.FW_ZSWSXW["SFXYJD.EREADONLY"] == "true",
  399. ZDGKLM: response.data.FW_ZSWSXW["ZDGKLM.EREADONLY"] == "true",
  400. ZDGKZT: response.data.FW_ZSWSXW["ZDGKZT.EREADONLY"] == "true",
  401. FLSH: response.data.FW_ZSWSXW["FLSH.EREADONLY"] == "true",
  402. GPJZSC: response.data.FW_ZSWSXW["GPJZSC.EREADONLY"] == "true",
  403. BGSFHYJ: response.data.FW_ZSWSXW["BGSFHYJ.EREADONLY"] == "true",
  404. SX: response.data.FW_ZSWSXW["SX.EREADONLY"] == "true",
  405. BMFZRYJ: response.data.FW_ZSWSXW["BMFZRYJ.EREADONLY"] == "true",
  406. NGR: response.data.FW_ZSWSXW["NGR.EREADONLY"] == "true",
  407. NGSJ: response.data.FW_ZSWSXW["NGSJ.EREADONLY"] == "true",
  408. HBCSYJ: response.data.FW_ZSWSXW["HBCSYJ.EREADONLY"] == "true",
  409. GWZL: response.data.FW_ZSWSXW["GWZL.EREADONLY"] == "true",
  410. YF: response.data.FW_ZSWSXW["YF.EREADONLY"] == "true",
  411. ZT: response.data.FW_ZSWSXW["ZT.EREADONLY"] == "true",
  412. ZS: response.data.FW_ZSWSXW["ZS.EREADONLY"] == "true",
  413. CS: response.data.FW_ZSWSXW["CS.EREADONLY"] == "true",
  414. }
  415. }
  416. _this.form = {
  417. ID: response.data.FW_ZSWSXW.ID,
  418. JJCD: response.data.FW_ZSWSXW.JJCD == "" ? _this.JJCD[0].CODE : response.data.FW_ZSWSXW.JJCD,
  419. XXGKSH: response.data.FW_ZSWSXW.XXGKSH == "" ? _this.XXGKSH[0].CODE : response.data.FW_ZSWSXW.XXGKSH,
  420. SFXYJD: response.data.FW_ZSWSXW.SFXYJD == "" ? _this.SFXYJD[0].CODE : response.data.FW_ZSWSXW.SFXYJD,
  421. ZDGKLM: response.data.FW_ZSWSXW.ZDGKLM == "" ? _this.ZDGKLM[0].CODE : response.data.FW_ZSWSXW.ZDGKLM,
  422. ZDGKZT: response.data.FW_ZSWSXW.ZDGKZT == "" ? _this.ZDGKZT[0].CODE : response.data.FW_ZSWSXW.ZDGKZT,
  423. GWZL: response.data.FW_ZSWSXW.GWZL == "" ? _this.GWZL[0].CODE : response.data.FW_ZSWSXW.GWZL,
  424. BGSFHYJ: response.data.FW_ZSWSXW.BGSFHYJ == "" ? _this.BGSFHYJ[0].CODE : response.data.FW_ZSWSXW.BGSFHYJ,
  425. NGSJ: (response.data.FW_ZSWSXW.NGSJ == "" || response.data.FW_ZSWSXW.NGSJ == null || response.data.FW_ZSWSXW.NGSJ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.FW_ZSWSXW.NGSJ),
  426. NGR: response.data.FW_ZSWSXW.NGR,
  427. YF: response.data.FW_ZSWSXW.YF,
  428. ZT: response.data.FW_ZSWSXW.ZT,
  429. ZS: response.data.FW_ZSWSXW.ZS,
  430. CS: response.data.FW_ZSWSXW.CS
  431. }
  432. if (response.data.FW_ZSWSXW.JJCD == "") {
  433. _this.form.JJCD_NAME = _this.JJCD[0].CNAME;
  434. } else {
  435. _this.JJCD.forEach(function (item) {
  436. if (item.CODE == response.data.FW_ZSWSXW.JJCD) {
  437. _this.form.JJCD_NAME = item.CNAME;
  438. }
  439. })
  440. }
  441. if (response.data.FW_ZSWSXW.XXGKSH == "") {
  442. _this.form.XXGKSH_NAME = _this.XXGKSH[0].CNAME;
  443. } else {
  444. _this.XXGKSH.forEach(function (item) {
  445. if (item.CODE == response.data.FW_ZSWSXW.XXGKSH) {
  446. _this.form.XXGKSH_NAME = item.CNAME;
  447. }
  448. })
  449. }
  450. if (response.data.FW_ZSWSXW.SFXYJD == "") {
  451. _this.form.SFXYJD_NAME = _this.SFXYJD[0].CNAME;
  452. } else {
  453. _this.SFXYJD.forEach(function (item) {
  454. if (item.CODE == response.data.FW_ZSWSXW.SFXYJD) {
  455. _this.form.SFXYJD_NAME = item.CNAME;
  456. }
  457. })
  458. }
  459. if (response.data.FW_ZSWSXW.ZDGKLM == "") {
  460. _this.form.ZDGKLM_NAME = _this.ZDGKLM[0].CNAME;
  461. } else {
  462. _this.ZDGKLM.forEach(function (item) {
  463. if (item.CODE == response.data.FW_ZSWSXW.ZDGKLM) {
  464. _this.form.ZDGKLM_NAME = item.CNAME;
  465. }
  466. })
  467. }
  468. if (response.data.FW_ZSWSXW.ZDGKZT == "") {
  469. _this.form.ZDGKZT_NAME = _this.ZDGKZT[0].CNAME;
  470. } else {
  471. _this.ZDGKZT.forEach(function (item) {
  472. if (item.CODE == response.data.FW_ZSWSXW.ZDGKZT) {
  473. _this.form.ZDGKZT_NAME = item.CNAME;
  474. }
  475. })
  476. }
  477. if (response.data.FW_ZSWSXW.GWZL == "") {
  478. _this.form.GWZL_NAME = _this.GWZL[0].CNAME;
  479. } else {
  480. _this.GWZL.forEach(function (item) {
  481. if (item.CODE == response.data.FW_ZSWSXW.GWZL) {
  482. _this.form.GWZL_NAME = item.CNAME;
  483. }
  484. })
  485. }
  486. if (response.data.FW_ZSWSXW.BGSFHYJ == "") {
  487. _this.form.BGSFHYJ_NAME = _this.BGSFHYJ[0].CNAME;
  488. } else {
  489. _this.BGSFHYJ.forEach(function (item) {
  490. if (item.CODE == response.data.FW_ZSWSXW.BGSFHYJ) {
  491. _this.form.BGSFHYJ_NAME = item.CNAME;
  492. }
  493. })
  494. }
  495. _this.$nextTick(() => {
  496. _this.initInputPlug();
  497. })
  498. })
  499. },
  500. initInputPlug: () => {
  501. $("#NGSJ").calendar({
  502. onChange: function (p, values, displayValues) {
  503. _this.form.NGSJ = values[0];
  504. }
  505. });
  506. let listJJCD = [];
  507. let listXXGKSH = [];
  508. let listGWZL = [];
  509. let listSFXYJD = [];
  510. let listZDGKLM = [];
  511. let listZDGKZT = [];
  512. let listBGSFHYJ = [];
  513. _this.JJCD.forEach(function (item) {
  514. listJJCD.push(item.CNAME);
  515. })
  516. _this.XXGKSH.forEach(function (item) {
  517. listXXGKSH.push(item.CNAME);
  518. })
  519. _this.GWZL.forEach(function (item) {
  520. listGWZL.push(item.CNAME);
  521. })
  522. _this.SFXYJD.forEach(function (item) {
  523. listSFXYJD.push(item.CNAME);
  524. })
  525. _this.ZDGKLM.forEach(function (item) {
  526. listZDGKLM.push(item.CNAME);
  527. })
  528. _this.ZDGKZT.forEach(function (item) {
  529. listZDGKZT.push(item.CNAME);
  530. })
  531. _this.BGSFHYJ.forEach(function (item) {
  532. listBGSFHYJ.push(item.CNAME);
  533. })
  534. $("#JJCD").picker({
  535. title: "请选择紧急程度",
  536. cols: [
  537. {
  538. textAlign: 'center',
  539. values: listJJCD
  540. }
  541. ],
  542. onChange: function (p, v, dv) {
  543. _this.form.JJCD_NAME = v[0];
  544. _this.JJCD.forEach(function (item) {
  545. if (item.CNAME == v[0]) {
  546. _this.form.JJCD = item.CODE;
  547. }
  548. })
  549. },
  550. });
  551. $("#XXGKSH").picker({
  552. title: "请选择信息公开审核",
  553. cols: [
  554. {
  555. textAlign: 'center',
  556. values: listXXGKSH
  557. }
  558. ],
  559. onChange: function (p, v, dv) {
  560. _this.form.XXGKSH_NAME = v[0];
  561. _this.XXGKSH.forEach(function (item) {
  562. if (item.CNAME == v[0]) {
  563. _this.form.XXGKSH = item.CODE;
  564. }
  565. })
  566. },
  567. });
  568. $("#GWZL").picker({
  569. title: "请选择公文种类",
  570. cols: [
  571. {
  572. textAlign: 'center',
  573. values: listGWZL
  574. }
  575. ],
  576. onChange: function (p, v, dv) {
  577. _this.form.GWZL_NAME = v[0];
  578. _this.GWZL.forEach(function (item) {
  579. if (item.CNAME == v[0]) {
  580. _this.form.GWZL = item.CODE;
  581. }
  582. })
  583. },
  584. });
  585. $("#SFXYJD").picker({
  586. title: "请选择是否需要解读",
  587. cols: [
  588. {
  589. textAlign: 'center',
  590. values: listSFXYJD
  591. }
  592. ],
  593. onChange: function (p, v, dv) {
  594. _this.form.SFXYJD_NAME = v[0];
  595. _this.SFXYJD.forEach(function (item) {
  596. if (item.CNAME == v[0]) {
  597. _this.form.SFXYJD = item.CODE;
  598. }
  599. })
  600. },
  601. });
  602. $("#ZDGKLM").picker({
  603. title: "请选择主动公开栏目",
  604. cols: [
  605. {
  606. textAlign: 'center',
  607. values: listZDGKLM
  608. }
  609. ],
  610. onChange: function (p, v, dv) {
  611. _this.form.ZDGKLM_NAME = v[0];
  612. _this.ZDGKLM.forEach(function (item) {
  613. if (item.CNAME == v[0]) {
  614. _this.form.ZDGKLM = item.CODE;
  615. }
  616. })
  617. },
  618. });
  619. $("#ZDGKZT").picker({
  620. title: "请选择主动公开主题",
  621. cols: [
  622. {
  623. textAlign: 'center',
  624. values: listZDGKZT
  625. }
  626. ],
  627. onChange: function (p, v, dv) {
  628. _this.form.ZDGKZT_NAME = v[0];
  629. _this.ZDGKZT.forEach(function (item) {
  630. if (item.CNAME == v[0]) {
  631. _this.form.ZDGKZT = item.CODE;
  632. }
  633. })
  634. },
  635. });
  636. $("#BGSFHYJ").picker({
  637. title: "请选择办公室复核意见",
  638. cols: [
  639. {
  640. textAlign: 'center',
  641. values: listBGSFHYJ
  642. }
  643. ],
  644. onChange: function (p, v, dv) {
  645. _this.form.BGSFHYJ_NAME = v[0];
  646. _this.BGSFHYJ.forEach(function (item) {
  647. if (item.CNAME == v[0]) {
  648. _this.form.BGSFHYJ = item.CODE;
  649. }
  650. })
  651. },
  652. });
  653. let optionDepart=[];
  654. _this.departList.forEach(function (item) {
  655. optionDepart.push({
  656. title: item.DEP,
  657. value: item.DEPCODE,
  658. description: item.DEP
  659. })
  660. })
  661. $("#ZS").select({
  662. title: "请选择主送",
  663. multi: true,
  664. items:optionDepart,
  665. onChange: function(d) {
  666. },
  667. onClose: function (d) {
  668. _this.form.ZS=d.data.titles;
  669. }
  670. });
  671. $("#CS").select({
  672. title: "请选择抄送",
  673. multi: true,
  674. items:optionDepart,
  675. onChange: function(d) {
  676. },
  677. onClose: function (d) {
  678. _this.form.CS=d.data.titles;
  679. }
  680. });
  681. },
  682. saveBtn: () => {
  683. if (_this.dotype != 0) {
  684. let formData = {};
  685. for (let key in _this.form) {
  686. if (key.indexOf("_NAME") == -1) {
  687. formData[key] = _this.form[key]
  688. }
  689. }
  690. let arrayData = [];
  691. arrayData.push(formData)
  692. let postData = {
  693. ckey: "FW_ZSWSXW",
  694. id: _this.form.ID,
  695. routeid: _this.routeid,
  696. routeinfoid: _this.routeinfoid,
  697. routeinfotitle: _this.form.ZT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  698. directionid: _this.directionid,
  699. formeditid: _this.formeditid,
  700. data: JSON.stringify(arrayData)
  701. };
  702. $http({
  703. method: 'post',
  704. baseURL: _this.apiurl,
  705. url: "g2app/abase/saveData",
  706. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  707. headers: {
  708. 'Content-Type': 'application/json',
  709. 'Authorization': "Bearer " + _this.token
  710. }
  711. }).then(res => {
  712. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  713. if (response.success) {
  714. $.alert("保存成功!", "温馨提示");
  715. _this.getFormDetail();
  716. } else {
  717. $.alert("保存失败,请联系管理员!", "温馨提示");
  718. }
  719. })
  720. } else {
  721. _this.$nextTick(() => {
  722. $.alert("当前模式下无法进行保存", "温馨提示");
  723. })
  724. }
  725. },
  726. getItemOption: (code) => {
  727. let postData = {
  728. cmanid: _this.userId,
  729. routeinfoid: _this.routeinfoid,
  730. routeid: _this.routeid,
  731. tableid: "FW_ZSWSXW",
  732. colid: code
  733. }
  734. return $http({
  735. method: 'post',
  736. baseURL: _this.apiurl,
  737. url: "g2app/abase/queryDataOpinion",
  738. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  739. headers: {
  740. 'Content-Type': 'application/json',
  741. 'Authorization': "Bearer " + _this.token
  742. }
  743. })
  744. },
  745. getAllOption: () => {
  746. _this.WLDQFL = [];
  747. _this.WLDSSL = [];
  748. _this.FLSH = [];
  749. _this.GPJZSC = [];
  750. //_this.BGSFHYJ = [];
  751. _this.SX = [];
  752. _this.BMFZRYJ = [];
  753. _this.HBCSYJ = [];
  754. $http.all([_this.getItemOption('WLDQFL'),
  755. _this.getItemOption('WLDSSL'),
  756. _this.getItemOption('FLSH'),
  757. _this.getItemOption('GPJZSC'),
  758. _this.getItemOption('BGSFHYJ'),
  759. _this.getItemOption('SX'),
  760. _this.getItemOption('BMFZRYJ'),
  761. _this.getItemOption('HBCSYJ')]).then($http.spread((first, second, third, forth, fifth, sixth, seventh, eighth) => {
  762. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  763. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  764. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  765. let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data));
  766. //let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data));
  767. let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data));
  768. let response7 = _this.utils.strToJson(s4.decryptData_CBC(seventh.data.data));
  769. let response8 = _this.utils.strToJson(s4.decryptData_CBC(eighth.data.data));
  770. _this.WLDQFL = response1.data;
  771. _this.WLDSSL = response2.data;
  772. _this.FLSH = response3.data;
  773. _this.GPJZSC = response4.data;
  774. //_this.BGSFHYJ = response5.data;
  775. _this.SX = response6.data;
  776. _this.BMFZRYJ = response7.data;
  777. _this.HBCSYJ = response8.data;
  778. _this.dealOption('WLDQFL');
  779. _this.dealOption('WLDSSL');
  780. _this.dealOption('FLSH');
  781. _this.dealOption('GPJZSC');
  782. //_this.dealOption('BGSFHYJ');
  783. _this.dealOption('SX');
  784. _this.dealOption('BMFZRYJ');
  785. _this.dealOption('HBCSYJ');
  786. }))
  787. },
  788. deleteOption: (code) => {
  789. $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
  790. let postData = {
  791. cmanid: _this.userId,
  792. routeid: _this.routeid,
  793. tableid: "FW_ZSWSXW",
  794. colid: code,
  795. };
  796. $http({
  797. method: 'post',
  798. baseURL: _this.apiurl,
  799. url: "g2app/abase/deleteDataOpinion",
  800. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  801. headers: {
  802. 'Content-Type': 'application/json',
  803. 'Authorization': "Bearer " + _this.token
  804. }
  805. }).then(res => {
  806. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  807. if (response.success) {
  808. _this.getAllOption();
  809. } else {
  810. $.alert("删除失败,请联系管理员!", "温馨提示");
  811. }
  812. })
  813. }, function () {
  814. //取消操作
  815. });
  816. },
  817. editOption: (type, index) => {
  818. _this.optionType = type;
  819. let nowEditObj = _this[type][index];
  820. if (_this.optionType == "") {
  821. $.alert("初始化失败,请联系管理员!", "温馨提示");
  822. } else {
  823. _this.optionContent = nowEditObj.OPINION;
  824. $(".open-popup").eq(0).click();
  825. }
  826. },
  827. addOption: (type) => {
  828. _this.optionType = type;
  829. _this.optionContent = "";
  830. if (_this.optionType == "") {
  831. $.alert("初始化失败,请联系管理员!", "温馨提示");
  832. } else {
  833. $(".open-popup").eq(0).click();
  834. }
  835. },
  836. saveOption: () => {
  837. $(".close-popup").eq(0).click();
  838. let postData = {
  839. cmanid: _this.userId,
  840. routeinfoid: _this.routeinfoid,
  841. routeid: _this.routeid,
  842. tableid: "FW_ZSWSXW",
  843. colid: _this.optionType,
  844. opiniontype: 0,
  845. cresult: "",
  846. opinion: _this.optionContent,
  847. opinionimage: ""
  848. };
  849. $http({
  850. method: 'post',
  851. baseURL: _this.apiurl,
  852. url: "g2app/abase/saveDataOpinion",
  853. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  854. headers: {
  855. 'Content-Type': 'application/json',
  856. 'Authorization': "Bearer " + _this.token
  857. }
  858. }).then(res => {
  859. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  860. if (response.success) {
  861. _this.getAllOption();
  862. } else {
  863. $.alert("删除失败,请联系管理员!", "温馨提示");
  864. }
  865. })
  866. },
  867. getBtnList: () => {
  868. let postData = {
  869. ckey: "FW_ZSWSXW",
  870. id: 0,
  871. directionid: _this.directionid,
  872. formeditid: _this.formeditid,
  873. routeid: _this.routeid,
  874. routeinfoid: _this.routeinfoid
  875. }
  876. $http({
  877. method: 'post',
  878. baseURL: _this.apiurl,
  879. url: "g2app/abase/queryData",
  880. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  881. headers: {
  882. 'Content-Type': 'application/json',
  883. 'Authorization': "Bearer " + _this.token
  884. }
  885. }).then(res => {
  886. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  887. _this.buttonList = _this.dotype == 0 ? [] : response.data["FW_ZSWSXW.FUNCLIST"];
  888. _this.buttonList.forEach(function (item) {
  889. if (item.CODE == "SAVEITEM") {
  890. _this.showSave = true;
  891. }
  892. })
  893. })
  894. },
  895. //增补一个函数
  896. dealOption: (key) => {
  897. let num = 0;
  898. let keyEdit = key + "EDIT";
  899. _this[key].forEach(function (item) {
  900. if (item.ROUTEID == _this.routeid) {
  901. num++
  902. }
  903. })
  904. if (num > 0) {
  905. _this[keyEdit] = true;
  906. } else {
  907. _this[keyEdit] = false;
  908. }
  909. },
  910. //拿回主动抄送的部门选项,和加载滚动选项一起执行
  911. getDepartOption: () => {
  912. return $http({
  913. method: 'post',
  914. baseURL: _this.apiurl,
  915. url: "g2app/dataabase/getDpList",
  916. data: {data: s4.encryptData_CBC(JSON.stringify(""))},
  917. headers: {
  918. 'Content-Type': 'application/json',
  919. 'Authorization': "Bearer " + _this.token
  920. }
  921. })
  922. },
  923. //获取单个文稿列表
  924. getItemFile: (code) => {
  925. let postData = {
  926. dockind: code,
  927. routeinfoid: _this.routeinfoid
  928. }
  929. return $http({
  930. method: 'post',
  931. baseURL: _this.apiurl,
  932. url: "g2app/fawenfiles/queryDataList",
  933. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  934. headers: {
  935. 'Content-Type': 'application/json',
  936. 'Authorization': "Bearer " + _this.token
  937. }
  938. })
  939. },
  940. //获取全部类型文稿列表
  941. getAllFile: () => {
  942. $http.all([_this.getItemFile('D01'),
  943. _this.getItemFile('D02'),
  944. _this.getItemFile('D03')]).then($http.spread((first, second, third) => {
  945. let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data));
  946. let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data));
  947. let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data));
  948. _this.fileData1 = response1.data;
  949. _this.fileData2 = response2.data;
  950. _this.fileData3 = response3.data;
  951. }))
  952. },
  953. //调用打开永中的嵌入页
  954. openOfficePage: (item, type) => {
  955. let postData={
  956. type:type,
  957. obj:item
  958. }
  959. let dataString = s4.encryptData_CBC(JSON.stringify(postData));
  960. let goUrl = "officeedit.html?dataString=" + dataString;
  961. location.href = goUrl;
  962. }
  963. },
  964. created: function () {
  965. _this = this;
  966. let token = localStorage.getItem("mobile-token", _this.token);
  967. let userName = localStorage.getItem("mobile-userName", _this.userName);
  968. let userId = localStorage.getItem("mobile-userId", _this.userId);
  969. _this.userId = userId;
  970. _this.token = token;
  971. _this.userName = userName;
  972. _this.routeid = _this.utils.getUrlName("routeid");
  973. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  974. _this.directionid = _this.utils.getUrlName("directionid");
  975. _this.formeditid = _this.utils.getUrlName("formeditid");
  976. _this.docmode = _this.utils.getUrlName("docmode");
  977. _this.dotype = _this.utils.getUrlName("dotype");
  978. _this.type = _this.utils.getUrlName("type");
  979. },
  980. mounted: function () {
  981. _this.getAllCodeTable();
  982. _this.getBtnList();
  983. }
  984. })