123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- app.controller('myKnowledgeCommentCtrl', ["$rootScope", "$scope", '$stateParams', '$http', '$state', '$timeout', '$ionicPopover', '$ionicPopup', '$ionicLoading', 'api_bpm_domain', 'Restangular', 'api_solution', function($rootScope, $scope, $stateParams, $http, $state, $timeout, $ionicPopover, $ionicPopup, $ionicLoading, api_bpm_domain, Restangular, api_solution) {
- console.log('myKnowledgeCommentCtrl is load');
- $scope.load = {
- 'pageIndex': 0, //第几页
- 'pageSum': 10, //每页条数
- 'pageCount': 0 //总页数
- };
- $scope.search = {
- 'pageIndex': 0, //第几页
- 'pageSum': 10, //每页条数
- 'pageCount': 0 //总页数
- };
- //弹出框
- // var template = '<ion-popover-view><ion-header-bar> <h1 class="title">My Popover Title</h1> </ion-header-bar> <ion-content> Hello! </ion-content></ion-popover-view>';
- // $scope.popover = $ionicPopover.fromTemplate(template, {
- // scope: $scope
- // });
- // .fromTemplateUrl() method
- $ionicPopover.fromTemplateUrl('assets/views/weChat/myIncident/popover.html', {
- scope: $scope
- }).then(function(popover) {
- $scope.popover = popover;
- });
- $scope.openPopover = function($event) {
- $scope.popover.show($event);
- };
- $scope.closePopover = function() {
- $scope.popover.hide();
- };
- //Cleanup the popover when we're done with it!
- $scope.$on('$destroy', function() {
- $scope.popover.remove();
- });
- // Execute action on hidden popover
- $scope.$on('popover.hidden', function() {
- // Execute action
- });
- // Execute action on remove popover
- $scope.$on('popover.removed', function() {
- // Execute action
- });
- $scope.statuses = [
- { status: 'all', label: '全部的事件', idName: 'a' },
- { status: 'todo', label: '待我处理的', idName: 'b' },
- { status: 'create', label: '我创建的', idName: 'c' },
- { status: 'done', label: '我处理过的', idName: 'd' },
- // { status: 's', label: '已驳回', idName: 'e' },
- // { status: '6', label: '已拒绝', idName: 'f' }
- ];
- $scope.searchTypeFunction = function(searchType) {
- $scope.reload(searchType);
- $scope.popover.hide();
- }
- // $scope.loginForm = {};
- // var loginUser = $rootScope.user;
- //获取login中的数据
- var sessionLogin = JSON.parse(sessionStorage.sessionLogin);
- var loginUser = sessionLogin.user;
- var solutionUser = JSON.parse($state.params.item);
- //定义流程代号
- // var pdKey = $state.current.pdKey;
- var pdKey = 'bpm_incident';
- //默认数据
- var defaultData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- //页面数据容器
- $scope.myData = [];
- //是否加载上拉刷新
- $scope.domore = false;
- //填充数据
- $scope.filterData = {
- 'assignee': loginUser.id,
- 'idx': 0,
- 'sum': 10,
- };
- //本地数据初始化
- // sessionStorage.incidentListMobileParameter = JSON.stringify(incidentListMobileParameter);
- $scope.goBack = function() {
- // $state.go('tab.myKnowledge', {});
- history.go(-1);
- }
- // $scope.ratingsObject = {
- // iconOn: 'ion-ios-star', //Optional
- // iconOff: 'ion-ios-star-outline', //Optional
- // iconOnColor: 'rgb(200, 200, 100)', //Optional
- // iconOffColor: 'rgb(200, 100, 100)', //Optional
- // rating: 2, //Optional
- // minRating: 1, //Optional
- // readOnly: true, //Optional
- // callback: function(rating, index) { //Mandatory
- // $scope.ratingsCallback(rating, index);
- // }
- // };
- // $scope.ratingsCallback = function(rating, index) {
- // console.log('Selected rating is : ', rating, ' and the index is : ', index);
- // };
- $scope.ratingStates = [
- { stateOn: 'glyphicon-ok-sign', stateOff: 'glyphicon-ok-circle' },
- { stateOn: 'glyphicon-star', stateOff: 'glyphicon-star-empty' },
- { stateOn: 'glyphicon-heart', stateOff: 'glyphicon-ban-circle' },
- { stateOn: 'glyphicon-heart' },
- { stateOff: 'glyphicon-off' }
- ];
- $scope.commentSubmit = function() {
- if (sessionLogin.tokenType == 'requester') {
- var data = {
- id: null,
- solutionId: solutionUser.id,
- account: loginUser.account,
- // userId: loginUser.id,
- review: '<p>' + $scope.reviewContent + '</p>',
- // reviewScore: reviewScore,
- reviewTime: new Date()
- };
- } else {
- var data = {
- id: null,
- solutionId: solutionUser.id,
- userId: loginUser.id,
- review: '<p>' + $scope.reviewContent + '</p>',
- // reviewScore: reviewScore,
- reviewTime: new Date()
- };
- }
- api_solution.addSolutionReview(data).then(function(response) {
- var status = response.status;
- if (status == "200") {
- $ionicPopup.alert({
- title: '评论成功!',
- }).then(function(res) {
- history.go(-1);
- });
- } else {
- $ionicPopup.alert({
- title: '评论失败!',
- }).then(function(res) {
- // history.go(-1);
- });
- }
- });
- };
- }])
|