/** * Created by pushkeji on 2018/8/14. */ angular.module('push') .controller('recordModalCtrl', function ($scope, $timeout, $stateParams,roleService,dataToolsService, UtilService,UserService, $ionicActionSheet,ConstantService, TechnicalBrokerPublishTrainService ) { $scope.pagetitle='我的title'; // $scope.pagetitle=$stateParams.pagetitle; $scope.getDataFromBackground={ detailList:[], addList:[], pagecode:0, title:'', tcname:'', itemvalue:'', tablename:'', templettype:0, }; // console.log($scope.activity); var getData=function(restype,num){ dataToolsService.getFormStructure($stateParams.pagecode,restype,0).then(function(res){ console.log(res); if(res.code==3350){ $scope.getDataFromBackground.detailList=res.data.infoSectionList[0].unitItems[0]; $scope.getDataFromBackground.addList=res.data.infoSectionList[0].subItems; $scope.getDataFromBackground.pagecode=res.data.infoSectionList[0].pagecode; $scope.getDataFromBackground.title=res.data.infoSectionList[0].title; $scope.getDataFromBackground.tcname=res.data.infoSectionList[0].tcname; $scope.getDataFromBackground.itemvalue=res.data.infoSectionList[0].itemvalue; $scope.getDataFromBackground.tablename=res.data.infoSectionList[0].tablename; $scope.getDataFromBackground.tablename=res.data.infoSectionList[0].tablename; tempData[num]=Object.assign({},$scope.getDataFromBackground); }else{ console.log('网络错误') } }) } //TODO var connid = $stateParams.connid; // var connid = 314; //切换到对应页面 $scope.activity=[]; $scope.imagelist = []; $scope.recordDetailInfo={ /*className:'demandInfo', name:'', achieveMentsInfoList:[{}, {}], //成果信息 patentInfoList:[{}],//专利信息 produceInfoList:[{},{}],//产品信息 talentInfoList:[{},{}],//人才信息 demandInfoList:[{},{}]//需求信息*/ }; //录入历史 $scope.recordHistoryInfoList=[]; $scope.act = ""; $scope.headerName = ""; // $scope.recordDetailInfo={ // className:'', // name:'', // achieveMentsInfoList:[], //成果信息 // patentInfoList:[],//专利信息 // produceInfoList:[],//产品信息 // talentInfoList:[],//人才信息 // demandInfoList:[]//需求信息 // }; //根据模版获取所有模块 var getRolePageSectionList = function () { roleService.getRolePageSectionList($scope.rolePageModel).then(function (response) { //console.log("==============获取所有模块================"); //console.log(response.data); // 基本信息 $scope.sectionList = response.data.sectionList; if (UtilService.isDefined($scope.sectionList)) { angular.forEach($scope.sectionList, function (value) { var baseactivity = { className:'', headerName:'' }; baseactivity.className = value.seccode;// 模块编号 baseactivity.headerName = value.secname;// 模块名称 $scope.activity.push(baseactivity); if ($scope.activity.length > 0) { $scope.act = $scope.activity[0].className; $scope.headerName = $scope.activity[0].headerName; } }); } //console.log($scope.activity); }, function () { }) }; //获取录入历史履历 var getHistoryInterviewList = function (orgid, userid) { TechnicalBrokerPublishTrainService.getHistoryInterviewList("", userid, orgid, 1, 2).then(function (response) { if(UtilService.isDefined(response.data)){ // 获取走访录入界面的传参 $scope.rolePageModel= { //TODO id: response.data.templettype,// 模版id orgtype: 0// 走访对应的机构类型 }; //console.log("=============================="); //console.log(response); // 录入历史 $scope.historyInterviewList = response.data; } }, function () { }); }; //获取录入详情 var getPublicResourceList = function () { dataToolsService.getConnectioninfoDetailByConnid(connid).then(function (response) { if(UtilService.isDefined(response.data)){ //模版编号 $scope.pageid = response.data.templettype; // 获取录入界面的传参 $scope.rolePageModel= { //TODO id: response.data.templettype,// 模版id orgtype: 0// 走访对应的机构类型 }; //console.log("===============录入详情==============="); //console.log(response); // 录入信息 $scope.recordDetailInfo = response.data; $scope.imagelist = response.data.imagelist; var orgid = 0; if(UtilService.isDefined($scope.recordDetailInfo.organizationInfo)){ orgid = $scope.recordDetailInfo.organizationInfo.id; } if($scope.recordDetailInfo.ishigh == 1){ $scope.recordDetailInfo.ishighInfo="是"; }else{ $scope.recordDetailInfo.ishighInfo="否"; } // 获取录入时的模版对应的模块列表,详情页只显示对应的模块 $timeout(function () { getRolePageSectionList(); //1:云走访,传递用户id=0,0是我的走访,传递登录用户 var userid = UserService.id; getHistoryInterviewList(orgid, userid); }, 300); } }, function () { }); }; getPublicResourceList(); //打开操作表:设置/编辑 $scope.openActionSheet = function () { // isedit:是否可以编辑资源,isset:是否可以设置权限 var buttonlist = []; if ($scope.recordDetailInfo.ishasset) { buttonlist.push({text: '设置'}); buttonlist.push({text: '编辑'}); } $ionicActionSheet.show({ buttons: buttonlist, cancelText: '取消', buttonClicked: function (index) { if (index == 0) { console.log($scope.recordDetailInfo.typecodemap); $scope.go("selectFieldsToSet", { typecodemap: $scope.recordDetailInfo.typecodemap, resid: connid, typecode: ConstantService.TABLE_CODE_300031 }); } else if (index = 1) { console.log('编辑'); switch ($scope.pageid) { case 3: $scope.go("unitOrPersonalBaseInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 4: $scope.go("recordDemandInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 5: $scope.go("recordAchievementsInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 6: $scope.go("recordProductInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 7: $scope.go("recordPatentInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 8: $scope.go("recordTalentInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; case 9: $scope.go("unitOrPersonalBaseInfo", {pageid: $scope.pageid, connid: connid, isedit: 1}); break; default: return; } return true; } } }); }; //进入资源详情 $scope.jumpResourceDetail = function (company) { // 再跳转到资源详情页 $scope.go('resourceCommonDetailsPage', { recourceid: company.resourcelibrary.id, recourcetype: company.resourcelibrary.restype, recourcecomefrom: company.resourcelibrary.comefrom, creator: company.resourcelibrary.creator }); }; // 点击录入历史进入录入详情页 $scope.goDetail = function (historyconnid) { $scope.go("recordInfoDetail", {connid: historyconnid}); }; // 点击头像或名字进入个人主页 $scope.goPublisher = function (userid) { if (userid != 0) { $scope.go('publisher', {Id: userid}); } }; });