detail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="record-detail">
  3. <nav-bar></nav-bar>
  4. <div class="page-container">
  5. <!-- 基本信息 -->
  6. <div class="card">
  7. <van-panel >
  8. <template #header>
  9. <span></span>
  10. </template>
  11. <div class="panel-box">
  12. <van-cell title="出入人员" :value="selectedUser.userName"></van-cell>
  13. <van-cell title="证件号码" :value="selectedUser.idCard"></van-cell>
  14. <div class="upload-box" v-if="selectedUser.imgFile && selectedUser.imgFile.length > 0">
  15. <span>证件照</span>
  16. <van-cell >
  17. <div
  18. class="nfc-img van-hairline--surround"
  19. v-for="(v, i) in selectedUser.imgFile"
  20. :key="v"
  21. @click="preView(selectedUser.imgFile)">
  22. <img :src="imgUrl(v)" alt="" />
  23. </div>
  24. </van-cell>
  25. </div>
  26. <van-cell title="单位" :value="selectedUser.companyName"></van-cell>
  27. <van-cell title="出入事由" :value="selectedUser.reasons"></van-cell>
  28. <div class="upload-box" v-if="selectedUser.letterFile && selectedUser.letterFile.length > 0">
  29. <span>介绍信</span>
  30. <van-cell >
  31. <div
  32. class="nfc-img van-hairline--surround"
  33. v-for="(v, i) in selectedUser.letterFile"
  34. :key="v.url"
  35. @click="preView(v.imgPath)">
  36. <img :src="imgUrl(v.imgPath)" alt="" />
  37. </div>
  38. </van-cell>
  39. </div>
  40. <van-cell title="出入类型" :value="getDictLabel(selectedUser.type,'out_in_type')"></van-cell>
  41. <van-cell title="陪同人员" :value="selectedUser.accompanyingPerson"></van-cell>
  42. <div class="upload-box" v-if="selectedUser.checkImage && selectedUser.checkImage.length > 0">
  43. <span>核验结果</span>
  44. <van-cell >
  45. <div
  46. class="nfc-img van-hairline--surround"
  47. v-for="(v, i) in selectedUser.checkImage"
  48. :key="v"
  49. @click="preView(selectedUser.checkImage)">
  50. <img :src="imgUrl(v)" alt="" />
  51. </div>
  52. </van-cell>
  53. </div>
  54. <van-cell title="到达时间" v-if="selectedUser.arrivalTime" :value="selectedUser.arrivalTime"></van-cell>
  55. <date-cell v-else required title="到达时间" :max-date="maxData" :is-row="true" v-model="formData.arrivalTime" date-type="datetime" />
  56. <van-cell title="离开时间" v-if="selectedUser.departureTime" :value="selectedUser.departureTime"></van-cell>
  57. <date-cell v-else required title="离开时间" :max-date="maxData" :is-row="true" v-model="formData.departureTime" date-type="datetime" />
  58. </div>
  59. <div v-if="!selectedUser.departureTime" class="big-btn-box" >
  60. <van-button type="info" size="large" @click="onSubmit">确认登记</van-button>
  61. </div>
  62. </van-panel>
  63. </div>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import DateCell from "@/components/dateCell/index.vue";
  69. import Uploader from "@/components/upload/gxuploader.vue";
  70. import {formatDate} from "@/filters/filter";
  71. import {mapGetters} from "vuex";
  72. import {imgUrl} from "@/utils";
  73. import { ImagePreview } from 'vant'
  74. import {userDetails, userDepart} from './api'
  75. export default {
  76. components: {Uploader, DateCell},
  77. data(){
  78. return {
  79. maxData:new Date(),
  80. visitId:null,
  81. userList:[],
  82. selectedUser:{},
  83. prop:{
  84. label:'userName',
  85. value:'id'
  86. },
  87. formData:{
  88. arrivalTime:null,
  89. departureTime:null,
  90. },
  91. dicts:['out_in_approve_status','out_in_type']
  92. }
  93. },
  94. computed:{
  95. ...mapGetters(['orgId','id','dictionary'])
  96. },
  97. mounted(){
  98. this.visitId = this.$route.query.id;
  99. this.getUserInfo();
  100. },
  101. methods:{
  102. imgUrl,formatDate,
  103. onSubmit(){
  104. let {departureTime} = this.formData;
  105. if(!departureTime){
  106. this.$toast('请选择离开时间');
  107. return
  108. }
  109. let data = {
  110. id:this.selectedUser.id,
  111. arrivalTime:this.selectedUser.arrivalTime,
  112. departureTime,
  113. }
  114. //alert(JSON.stringify(data))
  115. userDepart(data).then(res=>{
  116. this.$toast.success('提交成功');
  117. this.$router.replace({
  118. name:'visitRecord',
  119. path:'/visitRecord',
  120. params:{event:'refresh'},
  121. });
  122. })
  123. },
  124. getUserInfo(){
  125. userDetails(this.visitId).then(res=>{
  126. let checkImage = res.data.checkImage.split(',');
  127. let imgFile = res.data.imgFile.split(',');
  128. let letterFile = [];
  129. if(res.data.letterFile && res.data.letterFile.length > 0){
  130. letterFile = res.data.letterFile.map(v=>{
  131. return JSON.parse(v)
  132. })
  133. }
  134. this.selectedUser = res.data;
  135. this.selectedUser.checkImage = checkImage;
  136. this.selectedUser.imgFile = imgFile;
  137. this.selectedUser.letterFile = letterFile;
  138. })
  139. },
  140. preView(val) {
  141. if(Array.isArray(val)){
  142. let arr = val.map(v=>{
  143. return imgUrl(v);
  144. })
  145. ImagePreview(arr);
  146. }else {
  147. ImagePreview([imgUrl(val)]);
  148. }
  149. },
  150. }
  151. }
  152. </script>
  153. <style lang="scss">
  154. .record-detail{
  155. .van-card{
  156. padding: 20px;
  157. }
  158. .card-cell-box{
  159. width: 70%;
  160. .van-cell{
  161. padding: 10px;
  162. &::after{
  163. left:10px;
  164. right:10px;
  165. }
  166. }
  167. .van-cell__title{
  168. flex:.25;
  169. }
  170. .van-cell__value{
  171. flex:.75;
  172. }
  173. }
  174. }
  175. </style>
  176. <style scoped lang="scss">
  177. .record-detail{
  178. height: 100%;
  179. overflow: hidden;
  180. }
  181. .page-container{
  182. height: calc(100vh - 94px);
  183. overflow: auto;
  184. padding: 20px;
  185. }
  186. .flex-box{
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: center;
  190. >span{
  191. margin: 0 20px;
  192. }
  193. }
  194. .card{
  195. margin-bottom: 20px;
  196. box-shadow: 0 10px 10px #eaeaea;
  197. }
  198. .card:last-child{
  199. margin-bottom: 0;
  200. }
  201. .panel-box{
  202. -padding:0 20px;
  203. }
  204. .panel-box-item{
  205. height: 36px;
  206. line-height: 36px;
  207. }
  208. .item-label{
  209. width: 100%;
  210. display: flex;
  211. justify-content: right;
  212. align-items: center;
  213. }
  214. .item-value{
  215. width: 100%;
  216. display: flex;
  217. justify-content: left;
  218. align-items: center;
  219. }
  220. .upload-box{
  221. padding: 20px 30px;
  222. display: flex;
  223. >span{
  224. display: inline-block;
  225. height: 160px;
  226. width: 200px;
  227. line-height: 160px;
  228. font-size: 28px;
  229. color:#999;
  230. >i{
  231. font-style: normal;
  232. color: #ee0a24;
  233. }
  234. }
  235. .required::before{
  236. content: '*';
  237. color: #ee0a24;
  238. position: absolute;
  239. left: 14px;
  240. }
  241. }
  242. .goods-card{
  243. width: 100%;
  244. display: flex;
  245. align-items: center;
  246. padding: 10px;
  247. background-color: #fff;
  248. .card-img-box{
  249. width: 200px;
  250. height: 200px;
  251. margin-right: 10px;
  252. >img{
  253. width: 100%;
  254. height: 100%;
  255. object-fit: cover;
  256. border-radius: 10px;
  257. }
  258. }
  259. }
  260. .big-btn-box{
  261. padding: 20px;
  262. }
  263. .nfc-img {
  264. display: inline-block;
  265. width: 140px;
  266. height: 140px;
  267. margin: 0 10px;
  268. position: relative;
  269. > img {
  270. width: 100%;
  271. height: 100%;
  272. border: none;
  273. }
  274. > span {
  275. position: absolute;
  276. padding: 0 10px;
  277. bottom: 0;
  278. left: 0;
  279. display: block;
  280. width: 100%;
  281. background-color: rgba(0, 0, 0, 0.2);
  282. color: #eaeaea;
  283. font-size: 20px;
  284. overflow: hidden;
  285. text-overflow: ellipsis;
  286. white-space: nowrap;
  287. line-height: 30px;
  288. height: 30px;
  289. }
  290. }
  291. </style>