优化报废图片展示问题

This commit is contained in:
BianLzhaoMin 2024-06-17 16:18:00 +08:00
parent 782d2c645a
commit 31a70c1178
3 changed files with 101 additions and 79 deletions

View File

@ -13,48 +13,54 @@
<script> <script>
export default { export default {
name: "ImagePreview", name: 'ImagePreview',
props: { props: {
src: { src: {
type: String, type: String,
default: "" default: '',
}, },
width: { width: {
type: [Number, String], type: [Number, String],
default: "" default: '',
}, },
height: { height: {
type: [Number, String], type: [Number, String],
default: "" default: '',
} },
}, },
computed: { computed: {
realSrc() { realSrc() {
if (!this.src) { if (!this.src) {
return; return
} }
let real_src = this.src.split(",")[0]; let real_src = this.src.split(',')[0]
return real_src;
console.log(this.src, '图片地址--')
return real_src
}, },
realSrcList() { realSrcList() {
if (!this.src) { if (!this.src) {
return; return
} }
let real_src_list = this.src.split(","); let real_src_list = this.src.split(',')
let srcList = []; let srcList = []
real_src_list.forEach(item => { real_src_list.forEach((item) => {
return srcList.push(item); return srcList.push(item)
}); })
return srcList; return srcList
}, },
realWidth() { realWidth() {
return typeof this.width == "string" ? this.width : `${this.width}px`; return typeof this.width == 'string'
? this.width
: `${this.width}px`
}, },
realHeight() { realHeight() {
return typeof this.height == "string" ? this.height : `${this.height}px`; return typeof this.height == 'string'
} ? this.height
: `${this.height}px`
}, },
}; },
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -510,7 +510,7 @@
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="numList" height="500"> <el-table v-loading="loading" :data="numList">
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index" />
<el-table-column <el-table-column
label="类型名称" label="类型名称"
@ -539,7 +539,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model.number="scope.row.qualifiedNum" v-model.number="scope.row.qualifiedNum"
placeholder="请输入合格数量" placeholder="合格数量"
type="number" type="number"
:min="0" :min="0"
clearable clearable
@ -557,7 +557,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model.number="scope.row.serviceNum" v-model.number="scope.row.serviceNum"
placeholder="请输入待维修数量" placeholder="待维修数量"
type="number" type="number"
:min="0" :min="0"
clearable clearable
@ -574,7 +574,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model.number="scope.row.scrapNum" v-model.number="scope.row.scrapNum"
placeholder="请输入待报废数量" placeholder="待报废数量"
type="number" type="number"
:min="0" :min="0"
clearable clearable
@ -583,6 +583,19 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<!-- 6.17新增 报废原因等填写 -->
<el-table-column label="报废信息" align="center">
<template slot-scope="{ row }">
<el-button
type="primary"
size="mini"
:disabled="row.scrapNum <= 0"
> </el-button
>
</template>
</el-table-column>
<!-- <el-table-column label="报废信息" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="报废信息" align="center" prop="" :show-overflow-tooltip="true" /> -->
</el-table> </el-table>
</div> </div>

View File

@ -11,7 +11,7 @@
<ImagePreview <ImagePreview
v-for="(item, index) in scrapImgList" v-for="(item, index) in scrapImgList"
:key="index" :key="index"
:src="item" :src="`${impViewUrl}${item}`"
:width="`20px`" :width="`20px`"
:height="`20px`" :height="`20px`"
class="img-box" class="img-box"
@ -22,7 +22,10 @@
<script> <script>
export default { export default {
props: { props: {
scrapImgUrl: {}, scrapImgUrl: {
type: String,
default: () => null,
},
}, },
data() { data() {
return { return {
@ -31,14 +34,14 @@ export default {
} }
}, },
mounted() { mounted() {
let imgList = [] // let imgList = []
if (this.scrapImgUrl) { if (this.scrapImgUrl) {
imgList = this.scrapImgUrl.split(',') this.scrapImgList = this.scrapImgUrl.split(',')
} }
this.scrapImgList = imgList.map( // this.scrapImgList = imgList.map(
(item) => (item = this.impViewUrl + item), // (item) => (item = this.impViewUrl + item),
) // )
}, },
} }
</script> </script>