|
@@ -17,7 +17,7 @@
|
|
|
default-expand-all
|
|
|
:tree-props="{ children: 'pages' }"
|
|
|
>
|
|
|
- <el-table-column prop="moduleName" label="菜单名称" min-width="150" />
|
|
|
+ <el-table-column prop="moduleName" label="菜单名称" min-width="150" />
|
|
|
<el-table-column prop="url" label="菜单URL" min-width="150" />
|
|
|
<el-table-column prop="fullUrl" label="菜单全URL" min-width="200" />
|
|
|
<el-table-column align="center" prop="icon" label="菜单图标">
|
|
@@ -32,24 +32,16 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" prop="isCache" label="状态">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ ['缓存', '不缓存'][[1,0].indexOf(scope.row.isCache)] || '' }}</span>
|
|
|
+ <span>{{ ['缓存', '不缓存'][[1, 0].indexOf(scope.row.isCache)] || '' }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" prop="sortNum" label="排序" />
|
|
|
<el-table-column align="right" label="操作" width="150" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- icon="el-icon-plus"
|
|
|
- @click="addOrEditChild('add', scope.row.moduleId)"
|
|
|
- />
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="addOrEditChild('edit', scope.row.moduleId)"
|
|
|
- />
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-plus"
|
|
|
+ @click="addOrEditChild('add', scope.row.moduleId)" />
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-edit"
|
|
|
+ @click="addOrEditChild('edit', scope.row.moduleId)" />
|
|
|
<el-popconfirm style="margin-left: 10px" title="确定删除吗?" @confirm="handleDelete(scope.row.moduleId)">
|
|
|
<el-button slot="reference" size="mini" icon="el-icon-delete" />
|
|
|
</el-popconfirm>
|
|
@@ -72,7 +64,7 @@
|
|
|
:model="addParentForm"
|
|
|
:rules="addParentFormRules"
|
|
|
label-position="left"
|
|
|
- label-width="140px"
|
|
|
+ label-width="120px"
|
|
|
>
|
|
|
<el-form-item label="类型" prop="type">
|
|
|
<el-radio-group v-model="addParentForm.type">
|
|
@@ -104,24 +96,26 @@
|
|
|
<el-input v-model.number="addParentForm.sort" placeholder="请输入排序" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否显示" prop="status">
|
|
|
- <el-switch
|
|
|
- v-model="addParentForm.status"
|
|
|
- :active-value="true"
|
|
|
- :inactive-value="false"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#ff4949"
|
|
|
- />
|
|
|
+ <el-switch v-model="addParentForm.status" :active-value="true" :inactive-value="false" active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否缓存页面" prop="isCache">
|
|
|
- <el-switch
|
|
|
- v-model="addParentForm.isCache"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#ff4949"
|
|
|
- />
|
|
|
+ <el-switch v-model="addParentForm.isCache" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <div v-if="addParentForm.type === 2">
|
|
|
+ <el-button style="margin-bottom: 10px" type="primary" size="small" @click="hasShowTable">新增</el-button>
|
|
|
+ <zj-table
|
|
|
+ ref="tableEl"
|
|
|
+ :is-drop="true"
|
|
|
+ :columns="columns"
|
|
|
+ :table-data="tableData"
|
|
|
+ :table-attributes="{
|
|
|
+ border: true
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="cancelAddParentForm">取 消</el-button>
|
|
|
<el-button type="primary" @click="submitAddParentForm">确 定</el-button>
|
|
@@ -141,7 +135,7 @@
|
|
|
:model="addChildForm"
|
|
|
:rules="addChildFormRules"
|
|
|
label-position="left"
|
|
|
- label-width="140px"
|
|
|
+ label-width="120px"
|
|
|
>
|
|
|
<el-form-item label="类型" prop="type">
|
|
|
<el-radio-group v-model="addChildForm.type">
|
|
@@ -183,24 +177,26 @@
|
|
|
<el-input v-model.number="addChildForm.sort" placeholder="请输入排序" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否显示" prop="status">
|
|
|
- <el-switch
|
|
|
- v-model="addChildForm.status"
|
|
|
- :active-value="true"
|
|
|
- :inactive-value="false"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#ff4949"
|
|
|
- />
|
|
|
+ <el-switch v-model="addChildForm.status" :active-value="true" :inactive-value="false" active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否缓存页面" prop="isCache">
|
|
|
- <el-switch
|
|
|
- v-model="addChildForm.isCache"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#ff4949"
|
|
|
- />
|
|
|
+ <el-switch v-model="addChildForm.isCache" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <div v-if="addChildForm.type === 2">
|
|
|
+ <el-button style="margin-bottom: 10px" type="primary" size="small" @click="hasShowTable">新增</el-button>
|
|
|
+ <zj-table
|
|
|
+ ref="tableEl"
|
|
|
+ :is-drop="true"
|
|
|
+ :columns="columns"
|
|
|
+ :table-data="tableData"
|
|
|
+ :table-attributes="{
|
|
|
+ border: true
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="cancelAddChildForm">取 消</el-button>
|
|
|
<el-button type="primary" @click="submitAddChildForm">确 定</el-button>
|
|
@@ -213,24 +209,13 @@
|
|
|
width="40%"
|
|
|
:close-on-click-modal="false"
|
|
|
>
|
|
|
- <el-form ref="formData" :model="formData" :rules="formDataRules" label-position="left" label-width="140px">
|
|
|
+ <el-form ref="formData" :model="formData" :rules="formDataRules" label-position="left" label-width="100px">
|
|
|
<el-form-item label="code" prop="code">
|
|
|
<el-input v-model="formData.code" placeholder="请输入类型" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="名称" prop="moduleName">
|
|
|
<el-input v-model="formData.moduleName" placeholder="请输入接口名称" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="API" prop="apis">
|
|
|
- <el-select v-model="formData.apis" style="width: 100%" placeholder="请选择API" multiple clearable filterable>
|
|
|
- <el-option
|
|
|
- v-for="item in apiList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.tag + ' > ' + item.operation + ' - ' + item.url"
|
|
|
- :value="item.id"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button
|
|
@@ -286,6 +271,7 @@ export default {
|
|
|
fullUrl: '',
|
|
|
icon: '',
|
|
|
sort: 0,
|
|
|
+ flag: '',
|
|
|
type: 1,
|
|
|
status: true,
|
|
|
isCache: 1
|
|
@@ -296,6 +282,7 @@ export default {
|
|
|
code: [{ required: true, message: '请填写菜单CODE', trigger: 'blur' }],
|
|
|
url: [{ required: true, message: '请填写菜单URL', trigger: 'blur' }],
|
|
|
icon: [{ required: true, message: '请选择图标', trigger: 'blur' }],
|
|
|
+ flag: [{ required: true, message: '请选择所属', trigger: 'blur' }]
|
|
|
},
|
|
|
editChildId: null,
|
|
|
addChildFormType: 'add',
|
|
@@ -308,9 +295,10 @@ export default {
|
|
|
fullUrl: '',
|
|
|
icon: '',
|
|
|
sort: 0,
|
|
|
+ flag: '',
|
|
|
type: 1,
|
|
|
status: true,
|
|
|
- isCache:1
|
|
|
+ isCache: 1
|
|
|
},
|
|
|
addChildFormRules: {
|
|
|
type: [{ required: true, message: '请选择类型', trigger: 'change' }],
|
|
@@ -319,6 +307,7 @@ export default {
|
|
|
twoMenu: [{ required: true, message: '请填写二级菜单', trigger: 'blur' }],
|
|
|
code: [{ required: true, message: '请填写菜单CODE', trigger: 'blur' }],
|
|
|
url: [{ required: true, message: '请填写菜单URL', trigger: 'blur' }],
|
|
|
+ flag: [{ required: true, message: '请选择所属', trigger: 'blur' }]
|
|
|
},
|
|
|
isChooseIconDialog: false,
|
|
|
iconList: iconList,
|
|
@@ -342,23 +331,80 @@ export default {
|
|
|
formData: {
|
|
|
code: '',
|
|
|
moduleName: '',
|
|
|
- apis: []
|
|
|
},
|
|
|
formDataRules: {
|
|
|
code: [{ required: true, message: '请选择类型', trigger: 'blur' }],
|
|
|
moduleName: [{ required: true, message: '请选择类型', trigger: 'blur' }]
|
|
|
- // apis: [{ required: true, message: '请选择类型', trigger: 'change' }]
|
|
|
},
|
|
|
- apiList: [],
|
|
|
operateType: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['userid', 'name']),
|
|
|
isAdmin() {
|
|
|
- const type = JSON.parse(localStorage.getItem('greemall_user')).type
|
|
|
+ const type = JSON.parse(localStorage.getItem('supply_user')).type
|
|
|
return type === 2
|
|
|
},
|
|
|
+ columns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ columnAttributes: {
|
|
|
+ label: '名称',
|
|
|
+ prop: 'moduleName'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnAttributes: {
|
|
|
+ label: 'code',
|
|
|
+ prop: 'code'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnAttributes: {
|
|
|
+ label: '操作',
|
|
|
+ prop: ''
|
|
|
+ },
|
|
|
+ render: (h, { row, column, $index }) => {
|
|
|
+ return (
|
|
|
+ <div style="padding-left:10px">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ onClick={() => {
|
|
|
+ getMenuDetail({ moduleId: row.moduleId }).then(res => {
|
|
|
+ this.formData = {
|
|
|
+ ...this.formData,
|
|
|
+ ...res.data
|
|
|
+ }
|
|
|
+ this.dialogVisible = true
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ title="确定删除吗?"
|
|
|
+ onConfirm={() => {
|
|
|
+ deleteMenu({ id: row.moduleId }).then(res => {
|
|
|
+ this.$successMsg('删除成功')
|
|
|
+ getMenuDetail({ moduleId: this.operateType === 1 ? this.editParentId : this.editChildId }).then(
|
|
|
+ res => {
|
|
|
+ this.tableData = res.data.childList
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <el-button slot="reference" type="text" size="mini">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
this.getList()
|
|
@@ -382,8 +428,6 @@ export default {
|
|
|
if (!arr.length) return
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
if (arr[i].children.length) {
|
|
|
- // arr[i].pages 页面级, 页面类型 [1, 2, 4]
|
|
|
- // arr[i].controls 操作级, 操作类型 [3]
|
|
|
arr[i].pages = []
|
|
|
arr[i].controls = []
|
|
|
for (let j = 0; j < arr[i].children.length; j++) {
|
|
@@ -414,6 +458,7 @@ export default {
|
|
|
fullUrl: res.data.fullUrl,
|
|
|
icon: res.data.icon,
|
|
|
sort: res.data.sortNum,
|
|
|
+ flag: res.data.flag,
|
|
|
type: res.data.type,
|
|
|
status: res.data.status,
|
|
|
isCache: res.data.isCache,
|
|
@@ -441,10 +486,11 @@ export default {
|
|
|
fullUrl: this.addParentForm.fullUrl,
|
|
|
icon: this.addParentForm.icon,
|
|
|
sortNum: this.addParentForm.sort,
|
|
|
+ flag: this.addParentForm.flag,
|
|
|
parentId: 0,
|
|
|
type: this.addParentForm.type,
|
|
|
status: this.addParentForm.status,
|
|
|
- isCache: this.addParentForm.isCache,
|
|
|
+ isCache: this.addParentForm.isCache
|
|
|
}
|
|
|
if (this.addParentFormType == 'edit') {
|
|
|
params.moduleId = this.editParentId
|
|
@@ -485,6 +531,7 @@ export default {
|
|
|
fullUrl: res.data.fullUrl,
|
|
|
icon: res.data.icon,
|
|
|
sort: res.data.sortNum,
|
|
|
+ flag: res.data.flag,
|
|
|
type: res.data.type,
|
|
|
status: res.data.status,
|
|
|
isCache: res.data.isCache,
|
|
@@ -504,7 +551,6 @@ export default {
|
|
|
code: this.formData.code,
|
|
|
type: 3,
|
|
|
childList: this.formData.childList || null,
|
|
|
- apiList: this.formData.apis
|
|
|
}
|
|
|
if (this.formData.moduleId) {
|
|
|
params.parentId = null
|
|
@@ -533,7 +579,6 @@ export default {
|
|
|
this.formData = {
|
|
|
code: '',
|
|
|
moduleName: '',
|
|
|
- apis: []
|
|
|
}
|
|
|
},
|
|
|
hasShowTable() {
|
|
@@ -567,9 +612,10 @@ export default {
|
|
|
fullUrl: this.addChildForm.fullUrl,
|
|
|
icon: this.addChildForm.icon,
|
|
|
sortNum: this.addChildForm.sort,
|
|
|
+ flag: this.addChildForm.flag,
|
|
|
type: this.addChildForm.type,
|
|
|
status: this.addChildForm.status,
|
|
|
- isCache: this.addChildForm.isCache,
|
|
|
+ isCache: this.addChildForm.isCache
|
|
|
}
|
|
|
editMenu(params).then(res => {
|
|
|
this.cancelAddChildForm()
|
|
@@ -585,9 +631,10 @@ export default {
|
|
|
fullUrl: this.addChildForm.fullUrl,
|
|
|
icon: this.addChildForm.icon,
|
|
|
sortNum: this.addChildForm.sort,
|
|
|
+ flag: this.addChildForm.flag,
|
|
|
type: this.addChildForm.type,
|
|
|
status: this.addChildForm.status,
|
|
|
- isCache: this.addChildForm.isCache,
|
|
|
+ isCache: this.addChildForm.isCache
|
|
|
}
|
|
|
addMenu(params).then(res => {
|
|
|
this.cancelAddChildForm()
|
|
@@ -687,4 +734,4 @@ export default {
|
|
|
// th {
|
|
|
// text-align: center !important;
|
|
|
// }
|
|
|
-</style>
|
|
|
+</style>
|