index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="visitRecord">
  3. <NavBar/>
  4. <div class="page-container">
  5. <van-search v-model="query.userName" class="van-hairline--bottom" placeholder="请输入人员姓名" @change="refreshData"/>
  6. <div class="search-flex">
  7. <select-cell
  8. style="border-right: 1px solid #f5f5f5;"
  9. title="出入类型"
  10. :isAll="true"
  11. :border="false"
  12. v-model="query.type"
  13. :data-list="getDictItem('out_in_type')"
  14. @change="refreshData"/>
  15. <date-cell title="日期" v-model="query.arrivalTime" date-type="date" @change="refreshData"/>
  16. </div>
  17. <div class="card-list">
  18. <Scroll
  19. ref="Scroll"
  20. @refresh="refreshData"
  21. @loadMore="getDataList"
  22. :pullup="pullup">
  23. <empty v-if="!dataList || dataList.length === 0"/>
  24. <card v-else v-for="(v,i) in dataList" :key="v.id">
  25. <van-cell
  26. :title-style="{color:v.type == 3?'#D7000F':''}"
  27. :title="getDictLabel(v.type,'out_in_type')"
  28. @click="clickItem(v.id)">
  29. <template #extra>
  30. <van-button v-if="!v.departureTime" type="info" size="mini">登记离开时间</van-button>
  31. </template>
  32. <template #label>
  33. <div class="info-box">
  34. <div class="info-item">
  35. <div class="item-label">人员姓名:</div>
  36. <div class="item-value"> {{v.userName}}</div>
  37. </div>
  38. <div class="info-item">
  39. <div class="item-label">证件号码:</div>
  40. <div class="item-value">{{v.idCard}}</div>
  41. </div>
  42. <div class="info-item">
  43. <div class="item-label">到达时间:</div>
  44. <div class="item-value">
  45. {{v.arrivalTime}}
  46. </div>
  47. </div>
  48. <div class="info-item">
  49. <div class="item-label">离开时间:</div>
  50. <div class="item-value">
  51. {{v.departureTime || '暂无'}}
  52. </div>
  53. </div>
  54. <div class="info-item">
  55. <div class="item-label">出入事由:</div>
  56. <div class="item-value">
  57. {{v.reasons}}
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. </van-cell>
  63. </card>
  64. </Scroll>
  65. </div>
  66. </div>
  67. <drag-button @btnClick="clickAdd"></drag-button>
  68. </div>
  69. </template>
  70. <script>
  71. import NavBar from '@/components/NavBar/index.vue'
  72. import OrgTree from '@/components/orgTree/index.vue'
  73. import Scroll from '@/components/scroll/scroll.vue'
  74. import Card from '@/components/card/index.vue'
  75. import dateCell from '@/components/dateCell/index.vue'
  76. import selectCell from '@/components/selectCell/index.vue'
  77. import {dataList} from './api'
  78. import {mapGetters} from "vuex";
  79. import {formatDate} from "@/filters/filter";
  80. import DragButton from "@/components/DragButton/index.vue";
  81. export default {
  82. components: {
  83. DragButton,
  84. NavBar,
  85. OrgTree,
  86. Scroll,
  87. Card,
  88. dateCell,
  89. selectCell,
  90. },
  91. data() {
  92. return {
  93. query:{
  94. arrivalTime:`${formatDate(new Date(),'YYYY-MM-DD')}`,
  95. userName:null,
  96. pageSize:10,
  97. pageNum:1,
  98. },
  99. dataList:[],
  100. pullup:false,
  101. dicts:['out_in_type']
  102. }
  103. },
  104. beforeRouteEnter(to,from,next){
  105. next(vm=>{
  106. if(to.params.event === 'refresh'){
  107. vm.refreshData();
  108. }
  109. })
  110. },
  111. mounted() {
  112. this.initData();
  113. },
  114. computed:{
  115. ...mapGetters(['orgId','id','dictionary']),
  116. },
  117. methods: {
  118. clickAdd(){
  119. this.$router.push({
  120. path:'/visitUserRecord',
  121. });
  122. },
  123. refreshData(){
  124. this.pullup = true;
  125. this.query.pageNum = 1;
  126. this.total = 0;
  127. this.dataList = [];
  128. this.getDataList();
  129. },
  130. //初始化数据
  131. initData(){
  132. this.query.arrivalTime = formatDate(new Date(),'YYYY-MM-DD');
  133. this.getDataList();
  134. },
  135. //获取数据列表
  136. getDataList(){
  137. if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
  138. this.pullup = false;
  139. this.$toast('已加载完毕');
  140. return;
  141. }
  142. let data = {
  143. ...this.query,
  144. orgId:this.orgId
  145. }
  146. dataList(data).then(res=>{
  147. if(res.total === '0'){
  148. this.pullup = false;
  149. this.$toast('已加载完毕');
  150. return
  151. }
  152. this.total = res.total;
  153. if(this.dataList.length < res.total) {
  154. this.dataList = [...this.dataList,...res.rows] ;
  155. this.pullup = true;
  156. this.query.pageNum++;
  157. this.$refs.Scroll.refresh();
  158. }
  159. })
  160. },
  161. clickItem(id){
  162. this.$router.push({
  163. path:'/visitRecordDetail',
  164. query:{id}
  165. });
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .visitRecord{
  172. .card {
  173. >.van-cell{
  174. padding: 0;
  175. }
  176. }
  177. .van-cell-group{
  178. margin-bottom: 20px;
  179. }
  180. .van-cell-group:last-child{
  181. margin-bottom: 0;
  182. }
  183. .vue-table-root{
  184. tr,td,th{
  185. font-size: 25px!important;
  186. color:#666!important;
  187. }
  188. }
  189. }
  190. </style>
  191. <style lang="scss" scoped>
  192. .problem-item{
  193. }
  194. .app-container{
  195. }
  196. .card-list{
  197. padding:0 20px 20px 20px;
  198. height: calc(100vh - 426px);
  199. overflow: auto;
  200. }
  201. .card-num{
  202. display: flex;
  203. align-items: center;
  204. font-size: 28px;
  205. color: #009dff;
  206. }
  207. .search-flex{
  208. display: flex;
  209. align-items: center;
  210. justify-content: space-between;
  211. border-bottom: 1px solid #f5f5f5;
  212. >div{
  213. width: 50%;
  214. }
  215. }
  216. .btn-box{
  217. width: 100%;
  218. height: 100%;
  219. padding: 30px;
  220. background-color: #fff;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. }
  225. .info-box{
  226. color:#555;
  227. }
  228. .info-desc{
  229. padding-top: 10px;
  230. min-height: 50px;
  231. line-height: 36px;
  232. max-height: 250px;
  233. display: -webkit-box;
  234. -webkit-line-clamp: 3; /* 限制显示为3行 */
  235. -webkit-box-orient: vertical;
  236. overflow: hidden;
  237. text-overflow: ellipsis;
  238. >span{
  239. color:#999;
  240. }
  241. }
  242. .info-item{
  243. display: flex;
  244. justify-content: space-between;
  245. font-size: 26px;
  246. .item-label{
  247. flex:.25;
  248. text-align: left;
  249. color:#333;
  250. }
  251. .item-value{
  252. flex:.75;
  253. color:#666;
  254. min-height: 50px;
  255. line-height: 36px;
  256. max-height: 250px;
  257. display: -webkit-box;
  258. -webkit-line-clamp: 3; /* 限制显示为3行 */
  259. -webkit-box-orient: vertical;
  260. overflow: hidden;
  261. text-overflow: ellipsis;
  262. }
  263. }
  264. </style>