Commit 59624531b617e2df0549c0017d1bbe00e32b8786
1 parent
372b4a70
fix(公众号账号管理): 增、删、改、查
Showing
11 changed files
with
215 additions
and
156 deletions
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/WxAccountController.java
| ... | ... | @@ -25,10 +25,12 @@ import java.util.List; |
| 25 | 25 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 26 | 26 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 27 | 27 | |
| 28 | -// TODO @亚洲:/mp/account 即可 | |
| 28 | +/** | |
| 29 | + * @author fengdan | |
| 30 | + */ | |
| 29 | 31 | @Api(tags = "管理后台 - 公众号账户") |
| 30 | 32 | @RestController |
| 31 | -@RequestMapping("/wechatMp/wx-account") | |
| 33 | +@RequestMapping("/wechatMp/account") | |
| 32 | 34 | @Validated |
| 33 | 35 | public class WxAccountController { |
| 34 | 36 | |
| ... | ... | @@ -37,14 +39,14 @@ public class WxAccountController { |
| 37 | 39 | |
| 38 | 40 | @PostMapping("/create") |
| 39 | 41 | @ApiOperation("创建公众号账户") |
| 40 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:create')") | |
| 42 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:create')") | |
| 41 | 43 | public CommonResult<Long> createWxAccount(@Valid @RequestBody WxAccountCreateReqVO createReqVO) { |
| 42 | 44 | return success(wxAccountService.createWxAccount(createReqVO)); |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | @PutMapping("/update") |
| 46 | 48 | @ApiOperation("更新公众号账户") |
| 47 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:update')") | |
| 49 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:update')") | |
| 48 | 50 | public CommonResult<Boolean> updateWxAccount(@Valid @RequestBody WxAccountUpdateReqVO updateReqVO) { |
| 49 | 51 | wxAccountService.updateWxAccount(updateReqVO); |
| 50 | 52 | return success(true); |
| ... | ... | @@ -53,7 +55,7 @@ public class WxAccountController { |
| 53 | 55 | @DeleteMapping("/delete") |
| 54 | 56 | @ApiOperation("删除公众号账户") |
| 55 | 57 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) |
| 56 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:delete')") | |
| 58 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:delete')") | |
| 57 | 59 | public CommonResult<Boolean> deleteWxAccount(@RequestParam("id") Long id) { |
| 58 | 60 | wxAccountService.deleteWxAccount(id); |
| 59 | 61 | return success(true); |
| ... | ... | @@ -62,7 +64,7 @@ public class WxAccountController { |
| 62 | 64 | @GetMapping("/get") |
| 63 | 65 | @ApiOperation("获得公众号账户") |
| 64 | 66 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 65 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") | |
| 67 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") | |
| 66 | 68 | public CommonResult<WxAccountRespVO> getWxAccount(@RequestParam("id") Long id) { |
| 67 | 69 | WxAccountDO wxAccount = wxAccountService.getWxAccount(id); |
| 68 | 70 | return success(WxAccountConvert.INSTANCE.convert(wxAccount)); |
| ... | ... | @@ -71,7 +73,7 @@ public class WxAccountController { |
| 71 | 73 | @GetMapping("/list") |
| 72 | 74 | @ApiOperation("获得公众号账户列表") |
| 73 | 75 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 74 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") | |
| 76 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") | |
| 75 | 77 | public CommonResult<List<WxAccountRespVO>> getWxAccountList(@RequestParam("ids") Collection<Long> ids) { |
| 76 | 78 | List<WxAccountDO> list = wxAccountService.getWxAccountList(ids); |
| 77 | 79 | return success(WxAccountConvert.INSTANCE.convertList(list)); |
| ... | ... | @@ -79,7 +81,7 @@ public class WxAccountController { |
| 79 | 81 | |
| 80 | 82 | @GetMapping("/page") |
| 81 | 83 | @ApiOperation("获得公众号账户分页") |
| 82 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:query')") | |
| 84 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:query')") | |
| 83 | 85 | public CommonResult<PageResult<WxAccountRespVO>> getWxAccountPage(@Valid WxAccountPageReqVO pageVO) { |
| 84 | 86 | PageResult<WxAccountDO> pageResult = wxAccountService.getWxAccountPage(pageVO); |
| 85 | 87 | return success(WxAccountConvert.INSTANCE.convertPage(pageResult)); |
| ... | ... | @@ -87,7 +89,7 @@ public class WxAccountController { |
| 87 | 89 | |
| 88 | 90 | @GetMapping("/export-excel") |
| 89 | 91 | @ApiOperation("导出公众号账户 Excel") |
| 90 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account:export')") | |
| 92 | + @PreAuthorize("@ss.hasPermission('wechatMp:account:export')") | |
| 91 | 93 | @OperateLog(type = EXPORT) |
| 92 | 94 | public void exportWxAccountExcel(@Valid WxAccountExportReqVO exportReqVO, |
| 93 | 95 | HttpServletResponse response) throws IOException { | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.account.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 3 | +import io.swagger.annotations.ApiModelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 5 | 7 | |
| 6 | 8 | /** |
| 7 | -* 公众号账户 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 8 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 9 | -*/ | |
| 9 | + * 公众号账户 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | + * | |
| 12 | + * @author fengdan | |
| 13 | + */ | |
| 10 | 14 | @Data |
| 11 | 15 | public class WxAccountBaseVO { |
| 12 | 16 | |
| 13 | - @ApiModelProperty(value = "公众号名称") | |
| 17 | + @ApiModelProperty(value = "公众号名称", required = true) | |
| 18 | + @NotNull(message = "公众号名称不能为空") | |
| 14 | 19 | private String name; |
| 15 | 20 | |
| 16 | - @ApiModelProperty(value = "公众号账户") | |
| 21 | + @ApiModelProperty(value = "公众号账户", required = true) | |
| 22 | + @NotNull(message = "公众号账户不能为空") | |
| 17 | 23 | private String account; |
| 18 | 24 | |
| 19 | - @ApiModelProperty(value = "公众号appid") | |
| 20 | - private String appid; | |
| 25 | + @ApiModelProperty(value = "公众号appid", required = true) | |
| 26 | + @NotNull(message = "公众号appid不能为空") | |
| 27 | + private String appId; | |
| 21 | 28 | |
| 22 | - @ApiModelProperty(value = "公众号密钥") | |
| 23 | - private String appsecret; | |
| 29 | + @ApiModelProperty(value = "公众号密钥", required = true) | |
| 30 | + @NotNull(message = "公众号密钥不能为空") | |
| 31 | + private String appSecret; | |
| 24 | 32 | |
| 25 | 33 | @ApiModelProperty(value = "公众号token") |
| 26 | 34 | private String token; |
| 27 | 35 | |
| 28 | 36 | @ApiModelProperty(value = "加密密钥") |
| 29 | - private String aeskey; | |
| 37 | + private String aesKey; | |
| 30 | 38 | |
| 31 | 39 | @ApiModelProperty(value = "备注") |
| 32 | 40 | private String remark; | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountCreateReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.account.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 5 | 7 | |
| 8 | +/** | |
| 9 | + * @author fengdan | |
| 10 | + */ | |
| 6 | 11 | @ApiModel("管理后台 - 公众号账户创建 Request VO") |
| 7 | 12 | @Data |
| 8 | 13 | @EqualsAndHashCode(callSuper = true) | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExcelVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.account.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | - | |
| 6 | 3 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 7 | 8 | |
| 8 | 9 | /** |
| 9 | 10 | * 公众号账户 Excel VO |
| ... | ... | @@ -23,10 +24,7 @@ public class WxAccountExcelVO { |
| 23 | 24 | private String account; |
| 24 | 25 | |
| 25 | 26 | @ExcelProperty("公众号appid") |
| 26 | - private String appid; | |
| 27 | - | |
| 28 | - @ExcelProperty("公众号密钥") | |
| 29 | - private String appsecret; | |
| 27 | + private String appId; | |
| 30 | 28 | |
| 31 | 29 | @ExcelProperty("公众号url") |
| 32 | 30 | private String url; |
| ... | ... | @@ -35,7 +33,7 @@ public class WxAccountExcelVO { |
| 35 | 33 | private String token; |
| 36 | 34 | |
| 37 | 35 | @ExcelProperty("加密密钥") |
| 38 | - private String aeskey; | |
| 36 | + private String aesKey; | |
| 39 | 37 | |
| 40 | 38 | @ExcelProperty("二维码图片URL") |
| 41 | 39 | private String qrCodeUrl; |
| ... | ... | @@ -45,5 +43,4 @@ public class WxAccountExcelVO { |
| 45 | 43 | |
| 46 | 44 | @ExcelProperty("创建时间") |
| 47 | 45 | private Date createTime; |
| 48 | - | |
| 49 | 46 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountExportReqVO.java
| ... | ... | @@ -7,6 +7,9 @@ import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 7 | |
| 8 | 8 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 9 | 9 | |
| 10 | +/** | |
| 11 | + * @author fengdan | |
| 12 | + */ | |
| 10 | 13 | @ApiModel(value = "管理后台 - 公众号账户 Excel 导出 Request VO", description = "参数和 WxAccountPageReqVO 是一致的") |
| 11 | 14 | @Data |
| 12 | 15 | public class WxAccountExportReqVO { |
| ... | ... | @@ -18,7 +21,7 @@ public class WxAccountExportReqVO { |
| 18 | 21 | private String account; |
| 19 | 22 | |
| 20 | 23 | @ApiModelProperty(value = "公众号appid") |
| 21 | - private String appid; | |
| 24 | + private String appId; | |
| 22 | 25 | |
| 23 | 26 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 24 | 27 | @ApiModelProperty(value = "开始创建时间") | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountPageReqVO.java
| ... | ... | @@ -8,12 +8,14 @@ import org.springframework.format.annotation.DateTimeFormat; |
| 8 | 8 | |
| 9 | 9 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 10 | 10 | |
| 11 | +/** | |
| 12 | + * @author fengdan | |
| 13 | + */ | |
| 11 | 14 | @ApiModel("管理后台 - 公众号账户分页 Request VO") |
| 12 | 15 | @Data |
| 13 | 16 | @EqualsAndHashCode(callSuper = true) |
| 14 | 17 | @ToString(callSuper = true) |
| 15 | 18 | public class WxAccountPageReqVO extends PageParam { |
| 16 | - | |
| 17 | 19 | @ApiModelProperty(value = "公众号名称") |
| 18 | 20 | private String name; |
| 19 | 21 | |
| ... | ... | @@ -21,7 +23,7 @@ public class WxAccountPageReqVO extends PageParam { |
| 21 | 23 | private String account; |
| 22 | 24 | |
| 23 | 25 | @ApiModelProperty(value = "公众号appid") |
| 24 | - private String appid; | |
| 26 | + private String appId; | |
| 25 | 27 | |
| 26 | 28 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 27 | 29 | @ApiModelProperty(value = "开始创建时间") |
| ... | ... | @@ -30,5 +32,4 @@ public class WxAccountPageReqVO extends PageParam { |
| 30 | 32 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 31 | 33 | @ApiModelProperty(value = "结束创建时间") |
| 32 | 34 | private Date endCreateTime; |
| 33 | - | |
| 34 | 35 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.account.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.annotations.*; | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 6 | 8 | |
| 9 | +import java.util.Date; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * @author fengdan | |
| 13 | + */ | |
| 7 | 14 | @ApiModel("管理后台 - 公众号账户 Response VO") |
| 8 | 15 | @Data |
| 9 | 16 | @EqualsAndHashCode(callSuper = true) |
| ... | ... | @@ -22,4 +29,6 @@ public class WxAccountRespVO extends WxAccountBaseVO { |
| 22 | 29 | @ApiModelProperty(value = "创建时间", required = true) |
| 23 | 30 | private Date createTime; |
| 24 | 31 | |
| 32 | + @ApiModelProperty(value = "公众号密钥", required = true) | |
| 33 | + private String appSecret; | |
| 25 | 34 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/account/vo/WxAccountUpdateReqVO.java
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/account/WxAccountMapper.java
| ... | ... | @@ -22,7 +22,7 @@ public interface WxAccountMapper extends BaseMapperX<WxAccountDO> { |
| 22 | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<WxAccountDO>() |
| 23 | 23 | .likeIfPresent(WxAccountDO::getName, reqVO.getName()) |
| 24 | 24 | .eqIfPresent(WxAccountDO::getAccount, reqVO.getAccount()) |
| 25 | - .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppid()) | |
| 25 | + .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppId()) | |
| 26 | 26 | .betweenIfPresent(WxAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) |
| 27 | 27 | .orderByDesc(WxAccountDO::getId)); |
| 28 | 28 | } |
| ... | ... | @@ -31,7 +31,7 @@ public interface WxAccountMapper extends BaseMapperX<WxAccountDO> { |
| 31 | 31 | return selectList(new LambdaQueryWrapperX<WxAccountDO>() |
| 32 | 32 | .likeIfPresent(WxAccountDO::getName, reqVO.getName()) |
| 33 | 33 | .eqIfPresent(WxAccountDO::getAccount, reqVO.getAccount()) |
| 34 | - .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppid()) | |
| 34 | + .eqIfPresent(WxAccountDO::getAppId, reqVO.getAppId()) | |
| 35 | 35 | .betweenIfPresent(WxAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) |
| 36 | 36 | .orderByDesc(WxAccountDO::getId)); |
| 37 | 37 | } | ... | ... |
yudao-ui-admin/src/api/wechatMp/wxAccount.js
| 1 | 1 | import request from '@/utils/request' |
| 2 | 2 | |
| 3 | 3 | // 创建公众号账户 |
| 4 | -export function createWxAccount(data) { | |
| 4 | +export function createAccount(data) { | |
| 5 | 5 | return request({ |
| 6 | - url: '/wechatMp/wx-account/create', | |
| 6 | + url: '/wechatMp/account/create', | |
| 7 | 7 | method: 'post', |
| 8 | 8 | data: data |
| 9 | 9 | }) |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // 更新公众号账户 |
| 13 | -export function updateWxAccount(data) { | |
| 13 | +export function updateAccount(data) { | |
| 14 | 14 | return request({ |
| 15 | - url: '/wechatMp/wx-account/update', | |
| 15 | + url: '/wechatMp/account/update', | |
| 16 | 16 | method: 'put', |
| 17 | 17 | data: data |
| 18 | 18 | }) |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // 删除公众号账户 |
| 22 | -export function deleteWxAccount(id) { | |
| 22 | +export function deleteAccount(id) { | |
| 23 | 23 | return request({ |
| 24 | - url: '/wechatMp/wx-account/delete?id=' + id, | |
| 24 | + url: '/wechatMp/account/delete?id=' + id, | |
| 25 | 25 | method: 'delete' |
| 26 | 26 | }) |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // 获得公众号账户 |
| 30 | -export function getWxAccount(id) { | |
| 30 | +export function getAccount(id) { | |
| 31 | 31 | return request({ |
| 32 | - url: '/wechatMp/wx-account/get?id=' + id, | |
| 32 | + url: '/wechatMp/account/get?id=' + id, | |
| 33 | 33 | method: 'get' |
| 34 | 34 | }) |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // 获得公众号账户分页 |
| 38 | -export function getWxAccountPage(query) { | |
| 38 | +export function getAccountPage(query) { | |
| 39 | 39 | return request({ |
| 40 | - url: '/wechatMp/wx-account/page', | |
| 40 | + url: '/wechatMp/account/page', | |
| 41 | 41 | method: 'get', |
| 42 | 42 | params: query |
| 43 | 43 | }) |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // 导出公众号账户 Excel |
| 47 | -export function exportWxAccountExcel(query) { | |
| 47 | +export function exportAccountExcel(query) { | |
| 48 | 48 | return request({ |
| 49 | - url: '/wechatMp/wx-account/export-excel', | |
| 49 | + url: '/wechatMp/account/export-excel', | |
| 50 | 50 | method: 'get', |
| 51 | 51 | params: query, |
| 52 | 52 | responseType: 'blob' | ... | ... |
yudao-ui-admin/src/views/wechatMp/wxAccount/index.vue
| ... | ... | @@ -3,18 +3,13 @@ |
| 3 | 3 | |
| 4 | 4 | <!-- 搜索工作栏 --> |
| 5 | 5 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| 6 | - <el-form-item label="公众号名称" prop="name"> | |
| 7 | - <el-input v-model="queryParams.name" placeholder="请输入公众号名称" clearable @keyup.enter.native="handleQuery"/> | |
| 8 | - </el-form-item> | |
| 9 | - <el-form-item label="公众号账户" prop="account"> | |
| 10 | - <el-input v-model="queryParams.account" placeholder="请输入公众号账户" clearable @keyup.enter.native="handleQuery"/> | |
| 11 | - </el-form-item> | |
| 12 | - <el-form-item label="公众号appId" prop="appId"> | |
| 13 | - <el-input v-model="queryParams.appId" placeholder="请输入公众号appId" clearable @keyup.enter.native="handleQuery"/> | |
| 6 | + <el-form-item label="名称" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入公众号名称" clearable | |
| 8 | + @keyup.enter.native="handleQuery"/> | |
| 14 | 9 | </el-form-item> |
| 15 | 10 | <el-form-item label="创建时间"> |
| 16 | 11 | <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
| 17 | - type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | |
| 12 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/> | |
| 18 | 13 | </el-form-item> |
| 19 | 14 | <el-form-item> |
| 20 | 15 | <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
| ... | ... | @@ -26,27 +21,29 @@ |
| 26 | 21 | <el-row :gutter="10" class="mb8"> |
| 27 | 22 | <el-col :span="1.5"> |
| 28 | 23 | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" |
| 29 | - v-hasPermi="['wechatMp:wx-account:create']">新增</el-button> | |
| 24 | + v-hasPermi="['wechatMp:account:create']">新增 | |
| 25 | + </el-button> | |
| 30 | 26 | </el-col> |
| 31 | 27 | <el-col :span="1.5"> |
| 32 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | |
| 33 | - v-hasPermi="['wechatMp:wx-account:export']">导出</el-button> | |
| 28 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | |
| 29 | + :loading="exportLoading" | |
| 30 | + v-hasPermi="['wechatMp:account:export']">导出 | |
| 31 | + </el-button> | |
| 34 | 32 | </el-col> |
| 35 | 33 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 36 | 34 | </el-row> |
| 37 | 35 | |
| 38 | 36 | <!-- 列表 --> |
| 39 | 37 | <el-table v-loading="loading" :data="list"> |
| 40 | - <el-table-column label="编号" align="center" prop="id" /> | |
| 41 | - <el-table-column label="公众号名称" align="center" prop="name" /> | |
| 42 | - <el-table-column label="公众号账户" align="center" prop="account" /> | |
| 43 | - <el-table-column label="公众号appId" align="center" prop="appId"/> | |
| 44 | - <el-table-column label="公众号密钥" align="center" prop="appSecret"/> | |
| 45 | - <el-table-column label="公众号url" align="center" prop="url" /> | |
| 46 | - <el-table-column label="公众号token" align="center" prop="token" /> | |
| 38 | + <el-table-column label="编号" align="center" prop="id"/> | |
| 39 | + <el-table-column label="名称" align="center" prop="name"/> | |
| 40 | + <el-table-column label="微信原始ID" align="center" prop="account"/> | |
| 41 | + <el-table-column label="appId" align="center" prop="appId"/> | |
| 42 | + <el-table-column label="url" align="center" prop="url"/> | |
| 43 | + <el-table-column label="Token" align="center" prop="token"/> | |
| 47 | 44 | <el-table-column label="加密密钥" align="center" prop="aesKey"/> |
| 48 | - <el-table-column label="二维码图片URL" align="center" prop="qrCodeUrl"/> | |
| 49 | - <el-table-column label="备注" align="center" prop="remark" /> | |
| 45 | + <el-table-column label="二维码" align="center" prop="qrCodeUrl"/> | |
| 46 | + <el-table-column label="备注" align="center" prop="remark"/> | |
| 50 | 47 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| 51 | 48 | <template slot-scope="scope"> |
| 52 | 49 | <span>{{ parseTime(scope.row.createTime) }}</span> |
| ... | ... | @@ -55,9 +52,11 @@ |
| 55 | 52 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 56 | 53 | <template slot-scope="scope"> |
| 57 | 54 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| 58 | - v-hasPermi="['wechatMp:wx-account:update']">修改</el-button> | |
| 55 | + v-hasPermi="['wechatMp:account:update']">修改 | |
| 56 | + </el-button> | |
| 59 | 57 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| 60 | - v-hasPermi="['wechatMp:wx-account:delete']">删除</el-button> | |
| 58 | + v-hasPermi="['wechatMp:account:delete']">删除 | |
| 59 | + </el-button> | |
| 61 | 60 | </template> |
| 62 | 61 | </el-table-column> |
| 63 | 62 | </el-table> |
| ... | ... | @@ -69,25 +68,41 @@ |
| 69 | 68 | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| 70 | 69 | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| 71 | 70 | <el-form-item label="公众号名称" prop="name"> |
| 72 | - <el-input v-model="form.name" placeholder="请输入公众号名称" /> | |
| 73 | - </el-form-item> | |
| 74 | - <el-form-item label="公众号账户" prop="account"> | |
| 75 | - <el-input v-model="form.account" placeholder="请输入公众号账户" /> | |
| 76 | - </el-form-item> | |
| 77 | - <el-form-item label="公众号appId" prop="appId"> | |
| 78 | - <el-input v-model="form.appId" placeholder="请输入公众号appId"/> | |
| 71 | + <el-input v-model="form.name" placeholder="请输入公众号名称"/> | |
| 79 | 72 | </el-form-item> |
| 80 | - <el-form-item label="公众号密钥" prop="appSecret"> | |
| 81 | - <el-input v-model="form.appSecret" placeholder="请输入公众号密钥"/> | |
| 82 | - </el-form-item> | |
| 83 | - <el-form-item label="公众号token" prop="token"> | |
| 84 | - <el-input v-model="form.token" placeholder="请输入公众号token" /> | |
| 73 | + | |
| 74 | + <el-tooltip class="item" effect="dark" | |
| 75 | + content="在微信公众平台(mp.weixin.qq.com)的菜单【设置】-【公众号设置】-【帐号详情】中能找到原始ID" | |
| 76 | + placement="right"> | |
| 77 | + <el-form-item label="微信原始ID" prop="account"> | |
| 78 | + <el-input v-model="form.account" placeholder="请输入微信原始ID" :disabled='disabled'/> | |
| 79 | + </el-form-item> | |
| 80 | + </el-tooltip> | |
| 81 | + | |
| 82 | + <el-tooltip class="item" effect="dark" | |
| 83 | + content="在微信公众平台(mp.weixin.qq.com)的菜单【开发】-【基本配置】中能找到AppID " | |
| 84 | + placement="right"> | |
| 85 | + <el-form-item label="AppID" prop="appId"> | |
| 86 | + <el-input v-model="form.appId" placeholder="请输入公众号appId" :disabled='disabled'/> | |
| 87 | + </el-form-item> | |
| 88 | + </el-tooltip> | |
| 89 | + | |
| 90 | + <el-tooltip class="item" effect="dark" | |
| 91 | + content="在微信公众平台(mp.weixin.qq.com)的菜单【开发】-【基本配置】中能找到AppSecret" | |
| 92 | + placement="right"> | |
| 93 | + <el-form-item label="AppSecret" prop="appSecret"> | |
| 94 | + <el-input v-model="form.appSecret" placeholder="请输入公众号密钥" :disabled='disabled'/> | |
| 95 | + </el-form-item> | |
| 96 | + </el-tooltip> | |
| 97 | + | |
| 98 | + <el-form-item label="token" prop="token"> | |
| 99 | + <el-input v-model="form.token" placeholder="请输入公众号token"/> | |
| 85 | 100 | </el-form-item> |
| 86 | 101 | <el-form-item label="加密密钥" prop="aesKey"> |
| 87 | 102 | <el-input v-model="form.aesKey" placeholder="请输入加密密钥"/> |
| 88 | 103 | </el-form-item> |
| 89 | 104 | <el-form-item label="备注" prop="remark"> |
| 90 | - <el-input v-model="form.remark" placeholder="请输入备注" /> | |
| 105 | + <el-input v-model="form.remark" placeholder="请输入备注"/> | |
| 91 | 106 | </el-form-item> |
| 92 | 107 | </el-form> |
| 93 | 108 | <div slot="footer" class="dialog-footer"> |
| ... | ... | @@ -99,12 +114,18 @@ |
| 99 | 114 | </template> |
| 100 | 115 | |
| 101 | 116 | <script> |
| 102 | -import { createWxAccount, updateWxAccount, deleteWxAccount, getWxAccount, getWxAccountPage, exportWxAccountExcel } from "@/api/wechatMp/wxAccount"; | |
| 117 | +import { | |
| 118 | + createAccount, | |
| 119 | + deleteAccount, | |
| 120 | + exportAccountExcel, | |
| 121 | + getAccount, | |
| 122 | + getAccountPage, | |
| 123 | + updateAccount | |
| 124 | +} from '@/api/wechatMp/wxAccount' | |
| 103 | 125 | |
| 104 | 126 | export default { |
| 105 | - name: "WxAccount", | |
| 106 | - components: { | |
| 107 | - }, | |
| 127 | + name: 'wxAccount', | |
| 128 | + components: {}, | |
| 108 | 129 | data() { |
| 109 | 130 | return { |
| 110 | 131 | // 遮罩层 |
| ... | ... | @@ -118,7 +139,7 @@ export default { |
| 118 | 139 | // 公众号账户列表 |
| 119 | 140 | list: [], |
| 120 | 141 | // 弹出层标题 |
| 121 | - title: "", | |
| 142 | + title: '', | |
| 122 | 143 | // 是否显示弹出层 |
| 123 | 144 | open: false, |
| 124 | 145 | dateRangeCreateTime: [], |
| ... | ... | @@ -134,30 +155,37 @@ export default { |
| 134 | 155 | form: {}, |
| 135 | 156 | // 表单校验 |
| 136 | 157 | rules: { |
| 137 | - } | |
| 138 | - }; | |
| 158 | + name: [{required: true, message: '公众号名称不能为空', trigger: 'blur'}], | |
| 159 | + account: [{required: true, message: '公众号账户不能为空', trigger: 'blur'}], | |
| 160 | + appId: [{required: true, message: '公众号appid不能为空', trigger: 'blur'}], | |
| 161 | + appSecret: [{required: true, message: '公众号密钥不能为空', trigger: 'blur'}], | |
| 162 | + }, | |
| 163 | + // 禁用属性 | |
| 164 | + disabled: false, | |
| 165 | + } | |
| 139 | 166 | }, |
| 140 | 167 | created() { |
| 141 | - this.getList(); | |
| 168 | + this.getList() | |
| 142 | 169 | }, |
| 143 | 170 | methods: { |
| 144 | 171 | /** 查询列表 */ |
| 145 | 172 | getList() { |
| 146 | - this.loading = true; | |
| 173 | + this.loading = true | |
| 147 | 174 | // 处理查询参数 |
| 148 | - let params = {...this.queryParams}; | |
| 149 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | |
| 175 | + let params = {...this.queryParams} | |
| 176 | + this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime') | |
| 150 | 177 | // 执行查询 |
| 151 | - getWxAccountPage(params).then(response => { | |
| 152 | - this.list = response.data.list; | |
| 153 | - this.total = response.data.total; | |
| 154 | - this.loading = false; | |
| 155 | - }); | |
| 178 | + getAccountPage(params).then(response => { | |
| 179 | + this.list = response.data.list | |
| 180 | + this.total = response.data.total | |
| 181 | + this.loading = false | |
| 182 | + }) | |
| 156 | 183 | }, |
| 157 | 184 | /** 取消按钮 */ |
| 158 | 185 | cancel() { |
| 159 | - this.open = false; | |
| 160 | - this.reset(); | |
| 186 | + this.open = false | |
| 187 | + this.disabled = false | |
| 188 | + this.reset() | |
| 161 | 189 | }, |
| 162 | 190 | /** 表单重置 */ |
| 163 | 191 | reset() { |
| ... | ... | @@ -170,85 +198,88 @@ export default { |
| 170 | 198 | token: undefined, |
| 171 | 199 | aesKey: undefined, |
| 172 | 200 | remark: undefined, |
| 173 | - }; | |
| 174 | - this.resetForm("form"); | |
| 201 | + } | |
| 202 | + this.resetForm('form') | |
| 175 | 203 | }, |
| 176 | 204 | /** 搜索按钮操作 */ |
| 177 | 205 | handleQuery() { |
| 178 | - this.queryParams.pageNo = 1; | |
| 179 | - this.getList(); | |
| 206 | + this.queryParams.pageNo = 1 | |
| 207 | + this.getList() | |
| 180 | 208 | }, |
| 181 | 209 | /** 重置按钮操作 */ |
| 182 | 210 | resetQuery() { |
| 183 | - this.dateRangeCreateTime = []; | |
| 184 | - this.resetForm("queryForm"); | |
| 185 | - this.handleQuery(); | |
| 211 | + this.dateRangeCreateTime = [] | |
| 212 | + this.resetForm('queryForm') | |
| 213 | + this.handleQuery() | |
| 186 | 214 | }, |
| 187 | 215 | /** 新增按钮操作 */ |
| 188 | 216 | handleAdd() { |
| 189 | - this.reset(); | |
| 190 | - this.open = true; | |
| 191 | - this.title = "添加公众号账户"; | |
| 217 | + this.reset() | |
| 218 | + this.open = true | |
| 219 | + this.title = '添加公众号账户' | |
| 192 | 220 | }, |
| 193 | 221 | /** 修改按钮操作 */ |
| 194 | 222 | handleUpdate(row) { |
| 195 | - this.reset(); | |
| 196 | - const id = row.id; | |
| 197 | - getWxAccount(id).then(response => { | |
| 198 | - this.form = response.data; | |
| 199 | - this.open = true; | |
| 200 | - this.title = "修改公众号账户"; | |
| 201 | - }); | |
| 223 | + this.reset() | |
| 224 | + const id = row.id | |
| 225 | + getAccount(id).then(response => { | |
| 226 | + this.form = response.data | |
| 227 | + this.open = true | |
| 228 | + this.title = '修改公众号账户' | |
| 229 | + this.disabled = true | |
| 230 | + }) | |
| 202 | 231 | }, |
| 203 | 232 | /** 提交按钮 */ |
| 204 | 233 | submitForm() { |
| 205 | - this.$refs["form"].validate(valid => { | |
| 234 | + this.$refs['form'].validate(valid => { | |
| 206 | 235 | if (!valid) { |
| 207 | - return; | |
| 236 | + return | |
| 208 | 237 | } |
| 209 | 238 | // 修改的提交 |
| 210 | 239 | if (this.form.id != null) { |
| 211 | - updateWxAccount(this.form).then(response => { | |
| 212 | - this.$modal.msgSuccess("修改成功"); | |
| 213 | - this.open = false; | |
| 214 | - this.getList(); | |
| 215 | - }); | |
| 216 | - return; | |
| 240 | + updateAccount(this.form).then(response => { | |
| 241 | + this.$modal.msgSuccess('修改成功') | |
| 242 | + this.open = false | |
| 243 | + this.getList() | |
| 244 | + }) | |
| 245 | + return | |
| 217 | 246 | } |
| 218 | 247 | // 添加的提交 |
| 219 | - createWxAccount(this.form).then(response => { | |
| 220 | - this.$modal.msgSuccess("新增成功"); | |
| 221 | - this.open = false; | |
| 222 | - this.getList(); | |
| 223 | - }); | |
| 224 | - }); | |
| 248 | + createAccount(this.form).then(response => { | |
| 249 | + this.$modal.msgSuccess('新增成功') | |
| 250 | + this.open = false | |
| 251 | + this.getList() | |
| 252 | + }) | |
| 253 | + }) | |
| 225 | 254 | }, |
| 226 | 255 | /** 删除按钮操作 */ |
| 227 | 256 | handleDelete(row) { |
| 228 | - const id = row.id; | |
| 229 | - this.$modal.confirm('是否确认删除公众号账户编号为"' + id + '"的数据项?').then(function() { | |
| 230 | - return deleteWxAccount(id); | |
| 231 | - }).then(() => { | |
| 232 | - this.getList(); | |
| 233 | - this.$modal.msgSuccess("删除成功"); | |
| 234 | - }).catch(() => {}); | |
| 257 | + const id = row.id | |
| 258 | + this.$modal.confirm('是否确认删除公众号账户编号为"' + id + '"的数据项?').then(function () { | |
| 259 | + return deleteAccount(id) | |
| 260 | + }).then(() => { | |
| 261 | + this.getList() | |
| 262 | + this.$modal.msgSuccess('删除成功') | |
| 263 | + }).catch(() => { | |
| 264 | + }) | |
| 235 | 265 | }, |
| 236 | 266 | /** 导出按钮操作 */ |
| 237 | 267 | handleExport() { |
| 238 | 268 | // 处理查询参数 |
| 239 | - let params = {...this.queryParams}; | |
| 240 | - params.pageNo = undefined; | |
| 241 | - params.pageSize = undefined; | |
| 242 | - this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | |
| 269 | + let params = {...this.queryParams} | |
| 270 | + params.pageNo = undefined | |
| 271 | + params.pageSize = undefined | |
| 272 | + this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime') | |
| 243 | 273 | // 执行导出 |
| 244 | 274 | this.$modal.confirm('是否确认导出所有公众号账户数据项?').then(() => { |
| 245 | - this.exportLoading = true; | |
| 246 | - return exportWxAccountExcel(params); | |
| 247 | - }).then(response => { | |
| 248 | - this.$download.excel(response, '公众号账户.xls'); | |
| 249 | - this.exportLoading = false; | |
| 250 | - }).catch(() => {}); | |
| 275 | + this.exportLoading = true | |
| 276 | + return exportAccountExcel(params) | |
| 277 | + }).then(response => { | |
| 278 | + this.$download.excel(response, '公众号账户.xls') | |
| 279 | + this.exportLoading = false | |
| 280 | + }).catch(() => { | |
| 281 | + }) | |
| 251 | 282 | } |
| 252 | 283 | } |
| 253 | -}; | |
| 284 | +} | |
| 254 | 285 | </script> | ... | ... |