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