一,动态数据
后端传0,1,2,3数据,前端显示对应审核状态字符,table使用label的formatter属性,
<el-table-column label="审批状态" :formatter="formatAudit" align="center" prop="isAudit"/>
下面methods方法里面写方法
export default {
methods: {
formatAudit(row) {
if (row.isAudit == 0) {
return '审批中'
} else if (row.isAudit == 1) {
return '已通过'
}
},
}
}
二,按钮置灰
直接在按钮的type中:disable属性,用状态判断true或者false
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
:disabled="scope.row.auditStatus == 10 ? true :false"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['work:app:edit']"
>已完成
</template>
</el-table-column>