Files
dvcp_v2_webapp/packages/grid/AppGridMember/components/list.vue

168 lines
4.3 KiB
Vue
Raw Normal View History

2022-03-26 15:34:50 +08:00
<template>
<ai-list class="list" isTabs>
<template slot="content">
<ai-search-bar style="padding: 16px 0 0">
<template slot="left">
<el-button
2022-06-13 09:39:19 +08:00
icon="iconfont iconAdd"
type="primary"
size="small"
@click="add('')"
>添加
</el-button
2022-03-26 15:34:50 +08:00
>
<el-button
2022-06-13 09:39:19 +08:00
icon="iconfont iconDelete"
@click="deleteById(ids.join(','))"
:disabled="!Boolean(ids.length)"
>删除
</el-button
2022-03-26 15:34:50 +08:00
>
</template>
2022-06-13 09:39:19 +08:00
<template slot="right">
<el-input
v-model="searchObj.name"
size="small"
placeholder="网格员/责任网格"
v-throttle="() => {page.current = 1, getList()}"
clearable
@clear="(searchObj.name = '', page.current = 1), getList()"
suffix-icon="iconfont iconSearch"/>
</template>
2022-03-26 15:34:50 +08:00
</ai-search-bar>
<ai-table
2022-06-13 09:39:19 +08:00
:tableData="tableData"
:col-configs="colConfigs"
:total="page.total"
:current.sync="page.current"
:size.sync="page.size"
@selection-change="(v) => (ids = v.map((e) => e.id))"
@getList="getList()">
2022-03-26 15:34:50 +08:00
<el-table-column label="操作" slot="options" align="center" fixed="right" width="220">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toFamily(row.id)">责任家庭</el-button>
2022-04-29 14:32:08 +08:00
<el-button type="text" @click="toMonitorUser(row.id)" v-if="permissions('girdmemberpovertyconfig')">监测对象</el-button>
2022-03-26 15:34:50 +08:00
<el-button type="text" @click="add(row.id)">详情</el-button>
<el-button type="text" @click="deleteById(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: "List",
label: "网格员管理",
props: {
instance: Function,
dict: Object,
permissions: Function,
},
data() {
return {
searchObj: {
name: "",
selectionDate: "",
},
page: {
current: 1,
size: 10,
total: 0,
},
goAdd: false,
tableData: [],
fileList: [],
ids: [],
detail: {},
};
},
created() {
this.dict.load("sex", "girdMemberType", "politicsStatus", "education");
this.getList();
},
computed: {
colConfigs() {
return [
2022-06-13 09:39:19 +08:00
{type: "selection"},
{prop: "name", label: "网格员姓名"},
{prop: "girdInfoListStr", align: "center", label: "责任网格"},
{prop: "phone", align: "center", label: "联系电话"},
{prop: "createTime", align: "center", label: "创建时间"},
2022-03-26 15:34:50 +08:00
];
},
},
methods: {
getList() {
2022-06-13 09:39:19 +08:00
this.instance.post("/app/appgirdmemberinfo/list", null, {
params: {...this.searchObj, ...this.page}
}).then((res) => {
if (res?.data) {
this.tableData = res.data.records;
this.page.total = res.data.total;
}
})
},
deleteById(ids) {
ids && this.$confirm("是否要删除该网格员?", {
type: "error",
}).then(() => {
this.instance
.post("/app/appgirdmemberinfo/delete", null, {
params: {ids},
2022-03-26 15:34:50 +08:00
})
.then((res) => {
2022-06-13 09:39:19 +08:00
if (res?.code == 0) {
this.$message.success("删除成功!");
this.getList();
2022-03-26 15:34:50 +08:00
}
});
2022-06-13 09:39:19 +08:00
})
.catch(() => 0);
2022-03-26 15:34:50 +08:00
},
add(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
},
2022-06-13 09:39:19 +08:00
toMonitorUser(id) {
2022-03-26 15:34:50 +08:00
this.$emit('change', {
type: 'MonitorUser',
params: {
id
}
})
},
2022-06-13 09:39:19 +08:00
toFamily(id) {
2022-03-26 15:34:50 +08:00
this.$emit('change', {
type: 'Family',
params: {
id
}
})
},
handleSelectionChange(val) {
this.ids = [];
val.map((e) => {
this.ids.push(e.id);
});
},
resetSearch() {
Object.keys(this.searchObj).map((e) => {
this.searchObj[e] = "";
});
this.getList();
2022-06-13 09:39:19 +08:00
}
2022-03-26 15:34:50 +08:00
},
};
</script>
<style lang="scss" scoped>
2022-04-29 14:32:08 +08:00
</style>