technicalawardapplicationCtrl.js 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351
  1. /**
  2. * Created by pushkeji on 2018/8/16.
  3. */
  4. angular.module('push')
  5. .controller('technicalawardapplicationCtrl', ['$scope', '$stateParams', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', 'dataToolsService', '$sce', 'AccountService', 'UserService', '$ionicSlideBoxDelegate', '$timeout', '$state', '$http', 'ConfigService', 'CommonService', '$ionicPopup', 'ResourceLibraryService', 'taskModuleService', 'ScienceCircleService', '$ionicModal', '$q', function ($scope, $stateParams, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, dataToolsService, $sce, AccountService, UserService, $ionicSlideBoxDelegate, $timeout, $state, $http, ConfigService, CommonService, $ionicPopup, ResourceLibraryService, taskModuleService, ScienceCircleService, $ionicModal, $q) {
  6. console.log($stateParams);
  7. // 弹出任务邀请框
  8. $scope.defaultLan = UserService.defaultLan;
  9. $scope.tempData = {};
  10. $scope.node = UserService.node;
  11. $scope.resid = $stateParams.resid;
  12. $scope.restype = $stateParams.restype;
  13. $scope.list = $stateParams.list;
  14. $scope.flag = $stateParams.flag;
  15. $scope.userid = UserService.id;
  16. $scope.org = {};
  17. var tecBrokerPictureList = [];
  18. var getTechnicalAwardDetail = function (needInsertDBFlag) {
  19. AccountService.getTechnicalAwardDetail($scope.userid, $scope.resid, $scope.node, needInsertDBFlag, 0, 0, $scope.restype).then(function (res) {
  20. if (res.code == 3350) {
  21. var data = res.data;
  22. $scope.list.restype= res.data.demandReward.restype
  23. $scope.applyname = data.sysUsersInfo.applyname;
  24. $scope.certificate = data.sysUsersInfo.brokercertificate;
  25. $scope.tel = data.sysUsersInfo.tel;
  26. $scope.orgname = data.orgName;
  27. $scope.org.orgtel = data.demandReward.orgtel;
  28. $scope.org.orguser = data.demandReward.orguser;
  29. if($scope.org.orgtel == '' || $scope.org.orgtel == null){
  30. $scope.orgtelinfo = "show";
  31. }
  32. $scope.demandname = data.sysUsersTaskInfo.projectname;
  33. $scope.demandstatus = data.demandReward.demandstatus;
  34. $scope.refusereason = data.demandReward.refusereason;
  35. $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
  36. $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
  37. $scope.restype = data.demandReward.restype;
  38. $scope.demandcontent = data.sysUsersTaskInfo.taskintroduction;
  39. $scope.abutList = data.companyAbutLkList;
  40. $scope.technical = data.technicalContractList[0];
  41. $scope.picturelist = data.systemPictureList;
  42. angular.forEach(tecBroker, function (val, index) {
  43. angular.forEach($scope.picturelist, function (picture, index) {
  44. if (val.title == picture.title) {
  45. val.imagelist.push(picture);
  46. val.imageSaveList.push(picture);
  47. }
  48. })
  49. })
  50. dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
  51. if (newRes.code == 3350) {
  52. $scope.cooperationmodelInfo = newRes.data;
  53. }
  54. })
  55. }
  56. })
  57. }
  58. getTechnicalAwardDetail(false);
  59. $scope.reGoToReward = function (list) {
  60. console.log(list)
  61. if (!ConfigService.islogin) {
  62. if (localStorage.wxFlag == "true") {
  63. if (localStorage.isUserFocusXW == 0) {
  64. var title = localStorage.appidStr;
  65. $ionicPopup.alert({
  66. title: '提示',
  67. template: '请先关注微信公众号"' + title + '"!'
  68. });
  69. return;
  70. } else {
  71. if (localStorage.isUserBindWx == 0) {
  72. var wxFlag = JSON.parse(localStorage.params);
  73. if (wxFlag.weChatModel) {
  74. $scope.go('bindPhone', {
  75. params: localStorage.params,
  76. comfrom: 'maincontroller',
  77. url: window.location.href.split('#/')[1]
  78. });
  79. } else {
  80. $scope.go('login');
  81. return;
  82. }
  83. } else {
  84. $scope.go('login');
  85. return;
  86. }
  87. }
  88. } else {
  89. $scope.go('login');
  90. return;
  91. }
  92. } else {
  93. if (list.restype == 4801) {
  94. $scope.go('technicalawardapplication', {
  95. pageTitle: "技术经纪人技术合作类奖励",
  96. code: 4801,
  97. type: 5100,
  98. action: 'submit',
  99. resid: list.resid,
  100. restype: list.restype,
  101. list: list,
  102. flag:'re'
  103. });
  104. }
  105. if (list.restype == 1) {
  106. $scope.go("demandRewardDetail", {
  107. resid: list.resid,
  108. comefrom: 'reward',
  109. list: list,
  110. flag:'re'
  111. });
  112. }
  113. }
  114. }
  115. $scope.bigImage = false; //初始默认大图是隐藏的
  116. $scope.hideBigImage = function () {
  117. if ($scope.app) {
  118. $scope.setStatusBar(0);
  119. }
  120. $scope.bigImage = false;
  121. }
  122. $scope.shouBigImage = function (outindex, innerindex) {
  123. if ($scope.app) {
  124. $scope.setStatusBar(1);
  125. }
  126. $scope.bigImageList = $scope.abutList[outindex].photoList;
  127. $scope.bigImage = true; //显示大图
  128. $(function () {
  129. $('div.pinch-zoom').each(function () {
  130. new RTP.PinchZoom($(this), {});
  131. });
  132. });
  133. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  134. //图片总数量
  135. setTimeout(function () {
  136. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0);
  137. //获取图片
  138. var imgObj = document.getElementsByClassName('bigimage');
  139. var n;
  140. for (n = 0; n < imgObj.length; n++) {
  141. // 获取图片的原始高度和宽度
  142. var oldWid = imgObj[n].naturalWidth;
  143. var oldHei = imgObj[n].naturalHeight;
  144. var screen = document.body.offsetWidth;
  145. var screenH = window.innerHeight;
  146. // console.log(oldWid/oldHei);
  147. // console.log(screen );
  148. var rate = oldWid / oldHei;
  149. if (oldWid >= screen && oldHei >= screenH) {
  150. var tw = screen;
  151. var th = tw / rate;
  152. if (th < screenH) {
  153. imgObj[n].style.width = tw + 'px';
  154. imgObj[n].style.height = th + 'px';
  155. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  156. } else {
  157. imgObj[n].style.width = screenH * rate + 'px';
  158. imgObj[n].style.height = screenH + 'px';
  159. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  160. }
  161. } else if (oldWid >= screen && oldHei <= screenH) {
  162. imgObj[n].style.width = screen + 'px';
  163. imgObj[n].style.height = screen / rate + 'px';
  164. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  165. } else if (oldWid <= screen && oldHei >= screenH) {
  166. // var hh=screenH;
  167. // var ww=screenH*rate;
  168. imgObj[n].style.width = screenH * rate + 'px';
  169. imgObj[n].style.height = screenH + 'px';
  170. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  171. } else {
  172. imgObj[n].style.width = oldWid + 'px';
  173. imgObj[n].style.height = oldHei + 'px';
  174. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  175. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  176. }
  177. }
  178. }, 500);
  179. }
  180. $scope.submitTechnicalAwardDetail = function (needInsertDBFlag) {
  181. var orguser = $scope.org.orguser;
  182. var orgtel = $scope.org.orgtel;
  183. var mess = false;
  184. if (orguser == null || orguser == undefined || orguser == "") {
  185. mess = true;
  186. $ionicPopup.alert({
  187. title: '提示',
  188. template: '请填写单位负责人姓名'
  189. })
  190. return;
  191. }
  192. if (orgtel == null || orgtel == undefined || orgtel == "") {
  193. mess = true;
  194. $ionicPopup.alert({
  195. title: '提示',
  196. template: '请填写负责人联系方式'
  197. })
  198. return;
  199. }
  200. angular.forEach(tecBroker, function (val, index) {
  201. if (val.imageSaveList.length == 0) {
  202. mess = true;
  203. $ionicPopup.alert({
  204. title: '提示',
  205. template: '请' + val.title + '!'
  206. })
  207. return;
  208. }
  209. })
  210. angular.forEach(tecBroker, function (val, index) {
  211. tecBrokerPictureList.push(val);
  212. })
  213. if (!mess) {
  214. angular.forEach(tecBrokerPictureList, function(value){
  215. value.infoid = $scope.list.id;
  216. })
  217. var pictureRecord = angular.toJson(tecBrokerPictureList);
  218. AccountService.insertApplicationPicture(pictureRecord).then(function (pictureRes) {
  219. if (pictureRes.code == 3350) {
  220. console.log($scope.node)
  221. AccountService.getTechnicalAwardDetail($scope.userid, $scope.resid, $scope.node, needInsertDBFlag, $scope.org.orguser, $scope.org.orgtel, $scope.restype).then(function (res) {
  222. if (res.code == 3350) {
  223. var resource = res.data.resourcelibrary;
  224. $scope.go('reward');
  225. /*$scope.go('taskDetail', {
  226. resid: resource.id,
  227. node: '330122000',
  228. restype: resource.restype,
  229. comefrom: 'technicalawardapplication',
  230. status: 'technicalreward'
  231. })*/
  232. }
  233. })
  234. }
  235. })
  236. }
  237. }
  238. $scope.url = 'http://pic.ubittc.com/group2/M00/03/B7/wKjIKluVD3OAfkH4AAA74dltjKY89.docx';
  239. $scope.alertInfo = function () {
  240. // CommonService.showMessage('请在电脑端下载打印',$scope)
  241. if ($scope.app) {
  242. $ionicPopup.alert({
  243. title: '提示',
  244. template: '《企业认证申请公函》请在电脑端下载打印,并加盖企业公章后上传。电脑端web网址:ubittc.com'
  245. });
  246. }
  247. }
  248. if ($scope.app) {
  249. $scope.url = '';
  250. // $scope.alertInfo()
  251. }
  252. if ($stateParams.pageTitle) {
  253. $scope.pageTitle = $stateParams.pageTitle;
  254. } else {
  255. $scope.pageTitle = sessionStorage.indentifyDetailTitle;
  256. }
  257. if ($stateParams.code) {
  258. $scope.code = $stateParams.code;
  259. } else {
  260. $scope.code = sessionStorage.indentifyDetailCode;
  261. }
  262. $scope.action = $stateParams.action;
  263. $scope.type = $stateParams.type;
  264. // console.log($stateParams);
  265. // console.log($scope.pageTitle,$scope.code,$scope.action);
  266. // if($stateParams.type=){
  267. // $scope.type=$stateParams.type;
  268. // }else{
  269. // $scope.type=sessionStorage.type;
  270. // }
  271. $scope.orgid = null;
  272. $scope.showNew = false;
  273. $scope.showHistory = false;
  274. $scope.showFinish = false;
  275. $scope.showReject = false;
  276. $scope.refusereason = '';
  277. if ($stateParams.type == 5100) {
  278. $scope.showNew = true;
  279. } else if ($stateParams.type == 5101 || $stateParams.type == 0 || $scope.action == 'check' || $stateParams.type == 5102 || $stateParams.type == 5103) {
  280. $scope.showHistory = true;
  281. if ($stateParams.type == 5102 || $stateParams.type == 5103) {
  282. $scope.showFinish = true;
  283. }
  284. if ($stateParams.type == 5103) {
  285. $scope.showReject = true;
  286. }
  287. }
  288. $scope.personalNotices = [
  289. {
  290. image: '1',
  291. title: '注意事项',
  292. item: [
  293. '1.每个证件只能绑定一个账号',
  294. '2.证件照不清晰或与输入的信息不匹配,将导致实名认证被驳回',
  295. '3.您提供的证件信息将受到严格保护,仅用于身份验证,未经本人许可不会用于其他用途'
  296. ]
  297. }, {
  298. image: '2',
  299. title: '证件要求',
  300. item: [
  301. '1.需上传本人二代身份证背面照+身份证反面照(不需手持)',
  302. '2.证件必须在有效期内,有效期需在一个月以上',
  303. ]
  304. }, {
  305. image: '2',
  306. title: '照片要求',
  307. item: [
  308. '1.证件照上信息需完整且清晰可辩(无反光、遮挡、水印、证件套、logo等)',
  309. '2.申请人填写的“真实姓名”和“证件号码”需和提交证件照片信息一致',
  310. '3.证件必须真实拍摄,不能使用复印件',
  311. '4.确保照片完整(不缺边角),证件周围不允许加上边角框(如:加上红框等)'
  312. ]
  313. },
  314. ];
  315. var personal = [
  316. {
  317. title: '真实姓名',
  318. placeholder: '请填写真实姓名',
  319. content: '',
  320. type: 'input',
  321. needed: true,
  322. saveKey: 'applyname',
  323. }, {
  324. title: '证件类型',
  325. placeholder: '请选择证件类型',
  326. // type:'certificateType',
  327. content: '',
  328. key: '',
  329. saveKey: 'idtype',
  330. type: 'select',
  331. selectkey: 'id_type',
  332. needed: true,
  333. }, {
  334. title: '证件号码',
  335. placeholder: '请填写证件号码',
  336. type: 'input',
  337. content: '',
  338. needed: true,
  339. saveKey: 'cardno',
  340. }, {
  341. title: '证件正面照',
  342. content: '[]',
  343. type: 'upload',
  344. needed: true,
  345. imagelist: [],
  346. imageSaveList: [],
  347. imageDeleteList: [],
  348. doctype: 4906,
  349. remarkType: 'identify',
  350. }, {
  351. title: '证件背面照',
  352. content: '[]',
  353. type: 'upload',
  354. needed: true,
  355. imagelist: [],
  356. imageSaveList: [],
  357. imageDeleteList: [],
  358. doctype: 4907,
  359. remarkType: 'identify',
  360. },
  361. ];
  362. var tecBroker = [
  363. {
  364. title: '上传合作双方认可证明',
  365. content: '[]',
  366. type: 'upload',
  367. needed: true,
  368. imagelist: [],
  369. imageSaveList: [],
  370. imageDeleteList: [],
  371. doctype: 4900,
  372. remarkType: 'normal'
  373. }, {
  374. title: '上传发票',
  375. content: '[]',
  376. type: 'upload',
  377. needed: true,
  378. imagelist: [],
  379. imageSaveList: [],
  380. imageDeleteList: [],
  381. doctype: 4900,
  382. remarkType: 'add'
  383. },
  384. {
  385. title: '上传转账凭证',
  386. content: '[]',
  387. type: 'upload',
  388. needed: true,
  389. imagelist: [],
  390. imageSaveList: [],
  391. imageDeleteList: [],
  392. doctype: 4900,
  393. remarkType: 'identify'
  394. }
  395. ];
  396. var enterprise = [
  397. {
  398. title: '企业全称',
  399. placeholder: '请填写企业全称',
  400. fuzzyQuery: true,
  401. content: '',
  402. type: 'input',
  403. needed: true,
  404. saveKey: 'applyname',
  405. }, {
  406. title: '统一社会信用代码',
  407. placeholder: '请填写统一社会信用代码',
  408. content: '',
  409. type: 'input',
  410. needed: true,
  411. saveKey: 'orgcode',
  412. }, {
  413. title: '所属行业',
  414. placeholder: '请选择所属行业',
  415. content: '',
  416. key: '',
  417. type: 'selectDomain',
  418. needed: false,
  419. saveKey: 'categoryid',
  420. }, {
  421. title: '所在地区',
  422. content: '',
  423. type: 'selectArea',
  424. needed: false,
  425. saveKey: 'district',
  426. code: ''
  427. }, {
  428. title: '企业详细地址',
  429. placeholder: '请填写企业详细地址',
  430. content: '',
  431. type: 'input',
  432. needed: false,
  433. saveKey: 'detailaddress',
  434. }, {
  435. title: '企业法人',
  436. placeholder: '请填写企业法人',
  437. content: '',
  438. type: 'input',
  439. needed: false,
  440. saveKey: 'legalperson',
  441. }, {
  442. title: '职务',
  443. placeholder: '请填写职务',
  444. content: '',
  445. type: 'input',
  446. needed: true,
  447. saveKey: 'title',
  448. }, {
  449. title: '工作证明',
  450. content: '[]',
  451. type: 'upload',
  452. needed: true,
  453. imagelist: [],
  454. imageSaveList: [],
  455. imageDeleteList: [],
  456. doctype: 4903,
  457. remarkType: 'normal',
  458. }, {
  459. title: '是否认领机构管理员',
  460. type: 'toggle',
  461. content: '10502',
  462. togglecontent: false,
  463. saveKey: 'ifleader'
  464. }, {
  465. title: '机构管理运营确认函',
  466. content: '[]',
  467. type: 'upload',
  468. needed: true,
  469. imagelist: [],
  470. imageSaveList: [],
  471. imageDeleteList: [],
  472. doctype: 4908,
  473. remarkType: 'manage'
  474. }, {
  475. title: '补充文件',
  476. content: '[]',
  477. type: 'upload',
  478. needed: false,
  479. imagelist: [],
  480. imageSaveList: [],
  481. imageDeleteList: [],
  482. doctype: 4900,
  483. remarkType: 'add'
  484. },
  485. ];
  486. var college = [
  487. {
  488. title: '高校全称',
  489. placeholder: '请填写高校全称',
  490. fuzzyQuery: true,
  491. content: '',
  492. type: 'input',
  493. needed: true,
  494. saveKey: 'applyname',
  495. }, {
  496. title: '职务',
  497. placeholder: '请填写职务',
  498. content: '',
  499. type: 'input',
  500. needed: true,
  501. saveKey: 'title',
  502. }, {
  503. title: '所在地区',
  504. content: '',
  505. type: 'selectArea',
  506. needed: false,
  507. saveKey: 'district',
  508. code: ''
  509. }, {
  510. title: '所属领域',
  511. content: '',
  512. key: '',
  513. type: 'selectDomain',
  514. needed: true,
  515. saveKey: 'categoryid',
  516. }, {
  517. title: '工作证明',
  518. content: '[]',
  519. type: 'upload',
  520. needed: true,
  521. imagelist: [],
  522. imageSaveList: [],
  523. imageDeleteList: [],
  524. doctype: 4903,
  525. remarkType: 'normal',
  526. }, {
  527. title: '是否认领机构管理员',
  528. type: 'toggle',
  529. content: '10502',
  530. togglecontent: false,
  531. saveKey: 'ifleader'
  532. }, {
  533. title: '机构管理运营确认函',
  534. content: '[]',
  535. type: 'upload',
  536. needed: true,
  537. imagelist: [],
  538. imageSaveList: [],
  539. imageDeleteList: [],
  540. doctype: 4908,
  541. remarkType: 'manage'
  542. }, {
  543. title: '补充文件',
  544. content: '[]',
  545. type: 'upload',
  546. needed: false,
  547. imagelist: [],
  548. imageSaveList: [],
  549. imageDeleteList: [],
  550. doctype: 4900,
  551. remarkType: 'add'
  552. },
  553. ];
  554. var government = [
  555. {
  556. title: '政府全称',
  557. placeholder: '请填写政府全称',
  558. fuzzyQuery: true,
  559. content: '',
  560. type: 'input',
  561. needed: true,
  562. saveKey: 'applyname',
  563. }, {
  564. title: '职务',
  565. placeholder: '请填写职务',
  566. content: '',
  567. type: 'input',
  568. needed: true,
  569. saveKey: 'title',
  570. }, {
  571. title: '所在地区',
  572. content: '',
  573. type: 'selectArea',
  574. needed: false,
  575. saveKey: 'district',
  576. code: ''
  577. }, {
  578. title: '所在部门',
  579. placeholder: '请填写所在部门',
  580. content: '',
  581. type: 'input',
  582. needed: false,
  583. saveKey: 'department',
  584. }, {
  585. title: '工作证明',
  586. content: '[]',
  587. type: 'upload',
  588. needed: true,
  589. imagelist: [],
  590. imageSaveList: [],
  591. imageDeleteList: [],
  592. doctype: 4903,
  593. remarkType: 'normal',
  594. }, {
  595. title: '是否认领机构管理员',
  596. type: 'toggle',
  597. content: '10502',
  598. togglecontent: false,
  599. saveKey: 'ifleader'
  600. }, {
  601. title: '机构管理运营确认函',
  602. content: '[]',
  603. type: 'upload',
  604. needed: true,
  605. imagelist: [],
  606. imageSaveList: [],
  607. imageDeleteList: [],
  608. doctype: 4908,
  609. remarkType: 'manage'
  610. }, {
  611. title: '补充文件',
  612. content: '[]',
  613. type: 'upload',
  614. needed: false,
  615. imagelist: [],
  616. imageSaveList: [],
  617. imageDeleteList: [],
  618. doctype: 4900,
  619. remarkType: 'add'
  620. },
  621. ];
  622. var serviceorg = [
  623. {
  624. title: '服务机构全称',
  625. placeholder: '请填写服务机构全称',
  626. fuzzyQuery: true,
  627. content: '',
  628. type: 'input',
  629. needed: true,
  630. saveKey: 'applyname',
  631. }, {
  632. title: '统一社会信用代码',
  633. placeholder: '请填写统一社会信用代码',
  634. content: '',
  635. type: 'input',
  636. needed: true,
  637. saveKey: 'orgcode',
  638. }, {
  639. // title:'服务类型',
  640. // content:'',
  641. // type:'input',
  642. // needed:true,
  643. // saveKey:'categoryid',
  644. // dictionarytype:30050,
  645. // dictionary:0
  646. // },{
  647. title: '所在地区',
  648. content: '',
  649. type: 'selectArea',
  650. needed: false,
  651. saveKey: 'district',
  652. code: ''
  653. }, {
  654. title: '机构详细地址',
  655. placeholder: '请填写机构详细地址',
  656. content: '',
  657. type: 'input',
  658. needed: false,
  659. saveKey: 'detailaddress',
  660. }, {
  661. title: '企业法人',
  662. placeholder: '请填写企业法人',
  663. content: '',
  664. type: 'input',
  665. needed: false,
  666. saveKey: 'legalperson',
  667. }, {
  668. title: '职务',
  669. placeholder: '请填写职务',
  670. content: '',
  671. type: 'input',
  672. needed: true,
  673. saveKey: 'title',
  674. }, {
  675. title: '工作证明',
  676. content: '[]',
  677. type: 'upload',
  678. needed: true,
  679. imagelist: [],
  680. imageSaveList: [],
  681. imageDeleteList: [],
  682. doctype: 4903,
  683. remarkType: 'normal',
  684. }, {
  685. title: '是否认领机构管理员',
  686. type: 'toggle',
  687. content: '10502',
  688. togglecontent: false,
  689. saveKey: 'ifleader'
  690. }, {
  691. title: '机构管理运营确认函',
  692. content: '[]',
  693. type: 'upload',
  694. needed: true,
  695. imagelist: [],
  696. imageSaveList: [],
  697. imageDeleteList: [],
  698. doctype: 4908,
  699. remarkType: 'manage'
  700. }, {
  701. title: '补充文件',
  702. content: '[]',
  703. type: 'upload',
  704. needed: false,
  705. imagelist: [],
  706. imageSaveList: [],
  707. imageDeleteList: [],
  708. doctype: 4900,
  709. remarkType: 'add'
  710. },
  711. ];
  712. switch ($scope.code) {
  713. case 4800:
  714. $scope.formList = personal;
  715. break;
  716. case 4803:
  717. $scope.formList = enterprise;
  718. break;
  719. case 4801:
  720. $scope.formList = tecBroker;
  721. break;
  722. case 4804:
  723. $scope.formList = college;
  724. break;
  725. case 4805:
  726. $scope.formList = government;
  727. break;
  728. case 4806:
  729. $scope.formList = serviceorg;
  730. break;
  731. }
  732. // 对接录入
  733. if ($stateParams.comfrom == 'dockingInput') {
  734. $scope.formList = [
  735. {
  736. title: '企业',
  737. placeholder: '请填写企业全称',
  738. fuzzyQuery: true,
  739. content: '',
  740. type: 'input',
  741. needed: false,
  742. saveKey: 'companyid',
  743. rowMargin: true
  744. }, {
  745. title: '需求',
  746. placeholder: '请选择对接需求',
  747. content: null,
  748. selectkey: '',
  749. type: 'companyTaskSelect',
  750. needed: true,
  751. saveKey: 'taskid',
  752. key: null,
  753. list: []
  754. }, {
  755. title: '状态',
  756. placeholder: '请填写状态',
  757. content: '',
  758. type: 'input',
  759. needed: true,
  760. saveKey: 'title',
  761. recommend: '热门状态',
  762. recommendLable: ['洽谈', '签约', '合作中', '完成']
  763. }, {
  764. title: '内容',
  765. placeholder: '请填写对接内容',
  766. type: 'textarea',
  767. maxlength: 500,
  768. content: '',
  769. needed: true,
  770. saveKey: 'content',
  771. }, {
  772. title: '补充文件',
  773. content: '[]',
  774. type: 'upload',
  775. needed: false,
  776. imagelist: [],
  777. imageSaveList: [],
  778. imageDeleteList: [],
  779. doctype: 4900,
  780. remarkType: 'add',
  781. rowMargin: true
  782. }
  783. ]
  784. for (var i = 0; i < $scope.formList.length; i++) {
  785. if ($scope.formList[i].saveKey == 'taskid') {
  786. $scope.formList[i].content = $stateParams.taskTitle;
  787. $scope.tempData.resourceid = $stateParams.taskid;
  788. }
  789. if ($scope.formList[i].saveKey == 'companyid') {
  790. $scope.formList[i].content = $stateParams.companyName;
  791. }
  792. }
  793. taskModuleService.searchCompanyTask($stateParams.companyid, 1, 200).then(function (res) {
  794. console.log(res);
  795. if (res.code == 3350) {
  796. $scope.formList[1].listItem = [];
  797. angular.forEach(res.data, function (val) {
  798. $scope.formList[1].listItem.push({
  799. text: '<a class="action-sheet-push">' + val.projectname + '</a>',
  800. itemkey: val.id,
  801. itemvalue: val.projectname //名字
  802. })
  803. })
  804. }
  805. })
  806. }
  807. if ($stateParams.comfrom == 'taskRelease') {
  808. if (UserService.node != '330122000') {
  809. $scope.formList = [
  810. {
  811. title: '所属企业',
  812. placeholder: '请填写企业全称',
  813. fuzzyQuery: true,
  814. content: '',
  815. type: 'input',
  816. needed: true,
  817. saveKey: 'companyid',
  818. rowMargin: true
  819. }, {
  820. title: '需求名称',
  821. placeholder: '请填写需求名称',
  822. content: '',
  823. type: 'input',
  824. needed: true,
  825. saveKey: 'projectname',
  826. }, {
  827. title: '投入预算(w)',
  828. placeholder: '请填写预算',
  829. content: 0,
  830. type: 'input',
  831. needed: false,
  832. saveKey: 'capitalScale',
  833. inputType: 'number',
  834. }, {
  835. title: '联系人',
  836. placeholder: '请填写联系人',
  837. content: '',
  838. type: 'input',
  839. needed: false,
  840. saveKey: 'contactor',
  841. }, {
  842. title: '联系电话',
  843. placeholder: '请填联系电话',
  844. content: '',
  845. type: 'input',
  846. needed: false,
  847. saveKey: 'tel',
  848. inputType: 'number',
  849. }, {
  850. title: '合作模式',
  851. placeholder: '请选择合作模式',
  852. content: '',
  853. selectkey: 'cooperationmodel',
  854. type: 'select',
  855. needed: false,
  856. saveKey: 'cooperationmodel',
  857. key: ''
  858. }, {
  859. title: '需求类型',
  860. placeholder: '请选择需求类型',
  861. content: '',
  862. selectkey: 'usertask_type',
  863. type: 'select',
  864. needed: true,
  865. saveKey: 'tasktype',
  866. key: '',
  867. }, {
  868. title: '需求介绍',
  869. placeholder: '请填写需求介绍',
  870. type: 'textarea',
  871. maxlength: 500,
  872. content: '',
  873. needed: true,
  874. saveKey: 'taskintroduction',
  875. }, {
  876. title: '关键字',
  877. placeholder: '请请写关键字,多个请用逗号分隔',
  878. content: '',
  879. type: 'input',
  880. needed: false,
  881. saveKey: 'labelname',
  882. }, {
  883. title: '添加图片',
  884. content: '[]',
  885. type: 'upload',
  886. needed: false,
  887. imagelist: [],
  888. imageSaveList: [],
  889. imageDeleteList: [],
  890. doctype: 4911,
  891. remarkType: 'add',
  892. rowMargin: true
  893. }
  894. // ,{
  895. // title:'关键字',
  896. // placeholder:'请填写关键字,逗号隔开',
  897. // content:'',
  898. // type:'input',
  899. // needed:true,
  900. // saveKey:'',
  901. // },
  902. ];
  903. }
  904. if (UserService.node == '330122000') {
  905. $scope.formList = [
  906. {
  907. title: '所属企业',
  908. placeholder: '请填写企业全称',
  909. fuzzyQuery: true,
  910. content: '',
  911. type: 'input',
  912. needed: true,
  913. saveKey: 'companyid',
  914. rowMargin: true
  915. }, {
  916. title: '需求名称',
  917. placeholder: '请填写需求名称',
  918. content: '',
  919. type: 'input',
  920. needed: true,
  921. saveKey: 'projectname',
  922. }, {
  923. title: '投入预算(w)',
  924. placeholder: '请填写预算',
  925. content: 0,
  926. type: 'input',
  927. needed: false,
  928. saveKey: 'capitalScale',
  929. inputType: 'number',
  930. }, {
  931. title: '联系人',
  932. placeholder: '请填写联系人',
  933. content: '',
  934. type: 'input',
  935. needed: false,
  936. saveKey: 'contactor',
  937. }, {
  938. title: '联系电话',
  939. placeholder: '请填联系电话',
  940. content: '',
  941. type: 'input',
  942. needed: false,
  943. saveKey: 'tel',
  944. inputType: 'number',
  945. }, {
  946. title: '合作模式',
  947. placeholder: '请选择合作模式',
  948. content: '',
  949. selectkey: 'cooperationmodel',
  950. type: 'select',
  951. needed: false,
  952. saveKey: 'cooperationmodel',
  953. key: ''
  954. }, {
  955. title: '需求介绍',
  956. placeholder: '请填写需求介绍',
  957. type: 'textarea',
  958. maxlength: 500,
  959. content: '',
  960. needed: true,
  961. saveKey: 'taskintroduction',
  962. }, {
  963. title: '关键字',
  964. placeholder: '请请写关键字,多个请用逗号分隔',
  965. content: '',
  966. type: 'input',
  967. needed: false,
  968. saveKey: 'labelname',
  969. }, {
  970. title: '添加图片',
  971. content: '[]',
  972. type: 'upload',
  973. needed: false,
  974. imagelist: [],
  975. imageSaveList: [],
  976. imageDeleteList: [],
  977. doctype: 4911,
  978. remarkType: 'add',
  979. rowMargin: true
  980. }
  981. // ,{
  982. // title:'关键字',
  983. // placeholder:'请填写关键字,逗号隔开',
  984. // content:'',
  985. // type:'input',
  986. // needed:true,
  987. // saveKey:'',
  988. // },
  989. ];
  990. }
  991. if (JSON.stringify($stateParams.data) != '{}') {
  992. // console.log($stateParams.data);
  993. $scope.formList[0].disable = true;
  994. $scope.orgid = $stateParams.data.baseInfoModel.oid;
  995. $scope.tempData.id = $stateParams.data.resid;
  996. angular.forEach($scope.formList, function (val) {
  997. if (val.type == 'upload') {
  998. val.content = JSON.stringify($stateParams.data.images);
  999. val.imagelist = $stateParams.data.images;
  1000. val.imageSaveList = $stateParams.data.images;
  1001. }
  1002. for (var i = 0; i < $stateParams.data.infoSectionList[0].unitlist.length; i++) {
  1003. var item = $stateParams.data.infoSectionList[0].unitlist[i];
  1004. console.log(item.tcname);
  1005. if (val.saveKey == 'companyid' && item.tcname == 'oid') {
  1006. val.content = item.content;
  1007. }
  1008. if (val.saveKey == item.tcname) {
  1009. val.content = item.content;
  1010. if (val.type == 'upload') {
  1011. var temp = JSON.parse(item.content);
  1012. val.imagelist = temp;
  1013. val.imageSaveList = temp;
  1014. item.content = [];
  1015. }
  1016. }
  1017. }
  1018. console.log(val);
  1019. val.saveKey == 'projectname' ? val.content = $stateParams.data.title :
  1020. val.saveKey == 'capitalScale' ? val.content = Number($stateParams.data.capitalScale) :
  1021. val.saveKey == 'taskintroduction' ? val.content = $stateParams.data.content :
  1022. val.saveKey == 'tel' ? val.content = Number($stateParams.data.tel) :
  1023. "";
  1024. })
  1025. }
  1026. // 接单类型
  1027. dataToolsService.getTypeEntryListByTypeName('usertask_show').then(function (res) {
  1028. console.log(res);
  1029. if (res.code == 3350) {
  1030. angular.forEach(res.data, function (val) {
  1031. val.class = val.itemvalue == 5310 ? 'iconfont-single-select'
  1032. : val.itemvalue == 5311 ? 'iconfont-add-person' : '';
  1033. val.checked = false;
  1034. })
  1035. $scope.taskType = res.data;
  1036. $scope.taskType[0].checked = true;
  1037. if ($stateParams.data.opentowho && $stateParams.data.opentowho.length > 0) {
  1038. $scope.taskType[0].checked = false;
  1039. $scope.taskType[1].checked = true;
  1040. $scope.releaseToWhoList = $stateParams.data.opentowho;
  1041. }
  1042. }
  1043. })
  1044. // $scope.taskType=[
  1045. // {name:'自主接单',checked:true,class:'iconfont-single-select',id:5310},
  1046. // {name:'邀请接单',checked:false,class:'iconfont-add-person',id:5311},
  1047. // ];
  1048. }
  1049. $scope.addressList = false;
  1050. $scope.releaseToWhoList = [];
  1051. var opentype = 5310;
  1052. $scope.selectOpentype = function (index) {
  1053. console.log(index);
  1054. angular.forEach($scope.taskType, function (val) {
  1055. val.checked = false;
  1056. })
  1057. $scope.taskType[index].checked = true;
  1058. $scope.addressList = $scope.taskType[index].itemvalue == 5311;
  1059. opentype = $scope.taskType[index].itemvalue;
  1060. console.log(opentype);
  1061. if ($scope.taskType[index].itemvalue == 5311) {
  1062. $scope.taskInvite.show();
  1063. }
  1064. }
  1065. var getContacts = function () {
  1066. ScienceCircleService.getContacts(0).then(function (res) {
  1067. console.log(res);
  1068. angular.forEach(res, function (val) {
  1069. angular.forEach(val.userlist, function (value) {
  1070. value.select = false;
  1071. })
  1072. });
  1073. $scope.mailDatas = res;
  1074. })
  1075. }
  1076. getContacts();
  1077. $scope.closeAddressList = function () {
  1078. $scope.addressList = false;
  1079. }
  1080. $scope.selectPeople = function (outerIndex, innerIndex) {
  1081. $scope.mailDatas[outerIndex].userlist[innerIndex].select = !$scope.mailDatas[outerIndex].userlist[innerIndex].select;
  1082. if ($scope.mailDatas[outerIndex].userlist[innerIndex].select) {
  1083. $scope.releaseToWhoList.push($scope.mailDatas[outerIndex].userlist[innerIndex]);
  1084. } else {
  1085. for (var i = 0; i < $scope.releaseToWhoList.length; i++) {
  1086. if ($scope.releaseToWhoList[i] == $scope.mailDatas[outerIndex].userlist[innerIndex].userid) {
  1087. $scope.releaseToWhoList.splice(i, 1);
  1088. }
  1089. }
  1090. }
  1091. console.log($scope.releaseToWhoList);
  1092. }
  1093. $scope.deleteSelectedPerson = function (id, index) {
  1094. for (var i = 0; i < $scope.mailDatas.length; i++) {
  1095. if ($scope.mailDatas[i].userUpper == $scope.releaseToWhoList[index].userNamePinYin) {
  1096. for (var j = 0; j < $scope.mailDatas[i].userlist.length; j++) {
  1097. if ($scope.mailDatas[i].userlist[j].userid == id) {
  1098. $scope.mailDatas[i].userlist[j].select = false;
  1099. }
  1100. }
  1101. }
  1102. }
  1103. $scope.releaseToWhoList.splice(index, 1);
  1104. }
  1105. $scope.keyfilter = {
  1106. key: ""
  1107. }
  1108. $scope.isShowSearchButton = true;
  1109. $scope.showSearchButtonLeft = function () {
  1110. // console.log('aaa');
  1111. $scope.isShowSearchButton = false;
  1112. $timeout(function () {
  1113. $(".showSearchInput").focus();
  1114. }, 300)
  1115. };
  1116. $scope.clearSearch = function () {
  1117. $scope.isShowSearchButton = true;
  1118. $scope.keyfilter.key = "";
  1119. $scope.searchDatas = [];
  1120. }
  1121. $scope.getPersonData = function () {
  1122. console.log(1)
  1123. $scope.showLoadingToast();
  1124. ScienceCircleService.searchUser($scope.keyfilter.key, 1).then(function (response) {
  1125. console.log(response);
  1126. $scope.searchDatas = response.data.user;
  1127. // if ($scope.userList.length < 1) {
  1128. // $scope.shownone = true;
  1129. // } else {
  1130. // $scope.shownone = false;
  1131. // }
  1132. if ($scope.searchDatas.length == 0) {
  1133. if ($scope.app) {
  1134. UtilService.showMess("未搜索到相关用户");
  1135. } else {
  1136. CommonService.showMessage("未搜索到相关用户", $scope);
  1137. }
  1138. }
  1139. // toSelectUserList(response);
  1140. }, function () {
  1141. if ($scope.app) {
  1142. UtilService.showMess("网络不给力,请重试");
  1143. } else {
  1144. CommonService.showMessage("网络不给力,请重试", $scope);
  1145. }
  1146. }).finally(function () {
  1147. $scope.hideLoadingToast();
  1148. });
  1149. }
  1150. $scope.selectSearchPeople = function (index) {
  1151. $scope.releaseToWhoList.push($scope.searchDatas[index]);
  1152. $scope.keyfilter.key = '';
  1153. $scope.searchDatas = [];
  1154. }
  1155. // 模糊查询
  1156. $scope.queryOrgName = function (index) {
  1157. if ($scope.formList[index].fuzzyQuery) {
  1158. if ($scope.formList[index].content) {
  1159. var pagecode = $scope.code == 4803 ? 1000003 : 1000004;
  1160. dataToolsService.getOrganizationModelByOrgname($scope.formList[index].content, pagecode, 0).then(function (response) {
  1161. // console.log(response);
  1162. if (response.code == 3350) {
  1163. $scope.orgList = response.data;
  1164. $scope.isRelateUl = true;
  1165. } else {
  1166. $scope.orgList = [];
  1167. $scope.isRelateUl = false;
  1168. }
  1169. }, function () {
  1170. })
  1171. } else {
  1172. $scope.isRelateUl = false;
  1173. $scope.orgList = [];
  1174. }
  1175. }
  1176. }
  1177. $scope.ttt = function (tmptitle) {
  1178. return $sce.trustAsHtml(tmptitle);
  1179. }
  1180. var getSaveKeyContent = function (list, key, org) {
  1181. for (var i = 0; i < list.length; i++) {
  1182. if (list[i].tcname == key) {
  1183. list[i].content = org[key];
  1184. return;
  1185. }
  1186. ;
  1187. }
  1188. }
  1189. if ($scope.code == 4803 && $stateParams.companyName != '') {
  1190. $scope.formList[0].content = $stateParams.companyName;
  1191. $scope.queryOrgName(0);
  1192. }
  1193. //*************选择区域
  1194. $scope.areaDropDown = [
  1195. {
  1196. title: '省',
  1197. code: '0',
  1198. showList: false,
  1199. list: [],
  1200. selectName: '',
  1201. }, {
  1202. title: '市',
  1203. code: '1',
  1204. showList: false,
  1205. list: [],
  1206. selectName: '',
  1207. }, {
  1208. title: '区',
  1209. showList: false,
  1210. code: '1',
  1211. list: [],
  1212. selectName: '',
  1213. }
  1214. ]
  1215. $scope.domainDropDown = [
  1216. {
  1217. title: '请选择',
  1218. code: '0',
  1219. showList: false,
  1220. list: [],
  1221. selectName: '',
  1222. }, {
  1223. title: '请选择',
  1224. code: '1',
  1225. showList: false,
  1226. list: [],
  1227. selectName: '',
  1228. }, {
  1229. title: '请选择',
  1230. showList: false,
  1231. code: '1',
  1232. list: [],
  1233. selectName: '',
  1234. }
  1235. ]
  1236. var getAreaList = function (code, index) {
  1237. AccountService.getAreaInfo(code).then(function (res) {
  1238. if (res.code == 3350) {
  1239. // console.log(res);
  1240. // $scope.areaDropDown[index].list=res.data;
  1241. $scope.areaDropDown[index].list = [];
  1242. angular.forEach(res.data, function (val) {
  1243. $scope.areaDropDown[index].list.push({
  1244. text: '<a class="action-sheet-push">' + val.areaname + '</a>',
  1245. itemkey: val.id,
  1246. itemvalue: val.areaname //名字
  1247. })
  1248. })
  1249. } else {
  1250. }
  1251. })
  1252. }
  1253. var getDomainList = function (code, index) {
  1254. AccountService.getDomainInfo(code, UserService.node).then(function (res) {
  1255. if (res.code == 3350) {
  1256. // console.log(res);
  1257. angular.forEach(res.data, function (val) {
  1258. $scope.domainDropDown[index].list.push({
  1259. text: '<a class="action-sheet-push">' + val.name + '</a>',
  1260. itemkey: val.id,
  1261. itemvalue: val.name, //名字,
  1262. itemcode: val.code
  1263. })
  1264. })
  1265. } else {
  1266. }
  1267. })
  1268. }
  1269. $scope.seeTechnicalInfo = function (technical) {
  1270. $scope.go('signDemandContractDetail', {contract: technical});
  1271. }
  1272. //获取所有节点列表
  1273. var getNodeList = function () {
  1274. };
  1275. angular.forEach($scope.formList, function (val) {
  1276. if (val.type == 'affiliatedOrg') {
  1277. var pagecode = $scope.code == 4803 ? 1000003 : 1000004;
  1278. dataToolsService.getOrganizationModelByOrgname(' ', pagecode, 0, 1).then(function (response) {
  1279. console.log(response);
  1280. if (response.data.length > 0) {
  1281. if ($stateParams.type == 5100) {
  1282. $scope.brokernode = UserService.node;
  1283. if (UserService.node != '330122000') {
  1284. val.content = '普适云平台';
  1285. val.key = '123456';
  1286. }
  1287. }
  1288. val.listItem = [];
  1289. angular.forEach(response.data, function (value) {
  1290. val.listItem.push({
  1291. text: '<a class="action-sheet-push">' + value.name + '</a>',
  1292. itemkey: value.id,
  1293. itemvalue: value.name //名字
  1294. })
  1295. })
  1296. }
  1297. }, function () {
  1298. });
  1299. }
  1300. if (val.type == 'select') {
  1301. val.listItem = [];
  1302. dataToolsService.getTypeEntryListByTypeName(val.selectkey).then(function (res) {
  1303. if (res.code == 3350) {
  1304. angular.forEach(res.data, function (value) {
  1305. val.listItem.push({
  1306. text: '<a class="action-sheet-push">' + value.itemkey + '</a>',
  1307. itemkey: value.itemvalue,
  1308. itemvalue: value.itemkey //名字
  1309. })
  1310. })
  1311. $timeout(function () {
  1312. if (val.content) {
  1313. var temp = val.listItem.filter(function (vv) {
  1314. return vv.itemvalue == val.content;
  1315. })
  1316. if (temp.length > 0) {
  1317. val.key = temp[0].itemkey;
  1318. }
  1319. }
  1320. }, 1000);
  1321. }
  1322. })
  1323. }
  1324. if (val.type == 'selectArea') {
  1325. getAreaList(0, 0);
  1326. }
  1327. if (val.type == 'selectDomain') {
  1328. // getDomainList(0,0);
  1329. // console.log(val);
  1330. val.listItem = [];
  1331. AccountService.getDomainInfo(0, UserService.node).then(function (res) {
  1332. if (res.code == 3350) {
  1333. // console.log(res);
  1334. angular.forEach(res.data, function (value) {
  1335. val.listItem.push({
  1336. text: '<a class="action-sheet-push">' + value.name + '</a>',
  1337. itemkey: value.code,
  1338. itemvalue: value.name, //名字,
  1339. // itemcode:value.code
  1340. })
  1341. })
  1342. } else {
  1343. }
  1344. })
  1345. }
  1346. })
  1347. $timeout(function () {
  1348. console.log($scope.formList);
  1349. }, 4000)
  1350. // 获取数据处理
  1351. var dealWithData = function (temp) {
  1352. console.log(temp);
  1353. $scope.orgid = temp.orgid ? temp.orgid : 0;
  1354. // 处理数据
  1355. var arr = [];
  1356. $scope.refusereason = temp.refusereason;
  1357. if (temp.images != '' && temp.images != null) {
  1358. arr = JSON.parse(temp.images);
  1359. }
  1360. // console.log(temp);
  1361. for (var key in temp) {
  1362. for (var i = 0; i < $scope.formList.length; i++) {
  1363. if (key == $scope.formList[i].saveKey) {
  1364. console.log(key);
  1365. $scope.formList[i].content = temp[key];
  1366. // if(key=='district'&&temp[key]!=''&&$scope.formList[i].type=='selectArea'){
  1367. // console.log(temp[key]);
  1368. // var tp=JSON.parse(temp[key]);
  1369. // var str='';
  1370. // angular.forEach(tp,function(val,index){
  1371. // str+=val.name+' ';
  1372. // })
  1373. // $scope.formList[i].content=str;
  1374. // }
  1375. if ($scope.showNew == true && key == 'district' && temp[key] != '' && $scope.formList[i].type == 'selectArea') {
  1376. var tempArry = temp[key].split('/')
  1377. // console.log(temp);
  1378. for (var j = 0; j < $scope.areaDropDown.length; j++) {
  1379. $scope.areaDropDown[j].selectName = tempArry[j];
  1380. }
  1381. }
  1382. if ($scope.formList[i].type == 'select' || $scope.formList[i].type == 'selectDomain' || $scope.formList[i].type == 'affiliatedOrg' || $scope.formList[i].type == 'companyTaskSelect') {
  1383. // console.log($scope.formList[i]);
  1384. // console.log(temp[key]);
  1385. var tparr = $scope.formList[i].listItem.filter(function (vv) {
  1386. return vv.itemkey == temp[key];
  1387. })
  1388. // console.log(tparr);
  1389. $scope.formList[i].content = tparr.length > 0 ? tparr[0].itemvalue : '';
  1390. $scope.formList[i].key = tparr.length > 0 ? tparr[0].itemkey : '';
  1391. }
  1392. if ($scope.formList[i].type == 'toggle') {
  1393. $scope.formList[i].content = temp[key] == 10501 ? '是' : '否';
  1394. $scope.formList[i].togglecontent = temp[key] == 10501 ? true : false;
  1395. }
  1396. }
  1397. if ($scope.formList[i].type == 'upload' && arr.length > 0) {
  1398. $scope.formList[i].imagelist = arr.filter(function (va, ind) {
  1399. return $scope.formList[i].doctype == va.doctype;
  1400. })
  1401. $scope.formList[i].imageSaveList = arr.filter(function (va, ind) {
  1402. return $scope.formList[i].doctype == va.doctype;
  1403. })
  1404. $scope.formList[i].content = '点击放大查看图片';
  1405. }
  1406. // if($scope.formList[i].type=='selectArea'){
  1407. // console.log($scope.formList[i].content);
  1408. // if($scope.formList[i].content!=''){
  1409. // var tempArea=JSON.parse($scope.formList[i].content);
  1410. // var str='';
  1411. // angular.forEach(tempArea,function(val,index){
  1412. // str+=val.name+' ';
  1413. // })
  1414. // $scope.formList[i].content=str;
  1415. // }
  1416. // }
  1417. // if($scope.formList[i].type=='select'){
  1418. // var tempArr=JSON.parse(temp[key]);
  1419. //
  1420. // }
  1421. }
  1422. }
  1423. console.log($scope.formList);
  1424. };
  1425. $scope.checkData = {};
  1426. $scope.agree = true;
  1427. if ($scope.showHistory == true) {
  1428. if ($scope.action == 'submit') {
  1429. // 获取认证信息
  1430. // console.log($scope.code);
  1431. AccountService.getAuthMessageInfo($scope.code).then(function (res) {
  1432. console.log(res);
  1433. if (res.code == 3350) {
  1434. // $scope.dataList=res.data;
  1435. // console.log(res);
  1436. // console.log($stateParams);
  1437. var temp = res.data.filter(function (val, index, arr) {
  1438. return val.id == $stateParams.id;
  1439. })[0];
  1440. $scope.id = temp.id;
  1441. dealWithData(temp);
  1442. }
  1443. })
  1444. } else if ($scope.action == 'check') {
  1445. // console.log(2);
  1446. AccountService.getAuthCheckInfo($stateParams.pagenum, $stateParams.pagesize, '', 0, 0).then(function (res) {
  1447. // console.log(res);
  1448. if (res.code == 3350) {
  1449. // $scope.dataList=res.data;
  1450. var temp = res.data.filter(function (val, index, arr) {
  1451. return val.id == $stateParams.id;
  1452. })[0];
  1453. console.log(temp);
  1454. $scope.checkData = temp;
  1455. $scope.agree = $scope.checkData.authenstatus != 5103
  1456. dealWithData(temp);
  1457. }
  1458. })
  1459. }
  1460. }
  1461. $scope.selectItems = function (index) {
  1462. // console.log(index);
  1463. if ($scope.formList[index].type == 'select' || $scope.formList[index].type == 'selectDomain' || $scope.formList[index].type == 'affiliatedOrg' || $scope.formList[index].type == 'companyTaskSelect') {
  1464. var list = $scope.formList[index].listItem;
  1465. $ionicActionSheet.show({
  1466. buttons: list,
  1467. cancelText: '取消',
  1468. buttonClicked: function (indx) {
  1469. if ($stateParams.comfrom == 'dockingInput') {
  1470. $stateParams.taskid = list[indx].itemkey
  1471. }
  1472. $scope.formList[index].key = list[indx].itemkey;
  1473. $scope.formList[index].content = list[indx].itemvalue;
  1474. return true;
  1475. }
  1476. })
  1477. }
  1478. }
  1479. $scope.gobackpage = function () {
  1480. $scope.goback();
  1481. /*if(UserService.isTaskFlag == 1){
  1482. $scope.go('taskHoll');
  1483. UserService.isTaskFlag = 0;
  1484. }else{
  1485. goback();
  1486. }*/
  1487. }
  1488. // 选中机构
  1489. $scope.setOrgName = function (org, list) {
  1490. // console.log(org);
  1491. $scope.orgid = org.id;
  1492. for (var key in org) {
  1493. for (var i = 0; i < $scope.formList.length; i++) {
  1494. if ($scope.formList[i].saveKey == key) {
  1495. $scope.formList[i].content = org[key];
  1496. if ($scope.formList[i].type == 'select') {
  1497. var tparr = $scope.formList[i].listItem.filter(function (vv) {
  1498. return vv.itemkey == org[key];
  1499. })
  1500. $scope.formList[i].content = tparr.length > 0 ? tparr[0].itemvalue : '';
  1501. }
  1502. }
  1503. if ($scope.formList[i].saveKey == list.saveKey) {
  1504. $scope.formList[i].content = org.name;
  1505. }
  1506. }
  1507. }
  1508. // console.log($scope.formList);
  1509. $scope.isRelateUl = false;
  1510. if ($stateParams.comfrom == 'dockingInput') {
  1511. taskModuleService.searchCompanyTask(org.id, 1, 200).then(function (res) {
  1512. console.log(res);
  1513. if (res.code == 3350) {
  1514. $scope.formList[1].listItem = [];
  1515. angular.forEach(res.data, function (val) {
  1516. $scope.formList[1].listItem.push({
  1517. text: '<a class="action-sheet-push">' + val.projectname + '</a>',
  1518. itemkey: val.id,
  1519. itemvalue: val.projectname //名字
  1520. })
  1521. })
  1522. }
  1523. })
  1524. }
  1525. }
  1526. var hasArea = function () {
  1527. angular.forEach($scope.formList, function (val, index) {
  1528. if (val.type == 'selectArea') {
  1529. if (val.content != '') {
  1530. // var temp=JSON.parse(val.content);
  1531. var temp = val.content.split('/');
  1532. for (var i = 0; i < $scope.areaDropDown.length; i++) {
  1533. // $scope.areaDropDown[i].code=temp[i].code;
  1534. // $scope.areaDropDown[i].selectName=temp[i].name;
  1535. $scope.areaDropDown[i].selectName = temp[i];
  1536. // getAreaList(temp[i].code,i);
  1537. }
  1538. }
  1539. return true
  1540. }
  1541. ;
  1542. })
  1543. return false;
  1544. }
  1545. $scope.showAreaList = function (index, outerIndex, arr, key) {
  1546. // console.log(arr);
  1547. var list = arr[index].list;
  1548. $ionicActionSheet.show({
  1549. buttons: list,
  1550. cancelText: '取消',
  1551. buttonClicked: function (indx) {
  1552. // 先清除
  1553. if (index == 0) {
  1554. arr[1].selectName = '';
  1555. arr[2].selectName = '';
  1556. arr[1].code = '';
  1557. arr[2].code = '';
  1558. } else if (index == 1) {
  1559. arr[2].selectName = '';
  1560. arr[2].code = '';
  1561. }
  1562. if (index < 2) {
  1563. arr[index + 1].code = list[indx].itemkey;
  1564. if (key == 'area') {
  1565. getAreaList(list[indx].itemkey, index + 1);
  1566. } else {
  1567. getDomainList(list[indx].itemkey, index + 1);
  1568. }
  1569. }
  1570. arr[index].selectName = list[indx].itemvalue;
  1571. // var tempArr=[];
  1572. // angular.forEach(arr,function(val,index){
  1573. // tempArr.push({name:val.selectName,code:val.code});
  1574. // })
  1575. var tempArr = '';
  1576. angular.forEach(arr, function (val, index) {
  1577. tempArr += val.selectName + '/';
  1578. })
  1579. $scope.formList[outerIndex].code = list[indx].itemkey;
  1580. if (index == 0) {
  1581. $scope.formList[outerIndex].content = tempArr.slice(0, tempArr.length - 3);
  1582. } else {
  1583. $scope.formList[outerIndex].content = tempArr.slice(0, tempArr.length - 1);
  1584. }
  1585. // console.log($scope.formList[outerIndex].content);
  1586. return true;
  1587. }
  1588. })
  1589. }
  1590. $scope.setAreaListCode = function (code, name, index, outerIndex) {
  1591. // 先清除
  1592. if (index == 0) {
  1593. $scope.areaDropDown[1].selectName = '';
  1594. $scope.areaDropDown[2].selectName = '';
  1595. $scope.areaDropDown[1].code = '1';
  1596. $scope.areaDropDown[2].code = '1';
  1597. } else if (index == 1) {
  1598. $scope.areaDropDown[2].selectName = '';
  1599. $scope.areaDropDown[2].code = '1';
  1600. }
  1601. // 然后再新赋值,准备下一级别数据
  1602. $scope.areaDropDown[index].showList = false;
  1603. if (index + 1 < $scope.areaDropDown.length) {
  1604. $scope.areaDropDown[index + 1].code = code;
  1605. getAreaList(code, index + 1);
  1606. }
  1607. $scope.areaDropDown[index].selectName = name;
  1608. var tempArr = [];
  1609. angular.forEach($scope.areaDropDown, function (val, index) {
  1610. tempArr.push({name: val.selectName, code: val.code});
  1611. })
  1612. $scope.formList[outerIndex].content = JSON.stringify(tempArr);
  1613. }
  1614. // *************有效证件
  1615. $scope.showCTList = false;
  1616. // $scope.certificateType=[
  1617. // {name:'身份证',code:1},
  1618. // {name:'军官证',code:2},
  1619. // ]
  1620. $scope.showCertificateTypeList = function (index) {
  1621. $scope.clickIndex = index;
  1622. $scope.showCTList = true;
  1623. }
  1624. $scope.setCertificateType = function (index) {
  1625. $scope.showCTList = false;
  1626. $scope.formList[$scope.clickIndex].content = $scope.formList[$scope.clickIndex].listItem[index].itemkey;
  1627. $scope.formList[$scope.clickIndex].itemvalue = $scope.formList[$scope.clickIndex].listItem[index].itemvalue;
  1628. }
  1629. // *************上传照片
  1630. // 先从数据中读取照片
  1631. angular.forEach($scope.formList, function (val, index) {
  1632. if (val.type == 'upload') {
  1633. if (val.content != '') {
  1634. var temp = JSON.parse(val.content);
  1635. val.imagelist = Object.assign([], JSON.parse(val.content));
  1636. val.imageSaveList = Object.assign([], JSON.parse(val.content));
  1637. val.content = [];
  1638. console.log(val);
  1639. }
  1640. }
  1641. ;
  1642. })
  1643. // console.log($scope.formList);
  1644. //加载动画
  1645. $scope.showLoadingToast = function () {
  1646. $ionicLoading.show({
  1647. template: '<ion-spinner icon="bubbles" class="spinner-calm"></ion-spinner>',
  1648. content: '努力加载中',
  1649. animation: 'fade-in',
  1650. showBackdrop: true,//是否显示蒙层
  1651. maxWidth: 150,
  1652. showDelay: 0
  1653. });
  1654. // $timeout(function () {
  1655. // $ionicLoading.hide();
  1656. // }, 15000);
  1657. };
  1658. //关闭加载动画
  1659. $scope.hideLoadingToast = function () {
  1660. $ionicLoading.hide();
  1661. };
  1662. var listIndex = 1000;
  1663. $scope.addImage = function (index) {
  1664. listIndex = index;
  1665. if ($scope.app) {
  1666. var list = [
  1667. {text: '<a class="action-sheet-push">拍照</a>'},
  1668. {text: '<a class="action-sheet-push">从相册上传</a>'},
  1669. ];
  1670. var clickfunction = function (indx) {
  1671. if (indx == 0) {
  1672. $scope.openCamera();
  1673. } else {
  1674. getPictures();
  1675. }
  1676. return true;
  1677. }
  1678. } else {
  1679. var list = [
  1680. {text: '<a class="action-sheet-push">从相册上传</a>'},
  1681. ];
  1682. var clickfunction = function (indx) {
  1683. if (indx == 0) {
  1684. var files = document.getElementById('file');
  1685. files.click();
  1686. $(files).unbind().on('change', function (e) {
  1687. // console.log(e);
  1688. if ($scope.formList[listIndex].imagelist.length > 1) {
  1689. if ($scope.app) {
  1690. UtilService.showMess('只能上传一张照片');
  1691. } else {
  1692. CommonService.showMessage('只能上传一张照片', $scope);
  1693. }
  1694. return;
  1695. }
  1696. $.each(e.target.files, function (i, file) {
  1697. var url = null;
  1698. if (window.createObjectURL != undefined) { // basic
  1699. url = window.createObjectURL(file);
  1700. } else if (window.URL != undefined) { // mozilla(firefox)
  1701. url = window.URL.createObjectURL(file);
  1702. } else if (window.webkitURL != undefined) { // webkit or chrome
  1703. url = window.webkitURL.createObjectURL(file);
  1704. }
  1705. $scope.formList[listIndex].imagelist.push({photoName: url, originalName: url});
  1706. })
  1707. $.each(e.target.files, function (i, file) {
  1708. var data = new FormData();
  1709. data.append('file', file);
  1710. CommonService.webUploadImage(data).then(function (res) {
  1711. var temp = {
  1712. id: 0,
  1713. title: "",
  1714. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  1715. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  1716. photoName: res.photoName,
  1717. originalName: res.originalName,
  1718. sourceName: res.sourceName,
  1719. sourceSize: res.sourceSize
  1720. }
  1721. $scope.formList[listIndex].imageSaveList.push(temp);
  1722. // console.log(temp);
  1723. // console.log($scope.formList[listIndex]);
  1724. })
  1725. });
  1726. })
  1727. }
  1728. return true;
  1729. }
  1730. }
  1731. $ionicActionSheet.show({
  1732. buttons: list,
  1733. cancelText: '取消',
  1734. buttonClicked: clickfunction
  1735. })
  1736. }
  1737. $scope.openCamera = function () {
  1738. if ($scope.formList[listIndex].imagelist.length >= 9) {
  1739. if ($scope.app) {
  1740. UtilService.showMess("最多选取9张图片");
  1741. } else {
  1742. CommonService.showMessage("最多选取9张图片", $scope)
  1743. }
  1744. return;
  1745. }
  1746. UtilService.getPicture(1).then(function (results) {
  1747. $scope.showLoadingToast();
  1748. $scope.formList[listIndex].imagelist.push({photoName: results, originalName: results})
  1749. UtilService.uploadFile([results], 0, "image/jpeg").then(function (response) {
  1750. angular.forEach(response, function (value) {
  1751. $scope.formList[listIndex].imageSaveList.push({
  1752. id: 0,
  1753. title: "",
  1754. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  1755. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  1756. photoName: value.photoName,
  1757. originalName: value.originalName,
  1758. sourceName: value.sourceName,
  1759. sourceSize: value.sourceSize
  1760. })
  1761. })
  1762. $scope.hideLoadingToast();
  1763. }, function () {
  1764. $scope.hideLoadingToast();
  1765. if ($scope.app) {
  1766. UtilService.showMess("网络不给力,请重试");
  1767. } else {
  1768. CommonService.showMessage("网络不给力,请重试", $scope)
  1769. }
  1770. });
  1771. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  1772. }, function (err) {
  1773. });
  1774. }
  1775. var getPictures = function () {
  1776. if (device.platform == "Android") {
  1777. verifyStorage();
  1778. } else {
  1779. getPic();
  1780. }
  1781. };
  1782. var verifyStorage = function () {
  1783. window.imagePicker.verifyStorage(
  1784. function (results) {
  1785. if (results == "1") {
  1786. getPic();
  1787. }
  1788. }, function (error) {
  1789. }
  1790. );
  1791. };
  1792. var getPic = function () {
  1793. var imagelistLength = $scope.formList[listIndex].imagelist.length;
  1794. if (imagelistLength >= 9) {
  1795. if ($scope.app) {
  1796. UtilService.showMess("最多选取9张图片");
  1797. } else {
  1798. CommonService.showMessage("最多选取9张图片", $scope)
  1799. }
  1800. return;
  1801. }
  1802. UtilService.getPictureList(9 - imagelistLength).then(function (results) {
  1803. $scope.showLoadingToast();
  1804. angular.forEach(results, function (val, i) {
  1805. $scope.formList[listIndex].imagelist.push({photoName: val, originalName: val});
  1806. })
  1807. UtilService.uploadFile(results, 0, "image/jpeg").then(function (response) {
  1808. angular.forEach(response, function (value) {
  1809. if (value.status) {
  1810. $scope.formList[listIndex].imageSaveList.push({
  1811. id: 0,
  1812. title: "",
  1813. doctype: $scope.formList[listIndex].doctype,//文档类型 1图片,2文件,3pdf,4xls
  1814. isenabled: 1,//是否可用:0-不可用,1-可用,2-已停用
  1815. photoName: value.photoName,
  1816. originalName: value.originalName,
  1817. sourceName: value.sourceName,
  1818. sourceSize: value.sourceSize
  1819. });
  1820. }
  1821. })
  1822. $scope.hideLoadingToast();
  1823. }, function () {
  1824. $scope.hideLoadingToast();
  1825. if ($scope.app) {
  1826. UtilService.showMess("网络不给力,请重试");
  1827. } else {
  1828. CommonService.showMessage("网络不给力,请重试", $scope)
  1829. }
  1830. });
  1831. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  1832. }, function (err) {
  1833. });
  1834. };
  1835. //删除图片
  1836. $scope.deletePhoto = function (index, outerIndex) {
  1837. console.log($scope.formList[outerIndex]);
  1838. if ($scope.formList[outerIndex].imageSaveList[index].id != 0) {
  1839. $scope.formList[outerIndex].imageSaveList[index].isenabled = 2;
  1840. $scope.formList[outerIndex].imageDeleteList.push($scope.formList[outerIndex].imageSaveList[index]);
  1841. }
  1842. $scope.formList[outerIndex].imagelist.splice(index, 1);
  1843. $scope.formList[outerIndex].imageSaveList.splice(index, 1);
  1844. // console.log($scope.formList[outerIndex].imagelist);
  1845. // console.log($scope.formList[outerIndex].imageSaveList);
  1846. // console.log($scope.formList[outerIndex].imageDeleteList);
  1847. }
  1848. $scope.uploadPic = function (e) {
  1849. // console.log(2);
  1850. // console.log(e.target);
  1851. }
  1852. // **************切换开关
  1853. $scope.watchIsChange = function (index) {
  1854. $scope.formList[index].content = $scope.formList[index].togglecontent ? "10501" : "10502";
  1855. }
  1856. // **************提交按钮
  1857. $scope.checkNotice = function () {
  1858. $scope.isChecked = !$scope.isChecked;
  1859. }
  1860. // 处理审核
  1861. $scope.reSubmit = function () {
  1862. $scope.showNew = true;
  1863. $scope.showHistory = false;
  1864. $scope.tempData = {};
  1865. $scope.tempData.id = $scope.id;
  1866. console.log($scope.formList);
  1867. angular.forEach($scope.formList, function (val) {
  1868. if (val.type == 'upload') {
  1869. val.imageSaveList = Object.assign([], val.imagelist);
  1870. }
  1871. if (val.type == 'selectArea' && val.content != '') {
  1872. var temp = val.content.split('/')
  1873. // console.log(temp);
  1874. for (var i = 0; i < $scope.areaDropDown.length; i++) {
  1875. $scope.areaDropDown[i].selectName = temp[i];
  1876. }
  1877. }
  1878. })
  1879. }
  1880. if ($stateParams.comfrom == 'resubmit') {
  1881. $scope.id = $stateParams.id;
  1882. $scope.reSubmit();
  1883. }
  1884. var dealWidthData = function () {
  1885. console.log($scope.formList);
  1886. var tempImages = [];
  1887. angular.forEach($scope.formList, function (val, index) {
  1888. if (val.type == 'upload') {
  1889. // 处理照片
  1890. // if(val.imagelist.length>0){
  1891. // val.imageSaveList=Object.assign([],val.imagelist);
  1892. // }
  1893. val.content = '';
  1894. var temp = Object.assign([], val.imageSaveList);
  1895. angular.forEach(val.imageSaveList, function (v) {
  1896. tempImages.push(v);
  1897. })
  1898. if (val.imageDeleteList.length > 0) {
  1899. angular.forEach(val.imageDeleteList, function (value) {
  1900. tempImages.push(value);
  1901. temp.push(value)
  1902. })
  1903. }
  1904. val.content = JSON.stringify(temp);
  1905. } else if (val.type == 'select' || val.type == 'selectDomain' || val.type == 'affiliatedOrg' || val.type == 'companyTaskSelect') {
  1906. $scope.tempData[val.saveKey] = val.key;
  1907. } else if (val.type == 'selectArea') {
  1908. $scope.tempData[val.saveKey] = val.content;
  1909. $scope.tempData.regionsid = val.code;
  1910. } else if (val.type == 'toggle') {
  1911. if (val.content == '是' || val.content == '否') {
  1912. val.content = val.content == '是' ? 10502 : 10501;
  1913. }
  1914. $scope.tempData[val.saveKey] = val.content;
  1915. } else {
  1916. $scope.tempData[val.saveKey] = val.content;
  1917. }
  1918. })
  1919. console.log(tempImages);
  1920. $scope.tempData.images = JSON.stringify(tempImages);
  1921. }
  1922. // 发布任务
  1923. // 获取connid
  1924. var getConnid = function () {
  1925. var def = $q.defer();
  1926. $scope.requestModel = {
  1927. data: {
  1928. orgtype: 10104,
  1929. templettype: 4,
  1930. title: $scope.formList[0].content,
  1931. organizationInfo: {
  1932. orgtype: 10104,
  1933. name: $scope.formList[0].content,
  1934. id: $scope.orgid ? $scope.orgid : 0
  1935. },
  1936. userModel: {
  1937. userid: UserService.id
  1938. }
  1939. },
  1940. node: UserService.node,
  1941. userid: UserService.id
  1942. }
  1943. console.log($scope.requestModel);
  1944. dataToolsService.saveOrganizationInfo($scope.requestModel).then(function (response) {
  1945. console.log(response);
  1946. if (response.code == 3350) {
  1947. def.resolve(response.data);
  1948. } else {
  1949. def.reject('错误');
  1950. }
  1951. })
  1952. return def.promise;
  1953. }
  1954. var submitTaskAction = false;
  1955. $scope.submitTask = function () {
  1956. if (submitTaskAction) {
  1957. return;
  1958. }
  1959. submitTaskAction = true;
  1960. $scope.tempData = $scope.tempData ? $scope.tempData : {};
  1961. for (var i = 0; i < $scope.formList.length; i++) {
  1962. var val = $scope.formList[i];
  1963. if (val.remarkType == 'manage' && $scope.formList[i - 1].type == 'toggle' && ($scope.formList[i - 1].content == '10502' || $scope.formList[i - 1].content == '否')) {
  1964. continue;
  1965. }
  1966. // if(!$scope.orgid){
  1967. // if($scope.app){
  1968. // UtilService.showMess('所属企业请输入关键字,从列表中选择');
  1969. // }else{
  1970. // CommonService.showMessage('所属企业请输入关键字,从列表中选择',$scope);
  1971. // }
  1972. // submitTaskAction=false;
  1973. // return;
  1974. // }
  1975. if (val.needed && (val.content === '' || (val.type == 'upload' && val.imagelist.length == 0))) {
  1976. if (val.type == 'upload') {
  1977. if ($scope.app) {
  1978. UtilService.showMess('请上传' + val.title);
  1979. } else {
  1980. CommonService.showMessage('请上传' + val.title, $scope);
  1981. }
  1982. } else if (val.type == 'select' || val.type == 'affiliatedOrg' || val.type == 'selectArea' || val.type == 'selectDomain' || val.type == 'companyTaskSelect') {
  1983. if ($scope.app) {
  1984. UtilService.showMess('请选择' + val.title);
  1985. } else {
  1986. CommonService.showMessage('请选择' + val.title, $scope);
  1987. }
  1988. } else {
  1989. if ($scope.app) {
  1990. UtilService.showMess('请填写' + val.title);
  1991. } else {
  1992. CommonService.showMessage('请填写' + val.title, $scope);
  1993. }
  1994. }
  1995. submitTaskAction = false;
  1996. return;
  1997. }
  1998. }
  1999. if (opentype == 5311 && $scope.releaseToWhoList.length == 0) {
  2000. if ($scope.app) {
  2001. UtilService.showMess('请至少选择一位邀请接单人员!');
  2002. } else {
  2003. CommonService.showMessage('请至少选择一位邀请接单人员!', $scope);
  2004. }
  2005. submitTaskAction = false;
  2006. return;
  2007. }
  2008. dealWidthData();
  2009. $scope.tempData.opentype = opentype;
  2010. $scope.tempData.creator = UserService.id;
  2011. // console.log($scope.tempData);
  2012. var array = [];
  2013. angular.forEach($scope.releaseToWhoList, function (val) {
  2014. array.push(val.userid);
  2015. })
  2016. $scope.tempData.opentowho = array.join(',');
  2017. $scope.showLoadingToast();
  2018. getConnid().then(function (data) {
  2019. console.log(data);
  2020. $scope.tempData.connid = data.id;
  2021. $scope.tempData.orgid = data.organizationInfo.id;
  2022. $scope.tempData.companyid = data.organizationInfo.id;
  2023. console.log($scope.tempData);
  2024. $scope.tempData.images = $scope.tempData.images == '[]' ? '' : $scope.tempData.images;
  2025. var senddata = {
  2026. data: $scope.tempData,
  2027. node: UserService.node
  2028. }
  2029. if (senddata.capitalScale == NaN || senddata.capitalScale == null || senddata.capitalScale == undefined) {
  2030. senddata.capitalScale = 0;
  2031. }
  2032. if (senddata.tel == -1 || senddata.tel == null || senddata.tel == undefined) {
  2033. senddata.tel = "";
  2034. }
  2035. console.log(senddata);
  2036. taskModuleService.releaseOrEditTask(senddata).then(function (res) {
  2037. console.log(res);
  2038. if (res.code == 3350) {
  2039. if (JSON.stringify($stateParams.data) != '{}') {
  2040. $scope.go('taskDetail', {
  2041. actions: "5322,5325",
  2042. comefrom: "taskHoll",
  2043. node: UserService.node,
  2044. opentowho: JSON.stringify($scope.releaseToWhoList),
  2045. opentype: res.data.opentype,
  2046. resid: $stateParams.data.resid,
  2047. restype: 1,
  2048. taskid: res.data.id,
  2049. taskstatus: 5300,
  2050. title: $stateParams.data.title
  2051. })
  2052. } else {
  2053. $scope.goback();
  2054. }
  2055. }
  2056. $scope.hideLoadingToast();
  2057. })
  2058. })
  2059. }
  2060. // 保存对接信息
  2061. // 获取connid
  2062. var getDockingConnid = function () {
  2063. var def = $q.defer();
  2064. $scope.requestModel = {
  2065. data: {
  2066. templettype: 16,
  2067. title: $scope.formList[0].content,
  2068. organizationInfo: {
  2069. name: $scope.formList[0].content,
  2070. id: $scope.orgid ? $scope.orgid : 0
  2071. },
  2072. userModel: {
  2073. userid: UserService.id
  2074. }
  2075. },
  2076. node: UserService.node,
  2077. userid: UserService.id
  2078. }
  2079. console.log($scope.requestModel);
  2080. dataToolsService.saveOrganizationInfo($scope.requestModel).then(function (response) {
  2081. console.log(response);
  2082. if (response.code == 3350) {
  2083. def.resolve(response.data);
  2084. } else {
  2085. def.reject('错误');
  2086. }
  2087. })
  2088. return def.promise;
  2089. }
  2090. var submitTaskDocking = false;
  2091. $scope.submitTaskDocking = function () {
  2092. if (submitTaskDocking) {
  2093. return;
  2094. }
  2095. submitTaskDocking = true;
  2096. $scope.tempData = $scope.tempData ? $scope.tempData : {};
  2097. for (var i = 0; i < $scope.formList.length; i++) {
  2098. var val = $scope.formList[i];
  2099. if (val.remarkType == 'manage' && $scope.formList[i - 1].type == 'toggle' && ($scope.formList[i - 1].content == '10502' || $scope.formList[i - 1].content == '否')) {
  2100. continue;
  2101. }
  2102. if (val.needed && (val.content === '' || (val.type == 'upload' && val.imagelist.length == 0))) {
  2103. if (val.type == 'upload') {
  2104. if ($scope.app) {
  2105. UtilService.showMess('请上传' + val.title);
  2106. } else {
  2107. CommonService.showMessage('请上传' + val.title, $scope);
  2108. }
  2109. } else if (val.type == 'select' || val.type == 'affiliatedOrg' || val.type == 'selectArea' || val.type == 'selectDomain' || val.type == 'companyTaskSelect') {
  2110. if ($scope.app) {
  2111. UtilService.showMess('请选择' + val.title);
  2112. } else {
  2113. CommonService.showMessage('请选择' + val.title, $scope);
  2114. }
  2115. } else {
  2116. if ($scope.app) {
  2117. UtilService.showMess('请填写' + val.title);
  2118. } else {
  2119. CommonService.showMessage('请填写' + val.title, $scope);
  2120. }
  2121. }
  2122. submitTaskDocking = false;
  2123. return;
  2124. }
  2125. }
  2126. dealWidthData();
  2127. $scope.tempData.companyid = $scope.orgid;
  2128. $scope.tempData.action = 5322;
  2129. $scope.tempData.creator = UserService.id;
  2130. // var senddata={
  2131. // data:$scope.tempData,
  2132. // node:UserService.node
  2133. // }
  2134. $scope.showLoadingToast();
  2135. getDockingConnid().then(function (data) {
  2136. console.log(data);
  2137. $scope.tempData.connid = data.id;
  2138. $scope.tempData.orgid = data.organizationInfo.id;
  2139. $scope.tempData.companyid = data.organizationInfo.id;
  2140. $scope.tempData.taskid = $stateParams.taskid;
  2141. var senddata = {
  2142. data: $scope.tempData,
  2143. node: UserService.node
  2144. }
  2145. console.log(senddata);
  2146. taskModuleService.saveOrupdatetaskDocking(senddata).then(function (res) {
  2147. console.log(res);
  2148. if (res.code == 3350) {
  2149. $scope.goback();
  2150. }
  2151. $scope.hideLoadingToast();
  2152. })
  2153. })
  2154. }
  2155. var submitFormAction = false;
  2156. $scope.submitForm = function () {
  2157. // if(!$scope.isChecked){
  2158. // return;
  2159. // }
  2160. if (submitFormAction) {
  2161. return;
  2162. }
  2163. submitFormAction = true;
  2164. console.log($scope.formList);
  2165. // 先处理数据 判断非空
  2166. $scope.tempData = $scope.tempData ? $scope.tempData : {};
  2167. for (var i = 0; i < $scope.formList.length; i++) {
  2168. var val = $scope.formList[i];
  2169. if (val.remarkType == 'manage' && $scope.formList[i - 1].type == 'toggle' && ($scope.formList[i - 1].content == '10502' || $scope.formList[i - 1].content == '否')) {
  2170. continue;
  2171. }
  2172. if (val.type == 'upload') {
  2173. console.log(val.content == '');
  2174. console.log(val.type == 'upload');
  2175. console.log(val.imagelist.length == 0);
  2176. }
  2177. if (val.needed && (val.content === '' || (val.type == 'upload' && val.imagelist.length == 0))) {
  2178. if (val.type == 'upload') {
  2179. if ($scope.app) {
  2180. UtilService.showMess('请上传' + val.title);
  2181. } else {
  2182. CommonService.showMessage('请上传' + val.title, $scope);
  2183. }
  2184. } else {
  2185. if ($scope.app) {
  2186. UtilService.showMess('请填写' + val.title);
  2187. } else {
  2188. CommonService.showMessage('请填写' + val.title, $scope);
  2189. }
  2190. }
  2191. submitFormAction = false;
  2192. return;
  2193. }
  2194. }
  2195. dealWidthData();
  2196. // console.log($scope.tempData);
  2197. $scope.tempData.applytype = $scope.code;
  2198. $scope.tempData.creator = UserService.id;
  2199. $scope.tempData.authenstatus = 5101;
  2200. $scope.tempData.userid = UserService.id;
  2201. $scope.tempData.usercomefrom = UserService.node;
  2202. $scope.tempData.orgid = $scope.orgid;
  2203. $scope.tempData.node = UserService.node;
  2204. console.log($scope.tempData);
  2205. $scope.showLoadingToast();
  2206. AccountService.submitTechnicalContractInfo($scope.tempData).then(function (res) {
  2207. console.log(res);
  2208. $scope.hideLoadingToast();
  2209. if (res.code == 3350) {
  2210. if ($scope.app) {
  2211. UtilService.showMess("需求合同签订成功");
  2212. } else {
  2213. CommonService.showMessage('需求合同签订成功!', $scope);
  2214. }
  2215. $scope.go('taskDetail', {
  2216. resid: $scope.resid,
  2217. node: '330122000',
  2218. restype: 1,
  2219. comefrom: 'signDemandContract',
  2220. status: 'technicalreward'
  2221. })
  2222. }
  2223. })
  2224. }
  2225. $scope.agreeClick = function () {
  2226. $scope.agree = true;
  2227. }
  2228. $scope.rejectClick = function () {
  2229. $scope.agree = false;
  2230. }
  2231. var submitCheckAction = false;
  2232. $scope.submitCheck = function () {
  2233. if (submitCheckAction) {
  2234. return;
  2235. }
  2236. submitCheckAction = true;
  2237. // console.log($scope.agree);
  2238. $scope.checkData.authenstatus = $scope.agree ? 5102 : 5103;
  2239. $scope.checkData.refusereason = $scope.agree ? '' : $scope.checkData.refusereason;
  2240. $scope.checkData.authorityid = UserService.id;
  2241. // console.log($scope.checkData);
  2242. $scope.showLoadingToast();
  2243. AccountService.submitAuthCheckInfo($scope.checkData).then(function (res) {
  2244. $scope.hideLoadingToast();
  2245. // console.log(res);
  2246. if (res.code == 3350) {
  2247. $state.go('identifyDetail', {pageTitle: '认证审核', code: $scope.code, action: 'check'});
  2248. }
  2249. })
  2250. }
  2251. window.addEventListener("resize", function () {
  2252. var domWidth = window.document.documentElement.getBoundingClientRect().width;
  2253. if (domWidth > 540) {
  2254. $scope.viewscreen = 'browser';
  2255. } else {
  2256. $scope.viewscreen = 'app';
  2257. }
  2258. })
  2259. // 任务邀请页面
  2260. var taskInviteModal = function () {
  2261. $ionicModal.fromTemplateUrl('./modules/common/views/taskInviteModal.html', {
  2262. scope: $scope,
  2263. animation: 'slide-in-left'
  2264. }).then(function (modal) {
  2265. $scope.taskInvite = modal;
  2266. });
  2267. }
  2268. taskInviteModal();
  2269. // 选择热门标签
  2270. $scope.selectLable = function (index, label) {
  2271. $scope.formList[index].content = label;
  2272. }
  2273. }])
  2274. ;