特制化,使标题跟随菜单目录变化

This commit is contained in:
aixianling
2022-08-18 17:27:50 +08:00
parent 3b7ee0c6cc
commit 35e612d35c
6 changed files with 295 additions and 290 deletions

View File

@@ -1,44 +1,42 @@
<template> <template>
<div class="doc-circulation ailist-wrapper"> <div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> <component ref="component" :is="component" @change="onChange" :params="params" v-bind="$props"/>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
<script> <script>
import List from './components/List' import List from './components/List'
import Add from './components/Add' import Add from './components/Add'
import Detail from './components/Detail' import Detail from './components/Detail'
export default { export default {
name: 'AppVillageIntroduction', name: 'AppVillageIntroduction',
label: '本村简介', label: '本村简介',
props: { props: {
instance: Function, instance: Function,
dict: Object dict: Object,
menuName: {default: "本村简介"}
}, },
data() {
data () {
return { return {
component: 'List', component: 'List',
params: {}, params: {},
include: [] include: []
} }
}, },
components: { components: {
Add, Add,
List, List,
Detail Detail
}, },
mounted () { mounted() {
}, },
methods: { methods: {
onChange (data) { onChange(data) {
if (data.type === 'Add') { if (data.type === 'Add') {
this.component = 'Add' this.component = 'Add'
this.params = data.params this.params = data.params
@@ -61,13 +59,13 @@
} }
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.doc-circulation { .doc-circulation {
height: 100%; height: 100%;
background: #F3F6F9; background: #F3F6F9;
overflow: auto; overflow: auto;
} }
</style> </style>

View File

@@ -1,7 +1,7 @@
<template> <template>
<ai-detail> <ai-detail>
<template slot="title"> <template slot="title">
<ai-title :title="params.id ? '编辑本村简介' : '添加本村简介'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> <ai-title :title="pageTitle" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title> </ai-title>
</template> </template>
<template slot="content"> <template slot="content">
@@ -43,17 +43,19 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default {
export default {
name: 'Add', name: 'Add',
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
params: Object params: Object,
menuName: String
}, },
data () { data() {
return { return {
info: {}, info: {},
form: { form: {
@@ -74,10 +76,10 @@
}, },
computed: { computed: {
...mapState(['user']) ...mapState(['user']),
pageTitle: v => `${!!v.params.id ? '编辑' : '添加'}${v.menuName}`
}, },
created() {
created () {
this.form.areaId = this.user.info.areaId this.form.areaId = this.user.info.areaId
this.disabledLevel = this.user.info.areaList.length this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) { if (this.params && this.params.id) {
@@ -87,7 +89,7 @@
}, },
methods: { methods: {
getInfo (id) { getInfo(id) {
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => { this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data
@@ -96,7 +98,7 @@
}) })
}, },
confirm () { confirm() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, { this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, {
@@ -118,14 +120,14 @@
}) })
}, },
cancel (isRefresh) { cancel(isRefresh) {
this.$emit('change', { this.$emit('change', {
type: 'list', type: 'list',
isRefresh: !!isRefresh isRefresh: !!isRefresh
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -1,7 +1,7 @@
<template> <template>
<ai-list class="notice"> <ai-list class="notice">
<template slot="title"> <template slot="title">
<ai-title title="本村简介" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title> <ai-title :title="menuName" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template> </template>
<template slot="content"> <template slot="content">
<ai-search-bar class="search-bar"> <ai-search-bar class="search-bar">
@@ -57,9 +57,9 @@
props: { props: {
instance: Function, instance: Function,
dict: Object dict: Object,
menuName:String
}, },
data() { data() {
return { return {
search: { search: {

View File

@@ -1,26 +1,27 @@
<template> <template>
<div class="doc-circulation ailist-wrapper"> <div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> <component ref="component" :is="component" @change="onChange" :params="params" v-bind="$props"/>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
<script> <script>
import List from './components/List' import List from './components/List'
import Add from './components/Add' import Add from './components/Add'
import Detail from './components/Detail' import Detail from './components/Detail'
export default { export default {
name: 'AppVillageRegulations', name: 'AppVillageRegulations',
label: '村规民约', label: '村规民约',
props: { props: {
instance: Function, instance: Function,
dict: Object dict: Object,
menuName: {default: "村规民约"}
}, },
data () { data() {
return { return {
component: 'List', component: 'List',
params: {}, params: {},
@@ -34,11 +35,11 @@
Detail Detail
}, },
mounted () { mounted() {
}, },
methods: { methods: {
onChange (data) { onChange(data) {
if (data.type === 'Add') { if (data.type === 'Add') {
this.component = 'Add' this.component = 'Add'
this.params = data.params this.params = data.params
@@ -61,13 +62,13 @@
} }
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.doc-circulation { .doc-circulation {
height: 100%; height: 100%;
background: #F3F6F9; background: #F3F6F9;
overflow: auto; overflow: auto;
} }
</style> </style>

View File

@@ -1,7 +1,7 @@
<template> <template>
<ai-detail> <ai-detail>
<template slot="title"> <template slot="title">
<ai-title :title="params.id ? '编辑村规民约' : '添加村规民约'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> <ai-title :title="pageTitle" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title> </ai-title>
</template> </template>
<template slot="content"> <template slot="content">
@@ -50,7 +50,8 @@
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
params: Object params: Object,
menuName: String
}, },
data () { data () {
@@ -74,7 +75,8 @@
}, },
computed: { computed: {
...mapState(['user']) ...mapState(['user']),
pageTitle: v => `${!!v.params.id ? '编辑' : '添加'}${v.menuName}`
}, },
created () { created () {

View File

@@ -1,7 +1,7 @@
<template> <template>
<ai-list class="notice"> <ai-list class="notice">
<template slot="title"> <template slot="title">
<ai-title title="村规民约" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title> <ai-title :title="menuName" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template> </template>
<template slot="content"> <template slot="content">
<ai-search-bar class="search-bar"> <ai-search-bar class="search-bar">
@@ -51,13 +51,15 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default {
export default {
name: 'List', name: 'List',
props: { props: {
instance: Function, instance: Function,
dict: Object dict: Object,
menuName: String
}, },
data() { data() {
@@ -72,12 +74,12 @@
areaList: [], areaList: [],
total: 10, total: 10,
colConfigs: [ colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' }, {prop: 'title', label: '标题', align: 'left', width: '200px'},
{ prop: 'areaName', label: '地区', align: 'center' }, {prop: 'areaName', label: '地区', align: 'center'},
{ prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' }, {prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布'},
{ prop: 'createUserName', label: '发布人', align: 'center' }, {prop: 'createUserName', label: '发布人', align: 'center'},
{ prop: 'createDate', label: '发布时间', align: 'center' }, {prop: 'createDate', label: '发布时间', align: 'center'},
{ slot: 'options', label: '操作', align: 'center' } {slot: 'options', label: '操作', align: 'center'}
], ],
areaName: '', areaName: '',
unitName: '', unitName: '',
@@ -109,7 +111,7 @@
}) })
}, },
changeStatus (item) { changeStatus(item) {
let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?'; let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?';
this.$confirm(title, {type: 'warning'}).then(() => { this.$confirm(title, {type: 'warning'}).then(() => {
item.status = item.status == '1' ? '0' : '1' item.status = item.status == '1' ? '0' : '1'
@@ -142,10 +144,10 @@
}) })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.notice { .notice {
} }
</style> </style>