@ -0,0 +1,171 @@ | |||
package org.jeecg.modules.atComplaintLog.controller; | |||
import java.util.Arrays; | |||
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.util.oConvertUtils; | |||
import org.jeecg.modules.atComplaintLog.entity.AtComplaintLog; | |||
import org.jeecg.modules.atComplaintLog.service.IAtComplaintLogService; | |||
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; | |||
/** | |||
* @Description: 举报投诉日志表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="举报投诉日志表") | |||
@RestController | |||
@RequestMapping("/atComplaintLog/atComplaintLog") | |||
@Slf4j | |||
public class AtComplaintLogController extends JeecgController<AtComplaintLog, IAtComplaintLogService> { | |||
@Autowired | |||
private IAtComplaintLogService atComplaintLogService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param atComplaintLog | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "举报投诉日志表-分页列表查询") | |||
@ApiOperation(value="举报投诉日志表-分页列表查询", notes="举报投诉日志表-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AtComplaintLog>> queryPageList(AtComplaintLog atComplaintLog, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AtComplaintLog> queryWrapper = QueryGenerator.initQueryWrapper(atComplaintLog, req.getParameterMap()); | |||
Page<AtComplaintLog> page = new Page<AtComplaintLog>(pageNo, pageSize); | |||
IPage<AtComplaintLog> pageList = atComplaintLogService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param atComplaintLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "举报投诉日志表-添加") | |||
@ApiOperation(value="举报投诉日志表-添加", notes="举报投诉日志表-添加") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AtComplaintLog atComplaintLog) { | |||
atComplaintLogService.save(atComplaintLog); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param atComplaintLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "举报投诉日志表-编辑") | |||
@ApiOperation(value="举报投诉日志表-编辑", notes="举报投诉日志表-编辑") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AtComplaintLog atComplaintLog) { | |||
atComplaintLogService.updateById(atComplaintLog); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "举报投诉日志表-通过id删除") | |||
@ApiOperation(value="举报投诉日志表-通过id删除", notes="举报投诉日志表-通过id删除") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
atComplaintLogService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "举报投诉日志表-批量删除") | |||
@ApiOperation(value="举报投诉日志表-批量删除", notes="举报投诉日志表-批量删除") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.atComplaintLogService.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<AtComplaintLog> queryById(@RequestParam(name="id",required=true) String id) { | |||
AtComplaintLog atComplaintLog = atComplaintLogService.getById(id); | |||
if(atComplaintLog==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(atComplaintLog); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param atComplaintLog | |||
*/ | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AtComplaintLog atComplaintLog) { | |||
return super.exportXls(request, atComplaintLog, AtComplaintLog.class, "举报投诉日志表"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AtComplaintLog.class); | |||
} | |||
} |
@ -0,0 +1,71 @@ | |||
package org.jeecg.modules.atComplaintLog.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 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: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("at_complaint_log") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="at_complaint_log对象", description="举报投诉日志表") | |||
public class AtComplaintLog implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**用户*/ | |||
@Excel(name = "用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@ApiModelProperty(value = "用户") | |||
private java.lang.String userId; | |||
/**类型 */ | |||
@Excel(name = "类型 ", width = 15) | |||
@ApiModelProperty(value = "类型 ") | |||
private java.lang.Integer type; | |||
/**举报溯源*/ | |||
@Excel(name = "举报溯源", width = 15) | |||
@ApiModelProperty(value = "举报溯源") | |||
private java.lang.String orderId; | |||
/**内容*/ | |||
@Excel(name = "内容", width = 15) | |||
@ApiModelProperty(value = "内容") | |||
private java.lang.String complaint; | |||
/**原因标识*/ | |||
@Excel(name = "原因标识", width = 15) | |||
@ApiModelProperty(value = "原因标识") | |||
private java.lang.String complaintId; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.atComplaintLog.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.atComplaintLog.entity.AtComplaintLog; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 举报投诉日志表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AtComplaintLogMapper extends BaseMapper<AtComplaintLog> { | |||
} |
@ -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.atComplaintLog.mapper.AtComplaintLogMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.atComplaintLog.service; | |||
import org.jeecg.modules.atComplaintLog.entity.AtComplaintLog; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 举报投诉日志表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAtComplaintLogService extends IService<AtComplaintLog> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.atComplaintLog.service.impl; | |||
import org.jeecg.modules.atComplaintLog.entity.AtComplaintLog; | |||
import org.jeecg.modules.atComplaintLog.mapper.AtComplaintLogMapper; | |||
import org.jeecg.modules.atComplaintLog.service.IAtComplaintLogService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 举报投诉日志表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AtComplaintLogServiceImpl extends ServiceImpl<AtComplaintLogMapper, AtComplaintLog> implements IAtComplaintLogService { | |||
} |
@ -0,0 +1,196 @@ | |||
<template> | |||
<a-card :bordered="false"> | |||
<!-- 查询区域 --> | |||
<div class="table-page-search-wrapper"> | |||
<a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
<a-row :gutter="24"> | |||
</a-row> | |||
</a-form> | |||
</div> | |||
<!-- 查询区域-END --> | |||
<!-- 操作按钮区域 --> | |||
<div class="table-operator"> | |||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
<a-button type="primary" icon="download" @click="handleExportXls('举报投诉日志表')">导出</a-button> | |||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
<a-button type="primary" icon="import">导入</a-button> | |||
</a-upload> | |||
<!-- 高级查询区域 --> | |||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<a-menu slot="overlay"> | |||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
</a-menu> | |||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
</a-dropdown> | |||
</div> | |||
<!-- table区域-begin --> | |||
<div> | |||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
</div> | |||
<a-table | |||
ref="table" | |||
size="middle" | |||
:scroll="{x:true}" | |||
bordered | |||
rowKey="id" | |||
:columns="columns" | |||
:dataSource="dataSource" | |||
:pagination="ipagination" | |||
:loading="loading" | |||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
class="j-table-force-nowrap" | |||
@change="handleTableChange"> | |||
<template slot="htmlSlot" slot-scope="text"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template slot="imgSlot" slot-scope="text,record"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
</template> | |||
<template slot="fileSlot" slot-scope="text"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button | |||
v-else | |||
:ghost="true" | |||
type="primary" | |||
icon="download" | |||
size="small" | |||
@click="downloadFile(text)"> | |||
下载 | |||
</a-button> | |||
</template> | |||
<span slot="action" slot-scope="text, record"> | |||
<a @click="handleEdit(record)">编辑</a> | |||
<a-divider type="vertical" /> | |||
<a-dropdown> | |||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
<a-menu slot="overlay"> | |||
<a-menu-item> | |||
<a @click="handleDetail(record)">详情</a> | |||
</a-menu-item> | |||
<a-menu-item> | |||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
<a>删除</a> | |||
</a-popconfirm> | |||
</a-menu-item> | |||
</a-menu> | |||
</a-dropdown> | |||
</span> | |||
</a-table> | |||
</div> | |||
<at-complaint-log-modal ref="modalForm" @ok="modalFormOk"></at-complaint-log-modal> | |||
</a-card> | |||
</template> | |||
<script> | |||
import '@/assets/less/TableExpand.less' | |||
import { mixinDevice } from '@/utils/mixin' | |||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
import AtComplaintLogModal from './modules/AtComplaintLogModal' | |||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
export default { | |||
name: 'AtComplaintLogList', | |||
mixins:[JeecgListMixin, mixinDevice], | |||
components: { | |||
AtComplaintLogModal | |||
}, | |||
data () { | |||
return { | |||
description: '举报投诉日志表管理页面', | |||
// 表头 | |||
columns: [ | |||
{ | |||
title: '#', | |||
dataIndex: '', | |||
key:'rowIndex', | |||
width:60, | |||
align:"center", | |||
customRender:function (t,r,index) { | |||
return parseInt(index)+1; | |||
} | |||
}, | |||
{ | |||
title:'用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title:'类型 ', | |||
align:"center", | |||
dataIndex: 'type' | |||
}, | |||
{ | |||
title:'举报溯源', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title:'内容', | |||
align:"center", | |||
dataIndex: 'complaint' | |||
}, | |||
{ | |||
title:'原因标识', | |||
align:"center", | |||
dataIndex: 'complaintId' | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'action', | |||
align:"center", | |||
fixed:"right", | |||
width:147, | |||
scopedSlots: { customRender: 'action' } | |||
} | |||
], | |||
url: { | |||
list: "/atComplaintLog/atComplaintLog/list", | |||
delete: "/atComplaintLog/atComplaintLog/delete", | |||
deleteBatch: "/atComplaintLog/atComplaintLog/deleteBatch", | |||
exportXlsUrl: "/atComplaintLog/atComplaintLog/exportXls", | |||
importExcelUrl: "atComplaintLog/atComplaintLog/importExcel", | |||
}, | |||
dictOptions:{}, | |||
superFieldList:[], | |||
} | |||
}, | |||
created() { | |||
this.getSuperFieldList(); | |||
}, | |||
computed: { | |||
importExcelUrl: function(){ | |||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
}, | |||
}, | |||
methods: { | |||
initDictConfig(){ | |||
}, | |||
getSuperFieldList(){ | |||
let fieldList=[]; | |||
fieldList.push({type:'sel_search',value:'userId',text:'用户',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'}) | |||
fieldList.push({type:'int',value:'type',text:'类型 ',dictCode:''}) | |||
fieldList.push({type:'string',value:'orderId',text:'举报溯源',dictCode:''}) | |||
fieldList.push({type:'string',value:'complaint',text:'内容',dictCode:''}) | |||
fieldList.push({type:'string',value:'complaintId',text:'原因标识',dictCode:''}) | |||
this.superFieldList = fieldList | |||
} | |||
} | |||
} | |||
</script> | |||
<style scoped> | |||
@import '~@assets/less/common.less'; | |||
</style> |
@ -0,0 +1,124 @@ | |||
<template> | |||
<a-spin :spinning="confirmLoading"> | |||
<j-form-container :disabled="formDisabled"> | |||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
<a-row> | |||
<a-col :span="24"> | |||
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
<j-search-select-tag v-model="model.userId" dict="han_hai_member,nick_name,id" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="类型 " :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |||
<a-input-number v-model="model.type" placeholder="请输入类型 " style="width: 100%" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="举报溯源" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId"> | |||
<a-input v-model="model.orderId" placeholder="请输入举报溯源" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="complaint"> | |||
<a-input v-model="model.complaint" placeholder="请输入内容" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="原因标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="complaintId"> | |||
<a-input v-model="model.complaintId" placeholder="请输入原因标识" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
</a-row> | |||
</a-form-model> | |||
</j-form-container> | |||
</a-spin> | |||
</template> | |||
<script> | |||
import { httpAction, getAction } from '@/api/manage' | |||
import { validateDuplicateValue } from '@/utils/util' | |||
export default { | |||
name: 'AtComplaintLogForm', | |||
components: { | |||
}, | |||
props: { | |||
//表单禁用 | |||
disabled: { | |||
type: Boolean, | |||
default: false, | |||
required: false | |||
} | |||
}, | |||
data () { | |||
return { | |||
model:{ | |||
}, | |||
labelCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 5 }, | |||
}, | |||
wrapperCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 16 }, | |||
}, | |||
confirmLoading: false, | |||
validatorRules: { | |||
}, | |||
url: { | |||
add: "/atComplaintLog/atComplaintLog/add", | |||
edit: "/atComplaintLog/atComplaintLog/edit", | |||
queryById: "/atComplaintLog/atComplaintLog/queryById" | |||
} | |||
} | |||
}, | |||
computed: { | |||
formDisabled(){ | |||
return this.disabled | |||
}, | |||
}, | |||
created () { | |||
//备份model原始值 | |||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
}, | |||
methods: { | |||
add () { | |||
this.edit(this.modelDefault); | |||
}, | |||
edit (record) { | |||
this.model = Object.assign({}, record); | |||
this.visible = true; | |||
}, | |||
submitForm () { | |||
const that = this; | |||
// 触发表单验证 | |||
this.$refs.form.validate(valid => { | |||
if (valid) { | |||
that.confirmLoading = true; | |||
let httpurl = ''; | |||
let method = ''; | |||
if(!this.model.id){ | |||
httpurl+=this.url.add; | |||
method = 'post'; | |||
}else{ | |||
httpurl+=this.url.edit; | |||
method = 'put'; | |||
} | |||
httpAction(httpurl,this.model,method).then((res)=>{ | |||
if(res.success){ | |||
that.$message.success(res.message); | |||
that.$emit('ok'); | |||
}else{ | |||
that.$message.warning(res.message); | |||
} | |||
}).finally(() => { | |||
that.confirmLoading = false; | |||
}) | |||
} | |||
}) | |||
}, | |||
} | |||
} | |||
</script> |
@ -0,0 +1,84 @@ | |||
<template> | |||
<a-drawer | |||
:title="title" | |||
:width="width" | |||
placement="right" | |||
:closable="false" | |||
@close="close" | |||
destroyOnClose | |||
:visible="visible"> | |||
<at-complaint-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></at-complaint-log-form> | |||
<div class="drawer-footer"> | |||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
</div> | |||
</a-drawer> | |||
</template> | |||
<script> | |||
import AtComplaintLogForm from './AtComplaintLogForm' | |||
export default { | |||
name: 'AtComplaintLogModal', | |||
components: { | |||
AtComplaintLogForm | |||
}, | |||
data () { | |||
return { | |||
title:"操作", | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}); | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** Button按钮间距 */ | |||
.ant-btn { | |||
margin-left: 30px; | |||
margin-bottom: 30px; | |||
float: right; | |||
} | |||
.drawer-footer{ | |||
position: absolute; | |||
bottom: -8px; | |||
width: 100%; | |||
border-top: 1px solid #e8e8e8; | |||
padding: 10px 16px; | |||
text-align: right; | |||
left: 0; | |||
background: #fff; | |||
border-radius: 0 0 2px 2px; | |||
} | |||
</style> |
@ -0,0 +1,60 @@ | |||
<template> | |||
<j-modal | |||
:title="title" | |||
:width="width" | |||
:visible="visible" | |||
switchFullscreen | |||
@ok="handleOk" | |||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
@cancel="handleCancel" | |||
cancelText="关闭"> | |||
<at-complaint-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></at-complaint-log-form> | |||
</j-modal> | |||
</template> | |||
<script> | |||
import AtComplaintLogForm from './AtComplaintLogForm' | |||
export default { | |||
name: 'AtComplaintLogModal', | |||
components: { | |||
AtComplaintLogForm | |||
}, | |||
data () { | |||
return { | |||
title:'', | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}) | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,61 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import {Modal} from 'ant-design-vue'; | |||
enum Api { | |||
list = '/atComplaintLog/atComplaintLog/list', | |||
save='/atComplaintLog/atComplaintLog/add', | |||
edit='/atComplaintLog/atComplaintLog/edit', | |||
deleteOne = '/atComplaintLog/atComplaintLog/delete', | |||
deleteBatch = '/atComplaintLog/atComplaintLog/deleteBatch', | |||
importExcel = '/atComplaintLog/atComplaintLog/importExcel', | |||
exportXls = '/atComplaintLog/atComplaintLog/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) => { | |||
Modal.confirm({ | |||
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,66 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title: '类型 ', | |||
align:"center", | |||
dataIndex: 'type' | |||
}, | |||
{ | |||
title: '举报溯源', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title: '内容', | |||
align:"center", | |||
dataIndex: 'complaint' | |||
}, | |||
{ | |||
title: '原因标识', | |||
align:"center", | |||
dataIndex: 'complaintId' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '用户', | |||
field: 'userId', | |||
component: 'JSearchSelect', | |||
componentProps:{ | |||
dict:"han_hai_member,nick_name,id" | |||
}, | |||
}, | |||
{ | |||
label: '类型 ', | |||
field: 'type', | |||
component: 'InputNumber', | |||
}, | |||
{ | |||
label: '举报溯源', | |||
field: 'orderId', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '内容', | |||
field: 'complaint', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '原因标识', | |||
field: 'complaintId', | |||
component: 'Input', | |||
}, | |||
]; |
@ -0,0 +1,162 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="checkedKeys.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>批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template #htmlSlot="{text}"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template #fileSlot="{text}"> | |||
<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> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AtComplaintLogModal @register="registerModal" @success="handleSuccess"></AtComplaintLogModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="atComplaintLog-atComplaintLog" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AtComplaintLogModal from './components/AtComplaintLogModal.vue' | |||
import {columns, searchFormSchema} from './atComplaintLog.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './atComplaintLog.api'; | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
//注册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, | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"举报投诉日志表", | |||
url: getExportUrl, | |||
}, | |||
importConfig: { | |||
url: getImportUrl | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
/** | |||
* 新增事件 | |||
*/ | |||
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}, reload); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: checkedKeys.value}, reload); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
} | |||
} | |||
] | |||
} | |||
</script> | |||
<style scoped> | |||
</style> |
@ -0,0 +1,58 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm"/> | |||
</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 '../atComplaintLog.data'; | |||
import {saveOrUpdate} from '../atComplaintLog.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
//表单配置 | |||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
</style> |
@ -1,171 +1,171 @@ | |||
package org.jeecg.modules.atMasterPiece.controller; | |||
import java.util.Arrays; | |||
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.util.oConvertUtils; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import org.jeecg.modules.atMasterPiece.service.IAtMasterPieceService; | |||
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; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-08-25 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="代表作品表") | |||
@RestController | |||
@RequestMapping("/atMasterPiece/atMasterPiece") | |||
@Slf4j | |||
public class AtMasterPieceController extends JeecgController<AtMasterPiece, IAtMasterPieceService> { | |||
@Autowired | |||
private IAtMasterPieceService atMasterPieceService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param atMasterPiece | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "代表作品表-分页列表查询") | |||
@ApiOperation(value="代表作品表-分页列表查询", notes="代表作品表-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AtMasterPiece>> queryPageList(AtMasterPiece atMasterPiece, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AtMasterPiece> queryWrapper = QueryGenerator.initQueryWrapper(atMasterPiece, req.getParameterMap()); | |||
Page<AtMasterPiece> page = new Page<AtMasterPiece>(pageNo, pageSize); | |||
IPage<AtMasterPiece> pageList = atMasterPieceService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param atMasterPiece | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-添加") | |||
@ApiOperation(value="代表作品表-添加", notes="代表作品表-添加") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AtMasterPiece atMasterPiece) { | |||
atMasterPieceService.save(atMasterPiece); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param atMasterPiece | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-编辑") | |||
@ApiOperation(value="代表作品表-编辑", notes="代表作品表-编辑") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AtMasterPiece atMasterPiece) { | |||
atMasterPieceService.updateById(atMasterPiece); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-通过id删除") | |||
@ApiOperation(value="代表作品表-通过id删除", notes="代表作品表-通过id删除") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
atMasterPieceService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-批量删除") | |||
@ApiOperation(value="代表作品表-批量删除", notes="代表作品表-批量删除") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.atMasterPieceService.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<AtMasterPiece> queryById(@RequestParam(name="id",required=true) String id) { | |||
AtMasterPiece atMasterPiece = atMasterPieceService.getById(id); | |||
if(atMasterPiece==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(atMasterPiece); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param atMasterPiece | |||
*/ | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AtMasterPiece atMasterPiece) { | |||
return super.exportXls(request, atMasterPiece, AtMasterPiece.class, "代表作品表"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AtMasterPiece.class); | |||
} | |||
} | |||
package org.jeecg.modules.atMasterPiece.controller; | |||
import java.util.Arrays; | |||
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.util.oConvertUtils; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import org.jeecg.modules.atMasterPiece.service.IAtMasterPieceService; | |||
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; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="代表作品表") | |||
@RestController | |||
@RequestMapping("/atMasterPiece/atMasterPiece") | |||
@Slf4j | |||
public class AtMasterPieceController extends JeecgController<AtMasterPiece, IAtMasterPieceService> { | |||
@Autowired | |||
private IAtMasterPieceService atMasterPieceService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param atMasterPiece | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "代表作品表-分页列表查询") | |||
@ApiOperation(value="代表作品表-分页列表查询", notes="代表作品表-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AtMasterPiece>> queryPageList(AtMasterPiece atMasterPiece, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AtMasterPiece> queryWrapper = QueryGenerator.initQueryWrapper(atMasterPiece, req.getParameterMap()); | |||
Page<AtMasterPiece> page = new Page<AtMasterPiece>(pageNo, pageSize); | |||
IPage<AtMasterPiece> pageList = atMasterPieceService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param atMasterPiece | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-添加") | |||
@ApiOperation(value="代表作品表-添加", notes="代表作品表-添加") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AtMasterPiece atMasterPiece) { | |||
atMasterPieceService.save(atMasterPiece); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param atMasterPiece | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-编辑") | |||
@ApiOperation(value="代表作品表-编辑", notes="代表作品表-编辑") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AtMasterPiece atMasterPiece) { | |||
atMasterPieceService.updateById(atMasterPiece); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-通过id删除") | |||
@ApiOperation(value="代表作品表-通过id删除", notes="代表作品表-通过id删除") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
atMasterPieceService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "代表作品表-批量删除") | |||
@ApiOperation(value="代表作品表-批量删除", notes="代表作品表-批量删除") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.atMasterPieceService.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<AtMasterPiece> queryById(@RequestParam(name="id",required=true) String id) { | |||
AtMasterPiece atMasterPiece = atMasterPieceService.getById(id); | |||
if(atMasterPiece==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(atMasterPiece); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param atMasterPiece | |||
*/ | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AtMasterPiece atMasterPiece) { | |||
return super.exportXls(request, atMasterPiece, AtMasterPiece.class, "代表作品表"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AtMasterPiece.class); | |||
} | |||
} |
@ -1,62 +1,75 @@ | |||
package org.jeecg.modules.atMasterPiece.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 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: 2024-08-25 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("at_masterpiece") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="at_masterpiece对象", description="代表作品表") | |||
public class AtMasterPiece implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**用户*/ | |||
@Excel(name = "用户", width = 15) | |||
@ApiModelProperty(value = "用户") | |||
private java.lang.String userId; | |||
/**作品图片*/ | |||
@Excel(name = "作品图片", width = 15) | |||
@ApiModelProperty(value = "作品图片") | |||
private java.lang.String image; | |||
/**作品标题*/ | |||
@Excel(name = "作品标题", width = 15) | |||
@ApiModelProperty(value = "作品标题") | |||
private java.lang.String title; | |||
} | |||
package org.jeecg.modules.atMasterPiece.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 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: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("at_masterpiece") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="at_masterpiece对象", description="代表作品表") | |||
public class AtMasterPiece implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**用户*/ | |||
@Excel(name = "用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@ApiModelProperty(value = "用户") | |||
private java.lang.String userId; | |||
/**作品图片*/ | |||
@Excel(name = "作品图片", width = 15) | |||
@ApiModelProperty(value = "作品图片") | |||
private java.lang.String image; | |||
/**作品标题*/ | |||
@Excel(name = "作品标题", width = 15) | |||
@ApiModelProperty(value = "作品标题") | |||
private java.lang.String title; | |||
/**视频*/ | |||
@Excel(name = "视频", width = 15) | |||
@ApiModelProperty(value = "视频") | |||
private java.lang.String vod; | |||
/**文本内容*/ | |||
@Excel(name = "文本内容", width = 15) | |||
@ApiModelProperty(value = "文本内容") | |||
private java.lang.String context; | |||
/**投票次数*/ | |||
@Excel(name = "投票次数", width = 15) | |||
@ApiModelProperty(value = "投票次数") | |||
private java.lang.Integer num; | |||
} |
@ -1,17 +1,17 @@ | |||
package org.jeecg.modules.atMasterPiece.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-08-25 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AtMasterPieceMapper extends BaseMapper<AtMasterPiece> { | |||
} | |||
package org.jeecg.modules.atMasterPiece.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AtMasterPieceMapper extends BaseMapper<AtMasterPiece> { | |||
} |
@ -1,5 +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.atMasterPiece.mapper.AtMasterPieceMapper"> | |||
<?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.atMasterPiece.mapper.AtMasterPieceMapper"> | |||
</mapper> |
@ -1,14 +1,14 @@ | |||
package org.jeecg.modules.atMasterPiece.service; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-08-25 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAtMasterPieceService extends IService<AtMasterPiece> { | |||
} | |||
package org.jeecg.modules.atMasterPiece.service; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAtMasterPieceService extends IService<AtMasterPiece> { | |||
} |
@ -1,19 +1,19 @@ | |||
package org.jeecg.modules.atMasterPiece.service.impl; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import org.jeecg.modules.atMasterPiece.mapper.AtMasterPieceMapper; | |||
import org.jeecg.modules.atMasterPiece.service.IAtMasterPieceService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-08-25 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AtMasterPieceServiceImpl extends ServiceImpl<AtMasterPieceMapper, AtMasterPiece> implements IAtMasterPieceService { | |||
} | |||
package org.jeecg.modules.atMasterPiece.service.impl; | |||
import org.jeecg.modules.atMasterPiece.entity.AtMasterPiece; | |||
import org.jeecg.modules.atMasterPiece.mapper.AtMasterPieceMapper; | |||
import org.jeecg.modules.atMasterPiece.service.IAtMasterPieceService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 代表作品表 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AtMasterPieceServiceImpl extends ServiceImpl<AtMasterPieceMapper, AtMasterPiece> implements IAtMasterPieceService { | |||
} |
@ -1,184 +1,204 @@ | |||
<template> | |||
<a-card :bordered="false"> | |||
<!-- 查询区域 --> | |||
<div class="table-page-search-wrapper"> | |||
<a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
<a-row :gutter="24"> | |||
</a-row> | |||
</a-form> | |||
</div> | |||
<!-- 查询区域-END --> | |||
<!-- 操作按钮区域 --> | |||
<div class="table-operator"> | |||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
<a-button type="primary" icon="download" @click="handleExportXls('代表作品表')">导出</a-button> | |||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
<a-button type="primary" icon="import">导入</a-button> | |||
</a-upload> | |||
<!-- 高级查询区域 --> | |||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<a-menu slot="overlay"> | |||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
</a-menu> | |||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
</a-dropdown> | |||
</div> | |||
<!-- table区域-begin --> | |||
<div> | |||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
</div> | |||
<a-table | |||
ref="table" | |||
size="middle" | |||
:scroll="{x:true}" | |||
bordered | |||
rowKey="id" | |||
:columns="columns" | |||
:dataSource="dataSource" | |||
:pagination="ipagination" | |||
:loading="loading" | |||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
class="j-table-force-nowrap" | |||
@change="handleTableChange"> | |||
<template slot="htmlSlot" slot-scope="text"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template slot="imgSlot" slot-scope="text,record"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
</template> | |||
<template slot="fileSlot" slot-scope="text"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button | |||
v-else | |||
:ghost="true" | |||
type="primary" | |||
icon="download" | |||
size="small" | |||
@click="downloadFile(text)"> | |||
下载 | |||
</a-button> | |||
</template> | |||
<span slot="action" slot-scope="text, record"> | |||
<a @click="handleEdit(record)">编辑</a> | |||
<a-divider type="vertical" /> | |||
<a-dropdown> | |||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
<a-menu slot="overlay"> | |||
<a-menu-item> | |||
<a @click="handleDetail(record)">详情</a> | |||
</a-menu-item> | |||
<a-menu-item> | |||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
<a>删除</a> | |||
</a-popconfirm> | |||
</a-menu-item> | |||
</a-menu> | |||
</a-dropdown> | |||
</span> | |||
</a-table> | |||
</div> | |||
<at-master-piece-modal ref="modalForm" @ok="modalFormOk"></at-master-piece-modal> | |||
</a-card> | |||
</template> | |||
<script> | |||
import '@/assets/less/TableExpand.less' | |||
import { mixinDevice } from '@/utils/mixin' | |||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
import AtMasterPieceModal from './modules/AtMasterPieceModal' | |||
export default { | |||
name: 'AtMasterPieceList', | |||
mixins:[JeecgListMixin, mixinDevice], | |||
components: { | |||
AtMasterPieceModal | |||
}, | |||
data () { | |||
return { | |||
description: '代表作品表管理页面', | |||
// 表头 | |||
columns: [ | |||
{ | |||
title: '#', | |||
dataIndex: '', | |||
key:'rowIndex', | |||
width:60, | |||
align:"center", | |||
customRender:function (t,r,index) { | |||
return parseInt(index)+1; | |||
} | |||
}, | |||
{ | |||
title:'用户', | |||
align:"center", | |||
dataIndex: 'userId' | |||
}, | |||
{ | |||
title:'作品图片', | |||
align:"center", | |||
dataIndex: 'image', | |||
scopedSlots: {customRender: 'imgSlot'} | |||
}, | |||
{ | |||
title:'作品标题', | |||
align:"center", | |||
dataIndex: 'title' | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'action', | |||
align:"center", | |||
fixed:"right", | |||
width:147, | |||
scopedSlots: { customRender: 'action' } | |||
} | |||
], | |||
url: { | |||
list: "/atMasterPiece/atMasterPiece/list", | |||
delete: "/atMasterPiece/atMasterPiece/delete", | |||
deleteBatch: "/atMasterPiece/atMasterPiece/deleteBatch", | |||
exportXlsUrl: "/atMasterPiece/atMasterPiece/exportXls", | |||
importExcelUrl: "atMasterPiece/atMasterPiece/importExcel", | |||
}, | |||
dictOptions:{}, | |||
superFieldList:[], | |||
} | |||
}, | |||
created() { | |||
this.getSuperFieldList(); | |||
}, | |||
computed: { | |||
importExcelUrl: function(){ | |||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
}, | |||
}, | |||
methods: { | |||
initDictConfig(){ | |||
}, | |||
getSuperFieldList(){ | |||
let fieldList=[]; | |||
fieldList.push({type:'string',value:'userId',text:'用户',dictCode:''}) | |||
fieldList.push({type:'string',value:'image',text:'作品图片',dictCode:''}) | |||
fieldList.push({type:'string',value:'title',text:'作品标题',dictCode:''}) | |||
this.superFieldList = fieldList | |||
} | |||
} | |||
} | |||
</script> | |||
<style scoped> | |||
@import '~@assets/less/common.less'; | |||
<template> | |||
<a-card :bordered="false"> | |||
<!-- 查询区域 --> | |||
<div class="table-page-search-wrapper"> | |||
<a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
<a-row :gutter="24"> | |||
</a-row> | |||
</a-form> | |||
</div> | |||
<!-- 查询区域-END --> | |||
<!-- 操作按钮区域 --> | |||
<div class="table-operator"> | |||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
<a-button type="primary" icon="download" @click="handleExportXls('代表作品表')">导出</a-button> | |||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
<a-button type="primary" icon="import">导入</a-button> | |||
</a-upload> | |||
<!-- 高级查询区域 --> | |||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<a-menu slot="overlay"> | |||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
</a-menu> | |||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
</a-dropdown> | |||
</div> | |||
<!-- table区域-begin --> | |||
<div> | |||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
</div> | |||
<a-table | |||
ref="table" | |||
size="middle" | |||
:scroll="{x:true}" | |||
bordered | |||
rowKey="id" | |||
:columns="columns" | |||
:dataSource="dataSource" | |||
:pagination="ipagination" | |||
:loading="loading" | |||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
class="j-table-force-nowrap" | |||
@change="handleTableChange"> | |||
<template slot="htmlSlot" slot-scope="text"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template slot="imgSlot" slot-scope="text,record"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
</template> | |||
<template slot="fileSlot" slot-scope="text"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button | |||
v-else | |||
:ghost="true" | |||
type="primary" | |||
icon="download" | |||
size="small" | |||
@click="downloadFile(text)"> | |||
下载 | |||
</a-button> | |||
</template> | |||
<span slot="action" slot-scope="text, record"> | |||
<a @click="handleEdit(record)">编辑</a> | |||
<a-divider type="vertical" /> | |||
<a-dropdown> | |||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
<a-menu slot="overlay"> | |||
<a-menu-item> | |||
<a @click="handleDetail(record)">详情</a> | |||
</a-menu-item> | |||
<a-menu-item> | |||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
<a>删除</a> | |||
</a-popconfirm> | |||
</a-menu-item> | |||
</a-menu> | |||
</a-dropdown> | |||
</span> | |||
</a-table> | |||
</div> | |||
<at-master-piece-modal ref="modalForm" @ok="modalFormOk"></at-master-piece-modal> | |||
</a-card> | |||
</template> | |||
<script> | |||
import '@/assets/less/TableExpand.less' | |||
import { mixinDevice } from '@/utils/mixin' | |||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
import AtMasterPieceModal from './modules/AtMasterPieceModal' | |||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
export default { | |||
name: 'AtMasterPieceList', | |||
mixins:[JeecgListMixin, mixinDevice], | |||
components: { | |||
AtMasterPieceModal | |||
}, | |||
data () { | |||
return { | |||
description: '代表作品表管理页面', | |||
// 表头 | |||
columns: [ | |||
{ | |||
title: '#', | |||
dataIndex: '', | |||
key:'rowIndex', | |||
width:60, | |||
align:"center", | |||
customRender:function (t,r,index) { | |||
return parseInt(index)+1; | |||
} | |||
}, | |||
{ | |||
title:'用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title:'作品图片', | |||
align:"center", | |||
dataIndex: 'image', | |||
scopedSlots: {customRender: 'imgSlot'} | |||
}, | |||
{ | |||
title:'作品标题', | |||
align:"center", | |||
dataIndex: 'title' | |||
}, | |||
{ | |||
title:'视频', | |||
align:"center", | |||
dataIndex: 'vod', | |||
scopedSlots: {customRender: 'fileSlot'} | |||
}, | |||
{ | |||
title:'文本内容', | |||
align:"center", | |||
dataIndex: 'context' | |||
}, | |||
{ | |||
title:'投票次数', | |||
align:"center", | |||
dataIndex: 'num' | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'action', | |||
align:"center", | |||
fixed:"right", | |||
width:147, | |||
scopedSlots: { customRender: 'action' } | |||
} | |||
], | |||
url: { | |||
list: "/atMasterPiece/atMasterPiece/list", | |||
delete: "/atMasterPiece/atMasterPiece/delete", | |||
deleteBatch: "/atMasterPiece/atMasterPiece/deleteBatch", | |||
exportXlsUrl: "/atMasterPiece/atMasterPiece/exportXls", | |||
importExcelUrl: "atMasterPiece/atMasterPiece/importExcel", | |||
}, | |||
dictOptions:{}, | |||
superFieldList:[], | |||
} | |||
}, | |||
created() { | |||
this.getSuperFieldList(); | |||
}, | |||
computed: { | |||
importExcelUrl: function(){ | |||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
}, | |||
}, | |||
methods: { | |||
initDictConfig(){ | |||
}, | |||
getSuperFieldList(){ | |||
let fieldList=[]; | |||
fieldList.push({type:'sel_search',value:'userId',text:'用户',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'}) | |||
fieldList.push({type:'string',value:'image',text:'作品图片',dictCode:''}) | |||
fieldList.push({type:'string',value:'title',text:'作品标题',dictCode:''}) | |||
fieldList.push({type:'string',value:'vod',text:'视频',dictCode:''}) | |||
fieldList.push({type:'string',value:'context',text:'文本内容',dictCode:''}) | |||
fieldList.push({type:'int',value:'num',text:'投票次数',dictCode:''}) | |||
this.superFieldList = fieldList | |||
} | |||
} | |||
} | |||
</script> | |||
<style scoped> | |||
@import '~@assets/less/common.less'; | |||
</style> |
@ -1,114 +1,129 @@ | |||
<template> | |||
<a-spin :spinning="confirmLoading"> | |||
<j-form-container :disabled="formDisabled"> | |||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
<a-row> | |||
<a-col :span="24"> | |||
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
<a-input v-model="model.userId" placeholder="请输入用户" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="作品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image"> | |||
<j-image-upload isMultiple v-model="model.image" ></j-image-upload> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="作品标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
<a-input v-model="model.title" placeholder="请输入作品标题" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
</a-row> | |||
</a-form-model> | |||
</j-form-container> | |||
</a-spin> | |||
</template> | |||
<script> | |||
import { httpAction, getAction } from '@/api/manage' | |||
import { validateDuplicateValue } from '@/utils/util' | |||
export default { | |||
name: 'AtMasterPieceForm', | |||
components: { | |||
}, | |||
props: { | |||
//表单禁用 | |||
disabled: { | |||
type: Boolean, | |||
default: false, | |||
required: false | |||
} | |||
}, | |||
data () { | |||
return { | |||
model:{ | |||
}, | |||
labelCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 5 }, | |||
}, | |||
wrapperCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 16 }, | |||
}, | |||
confirmLoading: false, | |||
validatorRules: { | |||
}, | |||
url: { | |||
add: "/atMasterPiece/atMasterPiece/add", | |||
edit: "/atMasterPiece/atMasterPiece/edit", | |||
queryById: "/atMasterPiece/atMasterPiece/queryById" | |||
} | |||
} | |||
}, | |||
computed: { | |||
formDisabled(){ | |||
return this.disabled | |||
}, | |||
}, | |||
created () { | |||
//备份model原始值 | |||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
}, | |||
methods: { | |||
add () { | |||
this.edit(this.modelDefault); | |||
}, | |||
edit (record) { | |||
this.model = Object.assign({}, record); | |||
this.visible = true; | |||
}, | |||
submitForm () { | |||
const that = this; | |||
// 触发表单验证 | |||
this.$refs.form.validate(valid => { | |||
if (valid) { | |||
that.confirmLoading = true; | |||
let httpurl = ''; | |||
let method = ''; | |||
if(!this.model.id){ | |||
httpurl+=this.url.add; | |||
method = 'post'; | |||
}else{ | |||
httpurl+=this.url.edit; | |||
method = 'put'; | |||
} | |||
httpAction(httpurl,this.model,method).then((res)=>{ | |||
if(res.success){ | |||
that.$message.success(res.message); | |||
that.$emit('ok'); | |||
}else{ | |||
that.$message.warning(res.message); | |||
} | |||
}).finally(() => { | |||
that.confirmLoading = false; | |||
}) | |||
} | |||
}) | |||
}, | |||
} | |||
} | |||
<template> | |||
<a-spin :spinning="confirmLoading"> | |||
<j-form-container :disabled="formDisabled"> | |||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
<a-row> | |||
<a-col :span="24"> | |||
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
<j-search-select-tag v-model="model.userId" dict="han_hai_member,nick_name,id" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="作品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image"> | |||
<j-image-upload isMultiple v-model="model.image" ></j-image-upload> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="作品标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
<a-input v-model="model.title" placeholder="请输入作品标题" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="视频" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="vod"> | |||
<j-upload v-model="model.vod" ></j-upload> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="文本内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="context"> | |||
<a-textarea v-model="model.context" rows="4" placeholder="请输入文本内容" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="投票次数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num"> | |||
<a-input-number v-model="model.num" placeholder="请输入投票次数" style="width: 100%" /> | |||
</a-form-model-item> | |||
</a-col> | |||
</a-row> | |||
</a-form-model> | |||
</j-form-container> | |||
</a-spin> | |||
</template> | |||
<script> | |||
import { httpAction, getAction } from '@/api/manage' | |||
import { validateDuplicateValue } from '@/utils/util' | |||
export default { | |||
name: 'AtMasterPieceForm', | |||
components: { | |||
}, | |||
props: { | |||
//表单禁用 | |||
disabled: { | |||
type: Boolean, | |||
default: false, | |||
required: false | |||
} | |||
}, | |||
data () { | |||
return { | |||
model:{ | |||
}, | |||
labelCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 5 }, | |||
}, | |||
wrapperCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 16 }, | |||
}, | |||
confirmLoading: false, | |||
validatorRules: { | |||
}, | |||
url: { | |||
add: "/atMasterPiece/atMasterPiece/add", | |||
edit: "/atMasterPiece/atMasterPiece/edit", | |||
queryById: "/atMasterPiece/atMasterPiece/queryById" | |||
} | |||
} | |||
}, | |||
computed: { | |||
formDisabled(){ | |||
return this.disabled | |||
}, | |||
}, | |||
created () { | |||
//备份model原始值 | |||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
}, | |||
methods: { | |||
add () { | |||
this.edit(this.modelDefault); | |||
}, | |||
edit (record) { | |||
this.model = Object.assign({}, record); | |||
this.visible = true; | |||
}, | |||
submitForm () { | |||
const that = this; | |||
// 触发表单验证 | |||
this.$refs.form.validate(valid => { | |||
if (valid) { | |||
that.confirmLoading = true; | |||
let httpurl = ''; | |||
let method = ''; | |||
if(!this.model.id){ | |||
httpurl+=this.url.add; | |||
method = 'post'; | |||
}else{ | |||
httpurl+=this.url.edit; | |||
method = 'put'; | |||
} | |||
httpAction(httpurl,this.model,method).then((res)=>{ | |||
if(res.success){ | |||
that.$message.success(res.message); | |||
that.$emit('ok'); | |||
}else{ | |||
that.$message.warning(res.message); | |||
} | |||
}).finally(() => { | |||
that.confirmLoading = false; | |||
}) | |||
} | |||
}) | |||
}, | |||
} | |||
} | |||
</script> |
@ -1,84 +1,84 @@ | |||
<template> | |||
<a-drawer | |||
:title="title" | |||
:width="width" | |||
placement="right" | |||
:closable="false" | |||
@close="close" | |||
destroyOnClose | |||
:visible="visible"> | |||
<at-master-piece-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></at-master-piece-form> | |||
<div class="drawer-footer"> | |||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
</div> | |||
</a-drawer> | |||
</template> | |||
<script> | |||
import AtMasterPieceForm from './AtMasterPieceForm' | |||
export default { | |||
name: 'AtMasterPieceModal', | |||
components: { | |||
AtMasterPieceForm | |||
}, | |||
data () { | |||
return { | |||
title:"操作", | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}); | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** Button按钮间距 */ | |||
.ant-btn { | |||
margin-left: 30px; | |||
margin-bottom: 30px; | |||
float: right; | |||
} | |||
.drawer-footer{ | |||
position: absolute; | |||
bottom: -8px; | |||
width: 100%; | |||
border-top: 1px solid #e8e8e8; | |||
padding: 10px 16px; | |||
text-align: right; | |||
left: 0; | |||
background: #fff; | |||
border-radius: 0 0 2px 2px; | |||
} | |||
<template> | |||
<a-drawer | |||
:title="title" | |||
:width="width" | |||
placement="right" | |||
:closable="false" | |||
@close="close" | |||
destroyOnClose | |||
:visible="visible"> | |||
<at-master-piece-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></at-master-piece-form> | |||
<div class="drawer-footer"> | |||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
</div> | |||
</a-drawer> | |||
</template> | |||
<script> | |||
import AtMasterPieceForm from './AtMasterPieceForm' | |||
export default { | |||
name: 'AtMasterPieceModal', | |||
components: { | |||
AtMasterPieceForm | |||
}, | |||
data () { | |||
return { | |||
title:"操作", | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}); | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** Button按钮间距 */ | |||
.ant-btn { | |||
margin-left: 30px; | |||
margin-bottom: 30px; | |||
float: right; | |||
} | |||
.drawer-footer{ | |||
position: absolute; | |||
bottom: -8px; | |||
width: 100%; | |||
border-top: 1px solid #e8e8e8; | |||
padding: 10px 16px; | |||
text-align: right; | |||
left: 0; | |||
background: #fff; | |||
border-radius: 0 0 2px 2px; | |||
} | |||
</style> |
@ -1,60 +1,60 @@ | |||
<template> | |||
<j-modal | |||
:title="title" | |||
:width="width" | |||
:visible="visible" | |||
switchFullscreen | |||
@ok="handleOk" | |||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
@cancel="handleCancel" | |||
cancelText="关闭"> | |||
<at-master-piece-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></at-master-piece-form> | |||
</j-modal> | |||
</template> | |||
<script> | |||
import AtMasterPieceForm from './AtMasterPieceForm' | |||
export default { | |||
name: 'AtMasterPieceModal', | |||
components: { | |||
AtMasterPieceForm | |||
}, | |||
data () { | |||
return { | |||
title:'', | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}) | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
<template> | |||
<j-modal | |||
:title="title" | |||
:width="width" | |||
:visible="visible" | |||
switchFullscreen | |||
@ok="handleOk" | |||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
@cancel="handleCancel" | |||
cancelText="关闭"> | |||
<at-master-piece-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></at-master-piece-form> | |||
</j-modal> | |||
</template> | |||
<script> | |||
import AtMasterPieceForm from './AtMasterPieceForm' | |||
export default { | |||
name: 'AtMasterPieceModal', | |||
components: { | |||
AtMasterPieceForm | |||
}, | |||
data () { | |||
return { | |||
title:'', | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}) | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> |
@ -1,61 +1,61 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import {Modal} from 'ant-design-vue'; | |||
enum Api { | |||
list = '/atMasterPiece/atMasterPiece/list', | |||
save='/atMasterPiece/atMasterPiece/add', | |||
edit='/atMasterPiece/atMasterPiece/edit', | |||
deleteOne = '/atMasterPiece/atMasterPiece/delete', | |||
deleteBatch = '/atMasterPiece/atMasterPiece/deleteBatch', | |||
importExcel = '/atMasterPiece/atMasterPiece/importExcel', | |||
exportXls = '/atMasterPiece/atMasterPiece/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) => { | |||
Modal.confirm({ | |||
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}); | |||
} | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import {Modal} from 'ant-design-vue'; | |||
enum Api { | |||
list = '/atMasterPiece/atMasterPiece/list', | |||
save='/atMasterPiece/atMasterPiece/add', | |||
edit='/atMasterPiece/atMasterPiece/edit', | |||
deleteOne = '/atMasterPiece/atMasterPiece/delete', | |||
deleteBatch = '/atMasterPiece/atMasterPiece/deleteBatch', | |||
importExcel = '/atMasterPiece/atMasterPiece/importExcel', | |||
exportXls = '/atMasterPiece/atMasterPiece/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) => { | |||
Modal.confirm({ | |||
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}); | |||
} |
@ -1,46 +1,82 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '用户', | |||
align:"center", | |||
dataIndex: 'userId' | |||
}, | |||
{ | |||
title: '作品图片', | |||
align:"center", | |||
dataIndex: 'image', | |||
customRender:render.renderAvatar, | |||
}, | |||
{ | |||
title: '作品标题', | |||
align:"center", | |||
dataIndex: 'title' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '用户', | |||
field: 'userId', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '作品图片', | |||
field: 'image', | |||
component: 'JImageUpload', | |||
componentProps:{ | |||
}, | |||
}, | |||
{ | |||
label: '作品标题', | |||
field: 'title', | |||
component: 'Input', | |||
}, | |||
]; | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title: '作品图片', | |||
align:"center", | |||
dataIndex: 'image', | |||
customRender:render.renderAvatar, | |||
}, | |||
{ | |||
title: '作品标题', | |||
align:"center", | |||
dataIndex: 'title' | |||
}, | |||
{ | |||
title: '视频', | |||
align:"center", | |||
dataIndex: 'vod', | |||
slots: { customRender: 'fileSlot' }, | |||
}, | |||
{ | |||
title: '文本内容', | |||
align:"center", | |||
dataIndex: 'context' | |||
}, | |||
{ | |||
title: '投票次数', | |||
align:"center", | |||
dataIndex: 'num' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '用户', | |||
field: 'userId', | |||
component: 'JSearchSelect', | |||
componentProps:{ | |||
dict:"han_hai_member,nick_name,id" | |||
}, | |||
}, | |||
{ | |||
label: '作品图片', | |||
field: 'image', | |||
component: 'JImageUpload', | |||
componentProps:{ | |||
}, | |||
}, | |||
{ | |||
label: '作品标题', | |||
field: 'title', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '视频', | |||
field: 'vod', | |||
component: 'JUpload', | |||
componentProps:{ | |||
}, | |||
}, | |||
{ | |||
label: '文本内容', | |||
field: 'context', | |||
component: 'InputTextArea',//TODO 注意string转换问题 | |||
}, | |||
{ | |||
label: '投票次数', | |||
field: 'num', | |||
component: 'InputNumber', | |||
}, | |||
]; |
@ -1,162 +1,162 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="checkedKeys.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>批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template #htmlSlot="{text}"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template #fileSlot="{text}"> | |||
<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> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AtMasterPieceModal @register="registerModal" @success="handleSuccess"></AtMasterPieceModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="atMasterPiece-atMasterPiece" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AtMasterPieceModal from './components/AtMasterPieceModal.vue' | |||
import {columns, searchFormSchema} from './atMasterPiece.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './atMasterPiece.api'; | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
//注册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, | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"代表作品表", | |||
url: getExportUrl, | |||
}, | |||
importConfig: { | |||
url: getImportUrl | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
/** | |||
* 新增事件 | |||
*/ | |||
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}, reload); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: checkedKeys.value}, reload); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
} | |||
} | |||
] | |||
} | |||
</script> | |||
<style scoped> | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="checkedKeys.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>批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template #htmlSlot="{text}"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template #fileSlot="{text}"> | |||
<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> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AtMasterPieceModal @register="registerModal" @success="handleSuccess"></AtMasterPieceModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="atMasterPiece-atMasterPiece" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AtMasterPieceModal from './components/AtMasterPieceModal.vue' | |||
import {columns, searchFormSchema} from './atMasterPiece.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './atMasterPiece.api'; | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
//注册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, | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"代表作品表", | |||
url: getExportUrl, | |||
}, | |||
importConfig: { | |||
url: getImportUrl | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
/** | |||
* 新增事件 | |||
*/ | |||
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}, reload); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: checkedKeys.value}, reload); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
} | |||
} | |||
] | |||
} | |||
</script> | |||
<style scoped> | |||
</style> |
@ -1,58 +1,58 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm"/> | |||
</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 '../atMasterPiece.data'; | |||
import {saveOrUpdate} from '../atMasterPiece.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
//表单配置 | |||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm"/> | |||
</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 '../atMasterPiece.data'; | |||
import {saveOrUpdate} from '../atMasterPiece.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
//表单配置 | |||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
</style> |
@ -0,0 +1,171 @@ | |||
package org.jeecg.modules.atThumbsLog.controller; | |||
import java.util.Arrays; | |||
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.util.oConvertUtils; | |||
import org.jeecg.modules.atThumbsLog.entity.AtThumbsLog; | |||
import org.jeecg.modules.atThumbsLog.service.IAtThumbsLogService; | |||
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; | |||
/** | |||
* @Description: 点赞记录 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Api(tags="点赞记录") | |||
@RestController | |||
@RequestMapping("/atThumbsLog/atThumbsLog") | |||
@Slf4j | |||
public class AtThumbsLogController extends JeecgController<AtThumbsLog, IAtThumbsLogService> { | |||
@Autowired | |||
private IAtThumbsLogService atThumbsLogService; | |||
/** | |||
* 分页列表查询 | |||
* | |||
* @param atThumbsLog | |||
* @param pageNo | |||
* @param pageSize | |||
* @param req | |||
* @return | |||
*/ | |||
//@AutoLog(value = "点赞记录-分页列表查询") | |||
@ApiOperation(value="点赞记录-分页列表查询", notes="点赞记录-分页列表查询") | |||
@GetMapping(value = "/list") | |||
public Result<IPage<AtThumbsLog>> queryPageList(AtThumbsLog atThumbsLog, | |||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
HttpServletRequest req) { | |||
QueryWrapper<AtThumbsLog> queryWrapper = QueryGenerator.initQueryWrapper(atThumbsLog, req.getParameterMap()); | |||
Page<AtThumbsLog> page = new Page<AtThumbsLog>(pageNo, pageSize); | |||
IPage<AtThumbsLog> pageList = atThumbsLogService.page(page, queryWrapper); | |||
return Result.OK(pageList); | |||
} | |||
/** | |||
* 添加 | |||
* | |||
* @param atThumbsLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "点赞记录-添加") | |||
@ApiOperation(value="点赞记录-添加", notes="点赞记录-添加") | |||
@PostMapping(value = "/add") | |||
public Result<String> add(@RequestBody AtThumbsLog atThumbsLog) { | |||
atThumbsLogService.save(atThumbsLog); | |||
return Result.OK("添加成功!"); | |||
} | |||
/** | |||
* 编辑 | |||
* | |||
* @param atThumbsLog | |||
* @return | |||
*/ | |||
@AutoLog(value = "点赞记录-编辑") | |||
@ApiOperation(value="点赞记录-编辑", notes="点赞记录-编辑") | |||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
public Result<String> edit(@RequestBody AtThumbsLog atThumbsLog) { | |||
atThumbsLogService.updateById(atThumbsLog); | |||
return Result.OK("编辑成功!"); | |||
} | |||
/** | |||
* 通过id删除 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@AutoLog(value = "点赞记录-通过id删除") | |||
@ApiOperation(value="点赞记录-通过id删除", notes="点赞记录-通过id删除") | |||
@DeleteMapping(value = "/delete") | |||
public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
atThumbsLogService.removeById(id); | |||
return Result.OK("删除成功!"); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param ids | |||
* @return | |||
*/ | |||
@AutoLog(value = "点赞记录-批量删除") | |||
@ApiOperation(value="点赞记录-批量删除", notes="点赞记录-批量删除") | |||
@DeleteMapping(value = "/deleteBatch") | |||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
this.atThumbsLogService.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<AtThumbsLog> queryById(@RequestParam(name="id",required=true) String id) { | |||
AtThumbsLog atThumbsLog = atThumbsLogService.getById(id); | |||
if(atThumbsLog==null) { | |||
return Result.error("未找到对应数据"); | |||
} | |||
return Result.OK(atThumbsLog); | |||
} | |||
/** | |||
* 导出excel | |||
* | |||
* @param request | |||
* @param atThumbsLog | |||
*/ | |||
@RequestMapping(value = "/exportXls") | |||
public ModelAndView exportXls(HttpServletRequest request, AtThumbsLog atThumbsLog) { | |||
return super.exportXls(request, atThumbsLog, AtThumbsLog.class, "点赞记录"); | |||
} | |||
/** | |||
* 通过excel导入数据 | |||
* | |||
* @param request | |||
* @param response | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
return super.importExcel(request, response, AtThumbsLog.class); | |||
} | |||
} |
@ -0,0 +1,71 @@ | |||
package org.jeecg.modules.atThumbsLog.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 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: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Data | |||
@TableName("at_thumbs_log") | |||
@Accessors(chain = true) | |||
@EqualsAndHashCode(callSuper = false) | |||
@ApiModel(value="at_thumbs_log对象", description="点赞记录") | |||
public class AtThumbsLog implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/**主键*/ | |||
@TableId(type = IdType.ASSIGN_ID) | |||
@ApiModelProperty(value = "主键") | |||
private java.lang.String id; | |||
/**创建人*/ | |||
@ApiModelProperty(value = "创建人") | |||
private java.lang.String createBy; | |||
/**创建日期*/ | |||
@ApiModelProperty(value = "创建日期") | |||
private java.util.Date createTime; | |||
/**更新人*/ | |||
@ApiModelProperty(value = "更新人") | |||
private java.lang.String updateBy; | |||
/**更新日期*/ | |||
@ApiModelProperty(value = "更新日期") | |||
private java.util.Date updateTime; | |||
/**用户*/ | |||
@Excel(name = "用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id") | |||
@ApiModelProperty(value = "用户") | |||
private java.lang.String userId; | |||
/**类型*/ | |||
@Excel(name = "类型", width = 15) | |||
@ApiModelProperty(value = "类型") | |||
private java.lang.Integer type; | |||
/**溯源标识*/ | |||
@Excel(name = "溯源标识", width = 15) | |||
@ApiModelProperty(value = "溯源标识") | |||
private java.lang.String orderId; | |||
/**点赞名称*/ | |||
@Excel(name = "点赞名称", width = 15) | |||
@ApiModelProperty(value = "点赞名称") | |||
private java.lang.String orderName; | |||
/**点赞/踩*/ | |||
@Excel(name = "点赞/踩", width = 15) | |||
@ApiModelProperty(value = "点赞/踩") | |||
private java.lang.String isState; | |||
} |
@ -0,0 +1,17 @@ | |||
package org.jeecg.modules.atThumbsLog.mapper; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.jeecg.modules.atThumbsLog.entity.AtThumbsLog; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* @Description: 点赞记录 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface AtThumbsLogMapper extends BaseMapper<AtThumbsLog> { | |||
} |
@ -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.atThumbsLog.mapper.AtThumbsLogMapper"> | |||
</mapper> |
@ -0,0 +1,14 @@ | |||
package org.jeecg.modules.atThumbsLog.service; | |||
import org.jeecg.modules.atThumbsLog.entity.AtThumbsLog; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @Description: 点赞记录 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
public interface IAtThumbsLogService extends IService<AtThumbsLog> { | |||
} |
@ -0,0 +1,19 @@ | |||
package org.jeecg.modules.atThumbsLog.service.impl; | |||
import org.jeecg.modules.atThumbsLog.entity.AtThumbsLog; | |||
import org.jeecg.modules.atThumbsLog.mapper.AtThumbsLogMapper; | |||
import org.jeecg.modules.atThumbsLog.service.IAtThumbsLogService; | |||
import org.springframework.stereotype.Service; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* @Description: 点赞记录 | |||
* @Author: jeecg-boot | |||
* @Date: 2024-09-12 | |||
* @Version: V1.0 | |||
*/ | |||
@Service | |||
public class AtThumbsLogServiceImpl extends ServiceImpl<AtThumbsLogMapper, AtThumbsLog> implements IAtThumbsLogService { | |||
} |
@ -0,0 +1,196 @@ | |||
<template> | |||
<a-card :bordered="false"> | |||
<!-- 查询区域 --> | |||
<div class="table-page-search-wrapper"> | |||
<a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
<a-row :gutter="24"> | |||
</a-row> | |||
</a-form> | |||
</div> | |||
<!-- 查询区域-END --> | |||
<!-- 操作按钮区域 --> | |||
<div class="table-operator"> | |||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
<a-button type="primary" icon="download" @click="handleExportXls('点赞记录')">导出</a-button> | |||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
<a-button type="primary" icon="import">导入</a-button> | |||
</a-upload> | |||
<!-- 高级查询区域 --> | |||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
<a-dropdown v-if="selectedRowKeys.length > 0"> | |||
<a-menu slot="overlay"> | |||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
</a-menu> | |||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
</a-dropdown> | |||
</div> | |||
<!-- table区域-begin --> | |||
<div> | |||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
</div> | |||
<a-table | |||
ref="table" | |||
size="middle" | |||
:scroll="{x:true}" | |||
bordered | |||
rowKey="id" | |||
:columns="columns" | |||
:dataSource="dataSource" | |||
:pagination="ipagination" | |||
:loading="loading" | |||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
class="j-table-force-nowrap" | |||
@change="handleTableChange"> | |||
<template slot="htmlSlot" slot-scope="text"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template slot="imgSlot" slot-scope="text,record"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
</template> | |||
<template slot="fileSlot" slot-scope="text"> | |||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
<a-button | |||
v-else | |||
:ghost="true" | |||
type="primary" | |||
icon="download" | |||
size="small" | |||
@click="downloadFile(text)"> | |||
下载 | |||
</a-button> | |||
</template> | |||
<span slot="action" slot-scope="text, record"> | |||
<a @click="handleEdit(record)">编辑</a> | |||
<a-divider type="vertical" /> | |||
<a-dropdown> | |||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
<a-menu slot="overlay"> | |||
<a-menu-item> | |||
<a @click="handleDetail(record)">详情</a> | |||
</a-menu-item> | |||
<a-menu-item> | |||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
<a>删除</a> | |||
</a-popconfirm> | |||
</a-menu-item> | |||
</a-menu> | |||
</a-dropdown> | |||
</span> | |||
</a-table> | |||
</div> | |||
<at-thumbs-log-modal ref="modalForm" @ok="modalFormOk"></at-thumbs-log-modal> | |||
</a-card> | |||
</template> | |||
<script> | |||
import '@/assets/less/TableExpand.less' | |||
import { mixinDevice } from '@/utils/mixin' | |||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
import AtThumbsLogModal from './modules/AtThumbsLogModal' | |||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||
export default { | |||
name: 'AtThumbsLogList', | |||
mixins:[JeecgListMixin, mixinDevice], | |||
components: { | |||
AtThumbsLogModal | |||
}, | |||
data () { | |||
return { | |||
description: '点赞记录管理页面', | |||
// 表头 | |||
columns: [ | |||
{ | |||
title: '#', | |||
dataIndex: '', | |||
key:'rowIndex', | |||
width:60, | |||
align:"center", | |||
customRender:function (t,r,index) { | |||
return parseInt(index)+1; | |||
} | |||
}, | |||
{ | |||
title:'用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title:'类型', | |||
align:"center", | |||
dataIndex: 'type' | |||
}, | |||
{ | |||
title:'溯源标识', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title:'点赞名称', | |||
align:"center", | |||
dataIndex: 'orderName' | |||
}, | |||
{ | |||
title:'点赞/踩', | |||
align:"center", | |||
dataIndex: 'isState' | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'action', | |||
align:"center", | |||
fixed:"right", | |||
width:147, | |||
scopedSlots: { customRender: 'action' } | |||
} | |||
], | |||
url: { | |||
list: "/atThumbsLog/atThumbsLog/list", | |||
delete: "/atThumbsLog/atThumbsLog/delete", | |||
deleteBatch: "/atThumbsLog/atThumbsLog/deleteBatch", | |||
exportXlsUrl: "/atThumbsLog/atThumbsLog/exportXls", | |||
importExcelUrl: "atThumbsLog/atThumbsLog/importExcel", | |||
}, | |||
dictOptions:{}, | |||
superFieldList:[], | |||
} | |||
}, | |||
created() { | |||
this.getSuperFieldList(); | |||
}, | |||
computed: { | |||
importExcelUrl: function(){ | |||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
}, | |||
}, | |||
methods: { | |||
initDictConfig(){ | |||
}, | |||
getSuperFieldList(){ | |||
let fieldList=[]; | |||
fieldList.push({type:'sel_search',value:'userId',text:'用户',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'}) | |||
fieldList.push({type:'int',value:'type',text:'类型',dictCode:''}) | |||
fieldList.push({type:'string',value:'orderId',text:'溯源标识',dictCode:''}) | |||
fieldList.push({type:'string',value:'orderName',text:'点赞名称',dictCode:''}) | |||
fieldList.push({type:'string',value:'isState',text:'点赞/踩',dictCode:''}) | |||
this.superFieldList = fieldList | |||
} | |||
} | |||
} | |||
</script> | |||
<style scoped> | |||
@import '~@assets/less/common.less'; | |||
</style> |
@ -0,0 +1,124 @@ | |||
<template> | |||
<a-spin :spinning="confirmLoading"> | |||
<j-form-container :disabled="formDisabled"> | |||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
<a-row> | |||
<a-col :span="24"> | |||
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
<j-search-select-tag v-model="model.userId" dict="han_hai_member,nick_name,id" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |||
<a-input-number v-model="model.type" placeholder="请输入类型" style="width: 100%" /> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="溯源标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId"> | |||
<a-input v-model="model.orderId" placeholder="请输入溯源标识" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="点赞名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderName"> | |||
<a-input v-model="model.orderName" placeholder="请输入点赞名称" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
<a-col :span="24"> | |||
<a-form-model-item label="点赞/踩" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isState"> | |||
<a-input v-model="model.isState" placeholder="请输入点赞/踩" ></a-input> | |||
</a-form-model-item> | |||
</a-col> | |||
</a-row> | |||
</a-form-model> | |||
</j-form-container> | |||
</a-spin> | |||
</template> | |||
<script> | |||
import { httpAction, getAction } from '@/api/manage' | |||
import { validateDuplicateValue } from '@/utils/util' | |||
export default { | |||
name: 'AtThumbsLogForm', | |||
components: { | |||
}, | |||
props: { | |||
//表单禁用 | |||
disabled: { | |||
type: Boolean, | |||
default: false, | |||
required: false | |||
} | |||
}, | |||
data () { | |||
return { | |||
model:{ | |||
}, | |||
labelCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 5 }, | |||
}, | |||
wrapperCol: { | |||
xs: { span: 24 }, | |||
sm: { span: 16 }, | |||
}, | |||
confirmLoading: false, | |||
validatorRules: { | |||
}, | |||
url: { | |||
add: "/atThumbsLog/atThumbsLog/add", | |||
edit: "/atThumbsLog/atThumbsLog/edit", | |||
queryById: "/atThumbsLog/atThumbsLog/queryById" | |||
} | |||
} | |||
}, | |||
computed: { | |||
formDisabled(){ | |||
return this.disabled | |||
}, | |||
}, | |||
created () { | |||
//备份model原始值 | |||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
}, | |||
methods: { | |||
add () { | |||
this.edit(this.modelDefault); | |||
}, | |||
edit (record) { | |||
this.model = Object.assign({}, record); | |||
this.visible = true; | |||
}, | |||
submitForm () { | |||
const that = this; | |||
// 触发表单验证 | |||
this.$refs.form.validate(valid => { | |||
if (valid) { | |||
that.confirmLoading = true; | |||
let httpurl = ''; | |||
let method = ''; | |||
if(!this.model.id){ | |||
httpurl+=this.url.add; | |||
method = 'post'; | |||
}else{ | |||
httpurl+=this.url.edit; | |||
method = 'put'; | |||
} | |||
httpAction(httpurl,this.model,method).then((res)=>{ | |||
if(res.success){ | |||
that.$message.success(res.message); | |||
that.$emit('ok'); | |||
}else{ | |||
that.$message.warning(res.message); | |||
} | |||
}).finally(() => { | |||
that.confirmLoading = false; | |||
}) | |||
} | |||
}) | |||
}, | |||
} | |||
} | |||
</script> |
@ -0,0 +1,84 @@ | |||
<template> | |||
<a-drawer | |||
:title="title" | |||
:width="width" | |||
placement="right" | |||
:closable="false" | |||
@close="close" | |||
destroyOnClose | |||
:visible="visible"> | |||
<at-thumbs-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></at-thumbs-log-form> | |||
<div class="drawer-footer"> | |||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
</div> | |||
</a-drawer> | |||
</template> | |||
<script> | |||
import AtThumbsLogForm from './AtThumbsLogForm' | |||
export default { | |||
name: 'AtThumbsLogModal', | |||
components: { | |||
AtThumbsLogForm | |||
}, | |||
data () { | |||
return { | |||
title:"操作", | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}); | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
/** Button按钮间距 */ | |||
.ant-btn { | |||
margin-left: 30px; | |||
margin-bottom: 30px; | |||
float: right; | |||
} | |||
.drawer-footer{ | |||
position: absolute; | |||
bottom: -8px; | |||
width: 100%; | |||
border-top: 1px solid #e8e8e8; | |||
padding: 10px 16px; | |||
text-align: right; | |||
left: 0; | |||
background: #fff; | |||
border-radius: 0 0 2px 2px; | |||
} | |||
</style> |
@ -0,0 +1,60 @@ | |||
<template> | |||
<j-modal | |||
:title="title" | |||
:width="width" | |||
:visible="visible" | |||
switchFullscreen | |||
@ok="handleOk" | |||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
@cancel="handleCancel" | |||
cancelText="关闭"> | |||
<at-thumbs-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></at-thumbs-log-form> | |||
</j-modal> | |||
</template> | |||
<script> | |||
import AtThumbsLogForm from './AtThumbsLogForm' | |||
export default { | |||
name: 'AtThumbsLogModal', | |||
components: { | |||
AtThumbsLogForm | |||
}, | |||
data () { | |||
return { | |||
title:'', | |||
width:800, | |||
visible: false, | |||
disableSubmit: false | |||
} | |||
}, | |||
methods: { | |||
add () { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.add(); | |||
}) | |||
}, | |||
edit (record) { | |||
this.visible=true | |||
this.$nextTick(()=>{ | |||
this.$refs.realForm.edit(record); | |||
}) | |||
}, | |||
close () { | |||
this.$emit('close'); | |||
this.visible = false; | |||
}, | |||
handleOk () { | |||
this.$refs.realForm.submitForm(); | |||
}, | |||
submitCallback(){ | |||
this.$emit('ok'); | |||
this.visible = false; | |||
}, | |||
handleCancel () { | |||
this.close() | |||
} | |||
} | |||
} | |||
</script> |
@ -0,0 +1,61 @@ | |||
import {defHttp} from '/@/utils/http/axios'; | |||
import {Modal} from 'ant-design-vue'; | |||
enum Api { | |||
list = '/atThumbsLog/atThumbsLog/list', | |||
save='/atThumbsLog/atThumbsLog/add', | |||
edit='/atThumbsLog/atThumbsLog/edit', | |||
deleteOne = '/atThumbsLog/atThumbsLog/delete', | |||
deleteBatch = '/atThumbsLog/atThumbsLog/deleteBatch', | |||
importExcel = '/atThumbsLog/atThumbsLog/importExcel', | |||
exportXls = '/atThumbsLog/atThumbsLog/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) => { | |||
Modal.confirm({ | |||
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,66 @@ | |||
import {BasicColumn} from '/@/components/Table'; | |||
import {FormSchema} from '/@/components/Table'; | |||
import { rules} from '/@/utils/helper/validator'; | |||
import { render } from '/@/utils/common/renderUtils'; | |||
//列表数据 | |||
export const columns: BasicColumn[] = [ | |||
{ | |||
title: '用户', | |||
align:"center", | |||
dataIndex: 'userId_dictText' | |||
}, | |||
{ | |||
title: '类型', | |||
align:"center", | |||
dataIndex: 'type' | |||
}, | |||
{ | |||
title: '溯源标识', | |||
align:"center", | |||
dataIndex: 'orderId' | |||
}, | |||
{ | |||
title: '点赞名称', | |||
align:"center", | |||
dataIndex: 'orderName' | |||
}, | |||
{ | |||
title: '点赞/踩', | |||
align:"center", | |||
dataIndex: 'isState' | |||
}, | |||
]; | |||
//查询数据 | |||
export const searchFormSchema: FormSchema[] = [ | |||
]; | |||
//表单数据 | |||
export const formSchema: FormSchema[] = [ | |||
{ | |||
label: '用户', | |||
field: 'userId', | |||
component: 'JSearchSelect', | |||
componentProps:{ | |||
dict:"han_hai_member,nick_name,id" | |||
}, | |||
}, | |||
{ | |||
label: '类型', | |||
field: 'type', | |||
component: 'InputNumber', | |||
}, | |||
{ | |||
label: '溯源标识', | |||
field: 'orderId', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '点赞名称', | |||
field: 'orderName', | |||
component: 'Input', | |||
}, | |||
{ | |||
label: '点赞/踩', | |||
field: 'isState', | |||
component: 'Input', | |||
}, | |||
]; |
@ -0,0 +1,162 @@ | |||
<template> | |||
<div> | |||
<!--引用表格--> | |||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
<!--插槽:table标题--> | |||
<template #tableTitle> | |||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
<a-dropdown v-if="checkedKeys.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>批量操作 | |||
<Icon icon="mdi:chevron-down"></Icon> | |||
</a-button> | |||
</a-dropdown> | |||
</template> | |||
<!--操作栏--> | |||
<template #action="{ record }"> | |||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
</template> | |||
<!--字段回显插槽--> | |||
<template #htmlSlot="{text}"> | |||
<div v-html="text"></div> | |||
</template> | |||
<template #fileSlot="{text}"> | |||
<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> | |||
</BasicTable> | |||
<!-- 表单区域 --> | |||
<AtThumbsLogModal @register="registerModal" @success="handleSuccess"></AtThumbsLogModal> | |||
</div> | |||
</template> | |||
<script lang="ts" name="atThumbsLog-atThumbsLog" setup> | |||
import {ref, computed, unref} from 'vue'; | |||
import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
import {useModal} from '/@/components/Modal'; | |||
import { useListPage } from '/@/hooks/system/useListPage' | |||
import AtThumbsLogModal from './components/AtThumbsLogModal.vue' | |||
import {columns, searchFormSchema} from './atThumbsLog.data'; | |||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './atThumbsLog.api'; | |||
const checkedKeys = ref<Array<string | number>>([]); | |||
//注册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, | |||
fieldMapToTime: [ | |||
], | |||
}, | |||
actionColumn: { | |||
width: 120, | |||
}, | |||
}, | |||
exportConfig: { | |||
name:"点赞记录", | |||
url: getExportUrl, | |||
}, | |||
importConfig: { | |||
url: getImportUrl | |||
}, | |||
}) | |||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
/** | |||
* 新增事件 | |||
*/ | |||
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}, reload); | |||
} | |||
/** | |||
* 批量删除事件 | |||
*/ | |||
async function batchHandleDelete() { | |||
await batchDelete({ids: checkedKeys.value}, reload); | |||
} | |||
/** | |||
* 成功回调 | |||
*/ | |||
function handleSuccess() { | |||
reload(); | |||
} | |||
/** | |||
* 操作栏 | |||
*/ | |||
function getTableAction(record){ | |||
return [ | |||
{ | |||
label: '编辑', | |||
onClick: handleEdit.bind(null, record), | |||
} | |||
] | |||
} | |||
/** | |||
* 下拉操作栏 | |||
*/ | |||
function getDropDownAction(record){ | |||
return [ | |||
{ | |||
label: '详情', | |||
onClick: handleDetail.bind(null, record), | |||
}, { | |||
label: '删除', | |||
popConfirm: { | |||
title: '是否确认删除', | |||
confirm: handleDelete.bind(null, record), | |||
} | |||
} | |||
] | |||
} | |||
</script> | |||
<style scoped> | |||
</style> |
@ -0,0 +1,58 @@ | |||
<template> | |||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
<BasicForm @register="registerForm"/> | |||
</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 '../atThumbsLog.data'; | |||
import {saveOrUpdate} from '../atThumbsLog.api'; | |||
// Emits声明 | |||
const emit = defineEmits(['register','success']); | |||
const isUpdate = ref(true); | |||
//表单配置 | |||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
labelWidth: 150, | |||
schemas: formSchema, | |||
showActionButtonGroup: false, | |||
}); | |||
//表单赋值 | |||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
//重置表单 | |||
await resetFields(); | |||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
isUpdate.value = !!data?.isUpdate; | |||
if (unref(isUpdate)) { | |||
//表单赋值 | |||
await setFieldsValue({ | |||
...data.record, | |||
}); | |||
} | |||
// 隐藏底部时禁用整个表单 | |||
setProps({ disabled: !data?.showFooter }) | |||
}); | |||
//设置标题 | |||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
//表单提交事件 | |||
async function handleSubmit(v) { | |||
try { | |||
let values = await validate(); | |||
setModalProps({confirmLoading: true}); | |||
//提交表单 | |||
await saveOrUpdate(values, isUpdate.value); | |||
//关闭弹窗 | |||
closeModal(); | |||
//刷新列表 | |||
emit('success'); | |||
} finally { | |||
setModalProps({confirmLoading: false}); | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
</style> |