index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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="请输入人员姓名" @clear="refreshData" @change="refreshData"/>
  6. <div class="search-flex">
  7. <select-cell
  8. style="border-right: 1px solid #f5f5f5;"
  9. title="介绍信类型"
  10. is-all
  11. :border="false"
  12. v-model="query.type"
  13. :data-list="getDictItem('out_in_type')"
  14. @change="refreshData"/>
  15. <date-cell title="日期" is-all v-model="query.arrivalTime" date-type="date" @change="refreshData"/>
  16. </div>
  17. <select-cell
  18. style="border-right: 1px solid #f5f5f5;"
  19. title="审批状态"
  20. :isAll="true"
  21. :border="false"
  22. v-model="query.approveStatus"
  23. :data-list="getDictItem('out_in_approve_status')"
  24. @change="refreshData"/>
  25. <div class="card-list">
  26. <Scroll
  27. ref="Scroll"
  28. @refresh="refreshData"
  29. @loadMore="getDataList"
  30. :pullup="pullup">
  31. <empty v-if="!dataList || dataList.length === 0"/>
  32. <card v-else v-for="(v,i) in dataList" :key="v.id">
  33. <van-cell
  34. :border="false"
  35. class="item-title"
  36. :title-style="{color:'#008cd6'}"
  37. :title="`介绍信类型: ${getDictLabel(v.letterType,'out_in_type')}`"
  38. @click="clickItem(v.id)">
  39. <template #right-icon>
  40. <span v-if="v.approveStatus==1 && v.status==3" style="color:#D7000F">
  41. 已失效
  42. </span>
  43. <van-button v-if="v.approveStatus==0" @click.stop="cancelOutInRequest(v.id)" type="info" size="mini">取消出入申请</van-button>
  44. <van-button v-if="v.approveStatus==1 && v.status!=3 &&!v.arrivalTime" type="info" size="mini">登记达到时间</van-button>
  45. <van-button v-if="v.approveStatus==1 && v.status!=3 && v.arrivalTime&&!v.departureTime" type="info" size="mini">登记离开时间</van-button>
  46. </template>
  47. </van-cell>
  48. <van-cell
  49. :border="false"
  50. class="item-value"
  51. @click="clickItem(v.id)">
  52. <template #default>
  53. <div class="info-box">
  54. <div class="info-item">
  55. <div class="item-label">审批状态</div>
  56. <div class="item-value" :style="{color:getState(getDictLabel(v.approveStatus,'out_in_approve_status'))}">
  57. {{getDictLabel(v.approveStatus,'out_in_approve_status') }}
  58. </div>
  59. </div>
  60. <div class="info-item" v-if="v.approveRemark">
  61. <div class="item-label">审批说明</div>
  62. <div class="item-value"> {{v.approveRemark}}</div>
  63. </div>
  64. <div class="info-item">
  65. <div class="item-label">审批时间</div>
  66. <div class="item-value">
  67. <!-- {{v.approveTime}} -->
  68. {{v.approveTime? dayjs(v.approveTime).format('YYYY-MM-DD HH:mm') : '暂无'}}
  69. </div>
  70. </div>
  71. <div class="info-item">
  72. <div class="item-label">人员姓名</div>
  73. <div class="item-value"> {{v.userName}}</div>
  74. </div>
  75. <div class="info-item">
  76. <div class="item-label">到达时间</div>
  77. <div class="item-value">
  78. <!-- {{ dayjs(v.arrivalTime).format('YYYY-MM-DD HH:mm')}} -->
  79. {{v.arrivalTime? dayjs(v.arrivalTime).format('YYYY-MM-DD HH:mm') : '暂无'}}
  80. </div>
  81. </div>
  82. <div class="info-item">
  83. <div class="item-label">离开时间</div>
  84. <div class="item-value">
  85. {{v.departureTime? dayjs(v.departureTime).format('YYYY-MM-DD HH:mm') : '暂无'}}
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. </van-cell>
  91. </card>
  92. <!-- <card v-else v-for="(v,i) in dataList" :key="v.id">-->
  93. <!-- <van-cell-->
  94. <!-- :title-style="{color:'#008cd6'}"-->
  95. <!-- :title="`介绍信类型: ${getDictLabel(v.type,'out_in_type')}`"-->
  96. <!-- @click="clickItem(v.id)">-->
  97. <!-- <template #right-icon>-->
  98. <!-- <van-button v-if="!v.departureTime" type="info" size="mini">登记离开时间</van-button>-->
  99. <!-- <van-button v-else type="info" size="mini">查看登记详情</van-button>-->
  100. <!-- </template>-->
  101. <!-- <template #label>-->
  102. <!-- <div class="info-box">-->
  103. <!-- <div class="info-item">-->
  104. <!-- <div class="item-label">人员姓名:</div>-->
  105. <!-- <div class="item-value"> {{v.userName}}</div>-->
  106. <!-- </div>-->
  107. <!--&lt;!&ndash; <div class="info-item">&ndash;&gt;-->
  108. <!--&lt;!&ndash; <div class="item-label">证件号码:</div>&ndash;&gt;-->
  109. <!--&lt;!&ndash; <div class="item-value">{{v.idCard}}</div>&ndash;&gt;-->
  110. <!--&lt;!&ndash; </div>&ndash;&gt;-->
  111. <!-- <div class="info-item">-->
  112. <!-- <div class="item-label">到达时间:</div>-->
  113. <!-- <div class="item-value">-->
  114. <!-- {{ dayjs(v.arrivalTime).format('YYYY-MM-DD HH:mm')}}-->
  115. <!-- </div>-->
  116. <!-- </div>-->
  117. <!-- <div class="info-item">-->
  118. <!-- <div class="item-label">离开时间:</div>-->
  119. <!-- <div class="item-value">-->
  120. <!-- {{v.departureTime? dayjs(v.departureTime).format('YYYY-MM-DD HH:mm') : '暂无'}}-->
  121. <!-- </div>-->
  122. <!-- </div>-->
  123. <!--&lt;!&ndash; <div class="info-item">&ndash;&gt;-->
  124. <!--&lt;!&ndash; <div class="item-label">出入事由:</div>&ndash;&gt;-->
  125. <!--&lt;!&ndash; <div class="item-value">&ndash;&gt;-->
  126. <!--&lt;!&ndash; {{v.reasons}}&ndash;&gt;-->
  127. <!--&lt;!&ndash; </div>&ndash;&gt;-->
  128. <!--&lt;!&ndash; </div>&ndash;&gt;-->
  129. <!-- </div>-->
  130. <!-- </template>-->
  131. <!-- </van-cell>-->
  132. <!-- </card>-->
  133. </Scroll>
  134. </div>
  135. </div>
  136. <!-- <drag-button @btnClick="clickAdd"></drag-button> -->
  137. </div>
  138. </template>
  139. <script>
  140. import NavBar from '@/components/NavBar/index.vue'
  141. import OrgTree from '@/components/orgTree/index.vue'
  142. import Scroll from '@/components/scroll/scroll.vue'
  143. import Card from '@/components/card/index.vue'
  144. import dateCell from '@/components/dateCell/index.vue'
  145. import selectCell from '@/components/selectCell/index.vue'
  146. import {dataList,deleteUserRegister} from './api'
  147. import {mapGetters} from "vuex";
  148. import {formatDate} from "@/filters/filter";
  149. import DragButton from "@/components/DragButton/index.vue";
  150. import dayjs from "dayjs";
  151. export default {
  152. name: 'visitRecord',
  153. components: {
  154. DragButton,
  155. NavBar,
  156. OrgTree,
  157. Scroll,
  158. Card,
  159. dateCell,
  160. selectCell,
  161. },
  162. data() {
  163. return {
  164. query:{
  165. arrivalTime:null,
  166. userName:null,
  167. pageSize:10,
  168. pageNum:1,
  169. },
  170. dataList:[],
  171. pullup:false,
  172. dicts:['out_in_type','out_in_approve_status']
  173. }
  174. },
  175. beforeRouteEnter(to,from,next){
  176. next(vm=>{
  177. if(to.params.event === 'refresh'){
  178. vm.refreshData();
  179. }
  180. })
  181. },
  182. mounted() {
  183. this.initData();
  184. },
  185. computed:{
  186. ...mapGetters(['orgId','id','dictionary']),
  187. },
  188. methods: {
  189. dayjs,
  190. getState(state){
  191. switch (state){
  192. case '待审批':
  193. return '#008cd6';
  194. case '不同意':
  195. return '#bc9f71';
  196. case '同意':
  197. return '#009240';
  198. case '已失效':
  199. return '#D7000F';
  200. }
  201. },
  202. clickAdd(){
  203. this.$router.push({
  204. path:'/visitUserRecord',
  205. });
  206. },
  207. refreshData(){
  208. this.pullup = true;
  209. this.query.pageNum = 1;
  210. this.total = 0;
  211. this.dataList = [];
  212. this.getDataList();
  213. },
  214. //初始化数据
  215. initData(){
  216. this.getDataList();
  217. },
  218. //获取数据列表
  219. getDataList(){
  220. if( this.dataList.length !== 0 && this.dataList.length >= this.total) {
  221. this.pullup = false;
  222. this.$toast('已加载完毕');
  223. return;
  224. }
  225. let data = {
  226. ...this.query,
  227. orgId:this.orgId
  228. }
  229. dataList(data).then(res=>{
  230. if(res.total === '0'){
  231. this.pullup = false;
  232. this.$toast('已加载完毕');
  233. return
  234. }
  235. this.total = res.total;
  236. if(this.dataList.length < res.total) {
  237. this.dataList = [...this.dataList,...res.rows] ;
  238. this.pullup = true;
  239. this.query.pageNum++;
  240. this.$refs.Scroll.refresh();
  241. }
  242. })
  243. },
  244. clickItem(id){
  245. this.$router.push({
  246. path:'/visitRecordDetail',
  247. query:{id}
  248. });
  249. },
  250. cancelOutInRequest(id)
  251. {
  252. // let data = {
  253. // id:this.selectedUser.id,
  254. // accompanyingPerson:this.selectedUser.accompanyingPerson?this.selectedUser.accompanyingPerson:accompanyingPerson,
  255. // arrivalTime: this.selectedUser.arrivalTime ? this.selectedUser.arrivalTime:arrivalTime,
  256. // departureTime,
  257. // }
  258. //alert(JSON.stringify(data))
  259. let ids=[id];
  260. deleteUserRegister(ids).then(res=>{
  261. this.$toast.success('提交成功');
  262. this.refreshData();
  263. })
  264. }
  265. }
  266. }
  267. </script>
  268. <style lang="scss">
  269. .visitRecord{
  270. .card {
  271. >.van-cell{
  272. padding: 0;
  273. }
  274. }
  275. .van-cell-group{
  276. margin-bottom: 20px;
  277. }
  278. .van-cell-group:last-child{
  279. margin-bottom: 0;
  280. }
  281. .vue-table-root{
  282. tr,td,th{
  283. font-size: 25px!important;
  284. color:#666!important;
  285. }
  286. }
  287. }
  288. </style>
  289. <style lang="scss" scoped>
  290. .problem-item{
  291. }
  292. .app-container{
  293. }
  294. .card-list{
  295. padding:0 20px 20px 20px;
  296. height: calc(100vh - 426px);
  297. overflow: auto;
  298. }
  299. .item-title{
  300. border-bottom: 1px solid #f5f5f5;
  301. padding-bottom: 20px !important;
  302. }
  303. .card-num{
  304. display: flex;
  305. align-items: center;
  306. font-size: 28px;
  307. color: #009dff;
  308. }
  309. .search-flex{
  310. display: flex;
  311. align-items: center;
  312. justify-content: space-between;
  313. border-bottom: 1px solid #f5f5f5;
  314. >div{
  315. width: 50%;
  316. }
  317. }
  318. .btn-box{
  319. width: 100%;
  320. height: 100%;
  321. padding: 30px;
  322. background-color: #fff;
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. }
  327. .info-box{
  328. color:#555;
  329. padding-top: 20px;
  330. }
  331. .info-desc{
  332. padding-top: 10px;
  333. min-height: 50px;
  334. line-height: 36px;
  335. max-height: 250px;
  336. display: -webkit-box;
  337. -webkit-line-clamp: 3; /* 限制显示为3行 */
  338. -webkit-box-orient: vertical;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. >span{
  342. color:#999;
  343. }
  344. }
  345. .info-item{
  346. display: flex;
  347. justify-content: space-between;
  348. align-items: center;
  349. font-size: 26px;
  350. .item-label{
  351. flex:.25;
  352. text-align: left;
  353. color:#333;
  354. }
  355. .item-value{
  356. flex:.75;
  357. color:#666;
  358. min-height: 50px;
  359. max-height: 250px;
  360. display: -webkit-box;
  361. -webkit-line-clamp: 3; /* 限制显示为3行 */
  362. -webkit-box-orient: vertical;
  363. overflow: hidden;
  364. text-overflow: ellipsis;
  365. }
  366. }
  367. </style>