Files
dvcp_v2_webapp/packages/jianping/AppVisitToVerify/components/List.vue
yanran200730 ca3fbd9a89 28570
2022-03-28 16:30:42 +08:00

200 lines
5.6 KiB
Vue

<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="走访核实" isShowBottomBorder :isShowArea="true" v-model="search.areaId" :instance="instance" @change="getList"></ai-title>
</template>
<template slot="content">
<ai-search-bar>
<template #left>
<ai-select
v-model="search.fpRiskType"
clearable
placeholder="请选择风险类型"
:selectList="dict.getDict('fpRiskType')"
@change="search.current = 1, getList()">
</ai-select>
<ai-select
v-model="search.status"
clearable
placeholder="请选择状态"
:selectList="dict.getDict('fpRiskPersonStatus')"
@change="search.current = 1, getList()">
</ai-select>
<el-button size="small" v-if="checkType === '2'" :disabled="addIds.length == 0" type="primary" @click="addMonitor">纳入监测</el-button>
<el-button size="small" v-if="checkType !== '0'" :disabled="removeIds.length == 0" @click="removeAll">解除风险</el-button>
</template>
<template #right>
<el-input
v-model="search.name"
size="small"
placeholder="姓名/风险说明/操作人"
clearable
v-throttle="() => {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"
style="margin-top: 12px;"
:current.sync="search.current"
:size.sync="search.size"
@selection-change="(v) => chooseList = v"
@getList="getList">
<el-table-column slot="options" width="90px" fixed="right" label="操作" align="center">
<div class="table-options" slot-scope="{ row }">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
name: '',
areaId: '',
fpRiskType: '',
status: ''
},
chooseList: [],
total: 10,
checkType: '',
tableData: []
}
},
computed: {
...mapState(['user']),
colConfigs () {
return [
{ type: 'selection' },
{ prop: 'name', label: '姓名', align: 'left'},
{ prop: 'phone', label: '联系方式', align: 'center' },
{ prop: 'riskType', label: '风险类型', align: 'center', formart: v => this.dict.getLabel('fpRiskType', v) },
{ prop: 'areaName', label: '所属区域', align: 'center' },
{ prop: 'remarks', label: '备注说明', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', formart: v => this.dict.getLabel('fpRiskPersonStatus', v) },
{ prop: 'createTime', label: '处理时间', align: 'center' },
{ prop: 'createUserName', label: '处理人', align: 'center' }
]
},
addIds () {
if (!this.chooseList.length) {
return []
}
return this.chooseList.filter(v => v.status === '0' || v.status === '1').map(v => v.id)
},
removeIds () {
if (!this.chooseList.length) {
return []
}
return this.chooseList.filter(v => v.status !== '3').map(v => v.id)
}
},
created () {
this.search.areaId = this.user.info.areaId
this.dict.load('fpRiskType', 'fpRiskPersonStatus').then(() => {
this.getList()
})
this.getInfo()
},
methods: {
getList() {
this.instance.post(`/app/apppreventionreturntopovertyriskperson/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getInfo () {
this.instance.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => {
if (res.code == 0) {
this.checkType = res.data.checkType
}
})
},
addMonitor () {
this.$confirm('是否纳入监测对象?').then(() => {
this.instance.post(`/app/apppreventionreturntopovertyriskperson/monitor`, {
ids: this.addIds,
operation: 1
}).then(res => {
if (res.code == 0) {
this.$message.success('操作成功!')
this.getList()
}
})
})
},
removeAll () {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/apppreventionreturntopovertyriskperson/monitor`, {
ids: this.removeIds,
operation: 2
}).then(res => {
if (res.code == 0) {
this.$message.success('操作成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>