detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div class="intro-add">
  3. <nav-bar></nav-bar>
  4. <div class="page-container">
  5. <!-- 基本信息 -->
  6. <div class="card">
  7. <van-panel title="来访信息" >
  8. <template #header>
  9. <van-cell title="审批情况">
  10. <template #extra>
  11. <span :style="{color:getState(approveStatus)}">
  12. {{getDictLabel(approveStatus,'out_in_approve_status') }}
  13. </span>
  14. </template>
  15. </van-cell>
  16. </template>
  17. <div class="panel-box">
  18. <van-cell title="来访类型" :value="getDictLabel(visitInfo.type,'out_in_type')"></van-cell>
  19. <van-cell title="来访事由" :value="visitInfo.reasons"></van-cell>
  20. <van-cell title="介绍信编号" v-if="visitInfo.letterNo" :value="visitInfo.letterNo"></van-cell>
  21. <van-cell title="开具日期" v-if="visitInfo.startTimeStr" :value="visitInfo.startTimeStr"></van-cell>
  22. <van-cell title="有效天数" v-if="visitInfo.effectiveDays" :value="`${visitInfo.effectiveDays}天`"></van-cell>
  23. <van-cell title="介绍信附件" v-if="visitInfo.letterFile && visitInfo.letterFile.length > 0">
  24. <template #right-icon>
  25. <div class="file-box">
  26. <p class="van-ellipsis" v-for="(v, i) in visitInfo.letterFile"
  27. :key="v.url"
  28. @click="previewFile(v)">{{v.name}}</p>
  29. </div>
  30. </template>
  31. </van-cell>
  32. <van-cell v-if="visitInfo.description" title="备注信息" :value="visitInfo.description"></van-cell>
  33. </div>
  34. </van-panel>
  35. </div>
  36. <!-- 人员列表 -->
  37. <div class="card" v-for="(v,i) in userInfos" :key="i">
  38. <div class="goods-card">
  39. <div class="card-img-box" v-if="v.imgFile && v.imgFile.length > 0" @click="preView(v.imgFile)">
  40. <img :src="imgUrl(v.imgFile[0])" alt="">
  41. </div>
  42. <div class="card-cell-box">
  43. <van-cell title="来访单位" :value="v.companyName"></van-cell>
  44. <van-cell title="来访人员" :value="v.userName"></van-cell>
  45. <van-cell title="证件类型" :value="getDictLabel(v.idType,'letter_id_type')"></van-cell>
  46. <van-cell title="证件号码" :value="v.idCard"></van-cell>
  47. </div>
  48. </div>
  49. </div>
  50. <div v-show="showInput" class="input-box">
  51. <van-field
  52. v-model="formData.description"
  53. rows="1"
  54. autosize
  55. :maxlength="200"
  56. label="审批说明"
  57. type="textarea"
  58. placeholder="请输入"/>
  59. </div>
  60. <div v-if="approveRemark" class="input-box">
  61. <van-cell title="审批说明" :value="approveRemark"></van-cell>
  62. </div>
  63. <div v-if="approveStatus == 0 && visitInfo.status == 1" class="flex-box">
  64. <van-button type="info" style="width: 48%" plain @click="refuse">不同意</van-button>
  65. <van-button type="info" style="width: 48%" @click="accredit">同意</van-button>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import DateCell from "@/components/dateCell/index.vue";
  72. import Uploader from "@/components/upload/gxuploader.vue";
  73. import {formatDate} from "@/filters/filter";
  74. import {mapGetters} from "vuex";
  75. import {imgUrl} from "@/utils";
  76. import { ImagePreview } from 'vant'
  77. import {visitDetails,visitCheck} from './api'
  78. export default {
  79. components: {Uploader, DateCell},
  80. data(){
  81. return {
  82. go:{
  83. type:'replace', //参数:go push replace
  84. path:'/visitCheck',
  85. },
  86. visitId:null,
  87. approveStatus:null,
  88. approveRemark:null,
  89. activeNames:['1'],
  90. visitInfo: {},
  91. userInfos:[],
  92. formData:{},
  93. showInput:false,
  94. dicts:['out_in_approve_status','out_in_type','letter_id_type']
  95. }
  96. },
  97. computed:{
  98. ...mapGetters(['orgId','id','dictionary'])
  99. },
  100. mounted(){
  101. this.visitId = this.$route.query.id;
  102. this.getInfo();
  103. },
  104. methods:{
  105. imgUrl,formatDate,
  106. // 拒绝
  107. refuse(){
  108. if(this.showInput){
  109. let data = {
  110. approveStatus:2,
  111. approveRemark:this.formData.description,
  112. id:this.visitInfo.approveLog.id
  113. }
  114. visitCheck(data).then(res=>{
  115. this.$toast('操作成功');
  116. this.toPagesFcn();
  117. }).catch(error=>{
  118. if( error === '任务已完成'){
  119. this.toPagesFcn();
  120. }
  121. })
  122. }
  123. this.showInput = true;
  124. },
  125. //页面跳转逻辑
  126. toPagesFcn(){
  127. this.getRouter();
  128. if(this.fromPages.name === "works"){
  129. this.$router.go(-1)
  130. }else {
  131. this.$router.replace({
  132. name:'visitCheck',
  133. path:'/visitCheck',
  134. params:{event:'refresh'}
  135. });
  136. }
  137. },
  138. // 同意
  139. accredit(){
  140. let data = {
  141. approveStatus:1,
  142. id:this.visitInfo.approveLog.id
  143. }
  144. visitCheck(data).then(res=>{
  145. this.$toast('操作成功');
  146. this.toPagesFcn();
  147. }).catch(error=>{
  148. if( error === '任务已完成'){
  149. this.toPagesFcn();
  150. }
  151. })
  152. },
  153. getState(state){
  154. switch (state){
  155. case 0:
  156. return '#008cd6';
  157. case 1:
  158. return '#009240';
  159. case 2:
  160. return '#bc9f71';
  161. case 3:
  162. return '#D7000F';
  163. }
  164. },
  165. getInfo(){
  166. visitDetails(this.visitId).then(res=>{
  167. this.visitInfo = res.data;
  168. this.approveStatus = this.visitInfo.approveLog.approveStatus;
  169. this.approveRemark = this.visitInfo.approveLog.approveRemark;
  170. if(res.data.letterFile){
  171. let imgArr = res.data.letterFile.map(v=>{
  172. return JSON.parse(v)
  173. })
  174. this.visitInfo.letterFile = imgArr;
  175. }
  176. if(res.data.userInfos){
  177. let users = res.data.userInfos.map(v=>{
  178. if(v.imgFile){
  179. v.imgFile = v.imgFile.split(',');
  180. }
  181. return v
  182. });
  183. console.log(users,'users')
  184. this.userInfos = users;
  185. }
  186. })
  187. },
  188. previewFile(file){
  189. this.openFilePreview(file);
  190. },
  191. preView(val) {
  192. if(Array.isArray(val)){
  193. let arr = val.map(v=>{
  194. return imgUrl(v);
  195. })
  196. ImagePreview(arr);
  197. }else {
  198. ImagePreview([imgUrl(val)]);
  199. }
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. .intro-add{
  206. .van-card{
  207. padding: 20px;
  208. }
  209. .card-cell-box{
  210. width: 70%;
  211. .van-cell{
  212. padding: 4px;
  213. &::after{
  214. left:10px;
  215. right:10px;
  216. }
  217. }
  218. .van-cell__title{
  219. flex:.25;
  220. }
  221. .van-cell__value{
  222. flex:.75;
  223. }
  224. }
  225. }
  226. </style>
  227. <style scoped lang="scss">
  228. .intro-add{
  229. height: 100%;
  230. overflow: hidden;
  231. }
  232. .page-container{
  233. height: calc(100vh - 94px);
  234. overflow: auto;
  235. padding: 20px;
  236. }
  237. .flex-box{
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. >span{
  242. margin: 0 20px;
  243. }
  244. }
  245. .card{
  246. margin-bottom: 20px;
  247. box-shadow: 0 10px 10px #eaeaea;
  248. }
  249. .card:last-child{
  250. margin-bottom: 0;
  251. }
  252. .panel-box{
  253. -padding:0 20px;
  254. }
  255. .panel-box-item{
  256. height: 36px;
  257. line-height: 36px;
  258. }
  259. .item-label{
  260. width: 100%;
  261. display: flex;
  262. justify-content: right;
  263. align-items: center;
  264. }
  265. .item-value{
  266. width: 100%;
  267. display: flex;
  268. justify-content: left;
  269. align-items: center;
  270. }
  271. .upload-box{
  272. padding: 20px 30px;
  273. display: flex;
  274. >span{
  275. display: inline-block;
  276. height: 160px;
  277. width: 200px;
  278. line-height: 160px;
  279. font-size: 28px;
  280. color:#999;
  281. >i{
  282. font-style: normal;
  283. color: #ee0a24;
  284. }
  285. }
  286. }
  287. .goods-card{
  288. width: 100%;
  289. display: flex;
  290. align-items: center;
  291. padding: 10px;
  292. background-color: #fff;
  293. .card-img-box{
  294. width: 200px;
  295. height: 200px;
  296. margin-right: 10px;
  297. >img{
  298. width: 100%;
  299. height: 100%;
  300. object-fit: cover;
  301. border-radius: 10px;
  302. }
  303. }
  304. }
  305. .big-btn-box{
  306. padding-bottom: 20px;
  307. }
  308. .file-box{
  309. width: 70%;
  310. display: flex;
  311. justify-content: flex-end;
  312. color:#008cd6;
  313. }
  314. .nfc-img {
  315. display: inline-block;
  316. width: 140px;
  317. height: 140px;
  318. margin: 0 10px;
  319. position: relative;
  320. > img {
  321. width: 100%;
  322. height: 100%;
  323. border: none;
  324. }
  325. > span {
  326. position: absolute;
  327. padding: 0 10px;
  328. bottom: 0;
  329. left: 0;
  330. display: block;
  331. width: 100%;
  332. background-color: rgba(0, 0, 0, 0.2);
  333. color: #eaeaea;
  334. font-size: 20px;
  335. overflow: hidden;
  336. text-overflow: ellipsis;
  337. white-space: nowrap;
  338. line-height: 30px;
  339. height: 30px;
  340. }
  341. }
  342. .input-box{
  343. margin-bottom: 20px;
  344. }
  345. </style>