目录代码整合
This commit is contained in:
		
							
								
								
									
										184
									
								
								packages/publicity/AppContentManage/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								packages/publicity/AppContentManage/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,184 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <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 label="模块名称" style="width: 100%;" prop="moduleName" :rules="[{required: true, message: '请输入模块名称', trigger: 'blur'}]"> | ||||
|               <el-input type="input" style="width: 300px" size="small" v-model="form.moduleName" clearable placeholder="请输入模块名称" maxlength="30" show-word-limit></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="menuName" label="菜单名称" :rules="[{required: true, message: '请选择菜单', trigger: 'change'}]"> | ||||
|               <el-input type="input" style="width: 300px" disabled size="small" v-model="form.menuName" clearable placeholder="请选择菜单"> | ||||
|                 <template slot="append"> | ||||
|                   <el-button size="small" @click="showAdd">选择</el-button> | ||||
|                 </template> | ||||
|               </el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="是否审核" style="width: 100%;" prop="needExamine" :rules="[{required: true, message: '请选择是否审核', trigger: 'change'}]"> | ||||
|               <el-radio-group v-model="form.needExamine"> | ||||
|                 <el-radio label="0">否</el-radio> | ||||
|                 <el-radio label="1">是</el-radio> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|       <ai-dialog | ||||
|         :visible.sync="isShowAdd" | ||||
|         width="880px" | ||||
|         height="580px" | ||||
|         title="选择菜单" | ||||
|         @close="onClose" | ||||
|         @onConfirm="onConfirm"> | ||||
|         <el-tree | ||||
|           :data="treeData" | ||||
|           node-key="id" | ||||
|           ref="tree" | ||||
|           @node-click="onChange" | ||||
|           highlight-current | ||||
|           :default-expanded-keys="defaultExpandedKeys" | ||||
|           :default-checked-keys="defaulCheckedKeys" | ||||
|           :props="defaultProps"> | ||||
|         </el-tree> | ||||
|       </ai-dialog> | ||||
|     </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 { | ||||
|         info: {}, | ||||
|         form: { | ||||
|           moduleName: '', | ||||
|           menuId: '', | ||||
|           menuName: '', | ||||
|           needExamine: '0' | ||||
|         }, | ||||
|         isShowAdd: false, | ||||
|         treeData: [], | ||||
|         id: '', | ||||
|         chooseNode: {}, | ||||
|         defaultExpandedKeys: [], | ||||
|         defaulCheckedKeys: [], | ||||
|         defaultProps: { | ||||
|           children: 'subSet', | ||||
|           label: 'name', | ||||
|           disabled: e => { | ||||
|             return e.type !== '1' | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']) | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.getMenuList() | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appcontentmoduleinfo/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       showAdd () { | ||||
|         this.isShowAdd = true | ||||
|  | ||||
|         this.$nextTick(() => { | ||||
|           this.$refs.tree.setCurrentKey(this.form.menuId) | ||||
|           this.defaultExpandedKeys = [this.form.menuId] | ||||
|           this.chooseNode = { | ||||
|             menuId: this.form.menuId, | ||||
|             menuName: this.form.menuName, | ||||
|             type: '1' | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onClose () { | ||||
|  | ||||
|       }, | ||||
|  | ||||
|       onConfirm () { | ||||
|         if (this.chooseNode.type === '1') { | ||||
|           this.form.menuId = this.chooseNode.id | ||||
|           this.form.menuName = this.chooseNode.name | ||||
|  | ||||
|           this.isShowAdd = false | ||||
|         } else { | ||||
|           this.$message.error('无法选择') | ||||
|         } | ||||
|       }, | ||||
|  | ||||
|       onChange (e) { | ||||
|         this.chooseNode = e | ||||
|       }, | ||||
|  | ||||
|       getMenuList () { | ||||
|         this.instance.post(`/admin/menu/menuTree?containPermission=0`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.treeData = res.data | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appcontentmoduleinfo/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               id: this.params.id || '' | ||||
|             }).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> | ||||
							
								
								
									
										63
									
								
								packages/publicity/AppContentManage/components/Detail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								packages/publicity/AppContentManage/components/Detail.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -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> | ||||
							
								
								
									
										227
									
								
								packages/publicity/AppContentManage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										227
									
								
								packages/publicity/AppContentManage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,227 @@ | ||||
| <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> | ||||
|       </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="options" width="160px" 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="moduleId = row.id, form.moduleId = row.id, getCateList(),  isShowAdd = true">分类</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <ai-dialog | ||||
|         :visible.sync="isShowAdd" | ||||
|         width="880px" | ||||
|         height="580px" | ||||
|         title="文章分类" | ||||
|         @close="onClose" | ||||
|         @onConfirm="onConfirm(false)"> | ||||
|         <el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right"> | ||||
|           <el-form-item label="分类名称" style="width: 500px;" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]"> | ||||
|             <div class="catewrapper"> | ||||
|               <el-input  size="small" style="width: 300px;" placeholder="请输入分类名称" v-model="form.categoryName"> | ||||
|               </el-input> | ||||
|               <el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" v-if="!id" @click="onConfirm(true)">添加</el-button> | ||||
|             </div> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|         <ai-table | ||||
|           v-if="!id" | ||||
|           class="detail-table__table" | ||||
|           :border="true" | ||||
|           tableSize="small" | ||||
|           :total="cateTotal" | ||||
|           :tableData="cateList" | ||||
|           :col-configs="cateColConfigs" | ||||
|           :current.sync="cateSearch.current" | ||||
|           :size.sync="cateSearch.size" | ||||
|           :stripe="false" | ||||
|           @getList="getCateList"> | ||||
|           <el-table-column slot="options" width="220px" fixed="right" label="操作" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <div class="table-options"> | ||||
|                 <el-button type="text" @click="id = row.id, form.categoryName = row.categoryName">编辑</el-button> | ||||
|                 <el-button type="text" @click="removeCate(row.id)">删除</el-button> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data() { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           title: '' | ||||
|         }, | ||||
|         moduleId: '', | ||||
|         cateSearch: { | ||||
|           current: 1, | ||||
|           size: 10 | ||||
|         }, | ||||
|         total: 10, | ||||
|         cateList: [], | ||||
|         colConfigs: [ | ||||
|           { prop: 'moduleName',  label: '模块名称', align: 'left', width: '200px' }, | ||||
|           { prop: 'menuName', label: '关联菜单', align: 'center' }, | ||||
|           { prop: 'categoryStr', label: '文章分类', align: 'center' }, | ||||
|           { prop: 'needExamine', label: '是否审核', align: 'center', formart: v => v === '0' ? '否' : '是' } | ||||
|         ], | ||||
|         cateColConfigs: [ | ||||
|           {prop: 'categoryName', label: '分类名称', align: 'center'} | ||||
|         ], | ||||
|         form: { | ||||
|           categoryName: '', | ||||
|           moduleId: '', | ||||
|           showIndex: 1 | ||||
|         }, | ||||
|         cateTotal: 0, | ||||
|         isShowAdd: false, | ||||
|         id: '', | ||||
|         tableData: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     mounted() { | ||||
|       this.getList() | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getList() { | ||||
|         this.instance.post(`/app/appcontentmoduleinfo/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       getCateList () { | ||||
|         this.instance.post(`/app/appcontentmodulecategory/list`, null, { | ||||
|           params: { | ||||
|             ...this.cateSearch, | ||||
|             moduleId: this.moduleId | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.cateList = res.data.records | ||||
|             this.cateTotal = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       removeCate(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appcontentmodulecategory/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|               this.getCateList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       remove(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appcontentmoduleinfo/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onConfirm (flag) { | ||||
|         if (!flag && !this.id) { | ||||
|           this.isShowAdd = false | ||||
|  | ||||
|           return false | ||||
|         } | ||||
|  | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appcontentmodulecategory/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               id: this.id || '' | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 this.getList() | ||||
|                 this.getCateList() | ||||
|                 this.form.categoryName = '' | ||||
|  | ||||
|                 if (this.id) { | ||||
|                   this.id = '' | ||||
|  | ||||
|                   return false | ||||
|                 } | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onClose () { | ||||
|         this.id = '' | ||||
|         this.moduleId = '' | ||||
|         this.form.categoryName = '' | ||||
|         this.form.moduleId = '' | ||||
|       }, | ||||
|  | ||||
|       toAdd(id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Add', | ||||
|           params: { | ||||
|             id: id || '' | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   .notice { | ||||
|     .catewrapper { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|     } | ||||
|   } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user