调整村务公开

This commit is contained in:
aixianling
2022-03-14 12:21:24 +08:00
parent f2508c5823
commit edf03dbb5d
4 changed files with 274 additions and 269 deletions

View File

@@ -0,0 +1,33 @@
<template>
<section class="AppArticles">
<component :is="currentComponent" :instance="instance" :dict="dict" :permissions="permissions"/>
</section>
</template>
<script>
import Add from "./components/Add";
import Detail from "./components/Detail";
import Event from "./components/Event";
export default {
name: "AppArticles",
label: "村务公开(运营版)",
components: {Event, Detail, Add},
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
currentComponent() {
return this.$route.hash == "#add" ? Add :
!!this.$route.query?.id ? Detail : Event
}
}
}
</script>
<style lang="scss" scoped>
.AppArticles {
}
</style>

View File

@@ -54,7 +54,6 @@ export default {
props: { props: {
dict: Object, dict: Object,
params: Object,
instance: Function, instance: Function,
areaId: String areaId: String
}, },
@@ -78,7 +77,10 @@ export default {
}, },
computed: { computed: {
...mapState(['user']) ...mapState(['user']),
params() {
return this.$route.query
}
}, },
created() { created() {
@@ -89,7 +91,7 @@ export default {
methods: { methods: {
onBack() { onBack() {
this.cancel() this.$router.push({})
}, },
getInfo() { getInfo() {
@@ -124,13 +126,6 @@ export default {
} }
}) })
}, },
cancel(isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
} }
} }
</script> </script>

View File

