Files
dvcp_v2_webapp/packages/3.0.0/AppWeddingsFunerals/components/List.vue
yanran200730 4a7895b0e2 25987
2021-12-24 15:03:32 +08:00

211 lines
5.7 KiB
Vue

<template>
<ai-list class="list">
<ai-title slot="title" title="婚丧嫁娶" isShowBottomBorder></ai-title>
<template slot="content">
<div class="statistics-top">
<div class="statistics-top__item">
<span>活动登记数量</span>
<h2 style="color: #2266FF;">{{ info['丧礼登记数量'] }}</h2>
</div>
<div class="statistics-top__item">
<span>干部参与和操办登记数量</span>
<h2 style="color: #22AA99;">{{ info['干部参与和操办登记数量'] }}</h2>
</div>
<div class="statistics-top__item">
<span>婚礼登记数量</span>
<h2 style="color: #F8B425">{{ info['婚礼登记数量'] }}</h2>
</div>
<div class="statistics-top__item">
<span>丧礼登记数量</span>
<h2 style="color: red">{{ info['丧礼登记数量'] }}</h2>
</div>
</div>
<div class="content">
<ai-search-bar bottomBorder>
<template #left>
<el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button>
</template>
<template #right>
<el-input
v-model="search.name"
size="small"
placeholder="请输入姓名"
clearable
@keyup.enter.native="search.current = 1, getList()"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
v-loading="loading"
style="margin-top: 16px;"
:current.sync="search.current"
:size.sync="search.size"
@selection-change="v => (ids = v.map((e) => e.id))"
@getList="getList">
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
</template>
<script>
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
size: 10,
name: ''
},
info: {},
colConfigs: [
{ type: 'selection' },
{ prop: 'name', label: '事主姓名' },
{ prop: 'phone', align: 'center', label: '联系电话' },
{ prop: 'type', align: 'center', label: '类型', formart: v => this.dict.getLabel('marriageType', v) },
{ prop: 'modeType', align: 'center', label: '方式', formart: v => this.dict.getLabel('modeType', v) },
{ prop: 'personType', align: 'center', label: '人员性质', formart: v => this.dict.getLabel('marriagePersonType', v) },
{ prop: 'createTime', align: 'center', label: '发布时间' }
],
ids: [],
tableData: [],
total: 0,
loading: false
}
},
created () {
this.dict.load(['marriageType', 'marriagePersonType', 'modeType']).then(() => {
this.getList()
})
},
mounted () {
this.loading = true
},
methods: {
getList () {
this.instance.post(`/app/appmarriagefuneralinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
this.loading = false
} else {
this.loading = false
}
}).catch(() => {
this.loading = false
})
this.getTotalInfo()
},
getTotalInfo () {
this.instance.post(`/app/appmarriagefuneralinfo/queryDataStatistics`).then(res => {
if (res.code == 0) {
let info = {}
res.data.forEach(v => {
info[v.name] = v.v1
})
this.info = info
}
})
},
remove (id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appmarriagefuneralinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
removeAll() {
var id = this.ids.join(',')
this.remove(id)
}
}
}
</script>
<style scoped lang="scss">
.list {
::v-deep .ai-list__content {
padding: 0!important;
.ai-list__content--right-wrapper {
background: transparent!important;
box-shadow: none!important;
margin: 0!important;
padding: 12px 16px 12px!important;
}
}
.statistics-top {
display: flex;
align-items: center;
margin-bottom: 20px;
& > div {
flex: 1;
height: 96px;
line-height: 1;
margin-right: 20px;
padding: 16px 24px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
border-radius: 4px;
&:last-child {
margin-right: 0;
}
h3 {
font-size: 24px;
}
span {
display: block;
margin-bottom: 16px;
color: #888888;
font-size: 16px;
}
}
}
.content {
padding: 16px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
}
}
</style>