膜布管理
parent
9d624206db
commit
b23b037f0e
@ -0,0 +1,61 @@
|
||||
package com.flossom.common.core.mapper;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxLining;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 膜布Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
public interface WxLiningMapper {
|
||||
/**
|
||||
* 查询膜布
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 膜布
|
||||
*/
|
||||
public WxLining selectWxLiningById(Long id);
|
||||
|
||||
/**
|
||||
* 查询膜布列表
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 膜布集合
|
||||
*/
|
||||
public List<WxLining> selectWxLiningList(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 新增膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxLining(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 修改膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxLining(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 删除膜布
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxLiningById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除膜布
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxLiningByIds(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
<?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.flossom.common.core.mapper.WxLiningMapper">
|
||||
|
||||
<resultMap type="WxLining" id="WxLiningResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="code" column="code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="desc" column="desc" />
|
||||
<result property="isShowBuy" column="is_show_buy" />
|
||||
<result property="skipAppid" column="skip_appid" />
|
||||
<result property="skipPath" column="skip_path" />
|
||||
<result property="icon" column="icon" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWxLiningVo">
|
||||
select id, code, name, `desc`, is_show_buy, skip_appid, skip_path, icon, status, create_by, create_time, update_by, update_time from wx_lining
|
||||
</sql>
|
||||
|
||||
<select id="selectWxLiningList" parameterType="WxLining" resultMap="WxLiningResult">
|
||||
<include refid="selectWxLiningVo"/>
|
||||
<where>
|
||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
|
||||
<if test="isShowBuy != null "> and is_show_buy = #{isShowBuy}</if>
|
||||
<if test="skipAppid != null and skipAppid != ''"> and skip_appid = #{skipAppid}</if>
|
||||
<if test="skipPath != null and skipPath != ''"> and skip_path = #{skipPath}</if>
|
||||
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWxLiningById" parameterType="Long" resultMap="WxLiningResult">
|
||||
<include refid="selectWxLiningVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertWxLining" parameterType="WxLining">
|
||||
insert into wx_lining
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="code != null">code,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="desc != null">`desc`,</if>
|
||||
<if test="isShowBuy != null">is_show_buy,</if>
|
||||
<if test="skipAppid != null">skip_appid,</if>
|
||||
<if test="skipPath != null">skip_path,</if>
|
||||
<if test="icon != null">icon,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="desc != null">#{desc},</if>
|
||||
<if test="isShowBuy != null">#{isShowBuy},</if>
|
||||
<if test="skipAppid != null">#{skipAppid},</if>
|
||||
<if test="skipPath != null">#{skipPath},</if>
|
||||
<if test="icon != null">#{icon},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWxLining" parameterType="WxLining">
|
||||
update wx_lining
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="desc != null">`desc` = #{desc},</if>
|
||||
<if test="isShowBuy != null">is_show_buy = #{isShowBuy},</if>
|
||||
<if test="skipAppid != null">skip_appid = #{skipAppid},</if>
|
||||
<if test="skipPath != null">skip_path = #{skipPath},</if>
|
||||
<if test="icon != null">icon = #{icon},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWxLiningById" parameterType="Long">
|
||||
delete from wx_lining where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWxLiningByIds" parameterType="String">
|
||||
delete from wx_lining where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,100 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxLining;
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.common.log.annotation.Log;
|
||||
import com.flossom.common.log.enums.BusinessType;
|
||||
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.flossom.system.service.IWxLiningService;
|
||||
|
||||
/**
|
||||
* 膜布Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/lining")
|
||||
public class WxLiningController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWxLiningService wxLiningService;
|
||||
|
||||
/**
|
||||
* 查询膜布列表
|
||||
*/
|
||||
@RequiresPermissions("system:lining:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WxLining wxLining) {
|
||||
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出膜布列表
|
||||
*/
|
||||
@RequiresPermissions("system:lining:export")
|
||||
@Log(title = "膜布", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WxLining wxLining) {
|
||||
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
|
||||
ExcelUtil<WxLining> util = new ExcelUtil<WxLining>(WxLining.class);
|
||||
util.exportExcel(response, list, "膜布数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取膜布详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:lining:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(wxLiningService.selectWxLiningById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增膜布
|
||||
*/
|
||||
@RequiresPermissions("system:lining:add")
|
||||
@Log(title = "膜布", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WxLining wxLining) {
|
||||
return toAjax(wxLiningService.insertWxLining(wxLining));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改膜布
|
||||
*/
|
||||
@RequiresPermissions("system:lining:edit")
|
||||
@Log(title = "膜布", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WxLining wxLining) {
|
||||
return toAjax(wxLiningService.updateWxLining(wxLining));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除膜布
|
||||
*/
|
||||
@RequiresPermissions("system:lining:remove")
|
||||
@Log(title = "膜布", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(wxLiningService.deleteWxLiningByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxLining;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 膜布Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
public interface IWxLiningService {
|
||||
|
||||
/**
|
||||
* 查询膜布
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 膜布
|
||||
*/
|
||||
public WxLining selectWxLiningById(Long id);
|
||||
|
||||
/**
|
||||
* 查询膜布列表
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 膜布集合
|
||||
*/
|
||||
public List<WxLining> selectWxLiningList(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 新增膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxLining(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 修改膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxLining(WxLining wxLining);
|
||||
|
||||
/**
|
||||
* 批量删除膜布
|
||||
*
|
||||
* @param ids 需要删除的膜布主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxLiningByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除膜布信息
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxLiningById(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxLining;
|
||||
import com.flossom.common.core.mapper.WxLiningMapper;
|
||||
import com.flossom.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.service.IWxLiningService;
|
||||
|
||||
/**
|
||||
* 膜布Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
@Service
|
||||
public class WxLiningServiceImpl implements IWxLiningService {
|
||||
|
||||
@Autowired
|
||||
private WxLiningMapper wxLiningMapper;
|
||||
|
||||
/**
|
||||
* 查询膜布
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 膜布
|
||||
*/
|
||||
@Override
|
||||
public WxLining selectWxLiningById(Long id) {
|
||||
return wxLiningMapper.selectWxLiningById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询膜布列表
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 膜布
|
||||
*/
|
||||
@Override
|
||||
public List<WxLining> selectWxLiningList(WxLining wxLining) {
|
||||
return wxLiningMapper.selectWxLiningList(wxLining);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWxLining(WxLining wxLining) {
|
||||
wxLining.setCreateTime(DateUtils.getNowDate());
|
||||
return wxLiningMapper.insertWxLining(wxLining);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改膜布
|
||||
*
|
||||
* @param wxLining 膜布
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWxLining(WxLining wxLining) {
|
||||
wxLining.setUpdateTime(DateUtils.getNowDate());
|
||||
return wxLiningMapper.updateWxLining(wxLining);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除膜布
|
||||
*
|
||||
* @param ids 需要删除的膜布主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxLiningByIds(Long[] ids) {
|
||||
return wxLiningMapper.deleteWxLiningByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除膜布信息
|
||||
*
|
||||
* @param id 膜布主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxLiningById(Long id) {
|
||||
return wxLiningMapper.deleteWxLiningById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询膜布列表
|
||||
export function listLining(query) {
|
||||
return request({
|
||||
url: '/system/lining/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询膜布详细
|
||||
export function getLining(id) {
|
||||
return request({
|
||||
url: '/system/lining/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增膜布
|
||||
export function addLining(data) {
|
||||
return request({
|
||||
url: '/system/lining',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改膜布
|
||||
export function updateLining(data) {
|
||||
return request({
|
||||
url: '/system/lining',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除膜布
|
||||
export function delLining(id) {
|
||||
return request({
|
||||
url: '/system/lining/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
|
||||
<el-tab-pane :label="item.code" :name="item.code" v-for="(item, index) of liningList">
|
||||
<div style="width: 200px; float: left;">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<!-- 左侧表单项 -->
|
||||
<div class="form-top">
|
||||
<div class="form-top--left">
|
||||
<el-form-item label="膜布名称" prop="name" style="width: 500px">
|
||||
<el-input v-model="item.name" placeholder="请输入膜布名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="购买入口是否显示" label-width="150px" prop="name" style="width: 500px">
|
||||
<el-switch
|
||||
v-model="item.isShowBuy == 1"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="购买商城appid" label-width="150px" prop="skipAppid" style="width: 500px">
|
||||
<el-input v-model="item.skipAppid" placeholder="请输入购买商城appid"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="膜布图标" prop="icon" width="150px">
|
||||
<template>
|
||||
<!-- 膜布图标 -->
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="uploadUrl"
|
||||
:headers="headers"
|
||||
:file-list="item.fileList"
|
||||
list-type="picture-card"
|
||||
accept=".jpg,.png"
|
||||
:limit="1"
|
||||
:class="{ hide: item.uploadHide }"
|
||||
:on-remove="iconUploadRemove"
|
||||
:on-success="iconUploadSuccess"
|
||||
:on-error="uploadError"
|
||||
:before-upload="handleBeforeUploadImage"
|
||||
>
|
||||
<i slot="default" class="el-icon-plus"></i>
|
||||
<div slot="file" slot-scope="{ file }">
|
||||
<img :src="file.url" class="el-upload-list__item-thumbnail" alt=""/>
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span @click="iconPicturePreview(file)" class="el-upload-list__item-preview">
|
||||
<i class="el-icon-zoom-in"></i>
|
||||
</span>
|
||||
<span v-if="!disabled" @click="iconUploadRemove(file)" class="el-upload-list__item-delete">
|
||||
<i class="el-icon-delete"></i>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
|
||||
</el-upload>
|
||||
<!-- 预览窗口 -->
|
||||
<el-dialog :visible.sync="dialogVisible" append-to-body>
|
||||
<img width="100%" :src="dialogImageUrl" alt=""/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 右侧表单项 -->
|
||||
<div class="form-top--right">
|
||||
<el-form-item label="膜布描述" prop="desc" style="width: 500px">
|
||||
<el-input v-model="item.desc" placeholder="请输入膜布描述"/>
|
||||
</el-form-item>
|
||||
<el-form-item style="height: 36px"/>
|
||||
<el-form-item label="购买商城PATH" label-width="150px" prop="skipPath" style="width: 500px">
|
||||
<el-input v-model="item.skipPath" placeholder="请输入购买商城PATH"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" style="margin-left: 90%;">
|
||||
<el-button type="primary" @click="submitForm(item)">提 交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listLining, getLining, delLining, addLining, updateLining} from "@/api/system/lining";
|
||||
import {getToken} from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
name: "Lining",
|
||||
data() {
|
||||
return {
|
||||
// 激活标签页
|
||||
activeName: "M01",
|
||||
/* 文件上传地址 */
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + getToken(),
|
||||
},
|
||||
fileList: [
|
||||
[], []
|
||||
],
|
||||
// 上传后是否隐藏
|
||||
// uploadHide: false,
|
||||
disabled: false,
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 膜布表格数据
|
||||
liningList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
name: null,
|
||||
desc: null,
|
||||
isShowBuy: null,
|
||||
skipAppid: null,
|
||||
skipPath: null,
|
||||
icon: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询膜布列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listLining().then(response => {
|
||||
response?.rows?.forEach(item => {
|
||||
this.liningList.push({
|
||||
...item,
|
||||
// 上传后是否隐藏
|
||||
uploadHide: item?.icon != null,
|
||||
fileList: [{
|
||||
name: item?.icon,
|
||||
url: item?.icon
|
||||
}]
|
||||
})
|
||||
})
|
||||
console.log(this.liningList);
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
code: null,
|
||||
name: null,
|
||||
desc: null,
|
||||
isShowBuy: null,
|
||||
skipAppid: null,
|
||||
skipPath: null,
|
||||
icon: null,
|
||||
status: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getLining(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改膜布";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm(item) {
|
||||
this.form = item;
|
||||
this.form.icon = item.fileList[0].url;
|
||||
if (this.form.id != null) {
|
||||
updateLining(this.form).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
} else {
|
||||
this.$modal.msgError("修改失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addLining(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
},
|
||||
iconUploadRemove(file, fileList) {
|
||||
this.liningList.forEach(e => {
|
||||
if (this.activeName === e.code) {
|
||||
e.fileList = [];
|
||||
e.uploadHide = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
iconUploadSuccess(response, file) {
|
||||
if (response.code == 200) {
|
||||
this.form.banner = response.data.url
|
||||
this.liningList.forEach(e => {
|
||||
if (this.activeName === e.code) {
|
||||
e.fileList = [{
|
||||
name: response.data.url,
|
||||
url: response.data.url
|
||||
}];
|
||||
e.uploadHide = true;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error('图片插入失败')
|
||||
}
|
||||
},
|
||||
handleBeforeUploadImage(file) {
|
||||
let fileType = ['jpg', 'png', 'JPG', 'PNG']
|
||||
const fileName = file.name.split('.')
|
||||
const fileExt = fileName[fileName.length - 1]
|
||||
const isTypeOk = fileType.indexOf(fileExt) >= 0
|
||||
if (!isTypeOk) {
|
||||
this.$modal.msgError(`文件类型只能为jpg格式/png格式`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
iconPicturePreview(file) {
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
/* 文件上传失败 */
|
||||
uploadError() {
|
||||
this.$message.error('文件上传失败')
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
.form-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.form-top--right {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.form-bottom {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
::v-deep .hide .el-upload--picture-card {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue