detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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="getDictLabel(selectedUser.type,'out_in_type')"></van-cell>
  13. <van-cell title="来访事由" :value="selectedUser.reasons"></van-cell>
  14. <van-cell title="来访单位" :value="selectedUser.companyName"></van-cell>
  15. <van-cell title="来访人员" :value="selectedUser.userName"></van-cell>
  16. <van-cell title="证件类型" :value="getDictLabel(selectedUser.idType,'letter_id_type')"></van-cell>
  17. <van-cell title="证件号码" :value="selectedUser.idCard"></van-cell>
  18. <div class="upload-box" v-if="selectedUser.imgFile && selectedUser.imgFile.length > 0">
  19. <span>证件图片</span>
  20. <van-cell >
  21. <div
  22. class="nfc-img van-hairline--surround"
  23. v-for="(v, i) in selectedUser.imgFile"
  24. :key="v"
  25. @click="preView(selectedUser.imgFile)">
  26. <img :src="imgUrl(v)" alt="" />
  27. </div>
  28. </van-cell>
  29. </div>
  30. <van-cell title="介绍信附件" v-if="selectedUser.letterFile && selectedUser.letterFile.length > 0">
  31. <template #right-icon>
  32. <div class="file-box">
  33. <p class="van-ellipsis" v-for="(v, i) in selectedUser.letterFile"
  34. :key="v.url"
  35. @click="previewFile(v)">{{v.name}}</p>
  36. </div>
  37. </template>
  38. </van-cell>
  39. <div class="upload-box" v-if="selectedUser.checkImage && selectedUser.checkImage.length > 0">
  40. <span>核验结果</span>
  41. <van-cell >
  42. <div
  43. class="nfc-img van-hairline--surround"
  44. v-for="(v, i) in selectedUser.checkImage"
  45. :key="v"
  46. @click="preView(selectedUser.checkImage)">
  47. <img :src="imgUrl(v)" alt="" />
  48. </div>
  49. </van-cell>
  50. </div>
  51. <van-cell title="陪同人员" :value="selectedUser.accompanyingPerson"></van-cell>
  52. <van-cell title="到达时间" v-if="selectedUser.arrivalTime" :value="selectedUser.arrivalTime"></van-cell>
  53. <date-cell v-else required title="到达时间" :max-date="maxData" :is-row="true" v-model="formData.arrivalTime" date-type="datetime" />
  54. <van-cell title="离开时间" v-if="selectedUser.departureTime" :value="selectedUser.departureTime"></van-cell>
  55. <date-cell v-else required title="离开时间" :max-date="maxData" :min-date='minDate' :is-row="true" v-model="formData.departureTime" date-type="datetime" />
  56. </div>
  57. <div v-if="!selectedUser.departureTime" class="big-btn-box" >
  58. <van-button type="info" size="large" @click="onSubmit">确认登记</van-button>
  59. </div>
  60. </van-panel>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import DateCell from "@/components/dateCell/index.vue";
  67. import Uploader from "@/components/upload/gxuploader.vue";
  68. import {formatDate} from "@/filters/filter";
  69. import {mapGetters} from "vuex";
  70. import {imgUrl} from "@/utils";
  71. import { ImagePreview } from 'vant'
  72. import {userDetails, userDepart} from './api'
  73. import dayjs from 'dayjs'
  74. export default {
  75. components: {Uploader, DateCell},
  76. data(){
  77. return {
  78. maxData:new Date(),
  79. minDate:null,
  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','letter_id_type']
  92. }
  93. },
  94. computed:{
  95. ...mapGetters(['orgId','id','dictionary']),
  96. },
  97. created(){
  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. let minDate = this.selectedUser.arrivalTime;
  140. this.minDate = new Date(minDate);
  141. })
  142. },
  143. previewFile(file){
  144. this.openFilePreview(file);
  145. },
  146. preView(val) {
  147. if(Array.isArray(val)){
  148. let arr = val.map(v=>{
  149. return imgUrl(v);
  150. })
  151. ImagePreview(arr);
  152. }else {
  153. ImagePreview([imgUrl(val)]);
  154. }
  155. },
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. .record-detail{
  161. .van-card{
  162. padding: 20px;
  163. }
  164. .card-cell-box{
  165. width: 70%;
  166. .van-cell{
  167. padding: 10px;
  168. &::after{
  169. left:10px;
  170. right:10px;
  171. }
  172. }
  173. .van-cell__title{
  174. flex:.25;
  175. }
  176. .van-cell__value{
  177. flex:.75;
  178. }
  179. }
  180. }
  181. </style>
  182. <style scoped lang="scss">
  183. .record-detail{
  184. height: 100%;
  185. overflow: hidden;
  186. }
  187. .page-container{
  188. height: calc(100vh - 94px);
  189. overflow: auto;
  190. padding: 20px;
  191. }
  192. .flex-box{
  193. display: flex;
  194. justify-content: space-between;
  195. align-items: center;
  196. >span{
  197. margin: 0 20px;
  198. }
  199. }
  200. .card{
  201. margin-bottom: 20px;
  202. box-shadow: 0 10px 10px #eaeaea;
  203. }
  204. .card:last-child{
  205. margin-bottom: 0;
  206. }
  207. .panel-box{
  208. -padding:0 20px;
  209. }
  210. .panel-box-item{
  211. height: 36px;
  212. line-height: 36px;
  213. }
  214. .item-label{
  215. width: 100%;
  216. display: flex;
  217. justify-content: right;
  218. align-items: center;
  219. }
  220. .item-value{
  221. width: 100%;
  222. display: flex;
  223. justify-content: left;
  224. align-items: center;
  225. }
  226. .upload-box{
  227. padding: 20px 30px;
  228. display: flex;
  229. >span{
  230. display: inline-block;
  231. height: 160px;
  232. width: 200px;
  233. line-height: 160px;
  234. font-size: 28px;
  235. color:#999;
  236. >i{
  237. font-style: normal;
  238. color: #ee0a24;
  239. }
  240. }
  241. .required::before{
  242. content: '*';
  243. color: #ee0a24;
  244. position: absolute;
  245. left: 14px;
  246. }
  247. }
  248. .goods-card{
  249. width: 100%;
  250. display: flex;
  251. align-items: center;
  252. padding: 10px;
  253. background-color: #fff;
  254. .card-img-box{
  255. width: 200px;
  256. height: 200px;
  257. margin-right: 10px;
  258. >img{
  259. width: 100%;
  260. height: 100%;
  261. object-fit: cover;
  262. border-radius: 10px;
  263. }
  264. }
  265. }
  266. .big-btn-box{
  267. padding: 20px;
  268. }
  269. .file-box{
  270. width: 70%;
  271. display: flex;
  272. justify-content: flex-end;
  273. color:#008cd6;
  274. }
  275. .nfc-img {
  276. display: inline-block;
  277. width: 140px;
  278. height: 140px;
  279. margin: 0 10px;
  280. position: relative;
  281. > img {
  282. width: 100%;
  283. height: 100%;
  284. border: none;
  285. }
  286. > span {
  287. position: absolute;
  288. padding: 0 10px;
  289. bottom: 0;
  290. left: 0;
  291. display: block;
  292. width: 100%;
  293. background-color: rgba(0, 0, 0, 0.2);
  294. color: #eaeaea;
  295. font-size: 20px;
  296. overflow: hidden;
  297. text-overflow: ellipsis;
  298. white-space: nowrap;
  299. line-height: 30px;
  300. height: 30px;
  301. }
  302. }
  303. </style>