@@ -20,58 +20,58 @@
</template> </template>
<script> <script>
export default { export default {
name: 'detail', name: 'detail',
props: {
instance: Function,
dict: Object,
permissions: Function,
},
props: { data() {
instance: Function, return {
dict: Object, info: {}
permissions: Function, }
params: Object },
}, computed: {
params() {
return this.$route.query
}
},
mounted() {
this.getInfo()
},
data () { methods: {
return { getInfo() {
info: {} this.instance.post(`/appvillageinfo/queryDetailById?id=${this.params.id}`).then(res => {
} if (res?.data) {
}, this.info = res.data
if (res.data.thumbUrl) {
mounted () { this.info.thumbUrl = JSON.parse(res.data.thumbUrl)
this.getInfo()
},
methods: {
getInfo () {
this.instance.post(`/appvillageinfo/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
if (res.data.thumbUrl) {
this.info.thumbUrl = JSON.parse(res.data.thumbUrl)
}
} }
}) }
}, })
},
onBack () { onBack() {
this.$emit('change', { this.$router.push({})
type: 'list'
})
}
} }
} }
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.cover { .cover {
display: block; display: block;
width: 300px; width: 300px;
height: 140px; height: 140px;
margin: 20px auto; margin: 20px auto;
} }
.subTitle { .subTitle {
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
font-weight: normal; font-weight: normal;
} }
</style> </style>

View File

@@ -1,56 +1,56 @@
<template> <template>
<section class="event"> <section class="event">
<ai-list> <ai-list>
<ai-title slot="title" title="村务公开" isShowBottomBorder></ai-title> <ai-title slot="title" title="村务公开" isShowBottomBorder></ai-title>
<template slot="content"> <template slot="content">
<ai-search-bar> <ai-search-bar>
<template slot="left"> <template slot="left">
<el-button icon="iconfont iconAdd" type="primary" size="small" @click="add">添加</el-button> <el-button icon="iconfont iconAdd" type="primary" size="small" @click="toAdd">添加</el-button>
</template> </template>
<template slot="right"> <template slot="right">
<el-input <el-input
placeholder="请输入标题" placeholder="请输入标题"
size="small" size="small"
clearable clearable
v-model="search.title" v-model="search.title"
@keyup.enter.native="search.current = 1, getList()" @keyup.enter.native="search.current = 1, getList()"
@clear="search.current = 1, search.title = '', getList()" @clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch" /> suffix-icon="iconfont iconSearch"/>
</template> </template>
</ai-search-bar> </ai-search-bar>
<div class="ai-table"> <div class="ai-table">
<ai-table <ai-table
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
:total="total" :total="total"
:current.sync="search.current" :current.sync="search.current"
:size.sync="search.size" :size.sync="search.size"
@getList="getList"> @getList="getList">
<el-table-column slot="options" label="操作" align="center" width="250" fixed="right"> <el-table-column slot="options" label="操作" align="center" width="250" fixed="right">
<template slot-scope="{ row }" class="fs-14"> <template slot-scope="{ row }" class="fs-14">
<div class="table-options"> <div class="table-options">
<el-button <el-button
type="text" type="text"
@click="publish(row)" @click="publish(row)"
title="发布"> title="发布">
发布 发布
</el-button> </el-button>
<el-button <el-button
type="text" type="text"
title="详情" title="详情"
@click="toDetail(row.id)"> @click="toDetail(row.id)">
详情 详情
</el-button> </el-button>
<el-button <el-button
type="text" type="text"
title="编辑" title="编辑"
@click="toAdd(row.id)"> @click="toEdit(row.id)">
编辑 编辑
</el-button> </el-button>
<el-button <el-button
@click="remove(row.id)" @click="remove(row.id)"
type="text" type="text"
title="删除"> title="删除">
删除 删除
</el-button> </el-button>
</div> </div>
@@ -60,30 +60,31 @@
</div> </div>
</template> </template>
</ai-list> </ai-list>
<ai-dialog title="请选择发布平台企业" :visible.sync="dialog" width="600px" @onConfirm="saveSaas"> <ai-dialog title="请选择发布平台企业" :visible.sync="dialog" width="600px" @onConfirm="saveSaas">
<el-form ref="saasForm" :model="dialogForm" size="small" label-width="120px"> <el-form ref="saasForm" :model="dialogForm" size="small" label-width="120px">
<el-form-item required label="saas平台" prop="saasId" :rules="[{required: true, message: '请选择saas平台'}]"> <el-form-item required label="saas平台" prop="saasId" :rules="[{required: true, message: '请选择saas平台'}]">
<el-select v-model="dialogForm.saasId" placeholder="请选择saas平台" style="width:100%;" @change="getCompanyList"> <el-select v-model="dialogForm.saasId" placeholder="请选择saas平台" style="width:100%;" @change="getCompanyList">
<el-option <el-option
v-for="item in saasList" v-for="item in saasList"
:key="item.value" :key="item.value"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item required label="saas企业" prop="corpId" :rules="[{required: true, message: '请选择saas企业'}]"> <el-form-item required label="saas企业" prop="corpId" :rules="[{required: true, message: '请选择saas企业'}]">
<el-select v-model="dialogForm.corpId" placeholder="请选择saas企业" style="width:100%;" @change="selectCompany"> <el-select v-model="dialogForm.corpId" placeholder="请选择saas企业" style="width:100%;" @change="selectCompany">
<el-option <el-option
v-for="item in companyList" v-for="item in companyList"
:key="item.value" :key="item.value"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item required label="地区" prop="areaId" :rules="[{required: true, message: '请选择发布地区'}]"> <el-form-item required label="地区" prop="areaId" :rules="[{required: true, message: '请选择发布地区'}]">
<ai-area-get :instance="instance" v-model="dialogForm.areaId" :root="rootId" :name.sync="dialogForm.areaName" /> <ai-area-get :instance="instance" v-model="dialogForm.areaId" :root="rootId"
:name.sync="dialogForm.areaName"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ai-dialog> </ai-dialog>
@@ -91,202 +92,178 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { export default {
name: 'event', name: 'event',
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
colConfigs() { colConfigs() {
return [ return [
{ prop: 'type', label: '类型', formart: v => this.dict.getLabel('villInfoType', v) }, {prop: 'type', label: '类型', formart: v => this.dict.getLabel('villInfoType', v)},
{ prop: 'title', label: '标题', align: 'left' }, {prop: 'title', label: '标题', align: 'left'},
{ prop: 'createDate', label: '创建时间', dateFormart: 'YYYY-MM-DD', align: 'center' }, {prop: 'createDate', label: '创建时间', dateFormart: 'YYYY-MM-DD', align: 'center'},
{ prop: 'createUser', label: '发布人', align: 'center' }, {prop: 'createUser', label: '发布人', align: 'center'},
{ slot: 'options', label: '操作' } {slot: 'options', label: '操作'}
] ]
} }
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
size: 10, size: 10,
title: '' title: ''
}, },
total: 0, total: 0,
ids: [], ids: [],
tableData: [], tableData: [],
dialog: false, dialog: false,
dialogForm: {}, dialogForm: {},
saasList: [], saasList: [],
companyList: [], companyList: [],
rootId: '' rootId: ''
} }
}, },
mounted () { mounted() {
this.dict.load('villInfoType').then(() => { this.dict.load('villInfoType').then(() => {
this.getList() this.getList()
this.getsaasList() this.getsaasList()
})
},
methods: {
getsaasList() {
this.instance.post("/appSaas/page", null, {
params: {size: 10000}
}).then(res => {
if (res?.data) {
this.saasList = res.data?.records
}
}) })
}, },
methods: { getCompanyList() {
getsaasList() { this.instance.post("/appCorp/page", null, {
this.instance.post("/appSaas/page", null, { params: {saasId: this.dialogForm.saasId, size: 10000}
params: {size: 10000} }).then(res => {
}).then(res => { if (res?.data) {
if (res?.data) { this.companyList = res.data.records
this.saasList = res.data?.records this.rootId = ''
this.dialogForm.areaId = ''
this.corpId = ''
}
})
},
selectCompany() {
this.companyList.map(item => {
if (item.id == this.dialogForm.corpId) {
this.rootId = item.areaId
this.dialogForm.areaId = item.areaId
}
})
},
getList() {
this.instance.post(`/appvillageinfo/list`, null, {
params: {
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
publish(params) {
this.dialogForm.id = params.id
this.dialog = true
},
toAdd() {
this.$router.push({hash: "#add"})
},
toEdit(id) {
this.$router.push({hash: "#add", query: {id}})
},
toDetail(id) {
this.$router.push({query: {id}})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillageinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
} }
}) })
}, })
},
getCompanyList() { saveSaas() {
this.instance.post("/appCorp/page", null, { this.$refs.saasForm.validate(v => {
params: {saasId:this.dialogForm.saasId, size: 10000} if (v) {
}).then(res => { this.instance.post(`/appvillageinfo/sync?corpId=${this.dialogForm.corpId}&id=${this.dialogForm.id}&areaId=${this.dialogForm.areaId}`).then(res => {
if (res?.data) { if (res?.code == 0) {
this.companyList = res.data.records this.dialog = false;
this.rootId = '' this.$message.success("发布成功")
this.dialogForm.areaId = '' this.dialogForm = {}
this.corpId = '' } else {
} this.$message.error(res?.msg)
})
},
selectCompany() {
this.companyList.map(item => {
if(item.id == this.dialogForm.corpId) {
this.rootId = item.areaId
this.dialogForm.areaId = item.areaId
}
})
},
getList () {
this.instance.post(`/appvillageinfo/list`, null, {
params: {
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
publish (params) {
this.dialogForm.id = params.id
this.dialog = true
},
toAdd (id) {
this.$emit('change', {
type: 'add',
params: {
id
}
})
},
add () {
this.$emit('change', {
type: 'add',
params: {
id: ''
}
})
},
toEdit (id) {
this.$emit('change', {
type: 'add',
params: {
type: 'ReportAdd',
id
}
})
},
toDetail (id) {
this.$emit('change', {
type: 'detail',
params: {
type: 'eventDetail',
id
}
})
},
remove (id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillageinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
} }
}) })
}) }
}, })
},
saveSaas() {
this.$refs.saasForm.validate(v => {
if (v) {
this.instance.post(`/appvillageinfo/sync?corpId=${this.dialogForm.corpId}&id=${this.dialogForm.id}&areaId=${this.dialogForm.areaId}`).then(res => {
if (res?.code == 0) {
this.dialog = false;
this.$message.success("发布成功")
this.dialogForm = {}
} else {
this.$message.error(res?.msg)
}
})
}
})
},
}
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.event { .event {
height: 100%; height: 100%;
::v-deep th {
font-weight: bold!important; ::v-deep th {
} font-weight: bold !important;
::v-deep .table-options{ }
span{
font-size: 14px!important; ::v-deep .table-options {
} span {
font-size: 14px !important;
} }
} }
.table-btn { }
margin-right: 16px;
font-size: 14px;
color: #2266FF;
cursor: pointer;
&:hover { .table-btn {
opacity: 0.6; margin-right: 16px;
} font-size: 14px;
color: #2266FF;
cursor: pointer;
&:last-child { &:hover {
margin-right: 0; opacity: 0.6;
}
&:last-child:hover {
color: #f46;
opacity: 1;
}
} }
&:last-child {
margin-right: 0;
}
&:last-child:hover {
color: #f46;
opacity: 1;
}
}
</style> </style>