修改状态插槽组件

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> <template>
<div> <div>
<!--应收金额为 0 到账 开票 邮寄 显示zero--> <img :src="status" @click="s"/>
<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>-->
</div> </div>
</template> </template>
<script> <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 { export default {
name: "StatusSlot", name: "StatusSlot",
props: { props: {
/*
* 表格行对象
* */
statuObj: { statuObj: {
type: Object, type: Object,
required: false required: false
}, },
/* /*
* 0 代表是打包 和需要发票 * false 代表是打包 和需要发票
* 1 代表其他三个 * true 代表其他三个
* */ * */
statusType: { statusType: {
type: Number, type: Boolean,
required: false required: false,
default:false
}, },
/* /*
* 具体的状态值 * 具体的状态值
* */ * */
statusNo:{ statusNo: {
type: Number, type: Number,
required: false required: false
}, }
// name:{
// type:Number,
// }
}, },
computed: { computed: {
status() { status() {
// 应收金额为 0 到账 开票 邮寄 显示zero if (this.statuObj.amountReceivable === 0) {
if (this.statuObj.amountReceivable === 0 || this.statuObj.amountReceivable < 0 ) { if(this.statusType){
return 0 // 应收金额为0 未到账 未邮寄 未开票的状态
} else { return zero
// 应收金额不为0 }else {
// 未完成 // 应收金额为0 打包 与需要开票的状态
if(this.statusNo === 0){ if(this.statusNo === 0 ){
return 3 return error
}else if(this.statusNo === 1){
return finished
}else if(this.statusNo == 2){
return half
}
} }
// 完成
if(this.statusNo === 1){ }else {
return 1 // 应收金额不为0 都正常判断
} if(this.statusNo === 0 ){
// 一半 return error
if(this.statusNo === 2){ }else if(this.statusNo === 1){
return 2 return finished
}else if(this.statusNo == 2){
return half
} }
} }
} }
@@ -93,6 +93,10 @@
</template> </template>
<template slot="status" slot-scope="text,record"> <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> <status-slot :statu-obj="record" :status-no="text"></status-slot>
</template> </template>
@@ -167,13 +171,13 @@ export default {
title: '打包', title: '打包',
align: "center", align: "center",
dataIndex: 'pack', dataIndex: 'pack',
scopedSlots: {customRender: 'status'} scopedSlots: {customRender: 'status-pack'}
}, },
{ {
title: '需要发票', title: '需要发票',
align: "center", align: "center",
dataIndex: 'needInvoice', dataIndex: 'needInvoice',
scopedSlots: {customRender: 'status'} scopedSlots: {customRender: 'status-pack'}
}, },
{ {
title: '到账', title: '到账',