index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="visitCheck">
  3. <NavBar />
  4. <div class="page-container">
  5. <van-search v-model="query.reasons" 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. <select-cell
  16. style="border-right: 1px solid #f5f5f5;"
  17. title="审批状态"
  18. :isAll="true"
  19. :border="false"
  20. v-model="query.approveStatus"
  21. :data-list="getDictItem('out_in_approve_status')"
  22. @change="refreshData"/>
  23. </div>
  24. <div class="card-list">
  25. <Scroll
  26. ref="Scroll"
  27. @refresh="refreshData"
  28. @loadMore="getDataList"
  29. :pullup="pullup">
  30. <empty v-if="!dataList || dataList.length === 0" />
  31. <card v-else v-for="(v,i) in dataList" :key="v.id">
  32. <van-cell
  33. :title-style="{color:v.type == 3?'#D7000F':''}"
  34. :title="getDictLabel(v.type,'out_in_type')"
  35. @click="clickItem(v.id)">
  36. <template #extra>
  37. <span :style="{color:getState(getDictLabel(v.approveStatus,'out_in_approve_status'))}">
  38. {{getDictLabel(v.approveStatus,'out_in_approve_status') }}
  39. </span>
  40. </template>
  41. <template #label>
  42. <div class="info-box">
  43. <div v-if="v.type == 2" class="info-item">
  44. <div class="item-label">介绍信编号:</div>
  45. <div class="item-value"> {{v.letterNo}}</div>
  46. </div>
  47. <div class="info-item">
  48. <div class="item-label">有效期:</div>
  49. <div class="item-value">{{v.startTime}}~{{v.endTime}}</div>
  50. </div>
  51. <div class="info-item">
  52. <div class="item-label">来访事由:</div>
  53. <div class="item-value">
  54. {{v.reasons}}
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. </van-cell>
  60. </card>
  61. </Scroll>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import NavBar from '@/components/NavBar'
  68. import OrgTree from '@/components/orgTree'
  69. import Scroll from '@/components/scroll/scroll'
  70. import Card from '@/components/card'
  71. import dateCell from '@/components/dateCell'
  72. import selectCell from '@/components/selectCell'
  73. import {dataList} from './api'
  74. import {mapGetters} from "vuex";
  75. import {formatDate} from "@/filters/filter";
  76. export default {
  77. components: {
  78. NavBar,
  79. OrgTree,
  80. Scroll,
  81. Card,
  82. dateCell,
  83. selectCell,
  84. },
  85. data() {
  86. return {
  87. query:{
  88. reasons:'',
  89. approveStatus:null,
  90. type:null,
  91. pageSize:10,
  92. pageNum:1,
  93. },
  94. dataList:[],
  95. pullup:false,
  96. dicts:['out_in_approve_status','out_in_type']
  97. }
  98. },
  99. mounted() {
  100. this.initData();
  101. },
  102. computed:{
  103. ...mapGetters(['orgId','id','dictionary']),
  104. },
  105. methods: {
  106. getState(state){
  107. switch (state){
  108. case '待审批':
  109. return '#008cd6';
  110. case '不同意':
  111. return '#bc9f71';
  112. case '同意':
  113. return '#009240';
  114. case '已逾期':
  115. return '#D7000F';
  116. }
  117. },
  118. clickAdd(){
  119. this.$router.push({
  120. path:'/introAdd',
  121. query:{type:'add'}
  122. });
  123. },
  124. refreshData(){
  125. this.pullup = true;
  126. this.query.pageNum = 1;
  127. this.total = 0;
  128. this.dataList = [];
  129. this.getDataList();
  130. },
  131. //初始化数据
  132. initData(){
  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:'/visitCheckDetail',
  164. query:{id}
  165. });
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .visitCheck{
  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>