resourceLibrarySendMessageCtrl.js 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. angular.module('push')
  2. .controller('resourceLibrarySendMessageCtrl', function ($q, $scope, $ionicActionSheet, $ionicSlideBoxDelegate, ResourceLibraryService, $stateParams, $timeout, $ionicScrollDelegate,
  3. UtilService, $ionicPopup, resourceLibraryTempData, $ionicListDelegate, AuthorityService,
  4. UserService, taskModuleService, ConfigService, ActivityService, ConstantService, dataToolsService, CommonService, $ionicModal, $ionicHistory) {
  5. //TODO
  6. if ($scope.app) {
  7. $scope.setStatusBar(1);
  8. }
  9. //是否全选
  10. $scope.isChoiceAll = false;
  11. $scope.isWeb = !$scope.isapp;
  12. $scope.labelKeys = '';
  13. // $scope.comfromWeb=sessionStorage.comfrom=='web';
  14. // sessionStorage.comfrom='';
  15. console.log($stateParams);
  16. $scope.libtype = $stateParams.libtype;
  17. var category = $stateParams.category;
  18. $scope.authority = false;
  19. $scope.authority = $stateParams.authority == 'true';
  20. if ($stateParams.libtype == 3 || $stateParams.libtype == 30 || $stateParams.libtype == 31 || $stateParams.libtype == 32 || $stateParams.libtype == 33 || $stateParams.libtype == 34) {
  21. $scope.canDelete = $stateParams.authority == 'true';
  22. }
  23. $scope.hasAuth = false;
  24. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  25. $scope.hasAuth = res.data;
  26. })
  27. taskModuleService.thisUserIsAdmin().then(function (res) {
  28. if (res.code == 3350) {
  29. $scope.isAdmin = res.data;
  30. }
  31. })
  32. //加载等待页
  33. $scope.isloadingPageFloor = false;
  34. //全部企业加载失败页
  35. $scope.isloadingPageFailAll = false;
  36. //我的企业加载失败页
  37. $scope.isloadingPageFail = false;
  38. console.log($stateParams);
  39. //1:需求,2:成果,6:企业,8:人才
  40. var reclib = angular.fromJson($stateParams.reclib);
  41. //TODO
  42. $scope.reclibid = reclib.parentid;// 资源库文件夹id
  43. $scope.moduleid = reclib.moduleid;// 资源库类别
  44. var pagenum = $scope.pagenum = 0;// 索引库分页索引值,默认第一页:0
  45. var userid = $scope.userid = UserService.id;//查询时需的用户id
  46. var modlibid = $scope.modlibid = $stateParams.modlibid;
  47. var libtype = $scope.libtype = $stateParams.libtype;
  48. $scope.keyfilter = {
  49. key: ""// 搜索关键词
  50. }
  51. $scope.name = reclib.name;
  52. // console.log(reclib.parentid,reclib.moduleid,$scope.modlibid,$scope.libtype,$scope.name);
  53. // 需求库名称
  54. $scope.privateName = $stateParams.privateName;
  55. // 我的XX/全部XX XX→需求、成果
  56. $scope.privateContent = $stateParams.privateContent;
  57. var checkedresource = {};//单个分享时选中的资源
  58. var checkedindex = -1;//多个分享时第一个选择的索引
  59. $scope.checkedresourcelist = [];//多个分享时选中的资源
  60. $scope.tabs = [];
  61. var chooseIndex = resourceLibraryTempData.getCategoryIndex();//当前频道索引
  62. $scope.index = chooseIndex;
  63. $scope.checked = resourceLibraryTempData.getChecked();
  64. $scope.checked.classificationType = libtype;
  65. //通过浏览器地址栏里面的参数来获取moduleid和restype
  66. var href = window.location.href;
  67. var splitArr = href.split('privateResource');
  68. if (splitArr.length >= 2) {
  69. //重写返回功能
  70. $scope.goback = function () {
  71. $scope.go("tab.resourceLibrary");
  72. }
  73. var split = splitArr[1].split('/');
  74. if (split.length >= 2) {
  75. $scope.reclibid = split[1];
  76. $scope.moduleid = split[2];
  77. if ($scope.moduleid == "0") {
  78. $scope.privateName = '科创联盟入驻企业库';
  79. }
  80. if ($scope.moduleid == "1") {
  81. $scope.privateName = '需求库';
  82. }
  83. if ($scope.moduleid == "2") {
  84. $scope.privateName = '成果库';
  85. }
  86. if ($scope.moduleid == "3") {
  87. $scope.privateName = '政策库';
  88. }
  89. if ($scope.moduleid == "6") {
  90. $scope.privateName = '企业库';
  91. }
  92. if ($scope.moduleid == "7") {
  93. $scope.privateName = '高校库';
  94. }
  95. if ($scope.moduleid == "8") {
  96. $scope.privateName = '人才库';
  97. }
  98. if ($scope.moduleid == "35") {
  99. $scope.privateName = '技术经纪人库';
  100. }
  101. if ($scope.moduleid == "36") {
  102. $scope.privateName = '产学研备案库库';
  103. }
  104. if ($scope.moduleid == "43") {
  105. $scope.privateName = '武进区科技创新创业联盟库';
  106. }
  107. if ($scope.moduleid == "44") {
  108. $scope.privateName = '创新创业联盟导师库';
  109. }
  110. $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 1);
  111. }
  112. }
  113. if ($scope.reclibid != undefined && $scope.moduleid != undefined) {
  114. sessionStorage.reclibid = $scope.reclibid.toString();
  115. sessionStorage.moduleid = $scope.moduleid;
  116. }
  117. if ($scope.privateName == null || $scope.privateName == undefined || $scope.privateName == "") {
  118. if (sessionStorage.moduleid == "0") {
  119. $scope.privateName = '科创联盟入驻企业库';
  120. }
  121. if (sessionStorage.moduleid == "1") {
  122. $scope.privateName = '需求库';
  123. }
  124. if (sessionStorage.moduleid == "2") {
  125. $scope.privateName = '成果库';
  126. }
  127. if (sessionStorage.moduleid == "3") {
  128. $scope.privateName = '政策库';
  129. }
  130. if (sessionStorage.moduleid == "6") {
  131. $scope.privateName = '企业库';
  132. }
  133. if (sessionStorage.moduleid == "7") {
  134. $scope.privateName = '高校库';
  135. }
  136. if (sessionStorage.moduleid == "8") {
  137. $scope.privateName = '人才库';
  138. }
  139. if (sessionStorage.moduleid == "35") {
  140. $scope.privateName = '技术经纪人库';
  141. }
  142. if (sessionStorage.moduleid == "36") {
  143. $scope.privateName = '产学研备案库库';
  144. }
  145. if (sessionStorage.moduleid == "43") {
  146. $scope.privateName = '武进区科技创新创业联盟库';
  147. }
  148. if (sessionStorage.moduleid == "44") {
  149. $scope.privateName = '创新创业联盟导师库';
  150. }
  151. $scope.privateContent = $scope.privateName.substring(0, $scope.privateName.length - 1);
  152. }
  153. // 我的企业-分页
  154. $scope.mypages = {
  155. allFlag: true,
  156. currentPage: 0,
  157. pageSize: 4,
  158. totalPage: 0,
  159. totalCount: 0,
  160. startIndex: 0,
  161. sortKeys: ""
  162. };
  163. // 所有企业-分页
  164. $scope.allpages = {
  165. allFlag: true,
  166. currentPage: 0,
  167. pageSize: 4,
  168. totalPage: 0,
  169. totalCount: 0,
  170. startIndex: 0,
  171. sortKeys: ""
  172. };
  173. $scope.keyfilter = {key: ""};//搜索关键词
  174. var activity = ['task', 'mytask'];
  175. $scope.act = activity[1];//默认选择全部资源
  176. $scope.changeAct = function (num) {
  177. $scope.islogin = ConfigService.islogin;
  178. $scope.act = activity[num];
  179. if (num == 0) {
  180. if (!$scope.islogin) {
  181. if (localStorage.wxFlag == "true") {
  182. if (localStorage.isUserFocusXW == 0) {
  183. var title = localStorage.appidStr;
  184. $ionicPopup.alert({
  185. title: '提示',
  186. template: '请先关注微信公众号"' + title + '"!'
  187. });
  188. return;
  189. } else {
  190. if (localStorage.isUserBindWx == 0) {
  191. var wxFlag = JSON.parse(localStorage.params);
  192. if (wxFlag.weChatModel) {
  193. $scope.go('bindPhone', {
  194. params: localStorage.params,
  195. comfrom: 'maincontroller',
  196. url: window.location.href.split('#/')[1]
  197. });
  198. } else {
  199. $scope.selCom.show();
  200. return;
  201. }
  202. }
  203. }
  204. } else {
  205. $scope.selCom.show();
  206. return;
  207. }
  208. } else {
  209. // 我的企业则userid要传递
  210. $scope.act = activity[num];
  211. //TODO
  212. userid = UserService.id;
  213. // userid = 859;
  214. }
  215. } else if (num == 1) {
  216. $scope.act = activity[num];
  217. userid = 0;
  218. }
  219. };
  220. //虚拟搜索框
  221. $scope.isShowSearchButton = true;
  222. $scope.keyfilter = {key: ""};//搜索关键词
  223. $scope.showSearchButtonLeft = function () {
  224. $scope.isShowSearchButton = false;
  225. $(".showSearchInputForResLibrary").focus();
  226. };
  227. //清空搜索内容
  228. $scope.clearSearch = function () {
  229. $scope.isShowSearchButton = true;
  230. $scope.keyfilter.key = "";
  231. };
  232. //TODO 放开注释
  233. if ($scope.app) {
  234. if (device.platform != "Android") {
  235. $scope.isIos = true;
  236. } else {
  237. $scope.isIos = false;
  238. }
  239. }
  240. /*{
  241. SortType: 0,
  242. classificationType: libtype,
  243. starType: 0,
  244. MaturityType: 0,
  245. RightType: 0,
  246. ModelType: 0,
  247. BudgetType: 0,
  248. ScaleType: 0,
  249. EnterpriseType: 0,
  250. DegreeType: 0,
  251. sexType: 0,
  252. TitleType: 0
  253. }*/
  254. //排序初始化
  255. // $scope.sorts = [
  256. // {name: "热门", type: 0, value: "visitcount,DESC"},
  257. // {name: "最新", type: 1, value: "timestamp,DESC"},
  258. // {name: "综合", type: 2, value: "compositescore,DESC"}
  259. // ];
  260. // var checkedsort = $scope.sorts[0].value;
  261. //分类初始化
  262. /*$scope.classification = [
  263. {name: "不限", type: 0},
  264. {name: "成果", type: 2},
  265. {name: "需求", type: 1},
  266. {name: "企业", type: 6},
  267. {name: "人才", type: 8}
  268. ];
  269. //地区初始化
  270. $scope.checkedlocationtype = 1;
  271. $scope.chooeslocation = [
  272. {name: "不限"},
  273. {name: "常州"},
  274. {name: "定位"}
  275. ];*/
  276. if (libtype == 2) {
  277. //成熟度初始化
  278. $scope.chooesMaturity = [
  279. {name: "不限", type: 0},
  280. {name: "正在研发", type: 1},
  281. {name: "已有小样", type: 2},
  282. {name: "通过小试", type: 3},
  283. {name: "通过中试", type: 4},
  284. {name: "可以量产", type: 5}
  285. ];
  286. //知识产权初始化
  287. $scope.chooesRight = [
  288. {name: "不限", type: 0},
  289. {name: "有", type: 1},
  290. {name: "无", type: 2}
  291. ];
  292. //合作模式初始化
  293. $scope.chooesModel = [
  294. {name: "不限", type: 0},
  295. {name: "委托开发", type: 1},
  296. {name: "合作研发", type: 2},
  297. {name: "成果转让", type: 3},
  298. {name: "技术入股", type: 4},
  299. {name: "技术咨询", type: 5},
  300. {name: "其他", type: 6}
  301. ];
  302. } else if (libtype == 1) {
  303. //合作模式初始化
  304. $scope.chooesModel = [
  305. {name: "不限", type: 0},
  306. {name: "委托开发", type: 1},
  307. {name: "合作研发", type: 2},
  308. {name: "成果转让", type: 3},
  309. {name: "技术入股", type: 4},
  310. {name: "技术咨询", type: 5},
  311. {name: "其他", type: 6}
  312. ];
  313. //投入预算
  314. $scope.inputBudget = [
  315. {name: "不限", type: 0},
  316. {name: "1000万以上", type: 9},
  317. {name: "500万-1000万", type: 8},
  318. {name: "200万-500万", type: 7},
  319. {name: "100万-200万", type: 6},
  320. {name: "50万-100万", type: 5},
  321. {name: "10万-50万", type: 4},
  322. {name: "10万以下", type: 3},
  323. {name: "面议", type: 2}
  324. ]
  325. } else if (libtype == 6) {
  326. //企业规模
  327. $scope.enterpriseScale = [
  328. {name: "不限", type: 0},
  329. {name: "少于50人", type: 1},
  330. {name: "50-150人", type: 2},
  331. {name: "150-500人", type: 3},
  332. {name: "500-1000人", type: 4},
  333. {name: "1000-5000人", type: 5},
  334. {name: "5000-10000人", type: 6},
  335. {name: "10000人以上", type: 7}
  336. ];
  337. //企业类型
  338. $scope.enterpriseType = [
  339. {name: "不限", type: 0},
  340. {name: "国有企业", type: 1},
  341. {name: "集体所有制企业", type: 2},
  342. {name: "私营企业", type: 3},
  343. {name: "股份制企业", type: 4},
  344. {name: "联营企业", type: 5},
  345. {name: "外商投资企业", type: 6},
  346. {name: "港澳台企业", type: 7},
  347. {name: "股份合作企业", type: 8}
  348. ];
  349. $scope.starType = [
  350. {name: "不限", type: 0},
  351. {name: "是", type: 1},
  352. {name: "否", type: 2}
  353. ];
  354. } else if (libtype == 8) {
  355. //学位
  356. $scope.academicDegree = [
  357. {name: "不限", type: 0},
  358. {name: "博士后", type: 7},
  359. {name: "博士", type: 6},
  360. {name: "硕士", type: 5},
  361. {name: "学士", type: 4},
  362. {name: "其他", type: 8}
  363. ];
  364. $scope.sexType = [
  365. {name: "不限", type: 0},
  366. {name: "男", type: 1},
  367. {name: "女", type: 2}
  368. ];
  369. //职称
  370. $scope.occupationalTitle = [
  371. {name: "不限", type: 0},
  372. {name: "正高", type: 1},
  373. {name: "副高", type: 2},
  374. {name: "中级", type: 3},
  375. {name: "副级", type: 4},
  376. {name: "无", type: 5}
  377. ];
  378. } else if (libtype == 7) {
  379. //学校类别
  380. $scope.universitytype = [
  381. {name: "不限", type: 0},
  382. {name: "985工程院校暨211工程院校", type: 600},
  383. {name: "985工程院校", type: 601},
  384. {name: "211工程院校", type: 602},
  385. {name: "普通本科院校", type: 604},
  386. {name: "高职专科院校", type: 606}
  387. ];
  388. }
  389. // 我的企业
  390. $scope.contentlist = [];
  391. // 全部企业
  392. $scope.allcontentlist = [];
  393. // 获取排序选项列表
  394. var checkedsort = '';
  395. var getResourceSortList = function () {
  396. var deferred = $q.defer();
  397. ResourceLibraryService.getResourceSortList(libtype).then(function (res) {
  398. console.log(res);
  399. if (res.code == 3350) {
  400. $scope.sortList = res.data[0];
  401. angular.forEach($scope.sortList.items, function (val, index) {
  402. val.selected = index == 0;
  403. })
  404. checkedsort = $scope.sortList.items.length > 0 ? $scope.sortList.items[0].labelKey : 'timestamp,desc';
  405. deferred.resolve('sucess');
  406. }
  407. })
  408. return deferred.promise;
  409. };
  410. // 获取资源库下行业分类列表
  411. var getCategoryList = function () {
  412. /*ResourceLibraryService.getCategoryList(1001, reclibid, modlibid).then(function (response) {
  413. // console.log(response);
  414. $scope.categorylist = [{
  415. appModuleName: "全部",
  416. by1: ""
  417. }];
  418. $scope.categorylist = $scope.categorylist.concat(response.channelList);
  419. angular.forEach($scope.categorylist, function (value, index) {
  420. $scope.contentlist.push({isload: false, currentPage: 1, reslist: []});
  421. });
  422. $timeout(function () {
  423. $ionicSlideBoxDelegate.slide(chooseIndex);
  424. $scope.getPrivateResourceList();
  425. }, 100);
  426. }, function () {
  427. UtilService.showMess("网络不给力,请重试");
  428. })*/
  429. // 获取资源列表-全部企业
  430. getResourceSortList().then(function (res) {
  431. $scope.getAllPrivateResourceList(0);
  432. })
  433. };
  434. //获取资源列表-全部企业
  435. $scope.getAllPrivateResourceList = function (id) {
  436. $scope.isloadingPageFloor = true;
  437. // $scope.showLoadingToast();
  438. console.log(id);
  439. ResourceLibraryService.getFirstResourceListForAll(sessionStorage.moduleid, sessionStorage.reclibid, $scope.pagenum, $scope.keyfilter.key, checkedsort, id, 0, category, $scope.labelKeys).then(function (response) {
  440. console.log(response);
  441. $scope.hideLoadingToast();
  442. $scope.resourceLength = response.data == null ? 0 : response.data.length;
  443. if ($stateParams.libtype == 30) {
  444. angular.forEach(response.data, function (res) {
  445. if (!res.title) {
  446. dataToolsService.getWebCascade(res.type, 0).then(function (resp) {
  447. if (resp.code == 3350 && resp.data.length > 0) {
  448. var temp = resp.data.filter(function (val) {
  449. return val.code == res.primTag;
  450. })
  451. if (temp.length > 0) {
  452. res.title = temp[0].name;
  453. }
  454. }
  455. }, function () {
  456. })
  457. }
  458. })
  459. }
  460. var tempreslib = angular.fromJson(response.data);
  461. angular.forEach(tempreslib, function (val) {
  462. if (val.labelObj) {
  463. val.labelObj = val.labelObj.slice(0, 3);
  464. // angular.forEach(val.otherObj,function(vv){
  465. // vv.labelName=vv.labelKey=='企业规模'?vv.labelKey+vv.labelName:vv.labelName=='是'?vv.labelKey.slice(2):vv.labelName;
  466. // })
  467. }
  468. })
  469. $scope.allpages = angular.fromJson(response.page);
  470. // console.log(tempreslib);
  471. var temppage = angular.fromJson(response.page);
  472. var totalPage = Math.ceil(temppage == null ? 0 : temppage.totalCount / 4);
  473. console.log(totalPage);
  474. $scope.allcontentlist[chooseIndex].reslist = tempreslib;
  475. var trHtml = "<div class='refresh_tip_div'>更新了" + $scope.allcontentlist[chooseIndex].reslist == null ? 0 : ($scope.allcontentlist[chooseIndex].reslist.length == null ? 0 : $scope.allcontentlist[chooseIndex].reslist.length) + "条内容</div>";
  476. $timeout(function () {
  477. $(".resourcelistDiv .list").prepend(trHtml);
  478. $(".refresh_tip_div").animate({width: 100 + "%"}, 150);
  479. }, 800);
  480. $timeout(function () {
  481. $(".refresh_tip_div").slideUp();
  482. }, 1200);
  483. //判断是否有下一页
  484. $timeout(function () {
  485. $timeout(function () {
  486. if ($scope.allcontentlist[chooseIndex].currentPage >= totalPage) {
  487. $scope.allcontentlist[chooseIndex].isload = false;
  488. } else {
  489. $scope.allcontentlist[chooseIndex].isload = true;
  490. }
  491. $scope.allcontentlist[chooseIndex].currentPage = 1;
  492. }, 0);
  493. $scope.hideLoadingToast();
  494. $ionicSlideBoxDelegate.update();
  495. $ionicScrollDelegate.$getByHandle("privateContent").scrollTo(0, 0);
  496. }, 50);
  497. $scope.isloadingPageFloor = false;
  498. $scope.isloadingPageFail = false;
  499. $scope.isloadingPageFailAll = false;
  500. }, function () {
  501. $scope.hideLoadingToast();
  502. $scope.isloadingPageFloor = false;
  503. $scope.isloadingPageFail = false;
  504. $scope.isloadingPageFailAll = true;
  505. }).finally(function () {
  506. $scope.$broadcast('scroll.refreshComplete');
  507. });
  508. };
  509. //重新加载全部企业
  510. $scope.repeatLoadAll = function () {
  511. $scope.isloadingPageFailAll = false;
  512. $scope.getAllPrivateResourceList(0);
  513. };
  514. getCategoryList();
  515. $scope.islogin = ConfigService.islogin;
  516. // 进入资源详情
  517. $scope.goResourceDetail = function (resource, ind) {
  518. console.log(resource);
  519. console.log($stateParams.libtype);
  520. if (!$scope.islogin && ($stateParams.libtype != 30 && $stateParams.libtype != 31 && $stateParams.libtype != 32 && $stateParams.libtype != 33 && $stateParams.libtype != 34)) {
  521. if (localStorage.wxFlag == "true") {
  522. if (localStorage.isUserFocusXW == 0) {
  523. var title = localStorage.appidStr;
  524. $ionicPopup.alert({
  525. title: '提示',
  526. template: '请先关注微信公众号"' + title + '"!'
  527. });
  528. return;
  529. } else {
  530. if (localStorage.isUserBindWx == 0) {
  531. var wxFlag = JSON.parse(localStorage.params);
  532. if (wxFlag.weChatModel) {
  533. $scope.go('bindPhone', {
  534. params: localStorage.params,
  535. comfrom: 'maincontroller',
  536. url: window.location.href.split('#/')[1]
  537. });
  538. } else {
  539. $scope.selCom.show();
  540. return;
  541. }
  542. }
  543. }
  544. } else {
  545. $scope.selCom.show();
  546. return;
  547. }
  548. } else {
  549. if (selectflg) {
  550. selectResource(resource, ind);
  551. } else {
  552. resourceLibraryTempData.setCategoryIndex(chooseIndex);
  553. resourceLibraryTempData.setChecked($scope.checked);
  554. if (resource.groupid == "0") {
  555. $scope.go('resourceDetails', {
  556. recourceid: resource.unique,
  557. recourcetype: resource.type,
  558. recourcecomefrom: resource.source,
  559. title: resource.title
  560. });
  561. } else {
  562. $scope.go('resourceCommonDetailsPage', {
  563. recourceid: resource.unique,
  564. recourcetype: resource.type,
  565. recourcecomefrom: resource.source,
  566. creator: resource.clickthrough,
  567. title: resource.title,
  568. orgtype: 0,
  569. // comfrom:$scope.comfrom,
  570. pagecode: 0,
  571. label: JSON.stringify(resource.otherObj)
  572. });
  573. }
  574. }
  575. }
  576. };
  577. var editSlide = function (index) {
  578. var tablength = $scope.categorylist.length;//标题个数
  579. var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般
  580. var OffLeft = $(".Chanel_scroll_a").eq(index).offset().left;//获取当前点击标题距离父容器左边框的距离
  581. var SelfWidth = $(".Chanel_scroll_a").eq(index).width();//获取当前点击标题宽度
  582. var startTranform = $("#p_Chanel .scroll").offset().left;
  583. var movewidth = OffLeft - middlewidth + SelfWidth / 2;
  584. startTranform -= movewidth;
  585. if (startTranform <= 0) {
  586. if (index < tablength - 2) {
  587. $('#p_Chanel .scroll').css({
  588. 'transform': 'translate3d(' + startTranform + 'px,0,0)'
  589. });
  590. }
  591. } else if (index < 4) {
  592. $('#p_Chanel .scroll').css({
  593. 'transform': 'translate3d(0,0,0)'
  594. });
  595. }
  596. $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  597. };
  598. $scope.selectCategory = function (index) {
  599. editSlide(index);
  600. $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  601. if (index == chooseIndex) {
  602. return;
  603. }
  604. chooseIndex = index;
  605. $scope.index = chooseIndex;
  606. $scope.getPrivateResourceList(0);
  607. };
  608. //资源库搜索
  609. $scope.goResourceSearch = function () {
  610. resourceLibraryTempData.setCategoryIndex(chooseIndex);
  611. resourceLibraryTempData.setChecked($scope.checked);
  612. //1:需求,2:成果,6:企业,8:人才
  613. var tabindex = 3;
  614. if (libtype == 1) {
  615. tabindex = 4;
  616. } else if (libtype == 2) {
  617. tabindex = 3;
  618. } else if (libtype == 6) {
  619. tabindex = 5;
  620. } else if (libtype == 8) {
  621. tabindex = 6;
  622. }
  623. $timeout(function () {
  624. $scope.go('resourceSearch', {resourcetype: 1001, reclibid: $scope.reclibid, tabindex: tabindex});
  625. }, 350);
  626. };
  627. $scope.shareflg = false;
  628. $scope.openShare = function (tempobj, ind) {
  629. $scope.go('chooseShareResource', {
  630. chereslist: angular.toJson([tempobj.unique]),
  631. folderid: $scope.reclibid,
  632. isCloud: 1,
  633. recourcetype: tempobj.type,
  634. recourcecomefrom: tempobj.source
  635. });
  636. /*$scope.shareflg = true;
  637. $(".resource_wrap").css("left", "0%");
  638. $(".pay_list_c2").css("left", "-35px");
  639. $("#collect-bottom").css("display", "none");
  640. checkedresource = tempobj;
  641. checkedindex = ind;*/
  642. };
  643. $scope.closeShare = function () {
  644. $timeout(function () {
  645. $ionicListDelegate.closeOptionButtons();
  646. }, 10);
  647. $scope.shareflg = false;
  648. };
  649. //选择排序
  650. $scope.chooseSort = function (b) {
  651. $scope.checked.SortType = b.type;
  652. checkedsort = b.value;
  653. };
  654. //选择分类
  655. /*$scope.chooseClassification = function (tempclass) {
  656. $scope.checked.classificationType = tempclass.type;
  657. };*/
  658. //地区
  659. /*$scope.chooseActionlocation = function (index) {
  660. $(".locationclassfile ul li").eq(index).addClass("specialSpan").siblings().removeClass("specialSpan");
  661. if (index != 0) {
  662. $(".locationclassfile ul li:first-child").css({"color": "#000", "border": "none"});
  663. } else {
  664. $(".locationclassfile ul li:first-child").css({"color": "#3385ff", "border": "#3385ff .5px solid"});
  665. $(".locationclassfile ul li").removeClass("specialSpan");
  666. }
  667. };*/
  668. //选择成熟度
  669. $scope.chooseActionMaturity = function (s) {
  670. $scope.checked.MaturityType = s.type;
  671. };
  672. //选择知识产产权
  673. $scope.chooseActionRight = function (r) {
  674. $scope.checked.RightType = r.type;
  675. };
  676. //选择合作模式
  677. $scope.chooseActionModel = function (m) {
  678. $scope.checked.ModelType = m.type;
  679. };
  680. //选择投入预算
  681. $scope.chooseInputBudget = function (budget) {
  682. $scope.checked.BudgetType = budget.type;
  683. };
  684. //选择企业规模
  685. $scope.chooseEenterpriseScale = function (scale) {
  686. $scope.checked.ScaleType = scale.type;
  687. };
  688. //高企
  689. $scope.chooseStarType = function (star) {
  690. $scope.checked.starType = star.type;
  691. };
  692. //选择企业类型
  693. $scope.chooseEnterpriseType = function (enterprise) {
  694. $scope.checked.EnterpriseType = enterprise.type;
  695. };
  696. //选择学位
  697. $scope.chooseAcademicDegree = function (degree) {
  698. $scope.checked.DegreeType = degree.type;
  699. };
  700. //性别
  701. $scope.chooseSexType = function (sex) {
  702. $scope.checked.sexType = sex.type;
  703. };
  704. //选择职称
  705. $scope.chooseOccupationalTitle = function (title) {
  706. $scope.checked.TitleType = title.type;
  707. };
  708. //选择学校类别
  709. $scope.chooseUniversityType = function (university) {
  710. $scope.checked.UniversityType = university.type;
  711. };
  712. //展开/收起排序
  713. $scope.toggleSort = function () {
  714. $(".sort ul").toggle();
  715. $(".sort h3 i").toggleClass("transformArrow");
  716. };
  717. //展开/收起分类
  718. /*$scope.toggleClassification = function () {
  719. $(".Classification ul").toggle();
  720. $(".Classification h3 i").toggleClass("transformArrow");
  721. };
  722. //展开/收起地区
  723. $scope.toggleClassfilelocation = function () {
  724. $(".locationclassfile ul").toggle();
  725. $(".locationclassfile h3 i").toggleClass("transformArrow");
  726. };*/
  727. //展开/收起成熟度
  728. $scope.toggleClassfileMaturity = function () {
  729. $(".Maturityclassfile ul").toggle();
  730. $(".Maturityclassfile h3 i").toggleClass("transformArrow");
  731. };
  732. //展开/收起知识产权
  733. $scope.toggleClassfileRight = function () {
  734. $(".Rightclassfile ul").toggle();
  735. $(".Rightclassfile h3 i").toggleClass("transformArrow");
  736. };
  737. //展开/收起合作模式
  738. $scope.toggleClassfileModel = function () {
  739. $(".Modelclassfile ul").toggle();
  740. $(".Modelclassfile h3 i").toggleClass("transformArrow");
  741. };
  742. //展开/收起投入预算
  743. $scope.toggleInputBudget = function () {
  744. $(".InputBudget ul").toggle();
  745. $(".InputBudget h3 i").toggleClass("transformArrow");
  746. };
  747. //展开/收起企业规模
  748. $scope.toggleEenterpriseScale = function () {
  749. $(".EenterpriseScale ul").toggle();
  750. $(".EenterpriseScale h3 i").toggleClass("transformArrow");
  751. };
  752. //展开/收起高企
  753. $scope.toggleStarType = function () {
  754. $(".StarType ul").toggle();
  755. $(".StarType h3 i").toggleClass("transformArrow");
  756. };
  757. //展开/收起企业类型
  758. $scope.toggleEnterpriseType = function () {
  759. $(".EnterpriseType ul").toggle();
  760. $(".EnterpriseType h3 i").toggleClass("transformArrow");
  761. };
  762. //展开/收起学位
  763. $scope.toggleAcademicDegree = function () {
  764. $(".AcademicDegree ul").toggle();
  765. $(".AcademicDegree h3 i").toggleClass("transformArrow");
  766. };
  767. //展开/收起性别
  768. $scope.toggleSexType = function () {
  769. $(".sexType ul").toggle();
  770. $(".sexType h3 i").toggleClass("transformArrow");
  771. };
  772. //展开/收起职称
  773. $scope.toggleOccupationalTitle = function () {
  774. $(".OccupationalTitle ul").toggle();
  775. $(".OccupationalTitle h3 i").toggleClass("transformArrow");
  776. };
  777. //展开/收起学校类别
  778. $scope.toggleUniversityType = function () {
  779. $(".UniversityType ul").toggle();
  780. $(".UniversityType h3 i").toggleClass("transformArrow");
  781. };
  782. $scope.finishShow = false;
  783. //展开筛选
  784. $scope.menueFilter = function () {
  785. $scope.finishShow = true;
  786. };
  787. //完成选择,刷新数据
  788. $scope.finishDone = function () {
  789. $scope.finishShow = false;
  790. // 获取资源列表-全部企业
  791. $scope.getAllPrivateResourceList(0);
  792. // 获取资源列表-我的企业
  793. //TODO
  794. // userid = 859;
  795. $scope.getPrivateResourceList(userid);
  796. };
  797. //重置选择数据
  798. $scope.reseChecked = function () {
  799. $scope.checked = {
  800. SortType: 0,
  801. classificationType: libtype,
  802. starType: 0,
  803. MaturityType: 0,
  804. RightType: 0,
  805. ModelType: 0,
  806. BudgetType: 0,
  807. ScaleType: 0,
  808. EnterpriseType: 0,
  809. DegreeType: 0,
  810. sexType: 0,
  811. TitleType: 0,
  812. UniversityType: 0
  813. };
  814. checkedsort = $scope.sorts[0].value;
  815. };
  816. //点击空白灰色选择条件隐藏
  817. $scope.hideSortDiv = function () {
  818. $scope.finishShow = false;
  819. // 获取资源列表-全部企业
  820. $scope.getAllPrivateResourceList(0);
  821. // 获取资源列表-我的企业
  822. //TODO
  823. // userid = 859;
  824. $scope.getPrivateResourceList(userid);
  825. };
  826. //打开操作表
  827. $scope.openActionSheet = function () {
  828. $ionicActionSheet.show({
  829. buttons: [
  830. {text: '设置'}
  831. ],
  832. cancelText: '取消',
  833. buttonClicked: function (index) {
  834. if (index == 0) {
  835. $scope.go("authoritySet", {
  836. reclibid: reclib.id,
  837. authorityid: reclib.authorityid,
  838. authoritycomefrom: reclib.authoritycomefrom,
  839. name: reclib.name,
  840. content: reclib.content,
  841. sort: reclib.sort,
  842. goflg: 1,
  843. type: 1,
  844. parentid: reclib.parentid
  845. });
  846. }
  847. return true;
  848. }
  849. });
  850. };
  851. //分享选择操作表
  852. var selectflg = false;//列表选择打开标志
  853. $scope.openCollectShare = function () {
  854. selectflg = true;
  855. $scope.contentlist[$scope.index].reslist[checkedindex].value = true;
  856. var tempres = {
  857. infoid: checkedresource.unique,
  858. infocomefrom: checkedresource.source,
  859. infoType: checkedresource.type
  860. };
  861. $scope.checkedresourcelist.push(tempres);
  862. $(".item-options").addClass("invisible");
  863. $(".resource_wrap").css("left", "10%");
  864. $(".pay_list_c2").css("left", "4%");
  865. $(".item-content").css("transform", "translate3d(0px, 0px, 0px)");
  866. $("#collect-bottom").css("display", "block");
  867. $scope.closeShare();
  868. };
  869. //取消分享
  870. $scope.cancelShare = function () {
  871. angular.forEach($scope.contentlist[$scope.index].reslist, function (value, ind) {
  872. $scope.contentlist[$scope.index].reslist[ind].value = false;
  873. });
  874. $scope.checkedresourcelist = [];
  875. $(".resource_wrap").css("left", "0%");
  876. $(".pay_list_c2").css("left", "-35px");
  877. $("#collect-bottom").css("display", "none");
  878. selectflg = false;
  879. };
  880. var selectResource = function (resource, ind) {
  881. var tempres = {
  882. infoid: resource.unique,
  883. infocomefrom: resource.source,
  884. infoType: resource.type
  885. };
  886. var chind = -1;
  887. angular.forEach($scope.checkedresourcelist, function (value, index) {
  888. if (value.infoid == resource.unique) {
  889. chind = index;
  890. }
  891. });
  892. if (chind == -1) {
  893. $scope.contentlist[$scope.index].reslist[ind].value = true;
  894. $scope.checkedresourcelist.unshift(tempres);
  895. } else {
  896. $scope.contentlist[$scope.index].reslist[ind].value = false;
  897. $scope.checkedresourcelist.splice(chind, 1);
  898. }
  899. // console.log($scope.checkedresourcelist);
  900. };
  901. $scope.shareResourceToPrilib = function () {
  902. $scope.go('chooseShareResource', {
  903. chereslist: angular.toJson($scope.checkedresourcelist),
  904. reclibid: $scope.reclibid
  905. });
  906. };
  907. // 搜索各种资源信息
  908. $scope.searchResourceList = function () {
  909. $scope.showLoadingToast();
  910. var activity = ['task', 'mytask'];
  911. if ($scope.act == activity[1]) {
  912. // 获取资源列表-全部企业
  913. $scope.getAllPrivateResourceList(0);
  914. } else if ($scope.act == activity[0]) {
  915. // 获取资源列表-我的企业
  916. $scope.getPrivateResourceList(userid);
  917. }
  918. }, function () {
  919. $scope.hideLoadingToast();
  920. };
  921. //新建走访
  922. $scope.goEnterCompanyInfo = function (moduleid) {
  923. console.log(moduleid);
  924. if (moduleid == 3 || moduleid == 30 || moduleid == 31 || moduleid == 32 || moduleid == 33 || moduleid == 34) {
  925. if (!$scope.islogin) {
  926. if (localStorage.wxFlag == "true") {
  927. if (localStorage.isUserFocusXW == 0) {
  928. var title = localStorage.appidStr;
  929. $ionicPopup.alert({
  930. title: '提示',
  931. template: '请先关注微信公众号"' + title + '"!'
  932. });
  933. return;
  934. } else {
  935. if (localStorage.isUserBindWx == 0) {
  936. var wxFlag = JSON.parse(localStorage.params);
  937. if (wxFlag.weChatModel) {
  938. $scope.go('bindPhone', {
  939. params: localStorage.params,
  940. comfrom: 'maincontroller',
  941. url: window.location.href.split('#/')[1]
  942. });
  943. } else {
  944. $scope.selCom.show();
  945. return;
  946. }
  947. }
  948. }
  949. } else {
  950. $scope.selCom.show();
  951. return;
  952. }
  953. } else {
  954. if (moduleid == 3) {
  955. moduleid = 34;
  956. $stateParams.libtype = 34;
  957. }
  958. if ($stateParams.libtype == 30 || $stateParams.libtype == 31 || $stateParams.libtype == 32 || $stateParams.libtype == 33 || $stateParams.libtype == 34) {
  959. $scope.go('visitModularForm', {
  960. companyid: 0,
  961. pageid: moduleid,
  962. orgtype: moduleid == 6 ? ConstantService.UNITTYPE_10104 : moduleid == 7 ? ConstantService.UNITTYPE_10105 : 0,
  963. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  964. connid: 0,
  965. pagecode: 1000030,
  966. pageTitle: '新建' + $scope.privateName.slice(0, $scope.privateName.length - 1),
  967. node: UserService.node,
  968. comfrom: 'resource'
  969. });
  970. } else {
  971. ResourceLibraryService.getPageId(moduleid).then(function (res) {
  972. if (res.code == 3350) {
  973. $scope.go('visitModularForm', {
  974. companyid: 0,
  975. pageid: res.data,
  976. orgtype: moduleid == 6 || moduleid == 43 ? ConstantService.UNITTYPE_10104 : moduleid == 7 ? ConstantService.UNITTYPE_10105 : 0,
  977. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  978. connid: 0,
  979. pagecode: 1000030,
  980. pageTitle: '新建' + $scope.privateName.slice(0, $scope.privateName.length),
  981. node: UserService.node,
  982. resourcetype: moduleid,
  983. comfrom: 'privateResource'
  984. });
  985. }
  986. })
  987. }
  988. }
  989. }
  990. if (moduleid == 44) {
  991. $scope.go('visitModularForm', {
  992. companyid: 0,
  993. pageid: 44,
  994. orgtype: 10104,
  995. pagecode: 1000027,
  996. isedit: 0,
  997. node: UserService.node,
  998. pageTitle: '新建导师'
  999. });
  1000. }
  1001. if (moduleid == 39) {
  1002. $scope.go('visitModularForm', {
  1003. companyid: 0,
  1004. pageid: 39,
  1005. orgtype: 10104,
  1006. pagecode: 1000036,
  1007. isedit: 0,
  1008. node: UserService.node,
  1009. pageTitle: '新建金融信息',
  1010. innertype: 39
  1011. });
  1012. }
  1013. };
  1014. //假数据、添加星级、评分与评价数
  1015. // *******不能删,加载列表需要用到********
  1016. // 我的企业
  1017. $scope.contentlist = [
  1018. {
  1019. title: '企业A',
  1020. ishigh: 1,
  1021. industry: '化工',
  1022. starNum: 5,
  1023. commentListNum: 222,
  1024. },
  1025. {
  1026. title: '企业A',
  1027. ishigh: 1,
  1028. industry: '化工',
  1029. starNum: 4.5,
  1030. commentListNum: 102
  1031. },
  1032. {
  1033. title: '企业A',
  1034. ishigh: 1,
  1035. industry: '化工',
  1036. starNum: 4,
  1037. commentListNum: 82
  1038. },
  1039. {
  1040. title: '企业B',
  1041. ishigh: 1,
  1042. industry: '化工',
  1043. starNum: 3.5,
  1044. commentListNum: 62
  1045. },
  1046. {
  1047. title: '企业C',
  1048. ishigh: 1,
  1049. industry: '化工',
  1050. starNum: 3,
  1051. commentListNum: 42
  1052. },
  1053. {
  1054. title: '企业D',
  1055. ishigh: 0,
  1056. industry: '化工',
  1057. starNum: 2,
  1058. commentListNum: 32
  1059. },
  1060. {
  1061. title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长',
  1062. ishigh: 0,
  1063. industry: '化工',
  1064. starNum: 1,
  1065. commentListNum: 22
  1066. },
  1067. {
  1068. title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长',
  1069. ishigh: 0,
  1070. industry: '化工',
  1071. starNum: 0,
  1072. commentListNum: 12
  1073. }
  1074. ];
  1075. // 全部企业
  1076. $scope.allcontentlist = [
  1077. {
  1078. title: '企业A',
  1079. ishigh: 1,
  1080. industry: '化工',
  1081. starNum: 5,
  1082. commentListNum: 222,
  1083. },
  1084. {
  1085. title: '企业A',
  1086. ishigh: 1,
  1087. industry: '化工',
  1088. starNum: 4.5,
  1089. commentListNum: 102
  1090. },
  1091. {
  1092. title: '企业A',
  1093. ishigh: 1,
  1094. industry: '化工',
  1095. starNum: 4,
  1096. commentListNum: 82
  1097. },
  1098. {
  1099. title: '企业B',
  1100. ishigh: 1,
  1101. industry: '化工',
  1102. starNum: 3.5,
  1103. commentListNum: 62
  1104. },
  1105. {
  1106. title: '企业C',
  1107. ishigh: 1,
  1108. industry: '化工',
  1109. starNum: 3,
  1110. commentListNum: 42
  1111. },
  1112. {
  1113. title: '企业D',
  1114. ishigh: 0,
  1115. industry: '化工',
  1116. starNum: 2,
  1117. commentListNum: 32
  1118. },
  1119. {
  1120. title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长',
  1121. ishigh: 0,
  1122. industry: '化工',
  1123. starNum: 1,
  1124. commentListNum: 22
  1125. },
  1126. {
  1127. title: '企业的名字好长好长好长好长好长好长好长好长好长好长好长好长好长好长好长',
  1128. ishigh: 0,
  1129. industry: '化工',
  1130. starNum: 0,
  1131. commentListNum: 12
  1132. }
  1133. ]
  1134. $scope.editItem = function () {
  1135. console.log(1);
  1136. }
  1137. $scope.deletItem = function (id, node, idx) {
  1138. console.log(2);
  1139. var data = {
  1140. data: {
  1141. id: id,
  1142. isenabled: 2,
  1143. comfrom: node
  1144. },
  1145. node: node
  1146. }
  1147. // confirm 对话框
  1148. var confirmPopup = $ionicPopup.confirm({
  1149. title: '删除确认',
  1150. template: '请确认是否要删除此项!',
  1151. cancelText: '取消',
  1152. okText: '确认',
  1153. });
  1154. confirmPopup.then(function (res) {
  1155. console.log(res);
  1156. if (res) {
  1157. dataToolsService.saveWebInfo(data).then(function (res) {
  1158. if (res.code == 3350) {
  1159. if ($scope.app) {
  1160. UtilService.showMess('删除成功');
  1161. } else {
  1162. CommonService.showMessage('删除成功', $scope);
  1163. }
  1164. if ($scope.act == activity[1]) {
  1165. // 获取资源列表-全部企业
  1166. $scope.getAllPrivateResourceList(0);
  1167. } else if ($scope.act == activity[0]) {
  1168. // 获取资源列表-我的企业
  1169. $scope.getPrivateResourceList(userid);
  1170. }
  1171. } else {
  1172. if ($scope.app) {
  1173. UtilService.showMess('删除失败');
  1174. } else {
  1175. CommonService.showMessage('删除失败', $scope);
  1176. }
  1177. }
  1178. })
  1179. } else {
  1180. // console.log('You are not sure');
  1181. }
  1182. });
  1183. }
  1184. // 筛选条件页面
  1185. $ionicModal.fromTemplateUrl('./modules/common/views/filterPage.html', {
  1186. scope: $scope,
  1187. animation: 'slide-in-left'
  1188. }).then(function (modal) {
  1189. $scope.filterPageModal = modal;
  1190. });
  1191. $scope.showSideBar = function () {
  1192. $scope.filterPageModal.show();
  1193. }
  1194. $scope.taskTypeList =
  1195. {
  1196. title: '需求类型',
  1197. items: [
  1198. {labelName: '全部', labelKey: 0, selected: true},
  1199. {labelName: '技术需求', labelKey: 5350, selected: false},
  1200. {labelName: '人才需求', labelKey: 5351, selected: false},
  1201. {labelName: '申报科技项目需求', labelKey: 5352, selected: false},
  1202. {labelName: '投融资需求', labelKey: 5353, selected: false},
  1203. {labelName: '其他', labelKey: 5354, selected: false},
  1204. ]
  1205. }
  1206. $scope.filterList = [
  1207. // {
  1208. // title:'区域' ,
  1209. // items:[
  1210. // {labelName:'全部',labelKey:666},
  1211. // {labelName:'南京',labelKey:1},
  1212. // {labelName:'武进',labelKey:2},
  1213. // {labelName:'溧阳',labelKey:3},
  1214. // {labelName:'溧水',labelKey:4},
  1215. // ],
  1216. // },{
  1217. // title:'行业' ,
  1218. // items:[
  1219. // {labelName:'全部',labelKey:88s8},
  1220. // {labelName:'电子',labelKey:1},
  1221. // {labelName:'金融',labelKey:2},
  1222. // {labelName:'软件',labelKey:3},
  1223. // ],
  1224. // },
  1225. ]
  1226. $scope.showFilter = false;
  1227. ResourceLibraryService.getFilterList(sessionStorage.moduleid).then(function (res) {
  1228. console.log(res);
  1229. if (res.code == 3350 && res.data.length > 0) {
  1230. $scope.showFilter = true;
  1231. $scope.filterList = res.data;
  1232. angular.forEach($scope.filterList, function (val) {
  1233. val.items.unshift({labelName: '全部', labelKey: 88888888});
  1234. angular.forEach(val.items, function (value, index) {
  1235. value.selected = index == 0;
  1236. })
  1237. })
  1238. }
  1239. })
  1240. $scope.changSelected = function (outerIndex, index) {
  1241. angular.forEach($scope.filterList[outerIndex].items, function (val) {
  1242. val.selected = false;
  1243. })
  1244. $scope.filterList[outerIndex].items[index].selected = true;
  1245. }
  1246. $scope.resetSelected = function () {
  1247. angular.forEach($scope.filterList, function (val) {
  1248. angular.forEach(val.items, function (value, index) {
  1249. value.selected = index == 0;
  1250. })
  1251. })
  1252. angular.forEach($scope.sortList.items, function (value, index) {
  1253. value.selected = index == 0;
  1254. })
  1255. $scope.labelKeys = '';
  1256. //重新加载全部企业
  1257. /*$scope.showLoadingToast();
  1258. $scope.repeatLoadAll();
  1259. $scope.repeatLoad();*/
  1260. $scope.selectBySort(0);
  1261. // $scope.filterList.key='';
  1262. // $scope.currentnode=UserService.node;
  1263. // if ($scope.act == 'task') {
  1264. // if(!$scope.islogin){
  1265. // }else{
  1266. // //TODO
  1267. // getMyData(0).then(function(data){
  1268. // $scope.reportCompanyList=data;
  1269. // })
  1270. // }
  1271. // } else if ($scope.act == 'mytask') {
  1272. // getData(1).then(function(data){
  1273. // $scope.reportCompanyList=data;
  1274. // });
  1275. // }
  1276. }
  1277. $scope.submitSelected = function () {
  1278. $scope.labelKeys = '';
  1279. angular.forEach($scope.filterList, function (val) {
  1280. angular.forEach(val.items, function (value, index) {
  1281. if (value.selected && value.labelName != '全部') {
  1282. $scope.labelKeys += value.labelKey + ',';
  1283. }
  1284. })
  1285. });
  1286. angular.forEach($scope.orgtypelist.items, function (value) {
  1287. if (value.selected && value.name != '全部') {
  1288. $scope.labelKeys += value.value + ',';
  1289. }
  1290. });
  1291. //重新加载全部企业
  1292. $scope.showLoadingToast();
  1293. $scope.repeatLoadAll();
  1294. $scope.filterPageModal.hide();
  1295. }
  1296. $scope.selectByOrgType = function (index) {
  1297. angular.forEach($scope.orgtypelist.items, function (val) {
  1298. val.selected = false;
  1299. })
  1300. $scope.orgtypelist.items[index].selected = true;
  1301. $scope.submitSelected();
  1302. }
  1303. $scope.selectByJob = function (index) {
  1304. angular.forEach($scope.joblist.items, function (val) {
  1305. val.selected = false;
  1306. })
  1307. $scope.joblist.items[index].selected = true;
  1308. }
  1309. $scope.selectByLabel = function (outerIndex, index) {
  1310. $scope.contentlist[chooseIndex].reslist = [];
  1311. $scope.allcontentlist[chooseIndex].reslist = [];
  1312. $scope.changSelected(outerIndex, index);
  1313. $scope.submitSelected();
  1314. }
  1315. $scope.changSelectedSort = function (index) {
  1316. angular.forEach($scope.sortList.items, function (val) {
  1317. val.selected = false;
  1318. })
  1319. $scope.sortList.items[index].selected = true;
  1320. }
  1321. $scope.changSelectedList = function (index) {
  1322. angular.forEach($scope.typeList, function (val) {
  1323. val.selected = false;
  1324. })
  1325. $scope.typeList[index].selected = true;
  1326. }
  1327. $scope.changSelectedTaskType = function (index) {
  1328. angular.forEach($scope.taskTypeList.items, function (val) {
  1329. val.selected = false;
  1330. })
  1331. $scope.taskTypeList.items[index].selected = true;
  1332. }
  1333. $scope.selectBySort = function (index) {
  1334. $scope.contentlist[chooseIndex].reslist = [];
  1335. $scope.allcontentlist[chooseIndex].reslist = [];
  1336. checkedsort = $scope.sortList.items[index].labelKey;
  1337. $scope.changSelectedSort(index);
  1338. $scope.submitSelected();
  1339. }
  1340. $scope.selectByList = function (index) {
  1341. $scope.contentlist[chooseIndex].reslist = [];
  1342. $scope.allcontentlist[chooseIndex].reslist = [];
  1343. $scope.changSelectedList(index);
  1344. $scope.submitSelected();
  1345. }
  1346. $scope.selectByTaskType = function (index) {
  1347. $scope.contentlist[chooseIndex].reslist = [];
  1348. $scope.allcontentlist[chooseIndex].reslist = [];
  1349. checkedsort = $scope.taskTypeList.items[index].labelKey;
  1350. $scope.changSelectedTaskType(index);
  1351. $scope.submitSelected();
  1352. }
  1353. // 设置置顶
  1354. $scope.changeStickTop = function (type, resid) {
  1355. console.log(resid);
  1356. if (type) {
  1357. ResourceLibraryService.cancelStickTop(resid).then(function (res) {
  1358. console.log(res);
  1359. if (res.code == 3350) {
  1360. $scope.contentlist[chooseIndex].reslist = [];
  1361. $scope.allcontentlist[chooseIndex].reslist = [];
  1362. $scope.submitSelected();
  1363. }
  1364. })
  1365. } else {
  1366. ResourceLibraryService.stickTop(resid).then(function (res) {
  1367. console.log(res);
  1368. if (res.code == 3350) {
  1369. $scope.contentlist[chooseIndex].reslist = [];
  1370. $scope.allcontentlist[chooseIndex].reslist = [];
  1371. $scope.submitSelected();
  1372. }
  1373. })
  1374. }
  1375. }
  1376. $scope.orgtypelist =
  1377. {
  1378. title: '企业资质',
  1379. items: [
  1380. {name: '全部', value: 0, selected: true},
  1381. {name: '国高', value: 8307, selected: false},
  1382. {name: '市高', value: 8308, selected: false},
  1383. {name: '省科技型中小企业', value: 8309, selected: false}
  1384. ]
  1385. }
  1386. if ($scope.libtype == 6) {
  1387. $scope.joblist =
  1388. {
  1389. title: '职位',
  1390. items: [
  1391. {name: '全部', value: 0, selected: true},
  1392. {name: '科技联络人', value: 1, selected: false},
  1393. {name: '企业负责人', value: 2, selected: false},
  1394. {name: '研发总监', value: 3, selected: false}
  1395. ]
  1396. }
  1397. } else {
  1398. $scope.joblist =
  1399. {
  1400. title: '职位',
  1401. items: [
  1402. {name: '联系人', value: 1, selected: true},
  1403. ]
  1404. }
  1405. }
  1406. $scope.resourcelist = [];
  1407. $scope.residList = [];
  1408. $scope.selectResource = function (resource) {
  1409. resource.isSelected = !resource.isSelected;
  1410. angular.forEach($scope.allcontentlist[0].reslist, function (val) {
  1411. if (val.isSelected == true) {
  1412. $scope.resourcelist.push(val);
  1413. }
  1414. })
  1415. if ($scope.resourcelist.length > 0) {
  1416. document.getElementById("nextpage").style.backgroundColor = "#3b8bd0";
  1417. } else {
  1418. document.getElementById("nextpage").style.backgroundColor = "grey";
  1419. }
  1420. $scope.resourcelist = [];
  1421. }
  1422. $scope.choiceAllNum = 0;
  1423. $scope.choiceText = "全选";
  1424. $scope.choiceAll = function () {
  1425. $scope.choiceAllNum++;
  1426. if ($scope.choiceAllNum % 2 == 0) {
  1427. //偶数次点击,证明是全取消
  1428. angular.forEach($scope.allcontentlist[0].reslist, function (val) {
  1429. val.isSelected = false;
  1430. })
  1431. document.getElementById("nextpage").style.backgroundColor = "grey";
  1432. $scope.choiceText = "全选";
  1433. $scope.isChoiceAll = false;
  1434. } else {
  1435. //奇数次点击,证明是全选
  1436. angular.forEach($scope.allcontentlist[0].reslist, function (val) {
  1437. val.isSelected = true;
  1438. })
  1439. document.getElementById("nextpage").style.backgroundColor = "#3B8BD0";
  1440. $scope.choiceText = "全不选";
  1441. $scope.isChoiceAll = true;
  1442. }
  1443. }
  1444. $scope.goNextPage = function () {
  1445. console.log(222222222222222222)
  1446. $scope.showLoadingToastUtilEnd();
  1447. var jumptonextpage = false;
  1448. angular.forEach($scope.allcontentlist[0].reslist, function (val) {
  1449. if (val.isSelected == true) {
  1450. $scope.residList.push(val.unique);
  1451. $scope.resourcelist.push(val);
  1452. }
  1453. })
  1454. if ($scope.resourcelist.length == 0) {
  1455. return;
  1456. }
  1457. angular.forEach($scope.joblist.items, function (val) {
  1458. if (val.selected) {
  1459. $scope.roleValue = val.value;
  1460. }
  1461. })
  1462. ResourceLibraryService.getResourceListByESList($scope.residList, "资源库列表").then(function (res) {
  1463. $scope.hideLoadingToast()
  1464. if (res.code == 3350) {
  1465. var allRole = 0;//全部
  1466. var techRole = 0;//科技联络人
  1467. var orgRole = 0;//企业负责人
  1468. var devRole = 0;//研发总监
  1469. angular.forEach(res.data, function (val) {
  1470. if ($scope.roleValue == 0) {
  1471. //全部
  1472. if(val.tel!="" || val.legalrepresentativetel!="" || val.technologyContactphone!=""){
  1473. allRole++;
  1474. jumptonextpage =true;
  1475. }
  1476. }
  1477. if ($scope.roleValue == 1) {
  1478. //科技联络人
  1479. if(val.tel || val.legalrepresentativetel){
  1480. techRole++;
  1481. jumptonextpage =true;
  1482. }
  1483. }
  1484. if ($scope.roleValue == 2) {
  1485. //企业负责人
  1486. if(val.legalrepresentativetel){
  1487. orgRole++;
  1488. jumptonextpage =true;
  1489. }
  1490. }
  1491. if ($scope.roleValue == 3) {
  1492. //研发总监
  1493. if(val.technologyContactphone || val.legalrepresentativetel){
  1494. devRole++;
  1495. jumptonextpage =true;
  1496. }
  1497. }
  1498. })
  1499. if ($scope.roleValue == 0 && allRole == 0) {
  1500. $ionicPopup.alert({
  1501. title: '提示',
  1502. template: "没有可发送的收件号码"
  1503. })
  1504. return;
  1505. }
  1506. if ($scope.roleValue == 1 && techRole == 0) {
  1507. $ionicPopup.alert({
  1508. title: '提示',
  1509. template: "没有可发送的收件号码"
  1510. })
  1511. return;
  1512. }
  1513. if ($scope.roleValue == 2 && orgRole == 0) {
  1514. $ionicPopup.alert({
  1515. title: '提示',
  1516. template: "没有可发送的收件号码"
  1517. })
  1518. return;
  1519. }
  1520. if ($scope.roleValue == 3 && devRole == 0) {
  1521. $ionicPopup.alert({
  1522. title: '提示',
  1523. template: "没有可发送的收件号码"
  1524. })
  1525. return;
  1526. }
  1527. }
  1528. if (jumptonextpage ==true) {
  1529. angular.forEach($scope.orgtypelist.items, function(val){
  1530. if(val.selected){
  1531. $scope.resrole = val.name;
  1532. }
  1533. })
  1534. $scope.go("sendMessage", {resourcelist: $scope.resourcelist, job: $scope.joblist, resrole:$scope.resrole});
  1535. }
  1536. });
  1537. }
  1538. $scope.gobacktoselectlibrary = function () {
  1539. $scope.go('noticeHelper');
  1540. }
  1541. })
  1542. ;