网站
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

218 lines
7.8 KiB

  1. define(['jquery', "template", "Tools", 'LeftNav', 'dateTime'], function ($, template, Tools, LeftNav) {
  2. //数据存储
  3. var module = {
  4. data: {
  5. //服务器地址
  6. serverApi: '',
  7. dataList: {
  8. children: [],
  9. haschildren: true,
  10. isopen: false,
  11. level: "0",
  12. name: "",
  13. url: "#",
  14. },
  15. },
  16. };
  17. var tools = new Tools();
  18. module.init = function (page) {
  19. tools.doGet(dictType + '/Industrial_classification_type', {}, module.dictType , true);
  20. var tabs = $('.tab').find('li');
  21. var informationBox = $("#listBox > div");
  22. tabs.on('click', function (e) {
  23. e.preventDefault();//防止打开链接
  24. var index = $(this).data('id');
  25. tabs.removeClass('active');
  26. informationBox.css("display",'none');
  27. $(this).addClass('active');
  28. $('#'+index).css("display",'block')
  29. });
  30. // $("#signStartTimeStr").datetime({
  31. // type: "date",
  32. // value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  33. // success: function (res) {
  34. // //console.log(res)
  35. // }
  36. // })
  37. //
  38. // $("#signEndTimeStr").datetime({
  39. // type: "date",
  40. // value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  41. // success: function (res) {
  42. // //console.log(res)
  43. // }
  44. // })
  45. };
  46. //新闻列表
  47. module.projectList = function (data) {
  48. if (data.code == 200) {
  49. var content = data.data;
  50. content.forEach(res => {
  51. module.data.dataList.children.push(res);
  52. })
  53. leftNav(".left", module.data.dataList);
  54. }
  55. }
  56. module.dictType = function (data) {
  57. module.data.industryClassOptions = data.data;
  58. tools.doPost(entityMain, {}, module.entityMain , true);
  59. tools.doPost(supplyChainAgent, {}, module.supplyChainAgent , true);
  60. tools.doPost(supplyChainPurchaser, {}, module.supplyChainPurchaser , true);
  61. }
  62. //经营主体
  63. module.entityMain = function (data) {
  64. if (data.code == 200) {
  65. var content = data.data;
  66. for ( var i = 0 ; i < content.length ; i++ ){
  67. if (content[i].industryClassificationType != null){
  68. var industryClassificationType = content[i].industryClassificationType.split(",");
  69. var secondArray = "";
  70. for (var j = 0 ; j < industryClassificationType.length ; j++){
  71. secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
  72. }
  73. content[i].industryClassificationType = secondArray;
  74. }
  75. console.log(content[i].industryClassificationType)
  76. content[i].masterMap = serverApi + content[i].masterMap ;
  77. }
  78. module.data.entityMainList = content;
  79. var entityMainData = template('entityMainData', module.data);
  80. $("#entityMainContent").html(entityMainData);
  81. }
  82. }
  83. //经营主体
  84. module.supplyChainAgent = function (data) {
  85. if (data.code == 200) {
  86. var content = data.data;
  87. // for ( var i = 0 ; i < content.length ; i++ ){
  88. // if (content[i].industryClassificationType != null){
  89. // var industryClassificationType = content[i].industryClassificationType.split(",");
  90. // var secondArray = "";
  91. // for (var j = 0 ; j < industryClassificationType.length ; j++){
  92. // secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
  93. // }
  94. // content[i].industryClassificationType = secondArray;
  95. // }
  96. // console.log(content[i].industryClassificationType)
  97. // content[i].masterMap = serverApi + content[i].masterMap ;
  98. //
  99. // }
  100. module.data.agentList = content;
  101. var agentData = template('agentData', module.data);
  102. $("#agentContent").html(agentData);
  103. }
  104. }
  105. //经营主体
  106. module.supplyChainPurchaser = function (data) {
  107. if (data.code == 200) {
  108. var content = data.data;
  109. // for ( var i = 0 ; i < content.length ; i++ ){
  110. // if (content[i].industryClassificationType != null){
  111. // var industryClassificationType = content[i].industryClassificationType.split(",");
  112. // var secondArray = "";
  113. // for (var j = 0 ; j < industryClassificationType.length ; j++){
  114. // secondArray += module.selectDictLabel(module.data.industryClassOptions,industryClassificationType[j]);
  115. // }
  116. // content[i].industryClassificationType = secondArray;
  117. // }
  118. // console.log(content[i].industryClassificationType)
  119. // content[i].masterMap = serverApi + content[i].masterMap ;
  120. //
  121. // }
  122. module.data.purchaserList = content;
  123. var purchaserData = template('purchaserData', module.data);
  124. $("#purchaserContent").html(purchaserData);
  125. }
  126. }
  127. module.selectDictLabel = function (datas, value) {
  128. var actions = [];
  129. Object.keys(datas).some((key) => {
  130. if (datas[key].dictValue == ('' + value)) {
  131. actions.push(datas[key].dictLabel);
  132. return true;
  133. }
  134. })
  135. return actions.join('');
  136. }
  137. switchTab = function (type) {
  138. $("#"+type+"Btn").addClass("active").siblings().removeClass("active");
  139. $("#"+type+"").css('display','block').siblings().css('display','none');
  140. module.data.switchTab = type;
  141. }
  142. searchType = function (id) {
  143. console.log(id)
  144. $(".left .left_nav_name").removeClass("nav_open");
  145. tools.doPost(technologyConsulting, {techniqueType: id}, module.technologyConsultingList, true);
  146. }
  147. technologySearch = function(){
  148. const data = {}
  149. if ($("input[name='searchType']:checked").val() == 'title'){
  150. data.trainingName = $('#technologyInput').val();
  151. }else{
  152. data.briefIntroduction = $('#technologyInput').val();
  153. }
  154. if ($('#signStartTimeStr').val()){
  155. data.startTime = $('#signStartTimeStr').val() + ' 00:00:00';
  156. }
  157. if ($('#signEndTimeStr').val()){
  158. data.endTime = $('#signEndTimeStr').val() + ' 00:00:00';
  159. }
  160. console.log(data)
  161. tools.doPost(technologyTraining, data, module.technologyTrainingList, true);
  162. }
  163. consultingSearch = function(){
  164. const data = {}
  165. if ($("input[name='consultingType']:checked").val() == 'title'){
  166. data.title = $('#consultingInput').val();
  167. }else{
  168. data.handleName = $('#consultingInput').val();
  169. }
  170. // data.startTime = $('#technologyInput').val();
  171. // data.endTime = $('#technologyInput').val();
  172. console.log(data)
  173. tools.doPost(technologyConsulting, data, module.technologyConsultingList, true);
  174. }
  175. goSearch = function (type) {
  176. if (type == 'expert'){
  177. tools.doPost(expertDatabase, {name: $("#searchInput").val()}, module.expertDatabaseList, true);
  178. }
  179. if (type == 'article'){
  180. tools.doPost(articleLibrary, {headline: $("#articleSearchInput").val()}, module.articleLibraryList, true);
  181. }
  182. if (type == 'video'){
  183. tools.doPost(videoLibrary, {headline: $("#videoSearchInput").val()}, module.videoLibraryList, true);
  184. }
  185. }
  186. return module;
  187. })