LR hace 2 años
padre
commit
70c6631732
Se han modificado 3 ficheros con 36 adiciones y 2 borrados
  1. 2 0
      src/api/common/index.ts
  2. 1 1
      src/utils/constant.ts
  3. 33 1
      src/views/bigScreen/index.vue

+ 2 - 0
src/api/common/index.ts

@@ -61,3 +61,5 @@ export const fetchProjects = () => axios.request<IResult<IOrg[]>>({ url: uris.pr
 
 export const setProjectKey = (id: number) =>
   axios.request<IRes<boolean>>({ url: uris.project.set, method: 'post', data: { prjId: id } })
+
+export const addMenu = (data) => axios.request<IRes<boolean>>({ url: '/base/menu', method: 'post', data })

+ 1 - 1
src/utils/constant.ts

@@ -1,6 +1,6 @@
 import { ElTableColumn } from 'element-ui/types/table-column'
 
-export const gisNames = ['xjxt', 'whxt', 'monitor', 'psjc', 'psxc', 'jcgn']
+export const gisNames = ['spectrum', 'jcgn']
 
 export const pageSizes = [10, 20, 30, 50, 100, 1000]
 

+ 33 - 1
src/views/bigScreen/index.vue

@@ -7,6 +7,7 @@
           <el-input placeholder="请输入查询条件" v-model="keyword">
             <el-button slot="append" icon="el-icon-search"></el-button>
           </el-input>
+          <el-button type="primary" @click="onAddMenu">加菜单</el-button>
         </el-col>
       </el-row>
       <BaseTable :columns="columns" :data="tableData" border style="margin-top: 20px">
@@ -23,7 +24,7 @@ import { Vue, Component } from 'vue-property-decorator'
 import BaseTable from '@/components/BaseTable/index.vue'
 import { ElTableColumn } from 'element-ui/types/table-column'
 import { elTableAlignLeft } from '@/utils/constant'
-import { fetchProjects, IOrg, IProject, setProjectKey } from '@/api/common'
+import { fetchProjects, IOrg, IProject, setProjectKey, addMenu } from '@/api/common'
 
 interface ITableData extends IProject, Omit<IOrg, 'prjList'> {
   orgId: number
@@ -61,6 +62,37 @@ export default class Project extends Vue {
     }
   }
 
+  async onAddMenu() {
+    const data = [
+      { key: 'type', name: '设备类型管理' },
+      { key: 'standard', name: '指标标准管理' },
+      { key: 'device', name: '设备管理' },
+      { key: 'point', name: '监测点管理' },
+      { key: 'team', name: '监测点分组管理' },
+      { key: 'neighbor', name: '监测点上下游管理' }
+    ].map(({ key, name }, index) => {
+      const path = `/spectrum/configuration/${key}`
+      return {
+        sort: 1 + index,
+        name: path,
+        path: path,
+        parentId: 4382,
+        icon: null,
+        type: 'gis',
+        statusFlag: '1',
+        sysId: 52,
+        meta: JSON.stringify({ title: name }),
+        component: path,
+        label: name,
+        widgetid: 'FullPanel',
+        pathId: path,
+        parentPathid: '/spectrum'
+      }
+    })
+    const res = await Promise.all(data.map((item) => addMenu(item)))
+    console.log(res)
+  }
+
   created() {
     this.fetchProject()
   }