editListCardCtrl.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. angular.module('push')
  2. .controller('editListCardCtrl', function ($scope, $stateParams, ModelService, $ionicActionSheet, UtilService, UserService, ConfigService, DockingService, $timeout) {
  3. //空人员信息
  4. var person = {
  5. infoid: 0,
  6. contact: "",
  7. phone: "",
  8. email: "",
  9. rank: "",
  10. categoryid: 0,
  11. introduce: ""
  12. };
  13. //空主题信息
  14. var theme = {
  15. infoid: 0,
  16. type: 0,
  17. title: "",
  18. content: ""
  19. };
  20. //空产品信息
  21. var product = {
  22. infoid: 0,
  23. productname: "",
  24. productdescription: ""
  25. };
  26. //空产学研经历
  27. var iur1 = {
  28. infoid: 0,
  29. cooperateschool: "",
  30. cooperatedetail: ""
  31. };
  32. //空重大科研项目
  33. var iur2 = {
  34. infoid: 0,
  35. productname: "",
  36. productyear: ""
  37. };
  38. //空历年申报项目
  39. var yearproject = {
  40. year: "",
  41. name: "",
  42. money: "",
  43. description: ""
  44. };
  45. var addperflg = true;
  46. var addtheflg = true;
  47. var addproflg = true;
  48. var addiur1flg = true;
  49. var addiur2flg = true;
  50. var addyearprojectflg = true;
  51. var deletememberids = "";
  52. var deletethemeids = "";
  53. var deleteproductids = "";
  54. var deleteiur1ids = "";
  55. var deleteiur2ids = "";
  56. var deleteyearprojectids = "";
  57. //编辑或新增 卡片
  58. var index = $stateParams.index;
  59. if (index == -1) {
  60. $scope.card = {
  61. name: "",
  62. categoryid: 0,
  63. categorydetail: "",
  64. type: -1,
  65. address: "",
  66. presentation: "",
  67. synchrotype: 1,
  68. creator: UserService.id,
  69. creatorcomefrom: ConfigService.comefrom,
  70. isinsert: 0,
  71. personlist: [],
  72. themelist: [],
  73. productlist: [],
  74. iur1list: [],
  75. iur2list: [],
  76. calendarlist:[]
  77. };
  78. } else {
  79. $scope.card = angular.copy(ModelService.getCardList()[index]);
  80. if ($scope.card.personlist.length > 0) {
  81. addperflg = false;
  82. }
  83. if ($scope.card.themelist.length > 0) {
  84. addtheflg = false;
  85. }
  86. if ($scope.card.productlist.length > 0) {
  87. addproflg = false;
  88. }
  89. if ($scope.card.iur1list.length > 0) {
  90. addiur1flg = false;
  91. }
  92. if ($scope.card.iur2list.length > 0) {
  93. addiur2flg = false;
  94. }
  95. if ($scope.card.calendarlist.length > 0) {
  96. addyearprojectflg = false;
  97. }
  98. deletememberids = ModelService.getDeleteMemberIds();
  99. deletethemeids = ModelService.getDeleteThemeIds();
  100. deleteproductids = ModelService.getDeleteProductIds();
  101. deleteiur1ids = ModelService.getDeleteIur1Ids();
  102. deleteiur2ids = ModelService.getDeleteIur2Ids();
  103. deleteyearprojectids = ModelService.getDeleteYearProjectIds();
  104. }
  105. // console.log($scope.card);
  106. //添加人员
  107. $scope.addPerson = function () {
  108. $scope.card.personlist.push(angular.copy(person));
  109. };
  110. //添加主题
  111. $scope.addTheme = function () {
  112. $scope.card.themelist.push(angular.copy(theme));
  113. };
  114. //添加产品
  115. $scope.addProduct = function () {
  116. $scope.card.productlist.push(angular.copy(product));
  117. };
  118. //添加产学研
  119. $scope.addProductStudy = function () {
  120. $scope.card.iur1list.push(angular.copy(iur1));
  121. };
  122. //添加重大科研项目
  123. $scope.addProject = function () {
  124. $scope.card.iur2list.push(angular.copy(iur2));
  125. };
  126. //添加历年申报项目
  127. $scope.addYearProject = function () {
  128. $timeout(function () {
  129. $scope.card.calendarlist.push(angular.copy(yearproject));
  130. },300);
  131. };
  132. //保存或修改 卡片
  133. $scope.addCard = function () {
  134. // console.log($scope.card);
  135. if (!UtilService.isDefined($scope.card.name)) {
  136. UtilService.showMess("单位名称不能为空");
  137. return;
  138. }
  139. //有人员信息且有手机信息,验证手机号
  140. if ($scope.card.personlist.length > 0) {
  141. var pflg = -1;//第几个人员的姓名未填写
  142. var perdel = [];//需要删除人员的索引数组
  143. var tflg = -1;//第几个人员的手机格式错误
  144. //判断人员是否必填(其他信息均未填写,姓名也未填写则删除该条人员;若其他信息有一项填写,判断姓名不能为空)
  145. var perindex = $scope.card.personlist.length - 1;
  146. var templist1 = angular.copy($scope.card.personlist);
  147. for (var i = perindex; i >= 0; i--) {
  148. if (UtilService.isDefined(templist1[i].phone) || UtilService.isDefined(templist1[i].email) || UtilService.isDefined(templist1[i].rank) || templist1[i].categoryid != 0 || UtilService.isDefined(templist1[i].introduce)) {
  149. if (!UtilService.isDefined(templist1[i].contact)) {
  150. pflg = i;
  151. }
  152. } else {
  153. if (!UtilService.isDefined(templist1[i].contact)) {
  154. perdel.push(i);
  155. }
  156. }
  157. if (UtilService.isDefined(templist1[i].phone)) {
  158. if (!(UtilService.isMobilePhone(templist1[i].phone) || UtilService.isTelePhone(templist1[i].phone))) {
  159. tflg = index;
  160. }
  161. }
  162. }
  163. if (pflg != -1) {
  164. UtilService.showMess('第' + (pflg + 1) + '个人员姓名不能为空');
  165. return;
  166. }
  167. if (tflg != -1) {
  168. UtilService.showMess('人员"' + $scope.card.personlist[tflg].contact + '"的手机输入有误');
  169. return;
  170. }
  171. //存在均未填写的,删除-->
  172. if (pflg == -1) {
  173. angular.forEach(perdel, function (value) {
  174. $scope.card.personlist.splice(value, 1);
  175. });
  176. }
  177. }
  178. // console.log($scope.card.personlist);
  179. //有主题信息
  180. if ($scope.card.themelist.length > 0) {
  181. var hflg = -1;//第几个主题名称未填写
  182. var thedel = [];//需要删除主题的索引数组
  183. //判断主题名称是否必填(其他信息均未填写,主题名称也未填写则删除该条主题;若其他信息有一项填写,判断主题名称不能为空)
  184. var theindex = $scope.card.themelist.length - 1;
  185. var templist2 = angular.copy($scope.card.themelist);
  186. for (var j = theindex; j >= 0; j--) {
  187. if (UtilService.isDefined(templist2[j].title) || UtilService.isDefined(templist2[j].content) || templist2[j].type != 0) {
  188. if (!UtilService.isDefined(templist2[j].title)) {
  189. hflg = j;
  190. }
  191. } else {
  192. if (!UtilService.isDefined(templist2[j].title)) {
  193. thedel.push(j);
  194. }
  195. }
  196. }
  197. if (hflg != -1) {
  198. UtilService.showMess('第' + (hflg + 1) + '个主题名称不能为空');
  199. return;
  200. }
  201. //存在均未填写的,删除-->
  202. if (hflg == -1) {
  203. angular.forEach(thedel, function (value) {
  204. $scope.card.themelist.splice(value, 1);
  205. });
  206. }
  207. }
  208. //有产品信息
  209. if ($scope.card.productlist.length > 0) {
  210. var proflg = -1;//第几个产品名称未填写
  211. var prodel = [];//需要删除产品的索引数组
  212. //判断产品名称是否必填(其他信息均未填写,产品名称也未填写则删除该条产品;若其他信息有一项填写,判断产品名称不能为空)
  213. var proindex = $scope.card.productlist.length - 1;
  214. var templist3 = angular.copy($scope.card.productlist);
  215. for (var k = proindex; k >= 0; k--) {
  216. if (UtilService.isDefined(templist3[k].productname) || UtilService.isDefined(templist3[k].productdescription)) {
  217. if (!UtilService.isDefined(templist3[k].productname)) {
  218. proflg = k;
  219. }
  220. } else {
  221. if (!UtilService.isDefined(templist3[k].productname)) {
  222. prodel.push(k);
  223. }
  224. }
  225. }
  226. if (proflg != -1) {
  227. UtilService.showMess('第' + (proflg + 1) + '个产品名称不能为空');
  228. return;
  229. }
  230. //存在均未填写的,删除-->
  231. if (proflg == -1) {
  232. angular.forEach(prodel, function (value) {
  233. $scope.card.productlist.splice(value, 1);
  234. });
  235. }
  236. }
  237. //有产学研经历信息
  238. if ($scope.card.iur1list.length > 0) {
  239. var iur1flg = -1;//第几个产学研经历的合作单位未填写
  240. var iur1del = [];//需要删除产学研经历的索引数组
  241. //判断产学研经历的合作单位是否必填(其他信息均未填写,产学研经历的合作单位也未填写则删除该条产学研经历;若其他信息有一项填写,判断产学研经历的合作单位不能为空)
  242. var iur1index = $scope.card.iur1list.length - 1;
  243. var templist4 = angular.copy($scope.card.iur1list);
  244. for (var k = iur1index; k >= 0; k--) {
  245. if (UtilService.isDefined(templist4[k].cooperateschool) || UtilService.isDefined(templist4[k].cooperatedetail)) {
  246. if (!UtilService.isDefined(templist4[k].cooperateschool)) {
  247. iur1flg = k;
  248. }
  249. } else {
  250. if (!UtilService.isDefined(templist4[k].cooperateschool)) {
  251. iur1del.push(k);
  252. }
  253. }
  254. }
  255. if (iur1flg != -1) {
  256. UtilService.showMess('第' + (iur1flg + 1) + '个产学研经历的合作单位不能为空');
  257. return;
  258. }
  259. //存在均未填写的,删除-->
  260. if (iur1flg == -1) {
  261. angular.forEach(iur1del, function (value) {
  262. $scope.card.iur1list.splice(value, 1);
  263. });
  264. }
  265. }
  266. //有产学研经历信息
  267. if ($scope.card.iur2list.length > 0) {
  268. var iur2flg = -1;//第几个重大科研项目名称未填写
  269. var iur2del = [];//需要删除重大科研项目的索引数组
  270. //判断重大科研项目名称是否必填(其他信息均未填写,重大科研项目名称也未填写则删除该条重大科研项目;若其他信息有一项填写,判断重大科研项目名称不能为空)
  271. var iur2index = $scope.card.iur2list.length - 1;
  272. var templist5 = angular.copy($scope.card.iur2list);
  273. for (var k = iur2index; k >= 0; k--) {
  274. if (UtilService.isDefined(templist5[k].productname) || UtilService.isDefined(templist5[k].productyear)) {
  275. if (!UtilService.isDefined(templist5[k].productname)) {
  276. iur2flg = k;
  277. }
  278. } else {
  279. if (!UtilService.isDefined(templist5[k].productname)) {
  280. iur2del.push(k);
  281. }
  282. }
  283. }
  284. if (iur2flg != -1) {
  285. UtilService.showMess('第' + (iur2flg + 1) + '个重大科研项目名称不能为空');
  286. return;
  287. }
  288. //存在均未填写的,删除-->
  289. if (iur2flg == -1) {
  290. angular.forEach(iur2del, function (value) {
  291. $scope.card.iur2list.splice(value, 1);
  292. });
  293. }
  294. }
  295. //有历年申报项目信息
  296. if ($scope.card.calendarlist.length > 0) {
  297. var calendarflg = -1;//第几个历年申报项目名称未填写
  298. var calendardel = [];//需要删除历年申报项目的索引数组
  299. //判断历年申报项目名称是否必填(其他信息均未填写,历年申报项目名称也未填写则删除该条历年申报项目;若其他信息有一项填写,判断历年申报项目名称不能为空)
  300. var calendarindex = $scope.card.calendarlist.length - 1;
  301. var templist6 = angular.copy($scope.card.calendarlist);
  302. for (var k = calendarindex; k >= 0; k--) {
  303. if (UtilService.isDefined(templist6[k].year) || UtilService.isDefined(templist6[k].money) || UtilService.isDefined(templist6[k].description)) {
  304. if (!UtilService.isDefined(templist6[k].name)) {
  305. calendarflg = k;
  306. }
  307. } else {
  308. if (!UtilService.isDefined(templist6[k].name)) {
  309. calendardel.push(k);
  310. }
  311. }
  312. }
  313. if (calendarflg != -1) {
  314. UtilService.showMess('第' + (calendarflg + 1) + '个历年申报项目名称不能为空');
  315. return;
  316. }
  317. //存在均未填写的,删除-->
  318. if (calendarflg == -1) {
  319. angular.forEach(calendardel, function (value) {
  320. $scope.card.calendarlist.splice(value, 1);
  321. });
  322. }
  323. }
  324. //区分修改还是新增
  325. if (index == -1) {
  326. ModelService.addCardList($scope.card);
  327. } else {
  328. if ($scope.card.synchrotype != 1) {
  329. $scope.card.synchrotype = 2;
  330. }
  331. ModelService.setCardListByIndex(index, $scope.card);
  332. ModelService.setDeleteMemberIds(deletememberids);
  333. ModelService.setDeleteThemeIds(deletethemeids);
  334. ModelService.setDeleteProductIds(deleteproductids);
  335. ModelService.setDeleteIur1Ids(deleteiur1ids);
  336. ModelService.setDeleteIur2Ids(deleteiur2ids);
  337. ModelService.setDeleteYearProjectIds(deleteyearprojectids);
  338. }
  339. $scope.goback();
  340. };
  341. //展开/收起 单位信息
  342. $scope.UnitInfotoggleDiv = function () {
  343. $(".UnitInfo").fadeToggle(0);
  344. $(".UnitInfoEm").toggleClass("arrowChange");
  345. };
  346. //展开/收起 人员信息
  347. $scope.PersonnelInfotoggleDiv = function () {
  348. //是否有人员信息
  349. if (addperflg) {
  350. $scope.card.personlist.push(angular.copy(person));
  351. addperflg = false;
  352. }
  353. $(".PersonnelInfo").fadeToggle(0);
  354. $(".PersonnelInfoEm").toggleClass("arrowChange");
  355. };
  356. //展开/收起 主题
  357. $scope.DockingThemetoggleDiv = function () {
  358. //是否有主题信息
  359. if (addtheflg) {
  360. $scope.card.themelist.push(angular.copy(theme));
  361. addtheflg = false;
  362. }
  363. $(".DockingTheme").fadeToggle(0);
  364. $(".DockingThemeEm").toggleClass("arrowChange");
  365. };
  366. //展开/收起 产品
  367. $scope.ProductNametoggleDiv = function () {
  368. //是否有产品信息
  369. if (addproflg) {
  370. $scope.card.productlist.push(angular.copy(product));
  371. addproflg = false;
  372. }
  373. $(".ProductName").fadeToggle(0);
  374. $(".ProductNameEm").toggleClass("arrowChange");
  375. };
  376. //展开/收起 产学研究经历
  377. $scope.ProductStudytoggleDiv = function () {
  378. //是否有产学研究经历信息
  379. if (addiur1flg) {
  380. $scope.card.iur1list.push(angular.copy(iur1));
  381. addiur1flg = false;
  382. }
  383. $(".ProductStudy").fadeToggle(0);
  384. $(".ProductStudyEm").toggleClass("arrowChange");
  385. };
  386. //展开/收起 重大科研项目
  387. $scope.ImportantSciencetoggleDiv = function () {
  388. //是否有重大科研项目信息
  389. if (addiur2flg) {
  390. $scope.card.iur2list.push(angular.copy(iur2));
  391. addiur2flg = false;
  392. }
  393. $(".ImportantScience").fadeToggle(0);
  394. $(".ImportantScienceEm").toggleClass("arrowChange");
  395. };
  396. //展开/收起 历年申报项目
  397. $scope.yearProjectToggleDiv = function () {
  398. $timeout(function () {
  399. //是否有历年申报项目信息
  400. if (addyearprojectflg) {
  401. $scope.card.calendarlist.push(angular.copy(yearproject));
  402. addyearprojectflg = false;
  403. }
  404. $(".yearproject").fadeToggle(0);
  405. $(".yearprojectEm").toggleClass("arrowChange");
  406. },300);
  407. };
  408. //打开通讯录
  409. $scope.getContact = function (ind) {
  410. navigator.contacts.pickContact(function (contact) {
  411. // console.log(contact);
  412. var name = "";
  413. if (device.platform == "Android") {
  414. name = contact.displayName;
  415. } else {
  416. name = contact.name.formatted;
  417. }
  418. $scope.card.personlist[ind].contact = name;
  419. var tempdate = UtilService.formatDate();
  420. var templocalid = tempdate.timestamp + "";
  421. //判断人员联系方式个数,大于1弹窗选择
  422. if (angular.isDefined(contact.phoneNumbers) && contact.phoneNumbers.length > 1) {
  423. var buttons = [];
  424. angular.forEach(contact.phoneNumbers, function (data) {
  425. buttons.push({text: '<a class="action-sheet-push ">' + data.value + '</a>'})
  426. });
  427. $ionicActionSheet.show({
  428. buttons: buttons,
  429. cancelText: '取消',
  430. buttonClicked: function (index) {
  431. var str =
  432. $scope.card.personlist[ind].phone = contact.phoneNumbers[index].value.replace(/\s/g, "");
  433. return true;
  434. }
  435. });
  436. } else {
  437. var str = contact.phoneNumbers[0].value.replace(/\s/g, "");
  438. $scope.$apply(function () {
  439. $scope.card.personlist[ind].phone = str;
  440. });
  441. }
  442. }, function (err) {
  443. });
  444. };
  445. //单位行业
  446. $scope.showCategory = function (boo, ind) {
  447. $ionicActionSheet.show({
  448. buttons: [
  449. {text: '<a class="action-sheet-push">汽车制造</a>'},
  450. {text: '<a class="action-sheet-push">能源及节能技术</a>'},
  451. {text: '<a class="action-sheet-push">新材料</a>'},
  452. {text: '<a class="action-sheet-push">生物与新医药</a>'},
  453. {text: '<a class="action-sheet-push">电子信息</a>'},
  454. {text: '<a class="action-sheet-push">先进制造及高端装备</a>'},
  455. {text: '<a class="action-sheet-push">资源及环境技术</a>'}
  456. ],
  457. cancelText: '取消',
  458. buttonClicked: function (index) {
  459. if (boo) {
  460. $scope.card.categoryid = index + 1;
  461. } else {
  462. $scope.card.personlist[ind].categoryid = index + 1;
  463. }
  464. return true;
  465. }
  466. });
  467. };
  468. //单位类型
  469. $scope.showCompanyType = function () {
  470. $ionicActionSheet.show({
  471. buttons: [
  472. {text: '<a class="action-sheet-push">高校</a>'},
  473. {text: '<a class="action-sheet-push">企业</a>'},
  474. {text: '<a class="action-sheet-push">机构</a>'},
  475. {text: '<a class="action-sheet-push">园区</a>'},
  476. {text: '<a class="action-sheet-push">政府</a>'},
  477. {text: '<a class="action-sheet-push">其他</a>'}
  478. ],
  479. cancelText: '取消',
  480. buttonClicked: function (index) {
  481. $scope.card.type = 5 - index;
  482. return true;
  483. }
  484. });
  485. };
  486. //主题类型
  487. $scope.showThemeType = function (ind) {
  488. $ionicActionSheet.show({
  489. buttons: [
  490. {text: '<a class="action-sheet-push">需求</a>'},
  491. {text: '<a class="action-sheet-push">成果</a>'},
  492. {text: '<a class="action-sheet-push">服务</a>'},
  493. {text: '<a class="action-sheet-push">其他</a>'}
  494. ],
  495. cancelText: '取消',
  496. buttonClicked: function (index) {
  497. $scope.card.themelist[ind].type = index + 1;
  498. return true;
  499. }
  500. });
  501. };
  502. //人员信息中删除已新增名片
  503. $scope.cardListDelect = function (index) {
  504. //组装有id的已删除人员
  505. if (UtilService.isDefined($scope.card.personlist[index].id)) {
  506. if (deletememberids.length == 0) {
  507. deletememberids = $scope.card.personlist[index].id;
  508. } else {
  509. deletememberids = deletememberids + "," + $scope.card.personlist[index].id;
  510. }
  511. }
  512. $scope.card.personlist.splice(index, 1);
  513. };
  514. //对接主题中中删除已新增名片
  515. $scope.cardThemeListDelect = function (index) {
  516. //组装有id的已删除主题
  517. if (UtilService.isDefined($scope.card.themelist[index].id)) {
  518. if (deletethemeids.length == 0) {
  519. deletethemeids = $scope.card.themelist[index].id;
  520. } else {
  521. deletethemeids = deletethemeids + "," + $scope.card.themelist[index].id;
  522. }
  523. }
  524. $scope.card.themelist.splice(index, 1);
  525. };
  526. //产品中删除已新增名片
  527. $scope.cardProductListDelect = function (index) {
  528. //组装有id的已删除主题
  529. if (UtilService.isDefined($scope.card.productlist[index].id)) {
  530. if (deleteproductids.length == 0) {
  531. deleteproductids = $scope.card.productlist[index].id;
  532. } else {
  533. deleteproductids = deleteproductids + "," + $scope.card.productlist[index].id;
  534. }
  535. }
  536. $scope.card.productlist.splice(index, 1);
  537. };
  538. //产学研中删除已新增名片
  539. $scope.cardProductStudyListDelect = function (index) {
  540. //组装有id的已删除主题
  541. if (UtilService.isDefined($scope.card.iur1list[index].id)) {
  542. if (deleteiur1ids.length == 0) {
  543. deleteiur1ids = $scope.card.iur1list[index].id;
  544. } else {
  545. deleteiur1ids = deleteiur1ids + "," + $scope.card.iur1list[index].id;
  546. }
  547. }
  548. $scope.card.iur1list.splice(index, 1);
  549. };
  550. //重大科研项目中删除已新增名片
  551. $scope.cardProjectListDelect = function (index) {
  552. //组装有id的已删除主题
  553. if (UtilService.isDefined($scope.card.iur2list[index].id)) {
  554. if (deleteiur2ids.length == 0) {
  555. deleteiur2ids = $scope.card.iur2list[index].id;
  556. } else {
  557. deleteiur2ids = deleteiur2ids + "," + $scope.card.iur2list[index].id;
  558. }
  559. }
  560. $scope.card.iur2list.splice(index, 1);
  561. };
  562. //历年申报项目中删除已新增名片
  563. $scope.cardYearProjectListDelete = function (index) {
  564. //组装有id的已删除主题
  565. if (UtilService.isDefined($scope.card.calendarlist[index].id)) {
  566. if (deleteyearprojectids.length == 0) {
  567. deleteyearprojectids = $scope.card.calendarlist[index].id;
  568. } else {
  569. deleteyearprojectids = deleteyearprojectids + "," + $scope.card.calendarlist[index].id;
  570. }
  571. }
  572. $scope.card.calendarlist.splice(index, 1);
  573. };
  574. //关联相关企业
  575. $scope.isRelateUl = false;
  576. $scope.queryLikeName = function () {
  577. if ($scope.card.name.length == 0) {
  578. $scope.companylist = [];
  579. $scope.isRelateUl = false;
  580. return;
  581. }
  582. DockingService.getCampanyListByName($scope.card.name).then(function (response) {
  583. // console.log(response);
  584. $scope.companylist = response.companylist;
  585. $scope.isRelateUl = true;
  586. }, function () {
  587. })
  588. };
  589. //选中企业
  590. $scope.setCompanyName = function (name) {
  591. name = name.replace("<b style='color:red;font-weight: normal;'>", "");
  592. name = name.replace("</b>", "");
  593. $scope.card.name = name;
  594. $scope.isRelateUl = false;
  595. };
  596. $scope.years = [];
  597. $scope.currentyear = new Date().getFullYear();//当前年份
  598. var startYear = $scope.currentyear - 50; //开始年份
  599. for (var i = $scope.currentyear; i >= startYear; i--) {
  600. $scope.years.push(i);
  601. }
  602. });