添加支付模块

This commit is contained in:
酱子 2022-03-29 11:24:01 +08:00
parent 2043d1f439
commit dbe6f3c498
15 changed files with 1230 additions and 381 deletions

View File

@ -199,6 +199,13 @@
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- 支付模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-pay</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -209,6 +216,7 @@
<module>ruoyi-quartz</module> <module>ruoyi-quartz</module>
<module>ruoyi-generator</module> <module>ruoyi-generator</module>
<module>ruoyi-common</module> <module>ruoyi-common</module>
<module>ruoyi-pay</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -16,15 +16,6 @@ public class RuoYiApplication
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ ");
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
} }
} }

View File

@ -8,7 +8,7 @@ spring:
master: master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: password password: root
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -1,24 +0,0 @@
Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////

View File

@ -59,6 +59,12 @@
<artifactId>ruoyi-system</artifactId> <artifactId>ruoyi-system</artifactId>
</dependency> </dependency>
<!-- 支付模块-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-pay</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

28
ruoyi-pay/pom.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-pay</artifactId>
<description>
支付模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,104 @@
package com.ruoyi.pay.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
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.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.pay.domain.SysPay;
import com.ruoyi.pay.service.ISysPayService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 支付相关Controller
*
* @author ruoyi
* @date 2022-03-29
*/
@RestController
@RequestMapping("/pay/wxPay")
public class SysPayController extends BaseController
{
@Autowired
private ISysPayService sysPayService;
/**
* 查询支付相关列表
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:list')")
@GetMapping("/list")
public TableDataInfo list(SysPay sysPay)
{
startPage();
List<SysPay> list = sysPayService.selectSysPayList(sysPay);
return getDataTable(list);
}
/**
* 导出支付相关列表
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:export')")
@Log(title = "支付相关", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysPay sysPay)
{
List<SysPay> list = sysPayService.selectSysPayList(sysPay);
ExcelUtil<SysPay> util = new ExcelUtil<SysPay>(SysPay.class);
util.exportExcel(response, list, "支付相关数据");
}
/**
* 获取支付相关详细信息
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysPayService.selectSysPayById(id));
}
/**
* 新增支付相关
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:add')")
@Log(title = "支付相关", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysPay sysPay)
{
return toAjax(sysPayService.insertSysPay(sysPay));
}
/**
* 修改支付相关
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:edit')")
@Log(title = "支付相关", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysPay sysPay)
{
return toAjax(sysPayService.updateSysPay(sysPay));
}
/**
* 删除支付相关
*/
@PreAuthorize("@ss.hasPermi('pay:wxPay:remove')")
@Log(title = "支付相关", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysPayService.deleteSysPayByIds(ids));
}
}

View File

