1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233 |
- angular.module('push')
- .controller('visitModularFormDemandCtrl', function ($scope, $q, $ionicPopup, $stateParams, UserService, UtilService, roleService, $ionicActionSheet,
- ConstantService, $timeout, $ionicScrollDelegate,
- ActivityService, ConfigService, TechnicalBrokerPublishTrainService, dataToolsService, CommonService, $interval, ResourceLibraryService) {
- // var url = window.location.href;
- // var splitArr = url.split("/");
- var techtype = $stateParams.techtype;
- console.log(techtype)
- //TODO 放开注释
- if ($scope.app) {
- if (device.platform != "Android") {
- $scope.isIos = true;
- } else {
- $scope.isIos = false;
- }
- }
- if (!$stateParams.node) {
- $stateParams.node = UserService.node;
- }
- if ($scope.app && device.platform == "Android") {
- window.addEventListener('native.keyboardshow', function (e) {
- })
- }
- $scope.showMess = function (msg) {
- if ($scope.app) {
- UtilService.showMess(msg);
- } else {
- CommonService.showMessage(msg, $scope);
- }
- }
- UserService.isRewardFlag = 1;
- console.log($stateParams);
- // 对应的是0新增/1编辑/2复制
- $scope.isedit = $stateParams.isedit;
- $scope.pageTitle = "发布需求";
- console.log($scope.pageTitle);
- $scope.goBackToMain = function () {
- $scope.go("tab.activityIndex");
- }
- var toggleDemandInfo = [
- {
- savename: '保存融资需求信息',
- text: '<a class="action-sheet-push">融资需求</a>',
- title: '融资需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5353,
- node: '330122000'
- }, {
- savename: '保存技术需求',
- text: '<a class="action-sheet-push">技术需求</a>',
- title: '技术需求',
- id: $stateParams.pageid,
- select: true,
- orgtype: 10104,
- techtype: 5350,
- node: '330122000'
- }, {
- savename: '保存人才需求',
- text: '<a class="action-sheet-push">人才需求</a>',
- title: '人才需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5351,
- node: '330122000'
- }, {
- savename: '保存其他需求',
- text: '<a class="action-sheet-push">其他需求</a>',
- title: '其他需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5354,
- node: '330122000'
- }
- ]
- $scope.toggleDemandInfo = toggleDemandInfo;
- angular.forEach($scope.toggleDemandInfo, function (val) {
- val.select = false;
- if (val.techtype == techtype) {
- val.select = true;
- }
- })
- // 获取走访录入界面的传参
- // console.log($stateParams.orgtype);
- $scope.rolePageModel = toggleDemandInfo[1];
- if (techtype == 5350) {
- //技术需求
- $scope.rolePageModel = toggleDemandInfo[1];
- }
- if (techtype == 5351) {
- //人才需求
- $scope.rolePageModel = toggleDemandInfo[2];
- }
- if (techtype == 5353) {
- //融资需求
- $scope.rolePageModel = toggleDemandInfo[0];
- }
- if (techtype == 5354) {
- //其他需求
- $scope.rolePageModel = toggleDemandInfo[3];
- }
- // console.log($scope.rolePageModel);
- // {
- // //TODO
- // id: $stateParams.pageid,// 模版id
- // orgtype: $stateParams.orgtype// 走访对应的机构类型
- // // id: 1,// 模版id
- // // orgtype: 10104,// 模版id
- // };
- //根据模版获取所有模块
- var hasSearchData = [];
- // console.log($stateParams);
- var getAllData = function () {
- var def = $q.defer();
- if ($stateParams.comfrom == 'resource') {
- ResourceLibraryService.getPrivateResourceDetail($stateParams.connid, $stateParams.restype, $stateParams.node).then(function (res) {
- if (res.code == 3350) {
- console.log(res.data);
- def.resolve(res.data);
- } else {
- def.reject('错误');
- }
- })
- } else if ($stateParams.comfrom == 'resourceCommonDetailsPage') {
- ResourceLibraryService.getPrivateResourceDetail($stateParams.connid, $stateParams.restype, $stateParams.node).then(function (res) {
- if (res.code == 3350) {
- console.log(res.data);
- ResourceLibraryService.getOtherDetail($stateParams.connid, $stateParams.restype, $stateParams.node).then(function (response) {
- console.log(response.data);
- if (response.code == 3350) {
- var data = {};
- if (res.data.id) {
- if (response.data.id) {
- data = response.data;
- data.infoSectionList = Object.assign(data.infoSectionList, res.data.infoSectionList);
- } else {
- data = res.data;
- }
- }
- angular.forEach(response.data.infoSectionList, function (val) {
- data.infoSectionList.push(val);
- });
- data.typecodemap = Object.assign(data.typecodemap, response.data.typecodemap);
- console.log(data);
- def.resolve(data);
- } else {
- def.reject('错误');
- }
- })
- } else {
- def.reject('错误');
- }
- })
- } else {
- dataToolsService.getDetailEdit($stateParams.connid, 1000002, $stateParams.node).then(function (res) {
- if (res.code == 3350) {
- console.log(res.data);
- dataToolsService.getConnectionOtherInfoDetail($stateParams.connid, 1000002, 0, $stateParams.node).then(function (response) {
- console.log(response);
- if (response.code == 3350) {
- var data = {};
- if (res.data.id) {
- if (response.data.id) {
- data = response.data;
- data.infoSectionList = Object.assign(data.infoSectionList, res.data.infoSectionList);
- } else {
- data = res.data;
- }
- }
- angular.forEach(response.data.infoSectionList, function (val) {
- data.infoSectionList.push(val);
- });
- data.typecodemap = Object.assign(data.typecodemap, response.data.typecodemap);
- console.log(data);
- def.resolve(data);
- } else {
- def.reject('错误');
- }
- })
- } else {
- def.reject('错误');
- }
- })
- }
- return def.promise;
- }
- // console.log($scope.rolePageModel);
- var getRolePageSectionList = function () {
- $scope.showLoadingToast();
- if ($stateParams.comfrom == 'resource') {
- $scope.rolePageModel = {
- id: 13
- }
- }
- // console.log($scope.rolePageModel);
- roleService.getRolePageSectionList($scope.rolePageModel).then(function (response) {
- // console.log("==============================");
- // console.log(response.data);
- $scope.activity = [];
- // 基本信息
- $scope.sectionList = response.data.sectionList;
- if (UtilService.isDefined($scope.sectionList)) {
- angular.forEach($scope.sectionList, function (value, index) {
- var baseactivity = {
- className: '',
- headerName: '',
- restype: ''
- };
- // console.log(value);
- baseactivity.className = value.seccode;// 模块编号
- baseactivity.headerName = value.secname;// 模块名称
- baseactivity.restype = value.lktablecode;// 模块名称
- $scope.activity.push(baseactivity);
- if ($scope.activity.length > 0) {
- $scope.act = $scope.activity[0].className;
- }
- });
- for (var i = 0; i < $scope.activity.length; i++) {
- hasSearchData[i] = true;
- }
- console.log($scope.activity);
- if ($scope.isedit == 1 || $scope.isedit == 2) {
- getAllData().then(function (response) {
- // console.log(response);
- angular.forEach($scope.activity, function (val, index) {
- if (val.headerName == "对接录入") {
- goToTaskAction(response, 5322)
- }
- getData(val.headerName, val.restype, index, response);
- })
- })
- } else {
- angular.forEach($scope.activity, function (val, index) {
- if (val.headerName == "对接录入") {
- goToTaskAction(response, 5322)
- }
- getData(val.headerName, val.restype, index);
- })
- }
- }
- }, function () {
- })
- console.log( $scope.getDataFromBackground)
- };
- //调试
- getRolePageSectionList();
- var goToTaskAction = function (list, action) {
- console.log(list);
- console.log(action);
- if (!ConfigService.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- return;
- }
- // if (action == 5322) {
- // // 对接录入
- // $scope.go('dockingInput', {
- // comfrom: 'dockingInput',
- // /*taskTitle: list.title,
- // taskid: $stateParams.taskid,*/
- // companyName: list.baseInfoModel.title,
- // companyid: list.baseInfoModel.oid,
- // })
- // }
- }
- var getCascadList = function (arr, index, key) {
- // console.log(index);
- // console.log(arr);
- dataToolsService.getWebCascade(key, 1).then(function (response) {
- if (UtilService.isDefined(response.data) && response.data.length > 0) {
- console.log(response);
- arr[index].content = response.data[0].name;
- arr[index + 1].dictionary = response.data[0].code;
- dataToolsService.getWebCascade(response.data[0].code, 0).then(function (res) {
- var temp = res.data.filter(function (val) {
- return val.code == key;
- })
- if (temp.length > 0) {
- arr[index + 1].content = temp[0].name;
- }
- })
- }
- }, function () {
- })
- }
- //切换到对应页面
- $scope.activity = [];
- $scope.visitType = 0;//0:高校走企业 ,1:政府走企业,2:术经纪人或服务机构走企业,3:企业走高校,4:政府走高校、技术经纪人或服务机构走高校
- var lastNum = 0;
- $scope.tempData = [];
- //从后台获取数据
- // 默认显示内容
- $scope.getDataFromBackground = {
- detailList: [],
- addList: [],
- pagecode: 0,
- title: '',
- tcname: '',
- itemvalue: '',
- tablename: '',
- templettype: 0,
- };
- $scope.getFirstPage = true;
- //微信分享时自定义标题和描述
- var wechatInit = function () {
- var url = encodeURIComponent(window.location.href.split("#")[0]);
- dataToolsService.getWechatConfig(UserService.node, url).then(function (res) {
- if (res.code == 3350) {
- if ($scope.rolePageModel.techtype == 5353) {
- $scope.wechattitle = "桐科贷";
- $scope.wechatdesc = "桐庐县科技局常年面向科技企业征集贷款需求";
- $scope.wechatlink = res.data[3] + "#/visitModularFormDemand/1000027/4/5353";
- $scope.wechatimg = "http://pic.ubittc.com/group3/M00/0B/1A/wKgBd15y3_uABTIjAAAXAF8XkTY243.png";
- }
- if ($scope.rolePageModel.techtype == 5350) {
- $scope.wechattitle = "桐庐县科技企业技术难题征集";
- $scope.wechatdesc = "桐庐县科技局面向企业征集技术难题,联系高校院所促成对接,58505696";
- $scope.wechatlink = res.data[3] + "#/visitModularFormDemand/1000027/4/5350";
- $scope.wechatimg = "http://pic.ubittc.com/group3/M00/0B/1B/wKgBd16PyrOAakaCAAAYldy2lyE795.jpg";
- }
- if ($scope.rolePageModel.techtype == 5351) {
- $scope.wechattitle = "桐庐县科技企业人才需求征集";
- $scope.wechatdesc = "面向桐庐县征集企业人才需求";
- $scope.wechatlink = res.data[3] + "#/visitModularFormDemand/1000027/4/5351";
- $scope.wechatimg = "http://pic.ubittc.com/group3/M00/0B/1B/wKgBd16PyrOAakaCAAAYldy2lyE795.jpg";
- }
- if ($scope.rolePageModel.techtype == 5354) {
- $scope.wechattitle = "桐庐县科技企业其他需求征集";
- $scope.wechatdesc = "面向桐庐县征集企业其他需求";
- $scope.wechatlink = res.data[3] + "#/visitModularFormDemand/1000027/4/5354";
- $scope.wechatimg = "http://pic.ubittc.com/group3/M00/0B/1B/wKgBd16PyrOAakaCAAAYldy2lyE795.jpg";
- }
- wx.config({
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: res.data[4], // 必填,公众号的唯一标识
- timestamp: res.data[0], // 必填,生成签名的时间戳
- nonceStr: res.data[1], // 必填,生成签名的随机串
- signature: res.data[2],// 必填,签名
- jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填,需要使用的JS接口列表
- });
- wx.ready(function () {
- wx.onMenuShareTimeline({
- title: $scope.wechattitle, // 分享标题
- desc: $scope.wechatdesc, // 分享描述
- link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: $scope.wechatimg,
- });
- wx.onMenuShareAppMessage({
- title: $scope.wechattitle, // 分享标题
- desc: $scope.wechatdesc, // 分享描述
- link: $scope.wechatlink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: $scope.wechatimg,
- });
- });
- wx.error(function (res) {
- // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
- console.log(JSON.stringify(res));
- });
- }
- })
- };
- wechatInit();
- var getData = function (title, restype, num, response) {
- var innertype = $scope.rolePageModel.techtype;
- console.log(innertype)
- // var url = window.location.href;
- // var number = url.lastIndexOf("/");
- // url = url.substring(0, number) + "/" + innertype;
- // window.location.href = url;
- if ($stateParams.pageid == 3) {
- innertype = $scope.rolePageModel.orgtype;
- } else if ($stateParams.pageid == 30 || $stateParams.pageid == 31 || $stateParams.pageid == 32 || $stateParams.pageid == 33 || $stateParams.pageid == 34) {
- innertype = $stateParams.pageid;
- }
- var tempArray = {};
- //调试
- dataToolsService.getFormStructure($stateParams.pagecode, restype, innertype, $stateParams.node, $stateParams.resourcetype).then(function (res) {
- // dataToolsService.getFormStructure(1000030,30001,innertype,$stateParams.node).then(function(res){
- if (res.code == 3350) {
- console.log(res.data);
- if ($stateParams.title) {
- angular.forEach(res.data.infoSectionList[0].unitItems[0], function (val) {
- if (val.tcname == 'orgname' || val.tcname == 'companyid' || val.tcname == 'title') {
- val.content = $stateParams.title;
- }
- })
- }
- tempArray.detailList = res.data.infoSectionList[0].unitItems[0];
- tempArray.addList = res.data.infoSectionList[0].subItems;
- console.log(tempArray);
- angular.forEach(tempArray.detailList, function (vv) {
- if (vv.addimg) {
- vv.tempimagelist = [];
- vv.imagelist = [];
- vv.orgimages = [];
- }
- });
- angular.forEach(tempArray.addList, function (val) {
- angular.forEach(val.unitItems[0], function (value) {
- if (value.addimg) {
- value.tempimagelist = [];
- value.imagelist = [];
- value.orgimages = [];
- }
- })
- })
- // tempArray.pagecode=res.data.infoSectionList[0].pagecode;
- tempArray.pagecode = $stateParams.pagecode;
- tempArray.title = title;
- tempArray.tcname = res.data.infoSectionList[0].tcname;
- tempArray.restype = restype;
- tempArray.tablename = res.data.infoSectionList[0].tablename;
- tempArray.orgid = 0;
- if ($scope.isedit == 1 || $scope.isedit == 2) {
- console.log(response);
- var data = response.infoSectionList;
- var baseInfo = response.baseInfoModel;
- tempArray.oid = response.baseInfoModel.oid;
- if (tempArray.addList && tempArray.addList.length > 0) {
- angular.forEach(tempArray.addList, function (ta) {
- var temp = data.filter(function (da) {
- if (da.innertype) {
- return da.itemvalue == ta.itemvalue && da.innertype == ta.innertype;
- } else {
- return da.itemvalue == ta.itemvalue;
- }
- })
- if (temp.length > 0) {
- // console.log(temp);
- // return;
- var dd = Object.assign([], ta.unitItems[0]);
- ta.unitItems = [];
- // var length=temp[0].count?temp[0].count:0;
- var division = temp[0].count ? temp[0].unitlist.length / temp[0].count : 0;
- if (division) {
- for (var k = 0; k < temp[0].unitlist.length; k++) {
- var tt = Object.assign([], dd);
- var detail = temp[0].unitlist.slice(k, k + division);
- k = k + division - 1;
- angular.forEach(detail, function (vv) {
- for (var i = 0; i < tt.length; i++) {
- if (tt[i].tcname == vv.tcname) {
- // console.log(tt[i]);
- tt[i].content = tt[i].type == 'number' ? Number(vv.content) : vv.content;
- break;
- }
- }
- });
- // console.log(tt);
- ta.unitItems.push(JSON.parse(JSON.stringify(tt)));
- tt = [];
- }
- }
- angular.forEach(tempArray.addList, function (v, i) {
- angular.forEach(v.unitItems, function (val, ind) {
- angular.forEach(val, function (value, index) {
- if (value.addimg) {
- var tempImg = value.content ? JSON.parse(value.content) : [];
- if ($scope.isedit == 2) {
- angular.forEach(tempImg, function (v) {
- v.id = 0;
- })
- }
- value.imagelist = Object.assign([], tempImg);
- // value.imagelist=[];
- // value.orgimages=Object.assign([],tempImg);
- value.orgimages = [];
- value.tempimagelist = Object.assign([], tempImg);
- }
- if (value.toggle) {
- value.togglecontent = value.content == '1';
- value.content = value.content == '1' ? '是' : '否';
- }
- })
- })
- })
- }
- })
- }
- if (tempArray.detailList && tempArray.detailList.length > 0) {
- console.log(tempArray.detailList);
- var temp = data.filter(function (vv1) {
- return vv1.itemvalue == restype
- })
- var companyTemp = data.filter(function (vvv) {
- return vvv.itemvalue == 30030;
- })
- if (temp.length > 0) {
- if (companyTemp.length > 0) {
- temp[0].unitlist = temp[0].unitlist.concat(companyTemp[0].unitlist)
- }
- angular.forEach(temp[0].unitlist, function (vv2) {
- for (var i = 0; i < tempArray.detailList.length; i++) {
- var td = tempArray.detailList[i];
- if (td.rescode == vv2.rescode || td.title == vv2.title) {
- // td.content=vv2.content;
- // if(vv2.toggle){
- // console.log(vv2);
- // }
- td.content = td.type == 'number' ? Number(vv2.content) : vv2.content;
- break;
- }
- }
- })
- angular.forEach(tempArray.detailList, function (v1, indx) {
- if (v1.addimg) {
- var tempImg = v1.content ? JSON.parse(v1.content) : [];
- v1.imagelist = Object.assign([], tempImg);
- // v1.imagelist=[];
- // v1.orgimages=Object.assign([],tempImg);
- v1.orgimages = [];
- v1.tempimagelist = Object.assign([], tempImg);
- }
- if (v1.toggle) {
- // console.log(v1);
- v1.togglecontent = v1.content == '1';
- v1.content = v1.content == '1' ? '是' : '否';
- }
- // if(v1.type=='cascade'){
- if (v1.tcname == 'category') {
- // console.log(v1);
- if (v1.dictionary == '30') {
- dataToolsService.getWebCascade(30, 0).then(function (re) {
- if (re.code == 3350) {
- var tem = re.data.filter(function (ve) {
- return ve.code == v1.content;
- })
- if (tem.length > 0) {
- v1.content = tem[0].name;
- }
- }
- })
- } else {
- getCascadList(tempArray.detailList, indx, v1.content)
- }
- }
- })
- // console.log($scope.isedit);
- for (var i = 0; i < tempArray.detailList.length; i++) {
- if (tempArray.detailList[i].tcname == 'orglogo') {
- tempArray.detailList[i].content = baseInfo.logo;
- }
- if (tempArray.detailList[i].tcname == 'orgname') {
- tempArray.detailList[i].content = baseInfo.title;
- }
- if (tempArray.detailList[i].tcname == 'companyid') {
- tempArray.detailList[i].content = baseInfo.title;
- }
- }
- }
- }
- if ($scope.getFirstPage && num == 0) {
- $scope.getDataFromBackground = tempArray;
- $scope.getFirstPage = false;
- $scope.hideLoadingToast();
- }
- $scope.tempData[num] = tempArray;
- } else {
- if ($scope.getFirstPage && num == 0) {
- $scope.getDataFromBackground = tempArray;
- $scope.getFirstPage = false;
- $scope.hideLoadingToast();
- }
- $scope.tempData[num] = tempArray;
- }
- $scope.carryout.reset()
- console.log($scope.getDataFromBackground,tempArray)
- if ($scope.tempData[0] != undefined && $scope.tempData[0].title == "导师信息") {
- angular.forEach($scope.tempData[0].addList, function (val, index) {
- if (val.title == "添加人才") {
- val.title = "添加导师";
- }
- angular.forEach(val.unitItems[0], function (value, index) {
- if (value.title == "人才简介") {
- value.title = "导师简介";
- value.placeholder = "请输入导师简介";
- }
- })
- })
- }
- if (title == "导师信息") {
- var list = [];
- angular.forEach($scope.tempData[0].addList[0].unitItems[0], function (val, index) {
- if (val.title != "职位" && val.title != "学位" && val.title != "所属领域") {
- list.push(val);
- }
- })
- $scope.tempData[0].addList[0].unitItems[0] = list;
- }
- } else {
- console.log('网络错误')
- }
- })
- }
- $scope.carryout={}
- //调试
- // getData('基本信息',30001,0);
- //切换需求类型
- $scope.changeDemandStyle = function ($index) {
- console.log($index)
- if ($scope.isedit == 0) {
- $scope.isTapChange = !$scope.isTapChange;
- $scope.rolePageModel = toggleDemandInfo[$index];
- techtype=toggleDemandInfo[$index]
- angular.forEach($scope.toggleDemandInfo, function (val) {
- val.select = false;
- toggleDemandInfo[$index].select = true;
- })
- $scope.getFirstPage = true;
- // getData($scope.activity[0].headerName,$scope.activity[0].restype,0);
- getRolePageSectionList();
- // 选取身份证弹框
- /*$ionicActionSheet.show({
- buttons: toggleDemandInfo,
- cancelText: '取消',
- buttonClicked: function (index) {
- var toggleDemandInfo = [
- {
- savename: '保存融资需求信息',
- text: '<a class="action-sheet-push">融资需求</a>',
- title: '融资需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5353,
- node: '330122000'
- }, {
- savename: '保存技术需求',
- text: '<a class="action-sheet-push">技术需求</a>',
- title: '技术需求',
- id: $stateParams.pageid,
- select: true,
- orgtype: 10104,
- techtype: 5350,
- node: '330122000'
- }, {
- savename: '保存人才需求',
- text: '<a class="action-sheet-push">人才需求</a>',
- title: '人才需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5351,
- node: '330122000'
- }, {
- savename: '保存其他需求',
- text: '<a class="action-sheet-push">其他需求</a>',
- title: '其他需求',
- id: $stateParams.pageid,
- select: false,
- orgtype: 10104,
- techtype: 5354,
- node: '330122000'
- }
- ]
- // 获取走访录入界面的传参
- // console.log($stateParams.orgtype);
- $scope.rolePageModel = toggleDemandInfo[$index];
- $scope.getFirstPage = true;
- // getData($scope.activity[0].headerName,$scope.activity[0].restype,0);
- getRolePageSectionList();
- return true;
- }
- });*/
- }
- UserService.index = $index;//新
- };
- // 点击页头切换页面
- $scope.changeAct = function (num) {
- /************ sarah ****************/
- $scope.tempData[lastNum] = null;
- $scope.tempData[lastNum] = Object.assign({}, $scope.getDataFromBackground);
- lastNum = num;
- // console.log($scope.tempData);
- // 基本信息的联想
- if ($scope.tempData[num].title == '人力资源' && $scope.tempData[0].orgid && hasSearchData[num]) {
- hasSearchData[num] = false;
- $scope.showLoadingToast();
- dataToolsService.getHrResource($scope.tempData[0].orgid, $scope.tempData[0].pagecode, 0).then(function (res) {
- $scope.hideLoadingToast();
- if (res.code == 3350) {
- console.log(res);
- // $scope.tempData[num].detailList=res.data;
- angular.forEach($scope.tempData[num].detailList, function (val) {
- for (var key in res.data) {
- if (key == val.tcname) {
- val.content = res.data[key];
- if (val.toggle) {
- val.content = res.data[key] ? '是' : '否';
- val.togglecontent = res.data[key] ? true : false;
- }
- // if(val.type=='number'){
- // val.content=res.data[key];
- // }
- }
- }
- })
- }
- })
- console.log($scope.tempData[num]);
- } else if ($scope.tempData[0].orgid && hasSearchData[num]) {
- console.log(1);
- console.log($scope.tempData[0]);
- hasSearchData[num] = false;
- angular.forEach($scope.tempData[num].detailList, function (value) {
- for (var key in $scope.tempData[0].conpanyInfo) {
- if (key == value.tcname) {
- value.content = $scope.tempData[0].conpanyInfo[key];
- if (value.toggle) {
- value.content = $scope.tempData[0].conpanyInfo[key] ? '是' : '否';
- value.togglecontent = $scope.tempData[0].conpanyInfo[key] ? true : false;
- }
- }
- }
- })
- }
- if ($scope.tempData[num]) {
- $scope.getDataFromBackground = $scope.tempData[num];
- } else {
- // 从后台获取表单信息
- getData($scope.activity[num].restype, num);
- }
- /************2018****************/
- $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();
- $timeout(function () {
- $("#orgname").prop("disabled", true);
- }, 50);
- $scope.act = $scope.activity[num].className;
- var tablength = $scope.activity.length;//标题个数
- var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般
- var OffLeft = $(".main-select").eq(num).offset().left;//获取当前点击标题距离父容器左边框的距离
- var SelfWidth = $(".main-select").eq(num).width();//获取当前点击标题宽度
- var startTranform = $(".visitModule_header .scroll").offset().left + 25;
- var movewidth = OffLeft - middlewidth + SelfWidth / 2;
- startTranform -= movewidth;
- if (startTranform <= 0) {
- if (num < tablength - 1) {
- $('.visitModule_header .scroll').css({
- 'transform': 'translate3d(' + startTranform + 'px,0,0)'
- });
- }
- } else if (num < 4) {
- $('.visitModule_header .scroll').css({
- 'transform': 'translate3d(0,0,0)'
- });
- }
- $(".main-select").eq(num).addClass("arrange_borderBottom").siblings().removeClass("arrange_borderBottom");
- };
- //保存企业信息表
- $scope.connEnterpriseModuleModel = {
- id: 0,
- organizationInfo: {
- id: 0
- }
- };
- // 控制多次点击保存不触发
- var saveflg = 0;
- // var tempimages = [];
- var basicArr = [];//基本信息
- var projectInfo = [];//项目信息
- var comProduct = [];//企业产品
- var basicOperate = [];
- var basicIPR = [];
- var basicContact = [];
- var projectTransformation = {};
- var basicIUS = {};
- var temp = {};
- /************ sarah ****************/
- // 处理数组
- var handleArray = function (arr, delarr) {
- console.log(delarr);
- console.log(arr);
- if (delarr != 'other' && delarr && delarr.length > 0) {
- angular.forEach(delarr, function (v, i) {
- angular.forEach(v, function (vv) {
- if (vv.tcname == 'isenabled') {
- vv.content = '2';
- }
- })
- arr.push(v);
- })
- }
- if (arr && arr.length > 0) {
- var array = [];
- // 全部为空,则舍弃该组数据
- for (var i = 0; i < arr.length; i++) {
- for (var j = 0; j < arr[i].length; j++) {
- if (arr[i][j].content != '' || (arr[i][j].imagelist != undefined && arr[i][j].imagelist.length > 0) || arr[i][j].needed == 1) break;
- }
- if (j == arr[i].length) {
- arr.splice(i, 1);
- i--;
- }
- ;
- }
- // 赋初始值
- for (var k = 0; k < arr.length; k++) {
- for (var m = 0; m < arr[k].length; m++) {
- if (arr[k][m].content == '') {
- arr[k][m].content = arr[k][m].defaultvalue;
- }
- }
- }
- if (arr.length == 0) {
- return [];
- }
- // console.log(arr);
- angular.forEach(arr, function (val, index) {
- temp = {};
- isSon = true;
- // angular.forEach(val,function(value,ind){
- for (var i = 0; i < val.length; i++) {
- var value = val[i];
- if (value.fathermodel != '') {
- temp[value.fathermodel] = typeof temp[value.fathermodel] == 'object' ? temp[value.fathermodel] : {};
- if (value.fathercolumnname != '') {
- if (value.addimg) {
- if (value.orgimages.length > 0) {
- value.imagelist = value.imagelist.concat(value.orgimages);
- }
- temp[value.fathermodel][value.fathercolumnname] = JSON.stringify(value.imagelist);
- } else if (value.selectaction) {
- temp[value.fathermodel][value.fathercolumnname] = value.itemIndex;
- } else if (value.toggle) {
- temp[value.fathermodel][value.fathercolumnname] = value.content == '是' ? 1 : 0;
- } else {
- // temp[value.fathermodel][value.fathercolumnname] = value.content;
- if (value.content != '') {
- temp[value.fathermodel][value.fathercolumnname] = value.content;
- } else {
- continue;
- }
- }
- } else {
- if (value.addimg) {
- if (value.orgimages.length > 0) {
- value.imagelist = value.imagelist.concat(value.orgimages);
- }
- temp[value.fathermodel][value.tcname] = JSON.stringify(value.imagelist);
- } else if (value.selectaction) {
- temp[value.fathermodel][value.tcname] = value.itemIndex;
- } else if (value.toggle) {
- temp[value.fathermodel][value.tcname] = value.content == '是' ? 1 : 0;
- } else {
- // temp[value.fathermodel][value.tcname] = value.content;
- if (value.content != '') {
- temp[value.fathermodel][value.tcname] = value.content;
- } else {
- continue;
- }
- }
- }
- if (value.ismain == 1) {
- if (value.addimg) {
- if (value.orgimages.length > 0) {
- value.imagelist = value.imagelist.concat(value.orgimages);
- }
- temp[value.tcname] = JSON.stringify(value.imagelist);
- } else if (value.selectaction) {
- temp[value.tcname] = value.itemIndex;
- } else if (value.toggle) {
- temp[value.tcname] = value.content == '是' ? 1 : 0;
- } else {
- // temp[value.tcname] = value.content;
- if (value.content != '') {
- temp[value.tcname] = value.content;
- } else {
- continue;
- }
- }
- }
- } else {
- if (value.addimg) {
- if (value.orgimages.length > 0) {
- value.imagelist = value.imagelist.concat(value.orgimages);
- }
- temp[value.tcname] = JSON.stringify(value.imagelist);
- } else if (value.selectaction) {
- temp[value.tcname] = value.itemIndex;
- } else if (value.toggle) {
- temp[value.tcname] = value.content == '是' ? 1 : 0;
- } else {
- // temp[value.tcname] = value.content;
- if (value.content != '') {
- temp[value.tcname] = value.content;
- } else {
- continue;
- }
- }
- }
- }
- // });
- if (delarr === false) {
- array.push(temp);
- // array=[temp];
- console.log(array);
- } else {
- // if($scope.isedit==1||$scope.isedit==2){
- // temp.connid=$stateParams.connid;
- // }else{
- // temp.connid=$scope.connid;
- // }
- temp.connid = $scope.connid;
- temp.companyid = $scope.connEnterpriseModuleModel.organizationInfo.id;
- temp.creator = UserService.id;
- temp.updater = UserService.id;
- temp.isenabled = (temp.isenabled == '' || temp.isenabled == undefined) ? 1 : temp.isenabled;
- temp.id = (temp.id == '' || temp.id == undefined) ? 0 : temp.id;
- if ($scope.isedit == 2) {
- temp.id = 0;
- }
- // array=[temp];
- console.log(temp);
- array.push(temp);
- console.log(array);
- }
- });
- console.log(array);
- return array;
- } else {
- return [];
- }
- };
- var feedbackItem = {};
- $scope.saveTechInfo = function () {
- //$stateParams.comfrom来判断是不是发布活动时录入的需求
- if ($stateParams.comfrom == "activityApply") {
- $scope.comefromActivity = true;
- } else {
- $scope.comefromActivity = false;
- }
- var pagecode = $scope.tempData[0].pagecode;
- if ($scope.tempData[0].addList[0] == undefined) {
- var bakeinfoList = $scope.tempData[0].detailList;
- } else {
- var bakeinfoList = $scope.tempData[0].addList[0].unitItems[0];
- }
- var flag = 0;
- angular.forEach(bakeinfoList, function (val) {
- if (val.title == "姓名" && val.content == "") {
- CommonService.showMessage('请输入导师姓名!', $scope);
- flag = 1;
- }
- })
- if (flag == 0) {
- var orgName = "";
- if ($scope.tempData[0].detailList != null && $scope.tempData[0].detailList != undefined) {
- angular.forEach($scope.tempData[0].detailList, function (val) {
- if (val.title == "企业名称") {
- orgName = val.content;
- }
- });
- }
- if (pagecode == 1000030 && orgName != "") {
- dataToolsService.judgeOrgExistResource(orgName,UserService.node).then(function (response) {
- var message = response.message;
- if (message == "已存在该企业") {
- CommonService.showMessage('已存在该企业,请重新输入!', $scope);
- } else if (message == "该企业不存在") {
- newSaveCompanyInfo();
- }
- });
- }
- newSaveCompanyInfo();
- }
- };
- var newSaveCompanyInfo = function () {
- if ($stateParams.pageid == 30 || $stateParams.pageid == 31 || $stateParams.pageid == 32 || $stateParams.pageid == 33 || $stateParams.pageid == 34) {
- console.log($scope.tempData[0]);
- for (var i = 0; i < $scope.tempData[0].detailList.length; i++) {
- if ($scope.tempData[0].detailList[i].needed && $scope.tempData[0].detailList[i].content == '') {
- if ($scope.app) {
- UtilService.showMess($scope.tempData[0].detailList[i].title + '是必填项');
- } else {
- CommonService.showMessage($scope.tempData[0].detailList[i].title + '是必填项', $scope);
- }
- $scope.hideLoadingToast();
- saveflg = 0;
- return;
- }
- }
- var params = handleArray([$scope.tempData[0].detailList], false)[0];
- if (params) {
- params.id = params.id ? params.id : 0;
- params.isenabled = params.isenabled ? params.isenabled : 1;
- params.comfrom = $stateParams.node;
- params.creator = UserService.id;
- params.restype = $stateParams.pageid;
- console.log(params);
- var data = {
- data: params,
- node: $stateParams.node
- }
- // return;
- console.log(data);
- dataToolsService.saveWebInfo(data).then(function (res) {
- console.log($scope.isedit);
- if (res.code == 3350) {
- // if($scope.isedit==0){
- $scope.goback();
- // }else{
- // $scope.go('resourceCommonDetailsPage', {
- // recourceid: $stateParams.connid,
- // recourcetype: $stateParams.restype,
- // recourcecomefrom: $stateParams.node,
- // creator: '',
- // title:$stateParams.title,
- // orgtype:$stateParams.orgtype,
- // // comfrom:$scope.comfrom,
- // pagecode:$stateParams.pagecode
- // });
- // }
- }
- })
- } else {
- saveflg = 0;
- if ($scope.app) {
- UtilService.showMess('请填写相关数据');
- } else {
- CommonService.showMessage('请填写相关数据', $scope);
- }
- }
- return;
- }
- if ($stateParams.comfrom == 'activityDetail') {
- console.log($scope.tempData[0]);
- for (var i = 0; i < $scope.tempData[0].detailList.length; i++) {
- if ($scope.tempData[0].detailList[i].needed && $scope.tempData[0].detailList[i].content == '') {
- if ($scope.app) {
- UtilService.showMess($scope.tempData[0].detailList[i].title + '是必填项');
- } else {
- CommonService.showMessage($scope.tempData[0].detailList[i].title + '是必填项', $scope);
- }
- $scope.hideLoadingToast();
- saveflg = 0;
- return;
- }
- }
- var params1 = handleArray([$scope.tempData[0].detailList], false)[0];
- if (params1) {
- var images = JSON.parse(params1.images);
- angular.forEach(images, function (val) {
- val.doctype = 4913;
- })
- var data1 = {
- "activityid": $stateParams.companyid,
- "title": params1.title,
- "content": params1.content,
- "creator": UserService.id,
- "images": JSON.stringify(images)
- }
- dataToolsService.saveActivityBroadcastInfo({data: data1}).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- $scope.hideLoadingToast();
- $scope.go('activityDetail', {activityid: $stateParams.companyid})
- }
- })
- }
- return;
- }
- // 获取企业基本信息数组
- console.log($scope.tempData);
- basicArr = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '企业基本信息' || '高校基本信息';
- })[0];
- projectInfo = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '项目信息';
- })[0] || {addList: []};
- comProduct = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '企业产品';
- })[0] || {addList: []};
- // 经营情况
- basicOperate = $scope.tempData.filter(function (val) {
- return val.title == '经营情况';
- })[0];
- // 知识产权
- basicIPR = $scope.tempData.filter(function (val) {
- return val.title == '知识产权';
- })[0];
- // 产学研信息 industry-university-research
- basicIUS = $scope.tempData.filter(function (val) {
- return val.title == '产学研信息';
- })[0];
- // 联系方式 contact
- basicContact = $scope.tempData.filter(function (val) {
- return val.title == '联系方式';
- })[0];
- projectTransformation = $scope.tempData.filter(function (val) {
- return val.title == '促成成果转化项目';
- })[0];
- // if($stateParams.node=='320117005'||$stateParams.node=='320117003'||$stateParams.node=='320117002'||$stateParams.node=='320117001'||$stateParams.node=='320117004'){
- // basicArr=$scope.tempData[0];
- // }
- if (saveflg != 0) {
- return;
- }
- saveflg = 1;
- $scope.showLoadingToast();
- saveInfo();
- };
- // 保存企业信息
- var saveInfo = function () {
- // console.log(basicArr);
- basicArr = basicArr ? basicArr : $scope.tempData[0];
- // console.log(basicArr);
- // 判断必填项
- for (var i = 0; i < basicArr.detailList.length; i++) {
- if (basicArr.detailList[i].needed && (basicArr.detailList[i].content == "" || basicArr.detailList[i].content == null)) {
- if (basicArr.detailList[i].title == "土地面积(平方米)" || basicArr.detailList[i].title == "厂房面积(平方米)") {
- if (basicArr.detailList[5].content == "租用厂房" || basicArr.detailList[5].content == "") {
- continue;
- }
- }
- if ($scope.app) {
- UtilService.showMess(basicArr.detailList[i].title + '是必填项');
- } else {
- CommonService.showMessage(basicArr.detailList[i].title + '是必填项', $scope);
- }
- $scope.hideLoadingToast();
- saveflg = 0;
- return;
- }
- }
- for (var i = 0; i < $scope.tempData[0].addList.length; i++) {
- if ($scope.tempData[0].addList[i].needed && $scope.tempData[0].addList[i].unitItems[i][0].content == '') {
- if ($scope.app) {
- UtilService.showMess($scope.tempData[0].addList[i].title + '是必填项');
- } else {
- CommonService.showMessage($scope.tempData[0].addList[i].title + '是必填项', $scope);
- }
- $scope.hideLoadingToast();
- saveflg = 0;
- return;
- }
- }
- // 处理数据
- console.log(basicOperate);
- var allbasicArr = [];
- for (var i = 0; i < $scope.tempData.length; i++) {
- console.log($scope.tempData[i]);
- if ($scope.tempData[i].title != '人力资源') {
- angular.forEach($scope.tempData[i].detailList, function (vv) {
- })
- for (var j = 0; j < $scope.tempData[i].detailList.length; j++) {
- if ($scope.tempData[i].detailList[j].type == 'hidden') {
- if ($scope.tempData[i].title != '基本信息' && $scope.tempData[i].title != '高校基本信息')
- $scope.tempData[i].detailList.splice(j, 1);
- }
- }
- allbasicArr = allbasicArr.concat($scope.tempData[i].detailList);
- // console.log(allbasicArr);
- }
- }
- // var allbasicArr=basicArr.detailList;
- // if(basicOperate.detailList&&basicOperate.detailList.length>0){
- // allbasicArr=allbasicArr.concat(basicOperate.detailList);
- // }
- // if(basicIPR.detailList&&basicIPR.detailList.length>0){
- // allbasicArr=allbasicArr.concat(basicIPR.detailList);
- // }
- // if(basicIUS.detailList&&basicIUS.detailList.length>0){
- // allbasicArr=allbasicArr.concat(basicIUS.detailList);
- // }
- // if(basicContact.detailList&&basicContact.detailList.length>0){
- // allbasicArr=allbasicArr.concat(basicContact.detailList);
- // }
- console.log($scope.connEnterpriseModuleModel);
- console.log(allbasicArr);
- if (String(allbasicArr) != '') {
- $scope.connEnterpriseModuleModel = handleArray([allbasicArr], false)[0];
- }
- // 企业图片
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- }
- // 走访履历表中需记录机构信息
- console.log($scope.connEnterpriseModuleModel);
- $scope.connEnterpriseModuleModel.isenabled = 1;
- $scope.connEnterpriseModuleModel.userModel = {
- userid: UserService.id
- };
- // console.log($scope.connEnterpriseModuleModel);
- // if($scope.connEnterpriseModuleModel.organizationInfo.name){
- // }else{
- // var str='';
- // angular.forEach(projectTransformation.addList[0].unitItems,function(val){
- // angular.forEach(val,function(value){
- // if(value.tcname=='projectname'){
- // str+=value.content+' ';
- // }
- // })
- // })
- // $scope.connEnterpriseModuleModel.title =str
- // }
- if ($stateParams.pageid == 18) {
- $scope.connEnterpriseModuleModel.organizationInfoList = [];
- if (basicArr.addList.length > 0 && basicArr.addList[0].unitItems.length > 0) {
- $scope.connEnterpriseModuleModel.organizationInfoList = basicArr.addList[0].unitItems;
- }
- $scope.connEnterpriseModuleModel.organizationInfo = {};
- $scope.connEnterpriseModuleModel.organizationInfo.name = $scope.connEnterpriseModuleModel.affiliatedorg;
- $scope.connEnterpriseModuleModel.organizationInfo.title = $scope.connEnterpriseModuleModel.title;
- } else if ($stateParams.pageid == 20) {
- $scope.connEnterpriseModuleModel.organizationInfo.name = $scope.connEnterpriseModuleModel.organizationInfo.name;
- $scope.connEnterpriseModuleModel.organizationInfo.about = $scope.connEnterpriseModuleModel.orgcontent;// 企业logo
- $scope.connEnterpriseModuleModel.organizationInfo.orgtype = $scope.rolePageModel.orgtype;// 机构类型
- } else {
- $scope.connEnterpriseModuleModel.title = $scope.connEnterpriseModuleModel.organizationInfo.name;
- $scope.connEnterpriseModuleModel.organizationInfo.about = $scope.connEnterpriseModuleModel.orgcontent;// 企业logo
- $scope.connEnterpriseModuleModel.organizationInfo.orgtype = $scope.rolePageModel.orgtype;// 机构类型
- }
- $scope.connEnterpriseModuleModel.orgtype = $scope.rolePageModel.orgtype;// 机构类型
- $scope.connEnterpriseModuleModel.templettype = $stateParams.pageid;
- $scope.connEnterpriseModuleModel.pagecode = basicArr.pagecode;
- if ($scope.isedit == 2 || $scope.isedit == 0) {
- $scope.connEnterpriseModuleModel.id = 0;
- $scope.connEnterpriseModuleModel.organizationInfo.id = 0;
- }
- //编辑功能
- if ($scope.isedit == 1) {
- $scope.connEnterpriseModuleModel.id = $stateParams.connid;
- }
- // if($scope.isedit==0){
- // $scope.connEnterpriseModuleModel.id = 0;
- // $scope.connEnterpriseModuleModel.organizationInfo.id=0;
- // }
- // 传参格式
- $scope.requestModel.data = $scope.connEnterpriseModuleModel;
- $scope.requestModel.pagecode = basicArr.pagecode;
- $scope.requestModel.pagetitle = $stateParams.pageTitle;
- $scope.requestModel.rolePageTile = $scope.rolePageModel.title;
- $scope.requestModel.userid = UserService.id == 0 ? 2198 : UserService.id;
- console.log($scope.requestModel);
- dataToolsService.saveOrganizationInfo($scope.requestModel).then(function (response) {
- // console.log(response);
- if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
- // 保存走访基本信息 后保存其他内容
- // 取得记录id
- $scope.connid = response.data.id;
- feedbackItem.connid = response.data.id;
- // if($scope.isedit==1||$scope.isedit==2){
- // $scope.connid=$stateParams.connid;
- // };
- // 取得机构id
- $scope.connEnterpriseModuleModel.organizationInfo.id = response.data.organizationInfo.id;
- if ($stateParams.pagecode == 1000027 && $scope.tempData[0].restype == 30017 && $scope.tempData[0].title == "企业需求") {
- if ($scope.tempData[0] && $scope.tempData[0].addList[0] && $scope.tempData[0].addList[0].unitItems) {
- $scope.requestModel = {
- userid: UserService.id == 0 ? 2198 : UserService.id,
- orgid: $scope.connEnterpriseModuleModel.organizationInfo.id,
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- pagetitle: "桐庐需求录入"
- };
- $scope.requestModel.data = $scope.tempData[0].addList[0].unitItems;
- dataToolsService.insertOrUpdateCompanyProduct($scope.requestModel);
- }
- }
- // 1保存走访研发投入
- saveCompanyYearMultipleoptions1();
- } else {
- // console.log(ConstantService.INTERFACE_MESSAGE_ERROR);
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- saveflg = 0;
- }
- }, function () {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- // UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- // $scope.hideLoadingToast();
- saveflg = 0;
- });
- };
- // 1保存走访研发投入 企业基本信息->研发投入
- var saveCompanyYearMultipleoptions1 = function () {
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- // 获取研发投入数据
- if (basicArr.addList && basicArr.addList.length > 0) {
- var tempArr = basicArr.addList.filter(function (value, j, arr) {
- return value.title == '研发投入'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- console.log($scope.requestModel.data);
- console.log(2);
- if (String($scope.requestModel.data) == '') {
- saveCompanyYearMultipleoptions2();
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions($scope.requestModel).then(function (response) {
- // 保存销售收入、净利润、上缴税收
- saveCompanyYearMultipleoptions2();
- // console.log(response);
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // console.log(2);
- // 2保存走访销售收入、净利润、上缴税收 企业基本信息->实际收入/预计投入情况
- var saveCompanyYearMultipleoptions2 = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- // 保存走访销售收入、净利润、上缴税收
- if (basicArr.addList && basicArr.addList.length > 0) {
- var tempArr = basicArr.addList.filter(function (value, j, arr) {
- return value.title == '实际收入/预计投入情况'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- // console.log(2);
- // console.log($scope.requestModel);
- console.log(3);
- if (String($scope.requestModel.data) == '') {
- saveCompanyYearMultipleoptions3();
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions($scope.requestModel).then(function (response) {
- // 保存走访工程中心情况
- // console.log(response);
- saveCompanyYearMultipleoptions3();
- }, function () {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- // UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- })
- }
- };
- // 3保存走访工程中心情况 企业基本信息->工程中心信息
- var saveCompanyYearMultipleoptions3 = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (basicArr.addList && basicArr.addList.length > 0) {
- var tempArr = basicArr.addList.filter(function (value, j, arr) {
- return value.title == '工程中心信息'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- if (basicIPR) {
- var temp = basicIPR.addList.filter(function (val) {
- return val.title == '添加专利申请';
- })
- if (temp.length > 0) {
- $scope.requestModel.data = handleArray(temp[0].unitItems, temp[0].deletUnitItems);
- }
- }
- // console.log('abc');
- // console.log($scope.requestModel.data);
- console.log(4);
- if (String($scope.requestModel.data) == '') {
- //saveCompanyTechrequirement();
- saveCompanyDeclareproject();
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions($scope.requestModel).then(function (response) {
- // console.log(response);
- // 保存关联需求表
- //saveCompanyTechrequirement();
- saveCompanyDeclareproject();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 4保存关联需求表 企业需求
- // var saveCompanyTechrequirement = function () {
- // // 保存多条信息需要的格式
- // $scope.requestModel = {
- // data: [],
- // node: $stateParams.node,
- // pagecode: $stateParams.pagecode,
- // };
- // var demand = $scope.tempData.filter(function (val, i, arr) {
- // return val.title == '企业需求';
- // })[0];
- // // if($stateParams.node=='320117005'||$stateParams.node=='320117003'||$stateParams.node=='320117002'||$stateParams.node=='320117001'||$stateParams.node=='320117004'){
- // // demand=$scope.tempData[0];
- // // }
- // console.log(demand);
- // if (demand) {
- // $scope.requestModel.data = handleArray(demand.addList[0].unitItems, demand.addList[0].deletUnitItems);
- // }
- // // console.log(4);
- // // console.log($scope.requestModel);
- // console.log(5);
- // console.log($scope.requestModel);
- // if (String($scope.requestModel.data) == '') {
- // saveCompanyDeclareproject();
- // } else {
- // dataToolsService.insertOrUpdateCompanyTechrequirement($scope.requestModel).then(function (response) {
- // // console.log(response);
- // feedbackItem.demand = response.data;
- // // 5保存走访申报项目接口
- // saveCompanyDeclareproject();
- // }, function () {
- // if ($scope.app) {
- // UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- // } else {
- // CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- // }
- // })
- // }
- //
- // };
- // 5保存走访申报项目接口 项目信息->项目建议
- var saveCompanyDeclareproject = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (projectInfo.addList) {
- var tempArr = projectInfo.addList.filter(function (value, j, arr) {
- return value.title == '添加项目建议'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- console.log(6);
- if (String($scope.requestModel.data) == '') {
- saveCompanyHighleveltalents();
- } else {
- dataToolsService.insertOrUpdateCompanyDeclareproject($scope.requestModel).then(function (response) {
- // console.log(response);
- // 6保存高端人才信息表
- saveCompanyHighleveltalents();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 6保存高端人才信息表 人才信息
- var saveCompanyHighleveltalents = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- var talentPerson = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '人才信息' || val.title == '专家信息';
- })[0];
- if (talentPerson) {
- $scope.requestModel.data = handleArray(talentPerson.addList[0].unitItems, talentPerson.addList[0].deletUnitItems);
- }
- console.log(7);
- if (String($scope.requestModel.data) == '') {
- saveCompanyHignendproduct();
- } else {
- dataToolsService.insertOrUpdateCompanyHighleveltalents($scope.requestModel).then(function (response) {
- // console.log(response);
- // 7保存高端产品
- saveCompanyHignendproduct();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 7保存高端产品 企业产品->高新产品
- var saveCompanyHignendproduct = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (comProduct.addList) {
- var tempArr = comProduct.addList.filter(function (value, j, arr) {
- return value.title == '添加高新产品'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- console.log(8);
- if (String($scope.requestModel.data) == '') {
- saveCompanyIur();
- } else {
- dataToolsService.insertOrUpdateCompanyHignendproduct($scope.requestModel).then(function (response) {
- // console.log(response);
- // 8保存产学研
- saveCompanyIur();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 溧水录入产学研分块保存
- var saveIUSInfo = function (arr) {
- var def = $q.defer();
- var saveStatus = [];
- for (var i = 0; i < arr.length; i++) {
- saveStatus[i] = false;
- var requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- }
- requestModel.data = handleArray(arr[i].unitItems, arr[i].deletUnitItems);
- if (String(requestModel.data) == '') {
- continue;
- } else {
- console.log(requestModel.data);
- if (arr[i].tcname == 'company_iur_lk') {
- dataToolsService.insertOrUpdateCompanyIur(requestModel).then(function (response) {
- // console.log(response);
- saveStatus[i] = true;
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions(requestModel).then(function (response) {
- // console.log(response);
- saveStatus[i] = true;
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- }
- }
- var timer = $interval(function () {
- var j = 0
- for (; j < saveStatus.length; j++) {
- if (!saveStatus) break;
- }
- if (j == saveStatus.length) {
- $interval.cancel(timer);
- def.resolve(true);
- }
- }, 300)
- return def.promise;
- }
- // 8保存产学研 项目信息->产学研经验
- var saveCompanyIur = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if ($stateParams.pagecode == 1000003) {
- var tempArr = projectInfo.addList.filter(function (value, j, arr) {
- return value.title == '添加产学研经验'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- console.log(9);
- if (String($scope.requestModel.data) == '') {
- saveCompanyYearMultipleoptions4();
- } else {
- dataToolsService.insertOrUpdateCompanyIur($scope.requestModel).then(function (response) {
- // console.log(response);
- // 9保存重大科研项目
- saveCompanyYearMultipleoptions4();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- } else if (basicIUS) {
- saveIUSInfo(basicIUS.addList).then(function (data) {
- if (data) {
- saveCompanyYearMultipleoptions4();
- }
- })
- } else {
- saveCompanyYearMultipleoptions4();
- }
- };
- // 9保存重大科研项目 项目信息->重大科研项目
- var saveCompanyYearMultipleoptions4 = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (projectInfo.addList) {
- var tempArr = projectInfo.addList.filter(function (value, j, arr) {
- return value.title == '添加重大科研项目'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- console.log(10);
- if (String($scope.requestModel.data) == '') {
- saveCompanyProduct();
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions($scope.requestModel).then(function (response) {
- // console.log(response);
- // 10保存公司产品
- saveCompanyProduct();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 10保存公司产品 企业产品->产品
- var saveCompanyProduct = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (comProduct && comProduct.addList) {
- var tempArr = comProduct.addList.filter(function (value, j, arr) {
- return value.title == '添加产品'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray(tempArr.unitItems, tempArr.deletUnitItems);
- }
- }
- console.log(11);
- console.log($scope.requestModel);
- if (String($scope.requestModel.data) == '') {
- saveCompanyIntellectualproperty();
- } else {
- dataToolsService.insertOrUpdateCompanyProduct($scope.requestModel).then(function (response) {
- // console.log(response);
- // 11保存专利信息
- saveCompanyIntellectualproperty();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 11保存专利信息 专利信息
- var saveCompanyIntellectualproperty = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- var patent = $scope.tempData.filter(function (val, i, arr) {
- return (val.title == '专利信息' || val.title == '知识产权信息');
- })[0];
- if (patent) {
- $scope.requestModel.data = handleArray(patent.addList[0].unitItems, patent.addList[0].deletUnitItems);
- }
- if (basicIPR && basicIPR.addList) {
- var patent = basicIPR.addList.filter(function (val) {
- return val.title == '添加知识产权'
- })[0];
- if (patent) {
- $scope.requestModel.data = handleArray(patent.unitItems, patent.deletUnitItems);
- }
- }
- console.log(12);
- if (String($scope.requestModel.data) == '') {
- saveCompanyResearchfinding();
- } else {
- dataToolsService.insertOrUpdateCompanyIntellectualproperty($scope.requestModel).then(function (response) {
- // console.log(response);
- feedbackItem.patent = response.data;
- // 12保存成果信息
- saveCompanyResearchfinding();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 12保存成果信息 高校->成果
- var saveCompanyResearchfinding = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- var achievement = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '成果信息';
- })[0];
- if (achievement) {
- $scope.requestModel.data = handleArray(achievement.addList[0].unitItems, achievement.addList[0].deletUnitItems);
- }
- console.log(13);
- if (String($scope.requestModel.data) == '') {
- saveCompanySpecialty();
- } else {
- dataToolsService.insertOrUpdateCompanyResearchfinding($scope.requestModel).then(function (response) {
- console.log(response);
- feedbackItem.achievement = response.data;
- // 13保存特色专业信息表
- saveCompanySpecialty();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 13保存特色专业信息表
- var saveCompanySpecialty = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- // 保存特色专业信息
- var specialty = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '特色专业信息';
- })[0];
- if (specialty) {
- $scope.requestModel.data = handleArray(specialty.addList[0].unitItems, specialty.addList[0].deletUnitItems);
- }
- console.log(14);
- if (String($scope.requestModel.data) == '') {
- savebusinessCircumstance();
- } else {
- dataToolsService.insertOrUpdateCompanySpecialty($scope.requestModel).then(function (response) {
- // console.log(response);
- // 14保存实验室信息表
- savebusinessCircumstance();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 14保存经营情况
- var savebusinessCircumstance = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- if (basicOperate) {
- $scope.requestModel.data = handleArray(basicOperate.addList[0].unitItems, basicOperate.addList[0].deletUnitItems);
- }
- console.log(15);
- if (String($scope.requestModel.data) == '') {
- saveHR();
- } else {
- dataToolsService.insertOrUpdateCompanyYearMultipleoptions($scope.requestModel).then(function (response) {
- // console.log(response);
- // 10保存公司产品
- saveHR();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 15保存人力资源
- var saveHR = function () {
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- var tempArr = $scope.tempData.filter(function (value, j, arr) {
- return value.title == '人力资源'
- })[0];
- if (tempArr) {
- $scope.requestModel.data = handleArray([tempArr.detailList], 'other');
- }
- console.log(16);
- // console.log($scope.requestModel.data);
- // console.log(String($scope.requestModel.data));
- if (String($scope.requestModel.data) == '') {
- saveProjectTransformation();
- } else {
- // console.log($scope.requestModel);
- dataToolsService.insertOrUpdateCompanyHR($scope.requestModel).then(function (response) {
- // console.log(response);
- // 10保存公司产品
- saveProjectTransformation();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- // 保存促成成果转化项目信息
- var saveProjectTransformation = function () {
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- // var projectTransformation=$scope.tempData.filter(function(val,i,arr){
- // return val.title=='促成成果转化项目';
- // })[0];
- if (projectTransformation) {
- $scope.requestModel.data = handleArray(projectTransformation.addList[0].unitItems, projectTransformation.addList[0].deletUnitItems);
- }
- if (String($scope.requestModel.data) == '') {
- saveCompanyLab();
- } else {
- console.log($scope.requestModel);
- dataToolsService.insertOrUpdateProjectTransformation($scope.requestModel).then(function (response) {
- // console.log(response);
- saveCompanyLab();
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- }
- // 16保存实验室信息表
- var saveCompanyLab = function () {
- var pagetitle = $stateParams.pageTitle;
- // 保存多条信息需要的格式
- $scope.requestModel = {
- data: [],
- node: $stateParams.node,
- pagecode: $stateParams.pagecode,
- };
- // 保存实验室信息表
- var labInfo = $scope.tempData.filter(function (val, i, arr) {
- return val.title == '实验室信息';
- })[0];
- if (labInfo) {
- $scope.requestModel.data = handleArray(labInfo.addList[0].unitItems, labInfo.addList[0].deletUnitItems);
- }
- console.log(17);
- if (String($scope.requestModel.data) == '') {
- var patt = /录入/g;
- if ($scope.pageTitle != "新建录入" && patt.test($scope.pageTitle)) {
- // $scope.go("recordInfoAccount");
- $scope.hideLoadingToast();
- if ($stateParams.comfrom == 'activityApply' || $stateParams.comfrom == 'participantList') {
- localStorage.feedbackItem = JSON.stringify(feedbackItem);
- $scope.go('activityApply', {
- settingItems: localStorage.settingItems,
- comfrom: $stateParams.comfrom
- });
- // }if($stateParams.comfrom=='activityDetail'){
- // var params={
- // data:{
- // "activityid":$stateParams.companyid,
- // "otherid":$scope.connid,
- // "creator":UserService.id
- // }
- // }
- // dataToolsService.saveActivityBroadcastInfo(params).then(function(res){
- // $scope.go('activityApply',{activityid:$stateParams.companyid});
- // });
- } else {
- $scope.go("recordInfoAccount");
- }
- } else {
- var getBasicInfo = function () {
- var def = $q.defer();
- dataToolsService.getConnectioninfoDetailByConnid($scope.connid, 1000002, 0, $stateParams.node).then(function (response) {
- if (response.code == 3350) {
- def.resolve(response.data);
- } else {
- def.reject('错误');
- }
- }, function () {
- });
- return def.promise;
- };
- getBasicInfo().then(function (data) {
- dataToolsService.getConnectionOtherInfoDetail($scope.connid, 1000002, 0, $stateParams.node).then(function (res) {
- $scope.hideLoadingToast();
- if (data.typecodemap || res.data.typecodemap) {
- localStorage.feedbackItem = JSON.stringify(feedbackItem);
- data.typecodemap = data.typecodemap ? Object.assign(data.typecodemap, res.data.typecodemap) : res.data.typecodemap;
- if (pagetitle != "新建导师" && pagetitle != "新建创新创业联盟库") {
- if ($stateParams.pageid == 4 && UserService.node == "330122000") {
- if ($stateParams.comfrom == 'activityApply' || $stateParams.comfrom == 'participantList') {
- localStorage.feedbackItem = JSON.stringify(feedbackItem);
- $scope.go('activityApply', {
- settingItems: localStorage.settingItems,
- comfrom: $stateParams.comfrom
- });
- } else {
- $ionicPopup.alert({
- title: '提示',
- template: "<p style='text-align: center;'>提交成功</p>"
- }).then(function (result) {
- if (result) {
- $scope.go('tab.activityIndex');
- }
- })
- }
- } else {
- $scope.go("selectFieldsToSet", {
- comfrom: $stateParams.comfrom,
- typecodemap: data.typecodemap,
- resid: $stateParams.resid,
- typecode: ConstantService.TABLE_CODE_30003,
- templettype: $stateParams.templettype,
- title: $stateParams.title,
- node: $stateParams.node,
- pagetitle: $stateParams.pageTitle,
- });
- }
- } else {
- if (pagetitle == "新建导师") {
- $scope.go('wujingTeacher');
- }
- if (pagetitle == "新建创新创业联盟库") {
- $scope.go('wujingTechnical');
- }
- }
- }
- })
- })
- }
- } else {
- dataToolsService.insertOrUpdateCompanyLab($scope.requestModel).then(function (response) {
- // 添加成功后先查询保存的走访履历,再把typecodemap传递并跳转到 设置权限 界面
- // 获取走访履历详情
- if ($scope.app) {
- UtilService.showMess("添加成功");
- } else {
- CommonService.showMessage("添加成功", $scope);
- }
- // $timeout(function () {
- var patt = /录入/g;
- if (patt.test($scope.pageTitle)) {
- $scope.hideLoadingToast();
- if ($stateParams.comfrom == 'activityApply' || $stateParams.comfrom == 'participantList') {
- localStorage.feedbackItem = JSON.stringify(feedbackItem);
- $scope.go('activityApply', {
- settingItems: localStorage.settingItems,
- comfrom: $stateParams.comfrom
- });
- } else {
- $scope.go("recordInfoAccount");
- }
- } else {
- var getBasicInfo = function () {
- var def = $q.defer();
- dataToolsService.getConnectioninfoDetailByConnid($scope.connid, 1000002, 0, $stateParams.node).then(function (response) {
- if (response.code == 3350) {
- def.resolve(response.data);
- } else {
- def.reject('错误');
- }
- }, function () {
- })
- return def.promise;
- };
- getBasicInfo().then(function (data) {
- dataToolsService.getConnectionOtherInfoDetail($scope.connid, 1000002, 0, $stateParams.node).then(function (res) {
- $scope.hideLoadingToast();
- if (data.typecodemap || res.data.typecodemap) {
- data.typecodemap = data.typecodemap ? Object.assign(data.typecodemap, res.data.typecodemap) : res.data.typecodemap;
- $scope.go("selectFieldsToSet", {
- comfrom: $stateParams.comfrom,
- typecodemap: data.typecodemap,
- resid: $stateParams.resid,
- typecode: ConstantService.TABLE_CODE_30003,
- templettype: $stateParams.templettype,
- title: $stateParams.title,
- node: $stateParams.node,
- pagetitle: $stateParams.pageTitle,
- });
- }
- })
- })
- }
- // console.log($scope.connEnterpriseModuleModel.id);
- // console.log(15);
- // dataToolsService.getConnectioninfoDetailByConnid($scope.connEnterpriseModuleModel.id,$stateParams.pagecode,0,$stateParams.node).then(function (response) {
- // // console.log("==============================");
- // // console.log(response);
- // $scope.hideLoadingToast();
- // // 走访履历详情
- // $scope.connInfoDetail = response.data;
- // $timeout(function () {
- // gotoSelectFieldsToSet();
- // }, 500);
- // }, 500);
- // }, function () {
- // })
- }, function () {
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- }
- };
- }
- ).directive('stringToNumber', function () {
- return {
- require: 'ngModel',
- link: function (scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function (value) {
- return '' + value;
- });
- ngModel.$formatters.push(function (value) {
- return parseInt(value);
- });
- }
- };
- }).directive('stringToNumber2', function () {
- return {
- require: 'ngModel',
- link: function (scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function (value) {
- return '' + value;
- });
- ngModel.$formatters.push(function (value) {
- return parseInt(value);
- });
- }
- };
- });
|