taskHollCtrl.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. angular.module('push')
  2. .controller('taskHollCtrl', function ($scope, taskModuleService, $timeout, $q, UserService, ConfigService, $ionicScrollDelegate, CommonService, $ionicPopup, UtilService, $stateParams, $ionicHistory, dataToolsService) {
  3. //虚拟搜索框
  4. console.log('taskHoll');
  5. $scope.node = UserService.node;
  6. $scope.circleValue = 1;
  7. $scope.checkNeedShowFlag = false;
  8. $scope.defaultLan = UserService.defaultLan;
  9. $scope.isShowSearchButton = true;
  10. $scope.keyfilter = {
  11. key: ''
  12. }
  13. $scope.pagenum = 1;
  14. $scope.pagesize = 6;
  15. $scope.noData = false;
  16. $scope.tasktype = 0;
  17. $scope.userIsBroker = false;
  18. var type = 0;
  19. var totalpage = 0;
  20. $scope.allData = [];
  21. $scope.goWhere = function () {
  22. if ($stateParams.comfrom == 'tab.account') {
  23. $scope.go('tab.account');
  24. } else {
  25. $scope.go('tab.activityIndex');
  26. }
  27. };
  28. if ($scope.app) {
  29. if (device.platform != "Android") {
  30. $scope.isIos = true;
  31. } else {
  32. $scope.isIos = false;
  33. }
  34. }
  35. taskModuleService.getAllTaskLable(UserService.node).then(function (res) {
  36. $scope.labelList = [{
  37. itemvalue: 0,
  38. itemkey: '全部',
  39. isSelected: true
  40. }];
  41. if (res.code == 3350) {
  42. angular.forEach(res.data, function (val) {
  43. val.isSelected = false;
  44. })
  45. $scope.labelList = $scope.labelList.concat(res.data);
  46. }
  47. });
  48. if ($scope.defaultLan == 'Chinese') {
  49. $scope.taskHollList = [
  50. { title: '需求列表', selected: true, type: 0 },
  51. { title: '我报送的', selected: false, type: 1 },
  52. // { title: '我对接的', selected: false, type: 2 },
  53. ]
  54. } else {
  55. $scope.taskHollList = [
  56. { title: 'Demand List', selected: true, type: 0 },
  57. { title: 'My Submission', selected: false, type: 1 },
  58. { title: 'My Docking', selected: false, type: 2 },
  59. ]
  60. }
  61. if ($stateParams.comfrom == 'tab.account') {
  62. $scope.taskHollList = [
  63. { title: '需求列表', selected: false, type: 0 },
  64. { title: '我发布的', selected: false, type: 1 },
  65. // {title: '我对接的', selected: true, type: 2},
  66. ]
  67. }
  68. var searchList = function () {
  69. $scope.showLoadingToast();
  70. var deferred = $q.defer();
  71. //查询任务列表
  72. taskModuleService.getAllTaskList(UserService.node, type, $scope.tasktype, $scope.keyfilter.key, $scope.pagenum, $scope.pagesize).then(function (res) {
  73. // console.log(res);
  74. $scope.hideLoadingToast();
  75. deferred.resolve(res.data);
  76. totalpage = (res.page == null ? 0 : res.page.totalPage);
  77. if ($scope.pagenum >= totalpage) {
  78. // 如果没有数据了 用ng-if彻底结束
  79. $scope.showLoadMore = false;
  80. }
  81. })
  82. return deferred.promise;
  83. }
  84. $scope.getData = function () {
  85. searchList().then(function (data) {
  86. console.log(data)
  87. $scope.allData = data;
  88. $scope.noData = $scope.allData == null || $scope.allData.length == 0;
  89. angular.forEach($scope.allData, function (val) {
  90. if (val)
  91. // 事件按钮
  92. val.action0 = false;//对接录入 5322
  93. val.action1 = false;//对接录入 5322
  94. val.action2 = false;//评价 5323
  95. val.action3 = false;//申请奖励 5324
  96. val.action4 = false;//任务完成 5325
  97. val.actionNum = 0;
  98. var tempArr = (val.otherObj && val.otherObj.actions) ? val.otherObj.actions.split(',') : [];
  99. // console.log(tempArr);
  100. if (tempArr.length > 0) {
  101. for (var i = 0; i < tempArr.length; i++) {
  102. switch (Number(tempArr[i])) {
  103. case 5321:
  104. val.action0 = true;
  105. val.actionNum++;
  106. break;
  107. case 5322:
  108. val.action1 = true;
  109. val.actionNum++;
  110. break;
  111. // case 5323:val.action2=true;val.actionNum++;break;
  112. case 5324:
  113. val.action3 = true;
  114. $scope.buttonNum++;
  115. break;
  116. case 5325:
  117. val.action4 = true;
  118. val.actionNum++;
  119. break;
  120. }
  121. }
  122. }
  123. val.noSuthority = false;
  124. if (val.otherObj && val.otherObj.creator != UserService.id && val.otherObj.taskstatus == 5300 && val.actionNum == 0) {
  125. val.noSuthority = true;
  126. }
  127. })
  128. });
  129. }
  130. $scope.getData();
  131. $scope.changeSelected = function (index) {
  132. if ((index == 1 || index == 2) && !ConfigService.islogin) {
  133. if (localStorage.wxFlag == "true") {
  134. if (localStorage.isUserFocusXW == 0) {
  135. var title = localStorage.appidStr;
  136. $ionicPopup.alert({
  137. title: '提示',
  138. template: '请先关注微信公众号"' + title + '"!'
  139. });
  140. return;
  141. } else {
  142. if (localStorage.isUserBindWx == 0) {
  143. var wxFlag = JSON.parse(localStorage.params);
  144. if (wxFlag.weChatModel) {
  145. $scope.go('bindPhone', {
  146. params: localStorage.params,
  147. comfrom: 'maincontroller',
  148. url: window.location.href.split('#/')[1]
  149. });
  150. } else {
  151. $scope.go('login');
  152. return;
  153. }
  154. } else {
  155. $scope.go('login');
  156. return;
  157. }
  158. }
  159. } else {
  160. $scope.go('login');
  161. return;
  162. }
  163. } else {
  164. $scope.index = index;
  165. $scope.circleValue = 1;
  166. if (index == 0 || index == 2) {
  167. $scope.checkNeedShowFlag = false;
  168. } else {
  169. $scope.checkNeedShowFlag = true;
  170. }
  171. $scope.pagenum = 1;
  172. $scope.showLoadMore = true;
  173. angular.forEach($scope.taskHollList, function (val) {
  174. val.selected = false;
  175. })
  176. $scope.taskHollList[index].selected = true;
  177. type = $scope.taskHollList[index].type;
  178. $scope.allData = [];
  179. $scope.getData();
  180. $ionicScrollDelegate.$getByHandle('privateContent').scrollTop(true);
  181. }
  182. }
  183. $scope.showSearchButtonLeft = function () {
  184. // console.log('aaa');
  185. $scope.isShowSearchButton = false;
  186. $timeout(function () {
  187. $(".showSearchInput").focus();
  188. }, 300)
  189. };
  190. $scope.clearSearch = function () {
  191. $scope.isShowSearchButton = true;
  192. $scope.keyfilter.key = "";
  193. $scope.getData();
  194. }
  195. // 下拉刷新
  196. $scope.refreshData = function () {
  197. $scope.pagenum = 1;
  198. $scope.showLoadMore = true;
  199. $scope.getData();
  200. $scope.$broadcast('scroll.refreshComplete');
  201. };
  202. $scope.showLoadMore = true;
  203. $scope.loadMore = function () {
  204. if ($scope.showLoadMore) {
  205. $scope.pagenum++;
  206. searchList().then(function (data) {
  207. if ($scope.allData.length != 0 && data.length == $scope.allData.length) {
  208. for (var i = 0; i < data.length; i++) {
  209. for (var j = 0; j < $scope.allData.length; j++) {
  210. if (i == j && $scope.allData[j].id != data[i].id) {
  211. // $scope.allData = $scope.allData.concat(data);
  212. $scope.allData.push(data[i])
  213. // $scope.allData.push.apply($scope.allData,data)
  214. break;
  215. }
  216. }
  217. }
  218. } else {
  219. $scope.allData.push.apply($scope.allData, data)
  220. }
  221. // $scope.allData.push.apply($scope.allData,data)
  222. $scope.$broadcast('scroll.infiniteScrollComplete');
  223. });
  224. }
  225. }
  226. //判断当前用户是不是技术经纪人
  227. dataToolsService.judgeUserBroker(UserService.id).then(function (res) {
  228. if (res.code == 3350) {
  229. $scope.userIsBroker = res.data;
  230. }
  231. })
  232. $scope.releaseTask = function (userIsBroker) {
  233. // console.log(1);
  234. if (!ConfigService.islogin) {
  235. if (localStorage.wxFlag == "true") {
  236. if (localStorage.isUserFocusXW == 0) {
  237. var title = localStorage.appidStr;
  238. $ionicPopup.alert({
  239. title: '提示',
  240. template: '请先关注微信公众号"' + title + '"!'
  241. });
  242. return;
  243. } else {
  244. if (localStorage.isUserBindWx == 0) {
  245. var wxFlag = JSON.parse(localStorage.params);
  246. if (wxFlag.weChatModel) {
  247. $scope.go('bindPhone', {
  248. params: localStorage.params,
  249. comfrom: 'maincontroller',
  250. url: window.location.href.split('#/')[1]
  251. });
  252. } else {
  253. $scope.go('login');
  254. return;
  255. }
  256. } else {
  257. $scope.go('login');
  258. return;
  259. }
  260. }
  261. } else {
  262. $scope.go('login');
  263. return;
  264. }
  265. } else {
  266. $scope.go('taskRelease', { userIsBroker: userIsBroker });
  267. }
  268. }
  269. $scope.goToTaskDetail = function (list) {
  270. if (!ConfigService.islogin) {
  271. if (localStorage.wxFlag == "true") {
  272. if (localStorage.isUserFocusXW == 0) {
  273. var title = localStorage.appidStr;
  274. $ionicPopup.alert({
  275. title: '提示',
  276. template: '请先关注微信公众号"' + title + '"!'
  277. });
  278. return;
  279. } else {
  280. if (localStorage.isUserBindWx == 0) {
  281. var wxFlag = JSON.parse(localStorage.params);
  282. if (wxFlag.weChatModel) {
  283. $scope.go('bindPhone', {
  284. params: localStorage.params,
  285. comfrom: 'maincontroller',
  286. url: window.location.href.split('#/')[1]
  287. });
  288. } else {
  289. $scope.go('login');
  290. return;
  291. }
  292. } else {
  293. $scope.go('login');
  294. return;
  295. }
  296. }
  297. } else {
  298. $scope.go('login');
  299. return;
  300. }
  301. } else {
  302. if (list.source == '330122000') {
  303. console.log(list.creator)
  304. console.log(UserService.id)
  305. if (list.creator == UserService.id) {
  306. if (list.otherObj.taskstatus == 5302) {
  307. taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) {
  308. for (var i = 0; i < res.data.length; i++) {
  309. if (res.data[i] == UserService.id) {
  310. list.otherObj.actions = list.otherObj.actions + "," + 5324;
  311. break;
  312. }
  313. }
  314. })
  315. }
  316. console.log('来自远方的大锅', list)
  317. console.log('来自远方的大锅1', {
  318. resid: list.unique,
  319. node: list.source,
  320. title: list.title,
  321. restype: list.type,
  322. comefrom: 'taskHoll',
  323. ifjoin: list.otherObj.ifjoin,
  324. actions: list.otherObj.actions,
  325. taskstatus: list.otherObj.taskstatus,
  326. taskid: list.otherObj.id,
  327. opentowho: list.otherObj.opentowho,
  328. ispublic: true,
  329. })
  330. $scope.go('taskDetail', {
  331. resid: list.unique,
  332. node: list.source,
  333. title: list.title,
  334. restype: list.type,
  335. comefrom: 'taskHoll',
  336. ifjoin: list.otherObj.ifjoin,
  337. actions: list.otherObj.actions,
  338. taskstatus: list.otherObj.taskstatus,
  339. taskid: list.otherObj.id,
  340. opentowho: list.otherObj.opentowho,
  341. ispublic: true,
  342. });
  343. } else {
  344. var permissionvalue = list.by6;
  345. var splitArr = [];
  346. if (permissionvalue == 1 || permissionvalue == 2 || permissionvalue == 3 ||
  347. permissionvalue == 4 || permissionvalue == 5) {
  348. splitArr.push(permissionvalue);
  349. } else if (permissionvalue != null) {
  350. splitArr = permissionvalue.split(',');
  351. } else {
  352. splitArr.push(1);
  353. }
  354. if (splitArr.length == 2) {
  355. $scope.showTaskDetail = false;
  356. //技术经纪人及高校人员可见
  357. taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res1) {
  358. if (!res1.data) {//true可见,false不可见
  359. taskModuleService.checkTaskDetailPermission(2, UserService.id).then(function (res2) {
  360. //技术经纪人权限
  361. if (!res2.data) {//true可见,false不可见
  362. taskModuleService.checkTaskDetailPermission(3, UserService.id).then(function (res3) {
  363. //高校人员权限
  364. if (!res3.data) {//true可见,false不可见
  365. $ionicPopup.confirm({
  366. title: '确认',
  367. template: '仅高校院所专家可见,请先认证高校院所专家',
  368. okText: '去认证',
  369. cancelText: '取消'
  370. }).then(function (result) {
  371. if (result) {
  372. $scope.go('identifyForm', {
  373. pageTitle: '高校认证',
  374. code: 4804,
  375. action: 'submit'
  376. });
  377. } else {
  378. $scope.go('taskHoll');
  379. }
  380. })
  381. } else {
  382. goPermissionTaskDetail(list);
  383. $scope.showTaskDetail = true;
  384. }
  385. if (!res2.data && !$scope.showTaskDetail) {
  386. $ionicPopup.confirm({
  387. title: '确认',
  388. template: '仅技术经纪人可见,请先认证技术经纪人',
  389. okText: '去认证',
  390. cancelText: '取消'
  391. }).then(function (result) {
  392. if (result) {
  393. if ($scope.node == '330122000') {
  394. $scope.go('identifyFormForTongLu', {
  395. pageTitle: '技术经纪人认证',
  396. code: 4801,
  397. type: 5100,
  398. id: UserService.userid
  399. });
  400. }
  401. if ($scope.node == '320412000') {
  402. $scope.go('identifyForm', {
  403. pageTitle: '技术经纪人认证',
  404. code: 4801,
  405. type: 5100,
  406. id: UserService.userid
  407. });
  408. }
  409. } else {
  410. $scope.go('taskHoll');
  411. }
  412. })
  413. } else {
  414. goPermissionTaskDetail(list);
  415. }
  416. });
  417. }
  418. });
  419. } else {
  420. goPermissionTaskDetail(list);
  421. }
  422. });
  423. } else {
  424. //单一权限的情况
  425. for (var i = 0; i < splitArr.length; i++) {
  426. if (splitArr[i] == 2) {
  427. taskModuleService.checkTaskDetailPermission(2, UserService.id).then(function (res) {
  428. if (res.code == 3350) {
  429. $scope.isVisiableFlag = res.data;
  430. if (!$scope.isVisiableFlag) {
  431. taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) {
  432. if (res.code == 3350) {
  433. $scope.isVisiableFlag = res.data;
  434. if (!$scope.isVisiableFlag) {//true可见,false不可见
  435. $ionicPopup.confirm({
  436. title: '确认',
  437. template: '仅技术经纪人可见,请先认证技术经纪人',
  438. okText: '去认证',
  439. cancelText: '取消'
  440. }).then(function (result) {
  441. if (result) {
  442. if ($scope.node == '330122000') {
  443. $scope.go('identifyFormForTongLu', {
  444. pageTitle: '技术经纪人认证',
  445. code: 4801,
  446. type: 5100,
  447. id: UserService.userid
  448. });
  449. }
  450. if ($scope.node == '320412000') {
  451. $scope.go('identifyForm', {
  452. pageTitle: '技术经纪人认证',
  453. code: 4801,
  454. type: 5100,
  455. id: UserService.userid
  456. });
  457. }
  458. } else {
  459. $scope.go('taskHoll');
  460. }
  461. })
  462. } else {
  463. goPermissionTaskDetail(list);
  464. }
  465. }
  466. })
  467. } else {
  468. goPermissionTaskDetail(list);
  469. }
  470. }
  471. })
  472. } else if (splitArr[i] == 3) {
  473. taskModuleService.checkTaskDetailPermission(3, UserService.id).then(function (res) {
  474. if (res.code == 3350) {
  475. $scope.isVisiableFlag = res.data;
  476. if (!$scope.isVisiableFlag) {
  477. taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) {
  478. if (res.code == 3350) {
  479. $scope.isVisiableFlag = res.data;
  480. if (!$scope.isVisiableFlag) {//true可见,false不可见
  481. $ionicPopup.confirm({
  482. title: '确认',
  483. template: '仅高校院所专家可见,请先认证高校院所专家',
  484. okText: '去认证',
  485. cancelText: '取消'
  486. }).then(function (result) {
  487. if (result) {
  488. $scope.go('identifyForm', {
  489. pageTitle: '高校认证',
  490. code: 4804,
  491. action: 'submit'
  492. });
  493. } else {
  494. $scope.go('taskHoll');
  495. }
  496. })
  497. } else {
  498. goPermissionTaskDetail(list);
  499. }
  500. }
  501. });
  502. } else {
  503. goPermissionTaskDetail(list);
  504. }
  505. }
  506. });
  507. } else if (splitArr[i] == 4) {
  508. taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) {
  509. if (res.code == 3350) {
  510. $scope.isVisiableFlag = res.data;
  511. if (list.creator != UserService.id && !$scope.isVisiableFlag) {
  512. $ionicPopup.confirm({
  513. title: '提示',
  514. template: '此需求已设置权限,若需了解需求详情,去向发布者申请权限',
  515. okText: '去申请权限',
  516. cancelText: '取消'
  517. }).then(function (result) {
  518. if (result) {
  519. $scope.go("tongluPermissionApply", { resource: list });
  520. } else {
  521. $scope.go('taskHoll');
  522. }
  523. })
  524. } else {
  525. goPermissionTaskDetail(list);
  526. }
  527. }
  528. })
  529. } else {
  530. if (splitArr[i] == 1) {
  531. if (list.otherObj.taskstatus == 5302) {
  532. taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) {
  533. for (var i = 0; i < res.data.length; i++) {
  534. if (res.data[i] == UserService.id) {
  535. list.otherObj.actions = list.otherObj.actions + "," + 5324;
  536. break;
  537. }
  538. }
  539. })
  540. }
  541. $scope.go('taskDetail', {
  542. resid: list.unique,
  543. node: list.source,
  544. title: list.title,
  545. restype: list.type,
  546. comefrom: 'taskHoll',
  547. ifjoin: list.otherObj.ifjoin,
  548. actions: list.otherObj.actions,
  549. taskstatus: list.otherObj.taskstatus,
  550. taskid: list.otherObj.id,
  551. opentowho: list.otherObj.opentowho,
  552. ispublic: true,
  553. });
  554. }
  555. }
  556. }
  557. }
  558. }
  559. }
  560. else {
  561. if (list.noSuthority) {
  562. var alertPopup = $ionicPopup.alert({
  563. title: '提示',
  564. template: '自任务发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。'
  565. });
  566. return;
  567. }
  568. console.log(list);
  569. if (list.otherObj.taskstatus == 5302) {
  570. taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) {
  571. for (var i = 0; i < res.data.length; i++) {
  572. if (res.data[i] == UserService.id) {
  573. list.otherObj.actions = list.otherObj.actions + "," + 5324;
  574. break;
  575. }
  576. }
  577. })
  578. }
  579. $scope.go('taskDetail', {
  580. resid: list.unique,
  581. node: list.source,
  582. title: list.title,
  583. restype: list.type,
  584. comefrom: 'taskHoll',
  585. ifjoin: list.otherObj.ifjoin,
  586. actions: list.otherObj.actions,
  587. taskstatus: list.otherObj.taskstatus,
  588. taskid: list.otherObj.id,
  589. opentowho: list.otherObj.opentowho,
  590. ispublic: true,
  591. });
  592. }
  593. }
  594. }
  595. var goPermissionTaskDetail = function (list) {
  596. if (list.otherObj.taskstatus == 5302) {
  597. taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) {
  598. for (var i = 0; i < res.data.length; i++) {
  599. if (res.data[i] == UserService.id) {
  600. list.otherObj.actions = list.otherObj.actions + "," + 5324;
  601. break;
  602. }
  603. }
  604. })
  605. }
  606. $scope.go('taskDetail', {
  607. resid: list.unique,
  608. node: list.source,
  609. title: list.title,
  610. restype: list.type,
  611. comefrom: 'taskHoll',
  612. ifjoin: list.otherObj.ifjoin,
  613. actions: list.otherObj.actions,
  614. taskstatus: list.otherObj.taskstatus,
  615. taskid: list.otherObj.id,
  616. opentowho: list.otherObj.opentowho
  617. });
  618. }
  619. $scope.goToTaskDetailForTongLu = function (list, index) {
  620. console.log(list)
  621. if (!ConfigService.islogin) {
  622. if (localStorage.wxFlag == "true") {
  623. if (localStorage.isUserFocusXW == 0) {
  624. var title = localStorage.appidStr;
  625. $ionicPopup.alert({
  626. title: '提示',
  627. template: '请先关注微信公众号"' + title + '"!'
  628. });
  629. return;
  630. } else {
  631. if (localStorage.isUserBindWx == 0) {
  632. var wxFlag = JSON.parse(localStorage.params);
  633. if (wxFlag.weChatModel) {
  634. $scope.go('bindPhone', {
  635. params: localStorage.params,
  636. comfrom: 'maincontroller',
  637. url: window.location.href.split('#/')[1]
  638. });
  639. } else {
  640. $scope.go('login');
  641. return;
  642. }
  643. } else {
  644. $scope.go('login');
  645. return;
  646. }
  647. }
  648. } else {
  649. $scope.go('login');
  650. return;
  651. }
  652. } else {
  653. if (list.tonglucheckstatus == -1 || list.tonglucheckstatus == 0 || list.tonglucheckstatus == -2) {
  654. $scope.go('techDemandCheck', { id: list.id, checkShow: -1, list: list });
  655. }
  656. if (list.tonglucheckstatus == 1) {
  657. console.log(list)
  658. taskModuleService.getResourceByDemandName(list.projectname, $scope.node).then(function (res) {
  659. console.log(res)
  660. if (res.code == 3350) {
  661. var dataTemp = res.data;
  662. $scope.go('taskDetail', {
  663. resid: dataTemp.id,
  664. node: dataTemp.comefrom,
  665. title: dataTemp.title,
  666. restype: dataTemp.restype,
  667. comefrom: 'taskHoll',
  668. index: index,
  669. taskid: dataTemp.otherid
  670. });
  671. }
  672. })
  673. }
  674. }
  675. }
  676. $scope.goToTaskAction = function (list, action, index) {
  677. console.log(list);
  678. if (!ConfigService.islogin) {
  679. if (localStorage.wxFlag == "true") {
  680. if (localStorage.isUserFocusXW == 0) {
  681. var title = localStorage.appidStr;
  682. $ionicPopup.alert({
  683. title: '提示',
  684. template: '请先关注微信公众号"' + title + '"!'
  685. });
  686. return;
  687. } else {
  688. if (localStorage.isUserBindWx == 0) {
  689. var wxFlag = JSON.parse(localStorage.params);
  690. if (wxFlag.weChatModel) {
  691. $scope.go('bindPhone', {
  692. params: localStorage.params,
  693. comfrom: 'maincontroller',
  694. url: window.location.href.split('#/')[1]
  695. });
  696. } else {
  697. $scope.go('login');
  698. return;
  699. }
  700. } else {
  701. $scope.go('login');
  702. return;
  703. }
  704. }
  705. } else {
  706. $scope.go('login');
  707. return;
  708. }
  709. }
  710. if (action == 5323) {
  711. $scope.go('taskEvaluate', {
  712. taskRes: JSON.stringify(list)
  713. })
  714. } else if (action == 5322) {
  715. // 对接录入
  716. $scope.go('dockingInput', {
  717. comfrom: 'dockingInput',
  718. taskTitle: list.title,
  719. taskid: list.otherObj.id,
  720. companyName: list.school,
  721. companyid: list.otherObj.companyid,
  722. })
  723. } else if (action == 5324) {
  724. $scope.go('visitModularForm', {
  725. companyid: list.otherObj.companyid,
  726. pageTitle: '新建录入',
  727. pagecode: 1000027,
  728. pageid: 15,
  729. restype: 0,
  730. node: list.source,
  731. title: list.school,
  732. })
  733. } else if (action == 5325) {
  734. var confirmPopup = $ionicPopup.confirm({
  735. title: '提示信息',
  736. template: '是否确定结束任务?',
  737. buttons: [
  738. { text: '取消' },
  739. {
  740. text: '<b>确定</b>',
  741. type: 'button-positive',
  742. onTap: function () {
  743. return 'ok'
  744. }
  745. },
  746. ]
  747. });
  748. confirmPopup.then(function (res) {
  749. if (res == 'ok') {
  750. var senddata = {
  751. data: {
  752. resourceid: list.unique,
  753. action: 5325,
  754. creator: UserService.id
  755. },
  756. node: UserService.node
  757. }
  758. $scope.showLoadingToast();
  759. console.log(senddata);
  760. taskModuleService.saveOrupdatetaskAction(senddata).then(function (res) {
  761. console.log(res);
  762. $scope.getData();
  763. $scope.hideLoadingToast();
  764. })
  765. } else {
  766. return;
  767. }
  768. });
  769. } else if (action == 5321) {
  770. senddata = {
  771. data: {
  772. resourceid: list.unique,
  773. action: 5321,
  774. creator: UserService.id
  775. },
  776. node: UserService.node
  777. }
  778. $scope.showLoadingToast();
  779. console.log(senddata);
  780. taskModuleService.saveOrupdatetaskAction(senddata).then(function (res) {
  781. console.log(res);
  782. if (res.code == 3350) {
  783. if ($scope.app) {
  784. UtilService.showMess("任务申请成功!");
  785. } else {
  786. CommonService.showMessage("任务申请成功!", $scope);
  787. }
  788. $scope.allData[index].action1 = true;
  789. $scope.allData[index].action0 = false;
  790. $scope.allData[index].action3 = true;
  791. $scope.allData[index].otherObj.actions = '5322,5324';
  792. }
  793. $scope.hideLoadingToast();
  794. })
  795. }
  796. }
  797. });