angular.module('push') .controller('privateResourceCtrl', function ($q, $scope, $ionicActionSheet, $ionicHistory, $ionicSlideBoxDelegate, ResourceLibraryService, $stateParams, $timeout, $ionicScrollDelegate, UtilService, $ionicPopup, resourceLibraryTempData, $ionicListDelegate, AuthorityService, UserService, taskModuleService, ConfigService, ActivityService, ConstantService, dataToolsService, CommonService, $ionicModal) { //TODO if ($scope.app) { $scope.setStatusBar(1); } $scope.defaultLan = UserService.defaultLan; $scope.isWeb = !$scope.isapp; $scope.labelKeys = ''; // $scope.comfromWeb=sessionStorage.comfrom=='web'; // sessionStorage.comfrom=''; console.log($stateParams); $scope.privateName = $stateParams.privateName $scope.node = UserService.node; $scope.Connections = [ { restype: '2', url: 'https://www.51jishu.com/result', name: '成果大厅' }, { restype: '8', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/searchExpert', name: '专家大厅' }, { restype: '3', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/newPolicy?dataType=3', name: '政策扶持' }, { restype: '40', url: 'https://12348.sft.zj.gov.cn/main/index/', name: '法律咨询' }, { restype: '40', url: 'http://app.gjzwfw.gov.cn/jmopen/webapp/html5/swsxxcx/index.html', name: '会计咨询' }, { restype: '40', url: 'http://zhejiang.chinatax.gov.cn/col/col13316/index.html', name: '税务咨询' }, { restype: '40', url: 'https://zscqyjs.zjamr.zj.gov.cn/api/othing/cms/fwjg/1/0/0.html', name: '专利咨询' }, { restype: '40', url: 'https://jg.sac.net.cn/pages/publicity/securities-list.html', name: '券商咨询' }, { restype: '39', url: 'https://www.hzjrzhfw.com/home/index', name: '银行贷款' }, { restype: '39', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/technologyFinance', name: '科技金融' }, { restype: '41', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/makerSpace', name: '众创空间' }, { restype: '41', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/incubator', name: '孵化器' }, { restype: '41', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/comprehensive', name: '服务F综合体' }, { restype: '42', url: 'https://sti.kj.hangzhou.gov.cn:9443/technology-brain-web/searchList/handle', name: '项目申报' }, ] $scope.jumyclick = function (url) { console.log(url) window.open(url) } $scope.field = ['enterprisequalification', 'usertask_type', 'cooperationmodel', 'proficiency', 'cooperationmodel']; $scope.genre = ["category"]; var category = $stateParams.category; $scope.authority = false; $scope.authority = $stateParams.authority == 'true'; if ($stateParams.restype == 3 || $stateParams.restype == 30 || $stateParams.restype == 31 || $stateParams.restype == 32 || $stateParams.restype == 33 || $stateParams.restype == 34) { $scope.canDelete = $stateParams.authority == 'true'; } $scope.hasAuth = false; ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) { // console.log(res); $scope.hasAuth = res.data; }) taskModuleService.thisUserIsAdmin().then(function (res) { console.log('删除权限', res) if (res.code == 3350) { $scope.isAdmin = res.data; } }) $stateParams.capacityparams ? $scope.capacityparams = $stateParams.capacityparams : '' $scope.filterList = $stateParams.filterList; //加载等待页 $scope.isloadingPageFloor = false; //全部企业加载失败页 $scope.isloadingPageFailAll = false; //我的企业加载失败页 $scope.isloadingPageFail = false; // console.log($stateParams); //1:需求,2:成果,6:企业,8:人才 var res = angular.fromJson($stateParams.res); //TODO $scope.groupid = $stateParams.groupid;// 资源库文件夹id $scope.restype = $stateParams.restype;// 资源库类别 var pagenum = $scope.pagenum = 0;// 索引库分页索引值,默认第一页:0 var userid = $scope.userid = UserService.id;//查询时需的用户id $scope.keyfilter = { key: ""// 搜索关键词 } $scope.name = res.name; // console.log(reclib.parentid,reclib.moduleid,$scope.modlibid,$scope.libtype,$scope.name); // 需求库名称 $scope.privateName = $stateParams.privateName; // 我的XX/全部XX XX→需求、成果 $scope.privateContent = $stateParams.privateContent; var checkedresource = {};//单个分享时选中的资源 var checkedindex = -1;//多个分享时第一个选择的索引 $scope.checkedresourcelist = [];//多个分享时选中的资源 //拼凑筛选条件 if (!$scope.labelKeys || $scope.labelKeys == "") { $scope.labelKeys = ""; angular.forEach($scope.filterList, function (res) { if (res.title != '潜力库') { angular.forEach(res.items, function (item) { if (item.selected && item.labelName != '全部') { $scope.labelKeys += item.labelKey + ","; } }) } }) } $scope.tabs = []; var chooseIndex = resourceLibraryTempData.getCategoryIndex();//当前频道索引 $scope.index = chooseIndex; $scope.checked = resourceLibraryTempData.getChecked(); $scope.checked.classificationType = $scope.restype; // $scope.goback = function () { // if (UserService.node == 320481000) { // $scope.go("tab.activityIndex"); // } else { // $scope.go("tab.resourceLibrary"); // } // } $scope.goback = function () { $scope.go("tab.activityIndex"); } //通过浏览器地址栏里面的参数来获取moduleid和restype var href = window.location.href; var splitArr = href.split('privateResource'); if (splitArr.length >= 2) { console.log(splitArr) //重写返回功能 $scope.goback = function () { $scope.go("tab.activityIndex"); } var split = splitArr[1].split('/'); if (split.length >= 2) { $scope.groupid = split[1]; $scope.restype = split[2]; if (sessionStorage.restype == "0") { $scope.privateName = '科创联盟入驻企业库'; } if (sessionStorage.restype == "1") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '需求库'; } else { $scope.privateName = 'Demands Database'; } } if (sessionStorage.restype == "2") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '成果库'; } else { $scope.privateName = 'Achievements Database'; } } if (sessionStorage.restype == "3") { $scope.privateName = '政策库'; } if (sessionStorage.restype == "6") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '企业库'; } else { $scope.privateName = 'Enterprise Database'; } } if (sessionStorage.restype == "7") { $scope.privateName = '高校库'; } if (sessionStorage.restype == "8") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '专家库'; } else { $scope.privateName = 'Experts Database'; } } if (sessionStorage.restype == "35") { $scope.privateName = '技术经理人库'; } if (sessionStorage.restype == "36") { $scope.privateName = '产学研备案库库'; } if (sessionStorage.restype == "38") { $scope.privateName = '人才库'; } if (sessionStorage.restype == "39") { $scope.privateName = '金融库'; } if (sessionStorage.restype == "40") { $scope.privateName = '中介库'; } if (sessionStorage.restype == "41") { $scope.privateName = '平台库'; } if (sessionStorage.restype == "43") { $scope.privateName = '武进区科技创新创业联盟库'; } if (sessionStorage.restype == "44") { $scope.privateName = '创新创业联盟导师库'; } if (UserService.defaultLan == 'Chinese') { $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 1); } else { $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 9); } } } if ($scope.groupid != undefined && $scope.restype != undefined) { sessionStorage.groupid = $scope.groupid.toString(); sessionStorage.restype = $scope.restype; } if ($scope.privateName == null || $scope.privateName == undefined || $scope.privateName == "") { if (sessionStorage.restype == "0") { $scope.privateName = '科创联盟入驻企业库'; } if (sessionStorage.restype == "1") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '需求库'; } else { $scope.privateName = 'Demands Database'; } } if (sessionStorage.restype == "2") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '成果库'; } else { $scope.privateName = 'Achievements Database'; } } if (sessionStorage.restype == "3") { $scope.privateName = '政策库'; } if (sessionStorage.restype == "6") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '企业库'; } else { $scope.privateName = 'Enterprise Database'; } } if (sessionStorage.restype == "7") { $scope.privateName = '高校库'; } if (sessionStorage.restype == "8") { if (UserService.defaultLan == 'Chinese') { $scope.privateName = '专家库'; } else { $scope.privateName = 'Experts Database'; } } if (sessionStorage.restype == "35") { $scope.privateName = '技术经理人库'; } if (sessionStorage.restype == "36") { $scope.privateName = '产学研备案库库'; } if (sessionStorage.restype == "38") { $scope.privateName = '人才库'; } if (sessionStorage.restype == "39") { $scope.privateName = '金融库'; } if (sessionStorage.restype == "40") { $scope.privateName = '中介库'; } if (sessionStorage.restype == "41") { $scope.privateName = '平台库'; } if (sessionStorage.restype == "43") { $scope.privateName = '武进区科技创新创业联盟库'; } if (sessionStorage.restype == "44") { $scope.privateName = '创新创业联盟导师库'; } if (UserService.defaultLan == 'Chinese') { $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 1); } else { $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 9); } } // 我的企业-分页 $scope.mypages = { allFlag: true, currentPage: 0, pageSize: 4, totalPage: 0, totalCount: 0, startIndex: 0, sortKeys: "" }; // 所有企业-分页 $scope.allpages = { allFlag: true, currentPage: 0, pageSize: 4, totalPage: 0, totalCount: 0, startIndex: 0, sortKeys: "" }; $scope.keyfilter = { key: "" };//搜索关键词 var activity = ['task', 'mytask']; $scope.act = activity[1];//默认选择全部资源 $scope.changeAct = function (num) { $scope.islogin = ConfigService.islogin; $scope.act = activity[num]; if (num == 0) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { // 我的企业则userid要传递 $scope.act = activity[num]; //TODO userid = UserService.id; // userid = 859; } } else if (num == 1) { $scope.act = activity[num]; userid = 0; } }; //虚拟搜索框 $scope.isShowSearchButton = true; $scope.keyfilter = { key: "" };//搜索关键词 $scope.showSearchButtonLeft = function () { $scope.isShowSearchButton = false; $(".showSearchInputForResLibrary").focus(); }; //清空搜索内容 $scope.clearSearch = function () { $scope.isShowSearchButton = true; $scope.keyfilter.key = ""; }; //TODO 放开注释 if ($scope.app) { if (device.platform != "Android") { $scope.isIos = true; } else { $scope.isIos = false; } } /*{ SortType: 0, classificationType: libtype, starType: 0, MaturityType: 0, RightType: 0, ModelType: 0, BudgetType: 0, ScaleType: 0, EnterpriseType: 0, DegreeType: 0, sexType: 0, TitleType: 0 }*/ //排序初始化 // $scope.sorts = [ // {name: "热门", type: 0, value: "visitcount,DESC"}, // {name: "最新", type: 1, value: "timestamp,DESC"}, // {name: "综合", type: 2, value: "compositescore,DESC"} // ]; // var checkedsort = $scope.sorts[0].value; //分类初始化 /*$scope.classification = [ {name: "不限", type: 0}, {name: "成果", type: 2}, {name: "需求", type: 1}, {name: "企业", type: 6}, {name: "人才", type: 8} ]; //地区初始化 $scope.checkedlocationtype = 1; $scope.chooeslocation = [ {name: "不限"}, {name: "常州"}, {name: "定位"} ];*/ if ($scope.restype == 2) { //成熟度初始化 $scope.chooesMaturity = [ { name: "不限", type: 0 }, { name: "正在研发", type: 1 }, { name: "已有小样", type: 2 }, { name: "通过小试", type: 3 }, { name: "通过中试", type: 4 }, { name: "可以量产", type: 5 } ]; //知识产权初始化 $scope.chooesRight = [ { name: "不限", type: 0 }, { name: "有", type: 1 }, { name: "无", type: 2 } ]; //合作模式初始化 $scope.chooesModel = [ { name: "不限", type: 0 }, { name: "委托开发", type: 1 }, { name: "合作研发", type: 2 }, { name: "成果转让", type: 3 }, { name: "技术入股", type: 4 }, { name: "技术咨询", type: 5 }, { name: "其他", type: 6 } ]; } else if ($scope.restype == 1) { //合作模式初始化 $scope.chooesModel = [ { name: "不限", type: 0 }, { name: "委托开发", type: 1 }, { name: "合作研发", type: 2 }, { name: "成果转让", type: 3 }, { name: "技术入股", type: 4 }, { name: "技术咨询", type: 5 }, { name: "其他", type: 6 } ]; //投入预算 $scope.inputBudget = [ { name: "不限", type: 0 }, { name: "1000万以上", type: 9 }, { name: "500万-1000万", type: 8 }, { name: "200万-500万", type: 7 }, { name: "100万-200万", type: 6 }, { name: "50万-100万", type: 5 }, { name: "10万-50万", type: 4 }, { name: "10万以下", type: 3 }, { name: "面议", type: 2 } ] } else if ($scope.restype == 6) { //企业规模 $scope.enterpriseScale = [ { name: "不限", type: 0 }, { name: "少于50人", type: 1 }, { name: "50-150人", type: 2 }, { name: "150-500人", type: 3 }, { name: "500-1000人", type: 4 }, { name: "1000-5000人", type: 5 }, { name: "5000-10000人", type: 6 }, { name: "10000人以上", type: 7 } ]; //企业类型 $scope.enterpriseType = [ { name: "不限", type: 0 }, { name: "国有企业", type: 1 }, { name: "集体所有制企业", type: 2 }, { name: "私营企业", type: 3 }, { name: "股份制企业", type: 4 }, { name: "联营企业", type: 5 }, { name: "外商投资企业", type: 6 }, { name: "港澳台企业", type: 7 }, { name: "股份合作企业", type: 8 } ]; $scope.starType = [ { name: "不限", type: 0 }, { name: "是", type: 1 }, { name: "否", type: 2 } ]; } else if ($scope.restype == 8) { //学位 $scope.academicDegree = [ { name: "不限", type: 0 }, { name: "博士后", type: 7 }, { name: "博士", type: 6 }, { name: "硕士", type: 5 }, { name: "学士", type: 4 }, { name: "其他", type: 8 } ]; $scope.sexType = [ { name: "不限", type: 0 }, { name: "男", type: 1 }, { name: "女", type: 2 } ]; //职称 $scope.occupationalTitle = [ { name: "不限", type: 0 }, { name: "正高", type: 1 }, { name: "副高", type: 2 }, { name: "中级", type: 3 }, { name: "副级", type: 4 }, { name: "无", type: 5 } ]; } else if ($scope.restype == 7) { //学校类别 $scope.universitytype = [ { name: "不限", type: 0 }, { name: "985工程院校暨211工程院校", type: 600 }, { name: "985工程院校", type: 601 }, { name: "211工程院校", type: 602 }, { name: "普通本科院校", type: 604 }, { name: "高职专科院校", type: 606 } ]; } // 我的企业 $scope.contentlist = []; // 全部企业 $scope.allcontentlist = []; // 获取排序选项列表 var checkedsort = ''; var getResourceSortList = function () { var deferred = $q.defer(); ResourceLibraryService.getResourceSortList($stateParams.restype).then(function (res) { console.log('排序列表', res) if (res.code == 3350) { $scope.sortList = res.data[0]; $stateParams.checkedsort ? checkedsort = $stateParams.checkedsort : '' if ($stateParams.checkedsort) { $scope.sortList.items.forEach((res) => { if (res.labelKey == $stateParams.checkedsort) { res.selected = true } }) } else { // $scope.sortList.items[0].selected = true; console.log('这是什么意思', $scope.sortList.items); $scope.sortList.items[0] ? ($scope.sortList.items[0].selected = true) : false; checkedsort = $scope.sortList.items.length > 0 ? $scope.sortList.items[0].labelKey : 'timestamp,desc'; } deferred.resolve('sucess'); } }) return deferred.promise; }; // 获取资源库下行业分类列表 var getCategoryList = function () { /*ResourceLibraryService.getCategoryList(1001, reclibid, modlibid).then(function (response) { // console.log(response); $scope.categorylist = [{ appModuleName: "全部", by1: "" }]; $scope.categorylist = $scope.categorylist.concat(response.channelList); angular.forEach($scope.categorylist, function (value, index) { $scope.contentlist.push({isload: false, currentPage: 1, reslist: []}); }); $timeout(function () { $ionicSlideBoxDelegate.slide(chooseIndex); $scope.getPrivateResourceList(); }, 100); }, function () { UtilService.showMess("网络不给力,请重试"); })*/ // 获取资源列表-全部企业 getResourceSortList().then(function (res) { $scope.getAllPrivateResourceList(0); // 获取资源列表-我的企业 //TODO // userid = 859; $scope.getPrivateResourceList(userid); }) }; //导出所有企业基本信息 $scope.onexportAllOrg = function () { $scope.showLoadingToastUtilEnd(); ResourceLibraryService.getexportAllOrg().then(function (res) { $scope.hideLoadingToast(); var aEle = document.createElement("a");// 创建a标签 var blob = new Blob([res], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }); aEle.download = '企业库基本信息';// 设置下载文件的文件名 aEle.href = URL.createObjectURL(blob); aEle.click();// 设置点击事件 }).catch(function (res) { $scope.hideLoadingToast(); $ionicPopup.alert({ title: '提示', template: "服务器错误" }); }) } //获取资源列表-我的企业 $scope.getPrivateResourceList = function (id) { $scope.isloadingPageFloor = true; // $scope.showLoadingToast(); ResourceLibraryService.getFirstResourceList(sessionStorage.restype, sessionStorage.groupid, $scope.pagenum, $scope.keyfilter.key, checkedsort, id, ConstantService.TRACE_TYPE_2619, category, $scope.labelKeys, JSON.stringify(Traverse()), $scope.capacityparams).then(function (response) { console.log('收藏', response); if ($stateParams.restype == 30) { angular.forEach(response.data, function (res) { if (!res.title) { dataToolsService.getWebCascade(res.type, 0).then(function (resp) { if (resp.code == 3350 && resp.data.length > 0) { var temp = resp.data.filter(function (val) { return val.code == res.primTag; }) if (temp.length > 0) { res.title = temp[0].name; } } }, function () { }) } }) } var tempreslib = angular.fromJson(response.data); $scope.mypages = angular.fromJson(response.page); // console.log(tempreslib); var temppage = angular.fromJson(response.page); var totalPage = Math.ceil((temppage == null ? 0 : temppage.totalCount == null ? 0 : temppage.totalCount) / 4); // console.log(totalPage); angular.forEach(tempreslib, function (val) { if (val.labelObj) { val.labelObj = val.labelObj.slice(0, 3); // angular.forEach(val.otherObj,function(vv){ // vv.labelName=vv.labelKey=='企业规模'?vv.labelKey+vv.labelName:vv.labelName=='是'?vv.labelKey.slice(2):vv.labelName; // }) } }) $scope.contentlist[chooseIndex].reslist = tempreslib; var trHtml = "
更新了" + ($scope.contentlist[chooseIndex].reslist == null ? 0 : $scope.contentlist[chooseIndex].reslist.length == null ? 0 : $scope.contentlist[chooseIndex].reslist.length) + "条内容
"; $timeout(function () { $(".resourcelistDiv.list").prepend(trHtml); $(".refresh_tip_div").animate({ width: 100 + "%" }, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); //判断是否有下一页 $timeout(function () { $timeout(function () { if ($scope.contentlist[chooseIndex].currentPage >= totalPage) { $scope.contentlist[chooseIndex].isload = false; } else { $scope.contentlist[chooseIndex].isload = true; } $scope.contentlist[chooseIndex].currentPage = 1; }, 1000); // $scope.hideLoadingToast(); $ionicSlideBoxDelegate.update(); $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0); }, 50); $scope.isloadingPageFloor = false; $scope.isloadingPageFail = false; $scope.isloadingPageFailAll = false; }, function () { // $scope.hideLoadingToast(); $scope.isloadingPageFloor = false; $scope.isloadingPageFail = true; $scope.isloadingPageFailAll = false; }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); }; //加载更多资源列表-我的企业 $scope.loadMore = function (id) { $scope.contentlist[chooseIndex].isload = false; $scope.loadmore = true; // $scope.showLoadingToast(); // ResourceLibraryService.getSecondResourceList(1001, $scope.checked, checkedsort, $scope.categorylist[chooseIndex].by1, "", $scope.contentlist[chooseIndex].currentPage, reclibid).then(function (response) { ResourceLibraryService.getSecondResourceList(sessionStorage.restype, sessionStorage.groupid, $scope.contentlist[chooseIndex].currentPage, $scope.keyfilter.key, checkedsort, id, ConstantService.TRACE_TYPE_2619, category, $scope.labelKeys, JSON.stringify(Traverse()), $scope.capacityparams).then(function (response) { console.log('方法走了吗', response); // $scope.hideLoadingToast(); if ($stateParams.moduleid == 30) { angular.forEach(response.data, function (res) { if (!res.title) { dataToolsService.getWebCascade(res.type, 0).then(function (resp) { if (resp.code == 3350 && resp.data.length > 0) { var temp = resp.data.filter(function (val) { return val.code == res.primTag; }) if (temp.length > 0) { res.title = temp[0].name; } } }, function () { }) } }) } var tempreslib = angular.fromJson(response.data); angular.forEach(tempreslib, function (val) { if (val.labelObj) { val.labelObj = val.labelObj.slice(0, 3); // angular.forEach(val.otherObj,function(vv){ // vv.labelName=vv.labelKey=='企业规模'?vv.labelKey+vv.labelName:vv.labelName=='是'?vv.labelKey.slice(2):vv.labelName; // }) } }) $scope.mypages = angular.fromJson(response.page); var temppage = angular.fromJson(response.page); var totalPage = Math.ceil(temppage.totalCount / 4); // console.log(totalPage); //加载数据,更新当前页数 $timeout(function () { if (tempreslib.length > 0) { $scope.contentlist[chooseIndex].reslist = $scope.contentlist[chooseIndex].reslist.concat(tempreslib); } $scope.loadmore = false; }, 2000); // $scope.hideLoadingToast(); //判断是否有下一页 $timeout(function () { if ($scope.contentlist[chooseIndex].currentPage >= totalPage) { $scope.contentlist[chooseIndex].isload = false; } else { $scope.contentlist[chooseIndex].isload = true; } $scope.contentlist[chooseIndex].currentPage++; }, 2000); if (selectflg) { $timeout(function () { $(".item-options").addClass("invisible"); $(".resource_wrap").css("left", "10%"); $(".pay_list_c2").css("left", "4%"); $(".item-content").css("transform", "translate3d(0px, 0px, 0px)"); $("#collect-bottom").css("display", "block"); }, 20); } }, function () { // $scope.hideLoadingToast(); $scope.loadmore = false; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); }; $scope.showManagmentSheet = function () { var buttonlist = [ // {text: '导入'}, { text: '导出' } ]; $ionicActionSheet.show({ buttons: buttonlist, cancelText: '取消', buttonClicked: function (index) { console.log(index) // if (index == 0) { // $scope.go("importOrgInfo", {restype: $scope.restype}); // } if (index == 0) { $scope.showLoadingToast(); $scope.showExportResourceClick(); setTimeout(function () { $scope.showExportFlag = !$scope.showExportFlag; $scope.hideLoadingToast(); }, 2000); return true; } } }) } $scope.choiceExportField = function () { /*if (!$scope.flag && $scope.allcontentlist[0].reslist.length == 6) { $scope.showExportResourceClick(); $timeout(function () { jumptoexportField($scope.allcontentlist[0].reslist); }, 1000); } else { jumptoexportField($scope.allcontentlist[0].reslist); }*/ $scope.jumptoexportField($scope.allcontentlist[0].reslist); } $scope.jumptoexportField = function (reslist) { $scope.contenttemplist = []; $scope.uniquelist = []; angular.forEach(reslist, function (val) { if (val.isselected) { $scope.contenttemplist.push(val.resource); $scope.uniquelist.push(val.resource.unique); } }) if ($scope.uniquelist.length == 0) { $ionicPopup.alert({ title: '提示', template: "

请先选择企业!

", buttons: [{ text: "确定" }] }); return; } $scope.go("exportField", { "reslist": $scope.contenttemplist, "uniquelist": $scope.uniquelist }); } $scope.showExportFlag = true; $scope.showExportResourceClick = function () { var labelkey = ""; angular.forEach($scope.filterList, function (filter) { if (filter.items[0].isselect) { } else { angular.forEach(filter.items, function (item) { if (item.isselect) { labelkey += (item.labelKey + ","); } }) } }).getFirstResourceListForAll(sessionStorage.restype, sessionStorage.groupid, 0, "", "", 0, 0, "", labelkey).then(function (res) { console.log(res) if (res.code == 3350) { var resbackuplist = []; angular.forEach(res.data, function (res) { var temphtml = { resource: res, isselected: false }; resbackuplist.push(temphtml); }) $scope.allcontentlist[0].reslist = resbackuplist; $scope.allpages.totalCount = resbackuplist.length; } }) } $scope.showFinishlick = function () { $scope.showExportFlag = true; $scope.allcontentlist[0].reslist = $scope.resbackuplist; } //全选 $scope.flag = true; $scope.choiceAllResource = function () { if ($scope.flag) { angular.forEach($scope.allcontentlist[0].reslist, function (val) { val.isselected = true; }) } else { angular.forEach($scope.allcontentlist[0].reslist, function (val) { val.isselected = false; }) } $scope.flag = !$scope.flag; } //重新加载全部企业 $scope.repeatLoadAll = function () { $scope.isloadingPageFailAll = false; $scope.getAllPrivateResourceList(0); }; //重新加载我的企业 $scope.repeatLoad = function () { $scope.isloadingPageFail = false; $scope.getPrivateResourceList(userid); }; //获取资源列表-全部企业 $scope.getAllPrivateResourceList = function (id) { $scope.isloadingPageFloor = true; // $scope.showLoadingToast(); // console.log(id); ResourceLibraryService.getFirstResourceList(sessionStorage.restype, sessionStorage.groupid, $scope.pagenum, $scope.keyfilter.key, checkedsort, id, 0, category, $scope.labelKeys, JSON.stringify(Traverse()), $scope.capacityparams).then(function (response) { $scope.hideLoadingToast(); console.log('全部资源', response); $scope.resourceLength = response.data == null ? 0 : response.data.length; $scope.page = response.page if ($stateParams.libtype == 30) { angular.forEach(response.data, function (res) { if (!res.title) { dataToolsService.getWebCascade(res.type, 0).then(function (resp) { if (resp.code == 3350 && resp.data.length > 0) { var temp = resp.data.filter(function (val) { return val.code == res.primTag; }) if (temp.length > 0) { res.title = temp[0].name; } } }, function () { }) } }) } var tempreslib = angular.fromJson(response.data); angular.forEach(tempreslib, function (val) { if (val.labelObj) { val.labelObj = val.labelObj.slice(0, 3); // angular.forEach(val.otherObj,function(vv){ // vv.labelName=vv.labelKey=='企业规模'?vv.labelKey+vv.labelName:vv.labelName=='是'?vv.labelKey.slice(2):vv.labelName; // }) } }) $scope.allpages = angular.fromJson(response.page); var temppage = angular.fromJson(response.page); var totalPage = Math.ceil(temppage == null ? 0 : temppage.totalCount / 4); // console.log(totalPage); $scope.allcontentlist[chooseIndex].reslist = tempreslib; $scope.resbackuplist = $scope.allcontentlist[chooseIndex].reslist; var trHtml = "
更新了" + ($scope.allcontentlist[chooseIndex].reslist == null) ? 0 : ($scope.allcontentlist[chooseIndex].reslist.length == null ? 0 : $scope.allcontentlist[chooseIndex].reslist.length) + "条内容
"; $timeout(function () { $(".resourcelistDiv .list").prepend(trHtml); $(".refresh_tip_div").animate({ width: 100 + "%" }, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); //判断是否有下一页 $timeout(function () { $timeout(function () { if ($scope.allcontentlist[chooseIndex].currentPage >= totalPage) { $scope.allcontentlist[chooseIndex].isload = false; } else { $scope.allcontentlist[chooseIndex].isload = true; } $scope.allcontentlist[chooseIndex].currentPage = 1; var allcontenttemplist = []; angular.forEach($scope.allcontentlist[chooseIndex].reslist, function (res) { var temphtml = { resource: res, isselected: false }; allcontenttemplist.push(temphtml); }) $scope.allcontentlist[chooseIndex].reslist = allcontenttemplist; $scope.resbackuplist = $scope.allcontentlist[chooseIndex].reslist; }, 0); $scope.hideLoadingToast(); $ionicSlideBoxDelegate.update(); $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0); }, 50); $scope.clickResource = function (resource) { resource.isselected = !resource.isselected; } $scope.isloadingPageFloor = false; $scope.isloadingPageFail = false; $scope.isloadingPageFailAll = false; }, function () { $scope.hideLoadingToast(); $scope.isloadingPageFloor = false; $scope.isloadingPageFail = false; $scope.isloadingPageFailAll = true; }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); }; //分页 $scope.handlepagination = function (currentPage) { console.log(11, currentPage) $scope.allcontentlist[chooseIndex].currentPage = currentPage $scope.showLoadingToast(); $scope.loadMoreForAll(0) } //加载更多资源列表-全部企业 // $scope.loadMoreForAll = function (id) { // $scope.allcontentlist[chooseIndex].isload = false; $scope.allloadmore = true; // $scope.showLoadingToast(); // ResourceLibraryService.getSecondResourceList(1001, $scope.checked, checkedsort, $scope.categorylist[chooseIndex].by1, "", $scope.contentlist[chooseIndex].currentPage, reclibid).then(function (response) { ResourceLibraryService.getSecondResourceList(sessionStorage.restype, sessionStorage.groupid, $scope.allcontentlist[chooseIndex].currentPage, $scope.keyfilter.key, checkedsort, id, 0, category, $scope.labelKeys, JSON.stringify(Traverse()), $scope.capacityparams).then(function (response) { console.log(response); if ($stateParams.restype == 30) { angular.forEach(response.data, function (res) { if (!res.title) { dataToolsService.getWebCascade(res.type, 0).then(function (resp) { if (resp.code == 3350 && resp.data.length > 0) { var temp = resp.data.filter(function (val) { return val.code == res.primTag; }) if (temp.length > 0) { res.title = temp[0].name; } } }, function () { }) } }) } var tempreslib = angular.fromJson(response.data); angular.forEach(tempreslib, function (val) { if (val.labelObj) { val.labelObj = val.labelObj.slice(0, 3); // angular.forEach(val.otherObj,function(vv){ // vv.labelName=vv.labelKey=='企业规模'?vv.labelKey+vv.labelName:vv.labelName=='是'?vv.labelKey.slice(2):vv.labelName; // }) } }) $scope.allpages = angular.fromJson(response.page); var temppage = angular.fromJson(response.page); // var totalPage = Math.ceil(temppage.totalCount / 4); var totalPage = response.page.totalPage; console.log(totalPage); if ($scope.isapp) { console.log($scope.allcontentlist) if (tempreslib.length > 0) { $scope.allcontentlist[chooseIndex].reslist = $scope.allcontentlist[chooseIndex].reslist.concat(tempreslib); var allcontenttemplist = []; angular.forEach($scope.allcontentlist[chooseIndex].reslist, function (res) { if (res.isselected == undefined) { var temphtml = { resource: res, isselected: false }; allcontenttemplist.push(temphtml); } else { allcontenttemplist.push(res); } }) $scope.allcontentlist[chooseIndex].reslist = allcontenttemplist; } $scope.allloadmore = false; // $scope.hideLoadingToast(); //判断是否有下一页 if ($scope.allcontentlist[chooseIndex].currentPage >= totalPage) { console.log(963412) $scope.allcontentlist[chooseIndex].isload = false; } else { $scope.allcontentlist[chooseIndex].isload = true; } $scope.$broadcast('scroll.infiniteScrollComplete'); $scope.allcontentlist[chooseIndex].currentPage++; } else { var allcontenttemplist = []; angular.forEach(tempreslib, function (res) { if (res.isselected == undefined) { var temphtml = { resource: res, isselected: false }; allcontenttemplist.push(temphtml); } else { allcontenttemplist.push(res); } }) $scope.allcontentlist[chooseIndex].reslist = allcontenttemplist; $scope.hideLoadingToast() console.log($scope.allcontentlist) } //加载数据,更新当前页数 if (selectflg) { $timeout(function () { $(".item-options").addClass("invisible"); $(".resource_wrap").css("left", "10%"); $(".pay_list_c2").css("left", "4%"); $(".item-content").css("transform", "translate3d(0px, 0px, 0px)"); $("#collect-bottom").css("display", "block"); }, 20); } }, function () { // $scope.hideLoadingToast(); $scope.allloadmore = false; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); }; getCategoryList(); $scope.islogin = ConfigService.islogin; // 进入资源详情 $scope.goResourceDetail = function (resource, ind) { if (!$scope.islogin && ($stateParams.restype != 30 && $stateParams.restype != 31 && $stateParams.restype != 32 && $stateParams.restype != 33 && $stateParams.restype != 34)) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { if (selectflg) { selectResource(resource, ind); } else { resourceLibraryTempData.setCategoryIndex(chooseIndex); resourceLibraryTempData.setChecked($scope.checked); if (!$scope.groupid) { $scope.groupid = $stateParams.groupid; } if (!$scope.restype) { $scope.restype = $stateParams.restype; } if (resource.groupid == "0") { $scope.go('resourceDetails', { recourceid: resource.unique, recourcetype: resource.type, recourcecomefrom: resource.source, title: resource.title, comfrom: 'privateResource', filterList: $scope.filterList, reclibid: $scope.groupid, moduleid: $scope.restype }); } else { $scope.go('resourceCommonDetailsPage', { res: angular.toJson($stateParams.res), recourceid: resource.unique, recourcetype: resource.type, recourcecomefrom: resource.source, creator: resource.clickthrough, title: resource.title, orgtype: 0, comfrom: 'privateResource', pagecode: 0, label: JSON.stringify(resource.otherObj), filterList: $scope.filterList, groupid: $scope.groupid, restype: $scope.restype, privateName: $scope.privateName, MoreData: $scope.MoreData, capacityparams: $scope.capacityparams, checkedsort: checkedsort, row: JSON.stringify(resource) }); } } } }; var editSlide = function (index) { var tablength = $scope.categorylist.length;//标题个数 var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般 var OffLeft = $(".Chanel_scroll_a").eq(index).offset().left;//获取当前点击标题距离父容器左边框的距离 var SelfWidth = $(".Chanel_scroll_a").eq(index).width();//获取当前点击标题宽度 var startTranform = $("#p_Chanel .scroll").offset().left; var movewidth = OffLeft - middlewidth + SelfWidth / 2; startTranform -= movewidth; if (startTranform <= 0) { if (index < tablength - 2) { $('#p_Chanel .scroll').css({ 'transform': 'translate3d(' + startTranform + 'px,0,0)' }); } } else if (index < 4) { $('#p_Chanel .scroll').css({ 'transform': 'translate3d(0,0,0)' }); } $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on"); }; $scope.selectCategory = function (index) { editSlide(index); $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on"); if (index == chooseIndex) { return; } chooseIndex = index; $scope.index = chooseIndex; $scope.getPrivateResourceList(0); }; //资源库搜索 $scope.goResourceSearch = function () { resourceLibraryTempData.setCategoryIndex(chooseIndex); resourceLibraryTempData.setChecked($scope.checked); //1:需求,2:成果,6:企业,8:人才 var tabindex = 3; if ($scope.restype == 1) { tabindex = 4; } else if ($scope.restype == 2) { tabindex = 3; } else if ($scope.restype == 6) { tabindex = 5; } else if ($scope.restype == 8) { tabindex = 6; } $timeout(function () { $scope.go('resourceSearch', { resourcetype: 1001, restype: $scope.restype, tabindex: tabindex }); }, 350); }; $scope.shareflg = false; $scope.openShare = function (tempobj, ind) { $scope.go('chooseShareResource', { chereslist: angular.toJson([tempobj.unique]), folderid: $scope.reclibid, isCloud: 1, recourcetype: tempobj.type, recourcecomefrom: tempobj.source }); /*$scope.shareflg = true; $(".resource_wrap").css("left", "0%"); $(".pay_list_c2").css("left", "-35px"); $("#collect-bottom").css("display", "none"); checkedresource = tempobj; checkedindex = ind;*/ }; $scope.closeShare = function () { $timeout(function () { $ionicListDelegate.closeOptionButtons(); }, 10); $scope.shareflg = false; }; //选择排序 $scope.chooseSort = function (b) { $scope.checked.SortType = b.type; checkedsort = b.value; }; //选择分类 /*$scope.chooseClassification = function (tempclass) { $scope.checked.classificationType = tempclass.type; };*/ //地区 /*$scope.chooseActionlocation = function (index) { $(".locationclassfile ul li").eq(index).addClass("specialSpan").siblings().removeClass("specialSpan"); if (index != 0) { $(".locationclassfile ul li:first-child").css({"color": "#000", "border": "none"}); } else { $(".locationclassfile ul li:first-child").css({"color": "#3385ff", "border": "#3385ff .5px solid"}); $(".locationclassfile ul li").removeClass("specialSpan"); } };*/ //选择成熟度 $scope.chooseActionMaturity = function (s) { $scope.checked.MaturityType = s.type; }; //选择知识产产权 $scope.chooseActionRight = function (r) { $scope.checked.RightType = r.type; }; //选择合作模式 $scope.chooseActionModel = function (m) { $scope.checked.ModelType = m.type; }; //选择投入预算 $scope.chooseInputBudget = function (budget) { $scope.checked.BudgetType = budget.type; }; //选择企业规模 $scope.chooseEenterpriseScale = function (scale) { $scope.checked.ScaleType = scale.type; }; //高企 $scope.chooseStarType = function (star) { $scope.checked.starType = star.type; }; //选择企业类型 $scope.chooseEnterpriseType = function (enterprise) { $scope.checked.EnterpriseType = enterprise.type; }; //选择学位 $scope.chooseAcademicDegree = function (degree) { $scope.checked.DegreeType = degree.type; }; //性别 $scope.chooseSexType = function (sex) { $scope.checked.sexType = sex.type; }; //选择职称 $scope.chooseOccupationalTitle = function (title) { $scope.checked.TitleType = title.type; }; //选择学校类别 $scope.chooseUniversityType = function (university) { $scope.checked.UniversityType = university.type; }; //展开/收起排序 $scope.toggleSort = function () { $(".sort ul").toggle(); $(".sort h3 i").toggleClass("transformArrow"); }; //展开/收起分类 /*$scope.toggleClassification = function () { $(".Classification ul").toggle(); $(".Classification h3 i").toggleClass("transformArrow"); }; //展开/收起地区 $scope.toggleClassfilelocation = function () { $(".locationclassfile ul").toggle(); $(".locationclassfile h3 i").toggleClass("transformArrow"); };*/ //展开/收起成熟度 $scope.toggleClassfileMaturity = function () { $(".Maturityclassfile ul").toggle(); $(".Maturityclassfile h3 i").toggleClass("transformArrow"); }; //展开/收起知识产权 $scope.toggleClassfileRight = function () { $(".Rightclassfile ul").toggle(); $(".Rightclassfile h3 i").toggleClass("transformArrow"); }; //展开/收起合作模式 $scope.toggleClassfileModel = function () { $(".Modelclassfile ul").toggle(); $(".Modelclassfile h3 i").toggleClass("transformArrow"); }; //展开/收起投入预算 $scope.toggleInputBudget = function () { $(".InputBudget ul").toggle(); $(".InputBudget h3 i").toggleClass("transformArrow"); }; //展开/收起企业规模 $scope.toggleEenterpriseScale = function () { $(".EenterpriseScale ul").toggle(); $(".EenterpriseScale h3 i").toggleClass("transformArrow"); }; //展开/收起高企 $scope.toggleStarType = function () { $(".StarType ul").toggle(); $(".StarType h3 i").toggleClass("transformArrow"); }; //展开/收起企业类型 $scope.toggleEnterpriseType = function () { $(".EnterpriseType ul").toggle(); $(".EnterpriseType h3 i").toggleClass("transformArrow"); }; //展开/收起学位 $scope.toggleAcademicDegree = function () { $(".AcademicDegree ul").toggle(); $(".AcademicDegree h3 i").toggleClass("transformArrow"); }; //展开/收起性别 $scope.toggleSexType = function () { $(".sexType ul").toggle(); $(".sexType h3 i").toggleClass("transformArrow"); }; //展开/收起职称 $scope.toggleOccupationalTitle = function () { $(".OccupationalTitle ul").toggle(); $(".OccupationalTitle h3 i").toggleClass("transformArrow"); }; //展开/收起学校类别 $scope.toggleUniversityType = function () { $(".UniversityType ul").toggle(); $(".UniversityType h3 i").toggleClass("transformArrow"); }; $scope.finishShow = false; //展开筛选 $scope.menueFilter = function () { $scope.finishShow = true; }; //完成选择,刷新数据 $scope.finishDone = function () { $scope.finishShow = false; // 获取资源列表-全部企业 $scope.getAllPrivateResourceList(0); // 获取资源列表-我的企业 //TODO // userid = 859; $scope.getPrivateResourceList(userid); }; //重置选择数据 $scope.reseChecked = function () { $scope.checked = { SortType: 0, classificationType: libtype, starType: 0, MaturityType: 0, RightType: 0, ModelType: 0, BudgetType: 0, ScaleType: 0, EnterpriseType: 0, DegreeType: 0, sexType: 0, TitleType: 0, UniversityType: 0 }; checkedsort = $scope.sorts[0].value; }; //点击空白灰色选择条件隐藏 $scope.hideSortDiv = function () { $scope.finishShow = false; // 获取资源列表-全部企业 $scope.getAllPrivateResourceList(0); // 获取资源列表-我的企业 //TODO // userid = 859; $scope.getPrivateResourceList(userid); }; //打开操作表 $scope.openActionSheet = function () { $ionicActionSheet.show({ buttons: [ { text: '设置' } ], cancelText: '取消', buttonClicked: function (index) { if (index == 0) { $scope.go("authoritySet", { resid: res.id, authorityid: res.authorityid, authoritycomefrom: res.authoritycomefrom, name: res.name, content: res.content, sort: res.sort, goflg: 1, type: 1, groupid: res.parentid }); } return true; } }); }; //分享选择操作表 var selectflg = false;//列表选择打开标志 $scope.openCollectShare = function () { selectflg = true; $scope.contentlist[$scope.index].reslist[checkedindex].value = true; var tempres = { infoid: checkedresource.unique, infocomefrom: checkedresource.source, infoType: checkedresource.type }; $scope.checkedresourcelist.push(tempres); $(".item-options").addClass("invisible"); $(".resource_wrap").css("left", "10%"); $(".pay_list_c2").css("left", "4%"); $(".item-content").css("transform", "translate3d(0px, 0px, 0px)"); $("#collect-bottom").css("display", "block"); $scope.closeShare(); }; //取消分享 $scope.cancelShare = function () { angular.forEach($scope.contentlist[$scope.index].reslist, function (value, ind) { $scope.contentlist[$scope.index].reslist[ind].value = false; }); $scope.checkedresourcelist = []; $(".resource_wrap").css("left", "0%"); $(".pay_list_c2").css("left", "-35px"); $("#collect-bottom").css("display", "none"); selectflg = false; }; var selectResource = function (resource, ind) { var tempres = { infoid: resource.unique, infocomefrom: resource.source, infoType: resource.type }; var chind = -1; angular.forEach($scope.checkedresourcelist, function (value, index) { if (value.infoid == resource.unique) { chind = index; } }); if (chind == -1) { $scope.contentlist[$scope.index].reslist[ind].value = true; $scope.checkedresourcelist.unshift(tempres); } else { $scope.contentlist[$scope.index].reslist[ind].value = false; $scope.checkedresourcelist.splice(chind, 1); } // console.log($scope.checkedresourcelist); }; $scope.shareResourceToPrilib = function () { $scope.go('chooseShareResource', { chereslist: angular.toJson($scope.checkedresourcelist), reclibid: $scope.reclibid }); }; // 搜索各种资源信息 $scope.searchResourceList = function () { // $scope.showLoadingToast(); var activity = ['task', 'mytask']; if ($scope.act == activity[1]) { // 获取资源列表-全部企业 $scope.getAllPrivateResourceList(0); } else if ($scope.act == activity[0]) { // 获取资源列表-我的企业 $scope.getPrivateResourceList(userid); } }, function () { // $scope.hideLoadingToast(); }; //新建走访 $scope.goEnterCompanyInfo = function (restype) { console.log(restype); if (restype == 3 || restype == 30 || restype == 31 || restype == 32 || restype == 33 || restype == 34) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { if (restype == 3) { $scope.restype = 34; $stateParams.restype = 34; } if ($stateParams.restype == 30 || $stateParams.restype == 31 || $stateParams.restype == 32 || $stateParams.restype == 33 || $stateParams.restype == 34) { $scope.go('visitModularForm', { companyid: 0, pageid: moduleid, orgtype: moduleid == 6 ? ConstantService.UNITTYPE_10104 : moduleid == 7 ? ConstantService.UNITTYPE_10105 : 0, isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建 connid: 0, pagecode: 1000030, pageTitle: '新建' + $scope.privateName.slice(0, $scope.privateName.length - 1), node: UserService.node, comfrom: 'resource' }); } else { ResourceLibraryService.getPageId(restype).then(function (res) { if (res.code == 3350) { $scope.go('visitModularForm', { companyid: 0, pageid: res.data, orgtype: restype == 6 || restype == 43 ? ConstantService.UNITTYPE_10104 : restype == 7 ? ConstantService.UNITTYPE_10105 : 0, isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建 connid: 0, pagecode: 1000030, pageTitle: '新建' + $scope.privateName.slice(0, $scope.privateName.length), node: UserService.node, resourcetype: moduleid, comfrom: 'privateResource' }); } }) } } } if (restype == 44) { $scope.go('visitModularForm', { companyid: 0, pageid: 44, orgtype: 10104, pagecode: 1000027, isedit: 0, node: UserService.node, pageTitle: '新建导师' }); } if (restype == 39) { $scope.go('visitModularForm', { companyid: 0, pageid: 39, orgtype: 10104, pagecode: 1000036, isedit: 0, node: UserService.node, pageTitle: '新建金融信息', innertype: 39 }); } }; //假数据、添加星级、评分与评价数 // *******不能删,加载列表需要用到******** // 我的企业 $scope.contentlist = [ { title: '企业A', ishigh: 1, industry: '化工', starNum: 5, commentListNum: 222, }, { title: '企业A', ishigh: 1, industry: '化工', starNum: 4.5, commentListNum: 102 }, { title: '企业A', ishigh: 1, industry: '化工', starNum: 4, commentListNum: 82 }, { title: '企业B', ishigh: 1, industry: '化工', starNum: 3.5, commentListNum: 62 }, { title: '企业C', ishigh: 1, industry: '化工', starNum: 3, commentListNum: 42 }, { title: '企业D', ishigh: 0, industry: '化工', starNum: 2, commentListNum: 32 }, { title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长', ishigh: 0, industry: '化工', starNum: 1, commentListNum: 22 }, { title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长', ishigh: 0, industry: '化工', starNum: 0, commentListNum: 12 } ]; // 全部企业 $scope.allcontentlist = [ { title: '企业A', ishigh: 1, industry: '化工', starNum: 5, commentListNum: 222, }, { title: '企业A', ishigh: 1, industry: '化工', starNum: 4.5, commentListNum: 102 }, { title: '企业A', ishigh: 1, industry: '化工', starNum: 4, commentListNum: 82 }, { title: '企业B', ishigh: 1, industry: '化工', starNum: 3.5, commentListNum: 62 }, { title: '企业C', ishigh: 1, industry: '化工', starNum: 3, commentListNum: 42 }, { title: '企业D', ishigh: 0, industry: '化工', starNum: 2, commentListNum: 32 }, { title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长', ishigh: 0, industry: '化工', starNum: 1, commentListNum: 22 }, { title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长', ishigh: 0, industry: '化工', starNum: 0, commentListNum: 12 } ] $scope.editItem = function () { console.log(1); } $scope.deletItem = function (id, node, idx) { console.log(id) $ionicPopup.confirm({ title: '删除确认', template: '请确认是否要删除此项!', cancelText: '取消', okText: '确认', }).then(function (res) { console.log(res); if (res) { dataToolsService.deleteresource(id).then(function (res) { console.log(res) if (res.code == 3350) { if ($scope.app) { UtilService.showMess('删除成功'); } else { CommonService.showMessage('删除成功', $scope); } if ($scope.act == activity[1]) { // setTimeout(()=>{ // $scope.getAllPrivateResourceList(0); // },1000) // 获取资源列表-全部企业 $scope.getAllPrivateResourceList(0); } else if ($scope.act == activity[0]) { // 获取资源列表-我的企业 $scope.getPrivateResourceList(userid); } } else { if ($scope.app) { UtilService.showMess('删除失败'); } else { CommonService.showMessage('删除失败', $scope); } } }) } else { // console.log('You are not sure'); } }); } // 筛选条件页面 $ionicModal.fromTemplateUrl('./modules/common/views/filterPage.html', { scope: $scope, animation: 'slide-in-left' }).then(function (modal) { $scope.filterPageModal = modal; }); $ionicModal.fromTemplateUrl('./modules/common/views/filterPagetl.html', { scope: $scope, }).then(function (modal) { $scope.filtertlPageModaltl = modal; }); $scope.showSideBar = function () { $scope.filterPageModal.show(); } // $scope.taskTypeList = // { // title: '需求类型', // items: [ // {labelName: '全部', labelKey: 0, selected: true}, // {labelName: '技术需求', labelKey: 5350, selected: false}, // {labelName: '人才需求', labelKey: 5351, selected: false}, // {labelName: '投融资需求', labelKey: 5353, selected: false}, // {labelName: '其他', labelKey: 5354, selected: false}, // ] // } if ($scope.filterList == null || $scope.filterList.length == 0) { $scope.filterList = []; } $scope.showFilter = false; if ($scope.filterList == null || $scope.filterList.length == 0) { ResourceLibraryService.getFilterList(sessionStorage.restype).then(function (res) { console.log(res); if (res.code == 3350 && res.data.length > 0) { $scope.showFilter = true; $scope.filterList = res.data; angular.forEach($scope.filterList, function (val) { if (val.title != '国高' && val.title != '规上' && val.title != '潜力库') { val.items.unshift({ labelName: '全部', labelKey: 88888888, 'isselect': true, selected: true }); } }) } }) } $scope.changSelected = function (item, outerIndex, index) { console.log(item, outerIndex, index,$scope.privateName,$scope.filterList) // if($scope.privateName=='成果库'){ angular.forEach($scope.filterList, function (val1) { angular.forEach(val1.items, function (val2) { val2.selected = false; val2.isselect = false; }) }) item.selected = !item.selected; item.isselect = !item.isselect; // } // else { // item.selected = !item.selected; // item.isselect = !item.isselect; // angular.forEach($scope.filterList, function (val1) { // angular.forEach(val1.items, function (val2) { // if (val2.labelName == item.labelName && item.isselect && item.labelName != "全部") { // val1.items[0].selected = false; // val1.items[0].isselect = false; // } // if(item.labelName == "全部"&&val2.labelName!='全部'){ // val2.selected = false; // val2.isselect = false; // } // }) // }) // } } $scope.removeResourceByItems = function (item) { item.selected = !item.selected; item.isselect = !item.isselect; $scope.submitSelected(); } $scope.resetSelected = function () { angular.forEach($scope.filterList, function (val) { angular.forEach(val.items, function (value, index) { value.selected = index == 0; }) }) angular.forEach($scope.sortList.items, function (value, index) { value.selected = index == 0; }) $scope.labelKeys = ''; //重新加载全部企业 /*$scope.showLoadingToast(); $scope.repeatLoadAll(); $scope.repeatLoad();*/ $scope.selectBySort(0); // $scope.filterList.key=''; // $scope.currentnode=UserService.node; // if ($scope.act == 'task') { // if(!$scope.islogin){ // }else{ // //TODO // getMyData(0).then(function(data){ // $scope.reportCompanyList=data; // }) // } // } else if ($scope.act == 'mytask') { // getData(1).then(function(data){ // $scope.reportCompanyList=data; // }); // } } $scope.submitSelected = function () { console.log($scope.MoreData) console.log($scope.filterList) console.log($scope.selectif) if ($scope.selectif != 6 && $scope.node == '330122000' && $scope.privateName == '企业库') { $scope.filterList[2].items.forEach((res) => { res.selected = false }) $scope.capacityparams = '0' } $scope.labelKeys = ''; angular.forEach($scope.filterList, function (val) { angular.forEach(val.items, function (value) { if (value.selected && value.labelName != '全部' && val.title != '潜力库') { $scope.labelKeys += value.labelKey + ','; } }) }); console.log($scope.labelKeys) //重新加载全部企业 $scope.showLoadingToast(); $scope.repeatLoadAll(); $scope.repeatLoad(); if ($scope.node == '330122000') { $scope.filtertlPageModaltl.hide(); } else { $scope.filterPageModal.hide(); } } //桐庐筛选重置 $scope.resetSelectedtl = function () { if ($scope.selectif == 5 || $scope.selectif == 6) { $scope.MoreData.forEach(function (res) { res.ifshow = false res.content1 = "" res.content2 = "" if (res.choicetype == "dropdown/number" || res.choicetype == "number1") { res.content3 = "请选择" } else { res.content3 = "" } }) } if ($scope.selectif < 5) { $scope.selectindex.items.forEach((res, index) => { if (res.labelName == '全部') { res.selected = true } else { res.selected = false } }) } if ($scope.selectif == 6) { angular.forEach($scope.filterList, function (val) { if (val.title != '潜力库') { // val.items.forEach((res) => { // if (res.labelName == '全部') { // res.selected = true // } else { // res.selected = false // } // }) } }); $scope.labelKeys = '0' } } //选择框回调 $scope.handletypes = function (item, index) { $scope.MoreData[index].content3 = item } $scope.optclcick = function (item) { } //处理数据 function Traverse() { console.log($scope.MoreData) let data = {} if (!$scope.MoreData) { return 0 } $scope.MoreData.forEach((res) => { if ((res.content3 != '请选择' && res.content1 && res.content2 && res.content3) || (res.propertytoes == "highidentificationdate" && res.content3 != '请选择' && res.content3)) { data[res.propertytoes] = res.content3 + "" } if (res.content1 && res.content2) { if (!res.content3) { data[res.propertytoes] = res.content1 } else { data[res.propertytoes] += "," + res.content1 } data[res.propertytoes] += "," + res.content2 } if (res.choicetype == 'text') { data[res.propertytoes] = res.content1 } if (res.ifshow) { data[res.propertytoes] = res.value } if (res.choicetype == 'dropdown') { res.items.forEach((optres) => { if (optres.content1) { if (data[res.propertytoes]) { data[res.propertytoes] += "," + optres.value } else { data[res.propertytoes] = optres.value } } }) } }) if (Object.keys(data).length == 0) { return 0 } else { return data } } if ($stateParams.MoreData) { console.log($stateParams.MoreData) $scope.MoreData = $stateParams.MoreData } else { ResourceLibraryService.getMorefilters($stateParams.restype).then(function (res) { console.log(res) if (res.code == 3350) { $scope.MoreData = res.data $scope.MoreData.forEach(function (res) { res.ifshow = false if (res.choicetype == "dropdown/number" || res.choicetype == "number1") { res.content3 = "请选择" } }) console.log($scope.MoreData) } }) } //筛选 $scope.selectclick = function (item, index) { console.log(index) $scope.selectindex = item $scope.filtertlPageModaltl.show(); $scope.selectif = index } var myDate = new Date(); var startYear = 2018;//起始年份 var endYear = myDate.getFullYear();//结束年份 $scope.Datedata = ["请选择"] for (var i = startYear; i < endYear; i++) { $scope.Datedata.push(i) } $scope.selectByLabeltl = function (item, outerIndex, index) { $scope.selectindex.items.forEach((res) => { if (item.labelName == '全部') { res.selected = false } else { if (res.labelName == '全部') { res.selected = false } } }) item.selected = !item.selected } $scope.selectByLabel = function (item, outerIndex, index) { $scope.flag = true; $scope.contentlist[chooseIndex].reslist = []; $scope.allcontentlist[chooseIndex].reslist = []; $scope.changSelected(item, outerIndex, index); if (!$scope.showExportFlag) { $scope.showExportResourceClick(); } else { $scope.submitSelected(); } } $scope.changSelectedSort = function (index) { angular.forEach($scope.sortList.items, function (val) { val.selected = false; }) $scope.sortList.items[index].selected = true; } // $scope.changSelectedList = function (index) { // angular.forEach($scope.typeList, function (val) { // val.selected = false; // }) // $scope.typeList[index].selected = true; // } // $scope.changSelectedTaskType = function (index) { // angular.forEach($scope.taskTypeList.items, function (val) { // val.selected = false; // }) // $scope.taskTypeList.items[index].selected = true; // // } $scope.selectdive = function (item, index,type) { console.log(item) $scope.filterList.forEach((res1,index1)=>{ if(type){ if (index != index1) { res1.items.forEach((res2, index2) => { res2.selected = false }) } }else { res1.items.forEach((res2, index2) => { if (index != index2||res1.title!='潜力库') { res2.selected = false } }) } }) item.selected = !item.selected if (item.selected) { $scope.capacityparams = item.labelKey } else { $scope.capacityparams = '0' } $scope.selectif = 6 $scope.resetSelectedtl() $scope.submitSelected() console.log( $scope.filterList) } $scope.selectBySort = function (index) { $scope.contentlist[chooseIndex].reslist = []; $scope.allcontentlist[chooseIndex].reslist = []; checkedsort = $scope.sortList.items[index].labelKey; $scope.changSelectedSort(index); $scope.submitSelected(); } // $scope.selectByList = function (index) { // $scope.contentlist[chooseIndex].reslist = []; // $scope.allcontentlist[chooseIndex].reslist = []; // $scope.changSelectedList(index); // $scope.submitSelected(); // } // $scope.selectByTaskType = function (index) { // $scope.contentlist[chooseIndex].reslist = []; // $scope.allcontentlist[chooseIndex].reslist = []; // checkedsort = $scope.taskTypeList.items[index].labelKey; // $scope.changSelectedTaskType(index); // $scope.submitSelected(); // } // 设置置顶 $scope.changeStickTop = function (type, resid) { console.log(resid); if (type) { ResourceLibraryService.cancelStickTop(resid).then(function (res) { console.log(res); if (res.code == 3350) { $scope.contentlist[chooseIndex].reslist = []; $scope.allcontentlist[chooseIndex].reslist = []; $scope.submitSelected(); } }) } else { ResourceLibraryService.stickTop(resid).then(function (res) { console.log(res); if (res.code == 3350) { $scope.contentlist[chooseIndex].reslist = []; $scope.allcontentlist[chooseIndex].reslist = []; $scope.submitSelected(); } }) } } $scope.goNewNotification = function () { $scope.go("notification"); } }) ;