修改状态插槽组件

This commit is contained in:
fengachen
2021-09-01 10:56:58 +08:00
parent a8f6fe97d1
commit 1f6f8d00ed
2 changed files with 44 additions and 35 deletions
+38 -33
View File
@@ -1,62 +1,67 @@
<template>
<div>
<!--应收金额为 0 到账 开票 邮寄 显示zero-->
<img v-if="status === 0" src=".././../assets/imgs/zero.png"/>
<!--完成 -->
<img v-if="status === 1" src=".././../assets/imgs/finished.png"/>
<!--进行一半-->
<img v-if="status === 2" src=".././../assets/imgs/half.png"/>
<!-- &lt;!&ndash;没有&ndash;&gt;-->
<img v-if="status === 3" src=".././../assets/imgs/error.png" @click="s"/>
<!-- <slot :name="name">{{name}}</slot>-->
<img :src="status" @click="s"/>
</div>
</template>
<script>
import zero from '../../assets/imgs/zero.png'
import finished from '../../assets/imgs/finished.png'
import half from '../../assets/imgs/half.png'
import error from '../../assets/imgs/error.png'
export default {
name: "StatusSlot",
props: {
/*
* 表格行对象
* */
statuObj: {
type: Object,
required: false
},
/*
* 0 代表是打包 和需要发票
* 1 代表其他三个
* false 代表是打包 和需要发票
* true 代表其他三个
* */
statusType: {
type: Number,
required: false
type: Boolean,
required: false,
default:false
},
/*
* 具体的状态值
* */
statusNo:{
statusNo: {
type: Number,
required: false
},
// name:{
// type:Number,
// }
}
},
computed: {
status() {
// 应收金额为 0 到账 开票 邮寄 显示zero
if (this.statuObj.amountReceivable === 0 || this.statuObj.amountReceivable < 0 ) {
return 0
} else {
// 应收金额不为0
// 未完成
if(this.statusNo === 0){
return 3
if (this.statuObj.amountReceivable === 0) {
if(this.statusType){
// 应收金额为0 未到账 未邮寄 未开票的状态
return zero
}else {
// 应收金额为0 打包 与需要开票的状态
if(this.statusNo === 0 ){
return error
}else if(this.statusNo === 1){
return finished
}else if(this.statusNo == 2){
return half
}
}
// 完成
if(this.statusNo === 1){
return 1
}
// 一半
if(this.statusNo === 2){
return 2
}else {
// 应收金额不为0 都正常判断
if(this.statusNo === 0 ){
return error
}else if(this.statusNo === 1){
return finished
}else if(this.statusNo == 2){
return half
}
}
}
@@ -93,6 +93,10 @@
</template>
<template slot="status" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text" :status-type="true"></status-slot>
</template>
<template slot="status-pack" slot-scope="text,record">
<status-slot :statu-obj="record" :status-no="text"></status-slot>
</template>
@@ -167,13 +171,13 @@ export default {
title: '打包',
align: "center",
dataIndex: 'pack',
scopedSlots: {customRender: 'status'}
scopedSlots: {customRender: 'status-pack'}
},
{
title: '需要发票',
align: "center",
dataIndex: 'needInvoice',
scopedSlots: {customRender: 'status'}
scopedSlots: {customRender: 'status-pack'}
},
{
title: '到账',