logging.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>下井记录</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <link rel="stylesheet" href="../../css/animate.css">
  10. <link rel="stylesheet" href="../../css/style.css">
  11. <style>
  12. body,
  13. html {
  14. background: #F5F5F5;
  15. }
  16. .api_layout {
  17. /*margin: 10px;*/
  18. }
  19. .header_user_info {
  20. display: flex;
  21. align-items: center;
  22. justify-content: flex-start;
  23. }
  24. .left_avatar img {
  25. width: 48px;
  26. height: 48px;
  27. display: block;
  28. border-radius: 100%;
  29. }
  30. .right_name_department {
  31. padding-left: 5px;
  32. }
  33. #headerInfo {
  34. padding: 12px 0 11px 11px;
  35. background: #fff
  36. }
  37. #MonthOnce {
  38. padding: 0 11px 11px 11px;
  39. background: #fff
  40. }
  41. #monthInfoList {
  42. background: #fff;
  43. }
  44. #monthList {
  45. overflow-x: scroll;
  46. }
  47. .template_view_container {
  48. display: flex;
  49. align-items: center;
  50. padding: 7px 5px;
  51. /*margin-top: 20px;*/
  52. }
  53. .month_list_info {
  54. min-width: 110px;
  55. margin-left: 9.5px;
  56. float: left;
  57. flex: 1;
  58. position: relative;
  59. display: flex;
  60. justify-content: space-around;
  61. align-items: center;
  62. color: #009FE8;
  63. border-radius: 10px;
  64. border: 1px solid rgba(0, 159, 232, 1);
  65. padding: 8px 5px;
  66. }
  67. .month_list_info:first-child {
  68. width: 220px;
  69. background: rgba(0, 159, 232, 1);
  70. border-radius: 10px;
  71. color: #FFFFFF;
  72. }
  73. .month_list_info.active {
  74. background: rgba(0, 159, 232, 1);
  75. border-radius: 10px;
  76. color: #FFFFFF;
  77. }
  78. .month_list_info:first-child {
  79. margin-left: 0
  80. }
  81. .month_info_list li {
  82. display: flex;
  83. align-items: center;
  84. height: 51px;
  85. border-bottom: solid 1px #F5F5F5;
  86. background: #fff;
  87. }
  88. .month_info_list li:first-child {
  89. font-size: 14px;
  90. font-weight: 500;
  91. color: rgba(0, 159, 232, 1);
  92. border-bottom: solid 1px #009FE8;
  93. }
  94. .month_info_list li .item {
  95. width: 25%;
  96. text-align: center;
  97. }
  98. .month_once_view {
  99. position: relative;
  100. }
  101. .right_statistics {
  102. width: 116px;
  103. height: 95px;
  104. position: absolute;
  105. right: 0;
  106. top: 0;
  107. }
  108. #statistics {
  109. position: absolute;
  110. right: -10px;
  111. top: -60px;
  112. width: 100%;
  113. }
  114. .statistics-title {
  115. position: absolute;
  116. right: 20px;
  117. bottom: 0;
  118. }
  119. .left_times {
  120. width: 61%;
  121. padding: 7px 0 7px 12px;
  122. background: rgba(243, 246, 250, 1);
  123. border-radius: 7px;
  124. position: relative;
  125. }
  126. .left_times ul li {
  127. display: flex;
  128. align-items: center;
  129. color: #6C6F74;
  130. font-size: 16px;
  131. line-height: 28px
  132. }
  133. .left_times ul li div:last-child {
  134. padding-left: 4px;
  135. }
  136. .left_times img {
  137. width: 41px;
  138. height: 36px;
  139. position: absolute;
  140. top: 0;
  141. right: 0
  142. }
  143. .plan_num,
  144. .real_num {
  145. font-size: 24px;
  146. font-weight: 500;
  147. /*padding-bottom: 10px;*/
  148. }
  149. .plan_num {
  150. color: #E67E22
  151. }
  152. .real_num {
  153. color: #2980B9
  154. }
  155. </style>
  156. </head>
  157. <body>
  158. <div class="api_layout">
  159. <div id="headerInfo"></div>
  160. <div id="MonthOnce">
  161. <!-- <div id="statisticsContainer"></div> -->
  162. </div>
  163. <div id="monthList"></div>
  164. <div id="monthInfoList"></div>
  165. </div>
  166. </body>
  167. </html>
  168. <script type="text/javascript" src="../../script/api.js"></script>
  169. <script type="text/javascript" src="../../script/zepto.js"></script>
  170. <script type="text/javascript" src="../../script/f2.js"></script>
  171. <script src="../../script/config.js" charset="utf-8"></script>
  172. <script src="../../script/doT.min.js" charset="utf-8"></script>
  173. <script type="text/template" id="monthListView">
  174. <div class="template_view_container">
  175. {{ for(var i = 0; i
  176. < it.length; i++ ) { }} <div class="month_list_info" onclick="changeListTime(this,'{{=i}}','{{=it[i].year}}','{{=it[i].month}}','{{=it[i].times}}')">
  177. <div class="year_info">{{=it[i].year}}年</div>
  178. <div class="month_info">{{=it[i].month}}月</div>
  179. <div class="times_info">{{=it[i].times}}次</div>
  180. </div>
  181. {{ } }}
  182. </div>
  183. </script>
  184. <script type="text/template" id="monthInfoView">
  185. <ul class="month_info_list">
  186. <li class="month_info_list_first">
  187. <div class="item">时间</div>
  188. <div class="item">下井时间</div>
  189. <div class="item">上井时间</div>
  190. <div class="item">下井时长</div>
  191. </li>
  192. {{ for(var i = 0; i
  193. < it.length; i++ ) { }} <li class="month_info_item" onclick="handleGetOnceInfo('{{=it[i].date}}','{{=it[i].downtime}}')">
  194. <div class="item">
  195. <div>{{=it[i].date}}</div>
  196. <div>{{=it[i].week}}</div>
  197. </div>
  198. <div class="item">
  199. <div>{{=it[i].downtime}}</div>
  200. <div>{{=it[i].classes}}</div>
  201. </div>
  202. <div class="item month_info">{{=it[i].uptime}}</div>
  203. <div class="item times_info">{{=it[i].duration}}</div>
  204. </li>
  205. {{ } }}
  206. </ul>
  207. </script>
  208. <script type="text/template" id="MonthOnceView">
  209. <div class="month_once_view">
  210. <div class="left_times">
  211. {{? it.plan
  212. <=it.real}} <img src="../../image/completed.png" alt="">
  213. {{?? it.plan > it.real}}
  214. <img src="../../image/unfinished.png" alt=""> {{?}}
  215. <ul>
  216. <li>{{=it.date}}</li>
  217. <li>
  218. <div>需下井次数:</div>
  219. <div class="plan_num">{{=it.plan}}</div>
  220. <div>次</div>
  221. </li>
  222. <li>
  223. <div>已下井次数:</div>
  224. <div class="real_num">{{=it.real}}</div>
  225. <div>次</div>
  226. </li>
  227. </ul>
  228. </div>
  229. <div class="right_statistics">
  230. <canvas id="statistics" style="width: 140px;height: 140px"></canvas>
  231. <div class="statistics-title" style="color: #6C6F74">月下井完成度</div>
  232. </div>
  233. </div>
  234. </script>
  235. <script type="text/javascript">
  236. var jobID = "",staff_num = '',
  237. username = '',depart_name='';
  238. apiready = function() {
  239. var info = $api.getStorage('data');
  240. let user = JSON.parse(info).data.user
  241. staff_num = api.pageParam.staff_num
  242. username = api.pageParam.username
  243. depart_name = api.pageParam.depart_name
  244. var img
  245. img = `<img src="http://jiewei-icon.oss-cn-beijing.aliyuncs.com/icon/default-avatar.png" alt="" />`
  246. let userInfoHtml =
  247. `<div class="header_user_info">
  248. <div class="left_avatar"> ${img}</div>
  249. <div class="right_name_department">
  250. <div style="color: #232627;font-size: 16px">${username}</div>
  251. <div style="color: #6C6F74;font-size: 14px">${depart_name}</div>
  252. </div>
  253. </div>`
  254. $api.html(headerInfo, userInfoHtml);
  255. getMonthlist();
  256. getMonthInfo();
  257. getMonthOnce();
  258. }
  259. function getMonthlist() {
  260. $http.requestData(jinfengUrlRouter.getMonthlist, 'post', {staff_num})
  261. .then(ret => {
  262. if (ret.code == 0) {
  263. $apis.html(monthList, '#monthListView', ret.data);
  264. let DiffMonth = `${ret.data[0].year}-${ret.data[0].month}`;
  265. let DownTime = ret.data[0].times;
  266. getMonthInfo(DiffMonth, DownTime);
  267. getMonthOnce(DiffMonth, DownTime);
  268. }
  269. })
  270. .catch((err) => {
  271. // console.log(JSON.stringify(err));
  272. });
  273. }
  274. function changeListTime(el, index, year, month, times) {
  275. let diffMonth = `${year}-${month}`;
  276. let downtime = times;
  277. $(el).css({
  278. background: '#009FE8',
  279. color: '#FFFFFF'
  280. }).siblings().css({
  281. border: '1px solid rgba(0,159,232,1)',
  282. color: '#009FE8',
  283. background: '#FFFFFF'
  284. })
  285. getMonthInfo(diffMonth, downtime)
  286. getMonthOnce(diffMonth, downtime)
  287. }
  288. // 当月下井列表
  289. function getMonthInfo(month, downtime) {
  290. $http.requestData(jinfengUrlRouter.getMonthInfo, 'post', {
  291. month: month,
  292. staff_num,
  293. downtime: downtime
  294. })
  295. .then(ret => {
  296. if (ret.code == 0) {
  297. $apis.html(monthInfoList, '#monthInfoView', ret.data);
  298. }
  299. })
  300. .catch((err) => {
  301. // console.log(JSON.stringify(err));
  302. });
  303. }
  304. // 当月下井完成度
  305. function getMonthOnce(month, downtime) {
  306. $http.requestData(jinfengUrlRouter.getMonthOnce, 'post', {
  307. month: month,
  308. staff_num,
  309. downtime: downtime
  310. })
  311. .then(ret => {
  312. if (ret.code == 0) {
  313. $apis.html(MonthOnce, '#MonthOnceView', ret.data);
  314. try {
  315. var fontSize = 24 * (window.innerWidth / 375); // 字体适配不同屏幕
  316. var yNum = parseInt(ret.data.real / ret.data.plan * 100)
  317. let dataNum = yNum >= 100 ? 100 : yNum;
  318. var data = [{
  319. name: '总数据',
  320. defaultx: '1',
  321. defaulty: dataNum
  322. }];
  323. var chart = new F2.Chart({
  324. id: 'statistics',
  325. pixelRatio: window.devicePixelRatio
  326. });
  327. chart.source(data, {
  328. defaulty: {
  329. max: 100,
  330. min: 0
  331. }
  332. });
  333. chart.axis(false);
  334. chart.tooltip(false);
  335. chart.coord('polar', {
  336. transposed: true, // 坐标系翻转
  337. innerRadius: 0.85, // 内环半径,数值为 0 - 1 范围
  338. radius: 1 // 半径,数值为 0 - 1 范围
  339. });
  340. // chart.interval().position('defaultx*defaulty').color('name', ['#FE5D4D'])
  341. chart.guide().arc({
  342. start: [0, 0],
  343. end: [1, 99.98],
  344. top: false,
  345. style: {
  346. lineWidth: 10,
  347. stroke: '#BDC3C7'
  348. }
  349. });
  350. let chartColor = yNum < 100 ? '#E67E22' : '#27AE60'
  351. chart.guide().text({
  352. position: ['50%', '50%'],
  353. content: `${yNum}%`,
  354. style: {
  355. fontSize: fontSize, // 文本大小
  356. fill: chartColor, // 文本颜色 #1890ff
  357. // fontWeight: 'bold' // 文本粗细
  358. }
  359. });
  360. chart.interval().position('defaultx*defaulty').color(chartColor).size(10).animate({
  361. appear: {
  362. duration: 1200,
  363. easing: 'cubicIn'
  364. }
  365. });
  366. chart.render();
  367. } catch (e) {
  368. // console.log(e);
  369. }
  370. }
  371. })
  372. .catch((err) => {
  373. // console.log(JSON.stringify(err));
  374. });
  375. }
  376. function handleGetOnceInfo(date, downtime) {
  377. let params = {
  378. downtime: date + ' ' + downtime,
  379. staff_num,
  380. }
  381. $event.openTabLayout('drivingTrack', 'drivingTrack', '行驶轨迹', params);
  382. }
  383. </script>