增加是否可评论
This commit is contained in:
		| @@ -9,7 +9,8 @@ | ||||
|         <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-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="请选择菜单"> | ||||
| @@ -24,25 +25,30 @@ | ||||
|                 <el-radio label="1">是</el-radio> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="是否可评论" style="width: 100%;" prop="isComment" :rules="[{required: true, message: '请选择是否可评论'}]"> | ||||
|               <el-radio-group v-model="form.isComment"> | ||||
|                 <el-radio v-for="op in dict.getDict('yseOrNo')" :label="op.dictValue">{{ op.dictName }}</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"> | ||||
|           :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"> | ||||
|             :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> | ||||
| @@ -54,130 +60,130 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
| import {mapState} from 'vuex' | ||||
|  | ||||
|   export default { | ||||
|     name: 'Add', | ||||
| export default { | ||||
|   name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|   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' | ||||
|           } | ||||
|   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 | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|  | ||||
|   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"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user