@ -0,0 +1,116 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">应用用户表</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">用户名:</text></view> | |||
<input placeholder="请输入用户名" v-model="model.nickName"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">头像:</text></view> | |||
<input placeholder="请输入头像" v-model="model.avatar"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">手机号:</text></view> | |||
<input placeholder="请输入手机号" v-model="model.phone"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">密码:</text></view> | |||
<input placeholder="请输入密码" v-model="model.password"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">状态:</text></view> | |||
<input type="number" placeholder="请输入状态" v-model="model.status"/> | |||
</view> | |||
</view> | |||
<my-date label="最后登录时间:" v-model="model.lastLoginAt" placeholder="请输入最后登录时间"></my-date> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">最后登录 IP:</text></view> | |||
<input placeholder="请输入最后登录 IP" v-model="model.lastLoginIp"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<my-date label="更新日期:" v-model="model.updateTime" placeholder="请输入更新日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppUserForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/appuser/appUser/queryById", | |||
add: "/appuser/appUser/add", | |||
edit: "/appuser/appUser/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">应用用户表</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '应用用户表', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/appuser/appUser/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,184 @@ | |||
package org.jeecg.modules.demo.notice.controller; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.system.query.QueryRuleEnum; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.demo.notice.entity.AppNotice; | |||
import org.jeecg.modules.demo.notice.service.IAppNoticeService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
/** | |||
* @Description: 公告管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="公告管理") | |||
@RestController | |||
@RequestMapping("/notice/appNotice") | |||
@Slf4j | |||
public class AppNoticeController extends JeecgController<AppNotice, IAppNoticeService> { | |||
@Autowired | |||
private IAppNoticeService appNoticeService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param appNotice | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "公告管理-分页列表查询") | |||
@ApiOperation(value="公告管理-分页列表查询", notes="公告管理-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AppNotice>> queryPageList(AppNotice appNotice, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
// 自定义查询规则 | |||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>(); | |||
// 自定义多选的查询规则为:LIKE_WITH_OR | |||
customeRuleMap.put("status", QueryRuleEnum.LIKE_WITH_OR); | |||
QueryWrapper<AppNotice> queryWrapper = QueryGenerator.initQueryWrapper(appNotice, req.getParameterMap(),customeRuleMap); | |||
Page<AppNotice> page = new Page<AppNotice>(pageNo, pageSize); | |||
IPage<AppNotice> pageList = appNoticeService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param appNotice | |||
* @return | |||
*/ | |||
@AutoLog(value = "公告管理-添加") | |||
@ApiOperation(value="公告管理-添加", notes="公告管理-添加") | |||
@RequiresPermissions("notice:app_notice:add") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AppNotice appNotice) { | |||
appNoticeService.save(appNotice); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param appNotice | |||
* @return | |||
*/ | |||
@AutoLog(value = "公告管理-编辑") | |||
@ApiOperation(value="公告管理-编辑", notes="公告管理-编辑") | |||
@RequiresPermissions("notice:app_notice:edit") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AppNotice appNotice) { | |||
appNoticeService.updateById(appNotice); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "公告管理-通过id删除") | |||
@ApiOperation(value="公告管理-通过id删除", notes="公告管理-通过id删除") | |||
@RequiresPermissions("notice:app_notice:delete") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
appNoticeService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "公告管理-批量删除") | |||
@ApiOperation(value="公告管理-批量删除", notes="公告管理-批量删除") | |||
@RequiresPermissions("notice:app_notice:deleteBatch") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.appNoticeService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "公告管理-通过id查询") | |||
@ApiOperation(value="公告管理-通过id查询", notes="公告管理-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<AppNotice> queryById(@RequestParam(name="id",required=true) String id) { | |||
AppNotice appNotice = appNoticeService.getById(id); | |||
if(appNotice==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(appNotice); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param appNotice | |||
*/ | |||
@RequiresPermissions("notice:app_notice:exportXls") | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AppNotice appNotice) { | |||
return super.exportXls(request, appNotice, AppNotice.class, "公告管理"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequiresPermissions("notice:app_notice:importExcel") | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AppNotice.class); | |||
} | |||
} |
@ -0,0 +1,77 @@ | |||
package org.jeecg.modules.demo.notice.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableLogic; | |||
import org.jeecg.common.constant.ProvinceCityArea; | |||
import org.jeecg.common.util.SpringContextUtils; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 公告管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("app_notice") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="app_notice对象", description="公告管理") | |||
public class AppNotice implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**标题*/ | |||
@Excel(name = "标题", width = 15) | |||
@ApiModelProperty(value = "标题") | |||
private java.lang.String title; | |||
/**内容*/ | |||
@Excel(name = "内容", width = 15) | |||
@ApiModelProperty(value = "内容") | |||
private java.lang.String content; | |||
/**状态*/ | |||
@Excel(name = "状态", width = 15, dicCode = "dict_item_status") | |||
@Dict(dicCode = "dict_item_status") | |||
@ApiModelProperty(value = "状态") | |||
private java.lang.Integer status; | |||
/**排序*/ | |||
@Excel(name = "排序", width = 15) | |||
@ApiModelProperty(value = "排序") | |||
private java.lang.Integer sort; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**所属部门*/ | |||
@ApiModelProperty(value = "所属部门") | |||
private java.lang.String sysOrgCode; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.demo.notice.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.demo.notice.entity.AppNotice; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 公告管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AppNoticeMapper extends BaseMapper<AppNotice> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.demo.notice.mapper.AppNoticeMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.demo.notice.service; | |||
import org.jeecg.modules.demo.notice.entity.AppNotice; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 公告管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAppNoticeService extends IService<AppNotice> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.demo.notice.service.impl; | |||
import org.jeecg.modules.demo.notice.entity.AppNotice; | |||
import org.jeecg.modules.demo.notice.mapper.AppNoticeMapper; | |||
import org.jeecg.modules.demo.notice.service.IAppNoticeService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 公告管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AppNoticeServiceImpl extends ServiceImpl<AppNoticeMapper, AppNotice> implements IAppNoticeService { | |||
} |
@ -0,0 +1,102 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">公告管理</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">标题:</text></view> | |||
<input placeholder="请输入标题" v-model="model.title"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">内容:</text></view> | |||
<input placeholder="请输入内容" v-model="model.content"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">状态:</text></view> | |||
<input type="number" placeholder="请输入状态" v-model="model.status"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">排序:</text></view> | |||
<input type="number" placeholder="请输入排序" v-model="model.sort"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppNoticeForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/notice/appNotice/queryById", | |||
add: "/notice/appNotice/add", | |||
edit: "/notice/appNotice/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">公告管理</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '公告管理', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/notice/appNotice/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,64 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { useMessage } from "/@/hooks/web/useMessage"; | |||
const { createConfirm } = useMessage(); | |||
enum Api { | |||
list = '/notice/appNotice/list', | |||
save='/notice/appNotice/add', | |||
edit='/notice/appNotice/edit', | |||
deleteOne = '/notice/appNotice/delete', | |||
deleteBatch = '/notice/appNotice/deleteBatch', | |||
importExcel = '/notice/appNotice/importExcel', | |||
exportXls = '/notice/appNotice/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
createConfirm({ | |||
iconType: 'warning', | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,128 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
import { getWeekMonthQuarterYear } from '/@/utils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '标题', | |||
align:"center", | |||
dataIndex: 'title' | |||
}, | |||
{ | |||
title: '状态', | |||
align:"center", | |||
dataIndex: 'status_dictText' | |||
}, | |||
{ | |||
title: '排序', | |||
align:"center", | |||
sorter: true, | |||
dataIndex: 'sort' | |||
}, | |||
{ | |||
title: '创建日期', | |||
align:"center", | |||
sorter: true, | |||
dataIndex: 'createTime' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
{ | |||
label: "标题", | |||
field: "title", | |||
component: 'JInput', | |||
}, | |||
{ | |||
label: "状态", | |||
field: 'status', | |||
component: 'JSelectMultiple', | |||
componentProps:{ | |||
dictCode:"dict_item_status" | |||
}, | |||
//colProps: {span: 6}, | |||
}, | |||
{ | |||
label: "创建日期", | |||
field: "createTime", | |||
component: 'RangePicker', | |||
componentProps: { | |||
valueType: 'Date', | |||
showTime:true | |||
}, | |||
//colProps: {span: 6}, | |||
}, | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '标题', | |||
field: 'title', | |||
component: 'Input', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入标题!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '内容', | |||
field: 'content', | |||
component: 'JEditor', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入内容!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '状态', | |||
field: 'status', | |||
component: 'JDictSelectTag', | |||
componentProps:{ | |||
dictCode:"dict_item_status", | |||
type: "radio" | |||
}, | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入状态!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '排序', | |||
field: 'sort', | |||
component: 'InputNumber', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入排序!'}, | |||
]; | |||
}, | |||
}, | |||
// TODO 主键隐藏字段,目前写死为ID | |||
{ | |||
label: '', | |||
field: 'id', | |||
component: 'Input', | |||
show: false | |||
}, | |||
]; | |||
// 高级查询数据 | |||
export const superQuerySchema = { | |||
title: {title: '标题',order: 0,view: 'text', type: 'string',}, | |||
status: {title: '状态',order: 2,view: 'number', type: 'number',dictCode: 'dict_item_status',}, | |||
sort: {title: '排序',order: 3,view: 'number', type: 'number',}, | |||
createTime: {title: '创建日期',order: 4,view: 'datetime', type: 'string',}, | |||
}; | |||
/** | |||
* 流程表单调用这个方法获取formSchema | |||
* @param param | |||
*/ | |||
export function getBpmFormSchema(_formData): FormSchema[]{ | |||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
return formSchema; | |||
} |
@ -0,0 +1,195 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" v-auth="'notice:app_notice:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" v-auth="'notice:app_notice:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" v-auth="'notice:app_notice:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button v-auth="'notice:app_notice:deleteBatch'">批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
<!-- 高级查询 --> | |||
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template v-slot:bodyCell="{ column, record, index, text }"> | |||
<template v-if="column.dataIndex==='content'"> | |||
<!--富文本件字段回显插槽--> | |||
<div v-html="text"></div> | |||
</template> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AppNoticeModal @register="registerModal" @success="handleSuccess"></AppNoticeModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="notice-appNotice" setup> | |||
import {ref, reactive, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AppNoticeModal from './components/AppNoticeModal.vue' | |||
import {columns, searchFormSchema, superQuerySchema} from './AppNotice.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppNotice.api'; | |||
import { downloadFile } from '/@/utils/common/renderUtils'; | |||
import { useUserStore } from '/@/store/modules/user'; | |||
const queryParam = reactive<any>({}); | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
const userStore = useUserStore(); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '公告管理', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
//labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToNumber: [ | |||
], | |||
fieldMapToTime: [ | |||
['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss'], | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
fixed:'right' | |||
}, | |||
beforeFetch: (params) => { | |||
return Object.assign(params, queryParam); | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"公告管理", | |||
url: getExportUrl, | |||
params: queryParam, | |||
}, | |||
importConfig: { | |||
url: getImportUrl, | |||
success: handleSuccess | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
// 高级查询配置 | |||
const superQueryConfig = reactive(superQuerySchema); | |||
/** | |||
* 高级查询事件 | |||
*/ | |||
function handleSuperQuery(params) { | |||
Object.keys(params).map((k) => { | |||
queryParam[k] = params[k]; | |||
}); | |||
reload(); | |||
} | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, handleSuccess); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
(selectedRowKeys.value = []) && reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
auth: 'notice:app_notice:edit' | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
placement: 'topLeft', | |||
}, | |||
auth: 'notice:app_notice:delete' | |||
} | |||
] | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
:deep(.ant-picker),:deep(.ant-input-number){ | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,26 @@ | |||
-- 注意:该页面对应的前台目录为views/notice文件夹下 | |||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021603255270490', NULL, '公告管理', '/notice/appNoticeList', 'notice/AppNoticeList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0); | |||
-- 权限控制sql | |||
-- 新增 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270491', '2025021603255270490', '添加公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 编辑 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270492', '2025021603255270490', '编辑公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270493', '2025021603255270490', '删除公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 批量删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270494', '2025021603255270490', '批量删除公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 导出excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270495', '2025021603255270490', '导出excel_公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 导入excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021603255270496', '2025021603255270490', '导入excel_公告管理', NULL, NULL, 0, NULL, NULL, 2, 'notice:app_notice:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 15:25:49', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,70 @@ | |||
<template> | |||
<div style="min-height: 400px"> | |||
<BasicForm @register="registerForm"></BasicForm> | |||
<div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
</div> | |||
</div> | |||
</template> | |||
<script lang="ts"> | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {computed, defineComponent} from 'vue'; | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { propTypes } from '/@/utils/propTypes'; | |||
import {getBpmFormSchema} from '../AppNotice.data'; | |||
import {saveOrUpdate} from '../AppNotice.api'; | |||
export default defineComponent({ | |||
name: "AppNoticeForm", | |||
components:{ | |||
BasicForm | |||
}, | |||
props:{ | |||
formData: propTypes.object.def({}), | |||
formBpm: propTypes.bool.def(true), | |||
}, | |||
setup(props){ | |||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
labelWidth: 150, | |||
schemas: getBpmFormSchema(props.formData), | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
const formDisabled = computed(()=>{ | |||
if(props.formData.disabled === false){ | |||
return false; | |||
} | |||
return true; | |||
}); | |||
let formData = {}; | |||
const queryByIdUrl = '/notice/appNotice/queryById'; | |||
async function initFormData(){ | |||
let params = {id: props.formData.dataId}; | |||
const data = await defHttp.get({url: queryByIdUrl, params}); | |||
formData = {...data} | |||
//设置表单的值 | |||
await setFieldsValue(formData); | |||
//默认是禁用 | |||
await setProps({disabled: formDisabled.value}) | |||
} | |||
async function submitForm() { | |||
let data = getFieldsValue(); | |||
let params = Object.assign({}, formData, data); | |||
console.log('表单数据', params) | |||
await saveOrUpdate(params, true) | |||
} | |||
initFormData(); | |||
return { | |||
registerForm, | |||
formDisabled, | |||
submitForm, | |||
} | |||
} | |||
}); | |||
</script> |
@ -0,0 +1,76 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm" name="AppNoticeForm" /> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../AppNotice.data'; | |||
import {saveOrUpdate} from '../AppNotice.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
const isDetail = ref(false); | |||
//表单配置 | |||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
isDetail.value = !!data?.showFooter; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} catch ({ errorFields }) { | |||
if (errorFields) { | |||
const firstField = errorFields[0]; | |||
if (firstField) { | |||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
} | |||
} | |||
return Promise.reject(errorFields); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** 时间和数字输入框样式 */ | |||
:deep(.ant-input-number) { | |||
width: 100%; | |||
} | |||
:deep(.ant-calendar-picker) { | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,180 @@ | |||
package org.jeecg.modules.demo.product.controller; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.system.query.QueryRuleEnum; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.demo.product.entity.AppProduct; | |||
import org.jeecg.modules.demo.product.service.IAppProductService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
/** | |||
* @Description: 产品管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="产品管理") | |||
@RestController | |||
@RequestMapping("/product/appProduct") | |||
@Slf4j | |||
public class AppProductController extends JeecgController<AppProduct, IAppProductService> { | |||
@Autowired | |||
private IAppProductService appProductService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param appProduct | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品管理-分页列表查询") | |||
@ApiOperation(value="产品管理-分页列表查询", notes="产品管理-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AppProduct>> queryPageList(AppProduct appProduct, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AppProduct> queryWrapper = QueryGenerator.initQueryWrapper(appProduct, req.getParameterMap()); | |||
Page<AppProduct> page = new Page<AppProduct>(pageNo, pageSize); | |||
IPage<AppProduct> pageList = appProductService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param appProduct | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品管理-添加") | |||
@ApiOperation(value="产品管理-添加", notes="产品管理-添加") | |||
@RequiresPermissions("product:app_product:add") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AppProduct appProduct) { | |||
appProductService.save(appProduct); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param appProduct | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品管理-编辑") | |||
@ApiOperation(value="产品管理-编辑", notes="产品管理-编辑") | |||
@RequiresPermissions("product:app_product:edit") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AppProduct appProduct) { | |||
appProductService.updateById(appProduct); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品管理-通过id删除") | |||
@ApiOperation(value="产品管理-通过id删除", notes="产品管理-通过id删除") | |||
@RequiresPermissions("product:app_product:delete") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
appProductService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品管理-批量删除") | |||
@ApiOperation(value="产品管理-批量删除", notes="产品管理-批量删除") | |||
@RequiresPermissions("product:app_product:deleteBatch") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.appProductService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品管理-通过id查询") | |||
@ApiOperation(value="产品管理-通过id查询", notes="产品管理-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<AppProduct> queryById(@RequestParam(name="id",required=true) String id) { | |||
AppProduct appProduct = appProductService.getById(id); | |||
if(appProduct==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(appProduct); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param appProduct | |||
*/ | |||
@RequiresPermissions("product:app_product:exportXls") | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AppProduct appProduct) { | |||
return super.exportXls(request, appProduct, AppProduct.class, "产品管理"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequiresPermissions("product:app_product:importExcel") | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AppProduct.class); | |||
} | |||
} |
@ -0,0 +1,76 @@ | |||
package org.jeecg.modules.demo.product.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableLogic; | |||
import org.jeecg.common.constant.ProvinceCityArea; | |||
import org.jeecg.common.util.SpringContextUtils; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 产品管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("app_product") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="app_product对象", description="产品管理") | |||
public class AppProduct implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**产品名称*/ | |||
@Excel(name = "产品名称", width = 15) | |||
@ApiModelProperty(value = "产品名称") | |||
private java.lang.String name; | |||
/**产品分类*/ | |||
@Excel(name = "产品分类", width = 15) | |||
@ApiModelProperty(value = "产品分类") | |||
private java.lang.Integer categoryId; | |||
/**产品内容*/ | |||
@Excel(name = "产品内容", width = 15) | |||
@ApiModelProperty(value = "产品内容") | |||
private java.lang.String content; | |||
/**产品合同模板*/ | |||
@Excel(name = "产品合同模板", width = 15) | |||
@ApiModelProperty(value = "产品合同模板") | |||
private java.lang.String pdf; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**所属部门*/ | |||
@ApiModelProperty(value = "所属部门") | |||
private java.lang.String sysOrgCode; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.demo.product.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.demo.product.entity.AppProduct; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 产品管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AppProductMapper extends BaseMapper<AppProduct> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.demo.product.mapper.AppProductMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.demo.product.service; | |||
import org.jeecg.modules.demo.product.entity.AppProduct; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 产品管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAppProductService extends IService<AppProduct> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.demo.product.service.impl; | |||
import org.jeecg.modules.demo.product.entity.AppProduct; | |||
import org.jeecg.modules.demo.product.mapper.AppProductMapper; | |||
import org.jeecg.modules.demo.product.service.IAppProductService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 产品管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AppProductServiceImpl extends ServiceImpl<AppProductMapper, AppProduct> implements IAppProductService { | |||
} |
@ -0,0 +1,102 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品管理</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">产品名称:</text></view> | |||
<input placeholder="请输入产品名称" v-model="model.name"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">产品分类:</text></view> | |||
<input type="number" placeholder="请输入产品分类" v-model="model.categoryId"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">产品内容:</text></view> | |||
<input placeholder="请输入产品内容" v-model="model.content"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">产品合同模板:</text></view> | |||
<input placeholder="请输入产品合同模板" v-model="model.pdf"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppProductForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/product/appProduct/queryById", | |||
add: "/product/appProduct/add", | |||
edit: "/product/appProduct/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品管理</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '产品管理', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/product/appProduct/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,64 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { useMessage } from "/@/hooks/web/useMessage"; | |||
const { createConfirm } = useMessage(); | |||
enum Api { | |||
list = '/product/appProduct/list', | |||
save='/product/appProduct/add', | |||
edit='/product/appProduct/edit', | |||
deleteOne = '/product/appProduct/delete', | |||
deleteBatch = '/product/appProduct/deleteBatch', | |||
importExcel = '/product/appProduct/importExcel', | |||
exportXls = '/product/appProduct/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
createConfirm({ | |||
iconType: 'warning', | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,124 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
import { getWeekMonthQuarterYear } from '/@/utils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '产品名称', | |||
align:"center", | |||
dataIndex: 'name' | |||
}, | |||
{ | |||
title: '产品分类', | |||
align:"center", | |||
dataIndex: 'categoryId_dictText' | |||
}, | |||
{ | |||
title: '产品内容', | |||
align:"center", | |||
dataIndex: 'content' | |||
}, | |||
{ | |||
title: '产品合同模板', | |||
align:"center", | |||
dataIndex: 'pdf', | |||
}, | |||
{ | |||
title: '创建日期', | |||
align:"center", | |||
dataIndex: 'createTime' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
{ | |||
label: "产品名称", | |||
field: "name", | |||
component: 'JInput', | |||
}, | |||
{ | |||
label: "产品内容", | |||
field: "content", | |||
component: 'JInput', | |||
}, | |||
{ | |||
label: "创建日期", | |||
field: "createTime", | |||
component: 'RangePicker', | |||
componentProps: { | |||
valueType: 'Date', | |||
showTime:true | |||
}, | |||
//colProps: {span: 6}, | |||
}, | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '产品名称', | |||
field: 'name', | |||
component: 'Input', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入产品名称!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '产品分类', | |||
field: 'categoryId', | |||
component: 'JDictSelectTag', | |||
componentProps:{ | |||
dictCode:"" | |||
}, | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入产品分类!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '产品内容', | |||
field: 'content', | |||
component: 'Input', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入产品内容!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '产品合同模板', | |||
field: 'pdf', | |||
component: 'JUpload', | |||
componentProps:{ | |||
}, | |||
}, | |||
// TODO 主键隐藏字段,目前写死为ID | |||
{ | |||
label: '', | |||
field: 'id', | |||
component: 'Input', | |||
show: false | |||
}, | |||
]; | |||
// 高级查询数据 | |||
export const superQuerySchema = { | |||
name: {title: '产品名称',order: 0,view: 'text', type: 'string',}, | |||
categoryId: {title: '产品分类',order: 1,view: 'number', type: 'number',dictCode: '',}, | |||
content: {title: '产品内容',order: 2,view: 'text', type: 'string',}, | |||
pdf: {title: '产品合同模板',order: 3,view: 'file', type: 'string',}, | |||
createTime: {title: '创建日期',order: 4,view: 'datetime', type: 'string',}, | |||
}; | |||
/** | |||
* 流程表单调用这个方法获取formSchema | |||
* @param param | |||
*/ | |||
export function getBpmFormSchema(_formData): FormSchema[]{ | |||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
return formSchema; | |||
} |
@ -0,0 +1,196 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" v-auth="'product:app_product:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" v-auth="'product:app_product:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" v-auth="'product:app_product:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button v-auth="'product:app_product:deleteBatch'">批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
<!-- 高级查询 --> | |||
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template v-slot:bodyCell="{ column, record, index, text }"> | |||
<template v-if="column.dataIndex==='pdf'"> | |||
<!--文件字段回显插槽--> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
</template> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AppProductModal @register="registerModal" @success="handleSuccess"></AppProductModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="product-appProduct" setup> | |||
import {ref, reactive, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AppProductModal from './components/AppProductModal.vue' | |||
import {columns, searchFormSchema, superQuerySchema} from './AppProduct.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppProduct.api'; | |||
import { downloadFile } from '/@/utils/common/renderUtils'; | |||
import { useUserStore } from '/@/store/modules/user'; | |||
const queryParam = reactive<any>({}); | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
const userStore = useUserStore(); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '产品管理', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
//labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToNumber: [ | |||
], | |||
fieldMapToTime: [ | |||
['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss'], | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
fixed:'right' | |||
}, | |||
beforeFetch: (params) => { | |||
return Object.assign(params, queryParam); | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"产品管理", | |||
url: getExportUrl, | |||
params: queryParam, | |||
}, | |||
importConfig: { | |||
url: getImportUrl, | |||
success: handleSuccess | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
// 高级查询配置 | |||
const superQueryConfig = reactive(superQuerySchema); | |||
/** | |||
* 高级查询事件 | |||
*/ | |||
function handleSuperQuery(params) { | |||
Object.keys(params).map((k) => { | |||
queryParam[k] = params[k]; | |||
}); | |||
reload(); | |||
} | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, handleSuccess); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
(selectedRowKeys.value = []) && reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
auth: 'product:app_product:edit' | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
placement: 'topLeft', | |||
}, | |||
auth: 'product:app_product:delete' | |||
} | |||
] | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
:deep(.ant-picker),:deep(.ant-input-number){ | |||
width: 100%; | |||
} | |||
</style> |
@ -1,26 +1,26 @@ | |||
-- 注意:该页面对应的前台目录为views/appbanner文件夹下 | |||
-- 注意:该页面对应的前台目录为views/product文件夹下 | |||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021104268720180', NULL, '应用广告配置', '/appbanner/appBannerList', 'appbanner/AppBannerList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0); | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021604252050570', NULL, '产品管理', '/app/appProductList', 'miniapp/product/AppProductList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0); | |||
-- 权限控制sql | |||
-- 新增 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720181', '2025021104268720180', '添加应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050571', '2025021604252050570', '添加产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); | |||
-- 编辑 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720182', '2025021104268720180', '编辑应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050572', '2025021604252050570', '编辑产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); | |||
-- 删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720183', '2025021104268720180', '删除应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050573', '2025021604252050570', '删除产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); | |||
-- 批量删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720184', '2025021104268720180', '批量删除应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050574', '2025021604252050570', '批量删除产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); | |||
-- 导出excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720185', '2025021104268720180', '导出excel_应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050575', '2025021604252050570', '导出excel_产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); | |||
-- 导入excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021104268720186', '2025021104268720180', '导入excel_应用广告配置', NULL, NULL, 0, NULL, NULL, 2, 'appbanner:app_banner:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-11 16:26:18', NULL, NULL, 0, 0, '1', 0); | |||
VALUES ('2025021604252050576', '2025021604252050570', '导入excel_产品管理', NULL, NULL, 0, NULL, NULL, 2, 'product:app_product:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:25:57', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,70 @@ | |||
<template> | |||
<div style="min-height: 400px"> | |||
<BasicForm @register="registerForm"></BasicForm> | |||
<div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
</div> | |||
</div> | |||
</template> | |||
<script lang="ts"> | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {computed, defineComponent} from 'vue'; | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { propTypes } from '/@/utils/propTypes'; | |||
import {getBpmFormSchema} from '../AppProduct.data'; | |||
import {saveOrUpdate} from '../AppProduct.api'; | |||
export default defineComponent({ | |||
name: "AppProductForm", | |||
components:{ | |||
BasicForm | |||
}, | |||
props:{ | |||
formData: propTypes.object.def({}), | |||
formBpm: propTypes.bool.def(true), | |||
}, | |||
setup(props){ | |||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
labelWidth: 150, | |||
schemas: getBpmFormSchema(props.formData), | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
const formDisabled = computed(()=>{ | |||
if(props.formData.disabled === false){ | |||
return false; | |||
} | |||
return true; | |||
}); | |||
let formData = {}; | |||
const queryByIdUrl = '/product/appProduct/queryById'; | |||
async function initFormData(){ | |||
let params = {id: props.formData.dataId}; | |||
const data = await defHttp.get({url: queryByIdUrl, params}); | |||
formData = {...data} | |||
//设置表单的值 | |||
await setFieldsValue(formData); | |||
//默认是禁用 | |||
await setProps({disabled: formDisabled.value}) | |||
} | |||
async function submitForm() { | |||
let data = getFieldsValue(); | |||
let params = Object.assign({}, formData, data); | |||
console.log('表单数据', params) | |||
await saveOrUpdate(params, true) | |||
} | |||
initFormData(); | |||
return { | |||
registerForm, | |||
formDisabled, | |||
submitForm, | |||
} | |||
} | |||
}); | |||
</script> |
@ -0,0 +1,76 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm" name="AppProductForm" /> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../AppProduct.data'; | |||
import {saveOrUpdate} from '../AppProduct.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
const isDetail = ref(false); | |||
//表单配置 | |||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
isDetail.value = !!data?.showFooter; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} catch ({ errorFields }) { | |||
if (errorFields) { | |||
const firstField = errorFields[0]; | |||
if (firstField) { | |||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
} | |||
} | |||
return Promise.reject(errorFields); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** 时间和数字输入框样式 */ | |||
:deep(.ant-input-number) { | |||
width: 100%; | |||
} | |||
:deep(.ant-calendar-picker) { | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,180 @@ | |||
package org.jeecg.modules.demo.productCategory.controller; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.system.query.QueryRuleEnum; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.demo.productCategory.entity.AppCategory; | |||
import org.jeecg.modules.demo.productCategory.service.IAppCategoryService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
/** | |||
* @Description: 产品分类管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="产品分类管理") | |||
@RestController | |||
@RequestMapping("/productCategory/appCategory") | |||
@Slf4j | |||
public class AppCategoryController extends JeecgController<AppCategory, IAppCategoryService> { | |||
@Autowired | |||
private IAppCategoryService appCategoryService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param appCategory | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品分类管理-分页列表查询") | |||
@ApiOperation(value="产品分类管理-分页列表查询", notes="产品分类管理-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AppCategory>> queryPageList(AppCategory appCategory, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AppCategory> queryWrapper = QueryGenerator.initQueryWrapper(appCategory, req.getParameterMap()); | |||
Page<AppCategory> page = new Page<AppCategory>(pageNo, pageSize); | |||
IPage<AppCategory> pageList = appCategoryService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param appCategory | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类管理-添加") | |||
@ApiOperation(value="产品分类管理-添加", notes="产品分类管理-添加") | |||
@RequiresPermissions("productCategory:app_category:add") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AppCategory appCategory) { | |||
appCategoryService.save(appCategory); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param appCategory | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类管理-编辑") | |||
@ApiOperation(value="产品分类管理-编辑", notes="产品分类管理-编辑") | |||
@RequiresPermissions("productCategory:app_category:edit") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AppCategory appCategory) { | |||
appCategoryService.updateById(appCategory); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类管理-通过id删除") | |||
@ApiOperation(value="产品分类管理-通过id删除", notes="产品分类管理-通过id删除") | |||
@RequiresPermissions("productCategory:app_category:delete") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
appCategoryService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类管理-批量删除") | |||
@ApiOperation(value="产品分类管理-批量删除", notes="产品分类管理-批量删除") | |||
@RequiresPermissions("productCategory:app_category:deleteBatch") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.appCategoryService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品分类管理-通过id查询") | |||
@ApiOperation(value="产品分类管理-通过id查询", notes="产品分类管理-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<AppCategory> queryById(@RequestParam(name="id",required=true) String id) { | |||
AppCategory appCategory = appCategoryService.getById(id); | |||
if(appCategory==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(appCategory); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param appCategory | |||
*/ | |||
@RequiresPermissions("productCategory:app_category:exportXls") | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AppCategory appCategory) { | |||
return super.exportXls(request, appCategory, AppCategory.class, "产品分类管理"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequiresPermissions("productCategory:app_category:importExcel") | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AppCategory.class); | |||
} | |||
} |
@ -0,0 +1,64 @@ | |||
package org.jeecg.modules.demo.productCategory.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableLogic; | |||
import org.jeecg.common.constant.ProvinceCityArea; | |||
import org.jeecg.common.util.SpringContextUtils; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 产品分类管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("app_category") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="app_category对象", description="产品分类管理") | |||
public class AppCategory implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**名称*/ | |||
@Excel(name = "名称", width = 15) | |||
@ApiModelProperty(value = "名称") | |||
private java.lang.String categoryName; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**所属部门*/ | |||
@ApiModelProperty(value = "所属部门") | |||
private java.lang.String sysOrgCode; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.demo.productCategory.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.demo.productCategory.entity.AppCategory; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 产品分类管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AppCategoryMapper extends BaseMapper<AppCategory> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.demo.productCategory.mapper.AppCategoryMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.demo.productCategory.service; | |||
import org.jeecg.modules.demo.productCategory.entity.AppCategory; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 产品分类管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAppCategoryService extends IService<AppCategory> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.demo.productCategory.service.impl; | |||
import org.jeecg.modules.demo.productCategory.entity.AppCategory; | |||
import org.jeecg.modules.demo.productCategory.mapper.AppCategoryMapper; | |||
import org.jeecg.modules.demo.productCategory.service.IAppCategoryService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 产品分类管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AppCategoryServiceImpl extends ServiceImpl<AppCategoryMapper, AppCategory> implements IAppCategoryService { | |||
} |
@ -0,0 +1,84 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品分类管理</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">名称:</text></view> | |||
<input placeholder="请输入名称" v-model="model.categoryName"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppCategoryForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/productCategory/appCategory/queryById", | |||
add: "/productCategory/appCategory/add", | |||
edit: "/productCategory/appCategory/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品分类管理</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '产品分类管理', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/productCategory/appCategory/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,64 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { useMessage } from "/@/hooks/web/useMessage"; | |||
const { createConfirm } = useMessage(); | |||
enum Api { | |||
list = '/productCategory/appCategory/list', | |||
save='/productCategory/appCategory/add', | |||
edit='/productCategory/appCategory/edit', | |||
deleteOne = '/productCategory/appCategory/delete', | |||
deleteBatch = '/productCategory/appCategory/deleteBatch', | |||
importExcel = '/productCategory/appCategory/importExcel', | |||
exportXls = '/productCategory/appCategory/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
createConfirm({ | |||
iconType: 'warning', | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,71 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
import { getWeekMonthQuarterYear } from '/@/utils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '名称', | |||
align:"center", | |||
dataIndex: 'categoryName' | |||
}, | |||
{ | |||
title: '创建日期', | |||
align:"center", | |||
dataIndex: 'createTime' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
{ | |||
label: "名称", | |||
field: "categoryName", | |||
component: 'JInput', | |||
}, | |||
{ | |||
label: "创建日期", | |||
field: "createTime", | |||
component: 'RangePicker', | |||
componentProps: { | |||
valueType: 'Date', | |||
showTime:true | |||
}, | |||
//colProps: {span: 6}, | |||
}, | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '名称', | |||
field: 'categoryName', | |||
component: 'Input', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入名称!'}, | |||
]; | |||
}, | |||
}, | |||
// TODO 主键隐藏字段,目前写死为ID | |||
{ | |||
label: '', | |||
field: 'id', | |||
component: 'Input', | |||
show: false | |||
}, | |||
]; | |||
// 高级查询数据 | |||
export const superQuerySchema = { | |||
categoryName: {title: '名称',order: 0,view: 'text', type: 'string',}, | |||
createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',}, | |||
}; | |||
/** | |||
* 流程表单调用这个方法获取formSchema | |||
* @param param | |||
*/ | |||
export function getBpmFormSchema(_formData): FormSchema[]{ | |||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
return formSchema; | |||
} |
@ -0,0 +1,191 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" v-auth="'productCategory:app_category:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" v-auth="'productCategory:app_category:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" v-auth="'productCategory:app_category:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button v-auth="'productCategory:app_category:deleteBatch'">批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
<!-- 高级查询 --> | |||
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template v-slot:bodyCell="{ column, record, index, text }"> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AppCategoryModal @register="registerModal" @success="handleSuccess"></AppCategoryModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="productCategory-appCategory" setup> | |||
import {ref, reactive, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AppCategoryModal from './components/AppCategoryModal.vue' | |||
import {columns, searchFormSchema, superQuerySchema} from './AppCategory.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppCategory.api'; | |||
import { downloadFile } from '/@/utils/common/renderUtils'; | |||
import { useUserStore } from '/@/store/modules/user'; | |||
const queryParam = reactive<any>({}); | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
const userStore = useUserStore(); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '产品分类管理', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
//labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToNumber: [ | |||
], | |||
fieldMapToTime: [ | |||
['createTime', ['createTime_begin', 'createTime_end'], 'YYYY-MM-DD HH:mm:ss'], | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
fixed:'right' | |||
}, | |||
beforeFetch: (params) => { | |||
return Object.assign(params, queryParam); | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"产品分类管理", | |||
url: getExportUrl, | |||
params: queryParam, | |||
}, | |||
importConfig: { | |||
url: getImportUrl, | |||
success: handleSuccess | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
// 高级查询配置 | |||
const superQueryConfig = reactive(superQuerySchema); | |||
/** | |||
* 高级查询事件 | |||
*/ | |||
function handleSuperQuery(params) { | |||
Object.keys(params).map((k) => { | |||
queryParam[k] = params[k]; | |||
}); | |||
reload(); | |||
} | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, handleSuccess); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
(selectedRowKeys.value = []) && reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
auth: 'productCategory:app_category:edit' | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
placement: 'topLeft', | |||
}, | |||
auth: 'productCategory:app_category:delete' | |||
} | |||
] | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
:deep(.ant-picker),:deep(.ant-input-number){ | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,26 @@ | |||
-- 注意:该页面对应的前台目录为views/productCategory文件夹下 | |||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021604261960250', NULL, '产品分类管理', '/app/appCategoryList', 'miniapp/productCategory/AppCategoryList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0); | |||
-- 权限控制sql | |||
-- 新增 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960251', '2025021604261960250', '添加产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); | |||
-- 编辑 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960252', '2025021604261960250', '编辑产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); | |||
-- 删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960253', '2025021604261960250', '删除产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); | |||
-- 批量删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960254', '2025021604261960250', '批量删除产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); | |||
-- 导出excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960255', '2025021604261960250', '导出excel_产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); | |||
-- 导入excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604261960256', '2025021604261960250', '导入excel_产品分类管理', NULL, NULL, 0, NULL, NULL, 2, 'productCategory:app_category:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:26:25', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,70 @@ | |||
<template> | |||
<div style="min-height: 400px"> | |||
<BasicForm @register="registerForm"></BasicForm> | |||
<div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
</div> | |||
</div> | |||
</template> | |||
<script lang="ts"> | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {computed, defineComponent} from 'vue'; | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { propTypes } from '/@/utils/propTypes'; | |||
import {getBpmFormSchema} from '../AppCategory.data'; | |||
import {saveOrUpdate} from '../AppCategory.api'; | |||
export default defineComponent({ | |||
name: "AppCategoryForm", | |||
components:{ | |||
BasicForm | |||
}, | |||
props:{ | |||
formData: propTypes.object.def({}), | |||
formBpm: propTypes.bool.def(true), | |||
}, | |||
setup(props){ | |||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
labelWidth: 150, | |||
schemas: getBpmFormSchema(props.formData), | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
const formDisabled = computed(()=>{ | |||
if(props.formData.disabled === false){ | |||
return false; | |||
} | |||
return true; | |||
}); | |||
let formData = {}; | |||
const queryByIdUrl = '/productCategory/appCategory/queryById'; | |||
async function initFormData(){ | |||
let params = {id: props.formData.dataId}; | |||
const data = await defHttp.get({url: queryByIdUrl, params}); | |||
formData = {...data} | |||
//设置表单的值 | |||
await setFieldsValue(formData); | |||
//默认是禁用 | |||
await setProps({disabled: formDisabled.value}) | |||
} | |||
async function submitForm() { | |||
let data = getFieldsValue(); | |||
let params = Object.assign({}, formData, data); | |||
console.log('表单数据', params) | |||
await saveOrUpdate(params, true) | |||
} | |||
initFormData(); | |||
return { | |||
registerForm, | |||
formDisabled, | |||
submitForm, | |||
} | |||
} | |||
}); | |||
</script> |
@ -0,0 +1,76 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm" name="AppCategoryForm" /> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../AppCategory.data'; | |||
import {saveOrUpdate} from '../AppCategory.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
const isDetail = ref(false); | |||
//表单配置 | |||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
isDetail.value = !!data?.showFooter; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} catch ({ errorFields }) { | |||
if (errorFields) { | |||
const firstField = errorFields[0]; | |||
if (firstField) { | |||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
} | |||
} | |||
return Promise.reject(errorFields); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** 时间和数字输入框样式 */ | |||
:deep(.ant-input-number) { | |||
width: 100%; | |||
} | |||
:deep(.ant-calendar-picker) { | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,180 @@ | |||
package org.jeecg.modules.demo.productCategoryJoin.controller; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.system.query.QueryRuleEnum; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.demo.productCategoryJoin.entity.AppProductCategoryJoin; | |||
import org.jeecg.modules.demo.productCategoryJoin.service.IAppProductCategoryJoinService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
/** | |||
* @Description: 产品分类关联表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="产品分类关联表") | |||
@RestController | |||
@RequestMapping("/productCategoryJoin/appProductCategoryJoin") | |||
@Slf4j | |||
public class AppProductCategoryJoinController extends JeecgController<AppProductCategoryJoin, IAppProductCategoryJoinService> { | |||
@Autowired | |||
private IAppProductCategoryJoinService appProductCategoryJoinService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param appProductCategoryJoin | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品分类关联表-分页列表查询") | |||
@ApiOperation(value="产品分类关联表-分页列表查询", notes="产品分类关联表-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AppProductCategoryJoin>> queryPageList(AppProductCategoryJoin appProductCategoryJoin, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AppProductCategoryJoin> queryWrapper = QueryGenerator.initQueryWrapper(appProductCategoryJoin, req.getParameterMap()); | |||
Page<AppProductCategoryJoin> page = new Page<AppProductCategoryJoin>(pageNo, pageSize); | |||
IPage<AppProductCategoryJoin> pageList = appProductCategoryJoinService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param appProductCategoryJoin | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类关联表-添加") | |||
@ApiOperation(value="产品分类关联表-添加", notes="产品分类关联表-添加") | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:add") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AppProductCategoryJoin appProductCategoryJoin) { | |||
appProductCategoryJoinService.save(appProductCategoryJoin); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param appProductCategoryJoin | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类关联表-编辑") | |||
@ApiOperation(value="产品分类关联表-编辑", notes="产品分类关联表-编辑") | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:edit") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AppProductCategoryJoin appProductCategoryJoin) { | |||
appProductCategoryJoinService.updateById(appProductCategoryJoin); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类关联表-通过id删除") | |||
@ApiOperation(value="产品分类关联表-通过id删除", notes="产品分类关联表-通过id删除") | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:delete") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
appProductCategoryJoinService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "产品分类关联表-批量删除") | |||
@ApiOperation(value="产品分类关联表-批量删除", notes="产品分类关联表-批量删除") | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:deleteBatch") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.appProductCategoryJoinService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "产品分类关联表-通过id查询") | |||
@ApiOperation(value="产品分类关联表-通过id查询", notes="产品分类关联表-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<AppProductCategoryJoin> queryById(@RequestParam(name="id",required=true) String id) { | |||
AppProductCategoryJoin appProductCategoryJoin = appProductCategoryJoinService.getById(id); | |||
if(appProductCategoryJoin==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(appProductCategoryJoin); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param appProductCategoryJoin | |||
*/ | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:exportXls") | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AppProductCategoryJoin appProductCategoryJoin) { | |||
return super.exportXls(request, appProductCategoryJoin, AppProductCategoryJoin.class, "产品分类关联表"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequiresPermissions("productCategoryJoin:app_product_category_join:importExcel") | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AppProductCategoryJoin.class); | |||
} | |||
} |
@ -0,0 +1,68 @@ | |||
package org.jeecg.modules.demo.productCategoryJoin.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableLogic; | |||
import org.jeecg.common.constant.ProvinceCityArea; | |||
import org.jeecg.common.util.SpringContextUtils; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 产品分类关联表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("app_product_category_join") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="app_product_category_join对象", description="产品分类关联表") | |||
public class AppProductCategoryJoin implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**产品 id*/ | |||
@Excel(name = "产品 id", width = 15) | |||
@ApiModelProperty(value = "产品 id") | |||
private java.lang.Integer productId; | |||
/**分类 id*/ | |||
@Excel(name = "分类 id", width = 15) | |||
@ApiModelProperty(value = "分类 id") | |||
private java.lang.Integer categoryId; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**所属部门*/ | |||
@ApiModelProperty(value = "所属部门") | |||
private java.lang.String sysOrgCode; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.demo.productCategoryJoin.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.demo.productCategoryJoin.entity.AppProductCategoryJoin; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 产品分类关联表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AppProductCategoryJoinMapper extends BaseMapper<AppProductCategoryJoin> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.demo.productCategoryJoin.mapper.AppProductCategoryJoinMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.demo.productCategoryJoin.service; | |||
import org.jeecg.modules.demo.productCategoryJoin.entity.AppProductCategoryJoin; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 产品分类关联表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAppProductCategoryJoinService extends IService<AppProductCategoryJoin> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.demo.productCategoryJoin.service.impl; | |||
import org.jeecg.modules.demo.productCategoryJoin.entity.AppProductCategoryJoin; | |||
import org.jeecg.modules.demo.productCategoryJoin.mapper.AppProductCategoryJoinMapper; | |||
import org.jeecg.modules.demo.productCategoryJoin.service.IAppProductCategoryJoinService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 产品分类关联表 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AppProductCategoryJoinServiceImpl extends ServiceImpl<AppProductCategoryJoinMapper, AppProductCategoryJoin> implements IAppProductCategoryJoinService { | |||
} |
@ -0,0 +1,90 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品分类关联表</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">产品 id:</text></view> | |||
<input type="number" placeholder="请输入产品 id" v-model="model.productId"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">分类 id:</text></view> | |||
<input type="number" placeholder="请输入分类 id" v-model="model.categoryId"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppProductCategoryJoinForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/productCategoryJoin/appProductCategoryJoin/queryById", | |||
add: "/productCategoryJoin/appProductCategoryJoin/add", | |||
edit: "/productCategoryJoin/appProductCategoryJoin/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">产品分类关联表</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '产品分类关联表', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/productCategoryJoin/appProductCategoryJoin/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,64 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { useMessage } from "/@/hooks/web/useMessage"; | |||
const { createConfirm } = useMessage(); | |||
enum Api { | |||
list = '/productCategoryJoin/appProductCategoryJoin/list', | |||
save='/productCategoryJoin/appProductCategoryJoin/add', | |||
edit='/productCategoryJoin/appProductCategoryJoin/edit', | |||
deleteOne = '/productCategoryJoin/appProductCategoryJoin/delete', | |||
deleteBatch = '/productCategoryJoin/appProductCategoryJoin/deleteBatch', | |||
importExcel = '/productCategoryJoin/appProductCategoryJoin/importExcel', | |||
exportXls = '/productCategoryJoin/appProductCategoryJoin/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
createConfirm({ | |||
iconType: 'warning', | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,72 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
import { getWeekMonthQuarterYear } from '/@/utils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '产品 id', | |||
align:"center", | |||
dataIndex: 'productId' | |||
}, | |||
{ | |||
title: '分类 id', | |||
align:"center", | |||
dataIndex: 'categoryId' | |||
}, | |||
{ | |||
title: '创建日期', | |||
align:"center", | |||
dataIndex: 'createTime' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '产品 id', | |||
field: 'productId', | |||
component: 'InputNumber', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入产品 id!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '分类 id', | |||
field: 'categoryId', | |||
component: 'InputNumber', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入分类 id!'}, | |||
]; | |||
}, | |||
}, | |||
// TODO 主键隐藏字段,目前写死为ID | |||
{ | |||
label: '', | |||
field: 'id', | |||
component: 'Input', | |||
show: false | |||
}, | |||
]; | |||
// 高级查询数据 | |||
export const superQuerySchema = { | |||
productId: {title: '产品 id',order: 0,view: 'number', type: 'number',}, | |||
categoryId: {title: '分类 id',order: 1,view: 'number', type: 'number',}, | |||
createTime: {title: '创建日期',order: 2,view: 'datetime', type: 'string',}, | |||
}; | |||
/** | |||
* 流程表单调用这个方法获取formSchema | |||
* @param param | |||
*/ | |||
export function getBpmFormSchema(_formData): FormSchema[]{ | |||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
return formSchema; | |||
} |
@ -0,0 +1,190 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" v-auth="'productCategoryJoin:app_product_category_join:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" v-auth="'productCategoryJoin:app_product_category_join:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" v-auth="'productCategoryJoin:app_product_category_join:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button v-auth="'productCategoryJoin:app_product_category_join:deleteBatch'">批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
<!-- 高级查询 --> | |||
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template v-slot:bodyCell="{ column, record, index, text }"> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AppProductCategoryJoinModal @register="registerModal" @success="handleSuccess"></AppProductCategoryJoinModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="productCategoryJoin-appProductCategoryJoin" setup> | |||
import {ref, reactive, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AppProductCategoryJoinModal from './components/AppProductCategoryJoinModal.vue' | |||
import {columns, searchFormSchema, superQuerySchema} from './AppProductCategoryJoin.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppProductCategoryJoin.api'; | |||
import { downloadFile } from '/@/utils/common/renderUtils'; | |||
import { useUserStore } from '/@/store/modules/user'; | |||
const queryParam = reactive<any>({}); | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
const userStore = useUserStore(); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '产品分类关联表', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
//labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToNumber: [ | |||
], | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
fixed:'right' | |||
}, | |||
beforeFetch: (params) => { | |||
return Object.assign(params, queryParam); | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"产品分类关联表", | |||
url: getExportUrl, | |||
params: queryParam, | |||
}, | |||
importConfig: { | |||
url: getImportUrl, | |||
success: handleSuccess | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
// 高级查询配置 | |||
const superQueryConfig = reactive(superQuerySchema); | |||
/** | |||
* 高级查询事件 | |||
*/ | |||
function handleSuperQuery(params) { | |||
Object.keys(params).map((k) => { | |||
queryParam[k] = params[k]; | |||
}); | |||
reload(); | |||
} | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, handleSuccess); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
(selectedRowKeys.value = []) && reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
auth: 'productCategoryJoin:app_product_category_join:edit' | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
placement: 'topLeft', | |||
}, | |||
auth: 'productCategoryJoin:app_product_category_join:delete' | |||
} | |||
] | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
:deep(.ant-picker),:deep(.ant-input-number){ | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,26 @@ | |||
-- 注意:该页面对应的前台目录为views/productCategoryJoin文件夹下 | |||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021604458930590', NULL, '产品分类关联表', '/productCategoryJoin/appProductCategoryJoinList', 'productCategoryJoin/AppProductCategoryJoinList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0); | |||
-- 权限控制sql | |||
-- 新增 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930591', '2025021604458930590', '添加产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); | |||
-- 编辑 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930592', '2025021604458930590', '编辑产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); | |||
-- 删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930593', '2025021604458930590', '删除产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); | |||
-- 批量删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930594', '2025021604458930590', '批量删除产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); | |||
-- 导出excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930595', '2025021604458930590', '导出excel_产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); | |||
-- 导入excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021604458930596', '2025021604458930590', '导入excel_产品分类关联表', NULL, NULL, 0, NULL, NULL, 2, 'productCategoryJoin:app_product_category_join:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 16:45:59', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,70 @@ | |||
<template> | |||
<div style="min-height: 400px"> | |||
<BasicForm @register="registerForm"></BasicForm> | |||
<div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
</div> | |||
</div> | |||
</template> | |||
<script lang="ts"> | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {computed, defineComponent} from 'vue'; | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { propTypes } from '/@/utils/propTypes'; | |||
import {getBpmFormSchema} from '../AppProductCategoryJoin.data'; | |||
import {saveOrUpdate} from '../AppProductCategoryJoin.api'; | |||
export default defineComponent({ | |||
name: "AppProductCategoryJoinForm", | |||
components:{ | |||
BasicForm | |||
}, | |||
props:{ | |||
formData: propTypes.object.def({}), | |||
formBpm: propTypes.bool.def(true), | |||
}, | |||
setup(props){ | |||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
labelWidth: 150, | |||
schemas: getBpmFormSchema(props.formData), | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
const formDisabled = computed(()=>{ | |||
if(props.formData.disabled === false){ | |||
return false; | |||
} | |||
return true; | |||
}); | |||
let formData = {}; | |||
const queryByIdUrl = '/productCategoryJoin/appProductCategoryJoin/queryById'; | |||
async function initFormData(){ | |||
let params = {id: props.formData.dataId}; | |||
const data = await defHttp.get({url: queryByIdUrl, params}); | |||
formData = {...data} | |||
//设置表单的值 | |||
await setFieldsValue(formData); | |||
//默认是禁用 | |||
await setProps({disabled: formDisabled.value}) | |||
} | |||
async function submitForm() { | |||
let data = getFieldsValue(); | |||
let params = Object.assign({}, formData, data); | |||
console.log('表单数据', params) | |||
await saveOrUpdate(params, true) | |||
} | |||
initFormData(); | |||
return { | |||
registerForm, | |||
formDisabled, | |||
submitForm, | |||
} | |||
} | |||
}); | |||
</script> |
@ -0,0 +1,76 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm" name="AppProductCategoryJoinForm" /> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../AppProductCategoryJoin.data'; | |||
import {saveOrUpdate} from '../AppProductCategoryJoin.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
const isDetail = ref(false); | |||
//表单配置 | |||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
isDetail.value = !!data?.showFooter; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} catch ({ errorFields }) { | |||
if (errorFields) { | |||
const firstField = errorFields[0]; | |||
if (firstField) { | |||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
} | |||
} | |||
return Promise.reject(errorFields); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** 时间和数字输入框样式 */ | |||
:deep(.ant-input-number) { | |||
width: 100%; | |||
} | |||
:deep(.ant-calendar-picker) { | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,184 @@ | |||
package org.jeecg.modules.demo.store.controller; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import java.io.IOException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.jeecg.common.api.vo.Result; | |||
import org.jeecg.common.system.query.QueryGenerator; | |||
import org.jeecg.common.system.query.QueryRuleEnum; | |||
import org.jeecg.common.util.oConvertUtils; | |||
import org.jeecg.modules.demo.store.entity.AppStore; | |||
import org.jeecg.modules.demo.store.service.IAppStoreService; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
import org.jeecgframework.poi.excel.entity.ExportParams; | |||
import org.jeecgframework.poi.excel.entity.ImportParams; | |||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
import org.jeecg.common.system.base.controller.JeecgController; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
import org.springframework.web.servlet.ModelAndView; | |||
import com.alibaba.fastjson.JSON; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.jeecg.common.aspect.annotation.AutoLog; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
/** | |||
* @Description: 门店管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="门店管理") | |||
@RestController | |||
@RequestMapping("/store/appStore") | |||
@Slf4j | |||
public class AppStoreController extends JeecgController<AppStore, IAppStoreService> { | |||
@Autowired | |||
private IAppStoreService appStoreService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param appStore | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "门店管理-分页列表查询") | |||
@ApiOperation(value="门店管理-分页列表查询", notes="门店管理-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AppStore>> queryPageList(AppStore appStore, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
// 自定义查询规则 | |||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>(); | |||
// 自定义多选的查询规则为:LIKE_WITH_OR | |||
customeRuleMap.put("status", QueryRuleEnum.LIKE_WITH_OR); | |||
QueryWrapper<AppStore> queryWrapper = QueryGenerator.initQueryWrapper(appStore, req.getParameterMap(),customeRuleMap); | |||
Page<AppStore> page = new Page<AppStore>(pageNo, pageSize); | |||
IPage<AppStore> pageList = appStoreService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param appStore | |||
* @return | |||
*/ | |||
@AutoLog(value = "门店管理-添加") | |||
@ApiOperation(value="门店管理-添加", notes="门店管理-添加") | |||
@RequiresPermissions("store:app_store:add") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AppStore appStore) { | |||
appStoreService.save(appStore); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param appStore | |||
* @return | |||
*/ | |||
@AutoLog(value = "门店管理-编辑") | |||
@ApiOperation(value="门店管理-编辑", notes="门店管理-编辑") | |||
@RequiresPermissions("store:app_store:edit") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AppStore appStore) { | |||
appStoreService.updateById(appStore); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "门店管理-通过id删除") | |||
@ApiOperation(value="门店管理-通过id删除", notes="门店管理-通过id删除") | |||
@RequiresPermissions("store:app_store:delete") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
appStoreService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "门店管理-批量删除") | |||
@ApiOperation(value="门店管理-批量删除", notes="门店管理-批量删除") | |||
@RequiresPermissions("store:app_store:deleteBatch") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.appStoreService.removeByIds(Arrays.asList(ids.split(","))); | |||
return Result.OK("批量删除成功!"); | |||
} | |||
/** | |||
* 通过id查询 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
//@AutoLog(value = "门店管理-通过id查询") | |||
@ApiOperation(value="门店管理-通过id查询", notes="门店管理-通过id查询") | |||
@GetMapping(value = "/queryById") | |||
public Result<AppStore> queryById(@RequestParam(name="id",required=true) String id) { | |||
AppStore appStore = appStoreService.getById(id); | |||
if(appStore==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(appStore); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param appStore | |||
*/ | |||
@RequiresPermissions("store:app_store:exportXls") | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AppStore appStore) { | |||
return super.exportXls(request, appStore, AppStore.class, "门店管理"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequiresPermissions("store:app_store:importExcel") | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AppStore.class); | |||
} | |||
} |
@ -0,0 +1,73 @@ | |||
package org.jeecg.modules.demo.store.entity; | |||
import java.io.Serializable; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.Date; | |||
import java.math.BigDecimal; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableLogic; | |||
import org.jeecg.common.constant.ProvinceCityArea; | |||
import org.jeecg.common.util.SpringContextUtils; | |||
import lombok.Data; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.jeecgframework.poi.excel.annotation.Excel; | |||
import org.jeecg.common.aspect.annotation.Dict; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Description: 门店管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("app_store") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="app_store对象", description="门店管理") | |||
public class AppStore implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**门店名称*/ | |||
@Excel(name = "门店名称", width = 15) | |||
@ApiModelProperty(value = "门店名称") | |||
private java.lang.String storeName; | |||
/**状态*/ | |||
@Excel(name = "状态", width = 15, dicCode = "dict_item_status") | |||
@Dict(dicCode = "dict_item_status") | |||
@ApiModelProperty(value = "状态") | |||
private java.lang.Integer status; | |||
/**备注*/ | |||
@Excel(name = "备注", width = 15) | |||
@ApiModelProperty(value = "备注") | |||
private java.lang.String remark; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**所属部门*/ | |||
@ApiModelProperty(value = "所属部门") | |||
private java.lang.String sysOrgCode; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.demo.store.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.demo.store.entity.AppStore; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 门店管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AppStoreMapper extends BaseMapper<AppStore> { | |||
} |
@ -0,0 +1,5 @@ | |||
<?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="org.jeecg.modules.demo.store.mapper.AppStoreMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.demo.store.service; | |||
import org.jeecg.modules.demo.store.entity.AppStore; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 门店管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAppStoreService extends IService<AppStore> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.demo.store.service.impl; | |||
import org.jeecg.modules.demo.store.entity.AppStore; | |||
import org.jeecg.modules.demo.store.mapper.AppStoreMapper; | |||
import org.jeecg.modules.demo.store.service.IAppStoreService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 门店管理 | |||
* @Author: jeecg-boot | |||
* @Date: 2025-02-16 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AppStoreServiceImpl extends ServiceImpl<AppStoreMapper, AppStore> implements IAppStoreService { | |||
} |
@ -0,0 +1,96 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName"> | |||
<block slot="backText">返回</block> | |||
<block slot="content">门店管理</block> | |||
</cu-custom> | |||
<!--表单区域--> | |||
<view> | |||
<form> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">门店名称:</text></view> | |||
<input placeholder="请输入门店名称" v-model="model.storeName"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">状态:</text></view> | |||
<input type="number" placeholder="请输入状态" v-model="model.status"/> | |||
</view> | |||
</view> | |||
<view class="cu-form-group"> | |||
<view class="flex align-center"> | |||
<view class="title"><text space="ensp">备注:</text></view> | |||
<input placeholder="请输入备注" v-model="model.remark"/> | |||
</view> | |||
</view> | |||
<my-date label="创建日期:" v-model="model.createTime" placeholder="请输入创建日期"></my-date> | |||
<view class="padding"> | |||
<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit"> | |||
<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交 | |||
</button> | |||
</view> | |||
</form> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import myDate from '@/components/my-componets/my-date.vue' | |||
export default { | |||
name: "AppStoreForm", | |||
components:{ myDate }, | |||
props:{ | |||
formData:{ | |||
type:Object, | |||
default:()=>{}, | |||
required:false | |||
} | |||
}, | |||
data(){ | |||
return { | |||
CustomBar: this.CustomBar, | |||
NavBarColor: this.NavBarColor, | |||
loading:false, | |||
model: {}, | |||
backRouteName:'index', | |||
url: { | |||
queryById: "/store/appStore/queryById", | |||
add: "/store/appStore/add", | |||
edit: "/store/appStore/edit", | |||
}, | |||
} | |||
}, | |||
created(){ | |||
this.initFormData(); | |||
}, | |||
methods:{ | |||
initFormData(){ | |||
if(this.formData){ | |||
let dataId = this.formData.dataId; | |||
this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{ | |||
if(res.data.success){ | |||
console.log("表单数据",res); | |||
this.model = res.data.result; | |||
} | |||
}) | |||
} | |||
}, | |||
onSubmit() { | |||
let myForm = {...this.model}; | |||
this.loading = true; | |||
let url = myForm.id?this.url.edit:this.url.add; | |||
this.$http.post(url,myForm).then(res=>{ | |||
console.log("res",res) | |||
this.loading = false | |||
this.$Router.push({name:this.backRouteName}) | |||
}).catch(()=>{ | |||
this.loading = false | |||
}); | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,44 @@ | |||
<template> | |||
<view> | |||
<!--标题和返回--> | |||
<cu-custom :bgColor="NavBarColor" isBack> | |||
<block slot="backText">返回</block> | |||
<block slot="content">门店管理</block> | |||
</cu-custom> | |||
<!--滚动加载列表--> | |||
<mescroll-body ref="mescrollRef" bottom="88" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback"> | |||
<view class="cu-list menu"> | |||
<view class="cu-item" v-for="(item,index) in list" :key="index" @click="goHome"> | |||
<view class="flex" style="width:100%"> | |||
<text class="text-lg" style="color: #000;"> | |||
{{ item.createBy}} | |||
</text> | |||
</view> | |||
</view> | |||
</view> | |||
</mescroll-body> | |||
</view> | |||
</template> | |||
<script> | |||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; | |||
import Mixin from "@/common/mixin/Mixin.js"; | |||
export default { | |||
name: '门店管理', | |||
mixins: [MescrollMixin,Mixin], | |||
data() { | |||
return { | |||
CustomBar:this.CustomBar, | |||
NavBarColor:this.NavBarColor, | |||
url: "/store/appStore/list", | |||
}; | |||
}, | |||
methods: { | |||
goHome(){ | |||
this.$Router.push({name: "index"}) | |||
} | |||
} | |||
} | |||
</script> | |||
@ -0,0 +1,64 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { useMessage } from "/@/hooks/web/useMessage"; | |||
const { createConfirm } = useMessage(); | |||
enum Api { | |||
list = '/store/appStore/list', | |||
save='/store/appStore/add', | |||
edit='/store/appStore/edit', | |||
deleteOne = '/store/appStore/delete', | |||
deleteBatch = '/store/appStore/deleteBatch', | |||
importExcel = '/store/appStore/importExcel', | |||
exportXls = '/store/appStore/exportXls', | |||
} | |||
/** | |||
* 导出api | |||
* @param params | |||
*/ | |||
export const getExportUrl = Api.exportXls; | |||
/** | |||
* 导入api | |||
*/ | |||
export const getImportUrl = Api.importExcel; | |||
/** | |||
* 列表接口 | |||
* @param params | |||
*/ | |||
export const list = (params) => | |||
defHttp.get({url: Api.list, params}); | |||
/** | |||
* 删除单个 | |||
*/ | |||
export const deleteOne = (params,handleSuccess) => { | |||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
/** | |||
* 批量删除 | |||
* @param params | |||
*/ | |||
export const batchDelete = (params, handleSuccess) => { | |||
createConfirm({ | |||
iconType: 'warning', | |||
title: '确认删除', | |||
content: '是否删除选中数据', | |||
okText: '确认', | |||
cancelText: '取消', | |||
onOk: () => { | |||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
handleSuccess(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 保存或者更新 | |||
* @param params | |||
*/ | |||
export const saveOrUpdate = (params, isUpdate) => { | |||
let url = isUpdate ? Api.edit : Api.save; | |||
return defHttp.post({url: url, params}); | |||
} |
@ -0,0 +1,102 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
import { getWeekMonthQuarterYear } from '/@/utils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '门店名称', | |||
align:"center", | |||
dataIndex: 'storeName' | |||
}, | |||
{ | |||
title: '状态', | |||
align:"center", | |||
dataIndex: 'status_dictText' | |||
}, | |||
{ | |||
title: '备注', | |||
align:"center", | |||
dataIndex: 'remark' | |||
}, | |||
{ | |||
title: '创建日期', | |||
align:"center", | |||
dataIndex: 'createTime' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
{ | |||
label: "门店名称", | |||
field: "storeName", | |||
component: 'JInput', | |||
}, | |||
{ | |||
label: "状态", | |||
field: 'status', | |||
component: 'JSelectMultiple', | |||
componentProps:{ | |||
dictCode:"dict_item_status" | |||
}, | |||
//colProps: {span: 6}, | |||
}, | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '门店名称', | |||
field: 'storeName', | |||
component: 'Input', | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入门店名称!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '状态', | |||
field: 'status', | |||
defaultValue: 1, | |||
component: 'JDictSelectTag', | |||
componentProps:{ | |||
dictCode:"dict_item_status", | |||
type: "radio" | |||
}, | |||
dynamicRules: ({model,schema}) => { | |||
return [ | |||
{ required: true, message: '请输入状态!'}, | |||
]; | |||
}, | |||
}, | |||
{ | |||
label: '备注', | |||
field: 'remark', | |||
component: 'Input', | |||
}, | |||
// TODO 主键隐藏字段,目前写死为ID | |||
{ | |||
label: '', | |||
field: 'id', | |||
component: 'Input', | |||
show: false | |||
}, | |||
]; | |||
// 高级查询数据 | |||
export const superQuerySchema = { | |||
storeName: {title: '门店名称',order: 0,view: 'text', type: 'string',}, | |||
status: {title: '状态',order: 1,view: 'number', type: 'number',dictCode: 'dict_item_status',}, | |||
remark: {title: '备注',order: 2,view: 'text', type: 'string',}, | |||
createTime: {title: '创建日期',order: 3,view: 'datetime', type: 'string',}, | |||
}; | |||
/** | |||
* 流程表单调用这个方法获取formSchema | |||
* @param param | |||
*/ | |||
export function getBpmFormSchema(_formData): FormSchema[]{ | |||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema | |||
return formSchema; | |||
} |
@ -0,0 +1,190 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" v-auth="'store:app_store:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" v-auth="'store:app_store:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" v-auth="'store:app_store:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<template #overlay> | |||
<a-menu> | |||
<a-menu-item key="1" @click="batchHandleDelete"> | |||
<Icon icon="ant-design:delete-outlined"></Icon> | |||
删除 | |||
</a-menu-item> | |||
</a-menu> | |||
</template> | |||
<a-button v-auth="'store:app_store:deleteBatch'">批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
<!-- 高级查询 --> | |||
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template v-slot:bodyCell="{ column, record, index, text }"> | |||
</template> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AppStoreModal @register="registerModal" @success="handleSuccess"></AppStoreModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="store-appStore" setup> | |||
import {ref, reactive, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AppStoreModal from './components/AppStoreModal.vue' | |||
import {columns, searchFormSchema, superQuerySchema} from './AppStore.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './AppStore.api'; | |||
import { downloadFile } from '/@/utils/common/renderUtils'; | |||
import { useUserStore } from '/@/store/modules/user'; | |||
const queryParam = reactive<any>({}); | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
const userStore = useUserStore(); | |||
//注册model | |||
const [registerModal, {openModal}] = useModal(); | |||
//注册table数据 | |||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
tableProps:{ | |||
title: '门店管理', | |||
api: list, | |||
columns, | |||
canResize:false, | |||
formConfig: { | |||
//labelWidth: 120, | |||
schemas: searchFormSchema, | |||
autoSubmitOnEnter:true, | |||
showAdvancedButton:true, | |||
fieldMapToNumber: [ | |||
], | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
fixed:'right' | |||
}, | |||
beforeFetch: (params) => { | |||
return Object.assign(params, queryParam); | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"门店管理", | |||
url: getExportUrl, | |||
params: queryParam, | |||
}, | |||
importConfig: { | |||
url: getImportUrl, | |||
success: handleSuccess | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
// 高级查询配置 | |||
const superQueryConfig = reactive(superQuerySchema); | |||
/** | |||
* 高级查询事件 | |||
*/ | |||
function handleSuperQuery(params) { | |||
Object.keys(params).map((k) => { | |||
queryParam[k] = params[k]; | |||
}); | |||
reload(); | |||
} | |||
/** | |||
* 新增事件 | |||
*/ | |||
function handleAdd() { | |||
openModal(true, { | |||
isUpdate: false, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 编辑事件 | |||
*/ | |||
function handleEdit(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: true, | |||
}); | |||
} | |||
/** | |||
* 详情 | |||
*/ | |||
function handleDetail(record: Recordable) { | |||
openModal(true, { | |||
record, | |||
isUpdate: true, | |||
showFooter: false, | |||
}); | |||
} | |||
/** | |||
* 删除事件 | |||
*/ | |||
async function handleDelete(record) { | |||
await deleteOne({id: record.id}, handleSuccess); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
(selectedRowKeys.value = []) && reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
auth: 'store:app_store:edit' | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
placement: 'topLeft', | |||
}, | |||
auth: 'store:app_store:delete' | |||
} | |||
] | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
:deep(.ant-picker),:deep(.ant-input-number){ | |||
width: 100%; | |||
} | |||
</style> |
@ -0,0 +1,26 @@ | |||
-- 注意:该页面对应的前台目录为views/store文件夹下 | |||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) | |||
VALUES ('2025021602224080490', NULL, '门店管理', '/app/appStoreList', 'miniapp/store/AppStoreList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0); | |||
-- 权限控制sql | |||
-- 新增 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080491', '2025021602224080490', '添加门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 编辑 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080492', '2025021602224080490', '编辑门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080493', '2025021602224080490', '删除门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 批量删除 | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080494', '2025021602224080490', '批量删除门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 导出excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080495', '2025021602224080490', '导出excel_门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); | |||
-- 导入excel | |||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) | |||
VALUES ('2025021602224080496', '2025021602224080490', '导入excel_门店管理', NULL, NULL, 0, NULL, NULL, 2, 'store:app_store:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-02-16 14:22:49', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,70 @@ | |||
<template> | |||
<div style="min-height: 400px"> | |||
<BasicForm @register="registerForm"></BasicForm> | |||
<div style="width: 100%;text-align: center" v-if="!formDisabled"> | |||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button> | |||
</div> | |||
</div> | |||
</template> | |||
<script lang="ts"> | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {computed, defineComponent} from 'vue'; | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import { propTypes } from '/@/utils/propTypes'; | |||
import {getBpmFormSchema} from '../AppStore.data'; | |||
import {saveOrUpdate} from '../AppStore.api'; | |||
export default defineComponent({ | |||
name: "AppStoreForm", | |||
components:{ | |||
BasicForm | |||
}, | |||
props:{ | |||
formData: propTypes.object.def({}), | |||
formBpm: propTypes.bool.def(true), | |||
}, | |||
setup(props){ | |||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ | |||
labelWidth: 150, | |||
schemas: getBpmFormSchema(props.formData), | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
const formDisabled = computed(()=>{ | |||
if(props.formData.disabled === false){ | |||
return false; | |||
} | |||
return true; | |||
}); | |||
let formData = {}; | |||
const queryByIdUrl = '/store/appStore/queryById'; | |||
async function initFormData(){ | |||
let params = {id: props.formData.dataId}; | |||
const data = await defHttp.get({url: queryByIdUrl, params}); | |||
formData = {...data} | |||
//设置表单的值 | |||
await setFieldsValue(formData); | |||
//默认是禁用 | |||
await setProps({disabled: formDisabled.value}) | |||
} | |||
async function submitForm() { | |||
let data = getFieldsValue(); | |||
let params = Object.assign({}, formData, data); | |||
console.log('表单数据', params) | |||
await saveOrUpdate(params, true) | |||
} | |||
initFormData(); | |||
return { | |||
registerForm, | |||
formDisabled, | |||
submitForm, | |||
} | |||
} | |||
}); | |||
</script> |
@ -0,0 +1,76 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm" name="AppStoreForm" /> | |||
</BasicModal> | |||
</template> | |||
<script lang="ts" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
import {BasicForm, useForm} from '/@/components/Form/index'; | |||
import {formSchema} from '../AppStore.data'; | |||
import {saveOrUpdate} from '../AppStore.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
const isDetail = ref(false); | |||
//表单配置 | |||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
baseColProps: {span: 24} | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
isDetail.value = !!data?.showFooter; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} catch ({ errorFields }) { | |||
if (errorFields) { | |||
const firstField = errorFields[0]; | |||
if (firstField) { | |||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); | |||
} | |||
} | |||
return Promise.reject(errorFields); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** 时间和数字输入框样式 */ | |||
:deep(.ant-input-number) { | |||
width: 100%; | |||
} | |||
:deep(.ant-calendar-picker) { | |||
width: 100%; | |||
} | |||
</style> |