1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- angular.module('push')
- .controller('ParticipatingUnitsCtrl', function ($scope, $ionicActionSheet, ModelService, $stateParams, UtilService) {
- // 单位类型type: 0:其他 1:政府 2:园区 3:机构 4:企业 5:高校
- $scope.typename = ["未选择", "其他", "政府", "园区", "机构", "企业", "高校"];
- var listindex;
- if (UtilService.isDefined($stateParams.company)) {
- $scope.tempcompany = $stateParams.company;
- $scope.index = $stateParams.company.type + 1;
- listindex = $stateParams.index;
- } else {
- $scope.tempcompany = {name: "", type: 1, presentation: ""};
- $scope.index = 0;
- }
- $scope.show = function () {
- $ionicActionSheet.show({
- buttons: [
- {text: '<a class="action-sheet-push">高校</a>'},
- {text: '<a class="action-sheet-push">企业</a>'},
- {text: '<a class="action-sheet-push">机构</a>'},
- {text: '<a class="action-sheet-push">园区</a>'},
- {text: '<a class="action-sheet-push">政府</a>'},
- {text: '<a class="action-sheet-push">其他</a>'}
- ],
- cancelText: '取消',
- buttonClicked: function (index) {
- $scope.index = 6 - index;
- $scope.tempcompany.type = 5 - index;
- return true;
- }
- });
- };
- $scope.saveTempCompany = function () {
- if (!UtilService.isDefined($scope.tempcompany.name)) {
- UtilService.showMess("单位名称不能为空");
- return;
- }
- if ($scope.index == 0) {
- UtilService.showMess("单位类型不能为空");
- return;
- }
- if (UtilService.isDefined($stateParams.company)) {
- var tempCompanyList = ModelService.getTempCompanies();
- tempCompanyList[listindex] = $scope.tempcompany;
- ModelService.setTempCompanies2(tempCompanyList);
- } else {
- $scope.tempcompany.localid = UtilService.formatDate().timestamp + "";
- ModelService.setTempCompanies($scope.tempcompany);
- }
- $scope.goback();
- }
- });
|