formedit.js 35 KB

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