Files
dvcp_v2_webapp/packages/jianping/AppVisitToVerify/components/List.vue

200 lines
5.7 KiB
Vue
Raw Normal View History

2022-03-24 11:03:20 +08:00
<template>
<ai-list class="notice">
<template slot="title">
2022-03-26 14:35:47 +08:00
<ai-title title="走访核实" isShowBottomBorder :isShowArea="true" v-model="search.areaId" :instance="instance" @change="getList"></ai-title>
2022-03-24 11:03:20 +08:00
</template>
<template slot="content">
<ai-search-bar>
<template #left>
<ai-select
2022-03-28 16:41:31 +08:00
v-model="search.riskType"
2022-03-24 11:03:20 +08:00
clearable
placeholder="请选择风险类型"
2022-03-26 14:35:47 +08:00
:selectList="dict.getDict('fpRiskType')"
2022-03-24 11:03:20 +08:00
@change="search.current = 1, getList()">
</ai-select>
<ai-select
2022-03-26 14:35:47 +08:00
v-model="search.status"
2022-03-24 11:03:20 +08:00
clearable
placeholder="请选择状态"
2022-03-26 14:35:47 +08:00
:selectList="dict.getDict('fpRiskPersonStatus')"
2022-03-24 11:03:20 +08:00
@change="search.current = 1, getList()">
</ai-select>
2022-03-26 14:35:47 +08:00
<el-button size="small" v-if="checkType === '2'" :disabled="addIds.length == 0" type="primary" @click="addMonitor">纳入监测</el-button>
2022-03-28 16:30:41 +08:00
<el-button size="small" v-if="checkType !== '0'" :disabled="removeIds.length == 0" @click="removeAll">解除风险</el-button>
2022-03-24 11:03:20 +08:00
</template>
<template #right>
<el-input
v-model="search.name"
size="small"
2022-03-29 18:15:32 +08:00
placeholder="姓名/备注说明/操作人"
2022-03-24 11:03:20 +08:00
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"
2022-03-26 14:35:47 +08:00
@selection-change="(v) => chooseList = v"
2022-03-24 11:03:20 +08:00
@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,
2022-03-26 14:35:47 +08:00
name: '',
areaId: '',
2022-03-28 16:41:31 +08:00
riskType: '',
2022-03-26 14:35:47 +08:00
status: ''
2022-03-24 11:03:20 +08:00
},
2022-03-26 14:35:47 +08:00
chooseList: [],
2022-03-24 11:03:20 +08:00
total: 10,
2022-03-26 14:35:47 +08:00
checkType: '',
2022-03-24 11:03:20 +08:00
tableData: []
}
},
computed: {
...mapState(['user']),
colConfigs () {
return [
{ type: 'selection' },
2022-03-26 14:35:47 +08:00
{ 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' }
2022-03-24 11:03:20 +08:00
]
2022-03-26 14:35:47 +08:00
},
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 []
}
2022-03-29 17:09:37 +08:00
return this.chooseList.filter(v => v.status === '0' || v.status === '1').map(v => v.id)
2022-03-24 11:03:20 +08:00
}
},
created () {
2022-03-26 14:35:47 +08:00
this.search.areaId = this.user.info.areaId
this.dict.load('fpRiskType', 'fpRiskPersonStatus').then(() => {
2022-03-24 11:03:20 +08:00
this.getList()
})
2022-03-26 14:35:47 +08:00
this.getInfo()
2022-03-24 11:03:20 +08:00
},
methods: {
getList() {
2022-03-26 14:35:47 +08:00
this.instance.post(`/app/apppreventionreturntopovertyriskperson/list`, null, {
2022-03-24 11:03:20 +08:00
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
2022-03-26 14:35:47 +08:00
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()
}
})
})
2022-03-24 11:03:20 +08:00
},
2022-03-26 14:35:47 +08:00
removeAll () {
2022-03-24 11:03:20 +08:00
this.$confirm('确定删除该数据?').then(() => {
2022-03-26 14:35:47 +08:00
this.instance.post(`/app/apppreventionreturntopovertyriskperson/monitor`, {
ids: this.removeIds,
operation: 2
}).then(res => {
2022-03-24 11:03:20 +08:00
if (res.code == 0) {
2022-03-26 14:35:47 +08:00
this.$message.success('操作成功!')
2022-03-24 11:03:20 +08:00
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>