formedit.js 33 KB

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