sendedit.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. buttonList: [],
  18. sendType: "",
  19. sendTarget: "",
  20. userList: [],
  21. direction: "",
  22. allSelect: false
  23. },
  24. methods: {
  25. dateFtt: (fmt, date) => {
  26. var o = {
  27. "M+": date.getMonth() + 1, //月份
  28. "d+": date.getDate(), //日
  29. "h+": date.getHours(), //小时
  30. "m+": date.getMinutes(), //分
  31. "s+": date.getSeconds(), //秒
  32. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  33. "S": date.getMilliseconds() //毫秒
  34. };
  35. if (/(y+)/.test(fmt))
  36. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  37. for (var k in o)
  38. if (new RegExp("(" + k + ")").test(fmt))
  39. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  40. return fmt;
  41. },
  42. backBtn: () => {
  43. location.href = "formedit.html?routeid=" + _this.routeid + "&routeinfoid=" + _this.routeinfoid + "&directionid=" + _this.directionid + "&formeditid=" + _this.formeditid + "&docmode=" + _this.docmode + "&dotype=" + _this.dotype + "&type" + _this.type;
  44. },
  45. getBtnList: () => {
  46. let postData = {
  47. ckey: "DCDB_SXDBD",
  48. id: 0,
  49. directionid: _this.directionid,
  50. formeditid: _this.formeditid,
  51. routeid: _this.routeid,
  52. routeinfoid: _this.routeinfoid
  53. }
  54. $http({
  55. method: 'post',
  56. baseURL: _this.apiurl,
  57. url: "g2app/abase/queryData",
  58. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  59. headers: {
  60. 'Content-Type': 'application/json',
  61. 'Authorization': "Bearer " + _this.token
  62. }
  63. }).then(res => {
  64. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  65. let sendButton = [];
  66. response.data["DCDB_SXDBD.FUNCLIST"].forEach(function (item) {
  67. if (item.CODE.indexOf("SENDITEM") > -1) {
  68. sendButton.push(item);
  69. }
  70. })
  71. _this.buttonList = _this.dotype == 0 ? [] : sendButton;
  72. _this.buttonList.forEach(function (item, index) {
  73. if (index == 0) {
  74. _this.sendType = item.CODE;
  75. _this.sendTarget = item.DIRECTIONIDTARGET
  76. _this.getOptionList(_this.sendType, _this.sendTarget);
  77. }
  78. })
  79. })
  80. },
  81. getOptionList: (code, target) => {
  82. _this.userList = [];
  83. _this.direction = "";
  84. let postData = {
  85. codefuncbutton: code,
  86. directionid: _this.directionid,
  87. directionidtarget: target,
  88. userid: _this.userId,
  89. routeinfoid: _this.routeinfoid,
  90. routeid: _this.routeid
  91. }
  92. $http({
  93. method: 'post',
  94. baseURL: _this.apiurl,
  95. url: "g2app/abase/queryDataSendByTarget",
  96. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  97. headers: {
  98. 'Content-Type': 'application/json',
  99. 'Authorization': "Bearer " + _this.token
  100. }
  101. }).then(res => {
  102. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  103. response.data[0].SENDUSERS.USERS.forEach(function (item) {
  104. item.checked = false;
  105. })
  106. _this.direction = response.data[0];
  107. _this.userList = response.data[0].SENDUSERS.USERS;
  108. })
  109. },
  110. changeType: (index) => {
  111. _this.allSelect = false;
  112. _this.sendType = _this.buttonList[index].CODE;
  113. _this.sendTarget = _this.buttonList[index].DIRECTIONIDTARGET;
  114. _this.getOptionList(_this.sendType, _this.sendTarget);
  115. },
  116. send: () => {
  117. let sendUser
  118. if (_this.direction.ENDNODETYPE == 1) {
  119. sendUser = {
  120. DIRECTIONID: _this.direction.DIRECTIONID,
  121. MAINUSERID: "STOP",
  122. COPYUSERID: ""
  123. }
  124. } else if (_this.direction.CODEFUNCBUTTON == "SENDCOPYEND" || _this.direction.CODEFUNCBUTTON == "SENDPERUSAL") {
  125. sendUser = {
  126. DIRECTIONID: _this.direction.DIRECTIONID,
  127. MAINUSERID: "",
  128. COPYUSERID: ""
  129. }
  130. } else {
  131. let userSend = [];
  132. _this.userList.forEach(function (item) {
  133. if (item.checked) {
  134. userSend.push(item.USERID)
  135. }
  136. })
  137. sendUser = {
  138. DIRECTIONID: _this.direction.DIRECTIONID,
  139. MAINUSERID: userSend.join("|"),
  140. COPYUSERID: ""
  141. }
  142. if (userSend.length == 0) {
  143. $.alert("请先选择转发人员!", "温馨提示");
  144. return false
  145. }
  146. }
  147. let postData = {
  148. codefuncbutton: _this.direction.CODEFUNCBUTTON,
  149. directionid: _this.directionid,
  150. userid: _this.userId,
  151. routeinfoid: _this.routeinfoid,
  152. routeid: _this.routeid,
  153. data: "[" + JSON.stringify(sendUser) + "]"
  154. }
  155. $http({
  156. method: 'post',
  157. baseURL: _this.apiurl,
  158. url: "g2app/abase/saveDataSend",
  159. data: {data: s4.encryptData_CBC(JSON.stringify(postData))},
  160. headers: {
  161. 'Content-Type': 'application/json',
  162. 'Authorization': "Bearer " + _this.token
  163. }
  164. }).then(res => {
  165. let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data));
  166. if (response.success) {
  167. $.alert("转发成功,即将跳转列表!", "温馨提示");
  168. setTimeout(function () {
  169. location.href = "../list.html";
  170. }, 1000);
  171. } else {
  172. $.alert("转发失败,请联系管理员!", "温馨提示");
  173. }
  174. })
  175. },
  176. selectAll: () => {
  177. _this.userList.forEach(function (item) {
  178. item.checked = !_this.allSelect;
  179. })
  180. },
  181. selectItem: () => {
  182. _this.$nextTick(() => {
  183. setTimeout(function () {
  184. let selectNum = 0;
  185. let allNum = _this.userList.length;
  186. _this.userList.forEach(function (item) {
  187. if(item.checked){
  188. selectNum++;
  189. }
  190. })
  191. if(selectNum==allNum){
  192. _this.allSelect=true;
  193. }else{
  194. _this.allSelect=false;
  195. }
  196. },0)
  197. })
  198. }
  199. },
  200. created: function () {
  201. _this = this;
  202. let token = localStorage.getItem("mobile-token", _this.token);
  203. let userName = localStorage.getItem("mobile-userName", _this.userName);
  204. let userId = localStorage.getItem("mobile-userId", _this.userId);
  205. _this.userId = userId;
  206. _this.token = token;
  207. _this.userName = userName;
  208. _this.routeid = _this.utils.getUrlName("routeid");
  209. _this.routeinfoid = _this.utils.getUrlName("routeinfoid");
  210. _this.directionid = _this.utils.getUrlName("directionid");
  211. _this.formeditid = _this.utils.getUrlName("formeditid");
  212. _this.docmode = _this.utils.getUrlName("docmode");
  213. _this.dotype = _this.utils.getUrlName("dotype");
  214. _this.type = _this.utils.getUrlName("type");
  215. }
  216. ,
  217. mounted: function () {
  218. _this.getBtnList();
  219. }
  220. })