toDeclareCtrl.js 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480
  1. /**
  2. * Created by pushkeji on 2018/8/16.
  3. */
  4. angular.module('push')
  5. .controller('toDeclareCtrl', function ($scope, $stateParams, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, dataToolsService, $sce, AccountService, UserService, $ionicSlideBoxDelegate, $timeout, $state, $http, ConfigService, CommonService, $ionicPopup, ResourceLibraryService, taskModuleService, ScienceCircleService, $ionicModal, $q, ionicDatePicker) {
  6. console.log($stateParams);
  7. // 弹出任务邀请框
  8. $scope.tempData = {};
  9. $scope.node = UserService.node;
  10. $stateParams.list=JSON.parse($stateParams.list)
  11. $scope.list = $stateParams.list;
  12. console.log( $stateParams)
  13. $scope.by2 = $stateParams.by2;
  14. $scope.imageList1 = [];
  15. $scope.imageList2 = [];
  16. $scope.imageList3 = [];
  17. $scope.imageList4 = [];
  18. $scope.imageList5 = [];
  19. $scope.policeinfoid = ($scope.by2 == 'technical' ? '2' : $scope.by2 == 'broker' ? '1' : $scope.by2 == 'subsidy' ? '3' : '');
  20. $scope.picturelist = $stateParams.picturelist;
  21. var userid=$stateParams.list.creator?$stateParams.list.creator:UserService.id
  22. AccountService.getAuthorizationLetterList(userid, UserService.node).then(function (res) {
  23. console.log(res)
  24. if (res.data.length > 0) {
  25. $scope.companylist = res.data;
  26. // $scope.comnpanyoriginname = res.data[0].applyname;
  27. // $scope.content=res.data[0].applyname;
  28. $scope.orgid=res.data[0].orgid
  29. var id
  30. if($stateParams.list.title=='研发后补助申报'||$stateParams.list.restype==1611726857){
  31. id=$stateParams.list.researchCostId
  32. $scope.viewtitle='申报研发后补助'
  33. }else {
  34. id=$stateParams.list.technicalcontractid
  35. $scope.viewtitle='申报产学研合作补助'
  36. }
  37. console.log(id)
  38. if(id&&$stateParams.list.restype){
  39. ResourceLibraryService.getresearchcostdetail(id,$stateParams.list.restype).then(function (res) {
  40. console.log(res)
  41. if (res.code == 3350) {
  42. $scope.echolist = res.data;
  43. $scope.picturelist=JSON.parse(res.data.images)
  44. angular.forEach($scope.picturelist, function (val) {
  45. if (val.remark == "经技术合同登记的产学研合作合同(技术开发、技术转让、技术咨询、技术服务)"||val.remark == "A000000基础信息表") {
  46. $scope.imageList1.push(val)
  47. }
  48. if (val.remark == "发票"||val.remark == "A107012研发费用加计扣除优惠明细表") {
  49. $scope.imageList2.push(val)
  50. }
  51. if (val.remark == "支付凭证(银行转账凭证)"||val.remark == "A107012研发费用加计扣除优惠明细表") {
  52. $scope.imageList3.push(val)
  53. }
  54. if (val.remark == "结果凭证(结题报告、进度报告等)"||val.remark == "上传法定代表人授权委托书") {
  55. $scope.imageList4.push(val)
  56. }
  57. if (val.remark == "法定代表人授权委托书"||val.remark == "上传材料真实性承诺书") {
  58. $scope.imageList5.push(val)
  59. }
  60. })
  61. f()
  62. }
  63. })
  64. }else {
  65. f()
  66. }
  67. }
  68. });
  69. if ($scope.node == '330122000') {
  70. $scope.agree = 1;
  71. } else {
  72. $scope.agree = true;
  73. }
  74. if (UserService.user.data == null || UserService.user.data == undefined || UserService.user.data == "") {
  75. $scope.mobile = UserService.user.mobile;
  76. } else {
  77. $scope.mobile = UserService.user.data.mobile;
  78. }
  79. $scope.index = 0;
  80. var permissionvalue = "1";
  81. $scope.url = 'http://pic.ubittc.com/group2/M00/03/B7/wKjIKluVD3OAfkH4AAA74dltjKY89.docx';
  82. $scope.alertInfo = function () {
  83. // CommonService.showMessage('请在电脑端下载打印',$scope)
  84. if ($scope.app) {
  85. $ionicPopup.alert({
  86. title: '提示',
  87. template: '《企业认证申请公函》请在电脑端下载打印,并加盖企业公章后上传。电脑端web网址:ubittc.com'
  88. });
  89. }
  90. }
  91. if ($scope.app) {
  92. $scope.url = '';
  93. // $scope.alertInfo()
  94. }
  95. if ($stateParams.pageTitle) {
  96. $scope.pageTitle = $stateParams.pageTitle;
  97. } else {
  98. $scope.pageTitle = sessionStorage.indentifyDetailTitle;
  99. }
  100. if ($stateParams.code) {
  101. $scope.code = $stateParams.code;
  102. } else {
  103. $scope.code = sessionStorage.indentifyDetailCode;
  104. }
  105. $scope.action = $stateParams.action;
  106. $scope.type = $stateParams.type;
  107. // console.log($stateParams);
  108. // console.log($scope.pageTitle,$scope.code,$scope.action);
  109. // if($stateParams.type=){
  110. // $scope.type=$stateParams.type;
  111. // }else{
  112. // $scope.type=sessionStorage.type;
  113. // }
  114. $scope.orgid = null;
  115. $scope.showNew = false;
  116. $scope.showHistory = false;
  117. $scope.showFinish = false;
  118. $scope.showReject = false;
  119. $scope.refusereason = '';
  120. if ($stateParams.type == 5100) {
  121. $scope.showNew = true;
  122. } else if ($stateParams.type == 5101 || $stateParams.type == 0 || $scope.action == 'check' || $stateParams.type == 5102 || $stateParams.type == 5103) {
  123. $scope.showHistory = true;
  124. if ($stateParams.type == 5102 || $stateParams.type == 5103) {
  125. $scope.showFinish = true;
  126. }
  127. if ($stateParams.type == 5103) {
  128. $scope.showReject = true;
  129. }
  130. }
  131. function f() {
  132. var a = [
  133. {
  134. title: '企业名称',
  135. placeholder: '请选择企业名称',
  136. fuzzyQuery: true,
  137. content: $scope.echolist?$scope.echolist.buyorgname:'',
  138. type: 'companySelect',
  139. needed: true,
  140. saveKey: 'buyorgname',
  141. }, {
  142. title: '企业类别',
  143. placeholder: '请选择企业类别',
  144. content: $scope.echolist?$scope.echolist.orgtype == '8311' ? '高新潜力企业' : $scope.echolist.orgtype == '8310' ? '科技型初创企业' : $scope.echolist.orgtype == '8301' ? '国家高新技术企业' : $scope.echolist.orgtype == '8312' ? '创新引领企业' : $scope.echolist.orgtype == '8307' ? '其他企业': "":"",
  145. key: '',
  146. type: 'selectorgtype',
  147. needed: true,
  148. saveKey: 'orgtype',
  149. }, {
  150. title: '合同名称',
  151. placeholder: '请填写合同名称',
  152. fuzzyQuery: false,
  153. content: $scope.echolist? $scope.echolist.projectname : '',
  154. type: 'input',
  155. needed: true,
  156. saveKey: 'projectname',
  157. }, {
  158. title: '合同金额(万)',
  159. placeholder: '请填写',
  160. fuzzyQuery: false,
  161. regex:"number",
  162. content: $scope.echolist? $scope.echolist.contractamount : '',
  163. type: 'input',
  164. needed: true,
  165. saveKey: 'contractamount',
  166. }, {
  167. title: '当年实际支付金额(万)',
  168. placeholder: '请填写',
  169. fuzzyQuery: false,
  170. regex:"number",
  171. content: $scope.echolist ? $scope.echolist.actualamountpaid : '',
  172. type: 'input',
  173. needed: true,
  174. saveKey: 'actualamountpaid',
  175. }, {
  176. title: '当年实际支付的除税金额(万)(增值税普通发票不需要除税)',
  177. placeholder: '请填写',
  178. fuzzyQuery: false,
  179. regex:"number",
  180. content: $scope.echolist? $scope.echolist.actualamountpaidexcepttax : '',
  181. type: 'input',
  182. needed: true,
  183. saveKey: 'actualamountpaidexcepttax',
  184. }, {
  185. title: '合作方名称',
  186. placeholder: '请填写合作方名称',
  187. content: $scope.echolist? $scope.echolist.sellorgname : '',
  188. type: 'input',
  189. needed: true,
  190. saveKey: 'sellorgname',
  191. }, {
  192. title: '发票号码',
  193. placeholder: '请填写发票号码',
  194. regex:"number",
  195. content: $scope.echolist ? $scope.echolist.invoicenumber : '',
  196. type: 'input',
  197. needed: true,
  198. saveKey: 'invoicenumber',
  199. }, {
  200. title: '发票代码',
  201. placeholder: '请填写发票代码',
  202. regex:"number",
  203. content: $scope.echolist? $scope.echolist.invoicecode : '',
  204. type: 'input',
  205. needed: true,
  206. saveKey: 'invoicecode',
  207. }, {
  208. title: '经技术合同登记的产学研合作合同(技术开发、技术转让、技术咨询、技术服务)',
  209. content: '',
  210. type: 'upload',
  211. needed: true,
  212. imagelist: [],
  213. imageSaveList: $scope.imageList1 ? $scope.imageList1 : '[]',
  214. imageDeleteList: [],
  215. doctype: 4903,
  216. remarkType: 'normal',
  217. }, {
  218. title: '发票',
  219. content: '',
  220. type: 'upload',
  221. needed: true,
  222. imagelist: [],
  223. imageSaveList: $scope.imageList2 ? $scope.imageList2 : '[]',
  224. imageDeleteList: [],
  225. doctype: 4908,
  226. remarkType: 'normal'
  227. }, {
  228. title: '支付凭证(银行转账凭证)',
  229. content: '',
  230. type: 'upload',
  231. needed: true,
  232. imagelist: [],
  233. imageSaveList: $scope.imageList3 ? $scope.imageList3 : '[]',
  234. imageDeleteList: [],
  235. doctype: 4908,
  236. remarkType: 'normal'
  237. }, {
  238. title: '结果凭证(结题报告、进度报告等)',
  239. content:'' ,
  240. type: 'upload',
  241. needed: true,
  242. imagelist: [],
  243. imageSaveList: $scope.imageList4 ? $scope.imageList4 : '[]',
  244. imageDeleteList: [],
  245. doctype: 4908,
  246. remarkType: 'normal'
  247. }, {
  248. title: '法定代表人授权委托书',
  249. content: '',
  250. type: 'upload',
  251. needed: true,
  252. imagelist: [],
  253. imageSaveList: $scope.imageList5 ? $scope.imageList5 : '[]',
  254. imageDeleteList: [],
  255. doctype: 4908,
  256. remarkType: 'add'
  257. },
  258. ];
  259. var b = [
  260. {
  261. title: '企业名称',
  262. placeholder: '请选择企业名称',
  263. fuzzyQuery: true,
  264. content: $scope.echolist?$scope.echolist.orgName:'',
  265. type: 'companySelect',
  266. needed: true,
  267. saveKey: 'orgName',
  268. }, {
  269. title: '社会统一信用代码',
  270. placeholder: '请填写社会统一信用代码',
  271. content: $scope.echolist?$scope.echolist.orgCode:'',
  272. regex:true,
  273. type: 'input',
  274. needed: true,
  275. saveKey: 'orgCode',
  276. }, {
  277. title: '申报人姓名',
  278. placeholder: '请填写申报人姓名',
  279. fuzzyQuery: false,
  280. content: $scope.echolist? $scope.echolist.applicantName : '',
  281. type: 'input',
  282. needed: true,
  283. saveKey: 'applicantName',
  284. }, {
  285. title: '联系电话',
  286. placeholder: '请填写联系电话',
  287. fuzzyQuery: false,
  288. regex:"phone",
  289. content: $scope.echolist? $scope.echolist.applicantContact : '',
  290. type: 'input',
  291. needed: true,
  292. saveKey: 'applicantContact',
  293. }, {
  294. title: '近三年企业研发费用',
  295. fuzzyQuery: false,
  296. type: 'group',
  297. needed: true,
  298. form:[
  299. {
  300. title: new Date().getFullYear()-1,
  301. placeholder: '请输入',
  302. fuzzyQuery: false,
  303. regex:"number",
  304. content: $scope.echolist? $scope.echolist.pastOneResearchMoney : '',
  305. type: 'companySelect',
  306. needed: true,
  307. saveKey: 'pastOneResearchMoney',
  308. }, {
  309. title: new Date().getFullYear()-2,
  310. placeholder: '请输入',
  311. fuzzyQuery: false,
  312. regex:"number",
  313. content: $scope.echolist? $scope.echolist.pastThreeResearchMoney : '',
  314. type: 'companySelect',
  315. needed: true,
  316. saveKey: 'pastThreeResearchMoney',
  317. }, {
  318. title: new Date().getFullYear()-3,
  319. placeholder: '请输入',
  320. fuzzyQuery: false,
  321. regex:"number",
  322. content: $scope.echolist ? $scope.echolist.pastTwoResearchMoney : '',
  323. type: 'companySelect',
  324. needed: true,
  325. saveKey: 'pastTwoResearchMoney',
  326. }, {
  327. title: '估算可补助金额',
  328. placeholder: '等待计算',
  329. fuzzyQuery: false,
  330. content: $scope.echolist? $scope.echolist.estimateSubsidyMoney : '',
  331. type: 'companySelect',
  332. needed: true,
  333. saveKey: 'estimateSubsidyMoney',
  334. },
  335. ]
  336. }, {
  337. title: 'A000000基础信息表',
  338. content:"" ,
  339. type: 'upload',
  340. needed: true,
  341. imagelist: [],
  342. imageSaveList: $scope.imageList1 ? $scope.imageList1 : '[]',
  343. imageDeleteList: [],
  344. doctype: 4903,
  345. remarkType: 'normal',
  346. }, {
  347. title: 'A100000年度纳税申报表(A类)',
  348. content: '',
  349. type: 'upload',
  350. needed: true,
  351. imagelist: [],
  352. imageSaveList: $scope.imageList2 ? $scope.imageList2 : '[]',
  353. imageDeleteList: [],
  354. doctype: 4908,
  355. remarkType: 'normal'
  356. }, {
  357. title: 'A107012研发费用加计扣除优惠明细表',
  358. content:'' ,
  359. type: 'upload',
  360. needed: true,
  361. imagelist: [],
  362. imageSaveList: $scope.imageList3 ? $scope.imageList3 : '[]',
  363. imageDeleteList: [],
  364. doctype: 4908,
  365. remarkType: 'normal'
  366. }, {
  367. title: '上传法定代表人授权委托书',
  368. content:'' ,
  369. type: 'upload',
  370. needed: true,
  371. imagelist: [],
  372. imageSaveList:$scope.imageList4 ? $scope.imageList4 : '[]',
  373. imageDeleteList: [],
  374. doctype: 4908,
  375. remarkType: 'normal',
  376. Lowerdie:true
  377. }, {
  378. title: '上传材料真实性承诺书',
  379. content: '',
  380. type: 'upload',
  381. needed: true,
  382. imagelist: [],
  383. imageSaveList: $scope.imageList5 ? $scope.imageList5 : '[]',
  384. imageDeleteList: [],
  385. doctype: 4908,
  386. remarkType: 'normal',
  387. Lowerdie:true
  388. },
  389. ];
  390. var enterprise
  391. if($stateParams.list.title=='研发后补助申报'||$stateParams.list.restype==1611726857){
  392. enterprise=b
  393. }else{
  394. enterprise=a
  395. }
  396. $scope.formList = enterprise;
  397. }
  398. // 验证输入的是数字
  399. $scope.clearNoNum = function(obj,attr,regex){//先把非数字的都替换掉,除了数字和.
  400. if(regex=='number'){
  401. obj[attr] = obj[attr].replace(/[^\d.]/g,"");
  402. //必须保证第一个为数字而不是.
  403. obj[attr] = obj[attr].replace(/^\./g,"");
  404. //保证只有出现一个.而没有多个.
  405. obj[attr] = obj[attr].replace(/\.{2,}/g,"");
  406. //保证.只出现一次,而不能出现两次以上
  407. obj[attr] = obj[attr].replace(".","$#$").replace(/\./g,"").replace("$#$",".");
  408. }
  409. }
  410. //下载模板
  411. $scope.Lowerdie=function(index){
  412. dataToolsService.downloadcommonmodel('docx',index+1).then(function (res) {
  413. console.log(res)
  414. var aEle = document.createElement("a");// 创建a标签
  415. var blob = new Blob([res], {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'});
  416. // aEle.download = item.modelName;// 设置下载文件的文件名
  417. aEle.href = URL.createObjectURL(blob);
  418. aEle.click();// 设置点击事件
  419. })
  420. };
  421. // 模糊查询
  422. $scope.queryOrgName = function (index) {
  423. if ($scope.formList[index].fuzzyQuery) {
  424. if ($scope.formList[index].content) {
  425. var pagecode = $scope.code == 4803 ? 1000003 : 1000004;
  426. dataToolsService.getOrganizationModelByOrgname($scope.formList[index].content, pagecode, 0).then(function (response) {
  427. // console.log(response);
  428. if (response.code == 3350) {
  429. $scope.orgList = response.data;
  430. $scope.isRelateUl = true;
  431. } else {
  432. $scope.orgList = [];
  433. $scope.isRelateUl = false;
  434. }
  435. }, function () {
  436. })
  437. } else {
  438. $scope.isRelateUl = false;
  439. $scope.orgList = [];
  440. }
  441. }
  442. }
  443. //近三年企业研发费用
  444. $scope.rdchange=function(index){
  445. console.log($scope.formList[index].form)
  446. var a=[]
  447. $scope.formList[index].form.forEach(function (res) {
  448. if(res.content==''&&res.title!='估算可补助金额'){
  449. a.push(true)
  450. }
  451. })
  452. if(a.length==0){
  453. var params={
  454. aMoney: $scope.formList[index].form[0].content,
  455. bMoney: $scope.formList[index].form[1].content,
  456. cMoney: $scope.formList[index].form[2].content
  457. }
  458. dataToolsService.usercalresearchcost(params).then(function (res) {
  459. console.log(res)
  460. $scope.formList[index].form[3].content=res.data
  461. })
  462. }
  463. }
  464. $scope.ttt = function (tmptitle) {
  465. return $sce.trustAsHtml(tmptitle);
  466. }
  467. if ($scope.code == 4803 && $stateParams.companyName && $stateParams.companyName != '') {
  468. $scope.formList[0].content = $stateParams.companyName;
  469. $scope.queryOrgName(0);
  470. }
  471. angular.forEach($scope.formList, function (val) {
  472. if (val.type == 'affiliatedOrg') {
  473. var pagecode = $scope.code == 4803 ? 1000003 : 1000004;
  474. dataToolsService.getOrganizationModelByOrgname(' ', pagecode, 0, 1).then(function (response) {
  475. console.log(response);
  476. if (response.data.length > 0) {
  477. if ($stateParams.type == 5100) {
  478. $scope.brokernode = UserService.node;
  479. if (UserService.node != '330122000') {
  480. val.content = '普适云平台';
  481. val.key = '123456';
  482. }
  483. }
  484. val.listItem = [];
  485. angular.forEach(response.data, function (value) {
  486. val.listItem.push({
  487. text: '<a class="action-sheet-push">' + value.name + '</a>',
  488. itemkey: value.id,
  489. itemvalue: value.name //名字
  490. })
  491. })
  492. }
  493. }, function () {
  494. });
  495. }
  496. if (val.type == 'select') {
  497. val.listItem = [];
  498. dataToolsService.getTypeEntryListByTypeName(val.selectkey).then(function (res) {
  499. if (res.code == 3350) {
  500. angular.forEach(res.data, function (value) {
  501. val.listItem.push({
  502. text: '<a class="action-sheet-push">' + value.itemkey + '</a>',
  503. itemkey: value.itemvalue,
  504. itemvalue: value.itemkey //名字
  505. })
  506. })
  507. $timeout(function () {
  508. if (val.content) {
  509. var temp = val.listItem.filter(function (vv) {
  510. return vv.itemvalue == val.content;
  511. })
  512. if (temp.length > 0) {
  513. val.key = temp[0].itemkey;
  514. }
  515. }
  516. }, 1000);
  517. }
  518. })
  519. }
  520. if (val.type == 'selectArea') {
  521. getAreaList(0, 0);
  522. }
  523. if (val.type == 'selectDomain') {
  524. // getDomainList(0,0);
  525. // console.log(val);
  526. val.listItem = [];
  527. AccountService.getDomainInfo(0, $scope.node).then(function (res) {
  528. if (res.code == 3350) {
  529. // console.log(res);
  530. angular.forEach(res.data, function (value) {
  531. val.listItem.push({
  532. text: '<a class="action-sheet-push">' + value.name + '</a>',
  533. itemkey: value.code,
  534. itemvalue: value.name, //名字,
  535. // itemcode:value.code
  536. })
  537. })
  538. } else {
  539. }
  540. })
  541. }
  542. })
  543. $timeout(function () {
  544. console.log($scope.formList);
  545. }, 4000)
  546. // 获取数据处理
  547. var dealWithData = function (temp) {
  548. console.log(temp);
  549. $scope.orgid = temp.orgid ? temp.orgid : 0;
  550. // 处理数据
  551. var arr = [];
  552. $scope.refusereason = temp.refusereason;
  553. if (temp.images != '' && temp.images != null) {
  554. arr = JSON.parse(temp.images);
  555. }
  556. // console.log(temp);
  557. for (var key in temp) {
  558. for (var i = 0; i < $scope.formList.length; i++) {
  559. if (key == $scope.formList[i].saveKey) {
  560. console.log(key);
  561. $scope.formList[i].content = temp[key];
  562. // if(key=='district'&&temp[key]!=''&&$scope.formList[i].type=='selectArea'){
  563. // console.log(temp[key]);
  564. // var tp=JSON.parse(temp[key]);
  565. // var str='';
  566. // angular.forEach(tp,function(val,index){
  567. // str+=val.name+' ';
  568. // })
  569. // $scope.formList[i].content=str;
  570. // }
  571. if ($scope.showNew == true && key == 'district' && temp[key] != '' && $scope.formList[i].type == 'selectArea') {
  572. var tempArry = temp[key].split('/')
  573. // console.log(temp);
  574. for (var j = 0; j < $scope.areaDropDown.length; j++) {
  575. $scope.areaDropDown[j].selectName = tempArry[j];
  576. }
  577. }
  578. if ($scope.formList[i].type == 'select' || $scope.formList[i].type == 'selectDomain' || $scope.formList[i].type == 'affiliatedOrg' || $scope.formList[i].type == 'companyTaskSelect') {
  579. // console.log($scope.formList[i]);
  580. // console.log(temp[key]);
  581. var tparr = $scope.formList[i].listItem.filter(function (vv) {
  582. return vv.itemkey == temp[key];
  583. })
  584. // console.log(tparr);
  585. $scope.formList[i].content = tparr.length > 0 ? tparr[0].itemvalue : '';
  586. $scope.formList[i].key = tparr.length > 0 ? tparr[0].itemkey : '';
  587. }
  588. if ($scope.formList[i].type == 'toggle') {
  589. $scope.formList[i].content = temp[key] == 10501 ? '是' : '否';
  590. $scope.formList[i].togglecontent = temp[key] == 10501 ? true : false;
  591. }
  592. }
  593. if ($scope.formList[i].type == 'upload' && arr.length > 0) {
  594. $scope.formList[i].imagelist = arr.filter(function (va, ind) {
  595. return $scope.formList[i].doctype == va.doctype;
  596. })
  597. $scope.formList[i].imageSaveList = arr.filter(function (va, ind) {
  598. return $scope.formList[i].doctype == va.doctype;
  599. })
  600. $scope.formList[i].content = '点击放大查看图片';
  601. }
  602. }
  603. }
  604. console.log($scope.formList);
  605. };
  606. $scope.checkData = {};
  607. $scope.agree = true;
  608. if ($scope.showHistory == true) {
  609. if ($scope.action == 'submit') {
  610. // 获取认证信息
  611. // console.log($scope.code);
  612. AccountService.getAuthMessageInfo($scope.code).then(function (res) {
  613. console.log(res);
  614. if (res.code == 3350) {
  615. // $scope.dataList=res.data;
  616. // console.log(res);
  617. // console.log($stateParams);
  618. var temp = res.data.filter(function (val, index, arr) {
  619. return val.id == $stateParams.id;
  620. })[0];
  621. $scope.id = temp.id;
  622. dealWithData(temp);
  623. }
  624. })
  625. } else if ($scope.action == 'check') {
  626. // console.log(2);
  627. AccountService.getAuthCheckInfo($stateParams.pagenum, $stateParams.pagesize, '', 0, 0).then(function (res) {
  628. console.log(res);
  629. if (res.code == 3350) {
  630. // $scope.dataList=res.data;
  631. var temp = res.data.filter(function (val, index, arr) {
  632. return val.id == $stateParams.id;
  633. })[0];
  634. console.log(temp);
  635. $scope.checkData = temp;
  636. $scope.agree = $scope.checkData.authenstatus != 5103
  637. dealWithData(temp);
  638. }
  639. })
  640. }
  641. }
  642. $scope.orgtype = [
  643. {itemkey: '高新潜力企业', itemvalue: "8311"},
  644. {itemkey: '科技型初创企业', itemvalue: "8310"},
  645. {itemkey: '国家高新技术企业', itemvalue: "8301"},
  646. {itemkey: '创新引领企业', itemvalue: "8312"},
  647. {itemkey: '其他企业', itemvalue: "8307"}
  648. ];
  649. $scope.selectItems = function (index) {
  650. // console.log(index);
  651. if ($scope.formList[index].type == 'selectorgtype') {
  652. var obtainlist = [];
  653. angular.forEach($scope.orgtype, function (val) {
  654. obtainlist.push({
  655. text: '<a class="action-sheet-push">' + val.itemkey + '</a>',
  656. itemkey: val.itemkey,
  657. itemvalue: val.itemvalue
  658. })
  659. })
  660. $ionicActionSheet.show({
  661. cancelOnStateChange: true,
  662. cssClass: 'action_s',
  663. cancelText: '取消',
  664. buttons: obtainlist,
  665. buttonClicked: function (indx) {
  666. $scope.formList[index].content = obtainlist[indx].itemkey;
  667. return true;
  668. }
  669. });
  670. }
  671. if ($scope.formList[index].type == 'companySelect') {
  672. var obtainlist = [];
  673. angular.forEach($scope.companylist, function (val) {
  674. obtainlist.push({
  675. text: '<a class="action-sheet-push">' + val.applyname + '</a>',
  676. itemkey: val.applyname,
  677. itemvalue: val.orgid,
  678. itemcode:val.orgcode
  679. })
  680. })
  681. $ionicActionSheet.show({
  682. cancelOnStateChange: true,
  683. cssClass: 'action_s',
  684. cancelText: '取消',
  685. buttons: obtainlist,
  686. buttonClicked: function (indx) {
  687. $scope.orgid=obtainlist[indx].itemvalue
  688. $scope.formList[index].content = obtainlist[indx].itemkey;
  689. $scope.formList.forEach(function (res) {
  690. if(res.saveKey=='orgCode'){
  691. res.content=obtainlist[indx].itemcode
  692. }
  693. })
  694. return true;
  695. }
  696. });
  697. }
  698. }
  699. $scope.gobackpage = function () {
  700. $scope.goback();
  701. /*if(UserService.isTaskFlag == 1){
  702. $scope.go('taskHoll');
  703. UserService.isTaskFlag = 0;
  704. }else{
  705. goback();
  706. }*/
  707. }
  708. // 选中机构
  709. $scope.setOrgName = function (org) {
  710. console.log(org);
  711. $scope.orgid = org.id;
  712. for (var key in org) {
  713. for (var i = 0; i < $scope.formList.length; i++) {
  714. if ($scope.formList[i].saveKey == 'buyorgname') {
  715. $scope.formList[i].content = org.name;
  716. }
  717. }
  718. }
  719. // console.log($scope.formList);
  720. $scope.isRelateUl = false;
  721. if ($stateParams.comfrom == 'dockingInput') {
  722. taskModuleService.searchCompanyTask(org.id, 1, 200).then(function (res) {
  723. console.log(res);
  724. if (res.code == 3350) {
  725. $scope.formList[1].listItem = [];
  726. angular.forEach(res.data, function (val) {
  727. $scope.formList[1].listItem.push({
  728. text: '<a class="action-sheet-push">' + val.projectname + '</a>',
  729. itemkey: val.id,
  730. itemvalue: val.projectname //名字
  731. })
  732. })
  733. }
  734. })
  735. }
  736. }
  737. // *************上传照片
  738. // 先从数据中读取照片
  739. angular.forEach($scope.formList, function (val, index) {
  740. if (val.type == 'upload') {
  741. if (val.content != '') {
  742. /*var temp = JSON.parse(val.content);*/
  743. if (val.content != null && val.content != undefined && val.content != "") {
  744. //val.imagelist = Object.assign([], JSON.parse(val.content));
  745. val.imagelist = Object.assign(JSON.parse(JSON.stringify(val.content)));
  746. val.imageSaveList = val.imagelist;
  747. val.content = [];
  748. }
  749. console.log(val);
  750. }
  751. }
  752. ;
  753. })
  754. // console.log($scope.formList);
  755. //加载动画
  756. $scope.showLoadingToast = function () {
  757. $ionicLoading.show({
  758. template: '<ion-spinner icon="bubbles" class="spinner-calm"></ion-spinner>',
  759. content: '努力加载中',
  760. animation: 'fade-in',
  761. showBackdrop: true,//是否显示蒙层
  762. maxWidth: 150,
  763. showDelay: 0
  764. });
  765. // $timeout(function () {
  766. // $ionicLoading.hide();
  767. // }, 15000);
  768. };
  769. //关闭加载动画
  770. $scope.hideLoadingToast = function () {
  771. $ionicLoading.hide();
  772. };
  773. var listIndex = 1000;
  774. $scope.addImage = function (index) {
  775. listIndex = index;
  776. if ($scope.app) {
  777. var list = [
  778. {text: '<a class="action-sheet-push">拍照</a>'},
  779. {text: '<a class="action-sheet-push">从相册上传</a>'},
  780. ];
  781. var clickfunction = function (indx) {
  782. if (indx == 0) {
  783. $scope.openCamera();
  784. } else {
  785. getPictures();
  786. }
  787. return true;
  788. }
  789. } else {
  790. var files = document.getElementById('file');
  791. files.click();
  792. $(files).unbind().on('change', function (e) {
  793. console.log(e)
  794. if(!/.(jpg|jpeg|png|JPG|pdf|PDF)$/.test(e.target.value)){
  795. $ionicPopup.alert({
  796. title: '提示',
  797. template: "图片类型必须是jpeg,jpg,png,中的一种"
  798. });
  799. return;
  800. }
  801. if ($scope.formList[listIndex].imagelist.length > 9||(e.target.files.length+$scope.formList[listIndex].imageSaveList.length)>9) {
  802. $ionicPopup.alert({
  803. title: '提示',
  804. template: '最多只能上传9个文件!'
  805. });
  806. return;
  807. }
  808. // $.each(e.target.files, function (i, file) {
  809. // var url = null;
  810. // if (window.createObjectURL != undefined) { // basic
  811. // url = window.createObjectURL(file);
  812. // } else if (window.URL != undefined) { // mozilla(firefox)
  813. // url = window.URL.createObjectURL(file);
  814. // } else if (window.webkitURL != undefined) { // webkit or chrome
  815. // url = window.webkitURL.createObjectURL(file);
  816. // }
  817. // console.log($scope.formList[listIndex])
  818. // $scope.formList[listIndex].imagelist.push({photoName: url, originalName: url});
  819. // })
  820. $.each(e.target.files, function (i, file) {
  821. console.log(file)
  822. $scope.showLoadingToast();
  823. var data = new FormData();
  824. data.append('file', file);
  825. CommonService.webUploadImage(data).then(function (res) {
  826. files.value=''
  827. $scope.hideLoadingToast();
  828. var temp = {
  829. id: 0,
  830. title: res.title,
  831. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  832. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  833. photoName: res.photoName,
  834. originalName: res.originalName,
  835. sourceName: res.sourceName,
  836. sourceSize: res.sourceSize
  837. }
  838. $scope.formList[listIndex].imageSaveList.push(temp);
  839. console.log(temp);
  840. console.log($scope.formList[listIndex]);
  841. })
  842. });
  843. })
  844. return true;
  845. }
  846. $ionicActionSheet.show({
  847. buttons: list,
  848. cancelText: '取消',
  849. buttonClicked: clickfunction
  850. })
  851. }
  852. $scope.openCamera = function () {
  853. if ($scope.formList[listIndex].imagelist.length >= 9) {
  854. if ($scope.app) {
  855. UtilService.showMess("最多选取9张图片");
  856. } else {
  857. CommonService.showMessage("最多选取9张图片", $scope)
  858. }
  859. return;
  860. }
  861. UtilService.getPicture(1).then(function (results) {
  862. $scope.showLoadingToast();
  863. $scope.formList[listIndex].imagelist.push({photoName: results, originalName: results})
  864. UtilService.uploadFile([results], 0, "image/jpeg").then(function (response) {
  865. angular.forEach(response, function (value) {
  866. $scope.formList[listIndex].imageSaveList.push({
  867. id: 0,
  868. title: value.title,
  869. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  870. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  871. photoName: value.photoName,
  872. originalName: value.originalName,
  873. sourceName: value.sourceName,
  874. sourceSize: value.sourceSize
  875. })
  876. })
  877. $scope.hideLoadingToast();
  878. }, function () {
  879. $scope.hideLoadingToast();
  880. if ($scope.app) {
  881. UtilService.showMess("网络不给力,请重试");
  882. } else {
  883. CommonService.showMessage("网络不给力,请重试", $scope)
  884. }
  885. });
  886. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  887. }, function (err) {
  888. });
  889. }
  890. var getPictures = function () {
  891. if (device.platform == "Android") {
  892. verifyStorage();
  893. } else {
  894. getPic();
  895. }
  896. };
  897. var verifyStorage = function () {
  898. window.imagePicker.verifyStorage(
  899. function (results) {
  900. if (results == "1") {
  901. getPic();
  902. }
  903. }, function (error) {
  904. }
  905. );
  906. };
  907. var getPic = function () {
  908. var imagelistLength = $scope.formList[listIndex].imagelist.length;
  909. if (imagelistLength >= 9) {
  910. if ($scope.app) {
  911. UtilService.showMess("最多选取9张图片");
  912. } else {
  913. CommonService.showMessage("最多选取9张图片", $scope)
  914. }
  915. return;
  916. }
  917. UtilService.getPictureList(9 - imagelistLength).then(function (results) {
  918. $scope.showLoadingToast();
  919. angular.forEach(results, function (val, i) {
  920. $scope.formList[listIndex].imagelist.push({photoName: val, originalName: val});
  921. })
  922. UtilService.uploadFile(results, 0, "image/jpeg").then(function (response) {
  923. angular.forEach(response, function (value) {
  924. if (value.status) {
  925. $scope.formList[listIndex].imageSaveList.push({
  926. id: 0,
  927. title: value.title,
  928. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  929. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  930. photoName: value.photoName,
  931. originalName: value.originalName,
  932. sourceName: value.sourceName,
  933. sourceSize: value.sourceSize
  934. });
  935. }
  936. })
  937. $scope.hideLoadingToast();
  938. }, function () {
  939. $scope.hideLoadingToast();
  940. if ($scope.app) {
  941. UtilService.showMess("网络不给力,请重试");
  942. } else {
  943. CommonService.showMessage("网络不给力,请重试", $scope)
  944. }
  945. });
  946. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  947. }, function (err) {
  948. });
  949. };
  950. //删除图片
  951. $scope.deletePhoto = function (index, outerIndex) {
  952. if ($scope.formList[outerIndex].imageSaveList[index].id != 0) {
  953. $scope.formList[outerIndex].imageSaveList[index].isenabled = 2;
  954. $scope.formList[outerIndex].imageDeleteList.push($scope.formList[outerIndex].imageSaveList[index]);
  955. }
  956. $scope.formList[outerIndex].imagelist.splice(index, 1);
  957. $scope.formList[outerIndex].imageSaveList.splice(index, 1);
  958. }
  959. $scope.uploadPic = function (e) {
  960. // console.log(2);
  961. // console.log(e.target);
  962. }
  963. // **************切换开关
  964. $scope.watchIsChange = function (index) {
  965. $scope.formList[index].content = $scope.formList[index].togglecontent ? "10501" : "10502";
  966. }
  967. // **************提交按钮
  968. $scope.checkNotice = function () {
  969. $scope.isChecked = !$scope.isChecked;
  970. }
  971. // 处理审核
  972. $scope.reSubmit = function () {
  973. $scope.showNew = true;
  974. $scope.showHistory = false;
  975. $scope.tempData = {};
  976. $scope.tempData.id = $scope.id;
  977. console.log($scope.formList);
  978. angular.forEach($scope.formList, function (val) {
  979. if (val.type == 'upload') {
  980. val.imageSaveList = Object.assign([], val.imagelist);
  981. }
  982. if (val.type == 'selectArea' && val.content != '') {
  983. var temp = val.content.split('/')
  984. // console.log(temp);
  985. for (var i = 0; i < $scope.areaDropDown.length; i++) {
  986. $scope.areaDropDown[i].selectName = temp[i];
  987. }
  988. }
  989. })
  990. }
  991. if ($stateParams.comfrom == 'resubmit') {
  992. $scope.id = $stateParams.id;
  993. $scope.reSubmit();
  994. }
  995. var dealWidthData = function () {
  996. console.log($scope.formList);
  997. var tempImages = [];
  998. angular.forEach($scope.formList, function (val, index) {
  999. if (val.type == 'upload') {
  1000. // 处理照片
  1001. // if(val.imagelist.length>0){
  1002. // val.imageSaveList=Object.assign([],val.imagelist);
  1003. // }
  1004. val.content = '';
  1005. var temp = Object.assign([], val.imageSaveList);
  1006. angular.forEach(val.imageSaveList, function (v) {
  1007. tempImages.push(v);
  1008. });
  1009. console.log(tempImages);
  1010. if (val.imageDeleteList.length > 0) {
  1011. angular.forEach(val.imageDeleteList, function (value) {
  1012. tempImages.push(value);
  1013. /*temp.push(value)*/
  1014. })
  1015. }
  1016. console.log(tempImages);
  1017. val.content = JSON.stringify(temp);
  1018. } else if (val.type == 'select' || val.type == 'selectDomain' || val.type == 'affiliatedOrg' || val.type == 'companyTaskSelect') {
  1019. $scope.tempData[val.saveKey] = val.key;
  1020. } else if (val.type == 'selectArea') {
  1021. $scope.tempData[val.saveKey] = val.content;
  1022. $scope.tempData.regionsid = val.code;
  1023. } else if (val.type == 'toggle') {
  1024. if (val.content == '是' || val.content == '否') {
  1025. val.content = val.content == '是' ? 10502 : 10501;
  1026. }
  1027. $scope.tempData[val.saveKey] = val.content;
  1028. } else if(val.type == 'group'){
  1029. val.form.forEach(function (res) {
  1030. $scope.tempData[res.saveKey] = res.content;
  1031. })
  1032. }else {
  1033. $scope.tempData[val.saveKey] = val.content;
  1034. }
  1035. })
  1036. console.log(tempImages);
  1037. angular.forEach(tempImages, function (value, index) {
  1038. value.createtime = new Date().Format("yyyy-MM-dd hh:mm:ss");
  1039. value.updatetime = new Date().Format("yyyy-MM-dd hh:mm:ss");
  1040. })
  1041. $scope.tempData.images = JSON.stringify(tempImages);
  1042. }
  1043. $scope.readCommit = false;
  1044. $scope.readCommition = function () {
  1045. $scope.readCommit = !$scope.readCommit;
  1046. }
  1047. $scope.goToMyCommit = function () {
  1048. //$scope.commitmentCom.show();
  1049. permissionvalue = "";
  1050. angular.forEach($scope.taskTypeList, function (val) {
  1051. if (val.isSelected) {
  1052. permissionvalue = permissionvalue + "," + val.value;
  1053. }
  1054. })
  1055. if ($scope.taskTypeList[2].isSelected) {
  1056. permissionvalue = "";
  1057. angular.forEach($scope.sonTaskTypeList, function (val) {
  1058. if (val.isSelected) {
  1059. permissionvalue = permissionvalue + "," + val.value;
  1060. }
  1061. })
  1062. }
  1063. $scope.formList.permissionvalue = permissionvalue;
  1064. $scope.go('commitment', {formlist: $scope.formList});
  1065. }
  1066. $scope.gobackToTashHoll = function () {
  1067. $scope.go('taskHoll');
  1068. }
  1069. // 保存对接信息
  1070. // 获取connid
  1071. var getDockingConnid = function () {
  1072. var def = $q.defer();
  1073. $scope.requestModel = {
  1074. data: {
  1075. templettype: 16,
  1076. title: $scope.formList[0].content,
  1077. organizationInfo: {
  1078. name: $scope.formList[0].content,
  1079. id: $scope.orgid ? $scope.orgid : 0
  1080. },
  1081. userModel: {
  1082. userid: UserService.id
  1083. }
  1084. },
  1085. node: UserService.node,
  1086. userid: UserService.id
  1087. }
  1088. console.log($scope.requestModel);
  1089. dataToolsService.saveOrganizationInfo($scope.requestModel).then(function (response) {
  1090. console.log(response);
  1091. if (response.code == 3350) {
  1092. def.resolve(response.data);
  1093. } else {
  1094. def.reject('错误');
  1095. }
  1096. })
  1097. return def.promise;
  1098. }
  1099. var submitTaskDocking = false;
  1100. $scope.submitTaskDocking = function () {
  1101. if (submitTaskDocking) {
  1102. return;
  1103. }
  1104. submitTaskDocking = true;
  1105. $scope.tempData = $scope.tempData ? $scope.tempData : {};
  1106. for (var i = 0; i < $scope.formList.length; i++) {
  1107. var val = $scope.formList[i];
  1108. if (val.remarkType == 'manage' && $scope.formList[i - 1].type == 'toggle' && ($scope.formList[i - 1].content == '10502' || $scope.formList[i - 1].content == '否')) {
  1109. continue;
  1110. }
  1111. if (val.needed && (val.content === '' || val.content == null || (val.type == 'upload' && val.imagelist.length == 0))) {
  1112. if (val.type == 'upload') {
  1113. if ($scope.app) {
  1114. UtilService.showMess('请上传' + val.title);
  1115. } else {
  1116. CommonService.showMessage('请上传' + val.title, $scope);
  1117. }
  1118. } else if (val.type == 'select' || val.type == 'affiliatedOrg' || val.type == 'selectArea' || val.type == 'selectDomain' || val.type == 'companyTaskSelect') {
  1119. if ($scope.app) {
  1120. UtilService.showMess('请选择' + val.title);
  1121. } else {
  1122. CommonService.showMessage('请选择' + val.title, $scope);
  1123. }
  1124. } else {
  1125. if ($scope.app) {
  1126. UtilService.showMess('请填写' + val.title);
  1127. } else {
  1128. CommonService.showMessage('请填写' + val.title, $scope);
  1129. }
  1130. }
  1131. submitTaskDocking = false;
  1132. return;
  1133. }
  1134. }
  1135. dealWidthData();
  1136. $scope.tempData.companyid = $scope.orgid;
  1137. $scope.tempData.action = 5322;
  1138. $scope.tempData.creator = UserService.id;
  1139. // var senddata={
  1140. // data:$scope.tempData,
  1141. // node:UserService.node
  1142. // }
  1143. $scope.showLoadingToast();
  1144. getDockingConnid().then(function (data) {
  1145. console.log(data);
  1146. $scope.tempData.connid = data.id;
  1147. $scope.tempData.orgid = data.organizationInfo.id;
  1148. $scope.tempData.companyid = data.organizationInfo.id;
  1149. $scope.tempData.tasktitle = $scope.tasktitle;
  1150. $scope.tempData.taskid = $stateParams.taskid;
  1151. if ($scope.tempData.jointtime == null || $scope.tempData.jointtime == undefined || $scope.tempData.jointtime == "") {
  1152. $scope.tempData.jointtime = new Date();
  1153. } else {
  1154. $scope.tempData.jointtime += ' 00:00:00';
  1155. }
  1156. var senddata = {
  1157. data: $scope.tempData,
  1158. node: UserService.node
  1159. }
  1160. console.log(senddata);
  1161. taskModuleService.saveOrupdatetaskDocking(senddata).then(function (res) {
  1162. console.log(res);
  1163. if (res.code == 3350) {
  1164. $scope.goback();
  1165. }
  1166. $scope.hideLoadingToast();
  1167. })
  1168. })
  1169. }
  1170. var submitFormAction = false;
  1171. $scope.submitForm = function () {
  1172. // if(!$scope.isChecked){
  1173. // return;
  1174. // }
  1175. /*if (submitFormAction) {
  1176. return;
  1177. }
  1178. submitFormAction = true;*/
  1179. angular.forEach($scope.formList, function (val) {
  1180. if (val.type == "upload") {
  1181. angular.forEach(val.imageSaveList, function (image) {
  1182. image.remark = val.title;
  1183. })
  1184. }
  1185. })
  1186. // 先处理数据 判断非空
  1187. $scope.tempData = $scope.tempData ? $scope.tempData : {};
  1188. dealWidthData();
  1189. $scope.tempData.creator = UserService.id;
  1190. $scope.tempData.userid = UserService.id;
  1191. $scope.tempData.node = UserService.node;
  1192. $scope.tempData.id=$scope.echolist?$scope.echolist.id:0
  1193. $scope.tempData.orgid = $scope.orgid;
  1194. $scope.tempData.resid = 0;
  1195. for (var i = 0; i < $scope.formList.length; i++) {
  1196. var val = $scope.formList[i];
  1197. if (val.remarkType == 'manage' && $scope.formList[i - 1].type == 'toggle' && ($scope.formList[i - 1].content == '10502' || $scope.formList[i - 1].content == '否')) {
  1198. continue;
  1199. }
  1200. if (val.type == 'upload') {
  1201. // console.log(val.content);
  1202. console.log(val.content == '');
  1203. console.log(val.type == 'upload');
  1204. console.log(val.imagelist.length == 0);
  1205. }
  1206. if (val.needed && (val.content == '' || !val.content ||(val.type == 'upload' && val.imageSaveList.length == 0))) {
  1207. if (val.type == 'upload') {
  1208. $ionicPopup.alert({
  1209. title: '提示',
  1210. template: '请上传' + val.title
  1211. });
  1212. return;
  1213. } else {
  1214. if (val.type == 'selectorgtype') {
  1215. if (!val.content) {
  1216. $ionicPopup.alert({
  1217. title: '提示',
  1218. template: '请选择' + val.title
  1219. });
  1220. return;
  1221. }
  1222. } else if(val.type == 'group'){
  1223. val.form.forEach(function (res) {
  1224. if(!res.content){
  1225. $ionicPopup.alert({
  1226. title: '提示',
  1227. template: '请选择' + res.title
  1228. });
  1229. return;
  1230. }
  1231. })
  1232. }else {
  1233. $ionicPopup.alert({
  1234. title: '提示',
  1235. template: '请填写' + val.title
  1236. });
  1237. return;
  1238. }
  1239. }
  1240. submitFormAction = false;
  1241. }
  1242. }
  1243. $scope.showLoadingToast();
  1244. if (!$scope.tempData.orgid) {
  1245. $scope.tempData.orgid = 0;
  1246. }
  1247. console.log($scope.formList);
  1248. if($stateParams.list.title=='研发后补助申报'||$stateParams.list.restype==1611726857){
  1249. $scope.tempData.updater = "";
  1250. $scope.tempData.createtime = "";
  1251. $scope.tempData.updatetime = "";
  1252. $scope.tempData.by1 = $scope.echolist?$scope.echolist.by1:"";
  1253. $scope.tempData.by2 = "";
  1254. $scope.tempData.by3 = "";
  1255. $scope.tempData.tablename = $scope.echolist?$scope.echolist.tablename:"";
  1256. $scope.tempData.tablecode = "";
  1257. console.log( $scope.tempData)
  1258. AccountService.postresearchcosts($scope.tempData).then(function (res) {
  1259. console.log(res)
  1260. $scope.hideLoadingToast();
  1261. if (res.code == 3350) {
  1262. $ionicPopup.alert({
  1263. title: '提示',
  1264. template: '提交成功!可电话联系高新科58508190,催促研发后补助审核'
  1265. }).then(function () {
  1266. $scope.go('reward');
  1267. });
  1268. }
  1269. })
  1270. }else {
  1271. console.log( $scope.tempData)
  1272. $scope.tempData.applytype = $scope.code;
  1273. $scope.tempData.authenstatus = 5101;
  1274. $scope.tempData.policysettingid = $scope.list.id;
  1275. $scope.tempData.buyorgid = $scope.orgid;
  1276. // AccountService.getTechContractCooperateInfo($scope.tempData.projectname, $scope.tempData.orgid, $scope.tempData.buyorgname).then(function (res) {
  1277. // if (res.code == 3350) {
  1278. // if (res.data.length != 0) {
  1279. // $ionicPopup.alert({
  1280. // title: '提示',
  1281. // template: '已申报产学研合作补助'
  1282. // })
  1283. // return;
  1284. // }
  1285. // }
  1286. // })
  1287. AccountService.submitAuthMessageCooperateInfo($scope.tempData).then(function (res) {
  1288. console.log(res);
  1289. $scope.hideLoadingToast();
  1290. if (res.code == 3350) {
  1291. $ionicPopup.alert({
  1292. title: '提示',
  1293. template: '提交成功!'
  1294. });
  1295. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  1296. $scope.hasAuth = res.data;
  1297. if (!$scope.hasAuth) {
  1298. $scope.go('reward');
  1299. }
  1300. else {
  1301. $scope.go('cooperationSubsidyCheck');
  1302. }
  1303. })
  1304. }
  1305. })
  1306. }
  1307. }
  1308. $scope.agreeClick = function () {
  1309. if ($scope.node == '330122000') {
  1310. $scope.agree = 1;
  1311. } else {
  1312. $scope.agree = true;
  1313. }
  1314. }
  1315. $scope.rollClick = function () {
  1316. $scope.agree = -2;
  1317. }
  1318. $scope.rejectClick = function () {
  1319. if ($scope.node == '330122000') {
  1320. $scope.agree = -1;
  1321. } else {
  1322. $scope.agree = false;
  1323. }
  1324. }
  1325. var submitCheckAction = false;
  1326. $scope.submitCheck = function () {
  1327. if (submitCheckAction) {
  1328. return;
  1329. }
  1330. submitCheckAction = true;
  1331. // console.log($scope.agree);
  1332. if ($scope.node == '330122000') {
  1333. $scope.checkData.authenstatus = $scope.agree == 1 ? 5102 : ($scope.agree == -1 ? 5103 : 5104);
  1334. $scope.checkData.refusereason = $scope.agree == 1 ? '' : $scope.checkData.refusereason;
  1335. } else {
  1336. $scope.checkData.authenstatus = $scope.agree ? 5102 : 5103;
  1337. $scope.checkData.refusereason = $scope.agree ? '' : $scope.checkData.refusereason;
  1338. }
  1339. $scope.checkData.authorityid = UserService.id;
  1340. // console.log($scope.checkData);
  1341. $scope.showLoadingToast();
  1342. AccountService.submitAuthCheckInfo($scope.checkData).then(function (res) {
  1343. $scope.hideLoadingToast();
  1344. // console.log(res);
  1345. if (res.code == 3350) {
  1346. $state.go('identifyDetail', {pageTitle: '认证审核', code: $scope.code, action: 'check'});
  1347. }
  1348. })
  1349. }
  1350. //点击图片放大
  1351. $scope.bigImage = false; //初始默认大图是隐藏的
  1352. $scope.hideBigImage = function () {
  1353. $timeout(function () {
  1354. $scope.bigImage = false;
  1355. }, 400);
  1356. };
  1357. $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl)
  1358. window.open(ConfigService.imgurl + piclist[index].sourceName);
  1359. return;
  1360. };
  1361. window.addEventListener("resize", function () {
  1362. var domWidth = window.document.documentElement.getBoundingClientRect().width;
  1363. if (domWidth > 540) {
  1364. $scope.viewscreen = 'browser';
  1365. } else {
  1366. $scope.viewscreen = 'app';
  1367. }
  1368. })
  1369. // 任务邀请页面
  1370. var taskInviteModal = function () {
  1371. $ionicModal.fromTemplateUrl('./modules/common/views/taskInviteModal.html', {
  1372. scope: $scope,
  1373. animation: 'slide-in-left'
  1374. }).then(function (modal) {
  1375. $scope.taskInvite = modal;
  1376. });
  1377. }
  1378. taskInviteModal();
  1379. // 选择热门标签
  1380. $scope.selectLable = function (index, label) {
  1381. $scope.formList[index].content = label;
  1382. }
  1383. //删除图片集合中存在的相同图片
  1384. angular.forEach($scope.formList, function (val) {
  1385. if (val.type == 'upload') {
  1386. $scope.differentflag = false;
  1387. if (val.imagelist.length != 0) {
  1388. $scope.newimagelist = [];
  1389. $scope.newimagelist.push(val.imagelist[0]);
  1390. for (var i = 0; i < val.imagelist.length; i++) {
  1391. for (var j = 0; j < $scope.newimagelist.length; j++) {
  1392. if (val.imagelist[i].sourceName == $scope.newimagelist[j].sourceName) {
  1393. $scope.differentflag = false;
  1394. break;
  1395. } else {
  1396. $scope.differentflag = true;
  1397. }
  1398. }
  1399. if ($scope.differentflag) {
  1400. $scope.newimagelist.push(val.imagelist[i]);
  1401. }
  1402. }
  1403. val.imagelist = $scope.newimagelist;
  1404. }
  1405. $scope.differentflag = false;
  1406. if (val.imageSaveList.length != 0) {
  1407. $scope.newimagelist = [];
  1408. $scope.newimagelist.push(val.imageSaveList[0]);
  1409. for (var i = 0; i < val.imageSaveList.length; i++) {
  1410. for (var j = 0; j < $scope.newimagelist.length; j++) {
  1411. if (val.imageSaveList[i].sourceName == $scope.newimagelist[j].sourceName) {
  1412. $scope.differentflag = false;
  1413. break;
  1414. } else {
  1415. $scope.differentflag = true;
  1416. }
  1417. }
  1418. if ($scope.differentflag) {
  1419. $scope.newimagelist.push(val.imageSaveList[i]);
  1420. }
  1421. }
  1422. val.imageSaveList = $scope.newimagelist;
  1423. }
  1424. }
  1425. })
  1426. });