12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- angular.module('push')
- .controller('activityChooseCompanyCtrl', function ($scope, $stateParams, ActivityService, UtilService, $timeout) {
- /* $scope.setStatusBar(1);*/
- var activityid = $stateParams.activityid;
- var getIntentionStatus = function () {
- $scope.showLoadingToast();
- ActivityService.getIntentionStatus(activityid).then(function (response) {
- // console.log(response);
- // result 0未选择 1已选择
- $scope.intentionstatus = response.result;
- getSelCompanyInfo();
- }, function () {
- $scope.hideLoadingToast();
- $scope.hideLoadingToast();
- })
- };
- getIntentionStatus();
- // 获取参与企业列表
- var getSelCompanyInfo = function () {
- ActivityService.getSelCompanyInfo(" ", activityid).then(function (response) {
- // issuccess 0,1 专家单向选企业 2 双方互相选择 3 专家单向选企业 4 政府删除配对
- $scope.companylist = response.company;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- // 记录选中列表索引
- var indexlist = [];
- $scope.selectedLength = 0;
- // 选择企业
- $scope.selectOrgType = function (companyid, index) {
- if ($scope.intentionstatus != 0) {
- return;
- }
- if ($scope.companylist[index].isChecked) {
- var ind = indexlist.indexOf(index);
- indexlist.splice(ind);
- } else {
- indexlist.push(companyid);
- }
- $scope.companylist[index].isChecked = !$scope.companylist[index].isChecked;
- $scope.selectedLength = indexlist.length;
- };
- // 提交企业
- $scope.submitCompany = function () {
- $scope.showLoadingToast();
- var idlist = indexlist.join(",");
- // console.log(idlist);
- ActivityService.submitSelCompanyInfo(activityid, idlist).then(function (response) {
- // console.log(response);
- if (response.result == 1) {
- UtilService.showMess("提交成功!");
- $timeout(function () {
- $scope.goback();
- }, 1000);
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- $scope.goDetail = function (companyid) {
- $scope.go("activityCompanyListContent", {companyid: companyid});
- };
- });
|