From 87f07e589fb1c8103513a5fcc8febe3b14f5535f Mon Sep 17 00:00:00 2001 From: 石广澎 <shiguangpeng@163.com> Date: 星期五, 01 十二月 2023 17:30:46 +0800 Subject: [PATCH] feat: 1、图片预览使用半路径 2、部门物品退回详情 --- admin-web/src/views/stock/transfer/transferApplication/detail.vue | 170 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 111 insertions(+), 59 deletions(-) diff --git a/admin-web/src/views/stock/transfer/transferApplication/detail.vue b/admin-web/src/views/stock/transfer/transferApplication/detail.vue index f126f45..ee6005a 100644 --- a/admin-web/src/views/stock/transfer/transferApplication/detail.vue +++ b/admin-web/src/views/stock/transfer/transferApplication/detail.vue @@ -1,63 +1,51 @@ <template> - <el-dialog - title="璇︽儏" - width="60%" - :modal="true" - :visible.sync="visible" - :top="'15vh'" - :close-on-click-modal="false" - :append-to-body="true" - :destroy-on-close="true" - @close="close" - class="stock-detail" - > + <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'" :loading="loading"> + <el-row :gutter="20"> <el-col :span="8"> <span>璋冩嫧鍗曞彿锛�</span> <span>{{ detail.businessFormCode }}</span> </el-col> <el-col :span="8"> - <span>璋冩嫧浠撳簱锛�</span> - <span>{{ detail.warehouseName }}</span> + <span>璋冩嫧鏈烘瀯锛�</span> + <span>{{ detail.outAgencyName }}</span> </el-col> <el-col :span="8"> - <span>鎵�灞炴満鏋勶細</span> - <span>{{ detail.agencyId }}</span> + <span>鎺ユ敹鏈烘瀯锛�</span> + <span>{{ detail.inAgencyName }}</span> </el-col> </el-row> <el-row :gutter="20" style="margin-top: 20px"> <el-col :span="8"> - <span>鐘舵�侊細</span> - <span>{{ detail.states == 1 ? '寰呰皟鎷�' : '宸茶皟鎷�' }}</span> + <span>鐢宠璋冩嫧鏃堕棿锛�</span> + <span>{{ detail.createTime | formatTime }}</span> </el-col> <el-col :span="8"> - <span>鍒涘缓浜猴細</span> - <span>{{ detail.buyerName }}</span> + <span>鐘舵�侊細</span> + <span>{{ getStatesLabel(detail.states) }}</span> </el-col> <el-col :span="8"> <span>璋冩嫧鏃堕棿锛�</span> - <span>{{ detail.incomeTime | formatTime }}</span> + <span>{{ detail.outputTime | formatTime }}</span> </el-col> </el-row> - <el-row :gutter="20" style="margin-top: 20px"> + <el-row v-if="fileList && fileList.length" :gutter="20" style="margin-top: 20px"> <el-col class="img-row" :span="24"> <span>璋冩嫧鎵嬬画鐓х墖锛�</span> - <div class="img-box"></div> + <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)"> + <img class="img" :src="getUrl(item.path)" alt=""/> + </div> </el-col> </el-row> - <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.procureGoods" :key="goodsIndex"> + <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.formTransferGoods" :key="goodsIndex"> <el-row :gutter="20"> - <el-col :span="8"> + <el-col :span="12"> <span>鐗╁搧鍒嗙被锛�</span> - <span>{{ goodsItem.baseCategoryId }}</span> + <span>{{ goodsItem.categoryName }}</span> </el-col> - <el-col :span="8"> + <el-col :span="12"> <span>鐗╁搧鍚嶇О锛�</span> - <span>{{ goodsItem.goodsTemplateName }}</span> - </el-col> - <el-col :span="8"> - <span>渚涜揣鍟嗭細</span> - <span>{{ goodsItem.supplier }}</span> + <span>{{ goodsItem.goodsName }}</span> </el-col> </el-row> <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px"> @@ -71,54 +59,118 @@ {{ scope.row.unit }} </template> </el-table-column> - <el-table-column prop="price" label="鐜版湁搴撳瓨" align="center"> - <template slot-scope="scope"> - {{ scope.row.price }} - </template> - </el-table-column> <el-table-column prop="counts" label="璋冩嫧鏁伴噺" align="center"> <template slot-scope="scope"> {{ scope.row.counts }} </template> </el-table-column> + <el-table-column prop="price" label="閲戦" align="center"> + <template slot-scope="scope"> + {{ scope.row.price }} + </template> + </el-table-column> </el-table> </div> - </el-dialog> + + <div id="uploadPreviewImages" style="display: none"> + <span v-for="(src, index) in fileList" :key="index"> + <img + v-if="checkImg(src.name)" + class="v-img" + :src="getUrl(src.path)" + :alt="src.name" + style="width: 100px; height: 100px" + /> + </span> + </div> + </win-md> </template> <script> -import { procureDetail } from '@/api/stock/procure/purchaseOrder'; +import {transferDetail} from '@/api/stock/transfer'; import * as DateFormatter from '@/utils/DateFormatter'; +import winMd from '@/components/win/win-md'; +import transfer from '../../../mixins/transfer'; +import {getDownUrl} from "@/utils/base"; +import Viewer from 'viewerjs'; +import 'viewerjs/dist/viewer.css'; + +let viewer = null; + export default { + mixins: [transfer], + components: {winMd}, + props: { + setting: { + type: Object, + default: () => { + }, + }, + }, data() { return { - visible: false, - detail: { - businessFormCode: '', - goodsTemplateName: '', - agencyId: '', - states: '', - createName: '', - time: '', - procureGoods: [{}, {}], - }, + loading: true, + detail: {}, + fileList: [] }; }, - filters:{ + filters: { formatTime(time) { - if(!time) return - return DateFormatter.LongToDateTime(time) - } + if (!time) return '-'; + return DateFormatter.LongToDateTime(time); + }, + }, + created() { + transferDetail({id: this.setting.id}).then((res) => { + this.detail = res; + this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : []; + this.loading = false; + this.$nextTick(() => { + this.initPreviewImg(); + }); + }); }, methods: { - open(id) { - this.visible = true; - procureDetail({ id }).then((res) => { - this.detail = res; - }); + initPreviewImg() { + if (viewer != null) { + viewer.destroy(); + } + const ViewerDom = document.querySelector('#uploadPreviewImages'); + viewer = new Viewer(ViewerDom, {}); + }, + handlePreview(file) { + if (!this.checkImg(file.name)) { + return false; + } + let index = 0; + for (let i = 0; i < this.fileList.length; i++) { + const f = this.fileList[i]; + if (this.checkImg(f.name)) { + if (file.id == f.id) { + break; + } + index++; + } + } + viewer.view(index); + }, + checkImg(name) { + const suffix = name.substring(name.lastIndexOf('.'), name.length); + const imgArray = ['.jpg', '.jpeg', '.png', '.bmp']; + if (imgArray.indexOf(suffix) < 0) { + return false; + } + return true; + }, + getUrl(path) { + if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') { + return path; + } else { + return getDownUrl() + path; + } }, close() { - this.visible = false; + this.$emit('close'); }, }, }; -- Gitblit v1.9.1