2016-08-02 15:50:15 +08:00
|
|
|
|
|
|
|
|
2016-08-09 09:23:06 +08:00
|
|
|
app.controller('ReviewProjectMemberController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
|
|
|
common.checkLogin();
|
|
|
|
|
2016-08-02 15:50:15 +08:00
|
|
|
var vm = $scope;
|
|
|
|
|
|
|
|
// vm.current_edit_member = rms.get('current_edit_member');
|
2016-08-03 09:37:24 +08:00
|
|
|
|
|
|
|
vm.current_review_member = rms.get('current_review_member');
|
|
|
|
vm.current_project = rms.get('current_project');
|
2016-08-02 15:50:15 +08:00
|
|
|
|
|
|
|
vm.alertService = alertService.create();
|
|
|
|
|
2016-08-04 15:32:25 +08:00
|
|
|
vm.tip_1 = "";
|
|
|
|
vm.tip_2 = "";
|
|
|
|
|
2016-08-03 09:37:24 +08:00
|
|
|
var project_id = $routeParams.id;
|
2016-08-02 15:50:15 +08:00
|
|
|
var user_id = $routeParams.user_id;
|
2016-08-04 18:09:54 +08:00
|
|
|
vm.status = 1;
|
2016-08-02 15:50:15 +08:00
|
|
|
|
2016-08-03 14:55:54 +08:00
|
|
|
if(!vm.current_project){
|
2016-08-03 09:37:24 +08:00
|
|
|
$http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then(
|
|
|
|
function(response) {
|
|
|
|
console.log(response.data);
|
|
|
|
if (response.data.status == 0){
|
|
|
|
vm.current_project = response.data.data;
|
|
|
|
console.log("projects");
|
|
|
|
console.log(response.data.data);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
vm.alertService.showMessage('提示', response.data.message);
|
|
|
|
}
|
2016-08-02 15:50:15 +08:00
|
|
|
|
2016-08-04 15:32:25 +08:00
|
|
|
if(!vm.current_project){
|
|
|
|
vm.tip_1 = "该项目不存在或已被删除";
|
|
|
|
}
|
|
|
|
|
2016-08-03 09:37:24 +08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2016-08-02 15:50:15 +08:00
|
|
|
|
2016-08-03 09:37:24 +08:00
|
|
|
if(!vm.current_review_member){
|
|
|
|
$http.post(config.apiUrl+'projects/review_member_info', {
|
2016-08-02 15:50:15 +08:00
|
|
|
token: auth.token(),
|
2016-08-03 09:37:24 +08:00
|
|
|
project_id: project_id,
|
2016-08-02 15:50:15 +08:00
|
|
|
user_id:user_id
|
|
|
|
}).then(function(response){
|
2016-08-04 18:09:54 +08:00
|
|
|
if(response.data.status==-1){
|
2016-08-02 15:50:15 +08:00
|
|
|
vm.alertService.showMessage('提示', response.data.message);
|
|
|
|
} else {
|
2016-08-04 18:09:54 +08:00
|
|
|
vm.status = response.data.status;
|
2016-08-03 09:37:24 +08:00
|
|
|
vm.current_review_member = response.data.data;
|
|
|
|
console.log("review_member_info");
|
|
|
|
console.log(response.data.data);
|
2016-08-02 15:50:15 +08:00
|
|
|
}
|
2016-08-04 15:32:25 +08:00
|
|
|
|
|
|
|
if(!vm.current_review_member){
|
2016-08-04 18:09:54 +08:00
|
|
|
vm.tip_2 = "该申请不存在";
|
2016-08-04 15:32:25 +08:00
|
|
|
}
|
2016-08-02 15:50:15 +08:00
|
|
|
});
|
2016-08-03 09:37:24 +08:00
|
|
|
}
|
2016-08-02 15:50:15 +08:00
|
|
|
|
2016-08-03 09:37:24 +08:00
|
|
|
vm.deal = function(result){
|
|
|
|
$http.post(config.apiUrl+'projects/deal_join_apply', {
|
2016-08-02 15:50:15 +08:00
|
|
|
token: auth.token(),
|
2016-08-03 09:37:24 +08:00
|
|
|
project_id: project_id,
|
|
|
|
user_id:user_id,
|
|
|
|
type:result
|
|
|
|
}).then(function(response) {
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
vm.alertService.showMessage('提示', response.data.message, function () {
|
2016-08-03 14:55:54 +08:00
|
|
|
rms.save("project_master_members",[]);
|
|
|
|
rms.save("project_develop_members",[]);
|
|
|
|
rms.save("project_report_members",[]);
|
|
|
|
rms.save("review_master_members",[]);
|
|
|
|
rms.save("review_develop_members",[]);
|
|
|
|
rms.save("tab_num",null);
|
|
|
|
$location.path("/project").search({id: project_id,tag:1});
|
2016-08-02 15:50:15 +08:00
|
|
|
});
|
|
|
|
}
|
2016-08-03 09:37:24 +08:00
|
|
|
else{
|
|
|
|
vm.alertService.showMessage('提示', response.data.message);
|
|
|
|
}
|
2016-08-02 15:50:15 +08:00
|
|
|
});
|
|
|
|
};
|
2016-08-04 18:09:54 +08:00
|
|
|
|
|
|
|
vm.goProjectMemberList = function(){
|
|
|
|
rms.save("project_master_members",[]);
|
|
|
|
rms.save("project_develop_members",[]);
|
|
|
|
rms.save("project_report_members",[]);
|
|
|
|
rms.save("review_master_members",[]);
|
|
|
|
rms.save("review_develop_members",[]);
|
|
|
|
rms.save("tab_num",null);
|
2016-08-10 16:08:30 +08:00
|
|
|
if(vm.current_project.is_member){
|
|
|
|
$location.path("/project").search({id: project_id,tag: 1});
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$location.path("/project_list")
|
|
|
|
}
|
2016-08-04 18:09:54 +08:00
|
|
|
};
|
2016-08-02 15:50:15 +08:00
|
|
|
}] );
|