轮播图
This commit is contained in:
parent
69545f153d
commit
4e0e81a8f8
@ -0,0 +1,112 @@
|
|||||||
|
package com.ruoyi.base.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.base.domain.BasePic;
|
||||||
|
import com.ruoyi.base.service.IBasePicService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图管理Controller
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-23
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/base/pic")
|
||||||
|
public class BasePicController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBasePicService basePicService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询轮播图管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(BasePic basePic,
|
||||||
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||||
|
{
|
||||||
|
Page<BasePic> page = new Page<>(pageNum, pageSize);
|
||||||
|
IPage<BasePic> list = basePicService.queryListPage(basePic,page);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出轮播图管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:export')")
|
||||||
|
@Log(title = "轮播图管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BasePic basePic)
|
||||||
|
{
|
||||||
|
List<BasePic> list = basePicService.list();
|
||||||
|
ExcelUtil<BasePic> util = new ExcelUtil<BasePic>(BasePic.class);
|
||||||
|
util.exportExcel(response, list, "轮播图管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取轮播图管理详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(basePicService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增轮播图管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:add')")
|
||||||
|
@Log(title = "轮播图管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BasePic basePic)
|
||||||
|
{
|
||||||
|
return toAjax(basePicService.save(basePic));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改轮播图管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:edit')")
|
||||||
|
@Log(title = "轮播图管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BasePic basePic)
|
||||||
|
{
|
||||||
|
return toAjax(basePicService.updateById(basePic));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除轮播图管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('base:pic:remove')")
|
||||||
|
@Log(title = "轮播图管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
|
return toAjax(basePicService.removeByIds(list));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.ruoyi.base.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图管理对象 dl_base_pic
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-23
|
||||||
|
*/
|
||||||
|
@TableName("dl_base_pic")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BasePic extends DlBaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 标题 */
|
||||||
|
@Excel(name = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
@Excel(name = "排序")
|
||||||
|
private Long sort;
|
||||||
|
|
||||||
|
/** 图片 */
|
||||||
|
@Excel(name = "图片")
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/** 站点唯一编码(租户id) */
|
||||||
|
@Excel(name = "站点唯一编码", readConverterExp = "租=户id")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.base.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.base.domain.BasePic;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-23
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BasePicMapper extends BaseMapper<BasePic>
|
||||||
|
{
|
||||||
|
IPage<BasePic> queryListPage(@Param("entity") BasePic entity, Page<BasePic> page);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.base.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.base.domain.BasePic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图管理Service接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-23
|
||||||
|
*/
|
||||||
|
public interface IBasePicService extends IService<BasePic>
|
||||||
|
{
|
||||||
|
IPage<BasePic> queryListPage(BasePic pageReqVO, Page<BasePic> page);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.ruoyi.base.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.base.mapper.BasePicMapper;
|
||||||
|
import com.ruoyi.base.domain.BasePic;
|
||||||
|
import com.ruoyi.base.service.IBasePicService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图管理Service业务层处理
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BasePicServiceImpl extends ServiceImpl<BasePicMapper,BasePic> implements IBasePicService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BasePicMapper basePicMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<BasePic> queryListPage(BasePic pageReqVO, Page<BasePic> page) {
|
||||||
|
return basePicMapper.queryListPage(pageReqVO, page);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.base.mapper.BasePicMapper">
|
||||||
|
|
||||||
|
<resultMap type="BasePic" id="BasePicResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="sort" column="sort" />
|
||||||
|
<result property="pic" column="pic" />
|
||||||
|
<result property="tenantId" column="tenant_id" />
|
||||||
|
<result property="creator" column="creator" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updater" column="updater" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBasePicVo">
|
||||||
|
select id, title, sort, pic, tenant_id, creator, create_time, updater, update_time, del_flag from dl_base_pic
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="queryListPage" parameterType="BasePic" resultMap="BasePicResult">
|
||||||
|
<include refid="selectBasePicVo"/>
|
||||||
|
<where>
|
||||||
|
and del_flag='0'
|
||||||
|
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
|
||||||
|
<if test="entity.sort != null "> and sort = #{entity.sort}</if>
|
||||||
|
<if test="entity.pic != null and entity.pic != ''"> and pic = #{entity.pic}</if>
|
||||||
|
<if test="entity.tenantId != null and entity.tenantId != ''"> and tenant_id = #{entity.tenantId}</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY sort DESC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
44
dl_vue/src/api/base/pic.js
Normal file
44
dl_vue/src/api/base/pic.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询轮播图管理列表
|
||||||
|
export function listPic(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/pic/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询轮播图管理详细
|
||||||
|
export function getPic(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/pic/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增轮播图管理
|
||||||
|
export function addPic(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/pic',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改轮播图管理
|
||||||
|
export function updatePic(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/pic',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除轮播图管理
|
||||||
|
export function delPic(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/pic/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -5,23 +5,24 @@
|
|||||||
<breadcrumb v-if="!topNav" id="breadcrumb-container" class="breadcrumb-container" />
|
<breadcrumb v-if="!topNav" id="breadcrumb-container" class="breadcrumb-container" />
|
||||||
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" />
|
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" />
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu" style="display: flex">
|
||||||
<template v-if="device!=='mobile'">
|
<template v-if="device!=='mobile'">
|
||||||
|
<div>当前管理站点:{{tenantName}}</div>
|
||||||
<search id="header-search" class="right-menu-item" />
|
<search id="header-search" class="right-menu-item" />
|
||||||
|
|
||||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
|
||||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
|
|
||||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
|
||||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
|
|
||||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||||
|
|
||||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">-->
|
||||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
|
||||||
</el-tooltip>
|
<!-- </el-tooltip>-->
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -48,6 +49,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
import { getTenantName } from '@/utils/auth'
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import Breadcrumb from '@/components/Breadcrumb'
|
||||||
import TopNav from '@/components/TopNav'
|
import TopNav from '@/components/TopNav'
|
||||||
import Hamburger from '@/components/Hamburger'
|
import Hamburger from '@/components/Hamburger'
|
||||||
@ -68,6 +70,11 @@ export default {
|
|||||||
RuoYiGit,
|
RuoYiGit,
|
||||||
RuoYiDoc
|
RuoYiDoc
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tenantName:getTenantName(),
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'sidebar',
|
'sidebar',
|
||||||
|
@ -4,6 +4,8 @@ const TokenKey = 'Admin-Token'
|
|||||||
|
|
||||||
const TenantIdKey = 'tenantId'
|
const TenantIdKey = 'tenantId'
|
||||||
|
|
||||||
|
const TenantNameKey = 'tenantName'
|
||||||
|
|
||||||
export function getToken() {
|
export function getToken() {
|
||||||
return Cookies.get(TokenKey)
|
return Cookies.get(TokenKey)
|
||||||
}
|
}
|
||||||
@ -27,3 +29,15 @@ export function setTenantId(tenantId) {
|
|||||||
export function removeTenantId() {
|
export function removeTenantId() {
|
||||||
return Cookies.remove(TenantIdKey)
|
return Cookies.remove(TenantIdKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTenantName() {
|
||||||
|
return Cookies.get(TenantNameKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setTenantName(tenantName) {
|
||||||
|
return Cookies.set(TenantNameKey, tenantName)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeTenantName() {
|
||||||
|
return Cookies.remove(TenantNameKey)
|
||||||
|
}
|
||||||
|
282
dl_vue/src/views/base/pic/index.vue
Normal file
282
dl_vue/src/views/base/pic/index.vue
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['base:pic:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">-->
|
||||||
|
<!-- <el-button-->
|
||||||
|
<!-- type="success"-->
|
||||||
|
<!-- plain-->
|
||||||
|
<!-- icon="el-icon-edit"-->
|
||||||
|
<!-- size="mini"-->
|
||||||
|
<!-- :disabled="single"-->
|
||||||
|
<!-- @click="handleUpdate"-->
|
||||||
|
<!-- v-hasPermi="['base:pic:edit']"-->
|
||||||
|
<!-- >修改</el-button>-->
|
||||||
|
<!-- </el-col>-->
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['base:pic:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">-->
|
||||||
|
<!-- <el-button-->
|
||||||
|
<!-- type="warning"-->
|
||||||
|
<!-- plain-->
|
||||||
|
<!-- icon="el-icon-download"-->
|
||||||
|
<!-- size="mini"-->
|
||||||
|
<!-- @click="handleExport"-->
|
||||||
|
<!-- v-hasPermi="['base:pic:export']"-->
|
||||||
|
<!-- >导出</el-button>-->
|
||||||
|
<!-- </el-col>-->
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="picList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="标题" align="center" prop="title" />
|
||||||
|
<el-table-column label="排序" align="center" prop="sort" />
|
||||||
|
<el-table-column label="图片" align="center" prop="pic" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<image-preview :src="scope.row.pic" :width="50" :height="50"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column label="站点唯一编码" align="center" prop="tenantId" />-->
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['base:pic:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['base:pic:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改轮播图管理对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<div style="display: flex;align-items: center;justify-content: center">
|
||||||
|
<el-input v-model="form.sort" type="number" placeholder="请输入排序" />
|
||||||
|
<el-tooltip class="item" effect="dark" content="数字越大越靠前" placement="bottom">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="图片" prop="pic">
|
||||||
|
<image-upload v-model="form.pic" limit="1"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listPic, getPic, delPic, addPic, updatePic } from "@/api/base/pic";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Pic",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 轮播图管理表格数据
|
||||||
|
picList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
title: null,
|
||||||
|
sort: null,
|
||||||
|
pic: null,
|
||||||
|
tenantId: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
title: [
|
||||||
|
{ required: true, message: '请输入标题', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
sort: [
|
||||||
|
{ required: true, message: '请输入排序', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
pic: [
|
||||||
|
{ required: true, message: '请上传图片', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询轮播图管理列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listPic(this.queryParams).then(response => {
|
||||||
|
this.picList = response.data.records;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
title: null,
|
||||||
|
sort: null,
|
||||||
|
pic: null,
|
||||||
|
tenantId: null,
|
||||||
|
creator: null,
|
||||||
|
createTime: null,
|
||||||
|
updater: null,
|
||||||
|
updateTime: null,
|
||||||
|
delFlag: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加轮播图";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getPic(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改轮播图";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updatePic(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addPic(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除选中的轮播图?').then(function() {
|
||||||
|
return delPic(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('base/pic/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `pic_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg } from "@/api/login";
|
import { getCodeImg } from "@/api/login";
|
||||||
import { setTenantId } from '@/utils/auth'
|
import { setTenantId,setTenantName } from '@/utils/auth'
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||||
import { listAllSite } from "@/api/base/site";
|
import { listAllSite } from "@/api/base/site";
|
||||||
@ -144,7 +144,9 @@ export default {
|
|||||||
chooseSiteCodeFun(){
|
chooseSiteCodeFun(){
|
||||||
if(this.chooseSiteCode){
|
if(this.chooseSiteCode){
|
||||||
this.centerDialogVisible=false
|
this.centerDialogVisible=false
|
||||||
|
let chooseSiteObj = this.options.filter(item=>item.value==this.chooseSiteCode)[0]
|
||||||
setTenantId(this.chooseSiteCode)
|
setTenantId(this.chooseSiteCode)
|
||||||
|
setTenantName(chooseSiteObj.label)
|
||||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
}else{
|
}else{
|
||||||
this.$modal.msgWarning("请选择管理的站点");
|
this.$modal.msgWarning("请选择管理的站点");
|
||||||
|
Loading…
Reference in New Issue
Block a user