@ -0,0 +1,84 @@
package com.ruoyi.pay.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 支付相关对象 sys_pay
*
* @author ruoyi
* @date 2022-03-29
*/
public class SysPay extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 支付id */
private Long id;
/** 支付名称 */
@Excel(name = "支付名称")
private String name;
/** 支付状态 */
@Excel(name = "支付状态")
private String state;
/** 金额 */
@Excel(name = "金额")
private String figure;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setState(String state)
{
this.state = state;
}
public String getState()
{
return state;
}
public void setFigure(String figure)
{
this.figure = figure;
}
public String getFigure()
{
return figure;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("state", getState())
.append("figure", getFigure())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.pay.mapper;
import java.util.List;
import com.ruoyi.pay.domain.SysPay;
/**
* 支付相关Mapper接口
*
* @author ruoyi
* @date 2022-03-29
*/
public interface SysPayMapper
{
/**
* 查询支付相关
*
* @param id 支付相关主键
* @return 支付相关
*/
public SysPay selectSysPayById(Long id);
/**
* 查询支付相关列表
*
* @param sysPay 支付相关
* @return 支付相关集合
*/
public List<SysPay> selectSysPayList(SysPay sysPay);
/**
* 新增支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
public int insertSysPay(SysPay sysPay);
/**
* 修改支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
public int updateSysPay(SysPay sysPay);
/**
* 删除支付相关
*
* @param id 支付相关主键
* @return 结果
*/
public int deleteSysPayById(Long id);
/**
* 批量删除支付相关
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysPayByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.pay.service;
import java.util.List;
import com.ruoyi.pay.domain.SysPay;
/**
* 支付相关Service接口
*
* @author ruoyi
* @date 2022-03-29
*/
public interface ISysPayService
{
/**
* 查询支付相关
*
* @param id 支付相关主键
* @return 支付相关
*/
public SysPay selectSysPayById(Long id);
/**
* 查询支付相关列表
*
* @param sysPay 支付相关
* @return 支付相关集合
*/
public List<SysPay> selectSysPayList(SysPay sysPay);
/**
* 新增支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
public int insertSysPay(SysPay sysPay);
/**
* 修改支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
public int updateSysPay(SysPay sysPay);
/**
* 批量删除支付相关
*
* @param ids 需要删除的支付相关主键集合
* @return 结果
*/
public int deleteSysPayByIds(Long[] ids);
/**
* 删除支付相关信息
*
* @param id 支付相关主键
* @return 结果
*/
public int deleteSysPayById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.pay.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pay.mapper.SysPayMapper;
import com.ruoyi.pay.domain.SysPay;
import com.ruoyi.pay.service.ISysPayService;
/**
* 支付相关Service业务层处理
*
* @author ruoyi
* @date 2022-03-29
*/
@Service
public class SysPayServiceImpl implements ISysPayService
{
@Autowired
private SysPayMapper sysPayMapper;
/**
* 查询支付相关
*
* @param id 支付相关主键
* @return 支付相关
*/
@Override
public SysPay selectSysPayById(Long id)
{
return sysPayMapper.selectSysPayById(id);
}
/**
* 查询支付相关列表
*
* @param sysPay 支付相关
* @return 支付相关
*/
@Override
public List<SysPay> selectSysPayList(SysPay sysPay)
{
return sysPayMapper.selectSysPayList(sysPay);
}
/**
* 新增支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
@Override
public int insertSysPay(SysPay sysPay)
{
sysPay.setCreateTime(DateUtils.getNowDate());
return sysPayMapper.insertSysPay(sysPay);
}
/**
* 修改支付相关
*
* @param sysPay 支付相关
* @return 结果
*/
@Override
public int updateSysPay(SysPay sysPay)
{
sysPay.setUpdateTime(DateUtils.getNowDate());
return sysPayMapper.updateSysPay(sysPay);
}
/**
* 批量删除支付相关
*
* @param ids 需要删除的支付相关主键
* @return 结果
*/
@Override
public int deleteSysPayByIds(Long[] ids)
{
return sysPayMapper.deleteSysPayByIds(ids);
}
/**
* 删除支付相关信息
*
* @param id 支付相关主键
* @return 结果
*/
@Override
public int deleteSysPayById(Long id)
{
return sysPayMapper.deleteSysPayById(id);
}
}

View File

@ -0,0 +1,86 @@
<?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.pay.mapper.SysPayMapper">
<resultMap type="SysPay" id="SysPayResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="figure" column="figure" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysPayVo">
select id, name, state, figure, create_by, create_time, update_by, update_time, remark from sys_pay
</sql>
<select id="selectSysPayList" parameterType="SysPay" resultMap="SysPayResult">
<include refid="selectSysPayVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="state != null and state != ''"> and state = #{state}</if>
<if test="figure != null and figure != ''"> and figure = #{figure}</if>
</where>
</select>
<select id="selectSysPayById" parameterType="Long" resultMap="SysPayResult">
<include refid="selectSysPayVo"/>
where id = #{id}
</select>
<insert id="insertSysPay" parameterType="SysPay" useGeneratedKeys="true" keyProperty="id">
insert into sys_pay
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="state != null">state,</if>
<if test="figure != null">figure,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="state != null">#{state},</if>
<if test="figure != null">#{figure},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysPay" parameterType="SysPay">
update sys_pay
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="state != null">state = #{state},</if>
<if test="figure != null">figure = #{figure},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPayById" parameterType="Long">
delete from sys_pay where id = #{id}
</delete>
<delete id="deleteSysPayByIds" parameterType="String">
delete from sys_pay where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询支付相关列表
export function listWxPay(query) {
return request({
url: '/pay/wxPay/list',
method: 'get',
params: query
})
}
// 查询支付相关详细
export function getWxPay(id) {
return request({
url: '/pay/wxPay/' + id,
method: 'get'
})
}
// 新增支付相关
export function addWxPay(data) {
return request({
url: '/pay/wxPay',
method: 'post',
data: data
})
}
// 修改支付相关
export function updateWxPay(data) {
return request({
url: '/pay/wxPay',
method: 'put',
data: data
})
}
// 删除支付相关
export function delWxPay(id) {
return request({
url: '/pay/wxPay/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,304 @@
<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="name">
<el-input
v-model="queryParams.name"
placeholder="请输入支付名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="支付状态" prop="state">
<el-select v-model="queryParams.state" placeholder="请选择支付状态" clearable>
<el-option
v-for="dict in dict.type.sys_pay_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="金额" prop="figure">
<el-input
v-model="queryParams.figure"
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="['pay:wxPay: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="['pay:wxPay: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="['pay:wxPay: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="['pay:wxPay:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wxPayList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="支付id" align="center" prop="id" />
<el-table-column label="支付名称" align="center" prop="name" />
<el-table-column label="支付状态" align="center" prop="state">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_pay_status" :value="scope.row.state"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="figure" />
<el-table-column label="备注" align="center" prop="remark" />
<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="['pay:wxPay:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['pay:wxPay: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="name">
<el-input v-model="form.name" placeholder="请输入支付名称" />
</el-form-item>
<el-form-item label="支付状态">
<el-radio-group v-model="form.state">
<el-radio
v-for="dict in dict.type.sys_pay_status"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="金额" prop="figure">
<el-input v-model="form.figure" placeholder="请输入金额" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</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 { listWxPay, getWxPay, delWxPay, addWxPay, updateWxPay } from "@/api/pay/wxPay";
export default {
name: "WxPay",
dicts: ['sys_pay_status'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
wxPayList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
state: null,
figure: null,
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "支付名称不能为空", trigger: "blur" }
],
state: [
{ required: true, message: "支付状态不能为空", trigger: "blur" }
],
figure: [
{ required: true, message: "金额不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询支付相关列表 */
getList() {
this.loading = true;
listWxPay(this.queryParams).then(response => {
this.wxPayList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
state: "0",
figure: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: 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
getWxPay(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) {
updateWxPay(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWxPay(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除支付相关编号为"' + ids + '"的数据项?').then(function() {
return delWxPay(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('pay/wxPay/export', {
...this.queryParams
}, `wxPay_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -1,346 +1,346 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="dictName"> <el-form-item label="字典名称" prop="dictName">
<el-input <el-input
v-model="queryParams.dictName" v-model="queryParams.dictName"
placeholder="请输入字典名称" placeholder="请输入字典名称"
clearable clearable
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="字典类型" prop="dictType"> <el-form-item label="字典类型" prop="dictType">
<el-input <el-input
v-model="queryParams.dictType" v-model="queryParams.dictType"
placeholder="请输入字典类型" placeholder="请输入字典类型"
clearable clearable
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="字典状态" placeholder="字典状态"
clearable clearable
style="width: 240px" style="width: 240px"
> >
<el-option <el-option
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dict:add']" v-hasPermi="['system:dict:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
plain plain
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
@click="handleRefreshCache" @click="handleRefreshCache"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button> >刷新缓存</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" /> <el-table-column label="字典编号" align="center" prop="dictId" />
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true"> <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type"> <router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
<span>{{ scope.row.dictType }}</span> <span>{{ scope.row.dictType }}</span>
</router-link> </router-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典名称" prop="dictName"> <el-form-item label="字典名称" prop="dictName">
<el-input v-model="form.dictName" placeholder="请输入字典名称" /> <el-input v-model="form.dictName" placeholder="请输入字典名称" />
</el-form-item> </el-form-item>
<el-form-item label="字典类型" prop="dictType"> <el-form-item label="字典类型" prop="dictType">
<el-input v-model="form.dictType" placeholder="请输入字典类型" /> <el-input v-model="form.dictType" placeholder="请输入字典类型" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{dict.label}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
export default { export default {
name: "Dict", name: "Dict",
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
typeList: [], typeList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
dateRange: [], dateRange: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
dictName: [ dictName: [
{ required: true, message: "字典名称不能为空", trigger: "blur" } { required: true, message: "字典名称不能为空", trigger: "blur" }
], ],
dictType: [ dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" } { required: true, message: "字典类型不能为空", trigger: "blur" }
] ]
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows; this.typeList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
} }
); );
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// //
reset() { reset() {
this.form = { this.form = {
dictId: undefined, dictId: undefined,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: "0", status: "0",
remark: undefined remark: undefined
}; };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加字典类型"; this.title = "添加字典类型";
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId) this.ids = selection.map(item => item.dictId)
this.single = selection.length!=1 this.single = selection.length!=1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const dictId = row.dictId || this.ids const dictId = row.dictId || this.ids
getType(dictId).then(response => { getType(dictId).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改字典类型"; this.title = "修改字典类型";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId != undefined) {
updateType(this.form).then(response => { updateType(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addType(this.form).then(response => { addType(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} }
} }
}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids;
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
return delType(dictIds); return delType(dictIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/dict/type/export', { this.download('system/dict/type/export', {
...this.queryParams ...this.queryParams
}, `type_${new Date().getTime()}.xlsx`) }, `type_${new Date().getTime()}.xlsx`)
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess("刷新成功");
}); });
} }
} }
}; };
</script> </script>