inspection_record.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
  9. <script src="https://unpkg.com/element-ui@2.15.14/lib/index.js"></script>
  10. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  11. <style>
  12. @import url("https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css");
  13. *{
  14. margin:0;
  15. padding:0;
  16. }
  17. .el-calendar__header{
  18. border:none;
  19. }
  20. .el-calendar__body{
  21. margin-top:-24px;
  22. }
  23. td{
  24. text-align:center;
  25. }
  26. .el-calendar-table .el-calendar-day{
  27. height:auto;
  28. }
  29. .el-calendar-table td{
  30. border:none;
  31. }
  32. .el-calendar-table tr td:first-child{
  33. border:none;
  34. }
  35. .el-calendar-table .el-calendar-day{
  36. padding:6px;
  37. }
  38. .el-calendar-table tr:first-child td{
  39. border:none;
  40. }
  41. .el-calendar-day span{
  42. font-size:14px;
  43. }
  44. .form{
  45. display:flex;
  46. justify-content: space-between;
  47. padding:0 20px;
  48. margin-top:-20px;
  49. margin-bottom:-20px;
  50. }
  51. .form input{
  52. background:#F6F6F6;
  53. border:none;
  54. border-radius: 10px;
  55. width:120px;
  56. padding:5px 10px;
  57. }
  58. .form button{
  59. border:none;
  60. color:white;
  61. background:#3B70FE;
  62. border-radius: 10px;
  63. width:60px;
  64. height:40px;
  65. }
  66. .list{
  67. padding:20px;
  68. }
  69. .list .item{
  70. display:flex;
  71. justify-content: space-between;
  72. align-items: center;
  73. margin-bottom:20px;
  74. }
  75. .list .item .left{
  76. display:flex;
  77. align-items: center;
  78. position:relative;
  79. }
  80. .list .item .left .shu{
  81. border-left:1px solid #DADADA;
  82. width:1px;
  83. height:30px;
  84. position:absolute;
  85. left:5px;
  86. top:16px;
  87. }
  88. .list .item span{
  89. color:#DADADA;
  90. }
  91. .list .item .left .yuan{
  92. width:10px;
  93. height:10px;
  94. border-radius: 50%;
  95. border:1px solid #DBDBDB;
  96. margin-right:10px;
  97. }
  98. .list .item .left .through{
  99. background:#3F6EFE;
  100. }
  101. </style>
  102. </head>
  103. <body>
  104. <div id="app">
  105. <el-calendar v-model="val">
  106. </el-calendar>
  107. <div class="form">
  108. <!-- <input type="text" v-model="section" placeholder="单位名称"> -->
  109. <!-- <input type="text" v-model="name" placeholder="姓名"> -->
  110. <el-form :inline="true" class="demo-form-inline">
  111. <el-form-item>
  112. <el-select v-model="section" placeholder="单位名称" @change="handleSectionChange">
  113. <el-option v-for="(item,index) in select_list" :key="index" :label="item.name" :value="item.name"></el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item>
  117. <el-select v-model="name" placeholder="姓名">
  118. <el-option v-for="(item,index) in name_select" :key="index" :label="item.person_name" :value="item.person_id"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. </el-form>
  122. <button @click="search">搜索</button>
  123. </div>
  124. <div class="list">
  125. <div class="item" v-for="(item,index) in record_list" :key="index" @click="page_dump(item.url)">
  126. <div class="left">
  127. <div class="yuan" :class="{ 'through': item.date }"></div>
  128. <div class="shu"></div>
  129. <p>{{item.area}}</p>
  130. </div>
  131. <span>{{item.date}}</span>
  132. </div>
  133. </div>
  134. </div>
  135. <script>
  136. var Main = {
  137. data() {
  138. return {
  139. val: new Date(),
  140. section:'',
  141. name:'',
  142. ind:0,
  143. select_list:[],
  144. name_select:[],
  145. record_list:[]
  146. }
  147. },
  148. created(){
  149. this.get_select()
  150. },
  151. watch: {
  152. val(newValue, oldValue) {
  153. this.get_select()
  154. // 在这里可以处理选中日期改变的逻辑
  155. // 例如:
  156. // this.fetchEvents(newValue); // 拉取新选中日期的事件
  157. },
  158. },
  159. methods:{
  160. search(){
  161. this.get_select()
  162. const date = new Date(this.val);
  163. const year = date.getFullYear();
  164. const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份从0开始,需要加1并补零
  165. const day = ('0' + date.getDate()).slice(-2); // 获取日并补零
  166. const formattedDate = `${year}-${month}-${day}`;
  167. const loading = this.$loading({
  168. lock: true,
  169. text: '数据加载中',
  170. spinner: 'el-icon-loading',
  171. background: 'rgba(0, 0, 0, 0.7)'
  172. });
  173. axios.post('http://anvideo.nxmy.com:8011/api/fanwei/get_person_travel',{'person_id':this.name,'date':formattedDate,'depart':this.section})
  174. .then( (response)=> {
  175. this.record_list = response.data.content.data
  176. loading.close()
  177. })
  178. .catch(function (error) {
  179. console.log(error);
  180. loading.close()
  181. });
  182. },
  183. get_select() {
  184. const date = new Date(this.val);
  185. const year = date.getFullYear();
  186. const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份从0开始,需要加1并补零
  187. const day = ('0' + date.getDate()).slice(-2); // 获取日并补零
  188. const formattedDate = `${year}-${month}-${day}`;
  189. axios.post('http://anvideo.nxmy.com:8011/api/fanwei/get_query_conition',{'date':formattedDate})
  190. .then( (response)=> {
  191. this.select_list = response.data.content.data
  192. })
  193. .catch(function (error) {
  194. console.log(error);
  195. });
  196. },
  197. handleSectionChange() {
  198. this.name = ''
  199. this.ind = this.select_list.findIndex(item => item.name === this.section)
  200. this.name_select = this.select_list[this.ind].person_list
  201. },
  202. page_dump(url){
  203. if(url != ''){
  204. window.location.href = 'http://10.186.132.147'+url
  205. }
  206. }
  207. }
  208. }
  209. var Ctor = Vue.extend(Main)
  210. new Ctor().$mount('#app')
  211. </script>
  212. </body>
  213. </html>