landExpropriate.home.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * 创建者:王成
  3. * 创建日期:2022年4月22日
  4. * 描述:征地首页脚本
  5. * 要求:该脚本需要mui、JQuery、ajax、common、save等脚本的支持,请提前引入
  6. */
  7. mui.init();
  8. /* 启用轮播 */
  9. var sliderImagePaths = [];
  10. sliderImagePaths.push('../img/home/main_home_slider_image02.png');
  11. beginSliderContent('slider', sliderImagePaths, 2000);
  12. /* 初始化完成 */
  13. plusInit(function() {
  14. /* 显示日期和时间 */
  15. beginShowTime();
  16. loadLandExpropriateCountInfo();
  17. });
  18. var countModel = {
  19. itemTotal: '348',
  20. pzArea: '6815.3742',
  21. gyArea: '38.5163',
  22. jtArea: '4550.1554',
  23. gyRatio: '0.57%',
  24. jtRatio: '66.78%',
  25. }
  26. /**
  27. * 加载统计数据
  28. */
  29. function loadLandExpropriateCountInfo() {
  30. sendAjax({
  31. waitMessage: '加载统计信息...',
  32. url: 'appQueryLandExpropriateCollect',
  33. success: function(resData) {
  34. showLandExpropriateCountInfo(resData[0]);
  35. },
  36. error: function(err) {
  37. }
  38. })
  39. }
  40. /**
  41. * 展示综合统计数据
  42. * @param {JSON} model 征地综合统计模型
  43. */
  44. function showLandExpropriateCountInfo(model) {
  45. appendLandExpropriateCountItem('divCountV1', '征地项目总数', model.itemTotal);
  46. appendLandExpropriateCountItem('divCountV1', '征地总面积', model.pzArea);
  47. appendLandExpropriateCountItem('divCountV1', '国有总面积', model.gyArea);
  48. appendLandExpropriateCountItem('divCountV2', '集体总面积', model.jtArea);
  49. appendLandExpropriateCountItem('divCountV2', '国有面积占比', model.gyRatio);
  50. appendLandExpropriateCountItem('divCountV2', '集体面积占比', model.jtRatio);
  51. var subWidth = $(".cr-panel-count>*:first-child>*:nth-child(2)").width();
  52. var mainWidth = $(".cr-panel-count>*:first-child").width();
  53. var dis = (mainWidth - subWidth) / 2;
  54. var leftFrom = dis - 10;
  55. var leftTo = leftFrom + 10 * 2
  56. setPropertyFromStyle('--left--from', leftFrom + 'px');
  57. setPropertyFromStyle('--left--to', leftTo + 'px');
  58. }
  59. /**
  60. * 向容器中添加征地综合统计子项
  61. * @param {string} mainDomId 父容器Id
  62. * @param {string} title 标题
  63. * @param {string} value 值
  64. */
  65. function appendLandExpropriateCountItem(mainDomId, title, value) {
  66. var div = document.createElement('div');
  67. var divHtml = "";
  68. divHtml += "<div>" + title + "</div>";
  69. divHtml += "<div>" + value + "</div>";
  70. divHtml += "<img />";
  71. div.innerHTML = divHtml;
  72. $("#" + mainDomId).append(div);
  73. }
  74. /**
  75. * 点击事件
  76. * 打开征地分类统计页面
  77. */
  78. function click_openClasssifyCountPage() {
  79. createAndOpenPage({
  80. htmlPath: 'LandExpropriate-count-proportion.html',
  81. autoback: true,
  82. title: '征地占比统计'
  83. });
  84. }
  85. /**
  86. * 点击事件
  87. * 打开征地汇总统计页面
  88. */
  89. function click_openCollectCountPage() {
  90. createAndOpenPage({
  91. htmlPath: 'LandExpropriate-count-collect.html',
  92. autoback: true,
  93. title: '征地汇总统计'
  94. });
  95. }
  96. /**
  97. * 点击事件
  98. * 打开征地数据查询页面
  99. */
  100. function click_openQueryPage() {
  101. createAndOpenPage({
  102. htmlPath: 'LandExpropriate-query.html',
  103. autoback: true,
  104. title: '征地数据查询'
  105. });
  106. }