驻村辅警

This commit is contained in:
yanran200730
2021-12-20 17:50:04 +08:00
parent ae5cc0e0a4
commit 931eca4fb3
3 changed files with 67 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
<template>
<ai-list class="villagecode">
<template slot="title">
<ai-title title="便民通讯录" isShowBottomBorder></ai-title>
<ai-title title="驻村辅警" isShowBottomBorder></ai-title>
</template>
<template #left>
<div class="villagecode-left">
@@ -36,7 +36,20 @@
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" :disabled="isShowAdd" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template slot="right">
<el-input
v-model="search.name"
class="search-input"
size="small"
@keyup.enter.native="search.current = 1, getList()"
placeholder="请输入名称/电话"
clearable
@change="getList"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
@@ -47,27 +60,19 @@
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<el-table-column slot="isPublic" label="是否公开">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
<el-switch
v-model="row.isPublic"
active-value="1"
@change="e => onChange(row.id, e)"
inactive-value="0">
</el-switch>
</template>
</el-table-column>
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-popover
placement="bottom"
width="160"
:visible-arrow="false"
popper-class="wechat-message__container"
trigger="hover">
<el-button type="text" slot="reference">二维码</el-button>
<div style="font-size: 0;">
<img class="message-info__img" :src="row.codeUrl">
</div>
</el-popover>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
@@ -93,8 +98,7 @@
search: {
current: 1,
size: 10,
status: 0,
title: '',
name: '',
areaId: ''
},
defaultExpanded: [],
@@ -108,10 +112,11 @@
areaList: [],
total: 10,
colConfigs: [
{prop: 'codeName', label: '名', align: 'left'},
{prop: 'type', label: '二维码类型', align: 'left', formart: v => v === '0' ? '群二维码' : '个人二维码'},
{prop: 'createUserName', label: '创建人'},
{prop: 'createTime', label: '创建时间'},
{prop: 'name', label: '名', align: 'left'},
{prop: 'phone', label: '联系方式', align: 'center'},
{prop: 'areaName', label: '服务区域', align: 'center'},
{prop: 'createTime', label: '创建时间', align: 'center'},
{slot: 'isPublic', label: '是否公开', align: 'center'},
{slot: 'options', label: '操作'}
],
areaName: '',
@@ -121,13 +126,7 @@
},
computed: {
...mapState(['user']),
isShowAdd () {
const str = this.search.areaId.substr(this.search.areaId.length - 3)
return false
}
...mapState(['user'])
},
watch: {
@@ -149,7 +148,7 @@
methods: {
getList() {
this.instance.post(`/app/appeveryvillagecode/list`, null, {
this.instance.post(`/app/appvillageauxiliarypolice/list`, null, {
params: {
...this.search
}
@@ -161,6 +160,15 @@
})
},
onChange (id) {
this.instance.post(`/app/appvillageauxiliarypolice/enable?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('修改成功')
this.getList()
}
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
@@ -220,7 +228,7 @@
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appeveryvillagecode/delete?ids=${id}`).then(res => {
this.instance.post(`/app/appvillageauxiliarypolice/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()