<!--empc为后端返回的的对象-->
<el-table-column
prop="ecdate"
width="95"
align="left"
label="奖罚日期">
<template slot-scope="scope">
<span>{{ switchTimeFormat(scope.row.ecdate)}}</span>
</template>
</el-table-column>
switchTimeFormat(time) {
const dateTime = new Date(time)
const year = dateTime.getFullYear()
const month = dateTime.getMonth() + 1
const date = dateTime.getDate()
return `${year}-${this.addZero(month)}-${this.addZero(date)}`
},
addZero (v) {
return v < 10 ? '0' + v : v
}
<!--类型如果为1为奖为否则罚-->
<el-table-column
prop="ectype"
width="95"
align="left"
label="奖罚类别">
<template slot-scope="scope">
<span>{{ scope.row.ectype == '1' ? '奖' :'罚'}}</span>
</template>
</el-table-column>