From 6a4c36f647e791605979926bbba23f9970750bd1 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 10 十二月 2024 14:47:05 +0800
Subject: [PATCH] Merge branch 'master' of http://47.96.225.205:8888/r/operation_pc-v2

---
 pages/sys/app-menu.vue |  149 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 149 insertions(+), 0 deletions(-)

diff --git a/pages/sys/app-menu.vue b/pages/sys/app-menu.vue
new file mode 100644
index 0000000..e18e7e4
--- /dev/null
+++ b/pages/sys/app-menu.vue
@@ -0,0 +1,149 @@
+<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>

--
Gitblit v1.9.3