index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. (function ($app) {
  2. $app.module('gtPartyApp').controller('shykIndexCtrl', function ($scope, $http, $modal, $ocLazyLoad, $alert, $loading, $state, $bsRouterState, AuthUser, $timeout) {
  3. $state.params = $bsRouterState.$params($scope);
  4. $scope.pageId = "shykIndex" + $state.params.type;
  5. //定义数据集合
  6. $scope.loginUserId = AuthUser.getUser().Id;
  7. $scope.dataList = []; //列表数据
  8. $scope.shyklxList = [];//三会一课类型
  9. $scope.shykStatusList = [];//会议状态
  10. $scope.shykTypeName = "";
  11. switch ($state.params.type) {
  12. case 1:
  13. $scope.shykTypeName = "党员大会";
  14. break;
  15. case 2:
  16. $scope.shykTypeName = "支委会";
  17. break;
  18. case 3:
  19. $scope.shykTypeName = "党小组会";
  20. break;
  21. case 4:
  22. $scope.shykTypeName = "党课";
  23. break;
  24. }
  25. $scope.selectparams = {
  26. isunfold: false,//组织结构树展开收缩
  27. shykType: $state.params.type,
  28. 'pageindex': 1,
  29. 'pagesize': 10,
  30. isshowxz: $state.params.type == 3 ? 1 : 0,
  31. selectdzzdm: "",
  32. selectdzzmc: "",
  33. defaultselected: $state.params.dzzdm,
  34. parentcode: AuthUser.getUser().ParentDpCode,
  35. parentname: AuthUser.getUser().ParentDpName,
  36. szdzzdm: AuthUser.getUser().DPCode,
  37. szdzzmc: AuthUser.getUser().DPName,
  38. partyCode: '',//党组织代码
  39. meetingName: '',
  40. meetingAddress: '',
  41. shykStatus: null,
  42. beginTime: $state.params.begintime,
  43. endTime: $state.params.endtime,
  44. userid: AuthUser.getUser().Id,
  45. zzfbType: null
  46. };
  47. $scope.pageInfo = {ptotal: 0};
  48. //监视页数变化
  49. $scope.$watch("selectparams.pageindex", function (newVal, oldVal) {
  50. if ($scope.pageInfo.ptotal > 0) {
  51. $scope.loadData();
  52. }
  53. });
  54. $scope.$watch("selectparams.selectdzzdm", function (newVal, oldVal) {
  55. if (newVal != "") {
  56. if ($scope.selectparams.defaultselected != "" && $scope.selectparams.defaultselected != null &&
  57. $scope.selectparams.defaultselected != $scope.selectparams.selectdzzdm)
  58. return;
  59. $scope.selectparams.partyCode = $scope.selectparams.selectdzzdm;
  60. if ($scope.selectparams.selectdzzdm != AuthUser.getUser().DPCode) {
  61. $scope.selectparams.userid = "";
  62. } else {
  63. $scope.selectparams.userid = AuthUser.getUser().Id;
  64. }
  65. $scope.loadData();
  66. }
  67. });
  68. $scope.$watch("selectparams.zzfbType", function (newVal, oldVal) {
  69. if (newVal != oldVal) {
  70. $scope.loadData();
  71. }
  72. });
  73. $scope.$on('tabChildReloadData',function (event,data) {
  74. if(data.name=='shykIndexCtrl'){
  75. $scope.loadData();
  76. }
  77. });
  78. //查询
  79. $scope.search = function () {
  80. $scope.loadData();
  81. };
  82. //导出
  83. $scope.export = function () {
  84. var params = "?1=1";
  85. for (var p in $scope.selectparams) {
  86. if ($scope.selectparams[p] !== '' && $scope.selectparams[p] !== null)
  87. params += ("&" + p + "=" + encodeURI($scope.selectparams[p]));
  88. }
  89. window.open('../../api/shyk/exportMeeting' + params);
  90. };
  91. //加载列表数据
  92. $scope.loadData = function () {
  93. $scope.selectparams.defaultselected = "";
  94. $http
  95. ({
  96. method: 'get', url: '../../api/shyk/getMeetingList', params: $scope.selectparams
  97. }).then(function (result) {
  98. $scope.dataList = result.data.item.list;
  99. $scope.pageInfo.ptotal = result.data.item.total;
  100. });
  101. };
  102. //新增
  103. $scope.addData = function () {
  104. $bsRouterState.$closeTabName("home.shykAdd");
  105. $timeout(function () {
  106. $bsRouterState.go('home.shykAdd', {
  107. id: "",
  108. shykType: $scope.selectparams.shykType,
  109. dzzdm: $scope.selectparams.szdzzdm
  110. });
  111. }, 100);
  112. };
  113. //修改
  114. $scope.editData = function (id) {
  115. $bsRouterState.$closeTabName("home.shykEdit");
  116. $timeout(function () {
  117. $bsRouterState.go('home.shykEdit', {
  118. id: id,
  119. shykType: $scope.selectparams.shykType,
  120. dzzdm: $scope.selectparams.partyCode
  121. });
  122. }, 100);
  123. };
  124. //审核
  125. $scope.auditData = function (id) {
  126. $bsRouterState.$closeTabName("home.shykAudit");
  127. $timeout(function () {
  128. $bsRouterState.go('home.shykAudit', {id: id, shykType: $scope.selectparams.shykType});
  129. }, 100);
  130. };
  131. //查看
  132. $scope.showData = function (id) {
  133. $bsRouterState.$closeTabName("home.shykShow");
  134. $timeout(function () {
  135. $bsRouterState.go('home.shykShow', {id: id, shykType: $scope.selectparams.shykType});
  136. }, 100);
  137. };
  138. //删除
  139. $scope.deleteData = function (id) {
  140. if (confirm("是否确定删除?")) {
  141. $http({
  142. url: "../../api/shyk/deleteMeetingById",
  143. method: 'GET',
  144. params: {id: id}
  145. }).then(function (result) {
  146. $scope.showMsg("消息", result.data.msg);
  147. if (result.data.success) {
  148. $scope.loadData();
  149. }
  150. });
  151. }
  152. };
  153. //批量审核
  154. $scope.approveData = function (isPass) {
  155. var approveList = $scope.dataList.filter(function (val) {
  156. return val.checked == 1;
  157. });
  158. if (approveList.length <= 0) {
  159. $scope.showMsg("错误", "请选择需审核的会议");
  160. return false;
  161. }
  162. if (approveList.filter(function (val) {
  163. return val.MEETINGAPPROVESTATUS == 1;
  164. }).length > 0) {
  165. $scope.showMsg("错误", "存在已审核通过的会议");
  166. return false;
  167. }
  168. var meetingids = "";
  169. angular.forEach(approveList, function (val, index) {
  170. meetingids += val.MEETINGID + ","
  171. });
  172. if (confirm(isPass ? "确定审核通过?" : "确定审核不通过?")) {
  173. $http({
  174. method: 'post',
  175. url: '../../api/shyk/approveMeeting',
  176. data: {
  177. meetingIds: meetingids,
  178. isPass: isPass
  179. }
  180. }).then(function (result) {
  181. $scope.showMsg('成功', result.data.msg);
  182. $scope.loadData();
  183. }, function () {
  184. $scope.showMsg('错误', '服务器错误');
  185. });
  186. }
  187. };
  188. //推送通知
  189. $scope.sendNotify = function (shykStatus, meetingId) {
  190. if (confirm(shykStatus == 1 ? "确定推送通知?" : "该会议已推送通知,确定重新推送?")) {
  191. $http({
  192. method: 'post',
  193. url: '../../api/shyk/sendMeetingNotify',
  194. data: {
  195. meetingId: meetingId
  196. }
  197. }).then(function (result) {
  198. $scope.showMsg('成功', result.data.msg);
  199. $scope.loadData();
  200. }, function () {
  201. $scope.showMsg('错误', '服务器错误');
  202. });
  203. }
  204. };
  205. //填写会议决议
  206. $scope.editDecision = function (meetingId) {
  207. $bsRouterState.$closeTabName("home.shykDecisionEdit");
  208. $timeout(function () {
  209. $bsRouterState.go('home.shykDecisionEdit', {id: meetingId, shykType: $scope.selectparams.shykType});
  210. }, 100);
  211. };
  212. //审核会议决议
  213. $scope.auditDecision = function (meetingId) {
  214. $bsRouterState.$closeTabName("home.shykDecisionAudit");
  215. $timeout(function () {
  216. $bsRouterState.go('home.shykDecisionAudit', {id: meetingId, shykType: $scope.selectparams.shykType});
  217. }, 100);
  218. };
  219. $scope.recordEdit = function (id) {
  220. $bsRouterState.$closeTabName("home.shykMeetingRecordEdit");
  221. $timeout(function () {
  222. $bsRouterState.go('home.shykMeetingRecordEdit', {id: id, shykType: $scope.selectparams.shykType});
  223. }, 100);
  224. };
  225. //取消会议
  226. $scope.cancelMeeting = function (meetingId) {
  227. if (confirm("确定取消会议?")) {
  228. $http({
  229. method: 'post',
  230. url: '../../api/shyk/cancelMeeting',
  231. data: {
  232. meetingId: meetingId
  233. }
  234. }).then(function (result) {
  235. $scope.showMsg('成功', result.data.msg);
  236. $scope.loadData();
  237. }, function () {
  238. $scope.showMsg('错误', '服务器错误');
  239. });
  240. }
  241. };
  242. $scope.getShyklxList = function () {
  243. $http({
  244. method: 'get',
  245. url: '../../api/dictionary/getDictionaryListByDicTypeKey',
  246. params: {
  247. dicTypeKey: 'shykType'
  248. }
  249. }).then(function (result) {
  250. $scope.shyklxList = result.data;
  251. }, function (resp) {
  252. });
  253. };
  254. $scope.getShykStatusList = function () {
  255. $http({
  256. method: 'get',
  257. url: '../../api/dictionary/getDictionaryListByDicTypeKey',
  258. params: {
  259. dicTypeKey: 'shykStatus'
  260. }
  261. }).then(function (result) {
  262. $scope.shykStatusList = result.data;
  263. }, function (resp) {
  264. });
  265. };
  266. $scope.showMsg = function (title, content) {
  267. $alert({
  268. title: title + ':',
  269. content: content,
  270. placement: 'top',
  271. type: 'info',
  272. show: true,
  273. duration: 3
  274. });
  275. };
  276. $scope.getShyklxList();
  277. $scope.getShykStatusList();
  278. });
  279. })(angular);