<a-table :columns="columns" :data-source="tenantData" bordered> <!-- 状态自定义 --> <template slot="tag" slot-scope="row"> <a-tag color="blue" v-if="row.state === '1'"> 正常 </a-tag> <a-tag color="red" v-else> 冻结 </a-tag> </template> <!-- 操作自定义 --> <template slot="operation" slot-scope="row"> <a-space size="small"> <a @click.prevent="editHandle(row)">编辑</a> <a-divider type="vertical" /> <!-- 更多 --> <a-dropdown> <a class="ant-dropdown-link" @click="(e) => e.preventDefault()"> 更多<a-icon type="down" /></a> <a-menu slot="overlay"> <a-menu-item> <a href="javascript:;" @click="tenantDetails(row)">详情</a> </a-menu-item> <a-menu-item> <a-popconfirm title="确定要删掉吗?" ok-text="确定" cancel-text="取消" @confirm="() => removeConfirm(row)"> <a>删除</a> </a-popconfirm> </a-menu-item> </a-menu> </a-dropdown> </a-space> </template> </a-table>
<script> const columns = [ { title: "租户名称", dataIndex: "name", key: "name", align: "center", }, { title: "租户编号", dataIndex: "number", key: "number", align: "center", }, { title: "开始时间", dataIndex: "startTimer", key: "startTimer", align: "center", }, { title: "结束时间", dataIndex: "endTrmer", key: "endTrmer", align: "center", }, { align: "center", title: "状态", scopedSlots: { customRender: "tag" }, }, { align: "center", title: "操作", scopedSlots: { customRender: "operation" }, }, ] let tenantLists = [ { id: "1", name: "女警", tenantNo: "1100", startTimer: "2020-06-01 10:10:40", endTimer: "2021-06-01 10:10:40", state: "1", }, { id: "2", name: "青钢影", tenantNo: "1200", startTimer: "2020-06-01 10:10:40", endTimer: "2021-06-01 10:10:40", state: "1", }, { id: "3", name: "卡莎", tenantNo: "1300", startTimer: "2020-06-01 10:10:40", endTimer: "2021-06-01 10:10:40", state: "0", }] export default { data(){ return:{ tenantLists, columns, } } } </script>
|