内容管理
This commit is contained in:
		| @@ -11,19 +11,34 @@ | |||||||
|             <el-form-item label="模块名称" style="width: 100%;" prop="moduleName" :rules="[{required: true, message: '请输入模块名称', trigger: 'blur'}]"> |             <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> | ||||||
|             <el-form-item prop="menuId" label="菜单名称" :rules="[{required: true, message: '请选择菜单', trigger: 'change'}]"> |             <el-form-item prop="menuName" label="菜单名称" :rules="[{required: true, message: '请选择菜单', trigger: 'change'}]"> | ||||||
|                <el-select size="small" style="width: 300px" v-model="form.menuId" placeholder="请选择菜单"> |               <el-input type="input" style="width: 300px" disabled size="small" v-model="form.menuName" clearable placeholder="请选择菜单"> | ||||||
|                   <el-option |                 <template slot="append"> | ||||||
|                     v-for="item in memuList" |                   <el-button size="small" @click="showAdd">选择</el-button> | ||||||
|                     :key="item.id" |                 </template> | ||||||
|                     :label="item.name" |               </el-input> | ||||||
|                     :value="item.id"> |  | ||||||
|                   </el-option> |  | ||||||
|                 </el-select> |  | ||||||
|             </el-form-item> |             </el-form-item> | ||||||
|           </el-form> |           </el-form> | ||||||
|         </template> |         </template> | ||||||
|       </ai-card> |       </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> | ||||||
|     <template #footer> |     <template #footer> | ||||||
|       <el-button @click="cancel">取消</el-button> |       <el-button @click="cancel">取消</el-button> | ||||||
| @@ -34,6 +49,7 @@ | |||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   import { mapState } from 'vuex' |   import { mapState } from 'vuex' | ||||||
|  |  | ||||||
|   export default { |   export default { | ||||||
|     name: 'Add', |     name: 'Add', | ||||||
|  |  | ||||||
| @@ -48,10 +64,22 @@ | |||||||
|         info: {}, |         info: {}, | ||||||
|         form: { |         form: { | ||||||
|           moduleName: '', |           moduleName: '', | ||||||
|           menuId: '' |           menuId: '', | ||||||
|  |           menuName: '' | ||||||
|         }, |         }, | ||||||
|  |         isShowAdd: false, | ||||||
|  |         treeData: [], | ||||||
|         id: '', |         id: '', | ||||||
|         memuList: [] |         chooseNode: {}, | ||||||
|  |         defaultExpandedKeys: [], | ||||||
|  |         defaulCheckedKeys: [], | ||||||
|  |         defaultProps: { | ||||||
|  |           children: 'subSet', | ||||||
|  |           label: 'name', | ||||||
|  |           disabled: e => { | ||||||
|  |             return e.type !== '1' | ||||||
|  |           } | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
| @@ -76,10 +104,43 @@ | |||||||
|         }) |         }) | ||||||
|       }, |       }, | ||||||
|  |  | ||||||
|  |       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 () { |       getMenuList () { | ||||||
|         this.instance.post(`/admin/menu/menuTree?containPermission=0`).then(res => { |         this.instance.post(`/admin/menu/menuTree?containPermission=0`).then(res => { | ||||||
|           if (res.code === 0) { |           if (res.code === 0) { | ||||||
|             this.memuList = res.data |             this.treeData = res.data | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|       }, |       }, | ||||||
| @@ -89,7 +150,6 @@ | |||||||
|           if (valid) { |           if (valid) { | ||||||
|             this.instance.post(`/app/appcontentmoduleinfo/addOrUpdate`, { |             this.instance.post(`/app/appcontentmoduleinfo/addOrUpdate`, { | ||||||
|               ...this.form, |               ...this.form, | ||||||
|               menuName: this.memuList.filter(v => v.id === this.form.menuId)[0].name, |  | ||||||
|               id: this.params.id || '' |               id: this.params.id || '' | ||||||
|             }).then(res => { |             }).then(res => { | ||||||
|               if (res.code == 0) { |               if (res.code == 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user