党员阵地
This commit is contained in:
		
							
								
								
									
										74
									
								
								project/pingchang/apps/AppCommunityInfo/AppCommunityInfo.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								project/pingchang/apps/AppCommunityInfo/AppCommunityInfo.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation ailist-wrapper"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <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' | ||||
|  | ||||
| export default { | ||||
|   name: 'AppCommunityInfo', | ||||
|   label: '党员阵地', | ||||
|  | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     menuName: {default: "党员阵地"} | ||||
|   }, | ||||
|  | ||||
|   data() { | ||||
|     return { | ||||
|       component: 'List', | ||||
|       params: {}, | ||||
|       include: [] | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   components: { | ||||
|     Add, | ||||
|     List, | ||||
|     Detail | ||||
|   }, | ||||
|  | ||||
|   mounted() { | ||||
|   }, | ||||
|  | ||||
|   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() | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
| .doc-circulation { | ||||
|   height: 100%; | ||||
|   background: #F3F6F9; | ||||
|   overflow: auto; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										134
									
								
								project/pingchang/apps/AppCommunityInfo/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								project/pingchang/apps/AppCommunityInfo/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="pageTitle" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|           <el-form :model="form" label-width="120px" ref="form"> | ||||
|             <el-form-item label="标题" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]"> | ||||
|               <el-input type="input" v-model="form.title" clearable placeholder="请输入..." maxlength="30" show-word-limit></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="areaId" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]"> | ||||
|               <ai-area-select clearable always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="正文" prop="content" :rules="[{required: true, message: '请输入内容', trigger: 'change'}]"> | ||||
|               <ai-editor v-model="form.content" :instance="instance"/> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="缩略图" prop="thumbUrl"> | ||||
|               <ai-uploader | ||||
|                 :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> | ||||
|                 </template> | ||||
|               </ai-uploader> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|     <template #footer> | ||||
|       <el-button @click="cancel">取消</el-button> | ||||
|       <el-button type="primary" @click="confirm">提交</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
|   export default { | ||||
|     name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object, | ||||
|       menuName: String | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         form: { | ||||
|           title: '', | ||||
|           content: '', | ||||
|           areaId: '', | ||||
|           createUnitName: '', | ||||
|           createUserName: '', | ||||
|           status: '', | ||||
|           thumbUrl: [] | ||||
|         }, | ||||
|         cropOps: { | ||||
|           width: "336px", | ||||
|           height: "210px" | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     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: 5, | ||||
|               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"> | ||||
| </style> | ||||
| @@ -0,0 +1,63 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'Detail', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|             this.form.codeUrl = [{ | ||||
|               url: res.data.codeUrl | ||||
|             }] | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'list', | ||||
|           isRefresh: !!isRefresh | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| </style> | ||||
							
								
								
									
										153
									
								
								project/pingchang/apps/AppCommunityInfo/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								project/pingchang/apps/AppCommunityInfo/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,153 @@ | ||||
| <template> | ||||
|   <ai-list class="notice"> | ||||
|     <template slot="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"> | ||||
|         <template #left> | ||||
|           <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button> | ||||
|         </template> | ||||
|         <template #right> | ||||
|           <el-input | ||||
|               v-model="search.title" | ||||
|               class="search-input" | ||||
|               size="small" | ||||
|               v-throttle="() => {search.current=1,getList()}" | ||||
|               placeholder="请输入标题" | ||||
|               clearable | ||||
|               @clear="search.current = 1, search.title = '', getList()" | ||||
|               suffix-icon="iconfont iconSearch"> | ||||
|           </el-input> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|           :tableData="tableData" | ||||
|           :col-configs="colConfigs" | ||||
|           :total="total" | ||||
|           style="margin-top: 6px;" | ||||
|           :current.sync="search.current" | ||||
|           :size.sync="search.size" | ||||
|           @getList="getList"> | ||||
|         <el-table-column slot="tags" 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> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="220px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" :title="row.status == 1 ? '取消发布' : '发布'" @click="changeStatus(row)">{{ row.status == 1 ? '取消发布' : '发布' }}</el-button> | ||||
|               <el-button type="text" @click="toAdd(row.id)">编辑</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import {mapState} from 'vuex' | ||||
|  | ||||
| export default { | ||||
|   name: 'List', | ||||
|  | ||||
|   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: 5, | ||||
|           ...this.search | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if (res.code == 0) { | ||||
|           this.tableData = res.data.records | ||||
|           this.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     changeStatus(item) { | ||||
|       let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?'; | ||||
|       this.$confirm(title, {type: 'warning'}).then(() => { | ||||
|         item.status = item.status == '1' ? '0' : '1' | ||||
|         this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => { | ||||
|           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> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .notice { | ||||
| } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user