特制化,使标题跟随菜单目录变化
This commit is contained in:
		| @@ -1,73 +1,71 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation ailist-wrapper"> | ||||
|     <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> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import List from './components/List' | ||||
|   import Add from './components/Add' | ||||
|   import Detail from './components/Detail' | ||||
| import List from './components/List' | ||||
| import Add from './components/Add' | ||||
| import Detail from './components/Detail' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppVillageIntroduction', | ||||
|     label: '本村简介', | ||||
| export default { | ||||
|   name: 'AppVillageIntroduction', | ||||
|   label: '本村简介', | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     menuName: {default: "本村简介"} | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       component: 'List', | ||||
|       params: {}, | ||||
|       include: [] | ||||
|     } | ||||
|   }, | ||||
|   components: { | ||||
|     Add, | ||||
|     List, | ||||
|     Detail | ||||
|   }, | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|   mounted() { | ||||
|   }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         component: 'List', | ||||
|         params: {}, | ||||
|         include: [] | ||||
|   methods: { | ||||
|     onChange(data) { | ||||
|       if (data.type === 'Add') { | ||||
|         this.component = 'Add' | ||||
|         this.params = data.params | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     components: { | ||||
|       Add, | ||||
|       List, | ||||
|       Detail | ||||
|     }, | ||||
|       if (data.type === 'Detail') { | ||||
|         this.component = 'Detail' | ||||
|         this.params = data.params | ||||
|       } | ||||
|  | ||||
|     mounted () { | ||||
|     }, | ||||
|       if (data.type === 'list') { | ||||
|         this.component = 'List' | ||||
|         this.params = data.params | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         if (data.type === 'Add') { | ||||
|           this.component = 'Add' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'Detail') { | ||||
|           this.component = 'Detail' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'list') { | ||||
|           this.component = 'List' | ||||
|           this.params = data.params | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             if (data.isRefresh) { | ||||
|               this.$refs.component.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|         this.$nextTick(() => { | ||||
|           if (data.isRefresh) { | ||||
|             this.$refs.component.getList() | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|   .doc-circulation { | ||||
|     height: 100%; | ||||
|     background: #F3F6F9; | ||||
|     overflow: auto; | ||||
|   } | ||||
| .doc-circulation { | ||||
|   height: 100%; | ||||
|   background: #F3F6F9; | ||||
|   overflow: auto; | ||||
| } | ||||
| </style> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="params.id ? '编辑本村简介' : '添加本村简介'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       <ai-title :title="pageTitle" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
| @@ -19,12 +19,12 @@ | ||||
|             </el-form-item> | ||||
|             <el-form-item label="缩略图" prop="thumbUrl"> | ||||
|               <ai-uploader | ||||
|                 :instance="instance" | ||||
|                 isShowTip | ||||
|                 v-model="form.thumbUrl" | ||||
|                 :limit="1" | ||||
|                 :cropOps="cropOps" | ||||
|                 is-crop> | ||||
|                   :instance="instance" | ||||
|                   isShowTip | ||||
|                   v-model="form.thumbUrl" | ||||
|                   :limit="1" | ||||
|                   :cropOps="cropOps" | ||||
|                   is-crop> | ||||
|                 <template slot="tips"> | ||||
|                   <p>最多上传1张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p> | ||||
|                   <p>图片比例:1.6:1</p> | ||||
| @@ -43,89 +43,91 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
|   export default { | ||||
|     name: 'Add', | ||||
| import {mapState} from 'vuex' | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
| export default { | ||||
|   name: 'Add', | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         form: { | ||||
|           title: '', | ||||
|           content: '', | ||||
|           areaId: '', | ||||
|           createUnitName: '', | ||||
|           createUserName: '', | ||||
|           status: '', | ||||
|           thumbUrl: [] | ||||
|         }, | ||||
|         cropOps: { | ||||
|           width: "336px", | ||||
|           height: "210px" | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     params: Object, | ||||
|     menuName: String | ||||
|   }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']) | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.form.areaId = this.user.info.areaId | ||||
|       this.disabledLevel = this.user.info.areaList.length | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|             this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : [] | ||||
|           } | ||||
|         }) | ||||
|   data() { | ||||
|     return { | ||||
|       info: {}, | ||||
|       form: { | ||||
|         title: '', | ||||
|         content: '', | ||||
|         areaId: '', | ||||
|         createUnitName: '', | ||||
|         createUserName: '', | ||||
|         status: '', | ||||
|         thumbUrl: [] | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               type: 0, | ||||
|               createUserName: this.user.info.name, | ||||
|               thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{ | ||||
|                 url: this.form.thumbUrl[0].url | ||||
|               }]) : '' | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 setTimeout(() => { | ||||
|                   this.cancel(true) | ||||
|                 }, 600) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       cropOps: { | ||||
|         width: "336px", | ||||
|         height: "210px" | ||||
|       }, | ||||
|       id: '' | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'list', | ||||
|           isRefresh: !!isRefresh | ||||
|         }) | ||||
|       } | ||||
|   computed: { | ||||
|     ...mapState(['user']), | ||||
|     pageTitle: v => `${!!v.params.id ? '编辑' : '添加'}${v.menuName}` | ||||
|   }, | ||||
|   created() { | ||||
|     this.form.areaId = this.user.info.areaId | ||||
|     this.disabledLevel = this.user.info.areaList.length | ||||
|     if (this.params && this.params.id) { | ||||
|       this.id = this.params.id | ||||
|       this.getInfo(this.params.id) | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     getInfo(id) { | ||||
|       this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => { | ||||
|         if (res.code === 0) { | ||||
|           this.form = res.data | ||||
|           this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : [] | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     confirm() { | ||||
|       this.$refs.form.validate((valid) => { | ||||
|         if (valid) { | ||||
|           this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, { | ||||
|             ...this.form, | ||||
|             type: 0, | ||||
|             createUserName: this.user.info.name, | ||||
|             thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{ | ||||
|               url: this.form.thumbUrl[0].url | ||||
|             }]) : '' | ||||
|           }).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('提交成功') | ||||
|               setTimeout(() => { | ||||
|                 this.cancel(true) | ||||
|               }, 600) | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     cancel(isRefresh) { | ||||
|       this.$emit('change', { | ||||
|         type: 'list', | ||||
|         isRefresh: !!isRefresh | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <template> | ||||
|   <ai-list class="notice"> | ||||
|     <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 slot="content"> | ||||
|       <ai-search-bar class="search-bar"> | ||||
| @@ -57,9 +57,9 @@ | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|       dict: Object, | ||||
|       menuName:String | ||||
|     }, | ||||
|  | ||||
|     data() { | ||||
|       return { | ||||
|         search: { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user