|
- define(['jquery', "template", "Tools", 'LeftNav', 'dateTime'], function ($, template, Tools, LeftNav) {
- //数据存储
- var module = {
- data: {
- //服务器地址
- serverApi: '',
- dataList: {
- children: [],
- haschildren: true,
- isopen: false,
- level: "0",
- name: "",
- url: "#",
- },
- },
- };
- var tools = new Tools();
-
- module.init = function (page) {
-
- tools.doGet(dictType + '/Industrial_classification_type', {}, module.dictType , true);
-
- tools.getWebConfig();
-
- var tabs = $('.tab').find('li');
- var informationBox = $("#listBox > div");
- tabs.on('click', function (e) {
-
- e.preventDefault();//防止打开链接
-
- var index = $(this).data('id');
-
- tabs.removeClass('active');
-
- informationBox.css("display",'none');
-
- $(this).addClass('active');
-
- $('#'+index).css("display",'block')
-
- });
- // $("#signStartTimeStr").datetime({
- // type: "date",
- // value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- // success: function (res) {
- // //console.log(res)
- // }
- // })
- //
- // $("#signEndTimeStr").datetime({
- // type: "date",
- // value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- // success: function (res) {
- // //console.log(res)
- // }
- // })
- };
-
- //新闻列表
- module.projectList = function (data) {
- if (data.code == 200) {
- var content = data.data;
- content.forEach(res => {
- module.data.dataList.children.push(res);
- })
- leftNav(".left", module.data.dataList);
- }
- }
-
- module.dictType = function (data) {
- module.data.industryClassOptions = data.data;
- tools.doPost(entityMain, {pageNum:1,pageSize:10}, module.entityMain , true);
- tools.doPost(supplyChainAgent, {pageNum:1,pageSize:10}, module.supplyChainAgent , true);
- tools.doPost(supplyChainPurchaser, {pageNum:1,pageSize:10}, module.supplyChainPurchaser , true);
- }
-
- //经营主体
- module.entityMain = function (data) {
- if (data.code == 200) {
- var content = data.data;
-
- for ( var i = 0 ; i < content.length ; i++ ){
- if (content[i].industryClassificationType != null){
- var industryClassificationType = content[i].industryClassificationType.split(",");
- var secondArray = "";
- for (var j = 0 ; j < industryClassificationType.length ; j++){
- secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
- }
- content[i].industryClassificationType = secondArray;
- }
- content[i].masterMap = serverApi + ((content[i].masterMap || content[i].masterMap != '')?content[i].masterMap: 'null') ;
- }
-
- module.data.entityMainList = content;
- var entityMainData = template('entityMainData', module.data);
- $("#entityMainContent").html(entityMainData);
- }
- }
-
- //经营主体
- module.supplyChainAgent = function (data) {
- if (data.code == 200) {
- var content = data.data;
-
- // for ( var i = 0 ; i < content.length ; i++ ){
- // if (content[i].industryClassificationType != null){
- // var industryClassificationType = content[i].industryClassificationType.split(",");
- // var secondArray = "";
- // for (var j = 0 ; j < industryClassificationType.length ; j++){
- // secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
- // }
- // content[i].industryClassificationType = secondArray;
- // }
- // console.log(content[i].industryClassificationType)
- // content[i].masterMap = serverApi + content[i].masterMap ;
- //
- // }
-
- module.data.agentList = content;
- var agentData = template('agentData', module.data);
- $("#agentContent").html(agentData);
- }
- }
-
- //经营主体
- module.supplyChainPurchaser = function (data) {
- if (data.code == 200) {
- var content = data.data;
-
- // for ( var i = 0 ; i < content.length ; i++ ){
- // if (content[i].industryClassificationType != null){
- // var industryClassificationType = content[i].industryClassificationType.split(",");
- // var secondArray = "";
- // for (var j = 0 ; j < industryClassificationType.length ; j++){
- // secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
- // }
- // content[i].industryClassificationType = secondArray;
- // }
- // console.log(content[i].industryClassificationType)
- // content[i].masterMap = serverApi + content[i].masterMap ;
- //
- // }
-
- module.data.purchaserList = content;
- var purchaserData = template('purchaserData', module.data);
- $("#purchaserContent").html(purchaserData);
- }
- }
-
- module.selectDictLabel = function (datas, value) {
- var actions = [];
- Object.keys(datas).some((key) => {
- if (datas[key].dictValue == ('' + value)) {
- actions.push(datas[key].dictLabel);
- return true;
- }
- })
- return actions.join('');
- }
-
-
- switchTab = function (type) {
- $("#"+type+"Btn").addClass("active").siblings().removeClass("active");
- $("#"+type+"").css('display','block').siblings().css('display','none');
- module.data.switchTab = type;
- }
-
- searchType = function (id) {
- console.log(id)
- $(".left .left_nav_name").removeClass("nav_open");
- tools.doPost(technologyConsulting, {techniqueType: id}, module.technologyConsultingList, true);
- }
-
- technologySearch = function(){
- const data = {}
- if ($("input[name='searchType']:checked").val() == 'title'){
- data.trainingName = $('#technologyInput').val();
- }else{
- data.briefIntroduction = $('#technologyInput').val();
- }
- if ($('#signStartTimeStr').val()){
- data.startTime = $('#signStartTimeStr').val() + ' 00:00:00';
- }
- if ($('#signEndTimeStr').val()){
- data.endTime = $('#signEndTimeStr').val() + ' 00:00:00';
- }
-
- console.log(data)
- tools.doPost(technologyTraining, data, module.technologyTrainingList, true);
- }
-
- consultingSearch = function(){
- const data = {}
- if ($("input[name='consultingType']:checked").val() == 'title'){
- data.title = $('#consultingInput').val();
- }else{
- data.handleName = $('#consultingInput').val();
- }
- // data.startTime = $('#technologyInput').val();
- // data.endTime = $('#technologyInput').val();
- console.log(data)
- tools.doPost(technologyConsulting, data, module.technologyConsultingList, true);
- }
-
- goSearch = function (type) {
- if (type == 'expert'){
- tools.doPost(expertDatabase, {name: $("#searchInput").val()}, module.expertDatabaseList, true);
- }
- if (type == 'article'){
- tools.doPost(articleLibrary, {headline: $("#articleSearchInput").val()}, module.articleLibraryList, true);
- }
- if (type == 'video'){
- tools.doPost(videoLibrary, {headline: $("#videoSearchInput").val()}, module.videoLibraryList, true);
- }
- }
-
- return module;
- })
|