123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- (function ($app) {
- $app.module('gtPartyApp').controller('shykIndexCtrl', function ($scope, $http, $modal, $ocLazyLoad, $alert, $loading, $state, $bsRouterState, AuthUser, $timeout) {
- $state.params = $bsRouterState.$params($scope);
- $scope.pageId = "shykIndex" + $state.params.type;
- //定义数据集合
- $scope.loginUserId = AuthUser.getUser().Id;
- $scope.dataList = []; //列表数据
- $scope.shyklxList = [];//三会一课类型
- $scope.shykStatusList = [];//会议状态
- $scope.shykTypeName = "";
- switch ($state.params.type) {
- case 1:
- $scope.shykTypeName = "党员大会";
- break;
- case 2:
- $scope.shykTypeName = "支委会";
- break;
- case 3:
- $scope.shykTypeName = "党小组会";
- break;
- case 4:
- $scope.shykTypeName = "党课";
- break;
- }
- $scope.selectparams = {
- isunfold: false,//组织结构树展开收缩
- shykType: $state.params.type,
- 'pageindex': 1,
- 'pagesize': 10,
- isshowxz: $state.params.type == 3 ? 1 : 0,
- selectdzzdm: "",
- selectdzzmc: "",
- defaultselected: $state.params.dzzdm,
- parentcode: AuthUser.getUser().ParentDpCode,
- parentname: AuthUser.getUser().ParentDpName,
- szdzzdm: AuthUser.getUser().DPCode,
- szdzzmc: AuthUser.getUser().DPName,
- partyCode: '',//党组织代码
- meetingName: '',
- meetingAddress: '',
- shykStatus: null,
- beginTime: $state.params.begintime,
- endTime: $state.params.endtime,
- userid: AuthUser.getUser().Id,
- zzfbType: null
- };
- $scope.pageInfo = {ptotal: 0};
- //监视页数变化
- $scope.$watch("selectparams.pageindex", function (newVal, oldVal) {
- if ($scope.pageInfo.ptotal > 0) {
- $scope.loadData();
- }
- });
- $scope.$watch("selectparams.selectdzzdm", function (newVal, oldVal) {
- if (newVal != "") {
- if ($scope.selectparams.defaultselected != "" && $scope.selectparams.defaultselected != null &&
- $scope.selectparams.defaultselected != $scope.selectparams.selectdzzdm)
- return;
- $scope.selectparams.partyCode = $scope.selectparams.selectdzzdm;
- if ($scope.selectparams.selectdzzdm != AuthUser.getUser().DPCode) {
- $scope.selectparams.userid = "";
- } else {
- $scope.selectparams.userid = AuthUser.getUser().Id;
- }
- $scope.loadData();
- }
- });
- $scope.$watch("selectparams.zzfbType", function (newVal, oldVal) {
- if (newVal != oldVal) {
- $scope.loadData();
- }
- });
- $scope.$on('tabChildReloadData',function (event,data) {
- if(data.name=='shykIndexCtrl'){
- $scope.loadData();
- }
- });
- //查询
- $scope.search = function () {
- $scope.loadData();
- };
- //导出
- $scope.export = function () {
- var params = "?1=1";
- for (var p in $scope.selectparams) {
- if ($scope.selectparams[p] !== '' && $scope.selectparams[p] !== null)
- params += ("&" + p + "=" + encodeURI($scope.selectparams[p]));
- }
- window.open('../../api/shyk/exportMeeting' + params);
- };
- //加载列表数据
- $scope.loadData = function () {
- $scope.selectparams.defaultselected = "";
- $http
- ({
- method: 'get', url: '../../api/shyk/getMeetingList', params: $scope.selectparams
- }).then(function (result) {
- $scope.dataList = result.data.item.list;
- $scope.pageInfo.ptotal = result.data.item.total;
- });
- };
- //新增
- $scope.addData = function () {
- $bsRouterState.$closeTabName("home.shykAdd");
- $timeout(function () {
- $bsRouterState.go('home.shykAdd', {
- id: "",
- shykType: $scope.selectparams.shykType,
- dzzdm: $scope.selectparams.szdzzdm
- });
- }, 100);
- };
- //修改
- $scope.editData = function (id) {
- $bsRouterState.$closeTabName("home.shykEdit");
- $timeout(function () {
- $bsRouterState.go('home.shykEdit', {
- id: id,
- shykType: $scope.selectparams.shykType,
- dzzdm: $scope.selectparams.partyCode
- });
- }, 100);
- };
- //审核
- $scope.auditData = function (id) {
- $bsRouterState.$closeTabName("home.shykAudit");
- $timeout(function () {
- $bsRouterState.go('home.shykAudit', {id: id, shykType: $scope.selectparams.shykType});
- }, 100);
- };
- //查看
- $scope.showData = function (id) {
- $bsRouterState.$closeTabName("home.shykShow");
- $timeout(function () {
- $bsRouterState.go('home.shykShow', {id: id, shykType: $scope.selectparams.shykType});
- }, 100);
- };
- //删除
- $scope.deleteData = function (id) {
- if (confirm("是否确定删除?")) {
- $http({
- url: "../../api/shyk/deleteMeetingById",
- method: 'GET',
- params: {id: id}
- }).then(function (result) {
- $scope.showMsg("消息", result.data.msg);
- if (result.data.success) {
- $scope.loadData();
- }
- });
- }
- };
- //批量审核
- $scope.approveData = function (isPass) {
- var approveList = $scope.dataList.filter(function (val) {
- return val.checked == 1;
- });
- if (approveList.length <= 0) {
- $scope.showMsg("错误", "请选择需审核的会议");
- return false;
- }
- if (approveList.filter(function (val) {
- return val.MEETINGAPPROVESTATUS == 1;
- }).length > 0) {
- $scope.showMsg("错误", "存在已审核通过的会议");
- return false;
- }
- var meetingids = "";
- angular.forEach(approveList, function (val, index) {
- meetingids += val.MEETINGID + ","
- });
- if (confirm(isPass ? "确定审核通过?" : "确定审核不通过?")) {
- $http({
- method: 'post',
- url: '../../api/shyk/approveMeeting',
- data: {
- meetingIds: meetingids,
- isPass: isPass
- }
- }).then(function (result) {
- $scope.showMsg('成功', result.data.msg);
- $scope.loadData();
- }, function () {
- $scope.showMsg('错误', '服务器错误');
- });
- }
- };
- //推送通知
- $scope.sendNotify = function (shykStatus, meetingId) {
- if (confirm(shykStatus == 1 ? "确定推送通知?" : "该会议已推送通知,确定重新推送?")) {
- $http({
- method: 'post',
- url: '../../api/shyk/sendMeetingNotify',
- data: {
- meetingId: meetingId
- }
- }).then(function (result) {
- $scope.showMsg('成功', result.data.msg);
- $scope.loadData();
- }, function () {
- $scope.showMsg('错误', '服务器错误');
- });
- }
- };
- //填写会议决议
- $scope.editDecision = function (meetingId) {
- $bsRouterState.$closeTabName("home.shykDecisionEdit");
- $timeout(function () {
- $bsRouterState.go('home.shykDecisionEdit', {id: meetingId, shykType: $scope.selectparams.shykType});
- }, 100);
- };
- //审核会议决议
- $scope.auditDecision = function (meetingId) {
- $bsRouterState.$closeTabName("home.shykDecisionAudit");
- $timeout(function () {
- $bsRouterState.go('home.shykDecisionAudit', {id: meetingId, shykType: $scope.selectparams.shykType});
- }, 100);
- };
- $scope.recordEdit = function (id) {
- $bsRouterState.$closeTabName("home.shykMeetingRecordEdit");
- $timeout(function () {
- $bsRouterState.go('home.shykMeetingRecordEdit', {id: id, shykType: $scope.selectparams.shykType});
- }, 100);
- };
- //取消会议
- $scope.cancelMeeting = function (meetingId) {
- if (confirm("确定取消会议?")) {
- $http({
- method: 'post',
- url: '../../api/shyk/cancelMeeting',
- data: {
- meetingId: meetingId
- }
- }).then(function (result) {
- $scope.showMsg('成功', result.data.msg);
- $scope.loadData();
- }, function () {
- $scope.showMsg('错误', '服务器错误');
- });
- }
- };
- $scope.getShyklxList = function () {
- $http({
- method: 'get',
- url: '../../api/dictionary/getDictionaryListByDicTypeKey',
- params: {
- dicTypeKey: 'shykType'
- }
- }).then(function (result) {
- $scope.shyklxList = result.data;
- }, function (resp) {
- });
- };
- $scope.getShykStatusList = function () {
- $http({
- method: 'get',
- url: '../../api/dictionary/getDictionaryListByDicTypeKey',
- params: {
- dicTypeKey: 'shykStatus'
- }
- }).then(function (result) {
- $scope.shykStatusList = result.data;
- }, function (resp) {
- });
- };
- $scope.showMsg = function (title, content) {
- $alert({
- title: title + ':',
- content: content,
- placement: 'top',
- type: 'info',
- show: true,
- duration: 3
- });
- };
- $scope.getShyklxList();
- $scope.getShykStatusList();
- });
- })(angular);
|