formedit.js 37 KB

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