数字平昌
This commit is contained in:
		
							
								
								
									
										70
									
								
								project/shuzipingchang/app/AppSubjectSet/AppSubjectSet.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								project/shuzipingchang/app/AppSubjectSet/AppSubjectSet.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| <template> | ||||
|   <div class="AppSubjectSet"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <component | ||||
|         ref="component" | ||||
|         :is="component" | ||||
|         @change="onChange" | ||||
|         :params="params" | ||||
|         :instance="instance" | ||||
|         :dict="dict" | ||||
|       ></component> | ||||
|     </keep-alive> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import List from "./components/List"; | ||||
| import Add from "./components/Add"; | ||||
|  | ||||
| export default { | ||||
|   name: "AppSubjectSet", | ||||
|   label: "话题设置", | ||||
|  | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|   }, | ||||
|  | ||||
|   data() { | ||||
|     return { | ||||
|       component: "List", | ||||
|       params: {}, | ||||
|       include: [], | ||||
|     }; | ||||
|   }, | ||||
|  | ||||
|   components: { | ||||
|     Add, | ||||
|     List, | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     onChange(data) { | ||||
|       if (data.type === "Add") { | ||||
|         this.component = "Add"; | ||||
|         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"> | ||||
| .AppSubjectSet { | ||||
|   height: 100%; | ||||
|   background: #f3f6f9; | ||||
|   overflow: auto; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										128
									
								
								project/shuzipingchang/app/AppSubjectSet/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								project/shuzipingchang/app/AppSubjectSet/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,128 @@ | ||||
| <template> | ||||
|   <ai-detail class="content-add"> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="params.id ? '编辑话题' : '添加话题'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|           <el-form class="ai-form" :model="form" label-width="120px" ref="form"> | ||||
|             <el-form-item prop="title" style="width: 100%;" label="话题名称" :rules="[{required: true, message: '请输入话题名称', trigger: 'change'}]"> | ||||
|               <el-input size="small" placeholder='如“社会保障”仅限4个字' v-model="form.title" maxlength="4" :show-word-limit="true"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="showIndex" style="width: 100%;" label="排序" :rules="[{required: true, message: '请输入排序', trigger: 'change'}]"> | ||||
|               <el-input-number v-model="form.showIndex" :min="1" :max="100" size="small"></el-input-number> | ||||
|               <span class="tips">请输入数字,数字越小排序越前</span> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="话题描述" prop="description" style="width: 100%;" :rules="[{required: true, message: '请输入发布内容', trigger: 'change'}]"> | ||||
|               <el-input type="textarea" placeholder="限500字" v-model="form.description" rows="8" maxlength="500" :show-word-limit="true"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="话题图标" prop="files" style="width: 100%;" :rules="[{required: true, message: '请上传话题图标', trigger: 'change'}]"> | ||||
|               <ai-uploader | ||||
|                 :instance="instance" | ||||
|                 v-model="form.files" | ||||
|                 isShowTip | ||||
|                 :limit="1"> | ||||
|               </ai-uploader> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="status" style="width: 100%;" label="是否启用" :rules="[{required: true}]"> | ||||
|               <el-radio-group v-model="form.status"> | ||||
|                 <el-radio label="1">是</el-radio> | ||||
|                 <el-radio label="0">否</el-radio> | ||||
|               </el-radio-group> | ||||
|             </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 | ||||
|     }, | ||||
|     data () { | ||||
|       return { | ||||
|         form: { | ||||
|           title: '', | ||||
|           showIndex: '', | ||||
|           description: '', | ||||
|           files: [], | ||||
|           picUrl: '', | ||||
|           status: '1', | ||||
|         }, | ||||
|         isFlag: false | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']) | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appneighborhoodassistancetheme/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|             this.form.files = [{url: res.data.picUrl}] | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         if(this.isFlag) return | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.isFlag = true | ||||
|             this.instance.post(`/app/appneighborhoodassistancetheme/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               picUrl: this.form.files[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"> | ||||
|   .tips { | ||||
|     display: inline-block; | ||||
|     margin-left: 8px; | ||||
|     color: #999; | ||||
|     font-size: 12px; | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										144
									
								
								project/shuzipingchang/app/AppSubjectSet/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								project/shuzipingchang/app/AppSubjectSet/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,144 @@ | ||||
| <template> | ||||
|   <ai-list class="notice"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="话题设置" isShowBottomBorder> | ||||
|       </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="status" width="120px" label="是否启用" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <el-switch v-model="row.status" @change="changeStatus(row)" active-value="1" inactive-value="0"></el-switch> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="180px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <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> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           title: '', | ||||
|           status: '' | ||||
|         }, | ||||
|         total: 10, | ||||
|         colConfigs: [ | ||||
|           { prop: 'title',  label: '话题名称', align: 'left', width: '200' }, | ||||
|           { prop: 'description',  label: '话题描述', align: 'left', 'show-overflow-tooltip': true}, | ||||
|           { prop: 'partakeCount',  label: '参与话题数', align: 'center', width: '120' }, | ||||
|           { prop: 'showIndex',  label: '排序', align: 'center', width: '120' }, | ||||
|           { prop: 'createUserName',  label: '创建人', align: 'center', width: '120' }, | ||||
|           { prop: 'createTime',  label: '创建时间', align: 'center', width: '180' }, | ||||
|           { slot: 'status'}, | ||||
|           { slot: 'options'}, | ||||
|         ], | ||||
|         tableData: [], | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created() { | ||||
|       this.getList() | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getList() { | ||||
|         this.instance.post(`/app/appneighborhoodassistancetheme/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       remove (id) { | ||||
|         this.$confirm('确定删除该话题?').then(() => { | ||||
|           this.instance.post(`/app/appneighborhoodassistancetheme/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       toAdd(id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Add', | ||||
|           params: { | ||||
|             id: id || '' | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       changeStatus(row) { | ||||
|         this.$confirm(`确定${row.status == 1 ? '启用' : '关闭'}该话题?`).then(() => { | ||||
|           this.instance.post(`/app/appneighborhoodassistancetheme/enable?id=${row.id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('操作成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }).catch(() => { | ||||
|           this.getList() | ||||
|         }) | ||||
|         // this.instance.post(`/app/appneighborhoodassistancetheme/enable?id=${row.id}`).then(res => { | ||||
|         //   if (res.code == 0) { | ||||
|         //     this.$message.success('操作成功!') | ||||
|         //     this.getList() | ||||
|         //   } | ||||
|         // }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user