formedit.js 34 KB

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