123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <div class="appMenuManage app-container">
- <div class="search">
- <div>
- <el-select
- v-model="query.belongType"
- size="small"
- clearable
- class="item-width-200"
- placeholder="请选择小程序类型"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- <el-button
- class="ml10"
- type="primary"
- size="small"
- icon="el-icon-search"
- @click="handleSearch"
- >
- 搜索
- </el-button>
- </div>
- <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
- >添加</el-button
- >
- </div>
- <el-table
- :data="tableData"
- tooltip-effect="dark"
- border
- v-loading="loading"
- style="width: 100%"
- >
-
- <el-table-column
- prop="imgUrl"
- align="center"
- label="图标"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <img class="icon" :src="scope.row.imgUrl" alt="">
- </template>
- </el-table-column>
- <el-table-column
- prop="menuName"
- align="center"
- label="菜单名称"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- align="center"
- label="小程序"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <span>{{scope.row.belongType ==2?'慧研学':'贵大'}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="sort"
- align="center"
- label="权重排序"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="domainUrl"
- align="center"
- label="域名"
- show-overflow-tooltip
- >
- </el-table-column>
-
- <el-table-column
- prop="status"
- align="center"
- label="状态"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <span :class="[scope.row.status == 1?'red':'green']">{{scope.row.status == 1?"隐藏 ":"显示"}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="address" align="center" label="操作">
- <template slot-scope="scope">
- <el-button type="text" size="small" v-if="$route.query.title != '二级菜单'" @click="handle(scope.row.id)">查看下级</el-button>
- <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
- <el-button type="text" size="small" @click="handleDel(scope.row.id)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="page-box">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- background
- :current-page="query.currentPage"
- :page-sizes="[10, 20, 30, 40]"
- :page-size="query.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
- </div>
- </template>
-
- <script>
- import { debounce } from "@/utils/index";
- import {getMenu,del} from '@/api/appConfig'
- export default {
- name: "appMenuManage",
- data() {
- return {
- tableData: [],
- loading: false,
- query: {
- status: "",
- menuName: "",
- parentId:'',
- belongType:null,
- currentPage: 1,
- pageSize: 10,
- },
- options:[
- {
- label:'贵大',
- value:'1'
- },
- {
- label:'慧研学',
- value:'2'
- },
- {
- label: "生活宝",
- value: '3',
- },
- ],
- title: "",
- total: 0,
- };
- },
- // watch: {
- // query: {
- // handler: debounce(function (val) {
- // this.getMenu()
- // }),
- // deep: true,
- // },
- // },
- methods: {
- handleSearch(){
- this.query.currentPage = 1
- this.getMenu();
- },
- handle(id){
- let title
- if(!this.$route.query.title){
- title = '二级菜单'
- }
- this.$router.push({
- path:'/operationManage/appMenuManage/index',
- query:{
- parentId:id,
- title
- }
- })
- },
- handleEdit(row){
- sessionStorage.setItem('menuItem',JSON.stringify(row))
- this.$router.push({
- path:'/operationManage/appMenuManage/addMenu',
- query:{
- title:'编辑菜单',
- }
- })
- },
- handleAdd(){
- this.$router.push({
- path:'/operationManage/appMenuManage/addMenu',
- query:{
- title:'新增菜单',
- parentId:this.$route.query.parentId,
- menuLevel:this.$route.query.title == '二级菜单'?2:1
- }
- })
- },
- // 点击删除
- handleDel(id) {
- this.$confirm(`此操作将删除该数据, 是否继续?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- del({menuId:id}).then(res=>{
- if(res.state == 'Success'){
- this.$notify({
- title: '成功',
- message: '操作成功',
- type: 'success'
- });
- this.getMenu()
- }
- })
- })
- },
- handleSizeChange(val) {
- this.query.currentPage = 1;
- this.query.pageSize = val;
- this.getMenu()
- },
- handleCurrentChange(val) {
- this.query.currentPage = val;
- this.getMenu()
- },
- getMenu(){
- this.loading = true
- getMenu(this.query).then(res=>{
- this.loading = false
- if(res.state == 'Success'){
- this.tableData = res.content.records
- this.total = res.content.total
- }
- })
- }
- },
- created() {
- this.query.parentId = this.$route.query.parentId
- this.getMenu()
- },
- };
- </script>
-
- <style lang="scss" scoped>
- .appMenuManage {
- .search{
- justify-content: space-between;
- }
- .icon{
- width: 80px;
- height: 80px;
- }
- }
- </style>
-
|