绿谷官网后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

146 lines
3.4 KiB

<template>
<div class="main flex-1">
<div style="width:100%" v-if="lists && lists.length > 0">
<a-table
:columns="columns"
:data-source="lists"
:loading="loading"
:row-key="record => record.id"
bordered
class="white"
>
<template slot="id" slot-scope="text, record, index">
<span>{{ index + 1 }}</span>
</template>
<!-- 说明图片 -->
<template slot="introductionPicture" slot-scope="text, record">
<img :src="record.introductionPicture" class="img" />
<a-modal :imgVisible="imgVisible" @cancel="imgVisible = false" footer title="身份证明">
<img :src="record.idCardPromise" @click="imgVisible = true" style="width: 100%;" />
</a-modal>
</template>
<template slot="edit" slot-scope="text, record">
<a-icon @click="showEditModal" class="pointer" theme="twoTone" type="edit" />
<a-popconfirm @confirm="() => onDelete(record.id)" title="确定要删除这一条?" v-if="lists.length">
<a-icon class="ml-4 pointer" theme="twoTone" two-tone-color="#ff0000" type="delete" />
</a-popconfirm>
</template>
</a-table>
</div>
<a-empty v-else />
<!-- 编辑 -->
<development-edit :editVisible="editVisible" @closeModal="closeModal" />
</div>
</template>
<script>
import DevelopmentEdit from "components/Development/DevelopmentEdit.vue";
const columns = [
{
title: '序号',
align: 'center',
dataIndex: 'id',
key: 'id',
width: '7%',
scopedSlots: { customRender: 'id' },
},
{
title: '名录',
align: 'center',
dataIndex: 'directory',
key: 'directory',
},
{
title: '介绍图片',
align: 'center',
dataIndex: 'introductionPicture',
key: 'introductionPicture',
scopedSlots: { customRender: 'introductionPicture' },
},
{
title: '编辑',
align: 'center',
dataIndex: 'edit',
key: 'edit',
scopedSlots: { customRender: 'edit' },
},
];
const lists = [
{
id:'001',
directory:'传控科技',
introductionPicture:'assets/logo.png',
},
{
id:'002',
directory:'中绿环保',
introductionPicture:'assets/logo.png',
}
];
export default {
name: "DevelopmentDate",
components: {
DevelopmentEdit,
},
data() {
this.cacheData = lists.map(item => ({ ...item }));
return {
columns,
lists,
loading: false,
height: '',
editVisible: false,
imgVisible: false,
}
},
mounted() {
this.height = document.getElementsByClassName('main')[0].offsetHeight - 150;
},
methods: {
showEditModal(){
this.editVisible = true;
},
closeModal(){
this.editVisible = false;
},
// 删除
async onDelete(teamId) {
try {
const params = { param: { teamId } };
// const res = await delTeam(params);
// const { data, msg, code } = res.data;
// if (code === 200) {
// this.$message.success('删除成功');
// const arr = [...this.lists];
// this.lists = arr.filter(item => item.id !== teamId);
// // TODO: 填到列表中
// } else {
// throw msg;
// }
} catch (error) {
this.$message.error(error || '删除失败');
}
},
},
};
</script>
<style lang="stylus" scoped>
.main .img {
width: 100%;
}
.main .big_img {
width: 200px;
}
</style>