特制化,使标题跟随菜单目录变化
This commit is contained in:
		| @@ -1,73 +1,71 @@ | |||||||
| <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: { | ||||||
|  |     instance: Function, | ||||||
|  |     dict: Object, | ||||||
|  |     menuName: {default: "本村简介"} | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       component: 'List', | ||||||
|  |       params: {}, | ||||||
|  |       include: [] | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   components: { | ||||||
|  |     Add, | ||||||
|  |     List, | ||||||
|  |     Detail | ||||||
|  |   }, | ||||||
|  |  | ||||||
|     props: { |   mounted() { | ||||||
|       instance: Function, |   }, | ||||||
|       dict: Object |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     data () { |   methods: { | ||||||
|       return { |     onChange(data) { | ||||||
|         component: 'List', |       if (data.type === 'Add') { | ||||||
|         params: {}, |         this.component = 'Add' | ||||||
|         include: [] |         this.params = data.params | ||||||
|       } |       } | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     components: { |       if (data.type === 'Detail') { | ||||||
|       Add, |         this.component = 'Detail' | ||||||
|       List, |         this.params = data.params | ||||||
|       Detail |       } | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     mounted () { |       if (data.type === 'list') { | ||||||
|     }, |         this.component = 'List' | ||||||
|  |         this.params = data.params | ||||||
|  |  | ||||||
|     methods: { |         this.$nextTick(() => { | ||||||
|       onChange (data) { |           if (data.isRefresh) { | ||||||
|         if (data.type === 'Add') { |             this.$refs.component.getList() | ||||||
|           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() |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | } | ||||||
| </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> | ||||||
|   | |||||||
| @@ -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"> | ||||||
| @@ -19,12 +19,12 @@ | |||||||
|             </el-form-item> |             </el-form-item> | ||||||
|             <el-form-item label="缩略图" prop="thumbUrl"> |             <el-form-item label="缩略图" prop="thumbUrl"> | ||||||
|               <ai-uploader |               <ai-uploader | ||||||
|                 :instance="instance" |                   :instance="instance" | ||||||
|                 isShowTip |                   isShowTip | ||||||
|                 v-model="form.thumbUrl" |                   v-model="form.thumbUrl" | ||||||
|                 :limit="1" |                   :limit="1" | ||||||
|                 :cropOps="cropOps" |                   :cropOps="cropOps" | ||||||
|                 is-crop> |                   is-crop> | ||||||
|                 <template slot="tips"> |                 <template slot="tips"> | ||||||
|                   <p>最多上传1张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p> |                   <p>最多上传1张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p> | ||||||
|                   <p>图片比例:1.6:1</p> |                   <p>图片比例:1.6:1</p> | ||||||
| @@ -43,89 +43,91 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   import { mapState } from 'vuex' | import {mapState} from 'vuex' | ||||||
|   export default { |  | ||||||
|     name: 'Add', |  | ||||||
|  |  | ||||||
|     props: { | export default { | ||||||
|       instance: Function, |   name: 'Add', | ||||||
|       dict: Object, |  | ||||||
|       params: Object |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     data () { |   props: { | ||||||
|       return { |     instance: Function, | ||||||
|         info: {}, |     dict: Object, | ||||||
|         form: { |     params: Object, | ||||||
|           title: '', |     menuName: String | ||||||
|           content: '', |   }, | ||||||
|           areaId: '', |  | ||||||
|           createUnitName: '', |  | ||||||
|           createUserName: '', |  | ||||||
|           status: '', |  | ||||||
|           thumbUrl: [] |  | ||||||
|         }, |  | ||||||
|         cropOps: { |  | ||||||
|           width: "336px", |  | ||||||
|           height: "210px" |  | ||||||
|         }, |  | ||||||
|         id: '' |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     computed: { |   data() { | ||||||
|       ...mapState(['user']) |     return { | ||||||
|     }, |       info: {}, | ||||||
|  |       form: { | ||||||
|     created () { |         title: '', | ||||||
|       this.form.areaId = this.user.info.areaId |         content: '', | ||||||
|       this.disabledLevel = this.user.info.areaList.length |         areaId: '', | ||||||
|       if (this.params && this.params.id) { |         createUnitName: '', | ||||||
|         this.id = this.params.id |         createUserName: '', | ||||||
|         this.getInfo(this.params.id) |         status: '', | ||||||
|       } |         thumbUrl: [] | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     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) : [] |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }, |       }, | ||||||
|  |       cropOps: { | ||||||
|       confirm () { |         width: "336px", | ||||||
|         this.$refs.form.validate((valid) => { |         height: "210px" | ||||||
|           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) |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }, |       }, | ||||||
|  |       id: '' | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|       cancel (isRefresh) { |   computed: { | ||||||
|         this.$emit('change', { |     ...mapState(['user']), | ||||||
|           type: 'list', |     pageTitle: v => `${!!v.params.id ? '编辑' : '添加'}${v.menuName}` | ||||||
|           isRefresh: !!isRefresh |   }, | ||||||
|         }) |   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> | </script> | ||||||
|  |  | ||||||
| <style scoped lang="scss"> | <style scoped lang="scss"> | ||||||
|   | |||||||
| @@ -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: { | ||||||
|   | |||||||
| @@ -1,73 +1,74 @@ | |||||||
| <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: {}, | ||||||
|         include: [] |       include: [] | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   components: { | ||||||
|  |     Add, | ||||||
|  |     List, | ||||||
|  |     Detail | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   mounted() { | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   methods: { | ||||||
|  |     onChange(data) { | ||||||
|  |       if (data.type === 'Add') { | ||||||
|  |         this.component = 'Add' | ||||||
|  |         this.params = data.params | ||||||
|       } |       } | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     components: { |       if (data.type === 'Detail') { | ||||||
|       Add, |         this.component = 'Detail' | ||||||
|       List, |         this.params = data.params | ||||||
|       Detail |       } | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     mounted () { |       if (data.type === 'list') { | ||||||
|     }, |         this.component = 'List' | ||||||
|  |         this.params = data.params | ||||||
|  |  | ||||||
|     methods: { |         this.$nextTick(() => { | ||||||
|       onChange (data) { |           if (data.isRefresh) { | ||||||
|         if (data.type === 'Add') { |             this.$refs.component.getList() | ||||||
|           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() |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | } | ||||||
| </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> | ||||||
|   | |||||||
| @@ -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 () { | ||||||
|   | |||||||
| @@ -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"> | ||||||
| @@ -10,25 +10,25 @@ | |||||||
|         </template> |         </template> | ||||||
|         <template #right> |         <template #right> | ||||||
|           <el-input |           <el-input | ||||||
|             v-model="search.title" |               v-model="search.title" | ||||||
|             class="search-input" |               class="search-input" | ||||||
|             size="small" |               size="small" | ||||||
|             v-throttle="() => {search.current=1,getList()}" |               v-throttle="() => {search.current=1,getList()}" | ||||||
|             placeholder="请输入标题" |               placeholder="请输入标题" | ||||||
|             clearable |               clearable | ||||||
|             @clear="search.current = 1, search.title = '', getList()" |               @clear="search.current = 1, search.title = '', getList()" | ||||||
|             suffix-icon="iconfont iconSearch"> |               suffix-icon="iconfont iconSearch"> | ||||||
|           </el-input> |           </el-input> | ||||||
|         </template> |         </template> | ||||||
|       </ai-search-bar> |       </ai-search-bar> | ||||||
|       <ai-table |       <ai-table | ||||||
|         :tableData="tableData" |           :tableData="tableData" | ||||||
|         :col-configs="colConfigs" |           :col-configs="colConfigs" | ||||||
|         :total="total" |           :total="total" | ||||||
|         style="margin-top: 6px;" |           style="margin-top: 6px;" | ||||||
|         :current.sync="search.current" |           :current.sync="search.current" | ||||||
|         :size.sync="search.size" |           :size.sync="search.size" | ||||||
|         @getList="getList"> |           @getList="getList"> | ||||||
|         <el-table-column slot="tags" label="标签"> |         <el-table-column slot="tags" label="标签"> | ||||||
|           <template slot-scope="{ row }"> |           <template slot-scope="{ row }"> | ||||||
|             <div class="table-tags"> |             <div class="table-tags"> | ||||||
| @@ -51,101 +51,103 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   import { mapState } from 'vuex' | import {mapState} from 'vuex' | ||||||
|   export default { |  | ||||||
|     name: 'List', |  | ||||||
|  |  | ||||||
|     props: { | export default { | ||||||
|       instance: Function, |   name: 'List', | ||||||
|       dict: Object |  | ||||||
|  |   props: { | ||||||
|  |     instance: Function, | ||||||
|  |     dict: Object, | ||||||
|  |     menuName: String | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       search: { | ||||||
|  |         current: 1, | ||||||
|  |         size: 10, | ||||||
|  |         title: '', | ||||||
|  |         areaId: '' | ||||||
|  |       }, | ||||||
|  |       currIndex: -1, | ||||||
|  |       areaList: [], | ||||||
|  |       total: 10, | ||||||
|  |       colConfigs: [ | ||||||
|  |         {prop: 'title', label: '标题', align: 'left', width: '200px'}, | ||||||
|  |         {prop: 'areaName', label: '地区', align: 'center'}, | ||||||
|  |         {prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布'}, | ||||||
|  |         {prop: 'createUserName', label: '发布人', align: 'center'}, | ||||||
|  |         {prop: 'createDate', label: '发布时间', align: 'center'}, | ||||||
|  |         {slot: 'options', label: '操作', align: 'center'} | ||||||
|  |       ], | ||||||
|  |       areaName: '', | ||||||
|  |       unitName: '', | ||||||
|  |       tableData: [] | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   computed: { | ||||||
|  |     ...mapState(['user']) | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   mounted() { | ||||||
|  |     this.search.areaId = this.user.info.areaId | ||||||
|  |     this.getList() | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   methods: { | ||||||
|  |     getList() { | ||||||
|  |       this.instance.post(`/app/appcountrysidetourism/list`, null, { | ||||||
|  |         params: { | ||||||
|  |           type: 4, | ||||||
|  |           ...this.search | ||||||
|  |         } | ||||||
|  |       }).then(res => { | ||||||
|  |         if (res.code == 0) { | ||||||
|  |           this.tableData = res.data.records | ||||||
|  |           this.total = res.data.total | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     data() { |     changeStatus(item) { | ||||||
|       return { |       let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?'; | ||||||
|         search: { |       this.$confirm(title, {type: 'warning'}).then(() => { | ||||||
|           current: 1, |         item.status = item.status == '1' ? '0' : '1' | ||||||
|           size: 10, |         this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => { | ||||||
|           title: '', |           if (res && res.code == 0) { | ||||||
|           areaId: '' |             title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功') | ||||||
|         }, |             this.getList() | ||||||
|         currIndex: -1, |  | ||||||
|         areaList: [], |  | ||||||
|         total: 10, |  | ||||||
|         colConfigs: [ |  | ||||||
|           { prop: 'title',  label: '标题', align: 'left', width: '200px' }, |  | ||||||
|           { prop: 'areaName', label: '地区', align: 'center' }, |  | ||||||
|           { prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' }, |  | ||||||
|           { prop: 'createUserName', label: '发布人', align: 'center' }, |  | ||||||
|           { prop: 'createDate', label: '发布时间', align: 'center' }, |  | ||||||
|           { slot: 'options', label: '操作', align: 'center' } |  | ||||||
|         ], |  | ||||||
|         areaName: '', |  | ||||||
|         unitName: '', |  | ||||||
|         tableData: [] |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     computed: { |  | ||||||
|       ...mapState(['user']) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     mounted() { |  | ||||||
|       this.search.areaId = this.user.info.areaId |  | ||||||
|       this.getList() |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     methods: { |  | ||||||
|       getList() { |  | ||||||
|         this.instance.post(`/app/appcountrysidetourism/list`, null, { |  | ||||||
|           params: { |  | ||||||
|             type: 4, |  | ||||||
|             ...this.search |  | ||||||
|           } |           } | ||||||
|         }).then(res => { |         }) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     remove(id) { | ||||||
|  |       this.$confirm('确定删除该数据?').then(() => { | ||||||
|  |         this.instance.post(`/app/appcountrysidetourism/delete?ids=${id}`).then(res => { | ||||||
|           if (res.code == 0) { |           if (res.code == 0) { | ||||||
|             this.tableData = res.data.records |             this.$message.success('删除成功!') | ||||||
|             this.total = res.data.total |             this.getList() | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|       }, |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|       changeStatus (item) { |     toAdd(id) { | ||||||
|         let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?'; |       this.$emit('change', { | ||||||
|         this.$confirm(title, {type: 'warning'}).then(() => { |         type: 'Add', | ||||||
|           item.status = item.status == '1' ? '0' : '1' |         params: { | ||||||
|           this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => { |           id: id || '' | ||||||
|             if (res && res.code == 0) { |         } | ||||||
|               title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功') |       }) | ||||||
|               this.getList() |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         }) |  | ||||||
|       }, |  | ||||||
|  |  | ||||||
|       remove(id) { |  | ||||||
|         this.$confirm('确定删除该数据?').then(() => { |  | ||||||
|           this.instance.post(`/app/appcountrysidetourism/delete?ids=${id}`).then(res => { |  | ||||||
|             if (res.code == 0) { |  | ||||||
|               this.$message.success('删除成功!') |  | ||||||
|               this.getList() |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         }) |  | ||||||
|       }, |  | ||||||
|  |  | ||||||
|       toAdd(id) { |  | ||||||
|         this.$emit('change', { |  | ||||||
|           type: 'Add', |  | ||||||
|           params: { |  | ||||||
|             id: id || '' |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | } | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
|   .notice { | .notice { | ||||||
|   } | } | ||||||
| </style> | </style> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user