technicalBrokerAddCompanyInfoCtrl.js 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732
  1. angular.module('push')
  2. .controller('technicalBrokerAddCompanyInfoCtrl', function ($scope,$stateParams,$ionicActionSheet,$ionicSlideBoxDelegate, UtilService,AccountService,ActivityService,
  3. UserService,$ionicScrollDelegate,$timeout,ModelService,CloudFolderService,
  4. DockingService, TechnicalBrokerPublishTrainService,
  5. $ionicModal,SqliteStorageService,$ionicPopup,ConfigService) {
  6. // 信息来源,1是企业自己填写,2是对接宝的走企业模板
  7. $scope.sourcetype = 2;
  8. // 图片总数
  9. $scope.pictotal = 0;
  10. // 由哪个任务进入
  11. $scope.taskid = $stateParams.taskid;
  12. // 传入的企业id
  13. $scope.companyid = $stateParams.companyid;
  14. $scope.imagelist = [];
  15. $scope.enterCompanyInfo={
  16. delproductInfo: "",// 删除的产品信息
  17. deldemandInfo: "",// 删除的产品信息
  18. productInfoimagelist:[],// app端图片插件进行传递的变量(产品图片)
  19. greatProduceInfoimagelist:[],// app端图片插件进行传递的变量(高新产品图片)
  20. demandInfoimagelist:[],// app端图片插件进行传递的变量(需求图片)
  21. talentInfoimagelist:[]// app端图片插件进行传递的变量(人才图片)
  22. };
  23. $scope.companyimagelist = [];
  24. $scope.delproductInfo = "";
  25. $scope.deldemandInfo = "";
  26. $scope.delresearchInfo = "";
  27. $scope.delprojectCenterInfo = "";
  28. $scope.delrealInfo = "";
  29. $scope.delgreatProduceInfoList = "";
  30. $scope.deladviceInfoList="";
  31. $scope.delexperienceInfoList="";
  32. $scope.delpatentInfoList="";
  33. $scope.deltalentInfoList="";
  34. //初始化云文件夹列表
  35. $scope.checkdefolder = [];
  36. var initCloudFolderList = function () {
  37. // 0,查询所有文件夹,1查询通用文件夹,2查询走企业模板文件夹
  38. var templettype = 2;
  39. DockingService.newGetComFolderList(templettype).then(function (response) {
  40. $scope.cloudFolderList = response.folderlist;
  41. ModelService.setCloudFolderList($scope.cloudFolderList);
  42. // 云文件夹
  43. $scope.folderlist = angular.copy(ModelService.getCloudFolderList());
  44. //默认选择文件夹
  45. console.log("1:"+$scope.folderlist.length);
  46. if($scope.folderlist.length > 0){
  47. $scope.checkdefolder = $scope.folderlist[0];
  48. $scope.checkfolder = $scope.folderlist[0].id + "";
  49. }
  50. }, function () {
  51. })
  52. };
  53. initCloudFolderList();
  54. //企业基本信息
  55. $scope.connEnterpriseModuleModel = {
  56. userid: 0,
  57. usercomefrom: "",
  58. claid: 0,// 选中的文件夹id
  59. taskid: 0,// 任务id
  60. yearsetupid: 0,
  61. yearsetupname: "",
  62. company: {
  63. companyid: 0,
  64. companyname: "",
  65. contact: "",
  66. contactnum: "",
  67. categoryid: "",
  68. categoryName: "",
  69. rdinstitutiontype: 0,// 企业研发机构等级
  70. rdinstitutiontypeName: "",// 企业研发机构等级
  71. ishigh: 0,// 是否高企
  72. logo: "",// 企业logo
  73. high:true,
  74. ishighInfo:"是",
  75. images: "",// 传到后台的图片json
  76. delimages: "",// 删除的图片
  77. imagelist: []// app端图片插件进行传递的变量
  78. },
  79. // 工程中心信息
  80. projectCenterInfoListJson: "",
  81. // 研发投入
  82. researchInfoListJson: "",
  83. // 实际收入
  84. realInfoListJson: "",
  85. // 产品信息
  86. produceInfoListJson: "",
  87. // 高新产品
  88. greatProduceInfoListJson: "",
  89. // 需求信息
  90. techrequirelistJson: "",
  91. // 重大科研项目
  92. importantProjectListJson: "",
  93. // 项目建议
  94. adviceInfoListJson: "",
  95. // 产学研经验
  96. experienceInfoListJson: "",
  97. // 人才
  98. talentInfoListJson: "",
  99. // 专利
  100. intellectualListJson: "",
  101. };
  102. $scope.connEnterpriseModuleModel1 = {
  103. userid: 0,
  104. usercomefrom: ""
  105. };
  106. //产品信息
  107. $scope.produceInfoList = [{
  108. id: 0,
  109. productname: "",// 产品名称
  110. productdescription: ""//产品描述
  111. }];
  112. //高新产品
  113. $scope.greatProduceInfoList= [{
  114. id: 0,
  115. productname: "",// 产品名称
  116. productdescription: ""//产品描述
  117. }];
  118. //需求信息
  119. $scope.demandInfoList=[{
  120. id: 0,
  121. companyid: 0,
  122. techtype: 0,
  123. techtypename: "",
  124. techrequirementname: "",
  125. cooperationmodel: "",
  126. cooperationmodelName: "",// 合作模式名称
  127. capitalScale: "",
  128. techrequirementdetail: "",
  129. images: "", // 图片
  130. demandInfoimagelist:[],// app端图片插件进行传递的变量(需求图片)
  131. }];
  132. //工程中心信息
  133. $scope.projectCenterInfoList= [{
  134. id: 0,
  135. yid: 0,
  136. yearsetupname: "",// 选择项名称
  137. yvalue1: ""// 金额
  138. }];
  139. //研发投入信息
  140. $scope.researchInfoList = [{
  141. id: 0,
  142. yid: 0,
  143. yearsetupname: "",// 选择项名称
  144. yvalue1: ""// 金额
  145. }];
  146. //实际收入与预计投入信息
  147. $scope.realInfoList= [{
  148. id: 0,
  149. yid: 0,
  150. yearsetupname: "",//选择项名称
  151. yvalue1: "",// 销售收入
  152. yvalue2: "",// 净利润
  153. yvalue3: "" // 上缴税收
  154. }];
  155. //重大科研项目信息
  156. $scope.importantProjectList= [{
  157. id: 0,
  158. yid: 0,
  159. yearsetupname: "",// 选择项名称
  160. yvalue1: ""// 项目内容
  161. }];
  162. //项目建议
  163. $scope.adviceInfoList= [{
  164. id: 0,
  165. projectname: "",//
  166. projectdescription: "",//
  167. projectsuggest: ""// 申报项目建议
  168. }];
  169. //产学研经验
  170. $scope.experienceInfoList=[{
  171. id: 0,
  172. cooperateschool: "",// 合作院校
  173. cooperatedetail: ""// 合作内容
  174. }];
  175. //人才
  176. $scope.talentInfoList=[{
  177. id: 0,
  178. name: "",// 人才姓名
  179. tel: "",// 手机号
  180. position: "",// 职位
  181. academicdegree: 0,// 学位
  182. academicdegreeName: "",// 学位名称
  183. responsible: "",// 负责工作
  184. about: ""// 人才简介
  185. }];
  186. //专利
  187. $scope.patentInfoList=[{
  188. id: 0,
  189. intellectualpropertyname: "",// 名称
  190. applyperson: "",// 主要完成人
  191. licensenumber: "",// 申请号/授权号
  192. // licensedate: ""// 授权日期
  193. }];
  194. //产品图片
  195. $scope.productInfoimagelist = [];
  196. //高新产品图片
  197. $scope.greatProduceInfoimagelist=[];
  198. //需求图片
  199. // $scope.demandInfoimagelist = [];
  200. //人才图片
  201. $scope.talentInfoimagelist = [];
  202. //切换到对应页面
  203. var activity=['baseInfo','productInfo','demandInfo','projectInfo','personnelAbilityInfo','patentInfo'];
  204. $scope.act = activity[0];
  205. $scope.changeAct = function (num) {
  206. if (num == 0) {
  207. $scope.act = activity[num];
  208. } else if (num == 1) {
  209. $scope.act = activity[num];
  210. }else if (num == 2) {
  211. $scope.act = activity[num];
  212. }
  213. else if (num == 3) {
  214. $scope.act = activity[num];
  215. }
  216. else if (num == 4) {
  217. $scope.act = activity[num];
  218. }
  219. else if (num == 5) {
  220. $scope.act = activity[num];
  221. }
  222. };
  223. $scope.watchIsChange=function () {
  224. if($scope.connEnterpriseModuleModel.company.high==true){
  225. $scope.connEnterpriseModuleModel.company.ishighInfo="是";
  226. $scope.connEnterpriseModuleModel.company.ishigh=1;
  227. }else{
  228. $scope.connEnterpriseModuleModel.company.ishighInfo="否";
  229. $scope.connEnterpriseModuleModel.company.ishigh=0;
  230. }
  231. };
  232. // 获取传入的企业id对应的企业信息
  233. var companyid = $scope.companyid;
  234. // 获取参与企业详细信息
  235. var getCompanyInfo = function () {
  236. $scope.showLoadingToast();
  237. ActivityService.getCompanyInfo(companyid).then(function (response) {
  238. // console.log(response);
  239. if (angular.isDefined(response.company) && response.company.length > 0) {
  240. $scope.company = response.company[0];
  241. $scope.connEnterpriseModuleModel.company.logo = $scope.company.logo;
  242. $scope.connEnterpriseModuleModel.company.companyname = $scope.company.companyname;
  243. $scope.connEnterpriseModuleModel.company.categoryName = $scope.company.categoryname;
  244. $scope.connEnterpriseModuleModel.company.contact = $scope.company.contact;
  245. $scope.connEnterpriseModuleModel.company.contactnum = $scope.company.contactnum;
  246. $scope.connEnterpriseModuleModel.company.rdinstitutiontypeName = $scope.company.rdinstitutiontypename;
  247. $scope.connEnterpriseModuleModel.company.ishigh = $scope.company.ishigh;
  248. if($scope.connEnterpriseModuleModel.company.ishigh==1){
  249. $scope.connEnterpriseModuleModel.company.ishighInfo="是";
  250. $scope.connEnterpriseModuleModel.company.high=true;
  251. }else if($scope.connEnterpriseModuleModel.company.ishigh==0){
  252. $scope.connEnterpriseModuleModel.company.ishighInfo="否";
  253. $scope.connEnterpriseModuleModel.company.high=false;
  254. }
  255. }
  256. $scope.hideLoadingToast();
  257. }, function () {
  258. $scope.hideLoadingToast();
  259. })
  260. };
  261. getCompanyInfo();
  262. // 获取工程中心信息的通用年份配置列表
  263. var projectcenterinfoyearbuttons = [];
  264. var getProjectCenterInfoYearMultiSetupList = function () {
  265. TechnicalBrokerPublishTrainService.getYearMultiSetupList(3).then(function (response) {
  266. // console.log(response);
  267. if (UtilService.isDefined(response) && response.length > 0) {
  268. angular.forEach(response, function (value, index) {
  269. var temphtml = {
  270. text: '<a class="action-sheet-push">' + value.setupname + '</a>',
  271. yearsetupid: value.id,
  272. yearsetupname: value.setupname
  273. };
  274. projectcenterinfoyearbuttons.push(temphtml);
  275. });
  276. }
  277. }, function () {
  278. })
  279. };
  280. getProjectCenterInfoYearMultiSetupList();
  281. //选择工程中心信息的通用年份配置列表
  282. $scope.showProjectCenterInfoYearSetup = function (ind) {
  283. $ionicActionSheet.show({
  284. buttons: projectcenterinfoyearbuttons,
  285. cancelText: '取消',
  286. buttonClicked: function (index) {
  287. $scope.projectCenterInfoList[ind].yid = projectcenterinfoyearbuttons[index].yearsetupid;
  288. $scope.projectCenterInfoList[ind].yearsetupname = projectcenterinfoyearbuttons[index].yearsetupname;
  289. return true;
  290. }
  291. });
  292. };
  293. // 获取研发投入的通用年份配置列表
  294. var researchinfoyearbuttons = [];
  295. var getResearchInfoYearMultiSetupList = function () {
  296. TechnicalBrokerPublishTrainService.getYearMultiSetupList(1).then(function (response) {
  297. // console.log(response);
  298. if (UtilService.isDefined(response) && response.length > 0) {
  299. angular.forEach(response, function (value, index) {
  300. var temphtml = {
  301. text: '<a class="action-sheet-push">' + value.setupname + '</a>',
  302. yearsetupid: value.id,
  303. yearsetupname: value.setupname
  304. };
  305. researchinfoyearbuttons.push(temphtml);
  306. });
  307. }
  308. }, function () {
  309. })
  310. };
  311. getResearchInfoYearMultiSetupList();
  312. //选择研发投入的通用年份配置列表
  313. $scope.showResearchInfoYearSetup = function (ind) {
  314. $ionicActionSheet.show({
  315. buttons: researchinfoyearbuttons,
  316. cancelText: '取消',
  317. buttonClicked: function (index) {
  318. $scope.researchInfoList[ind].yid = researchinfoyearbuttons[index].yearsetupid;
  319. $scope.researchInfoList[ind].yearsetupname = researchinfoyearbuttons[index].yearsetupname;
  320. return true;
  321. }
  322. });
  323. };
  324. // 获取实际收入的通用年份配置列表
  325. var realinfoyearbuttons = [];
  326. var getRealInfoYearMultiSetupList = function () {
  327. TechnicalBrokerPublishTrainService.getYearMultiSetupList(2).then(function (response) {
  328. // console.log(response);
  329. if (UtilService.isDefined(response) && response.length > 0) {
  330. angular.forEach(response, function (value, index) {
  331. var temphtml = {
  332. text: '<a class="action-sheet-push">' + value.setupname + '</a>',
  333. yearsetupid: value.id,
  334. yearsetupname: value.setupname
  335. };
  336. realinfoyearbuttons.push(temphtml);
  337. });
  338. }
  339. }, function () {
  340. })
  341. };
  342. getRealInfoYearMultiSetupList();
  343. //选择实际收入的通用年份配置列表
  344. $scope.showRealInfoYearSetup = function (ind) {
  345. $ionicActionSheet.show({
  346. buttons: realinfoyearbuttons,
  347. cancelText: '取消',
  348. buttonClicked: function (index) {
  349. $scope.realInfoList[ind].yid = realinfoyearbuttons[index].yearsetupid;
  350. $scope.realInfoList[ind].yearsetupname = realinfoyearbuttons[index].yearsetupname;
  351. return true;
  352. }
  353. });
  354. };
  355. // 获取重大科研项目的通用年份配置列表
  356. var importantprojectbuttons = [];
  357. var getImportantProjectYearMultiSetupList = function () {
  358. TechnicalBrokerPublishTrainService.getYearMultiSetupList(4).then(function (response) {
  359. // console.log(response);
  360. if (UtilService.isDefined(response) && response.length > 0) {
  361. angular.forEach(response, function (value, index) {
  362. var temphtml = {
  363. text: '<a class="action-sheet-push">' + value.setupname + '</a>',
  364. yearsetupid: value.id,
  365. yearsetupname: value.setupname
  366. };
  367. importantprojectbuttons.push(temphtml);
  368. });
  369. }
  370. }, function () {
  371. })
  372. };
  373. getImportantProjectYearMultiSetupList();
  374. //选择重大科研项目的通用年份配置列表
  375. $scope.showImportantProjectYearSetup = function (ind) {
  376. $ionicActionSheet.show({
  377. buttons: importantprojectbuttons,
  378. cancelText: '取消',
  379. buttonClicked: function (index) {
  380. $scope.importantProjectList[ind].yid = importantprojectbuttons[index].yearsetupid;
  381. $scope.importantProjectList[ind].yearsetupname = importantprojectbuttons[index].yearsetupname;
  382. return true;
  383. }
  384. });
  385. };
  386. // 获取需求的合作模式列表
  387. var cooperationmodelbuttons = [];
  388. var getCooperationmodelList = function () {
  389. TechnicalBrokerPublishTrainService.getCooperationmodelList().then(function (response) {
  390. if (UtilService.isDefined(response) && response.length > 0) {
  391. angular.forEach(response, function (value, index) {
  392. var temphtml = {
  393. text: '<a class="action-sheet-push">' + value.itemkey + '</a>',
  394. cooperationmodel: value.itemvalue,
  395. cooperationmodelName: value.itemkey
  396. };
  397. cooperationmodelbuttons.push(temphtml);
  398. });
  399. // console.log(cooperationmodelbuttons);
  400. }
  401. }, function () {
  402. })
  403. };
  404. getCooperationmodelList();
  405. //选择需求的合作模式列表
  406. $scope.showCooperationmodelStatus = function (ind) {
  407. $ionicActionSheet.show({
  408. buttons: cooperationmodelbuttons,
  409. cancelText: '取消',
  410. buttonClicked: function (index) {
  411. $scope.demandInfoList[ind].cooperationmodel = cooperationmodelbuttons[index].cooperationmodel;
  412. $scope.demandInfoList[ind].cooperationmodelName = cooperationmodelbuttons[index].cooperationmodelName;
  413. return true;
  414. }
  415. });
  416. };
  417. // 获取需求的需求类型列表
  418. var techtypebuttons = [];
  419. var getTechtypeList = function () {
  420. TechnicalBrokerPublishTrainService.getTechtypeList().then(function (response) {
  421. if (UtilService.isDefined(response) && response.length > 0) {
  422. angular.forEach(response, function (value, index) {
  423. var temphtml = {
  424. text: '<a class="action-sheet-push">' + value.itemkey + '</a>',
  425. techtype: value.itemvalue,
  426. techtypename: value.itemkey
  427. };
  428. techtypebuttons.push(temphtml);
  429. });
  430. // console.log(cooperationmodelbuttons);
  431. }
  432. }, function () {
  433. })
  434. };
  435. getTechtypeList();
  436. //选择需求的需求类型
  437. $scope.showTechtype = function (ind) {
  438. $ionicActionSheet.show({
  439. buttons: techtypebuttons,
  440. cancelText: '取消',
  441. buttonClicked: function (index) {
  442. $scope.demandInfoList[ind].techtype = techtypebuttons[index].techtype;
  443. $scope.demandInfoList[ind].techtypename = techtypebuttons[index].techtypename;
  444. return true;
  445. }
  446. });
  447. };
  448. // 获取人才的学位列表
  449. var academicdegreebuttons = [];
  450. var getAcademicdegreeList = function () {
  451. TechnicalBrokerPublishTrainService.getAcademicdegreeList().then(function (response) {
  452. if (UtilService.isDefined(response) && response.length > 0) {
  453. angular.forEach(response, function (value, index) {
  454. var temphtml = {
  455. text: '<a class="action-sheet-push">' + value.itemkey + '</a>',
  456. academicdegree: value.itemvalue,
  457. academicdegreeName: value.itemkey
  458. };
  459. academicdegreebuttons.push(temphtml);
  460. });
  461. // console.log(academicdegreebuttons);
  462. }
  463. }, function () {
  464. })
  465. };
  466. getAcademicdegreeList();
  467. //选择人才的学位列表
  468. $scope.showAcademicdegreeStatus = function (ind) {
  469. $ionicActionSheet.show({
  470. buttons: academicdegreebuttons,
  471. cancelText: '取消',
  472. buttonClicked: function (index) {
  473. $scope.talentInfoList[ind].academicdegree = academicdegreebuttons[index].academicdegree;
  474. $scope.talentInfoList[ind].academicdegreeName = academicdegreebuttons[index].academicdegreeName;
  475. return true;
  476. }
  477. });
  478. };
  479. // 弹出获取企业logo
  480. //!******************* logo上传图片 *******************
  481. $scope.show_logo = function () {
  482. $ionicActionSheet.show({
  483. cancelOnStateChange: true,
  484. cssClass: 'action_s',
  485. cancelText: '取消',
  486. buttons: [
  487. {text: "拍照"},
  488. {text: "从相册上传"}
  489. ],
  490. buttonClicked: function (index) {
  491. if (index == 0) {
  492. openCamera(1,1);
  493. } else {
  494. openCamera(0,1);
  495. }
  496. return true;
  497. },
  498. destructiveButtonClicked: function () {
  499. return true;
  500. }
  501. });
  502. };
  503. var openCamera = function (srcType) {
  504. var options = {
  505. // Some common settings are 20, 50, and 100
  506. quality: 50,
  507. destinationType: Camera.DestinationType.FILE_URI,
  508. // In this app, dynamically set the picture source, Camera or photo gallery
  509. sourceType: srcType,
  510. encodingType: Camera.EncodingType.JPEG,
  511. mediaType: Camera.MediaType.PICTURE,
  512. allowEdit: false,
  513. correctOrientation: true //Corrects Android orientation quirks
  514. };
  515. navigator.camera.getPicture(function (imageData) {
  516. $scope.imgurl = imageData;
  517. $scope.showLoadingToast();
  518. UtilService.uploadFile([imageData], 0, "image/jpeg").then(function (response) {
  519. // 企业logo
  520. $scope.connEnterpriseModuleModel.company.logo = response[0].userPhoto;
  521. $scope.hideLoadingToast();
  522. }, function () {
  523. $scope.hideLoadingToast();
  524. });
  525. }, function (message) {
  526. }, options);
  527. };
  528. // ****** 单信息图片 ******
  529. $scope.openCamera = function () {
  530. if ($scope.imagelist.length >= 9) {
  531. UtilService.showMess("最多选取9张图片");
  532. return;
  533. }
  534. UtilService.getPicture(1).then(function (results) {
  535. // console.log(results);
  536. $scope.imagelist.push({photo_name: results, original_name: results});
  537. $scope.totalImglength = 600 * $scope.imagelist.length;
  538. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  539. }, function (err) {
  540. });
  541. };
  542. $scope.show = function () {
  543. $ionicActionSheet.show({
  544. buttons: [
  545. {text: '<a class="action-sheet-push">相册中添加照片</a>'},
  546. {text: '<a class="action-sheet-push">拍照</a>'}
  547. ],
  548. cancelText: '取消',
  549. buttonClicked: function (index) {
  550. if (index == 0) {
  551. getPictures();
  552. } else if (index == 1) {
  553. $scope.openCamera();
  554. }
  555. return true;
  556. }
  557. });
  558. };
  559. var verifyStorage = function () {
  560. window.imagePicker.verifyStorage(
  561. function (results) {
  562. if (results == "1") {
  563. getPic();
  564. }
  565. }, function (error) {
  566. }
  567. );
  568. };
  569. var getPic = function () {
  570. if ($scope.imagelist.length >= 9) {
  571. UtilService.showMess("最多选取9张图片");
  572. return;
  573. }
  574. UtilService.getPictureList(9 - $scope.imagelist.length).then(function (results) {
  575. // console.log(results);
  576. angular.forEach(results, function (value, index) {
  577. $scope.imagelist.push({photo_name: value, original_name: value})
  578. });
  579. $scope.totalImglength = 600 * $scope.imagelist.length;
  580. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  581. }, function (err) {
  582. });
  583. };
  584. var getPictures = function () {
  585. if (device.platform == "Android") {
  586. verifyStorage();
  587. } else {
  588. getPic();
  589. }
  590. };
  591. //点击图片放大
  592. $scope.bigImage = false; //初始默认大图是隐藏的
  593. $scope.hideBigImage = function () {
  594. if($scope.app){
  595. $scope.setStatusBar(0);
  596. }
  597. $timeout(function () {
  598. $scope.bigImage = false;
  599. }, 400);
  600. };
  601. $scope.shouBigImage = function (index) { //传递一个参数(图片的URl)
  602. if($scope.app){
  603. $scope.setStatusBar(1);
  604. }
  605. $(function () {
  606. $('div.pinch-zoom').each(function () {
  607. new RTP.PinchZoom($(this), {});
  608. });
  609. });
  610. $scope.bigImage = true;//显示大图
  611. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  612. //图片总数量
  613. setTimeout(function () {
  614. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -10);
  615. //获取图片
  616. var imgObj = document.getElementsByClassName('bigimage');
  617. var n;
  618. for (n = 0; n < imgObj.length; n++) {
  619. // 获取图片的原始高度和宽度
  620. var oldWid = imgObj[n].naturalWidth;
  621. var oldHei = imgObj[n].naturalHeight;
  622. var screen = document.body.offsetWidth;
  623. var screenH = window.innerHeight;
  624. // console.log(oldWid / oldHei);
  625. // console.log(screen);
  626. var cc = screen / (oldWid / oldHei);
  627. imgObj[n].style.height = cc + 'px';
  628. if (cc < screenH) {
  629. imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
  630. // console.log("e:"+imgObj[n].style.marginTop);
  631. } else {
  632. imgObj[n].style.marginTop = 0 + 'px';
  633. // console.log((cc-screenH) +'px')
  634. }
  635. }
  636. }, 10);
  637. };
  638. //删除图片
  639. $scope.deletePhoto = function (index) {
  640. $scope.imagelist.splice(index, 1);
  641. };
  642. // ****** 多模块图片 ******
  643. /*// 弹出获取产品图片
  644. $scope.showProductImage = function () {
  645. $ionicActionSheet.show({
  646. cancelOnStateChange: true,
  647. cssClass: 'action_s',
  648. cancelText: '取消',
  649. buttons: [
  650. {text: "拍照"},
  651. {text: "从相册上传"}
  652. ],
  653. buttonClicked: function (index) {
  654. if (index == 0) {
  655. openCamera(1,2);
  656. } else {
  657. openCamera(0,2);
  658. }
  659. return true;
  660. },
  661. destructiveButtonClicked: function () {
  662. return true;
  663. }
  664. });
  665. };
  666. // 弹出获取需求图片
  667. $scope.showDemandImage = function () {
  668. $ionicActionSheet.show({
  669. cancelOnStateChange: true,
  670. cssClass: 'action_s',
  671. cancelText: '取消',
  672. buttons: [
  673. {text: "拍照"},
  674. {text: "从相册上传"}
  675. ],
  676. buttonClicked: function (index) {
  677. if (index == 0) {
  678. openCamera(1,3);
  679. } else {
  680. openCamera(0,3);
  681. }
  682. return true;
  683. },
  684. destructiveButtonClicked: function () {
  685. return true;
  686. }
  687. });
  688. };
  689. //!******************* 各区块加图片 *******************
  690. $scope.openCamera = function (ind) {
  691. if ($scope.demandInfoList.demandInfoimagelist.length >= 9) {
  692. UtilService.showMess("最多选取9张图片");
  693. return;
  694. }
  695. UtilService.getPicture(1).then(function (results) {
  696. // console.log(results);
  697. $scope.demandInfoList[ind].demandInfoimagelist.push({photo_name: results, original_name: results});
  698. $scope.totalImglength = 600 * $scope.demandInfoList[ind].demandInfoimagelist.length;
  699. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  700. }, function (err) {
  701. });
  702. };
  703. $scope.show = function (ind) {
  704. $ionicActionSheet.show({
  705. buttons: [
  706. {text: '<a class="action-sheet-push">相册中添加照片</a>'},
  707. {text: '<a class="action-sheet-push">拍照</a>'}
  708. ],
  709. cancelText: '取消',
  710. buttonClicked: function (index) {
  711. if (index == 0) {
  712. getPictures(ind);
  713. } else if (index == 1) {
  714. $scope.openCamera(ind);
  715. }
  716. return true;
  717. }
  718. });
  719. };
  720. var getPictures = function (ind) {
  721. if (device.platform == "Android") {
  722. verifyStorage(ind);
  723. } else {
  724. getPic(ind);
  725. }
  726. };
  727. var verifyStorage = function (ind) {
  728. window.imagePicker.verifyStorage(
  729. function (results) {
  730. if (results == "1") {
  731. getPic(ind);
  732. }
  733. }, function (error) {
  734. }
  735. );
  736. };
  737. var getPic = function (ind) {
  738. //产品图片
  739. if ($scope.productInfoimagelist.length >= 9) {
  740. UtilService.showMess("最多选取9张图片");
  741. return;
  742. }
  743. UtilService.getPictureList(9 - $scope.productInfoimagelist.length).then(function (results) {
  744. // console.log(results);
  745. angular.forEach(results, function (value, index) {
  746. $scope.productInfoimagelist.push({photo_name: value, original_name: value})
  747. });
  748. $scope.totalImglength = 600 * $scope.productInfoimagelist.length;
  749. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  750. }, function (err) {
  751. });
  752. //需求图片
  753. if ($scope.demandInfoList[ind].demandInfoimagelist.length >= 9) {
  754. UtilService.showMess("最多选取9张图片");
  755. return;
  756. }
  757. UtilService.getPictureList(9 - $scope.demandInfoList[ind].demandInfoimagelist.length).then(function (results) {
  758. // console.log(results);
  759. angular.forEach(results, function (value, index) {
  760. $scope.pictotal = $scope.pictotal + 1;
  761. $scope.demandInfoList[ind].demandInfoimagelist.push({photo_name: value, original_name: value});
  762. });
  763. $scope.totalImglength = 600 * $scope.demandInfoList[ind].demandInfoimagelist.length;
  764. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  765. }, function (err) {
  766. });
  767. };
  768. //点击产品图片放大
  769. $scope.bigImageProduct=false; //初始默认大图是隐藏的
  770. $scope.hideBigImageProduct = function () {
  771. $scope.setStatusBar(0);
  772. $timeout(function () {
  773. $scope.bigImageProduct = false;
  774. }, 400);
  775. };
  776. //点击需求图片放大
  777. $scope.bigImageDemand=false; //初始默认大图是隐藏的
  778. $scope.hideBigImageProduct = function () {
  779. $scope.setStatusBar(0);
  780. $timeout(function () {
  781. $scope.bigImageDemand = false;
  782. }, 400);
  783. };
  784. $scope.shouBigImage = function (index) { //传递一个参数(图片的URl)
  785. $scope.setStatusBar(1);
  786. $(function () {
  787. $('div.pinch-zoom').each(function () {
  788. new RTP.PinchZoom($(this), {});
  789. });
  790. });
  791. $scope.bigImage = true;//显示大图
  792. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  793. //图片总数量
  794. setTimeout(function () {
  795. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -10);
  796. //获取图片
  797. var imgObj = document.getElementsByClassName('bigimage');
  798. var n;
  799. for (n = 0; n < imgObj.length; n++) {
  800. // 获取图片的原始高度和宽度
  801. var oldWid = imgObj[n].naturalWidth;
  802. var oldHei = imgObj[n].naturalHeight;
  803. var screen = document.body.offsetWidth;
  804. var screenH = window.innerHeight;
  805. // console.log(oldWid / oldHei);
  806. // console.log(screen);
  807. var cc = screen / (oldWid / oldHei);
  808. imgObj[n].style.height = cc + 'px';
  809. if (cc < screenH) {
  810. imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
  811. // console.log("e:"+imgObj[n].style.marginTop);
  812. } else {
  813. imgObj[n].style.marginTop = 0 + 'px';
  814. // console.log((cc-screenH) +'px')
  815. }
  816. }
  817. }, 10);
  818. };
  819. //删除产品图片
  820. $scope.deleteProductPhoto = function (index) {
  821. $scope.productInfoInfoimagelist.splice(index, 1);
  822. };
  823. //删除需求图片
  824. $scope.deleteDemandPhoto = function (ind, index) {
  825. $scope.pictotal = $scope.pictotal - 1;
  826. $scope.demandInfoList[ind].demandInfoimagelist.splice(index, 1);
  827. };
  828. */
  829. //选择企业产业领域
  830. var buttonsIndustryStatus = [
  831. {text: "汽车制造",
  832. stausName:"汽车制造",
  833. stausId: "A"
  834. },
  835. {text: "能源及节能技术",
  836. stausName:"能源及节能技术",
  837. stausId: "B"
  838. },
  839. {text: "新材料",
  840. stausName:"新材料",
  841. stausId: "C"
  842. },
  843. {text: "生物与新医药",
  844. stausName:"生物与新医药",
  845. stausId: "D"
  846. },
  847. {text: "电子信息",
  848. stausName:"电子信息",
  849. stausId: "E"
  850. },
  851. {text: "先进制造及高端装备",
  852. stausName:"先进制造及高端装备",
  853. stausId: "F"
  854. },
  855. {text: "资源及环境技术",
  856. stausName:"资源及环境技术",
  857. stausId: "G"
  858. }
  859. ];
  860. $scope.showIndustryStatus=function () {
  861. $ionicActionSheet.show({
  862. cancelOnStateChange: true,
  863. cssClass: 'action_s',
  864. cancelText: '取消',
  865. buttons: buttonsIndustryStatus,
  866. buttonClicked: function (index) {
  867. $scope.connEnterpriseModuleModel.company.categoryid = buttonsIndustryStatus[index].stausId;
  868. $scope.connEnterpriseModuleModel.company.categoryName = buttonsIndustryStatus[index].stausName;
  869. return true;
  870. },
  871. destructiveButtonClicked: function () {
  872. return true;
  873. }
  874. });
  875. };
  876. //选择研发机构等级
  877. var buttonsResearchStatus = [
  878. { text: "国家级",
  879. ResearchStatusName:"国家级",
  880. ResearchStatusId: "1"
  881. },
  882. { text: "省级",
  883. ResearchStatusName:"省级",
  884. ResearchStatusId: "2"
  885. },
  886. { text: "市级",
  887. ResearchStatusName:"市级",
  888. ResearchStatusId: "3"
  889. },
  890. { text: "区级",
  891. ResearchStatusName:"区级",
  892. ResearchStatusId: "4"
  893. }
  894. ];
  895. $scope.showResearchStatus=function () {
  896. $ionicActionSheet.show({
  897. cancelOnStateChange: true,
  898. cssClass: 'action_s',
  899. cancelText: '取消',
  900. buttons: buttonsResearchStatus,
  901. buttonClicked: function (index) {
  902. $scope.connEnterpriseModuleModel.company.rdinstitutiontype = buttonsResearchStatus[index].ResearchStatusId;
  903. $scope.connEnterpriseModuleModel.company.rdinstitutiontypeName = buttonsResearchStatus[index].ResearchStatusName;
  904. return true;
  905. },
  906. destructiveButtonClicked: function () {
  907. return true;
  908. }
  909. });
  910. };
  911. //选择需求标签
  912. var demandLabels = [
  913. { text: "标签A",
  914. demandLabelName:"标签A",
  915. demandLabelId: "0"
  916. },
  917. { text: "标签B",
  918. demandLabelName:"标签B",
  919. demandLabelId: "1"
  920. },
  921. { text: "标签C",
  922. demandLabelName:"标签C",
  923. demandLabelId: "2"
  924. },
  925. { text: "标签D",
  926. demandLabelName:"标签D",
  927. demandLabelId: "3"
  928. }
  929. ];
  930. $scope.showDemandLabelName=function () {
  931. $ionicActionSheet.show({
  932. cancelOnStateChange: true,
  933. cssClass: 'action_s',
  934. cancelText: '取消',
  935. buttons: demandLabels,
  936. buttonClicked: function (index) {
  937. $scope.demandInfoList.demandLabelId = demandLabels[index].demandLabelId;
  938. $scope.demandInfoList.demandLabelName = demandLabels[index].demandLabelName;
  939. return true;
  940. },
  941. destructiveButtonClicked: function () {
  942. return true;
  943. }
  944. });
  945. };
  946. //添加、删除更多一般产品
  947. $scope.AddOrDelProductInfo = function (ind) {
  948. if (ind == 0) {
  949. $scope.produceInfoList.push({
  950. id: 0,
  951. productname: "",// 产品名称
  952. productdescription: ""//产品描述
  953. });
  954. } else {
  955. if ($scope.produceInfoList[ind].id != 0) {
  956. delproductInfo.push($scope.produceInfoList[ind].id);
  957. }
  958. $scope.produceInfoList.splice(ind, 1);
  959. }
  960. };
  961. //添加、删除更多高新产品
  962. $scope.AddOrDelGreatProductInfo = function (ind) {
  963. if (ind == 0) {
  964. $scope.greatProduceInfoList.push({
  965. id: 0,
  966. productname: "",// 产品名称
  967. productdescription: ""//产品描述
  968. });
  969. } else {
  970. if ($scope.greatProduceInfoList[ind].id != 0) {
  971. delgreatProduceInfoList.push($scope.greatProduceInfoList[ind].id);
  972. }
  973. $scope.greatProduceInfoList.splice(ind, 1);
  974. }
  975. };
  976. //添加、删除更多工程中心信息
  977. $scope.AddOrDelProjectInfo = function (ind) {
  978. if (ind == 0) {
  979. $scope.projectCenterInfoList.push({
  980. id: 0,
  981. yid: 0,
  982. yearsetupname: "",//选择项名称
  983. yvalue1: ""
  984. });
  985. } else {
  986. if ($scope.projectCenterInfoList[ind].id != 0) {
  987. delprojectCenterInfo.push($scope.projectCenterInfoList[ind].id);
  988. }
  989. $scope.projectCenterInfoList.splice(ind, 1);
  990. }
  991. };
  992. //添加、删除更多研发投入信息
  993. $scope.AddOrDelResearchInfo = function (ind) {
  994. if (ind == 0) {
  995. $scope.researchInfoList.push({
  996. id: 0,
  997. yid: 0,
  998. yearsetupname: "",//选择项名称
  999. yvalue1: ""
  1000. });
  1001. } else {
  1002. if ($scope.researchInfoList[ind].id != 0) {
  1003. delresearchInfo.push($scope.researchInfoList[ind].id);
  1004. }
  1005. $scope.researchInfoList.splice(ind, 1);
  1006. }
  1007. };
  1008. //添加、删除更多实际研发与投入信息
  1009. $scope.AddOrDelrealInfoInfo= function (ind) {
  1010. if (ind == 0) {
  1011. $scope.realInfoList.push({
  1012. id: 0,
  1013. yid: 0,
  1014. yearsetupname: "",//选择项名称
  1015. yvalue1: "",
  1016. yvalue2: "",
  1017. yvalue3: ""
  1018. });
  1019. } else {
  1020. if ($scope.realInfoList[ind].id != 0) {
  1021. delrealInfo.push($scope.realInfoList[ind].id);
  1022. }
  1023. $scope.realInfoList.splice(ind, 1);
  1024. }
  1025. };
  1026. //添加、删除更多需求
  1027. $scope.AddOrDelDemandInfo = function (ind) {
  1028. if (ind == 0) {
  1029. $scope.demandInfoList.push({
  1030. ind: ind,// 索引值
  1031. id: 0,
  1032. companyid: 0,
  1033. techtype: 0,
  1034. techtypename: "",
  1035. techrequirementname: "",
  1036. cooperationmodel: "",
  1037. capital_scale: "",
  1038. techrequirementdetail: "",
  1039. images: "" // 图片
  1040. });
  1041. } else {
  1042. $scope.demandInfoList.splice(ind, 1);
  1043. }
  1044. };
  1045. //添加、删除更多重大科研项目
  1046. $scope.AddOrDelImportantProjectInfo = function (ind) {
  1047. if (ind == 0) {
  1048. $scope.importantProjectList.push({
  1049. id: 0,
  1050. yid: 0,
  1051. yearsetupname: "",//选择项名称
  1052. yvalue1: ""
  1053. });
  1054. } else {
  1055. if ($scope.importantProjectList[ind].id != 0) {
  1056. deldemandInfo.push($scope.importantProjectList[ind].id);
  1057. }
  1058. $scope.importantProjectList.splice(ind, 1);
  1059. }
  1060. };
  1061. //添加、删除更多项目建议
  1062. $scope.AddOrDelAdviceInfo= function (ind) {
  1063. if (ind == 0) {
  1064. $scope.adviceInfoList.push({
  1065. id: 0,
  1066. projectname: "",//
  1067. projectdescription: "",//
  1068. projectsuggest: ""// 申报项目建议
  1069. });
  1070. } else {
  1071. if ($scope.adviceInfoList[ind].id != 0) {
  1072. deladviceInfoList.push($scope.adviceInfoList[ind].id);
  1073. }
  1074. $scope.adviceInfoList.splice(ind, 1);
  1075. }
  1076. };
  1077. //添加、删除更多产学研经验
  1078. $scope.AddOrexperienceInfo= function (ind) {
  1079. if (ind == 0) {
  1080. $scope.experienceInfoList.push({
  1081. id: 0,
  1082. cooperateschool: "",// 合作院校
  1083. cooperatedetail: ""// 合作内容
  1084. });
  1085. } else {
  1086. if ($scope.experienceInfoList[ind].id != 0) {
  1087. delexperienceInfoList.push($scope.experienceInfoList[ind].id);
  1088. }
  1089. $scope.experienceInfoList.splice(ind, 1);
  1090. }
  1091. };
  1092. //添加、删除更多专利
  1093. $scope.AddOrDelpatentInfo= function (ind) {
  1094. if (ind == 0) {
  1095. $scope.patentInfoList.push({
  1096. id: 0,
  1097. intellectualpropertyname: "",// 名称
  1098. applyperson: "",// 主要完成人
  1099. licensenumber: "",// 申请号/授权号
  1100. // licensedate: ""// 授权日期
  1101. });
  1102. } else {
  1103. if ($scope.patentInfoList[ind].id != 0) {
  1104. delpatentInfoList.push($scope.patentInfoList[ind].id);
  1105. }
  1106. $scope.patentInfoList.splice(ind, 1);
  1107. }
  1108. };
  1109. //添加、删除更多人才信息
  1110. $scope.AddOrDelTalentInfo= function (ind) {
  1111. if (ind == 0) {
  1112. $scope.talentInfoList.push({
  1113. id: 0,
  1114. name: "",// 人才姓名
  1115. tel: "",// 手机号
  1116. position: "",// 职位
  1117. academicdegree: 0,// 学位
  1118. academicdegreeName: "",// 学位名称
  1119. responsible: "",// 负责工作
  1120. about: ""// 人才简介
  1121. });
  1122. } else {
  1123. if ($scope.talentInfoList[ind].id != 0) {
  1124. deltalentInfoList.push($scope.talentInfoList[ind].id);
  1125. }
  1126. $scope.talentInfoList.splice(ind, 1);
  1127. }
  1128. };
  1129. //保存企业信息表
  1130. var saveflg = 0;
  1131. $scope.saveCompanyInfo = function () {
  1132. // 基本信息
  1133. if (!UtilService.isDefined($scope.connEnterpriseModuleModel.company.companyname)) {
  1134. UtilService.showMess("请填写企业名称");
  1135. return;
  1136. }
  1137. if ($scope.connEnterpriseModuleModel.company.companyname.length > 255) {
  1138. UtilService.showMess("企业名称不能超过255个字");
  1139. return;
  1140. }
  1141. if ($scope.connEnterpriseModuleModel.company.contact.length > 255) {
  1142. UtilService.showMess("联系人不能超过255个字");
  1143. return;
  1144. }
  1145. if ($scope.connEnterpriseModuleModel.company.contactnum.length > 255) {
  1146. UtilService.showMess("联系方式不能超过255个字");
  1147. return;
  1148. }
  1149. var result = 1;
  1150. // 工程中心
  1151. if ($scope.projectCenterInfoList.length > 0) {
  1152. angular.forEach($scope.projectCenterInfoList, function (projectCenterInfoList,index) {
  1153. if ($scope.projectCenterInfoList[index].yvalue1.length > 255) {
  1154. result = 0;
  1155. }
  1156. });
  1157. if(result == 0){
  1158. UtilService.showMess("工程中心的年度情况不能超过255个字");
  1159. return;
  1160. }
  1161. }
  1162. // 研发投入
  1163. if ($scope.researchInfoList.length > 0) {
  1164. angular.forEach($scope.researchInfoList, function (researchInfoList,index) {
  1165. if (result == 1 && $scope.researchInfoList[index].yvalue1.length > 255) {
  1166. result = 0;
  1167. }
  1168. });
  1169. if(result == 0){
  1170. UtilService.showMess("研发投入的年度情况不能超过255个字");
  1171. return;
  1172. }
  1173. }
  1174. // 实际收入/预计投入
  1175. if ($scope.realInfoList.length > 0) {
  1176. angular.forEach($scope.realInfoList, function (realInfoList,index) {
  1177. if (result == 1 &&
  1178. ($scope.realInfoList[index].yvalue1.length > 255
  1179. || $scope.realInfoList[index].yvalue2.length > 255
  1180. || $scope.realInfoList[index].yvalue3.length > 255)) {
  1181. result = 0;
  1182. }
  1183. });
  1184. if(result == 0){
  1185. UtilService.showMess("实际收入/预计投入的销售收入、净利润和上缴税收不能超过255个字");
  1186. return;
  1187. }
  1188. }
  1189. // 产品信息
  1190. if ($scope.produceInfoList.length > 0) {
  1191. angular.forEach($scope.produceInfoList, function (produceInfoList,index) {
  1192. if (result == 1 && $scope.produceInfoList[index].productname.length > 255) {
  1193. result = 0;
  1194. }
  1195. });
  1196. if(result == 0){
  1197. UtilService.showMess("产品信息的产品名称不能超过255个字");
  1198. return;
  1199. }
  1200. }
  1201. // 高新产品信息
  1202. if ($scope.greatProduceInfoList.length > 0) {
  1203. angular.forEach($scope.greatProduceInfoList, function (greatProduceInfoList,index) {
  1204. if (result == 1 && $scope.greatProduceInfoList[index].productname.length > 255) {
  1205. result = 0;
  1206. }
  1207. });
  1208. if(result == 0){
  1209. UtilService.showMess("高新产品信息的产品名称不能超过255个字");
  1210. return;
  1211. }
  1212. }
  1213. // 需求信息
  1214. if ($scope.demandInfoList.length > 0) {
  1215. angular.forEach($scope.demandInfoList, function (demandInfoList,index) {
  1216. if (result == 1 &&
  1217. ($scope.demandInfoList[index].techrequirementname.length > 255
  1218. || $scope.demandInfoList[index].capital_scale.length > 255)) {
  1219. result = 0;
  1220. }
  1221. });
  1222. if(result == 0){
  1223. UtilService.showMess("需求信息的需求名称和投入预算不能超过255个字");
  1224. return;
  1225. }
  1226. }
  1227. // 重大科研项目
  1228. if ($scope.importantProjectList.length > 0) {
  1229. angular.forEach($scope.importantProjectList, function (importantProjectList,index) {
  1230. if (result == 1 && $scope.importantProjectList[index].yvalue1.length > 255) {
  1231. result = 0;
  1232. }
  1233. });
  1234. if(result == 0){
  1235. UtilService.showMess("重大科研项目的项目名称不能超过255个字");
  1236. return;
  1237. }
  1238. }
  1239. // 项目建议
  1240. if ($scope.adviceInfoList.length > 0) {
  1241. angular.forEach($scope.adviceInfoList, function (adviceInfoList,index) {
  1242. if (result == 1 && $scope.adviceInfoList[index].projectname.length > 255) {
  1243. result = 0;
  1244. }
  1245. });
  1246. if(result == 0){
  1247. UtilService.showMess("项目建议的项目名称不能超过255个字");
  1248. return;
  1249. }
  1250. }
  1251. // 产学研经验
  1252. if ($scope.experienceInfoList.length > 0) {
  1253. angular.forEach($scope.experienceInfoList, function (experienceInfoList,index) {
  1254. if (result == 1 && $scope.experienceInfoList[index].cooperateschool.length > 255) {
  1255. result = 0;
  1256. }
  1257. });
  1258. if(result == 0){
  1259. UtilService.showMess("产学研经验的已合作院校不能超过255个字");
  1260. return;
  1261. }
  1262. }
  1263. // 人才信息
  1264. if ($scope.talentInfoList.length > 0) {
  1265. angular.forEach($scope.talentInfoList, function (talentInfoList,index) {
  1266. if (result == 1 && $scope.talentInfoList[index].name.length > 50) {
  1267. result = 0;
  1268. }
  1269. if (result == 1 && $scope.talentInfoList[index].tel.length > 30) {
  1270. result = 2;
  1271. }
  1272. if (result == 1 && $scope.talentInfoList[index].position.length > 50) {
  1273. result = 3;
  1274. }
  1275. if (result == 1 && $scope.talentInfoList[index].responsible.length > 255) {
  1276. result = 4;
  1277. }
  1278. });
  1279. if(result == 0){
  1280. UtilService.showMess("人才信息的姓名不能超过50个字");
  1281. return;
  1282. }else if(result == 2){
  1283. UtilService.showMess("人才信息的联系方式不能超过30个字");
  1284. return;
  1285. }else if(result == 3){
  1286. UtilService.showMess("人才信息的职位不能超过50个字");
  1287. return;
  1288. }else if(result == 4){
  1289. UtilService.showMess("人才信息的负责工作不能超过255个字");
  1290. return;
  1291. }
  1292. }
  1293. // 专利信息
  1294. if ($scope.patentInfoList.length > 0) {
  1295. angular.forEach($scope.patentInfoList, function (patentInfoList,index) {
  1296. if (result == 1 && $scope.patentInfoList[index].intellectualpropertyname.length > 255) {
  1297. result = 0;
  1298. }
  1299. if (result == 1 && $scope.patentInfoList[index].applyperson.length > 255) {
  1300. result = 2;
  1301. }
  1302. if (result == 1 && $scope.patentInfoList[index].licensenumber.length > 255) {
  1303. result = 3;
  1304. }
  1305. });
  1306. if(result == 0){
  1307. UtilService.showMess("专利信息的名称不能超过255个字");
  1308. return;
  1309. }else if(result == 2){
  1310. UtilService.showMess("专利信息的主要完成人不能超过255个字");
  1311. return;
  1312. }else if(result == 3){
  1313. UtilService.showMess("专利信息的申请号/专利号不能超过255个字");
  1314. return;
  1315. }
  1316. }
  1317. if (saveflg != 0) {
  1318. return;
  1319. }
  1320. saveflg = 1;
  1321. $scope.showLoadingToast();
  1322. if ($scope.imagelist.length > 0) {
  1323. uploadImages();
  1324. } else {
  1325. saveInfo();
  1326. }
  1327. };
  1328. var tempimages = [];
  1329. var uploadImages = function () {
  1330. tempimages = [];
  1331. var upimages = [];
  1332. angular.forEach($scope.imagelist, function (data) {
  1333. upimages.push(data.photo_name);
  1334. });
  1335. UtilService.uploadFile(upimages, 0, "image/jpeg").then(function (response) {
  1336. // console.log(response);
  1337. angular.forEach(response, function (value) {
  1338. if (value.status) {
  1339. tempimages.push({
  1340. id: 0,
  1341. title: "",
  1342. photo_name: value.userPhoto,
  1343. original_name: value.originalPhoto,
  1344. source_name: value.sourcePhoto,
  1345. source_size: value.source_size
  1346. });
  1347. }
  1348. });
  1349. $timeout(function () {
  1350. saveInfo();
  1351. }, 100);
  1352. }, function () {
  1353. $scope.hideLoadingToast();
  1354. UtilService.showMess("网络不给力,请重试");
  1355. saveflg = 0;
  1356. })
  1357. };
  1358. // 保存企业信息
  1359. var saveInfo = function () {
  1360. // 需求
  1361. if ($scope.demandInfoList.length > 0) {
  1362. angular.forEach($scope.demandInfoList, function (demandInfoList,$index) {
  1363. if (!UtilService.isDefined($scope.demandInfoList[$index].techrequirementname)
  1364. && !UtilService.isDefined($scope.demandInfoList[$index].techrequirementdetail)
  1365. && !UtilService.isDefined($scope.demandInfoList[$index].techtypename)
  1366. && !UtilService.isDefined($scope.demandInfoList[$index].cooperationmodelName)
  1367. && !UtilService.isDefined($scope.demandInfoList[$index].capital_scale)) {
  1368. $scope.demandInfoList.splice($index, 1);
  1369. }
  1370. });
  1371. }
  1372. $scope.connEnterpriseModuleModel.techrequirelistJson = JSON.stringify($scope.demandInfoList);
  1373. // 工程中心
  1374. if ($scope.projectCenterInfoList.length > 0) {
  1375. angular.forEach($scope.projectCenterInfoList, function (projectCenterInfoList,$index) {
  1376. if (!UtilService.isDefined($scope.projectCenterInfoList[$index].yearsetupname)
  1377. && !UtilService.isDefined($scope.projectCenterInfoList[$index].yvalue1)) {
  1378. $scope.projectCenterInfoList.splice($index, 1);
  1379. }
  1380. });
  1381. }
  1382. $scope.connEnterpriseModuleModel.projectCenterInfoListJson = JSON.stringify($scope.projectCenterInfoList);
  1383. // 研发投入
  1384. if ($scope.researchInfoList.length > 0) {
  1385. angular.forEach($scope.researchInfoList, function (researchInfoList,$index) {
  1386. if (!UtilService.isDefined($scope.researchInfoList[$index].yearsetupname)
  1387. && !UtilService.isDefined($scope.researchInfoList[$index].yvalue1)) {
  1388. $scope.researchInfoList.splice($index, 1);
  1389. }
  1390. });
  1391. }
  1392. $scope.connEnterpriseModuleModel.researchInfoListJson = JSON.stringify($scope.researchInfoList);
  1393. // 实际收入
  1394. if ($scope.realInfoList.length > 0) {
  1395. angular.forEach($scope.realInfoList, function (realInfoList,$index) {
  1396. if (!UtilService.isDefined($scope.realInfoList[$index].yearsetupname)
  1397. && !UtilService.isDefined($scope.realInfoList[$index].yvalue1)
  1398. && !UtilService.isDefined($scope.realInfoList[$index].yvalue2)
  1399. && !UtilService.isDefined($scope.realInfoList[$index].yvalue3)) {
  1400. $scope.realInfoList.splice($index, 1);
  1401. }
  1402. });
  1403. }
  1404. $scope.connEnterpriseModuleModel.realInfoListJson = JSON.stringify($scope.realInfoList);
  1405. // 产品信息
  1406. if ($scope.produceInfoList.length > 0) {
  1407. angular.forEach($scope.produceInfoList, function (produceInfoList,$index) {
  1408. if (!UtilService.isDefined($scope.produceInfoList[$index].productname)
  1409. && !UtilService.isDefined($scope.produceInfoList[$index].productdescription)) {
  1410. $scope.produceInfoList.splice($index, 1);
  1411. }
  1412. });
  1413. }
  1414. $scope.connEnterpriseModuleModel.produceInfoListJson = JSON.stringify($scope.produceInfoList);
  1415. // 高新产品
  1416. if ($scope.greatProduceInfoList.length > 0) {
  1417. angular.forEach($scope.greatProduceInfoList, function (greatProduceInfoList,$index) {
  1418. if (!UtilService.isDefined($scope.greatProduceInfoList[$index].productname)
  1419. && !UtilService.isDefined($scope.greatProduceInfoList[$index].productdescription)) {
  1420. $scope.greatProduceInfoList.splice($index, 1);
  1421. }
  1422. });
  1423. }
  1424. $scope.connEnterpriseModuleModel.greatProduceInfoListJson = JSON.stringify($scope.greatProduceInfoList);
  1425. // 重大科研项目
  1426. if ($scope.importantProjectList.length > 0) {
  1427. angular.forEach($scope.importantProjectList, function (importantProjectList,$index) {
  1428. if (!UtilService.isDefined($scope.importantProjectList[$index].yearsetupname)
  1429. && !UtilService.isDefined($scope.importantProjectList[$index].yvalue1)) {
  1430. $scope.importantProjectList.splice($index, 1);
  1431. }
  1432. });
  1433. }
  1434. $scope.connEnterpriseModuleModel.importantProjectListJson = JSON.stringify($scope.importantProjectList);
  1435. // 申报项目建议
  1436. if ($scope.adviceInfoList.length > 0) {
  1437. angular.forEach($scope.adviceInfoList, function (adviceInfoList,$index) {
  1438. if (!UtilService.isDefined($scope.adviceInfoList[$index].projectname)
  1439. && !UtilService.isDefined($scope.adviceInfoList[$index].projectdescription)
  1440. && !UtilService.isDefined($scope.adviceInfoList[$index].projectsuggest)) {
  1441. $scope.adviceInfoList.splice($index, 1);
  1442. }
  1443. });
  1444. }
  1445. $scope.connEnterpriseModuleModel.adviceInfoListJson = JSON.stringify($scope.adviceInfoList);
  1446. // 产学研经验
  1447. if ($scope.experienceInfoList.length > 0) {
  1448. angular.forEach($scope.experienceInfoList, function (experienceInfoList,$index) {
  1449. if (!UtilService.isDefined($scope.experienceInfoList[$index].cooperateschool)
  1450. && !UtilService.isDefined($scope.experienceInfoList[$index].cooperatedetail)) {
  1451. $scope.experienceInfoList.splice($index, 1);
  1452. }
  1453. });
  1454. }
  1455. $scope.connEnterpriseModuleModel.experienceInfoListJson = JSON.stringify($scope.experienceInfoList);
  1456. // 人才
  1457. if ($scope.talentInfoList.length > 0) {
  1458. angular.forEach($scope.talentInfoList, function (talentInfoList,$index) {
  1459. if (!UtilService.isDefined($scope.talentInfoList[$index].name)
  1460. && !UtilService.isDefined($scope.talentInfoList[$index].tel)
  1461. && !UtilService.isDefined($scope.talentInfoList[$index].position)
  1462. && !UtilService.isDefined($scope.talentInfoList[$index].academicdegreeName)
  1463. && !UtilService.isDefined($scope.talentInfoList[$index].responsible)
  1464. && !UtilService.isDefined($scope.talentInfoList[$index].about)) {
  1465. $scope.talentInfoList.splice($index, 1);
  1466. }
  1467. });
  1468. }
  1469. $scope.connEnterpriseModuleModel.talentInfoListJson = JSON.stringify($scope.talentInfoList);
  1470. // 专利
  1471. if ($scope.patentInfoList.length > 0) {
  1472. angular.forEach($scope.patentInfoList, function (patentInfoList,$index) {
  1473. if (!UtilService.isDefined($scope.patentInfoList[$index].intellectualpropertyname)
  1474. && !UtilService.isDefined($scope.patentInfoList[$index].applyperson)
  1475. && !UtilService.isDefined($scope.patentInfoList[$index].licensenumber)) {
  1476. $scope.patentInfoList.splice($index, 1);
  1477. }
  1478. });
  1479. }
  1480. $scope.connEnterpriseModuleModel.intellectualListJson = JSON.stringify($scope.patentInfoList);
  1481. // 所属文件夹
  1482. $scope.connEnterpriseModuleModel.claid = $scope.checkfolder;
  1483. // 任务id
  1484. $scope.connEnterpriseModuleModel.taskid = $scope.taskid;
  1485. // 企业图片
  1486. $scope.connEnterpriseModuleModel.company.images = JSON.stringify(tempimages);
  1487. // console.log($scope.connEnterpriseModuleModel);
  1488. TechnicalBrokerPublishTrainService.saveCompanyInfo($scope.connEnterpriseModuleModel, tempimages).then(function (response) {
  1489. // console.log(response);
  1490. if (response.result == 1) {
  1491. UtilService.showMess("添加成功");
  1492. $timeout(function () {
  1493. // $scope.goback();
  1494. // 添加成功后跳入我的录入
  1495. $scope.go("technicalBrokerEnterCompanyInfo");
  1496. }, 1500);
  1497. } else {
  1498. UtilService.showMess("网络不给力,请重试");
  1499. }
  1500. $scope.hideLoadingToast();
  1501. saveflg = 0;
  1502. }, function () {
  1503. UtilService.showMess("网络不给力,请重试");
  1504. $scope.hideLoadingToast();
  1505. saveflg = 0;
  1506. })
  1507. };
  1508. // 自定义新建分类弹窗
  1509. $scope.showPopup = function () {
  1510. $ionicPopup.show({
  1511. template: "<div style='height: 70px;'>" +
  1512. "<input type='text' maxlength='20' ng-model='folder.name' style='border-radius:4px;border:1px solid #e9e9ea;text-indent: 11px;'>" +
  1513. "<span class='pop_subtitle'>20个字以内,支持中英文,数字。</span>" +
  1514. "</div>",
  1515. title: '新建文件夹',
  1516. scope: $scope,
  1517. buttons: [
  1518. {
  1519. text: '取消',
  1520. type: 'button-default',
  1521. onTap: function () {
  1522. $scope.folder.name = "";
  1523. }
  1524. },
  1525. {
  1526. text: '<span class="pop_right_button">创建</span>',
  1527. type: 'button-positive',
  1528. onTap: function (e) {
  1529. if (!UtilService.isDefined($scope.folder.name)) {
  1530. UtilService.showMess("文件夹名称不能为空");
  1531. e.preventDefault();
  1532. return;
  1533. }
  1534. if ($scope.folder.name == "默认文件夹") {
  1535. UtilService.showMess("默认文件夹已存在");
  1536. e.preventDefault();
  1537. return;
  1538. }
  1539. createFolder();
  1540. }
  1541. }
  1542. ]
  1543. });
  1544. };
  1545. $ionicModal.fromTemplateUrl('templates/modal.html', {
  1546. scope: $scope,
  1547. animation: 'slide-in-up'
  1548. }).then(function (modal) {
  1549. $scope.modal = modal;
  1550. });
  1551. $scope.folder = {name: ""};
  1552. //新建分类
  1553. var crfoflg = 0;
  1554. var createFolder = function () {
  1555. if (crfoflg != 0) {
  1556. return;
  1557. }
  1558. crfoflg = 1;
  1559. var tempdate = UtilService.formatDate();
  1560. var folder = {
  1561. localid: tempdate.timestamp + "",//本地id
  1562. id: 0,
  1563. userid: UserService.id,
  1564. usercomefrom: ConfigService.comefrom,
  1565. name: $scope.folder.name,
  1566. createtime: tempdate.formattime,
  1567. status: 0,
  1568. isCloud: 0,
  1569. synchrotype: 1,// 0:已同步,1:新增,2:修改,3:逻辑删除,4:物理删除
  1570. updatetime: tempdate.formattime,//修改时间
  1571. counts: 0
  1572. };
  1573. SqliteStorageService.insertSingleData("conninfofolder", folder).then(function (response) {
  1574. $scope.folderlist.push(folder);
  1575. $scope.checkdefolder = folder;
  1576. $scope.folder.name = "";
  1577. $scope.modal.hide();
  1578. ModelService.setLocalFolderList($scope.folderlist);
  1579. ModelService.setCheckdeFolder(folder);
  1580. SqliteStorageService.updateEditFlg(1);
  1581. $timeout(function () {
  1582. crfoflg = 0;
  1583. }, 1000);
  1584. }, function () {
  1585. crfoflg = 0;
  1586. });
  1587. };
  1588. //筛选选择文件夹
  1589. angular.forEach($scope.folderlist, function (value, index) {
  1590. if (value.id == $scope.checkdefolder.id) {
  1591. $scope.folderlist[index].value = true;
  1592. }
  1593. });
  1594. //选择分类
  1595. $scope.chooseNewUndid = function (folder, index) {
  1596. angular.forEach($scope.folderlist, function (value, ind) {
  1597. $scope.folderlist[ind].value = false;
  1598. });
  1599. $scope.folderlist[index].value = true;
  1600. $scope.checkdefolder = folder;
  1601. $scope.checkfolder = folder.id + "";
  1602. $scope.modal.hide();
  1603. };
  1604. //返回上一级目录
  1605. $scope.backUpperFolder = function () {
  1606. ModelService.deleteSelectLevelList($scope.level);
  1607. $scope.level--;
  1608. if ($scope.level == 0) {
  1609. $scope.folderlist = angular.copy(ModelService.getCloudFolderList());
  1610. } else {
  1611. var tempfolder = ModelService.getSelectLevelList()[$scope.level];
  1612. queryCloudFolder(tempfolder);
  1613. $scope.currentfoldername = tempfolder.name;
  1614. }
  1615. $scope.checkfolder = "";
  1616. };
  1617. //打开下一级目录
  1618. $scope.openNextFolder = function (folder) {
  1619. $scope.currentfoldername = folder.name;
  1620. $scope.folderlist = [];
  1621. $scope.level = folder.level + 1;
  1622. queryCloudFolder(folder);
  1623. $scope.checkfolder = "";
  1624. };
  1625. //查询云子文件夹
  1626. var queryCloudFolder = function (folder) {
  1627. DockingService.newGetConnInfoList(folder.id, folder.level, 1).then(function (response) {
  1628. // console.log(response);
  1629. $scope.folderlist = response.connFolderlist;
  1630. }, function () {
  1631. })
  1632. };
  1633. //关联相关企业
  1634. $scope.isRelateUl = false;
  1635. $scope.queryLikeName = function () {
  1636. if ($scope.connEnterpriseModuleModel.company.companyname.length == 0) {
  1637. $scope.companylist = [];
  1638. $scope.isRelateUl = false;
  1639. return;
  1640. }
  1641. DockingService.getCampanyListByName($scope.connEnterpriseModuleModel.company.companyname).then(function (response) {
  1642. // console.log(response);
  1643. $scope.companylist = response.companylist;
  1644. $scope.isRelateUl = true;
  1645. }, function () {
  1646. })
  1647. };
  1648. //选中企业
  1649. $scope.setCompanyName = function (company) {
  1650. //<b style='color:red;font-weight: normal;'>亚</b>
  1651. company.companyname = company.companyname.replace("<b style='color:red;font-weight: normal;'>", "");
  1652. company.companyname = company.companyname.replace("</b>", "");
  1653. $scope.connEnterpriseModuleModel.company.companyname = company.companyname;
  1654. $scope.connEnterpriseModuleModel.company.logo = company.logo;
  1655. $scope.connEnterpriseModuleModel.company.contact = company.contact;
  1656. $scope.connEnterpriseModuleModel.company.contactnum = company.contactnum;
  1657. $scope.connEnterpriseModuleModel.company.category = company.category;
  1658. $scope.connEnterpriseModuleModel.company.categoryName = company.categoryname;
  1659. $scope.connEnterpriseModuleModel.company.rdinstitutiontype = company.rdinstitutiontype;
  1660. $scope.connEnterpriseModuleModel.company.rdinstitutiontypeName = company.rdinstitutiontypename;
  1661. $scope.connEnterpriseModuleModel.company.ishigh = company.ishigh;
  1662. if($scope.connEnterpriseModuleModel.company.ishigh==1){
  1663. $scope.connEnterpriseModuleModel.company.ishighInfo="是";
  1664. $scope.connEnterpriseModuleModel.company.high=true;
  1665. }else if($scope.connEnterpriseModuleModel.company.ishigh==0){
  1666. $scope.connEnterpriseModuleModel.company.ishighInfo="否";
  1667. $scope.connEnterpriseModuleModel.company.high=false;
  1668. }
  1669. $scope.isRelateUl = false;
  1670. };
  1671. });