index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <!-- import element-ui CSS -->
  6. <link rel="stylesheet" href="../css/element-plus.css">
  7. <!-- import Vue before Element -->
  8. <script src="../utijs/vue.js"></script>
  9. <!-- import element-ui JavaScript -->
  10. <script src="../utijs/elementui.js"></script>
  11. <script src="../utijs/echart.js"></script>
  12. <link rel="stylesheet" href="../css/index.css">
  13. </head>
  14. <body>
  15. <!--编写标签-->
  16. <div id="app">
  17. <div class="hc-layout-box">
  18. <div class="main_box">
  19. <div class="main_nox_header">
  20. <span class="inner-text">
  21. {{projectName}}
  22. </span>
  23. </div>
  24. <div class="maininfo">
  25. <div class="maininfo_box">
  26. <div class="main_box_top">
  27. <div class="main_box_top_left">
  28. <div class="today_title">
  29. <span>今日,</span>
  30. </div>
  31. <div class="today_title_info">
  32. <span>{{yearTime}}年{{monthTime}}月{{dateTime}}日{{nowWeek}},欢迎您使用档案控制台。</span>
  33. </div>
  34. <div class="today_title_info_bottom">
  35. <div class="today_title_info_bottom_left">
  36. <span>总存储量</span>
  37. </div>
  38. <div class="today_title_info_bottom_right_box">
  39. <span class="today_title_info_bottom_right">{{allSize}}</span>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="main_box_top_right">
  44. <div class="main_box_top_right_toptitle">
  45. <span>档案总数</span>
  46. </div>
  47. <div class="main_box_top_right_topnumbox">
  48. <span class="main_box_top_right_topnum">{{countArchives}}</span>
  49. <span class="main_box_top_right_topnum_tip">卷</span>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="main_box_center">
  54. <div class="echart_box" id="main"></div>
  55. </div>
  56. <div class="main_box_center_btn_box">
  57. <div class="main_box_center_btn" @click="toQuery">
  58. <span >点击进馆查询</span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </body>
  67. <script>
  68. let myEchart;
  69. // 创建vue
  70. new Vue({
  71. // 控制的标签容器
  72. el: '#app',
  73. // 交互的数据
  74. data: function () {
  75. return {
  76. allSize:'66.35MB',
  77. visible: false,
  78. projectName:'安康至来凤国家高速公路奉节至巫山段-档案管理',
  79. countArchives: 0,
  80. option:{
  81. title: {
  82. text: '各保管期限案卷数量'
  83. },
  84. xAxis: {
  85. type: 'category',
  86. data: ['永久','定期30年','定期10年'],
  87. axisLine: {
  88. show: false, // 不显示坐标轴线
  89. },
  90. axisTick:{
  91. show:false // 不显示坐标轴刻度线
  92. },
  93. },
  94. yAxis: {
  95. type: 'value',
  96. axisLabel: {
  97. //这种做法就是在y轴的数据的值旁边拼接单位,貌似也挺方便的
  98. formatter: "{value}",
  99. },
  100. axisTick:{
  101. show:false // 不显示坐标轴刻度线
  102. },
  103. axisLine: {
  104. show: false, // 不显示坐标轴线
  105. },
  106. splitLine :{
  107. lineStyle:{
  108. type:'dashed'//虚线
  109. },
  110. show: true //隐藏
  111. }
  112. },
  113. series:[
  114. { type: 'bar',
  115. data: [0, 0, 0],
  116. barWidth: '30%',
  117. itemStyle:{
  118. color:'#59CEF5'
  119. }
  120. }
  121. ]
  122. },
  123. echartTest:null,
  124. yearTime:'',
  125. monthTime:'',
  126. dateTime:'',
  127. nowWeek:'',
  128. }
  129. },
  130. // 方法
  131. methods: {
  132. //获取当前时间
  133. getNowTime(){
  134. let date= new Date();
  135. this.yearTime=date .getFullYear();
  136. this.monthTime=date .getMonth()+1;
  137. this.dateTime=date .getDate();
  138. this.nowWeek="星期"+"天一二三四五六".charAt(new Date().getDay());
  139. },
  140. //获取项目名称
  141. getProjectName(){
  142. let that = this;
  143. var db = openDatabase('test1341', '1.0', '测试', 2 * 1024 * 1024);
  144. db.transaction(function (tx) {
  145. tx.executeSql('select node_name as name FROM m_archive_tree_contract WHERE parent_id=0 ',
  146. [], function (tx, results) {
  147. that.projectName = results.rows[0].name;
  148. }, null);
  149. });
  150. },
  151. toQuery() {
  152. console.log('去首页');
  153. window.location.href="query.html";
  154. },
  155. //获取案卷总数
  156. getCountArchives(){
  157. let that = this;
  158. var db = openDatabase('test1341', '1.0', '测试', 2 * 1024 * 1024);
  159. db.transaction(function (tx) {
  160. tx.executeSql('SELECT * FROM u_archives_auto', [], function (tx, results) {
  161. that.countArchives = results.rows.length;
  162. }, null);
  163. });
  164. },
  165. //各保管期限档案数量
  166. getHistogram(){
  167. let that = this;
  168. var db = openDatabase('test1341', '1.0', '测试', 2 * 1024 * 1024);
  169. db.transaction(function (tx) {
  170. tx.executeSql('SELECT * FROM u_archives_auto where storage_time = "3"', [], function (tx, results) {
  171. that.option.series[0].data[0] = results.rows.length;
  172. console.log( that.option.series[0].data);
  173. console.log('永久');
  174. }, null);
  175. tx.executeSql('SELECT * FROM u_archives_auto where storage_time = "2"', [], function (tx, results) {
  176. that.option.series[0].data[1] = results.rows.length;
  177. console.log( that.option.series[0].data);
  178. console.log('30');
  179. }, null);
  180. tx.executeSql('SELECT * FROM u_archives_auto where storage_time = "1"', [], function (tx, results) {
  181. that.option.series[0].data[2] = results.rows.length;
  182. console.log( that.option.series[0].data);
  183. console.log('10');
  184. myEchart.setOption(that.option);
  185. }, null);
  186. });
  187. },
  188. //获取档案总存储量
  189. getAutoAllSize(){
  190. let that = this;
  191. var db = openDatabase('test1341', '1.0', '测试', 2 * 1024 * 1024);
  192. db.transaction(function (tx) {
  193. tx.executeSql('SELECT SUM(file_size) as fileSize FROM u_archives_auto', [], function (tx, results) {
  194. var fileSizeString = "";
  195. var wrongSize = "0B";
  196. var fizeSize = results.rows[0].fileSize * 1024;
  197. if (fizeSize == 0) {
  198. return wrongSize;
  199. }
  200. if (fizeSize < 1024) {
  201. fileSizeString = fizeSize + "B";
  202. } else if (fizeSize < 1048576) {
  203. fileSizeString = (fizeSize / 1024).toFixed(2) + "KB";
  204. } else if (fizeSize < 1073741824) {
  205. fileSizeString = (fizeSize / 1048576).toFixed(2) + "MB";
  206. } else {
  207. fileSizeString = (fizeSize / 1073741824).toFixed(2) + "GB";
  208. }
  209. that.allSize = fileSizeString;
  210. }, null);
  211. });
  212. }
  213. },
  214. mounted(){
  215. this.getProjectName();
  216. this.getNowTime()
  217. this.getCountArchives();
  218. this.getHistogram();
  219. this.getAutoAllSize();
  220. myEchart = echarts.init(document.getElementById('main'));
  221. myEchart.setOption(this.option)
  222. this.echartTest =myEchart
  223. window.onresize =() => {
  224. if (this.echartTest) this.echartTest.resize();
  225. }
  226. }
  227. })
  228. </script>
  229. </html>