Merge branch 'master' of http://47.96.225.205:8888/r/operation_pc-v2
对比新文件 |
| | |
| | | <template> |
| | | <div class="custom-crud-page"> |
| | | <el-bus-crud ref="crud" v-bind="crudConfig"></el-bus-crud> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | crudConfig: { |
| | | url: 'flower/api/app/menu/list', |
| | | hasPagination: false, |
| | | saveQuery: false, |
| | | isTree: true, |
| | | hasView: false, |
| | | deleteMessage: () => '此操作将会删除所有子菜单, 是否继续?', |
| | | beforeOpen(row, isNew) { |
| | | if (isNew && row.menuName) { |
| | | row.parentName = row.menuName |
| | | } |
| | | if (!isNew) { |
| | | row.parentName = '' |
| | | } |
| | | }, |
| | | extraParentKeys: ['parentName'], |
| | | tableAttrs: { |
| | | rowKey: 'id', |
| | | }, |
| | | columns: [ |
| | | { label: '菜单名称', prop: 'menuName' }, |
| | | { |
| | | label: '前端地址', |
| | | prop: 'menuHref', |
| | | }, |
| | | { |
| | | label: '权限唯一标识', |
| | | prop: 'permissionUq', |
| | | |
| | | }, |
| | | { |
| | | label: '子账号权限', |
| | | formatter: (row) => ( |
| | | <el-switch |
| | | value={row.subaccountAccessFlag===1} |
| | | onChange={this.onShownChange.bind(this, row)} |
| | | ></el-switch> |
| | | ), |
| | | }, |
| | | { |
| | | label: '图标', |
| | | formatter: (row) => |
| | | row.menuIcon ? ( |
| | | <i class={row.menuIcon} aria-hidden="true" /> |
| | | ) : null, |
| | | }, |
| | | { label: '排序', prop: 'seq' }, |
| | | ], |
| | | form: [ |
| | | { |
| | | label: '父级节点:', |
| | | id: 'parentName', |
| | | type: 'input', |
| | | readonly: true, |
| | | hidden: (row) => !row.parentName, |
| | | }, |
| | | { |
| | | label: '标题:', |
| | | id: 'menuName', |
| | | type: 'input', |
| | | el: { placeholder: '请输入标题' }, |
| | | rules: { required: true, message: '请输入标题', trigger: 'blur' }, |
| | | }, |
| | | { |
| | | label: '权限唯一标识:', |
| | | id: 'permissionUq', |
| | | type: 'input', |
| | | el: { placeholder: '请输入权限唯一标识' }, |
| | | rules: { required: true, message: '请输入权限唯一标识', trigger: 'blur' }, |
| | | }, |
| | | /* { |
| | | label: '子账号权限:', |
| | | formatter: (row) => ( |
| | | <el-switch |
| | | value={row.subaccountAccessFlag===1} |
| | | onChange={this.onShownChange.bind(this, row)} |
| | | ></el-switch> |
| | | ), |
| | | }, */ |
| | | { |
| | | label: '图标:', |
| | | id: 'menuIcon', |
| | | component: 'base-menu-icon', |
| | | }, |
| | | { |
| | | label: '排序:', |
| | | id: 'seq', |
| | | type: 'input-number', |
| | | el: { |
| | | min: 0, |
| | | precision: 0, |
| | | controlsPosition: 'right', |
| | | placeholder: '请输入排序', |
| | | }, |
| | | }, |
| | | { |
| | | label: '前端地址:', |
| | | id: 'menuHref', |
| | | type: 'input', |
| | | el: { placeholder: '请输入前端地址' }, |
| | | rules: { |
| | | required: true, |
| | | message: '请输入前端地址', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | } |
| | | }, |
| | | head() { |
| | | return { |
| | | title: '菜单管理', |
| | | } |
| | | }, |
| | | methods: { |
| | | onShownChange(row, e) { |
| | | const url = e |
| | | ? 'flower/api/app/menu/tree/shown' |
| | | : 'flower/api/app/menu/tree/hidden' |
| | | const text = e ? '显示' : '隐藏' |
| | | this.$elBusUtil |
| | | .confirm(`确定要${text}这个菜单吗?`) |
| | | .then(async () => { |
| | | const { code } = await this.$elBusHttp.request(url, { |
| | | params: { |
| | | id: row.id, |
| | | }, |
| | | }) |
| | | if (code === 0) { |
| | | this.$message.success(`${text}成功`) |
| | | this.$refs.crud.getList() |
| | | } |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |