| @ -0,0 +1,171 @@ | |||||
| package org.jeecg.modules.travelAddress.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.travelAddress.entity.TravelAddress; | |||||
| import org.jeecg.modules.travelAddress.service.ITravelAddressService; | |||||
| 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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Api(tags="地址表") | |||||
| @RestController | |||||
| @RequestMapping("/travelAddress/travelAddress") | |||||
| @Slf4j | |||||
| public class TravelAddressController extends JeecgController<TravelAddress, ITravelAddressService> { | |||||
| @Autowired | |||||
| private ITravelAddressService travelAddressService; | |||||
| /** | |||||
| * 分页列表查询 | |||||
| * | |||||
| * @param travelAddress | |||||
| * @param pageNo | |||||
| * @param pageSize | |||||
| * @param req | |||||
| * @return | |||||
| */ | |||||
| //@AutoLog(value = "地址表-分页列表查询") | |||||
| @ApiOperation(value="地址表-分页列表查询", notes="地址表-分页列表查询") | |||||
| @GetMapping(value = "/list") | |||||
| public Result<IPage<TravelAddress>> queryPageList(TravelAddress travelAddress, | |||||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||||
| HttpServletRequest req) { | |||||
| QueryWrapper<TravelAddress> queryWrapper = QueryGenerator.initQueryWrapper(travelAddress, req.getParameterMap()); | |||||
| Page<TravelAddress> page = new Page<TravelAddress>(pageNo, pageSize); | |||||
| IPage<TravelAddress> pageList = travelAddressService.page(page, queryWrapper); | |||||
| return Result.OK(pageList); | |||||
| } | |||||
| /** | |||||
| * 添加 | |||||
| * | |||||
| * @param travelAddress | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "地址表-添加") | |||||
| @ApiOperation(value="地址表-添加", notes="地址表-添加") | |||||
| @PostMapping(value = "/add") | |||||
| public Result<String> add(@RequestBody TravelAddress travelAddress) { | |||||
| travelAddressService.save(travelAddress); | |||||
| return Result.OK("添加成功!"); | |||||
| } | |||||
| /** | |||||
| * 编辑 | |||||
| * | |||||
| * @param travelAddress | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "地址表-编辑") | |||||
| @ApiOperation(value="地址表-编辑", notes="地址表-编辑") | |||||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||||
| public Result<String> edit(@RequestBody TravelAddress travelAddress) { | |||||
| travelAddressService.updateById(travelAddress); | |||||
| 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) { | |||||
| travelAddressService.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.travelAddressService.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<TravelAddress> queryById(@RequestParam(name="id",required=true) String id) { | |||||
| TravelAddress travelAddress = travelAddressService.getById(id); | |||||
| if(travelAddress==null) { | |||||
| return Result.error("未找到对应数据"); | |||||
| } | |||||
| return Result.OK(travelAddress); | |||||
| } | |||||
| /** | |||||
| * 导出excel | |||||
| * | |||||
| * @param request | |||||
| * @param travelAddress | |||||
| */ | |||||
| @RequestMapping(value = "/exportXls") | |||||
| public ModelAndView exportXls(HttpServletRequest request, TravelAddress travelAddress) { | |||||
| return super.exportXls(request, travelAddress, TravelAddress.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, TravelAddress.class); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,59 @@ | |||||
| package org.jeecg.modules.travelAddress.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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Data | |||||
| @TableName("travel_address") | |||||
| @Accessors(chain = true) | |||||
| @EqualsAndHashCode(callSuper = false) | |||||
| @ApiModel(value="travel_address对象", description="地址表") | |||||
| public class TravelAddress implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| /**主键*/ | |||||
| @TableId(type = IdType.ASSIGN_ID) | |||||
| @ApiModelProperty(value = "主键") | |||||
| private java.lang.String id; | |||||
| /**联系人姓名*/ | |||||
| @Excel(name = "联系人姓名", width = 15) | |||||
| @ApiModelProperty(value = "联系人姓名") | |||||
| private java.lang.String userName; | |||||
| /**联系人电话*/ | |||||
| @Excel(name = "联系人电话", width = 15) | |||||
| @ApiModelProperty(value = "联系人电话") | |||||
| private java.lang.String userPhone; | |||||
| /**所属区域*/ | |||||
| @Excel(name = "所属区域", width = 15) | |||||
| @ApiModelProperty(value = "所属区域") | |||||
| private java.lang.String area; | |||||
| /**详细地址*/ | |||||
| @Excel(name = "详细地址", width = 15) | |||||
| @ApiModelProperty(value = "详细地址") | |||||
| private java.lang.String address; | |||||
| /**所属用户*/ | |||||
| @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 memberId; | |||||
| } | |||||
| @ -0,0 +1,17 @@ | |||||
| package org.jeecg.modules.travelAddress.mapper; | |||||
| import java.util.List; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.jeecg.modules.travelAddress.entity.TravelAddress; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| /** | |||||
| * @Description: 地址表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface TravelAddressMapper extends BaseMapper<TravelAddress> { | |||||
| } | |||||
| @ -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.travelAddress.mapper.TravelAddressMapper"> | |||||
| </mapper> | |||||
| @ -0,0 +1,14 @@ | |||||
| package org.jeecg.modules.travelAddress.service; | |||||
| import org.jeecg.modules.travelAddress.entity.TravelAddress; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| /** | |||||
| * @Description: 地址表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface ITravelAddressService extends IService<TravelAddress> { | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package org.jeecg.modules.travelAddress.service.impl; | |||||
| import org.jeecg.modules.travelAddress.entity.TravelAddress; | |||||
| import org.jeecg.modules.travelAddress.mapper.TravelAddressMapper; | |||||
| import org.jeecg.modules.travelAddress.service.ITravelAddressService; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| /** | |||||
| * @Description: 地址表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Service | |||||
| public class TravelAddressServiceImpl extends ServiceImpl<TravelAddressMapper, TravelAddress> implements ITravelAddressService { | |||||
| } | |||||
| @ -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> | |||||
| <travel-address-modal ref="modalForm" @ok="modalFormOk"></travel-address-modal> | |||||
| </a-card> | |||||
| </template> | |||||
| <script> | |||||
| import '@/assets/less/TableExpand.less' | |||||
| import { mixinDevice } from '@/utils/mixin' | |||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||||
| import TravelAddressModal from './modules/TravelAddressModal' | |||||
| import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |||||
| export default { | |||||
| name: 'TravelAddressList', | |||||
| mixins:[JeecgListMixin, mixinDevice], | |||||
| components: { | |||||
| TravelAddressModal | |||||
| }, | |||||
| 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: 'userName' | |||||
| }, | |||||
| { | |||||
| title:'联系人电话', | |||||
| align:"center", | |||||
| dataIndex: 'userPhone' | |||||
| }, | |||||
| { | |||||
| title:'所属区域', | |||||
| align:"center", | |||||
| dataIndex: 'area' | |||||
| }, | |||||
| { | |||||
| title:'详细地址', | |||||
| align:"center", | |||||
| dataIndex: 'address' | |||||
| }, | |||||
| { | |||||
| title:'所属用户', | |||||
| align:"center", | |||||
| dataIndex: 'memberId_dictText' | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| dataIndex: 'action', | |||||
| align:"center", | |||||
| fixed:"right", | |||||
| width:147, | |||||
| scopedSlots: { customRender: 'action' } | |||||
| } | |||||
| ], | |||||
| url: { | |||||
| list: "/travelAddress/travelAddress/list", | |||||
| delete: "/travelAddress/travelAddress/delete", | |||||
| deleteBatch: "/travelAddress/travelAddress/deleteBatch", | |||||
| exportXlsUrl: "/travelAddress/travelAddress/exportXls", | |||||
| importExcelUrl: "travelAddress/travelAddress/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:'userName',text:'联系人姓名',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'userPhone',text:'联系人电话',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'area',text:'所属区域',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'address',text:'详细地址',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'memberId',text:'所属用户',dictCode:"han_hai_member,nick_name,id"}) | |||||
| 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="userName"> | |||||
| <a-input v-model="model.userName" placeholder="请输入联系人姓名" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="联系人电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userPhone"> | |||||
| <a-input v-model="model.userPhone" placeholder="请输入联系人电话" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="所属区域" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="area"> | |||||
| <a-input v-model="model.area" placeholder="请输入所属区域" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="详细地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address"> | |||||
| <a-input v-model="model.address" placeholder="请输入详细地址" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="所属用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="memberId"> | |||||
| <j-dict-select-tag type="list" v-model="model.memberId" dictCode="han_hai_member,nick_name,id" placeholder="请选择所属用户" /> | |||||
| </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: 'TravelAddressForm', | |||||
| 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: "/travelAddress/travelAddress/add", | |||||
| edit: "/travelAddress/travelAddress/edit", | |||||
| queryById: "/travelAddress/travelAddress/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"> | |||||
| <travel-address-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></travel-address-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 TravelAddressForm from './TravelAddressForm' | |||||
| export default { | |||||
| name: 'TravelAddressModal', | |||||
| components: { | |||||
| TravelAddressForm | |||||
| }, | |||||
| 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="关闭"> | |||||
| <travel-address-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></travel-address-form> | |||||
| </j-modal> | |||||
| </template> | |||||
| <script> | |||||
| import TravelAddressForm from './TravelAddressForm' | |||||
| export default { | |||||
| name: 'TravelAddressModal', | |||||
| components: { | |||||
| TravelAddressForm | |||||
| }, | |||||
| 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 = '/travelAddress/travelAddress/list', | |||||
| save='/travelAddress/travelAddress/add', | |||||
| edit='/travelAddress/travelAddress/edit', | |||||
| deleteOne = '/travelAddress/travelAddress/delete', | |||||
| deleteBatch = '/travelAddress/travelAddress/deleteBatch', | |||||
| importExcel = '/travelAddress/travelAddress/importExcel', | |||||
| exportXls = '/travelAddress/travelAddress/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: 'userName' | |||||
| }, | |||||
| { | |||||
| title: '联系人电话', | |||||
| align:"center", | |||||
| dataIndex: 'userPhone' | |||||
| }, | |||||
| { | |||||
| title: '所属区域', | |||||
| align:"center", | |||||
| dataIndex: 'area' | |||||
| }, | |||||
| { | |||||
| title: '详细地址', | |||||
| align:"center", | |||||
| dataIndex: 'address' | |||||
| }, | |||||
| { | |||||
| title: '所属用户', | |||||
| align:"center", | |||||
| dataIndex: 'memberId_dictText' | |||||
| }, | |||||
| ]; | |||||
| //查询数据 | |||||
| export const searchFormSchema: FormSchema[] = [ | |||||
| ]; | |||||
| //表单数据 | |||||
| export const formSchema: FormSchema[] = [ | |||||
| { | |||||
| label: '联系人姓名', | |||||
| field: 'userName', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '联系人电话', | |||||
| field: 'userPhone', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '所属区域', | |||||
| field: 'area', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '详细地址', | |||||
| field: 'address', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '所属用户', | |||||
| field: 'memberId', | |||||
| component: 'JDictSelectTag', | |||||
| componentProps:{ | |||||
| dictCode:"han_hai_member,nick_name,id" | |||||
| }, | |||||
| }, | |||||
| ]; | |||||
| @ -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> | |||||
| <!-- 表单区域 --> | |||||
| <TravelAddressModal @register="registerModal" @success="handleSuccess"></TravelAddressModal> | |||||
| </div> | |||||
| </template> | |||||
| <script lang="ts" name="travelAddress-travelAddress" 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 TravelAddressModal from './components/TravelAddressModal.vue' | |||||
| import {columns, searchFormSchema} from './travelAddress.data'; | |||||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './travelAddress.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 '../travelAddress.data'; | |||||
| import {saveOrUpdate} from '../travelAddress.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.travelAmusement.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.travelAmusement.entity.TravelAmusement; | |||||
| import org.jeecg.modules.travelAmusement.service.ITravelAmusementService; | |||||
| 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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Api(tags="游玩项目表") | |||||
| @RestController | |||||
| @RequestMapping("/travelAmusement/travelAmusement") | |||||
| @Slf4j | |||||
| public class TravelAmusementController extends JeecgController<TravelAmusement, ITravelAmusementService> { | |||||
| @Autowired | |||||
| private ITravelAmusementService travelAmusementService; | |||||
| /** | |||||
| * 分页列表查询 | |||||
| * | |||||
| * @param travelAmusement | |||||
| * @param pageNo | |||||
| * @param pageSize | |||||
| * @param req | |||||
| * @return | |||||
| */ | |||||
| //@AutoLog(value = "游玩项目表-分页列表查询") | |||||
| @ApiOperation(value="游玩项目表-分页列表查询", notes="游玩项目表-分页列表查询") | |||||
| @GetMapping(value = "/list") | |||||
| public Result<IPage<TravelAmusement>> queryPageList(TravelAmusement travelAmusement, | |||||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||||
| HttpServletRequest req) { | |||||
| QueryWrapper<TravelAmusement> queryWrapper = QueryGenerator.initQueryWrapper(travelAmusement, req.getParameterMap()); | |||||
| Page<TravelAmusement> page = new Page<TravelAmusement>(pageNo, pageSize); | |||||
| IPage<TravelAmusement> pageList = travelAmusementService.page(page, queryWrapper); | |||||
| return Result.OK(pageList); | |||||
| } | |||||
| /** | |||||
| * 添加 | |||||
| * | |||||
| * @param travelAmusement | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "游玩项目表-添加") | |||||
| @ApiOperation(value="游玩项目表-添加", notes="游玩项目表-添加") | |||||
| @PostMapping(value = "/add") | |||||
| public Result<String> add(@RequestBody TravelAmusement travelAmusement) { | |||||
| travelAmusementService.save(travelAmusement); | |||||
| return Result.OK("添加成功!"); | |||||
| } | |||||
| /** | |||||
| * 编辑 | |||||
| * | |||||
| * @param travelAmusement | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "游玩项目表-编辑") | |||||
| @ApiOperation(value="游玩项目表-编辑", notes="游玩项目表-编辑") | |||||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||||
| public Result<String> edit(@RequestBody TravelAmusement travelAmusement) { | |||||
| travelAmusementService.updateById(travelAmusement); | |||||
| 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) { | |||||
| travelAmusementService.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.travelAmusementService.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<TravelAmusement> queryById(@RequestParam(name="id",required=true) String id) { | |||||
| TravelAmusement travelAmusement = travelAmusementService.getById(id); | |||||
| if(travelAmusement==null) { | |||||
| return Result.error("未找到对应数据"); | |||||
| } | |||||
| return Result.OK(travelAmusement); | |||||
| } | |||||
| /** | |||||
| * 导出excel | |||||
| * | |||||
| * @param request | |||||
| * @param travelAmusement | |||||
| */ | |||||
| @RequestMapping(value = "/exportXls") | |||||
| public ModelAndView exportXls(HttpServletRequest request, TravelAmusement travelAmusement) { | |||||
| return super.exportXls(request, travelAmusement, TravelAmusement.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, TravelAmusement.class); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,78 @@ | |||||
| package org.jeecg.modules.travelAmusement.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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Data | |||||
| @TableName("travel_amusement") | |||||
| @Accessors(chain = true) | |||||
| @EqualsAndHashCode(callSuper = false) | |||||
| @ApiModel(value="travel_amusement对象", description="游玩项目表") | |||||
| public class TravelAmusement implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| /**主键*/ | |||||
| @TableId(type = IdType.ASSIGN_ID) | |||||
| @ApiModelProperty(value = "主键") | |||||
| private java.lang.String id; | |||||
| /**项目标题*/ | |||||
| @Excel(name = "项目标题", width = 15) | |||||
| @ApiModelProperty(value = "项目标题") | |||||
| private java.lang.String amusementTitle; | |||||
| /**项目副标题*/ | |||||
| @Excel(name = "项目副标题", width = 15) | |||||
| @ApiModelProperty(value = "项目副标题") | |||||
| private java.lang.String amusementShortTitle; | |||||
| /**项目图片*/ | |||||
| @Excel(name = "项目图片", width = 15) | |||||
| @ApiModelProperty(value = "项目图片") | |||||
| private java.lang.String amusementImage; | |||||
| /**项目价格*/ | |||||
| @Excel(name = "项目价格", width = 15) | |||||
| @ApiModelProperty(value = "项目价格") | |||||
| private java.math.BigDecimal amusementPrice; | |||||
| /**项目介绍*/ | |||||
| @Excel(name = "项目介绍", width = 15) | |||||
| @ApiModelProperty(value = "项目介绍") | |||||
| private java.lang.String amusementBrief; | |||||
| /**关于行程*/ | |||||
| @Excel(name = "关于行程", width = 15) | |||||
| @ApiModelProperty(value = "关于行程") | |||||
| private java.lang.String amusementRoute; | |||||
| /**注意事项*/ | |||||
| @Excel(name = "注意事项", width = 15) | |||||
| @ApiModelProperty(value = "注意事项") | |||||
| private java.lang.String amusementAttention; | |||||
| /**出行说明*/ | |||||
| @Excel(name = "出行说明", width = 15) | |||||
| @ApiModelProperty(value = "出行说明") | |||||
| private java.lang.String amusementStatement; | |||||
| /**是否付费项目(0-否 1-是)*/ | |||||
| @Excel(name = "是否付费项目(0-否 1-是)", width = 15) | |||||
| @ApiModelProperty(value = "是否付费项目(0-否 1-是)") | |||||
| private java.lang.String isPay; | |||||
| /**项目类型(0-遗产路径 1-我要研学)*/ | |||||
| @Excel(name = "项目类型(0-遗产路径 1-我要研学)", width = 15) | |||||
| @ApiModelProperty(value = "项目类型(0-遗产路径 1-我要研学)") | |||||
| private java.lang.String amusementType; | |||||
| } | |||||
| @ -0,0 +1,17 @@ | |||||
| package org.jeecg.modules.travelAmusement.mapper; | |||||
| import java.util.List; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.jeecg.modules.travelAmusement.entity.TravelAmusement; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| /** | |||||
| * @Description: 游玩项目表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface TravelAmusementMapper extends BaseMapper<TravelAmusement> { | |||||
| } | |||||
| @ -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.travelAmusement.mapper.TravelAmusementMapper"> | |||||
| </mapper> | |||||
| @ -0,0 +1,14 @@ | |||||
| package org.jeecg.modules.travelAmusement.service; | |||||
| import org.jeecg.modules.travelAmusement.entity.TravelAmusement; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| /** | |||||
| * @Description: 游玩项目表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface ITravelAmusementService extends IService<TravelAmusement> { | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package org.jeecg.modules.travelAmusement.service.impl; | |||||
| import org.jeecg.modules.travelAmusement.entity.TravelAmusement; | |||||
| import org.jeecg.modules.travelAmusement.mapper.TravelAmusementMapper; | |||||
| import org.jeecg.modules.travelAmusement.service.ITravelAmusementService; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| /** | |||||
| * @Description: 游玩项目表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Service | |||||
| public class TravelAmusementServiceImpl extends ServiceImpl<TravelAmusementMapper, TravelAmusement> implements ITravelAmusementService { | |||||
| } | |||||
| @ -0,0 +1,229 @@ | |||||
| <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> | |||||
| <travel-amusement-modal ref="modalForm" @ok="modalFormOk"></travel-amusement-modal> | |||||
| </a-card> | |||||
| </template> | |||||
| <script> | |||||
| import '@/assets/less/TableExpand.less' | |||||
| import { mixinDevice } from '@/utils/mixin' | |||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||||
| import TravelAmusementModal from './modules/TravelAmusementModal' | |||||
| export default { | |||||
| name: 'TravelAmusementList', | |||||
| mixins:[JeecgListMixin, mixinDevice], | |||||
| components: { | |||||
| TravelAmusementModal | |||||
| }, | |||||
| 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: 'amusementTitle' | |||||
| }, | |||||
| { | |||||
| title:'项目副标题', | |||||
| align:"center", | |||||
| dataIndex: 'amusementShortTitle' | |||||
| }, | |||||
| { | |||||
| title:'项目图片', | |||||
| align:"center", | |||||
| dataIndex: 'amusementImage', | |||||
| scopedSlots: {customRender: 'imgSlot'} | |||||
| }, | |||||
| { | |||||
| title:'项目价格', | |||||
| align:"center", | |||||
| dataIndex: 'amusementPrice' | |||||
| }, | |||||
| { | |||||
| title:'项目介绍', | |||||
| align:"center", | |||||
| dataIndex: 'amusementBrief' | |||||
| }, | |||||
| { | |||||
| title:'关于行程', | |||||
| align:"center", | |||||
| dataIndex: 'amusementRoute', | |||||
| scopedSlots: {customRender: 'htmlSlot'} | |||||
| }, | |||||
| { | |||||
| title:'注意事项', | |||||
| align:"center", | |||||
| dataIndex: 'amusementAttention', | |||||
| scopedSlots: {customRender: 'htmlSlot'} | |||||
| }, | |||||
| { | |||||
| title:'出行说明', | |||||
| align:"center", | |||||
| dataIndex: 'amusementStatement', | |||||
| scopedSlots: {customRender: 'htmlSlot'} | |||||
| }, | |||||
| { | |||||
| title:'是否付费项目(0-否 1-是)', | |||||
| align:"center", | |||||
| dataIndex: 'isPay' | |||||
| }, | |||||
| { | |||||
| title:'项目类型(0-遗产路径 1-我要研学)', | |||||
| align:"center", | |||||
| dataIndex: 'amusementType' | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| dataIndex: 'action', | |||||
| align:"center", | |||||
| fixed:"right", | |||||
| width:147, | |||||
| scopedSlots: { customRender: 'action' } | |||||
| } | |||||
| ], | |||||
| url: { | |||||
| list: "/travelAmusement/travelAmusement/list", | |||||
| delete: "/travelAmusement/travelAmusement/delete", | |||||
| deleteBatch: "/travelAmusement/travelAmusement/deleteBatch", | |||||
| exportXlsUrl: "/travelAmusement/travelAmusement/exportXls", | |||||
| importExcelUrl: "travelAmusement/travelAmusement/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:'amusementTitle',text:'项目标题',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementShortTitle',text:'项目副标题',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementImage',text:'项目图片',dictCode:''}) | |||||
| fieldList.push({type:'BigDecimal',value:'amusementPrice',text:'项目价格',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementBrief',text:'项目介绍',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementRoute',text:'关于行程',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementAttention',text:'注意事项',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementStatement',text:'出行说明',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'isPay',text:'是否付费项目(0-否 1-是)',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'amusementType',text:'项目类型(0-遗产路径 1-我要研学)',dictCode:''}) | |||||
| this.superFieldList = fieldList | |||||
| } | |||||
| } | |||||
| } | |||||
| </script> | |||||
| <style scoped> | |||||
| @import '~@assets/less/common.less'; | |||||
| </style> | |||||
| @ -0,0 +1,149 @@ | |||||
| <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="amusementTitle"> | |||||
| <a-input v-model="model.amusementTitle" placeholder="请输入项目标题" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="项目副标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementShortTitle"> | |||||
| <a-input v-model="model.amusementShortTitle" placeholder="请输入项目副标题" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="项目图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementImage"> | |||||
| <j-image-upload isMultiple v-model="model.amusementImage" ></j-image-upload> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="项目价格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementPrice"> | |||||
| <a-input-number v-model="model.amusementPrice" placeholder="请输入项目价格" style="width: 100%" /> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="项目介绍" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementBrief"> | |||||
| <a-input v-model="model.amusementBrief" placeholder="请输入项目介绍" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="关于行程" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementRoute"> | |||||
| <j-editor v-model="model.amusementRoute" /> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="注意事项" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementAttention"> | |||||
| <j-editor v-model="model.amusementAttention" /> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="出行说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementStatement"> | |||||
| <j-editor v-model="model.amusementStatement" /> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="是否付费项目(0-否 1-是)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isPay"> | |||||
| <a-input v-model="model.isPay" placeholder="请输入是否付费项目(0-否 1-是)" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="项目类型(0-遗产路径 1-我要研学)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amusementType"> | |||||
| <a-input v-model="model.amusementType" placeholder="请输入项目类型(0-遗产路径 1-我要研学)" ></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: 'TravelAmusementForm', | |||||
| 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: "/travelAmusement/travelAmusement/add", | |||||
| edit: "/travelAmusement/travelAmusement/edit", | |||||
| queryById: "/travelAmusement/travelAmusement/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"> | |||||
| <travel-amusement-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></travel-amusement-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 TravelAmusementForm from './TravelAmusementForm' | |||||
| export default { | |||||
| name: 'TravelAmusementModal', | |||||
| components: { | |||||
| TravelAmusementForm | |||||
| }, | |||||
| 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="关闭"> | |||||
| <travel-amusement-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></travel-amusement-form> | |||||
| </j-modal> | |||||
| </template> | |||||
| <script> | |||||
| import TravelAmusementForm from './TravelAmusementForm' | |||||
| export default { | |||||
| name: 'TravelAmusementModal', | |||||
| components: { | |||||
| TravelAmusementForm | |||||
| }, | |||||
| 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 = '/travelAmusement/travelAmusement/list', | |||||
| save='/travelAmusement/travelAmusement/add', | |||||
| edit='/travelAmusement/travelAmusement/edit', | |||||
| deleteOne = '/travelAmusement/travelAmusement/delete', | |||||
| deleteBatch = '/travelAmusement/travelAmusement/deleteBatch', | |||||
| importExcel = '/travelAmusement/travelAmusement/importExcel', | |||||
| exportXls = '/travelAmusement/travelAmusement/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,119 @@ | |||||
| 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: 'amusementTitle' | |||||
| }, | |||||
| { | |||||
| title: '项目副标题', | |||||
| align:"center", | |||||
| dataIndex: 'amusementShortTitle' | |||||
| }, | |||||
| { | |||||
| title: '项目图片', | |||||
| align:"center", | |||||
| dataIndex: 'amusementImage', | |||||
| customRender:render.renderAvatar, | |||||
| }, | |||||
| { | |||||
| title: '项目价格', | |||||
| align:"center", | |||||
| dataIndex: 'amusementPrice' | |||||
| }, | |||||
| { | |||||
| title: '项目介绍', | |||||
| align:"center", | |||||
| dataIndex: 'amusementBrief' | |||||
| }, | |||||
| { | |||||
| title: '关于行程', | |||||
| align:"center", | |||||
| dataIndex: 'amusementRoute', | |||||
| slots: { customRender: 'htmlSlot' }, | |||||
| }, | |||||
| { | |||||
| title: '注意事项', | |||||
| align:"center", | |||||
| dataIndex: 'amusementAttention', | |||||
| slots: { customRender: 'htmlSlot' }, | |||||
| }, | |||||
| { | |||||
| title: '出行说明', | |||||
| align:"center", | |||||
| dataIndex: 'amusementStatement', | |||||
| slots: { customRender: 'htmlSlot' }, | |||||
| }, | |||||
| { | |||||
| title: '是否付费项目(0-否 1-是)', | |||||
| align:"center", | |||||
| dataIndex: 'isPay' | |||||
| }, | |||||
| { | |||||
| title: '项目类型(0-遗产路径 1-我要研学)', | |||||
| align:"center", | |||||
| dataIndex: 'amusementType' | |||||
| }, | |||||
| ]; | |||||
| //查询数据 | |||||
| export const searchFormSchema: FormSchema[] = [ | |||||
| ]; | |||||
| //表单数据 | |||||
| export const formSchema: FormSchema[] = [ | |||||
| { | |||||
| label: '项目标题', | |||||
| field: 'amusementTitle', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '项目副标题', | |||||
| field: 'amusementShortTitle', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '项目图片', | |||||
| field: 'amusementImage', | |||||
| component: 'JImageUpload', | |||||
| componentProps:{ | |||||
| }, | |||||
| }, | |||||
| { | |||||
| label: '项目价格', | |||||
| field: 'amusementPrice', | |||||
| component: 'InputNumber', | |||||
| }, | |||||
| { | |||||
| label: '项目介绍', | |||||
| field: 'amusementBrief', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '关于行程', | |||||
| field: 'amusementRoute', | |||||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||||
| }, | |||||
| { | |||||
| label: '注意事项', | |||||
| field: 'amusementAttention', | |||||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||||
| }, | |||||
| { | |||||
| label: '出行说明', | |||||
| field: 'amusementStatement', | |||||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||||
| }, | |||||
| { | |||||
| label: '是否付费项目(0-否 1-是)', | |||||
| field: 'isPay', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '项目类型(0-遗产路径 1-我要研学)', | |||||
| field: 'amusementType', | |||||
| 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> | |||||
| <!-- 表单区域 --> | |||||
| <TravelAmusementModal @register="registerModal" @success="handleSuccess"></TravelAmusementModal> | |||||
| </div> | |||||
| </template> | |||||
| <script lang="ts" name="travelAmusement-travelAmusement" 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 TravelAmusementModal from './components/TravelAmusementModal.vue' | |||||
| import {columns, searchFormSchema} from './travelAmusement.data'; | |||||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './travelAmusement.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 '../travelAmusement.data'; | |||||
| import {saveOrUpdate} from '../travelAmusement.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.travelExperience.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.travelExperience.entity.TravelExperience; | |||||
| import org.jeecg.modules.travelExperience.service.ITravelExperienceService; | |||||
| 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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Api(tags="非遗体验表") | |||||
| @RestController | |||||
| @RequestMapping("/travelExperience/travelExperience") | |||||
| @Slf4j | |||||
| public class TravelExperienceController extends JeecgController<TravelExperience, ITravelExperienceService> { | |||||
| @Autowired | |||||
| private ITravelExperienceService travelExperienceService; | |||||
| /** | |||||
| * 分页列表查询 | |||||
| * | |||||
| * @param travelExperience | |||||
| * @param pageNo | |||||
| * @param pageSize | |||||
| * @param req | |||||
| * @return | |||||
| */ | |||||
| //@AutoLog(value = "非遗体验表-分页列表查询") | |||||
| @ApiOperation(value="非遗体验表-分页列表查询", notes="非遗体验表-分页列表查询") | |||||
| @GetMapping(value = "/list") | |||||
| public Result<IPage<TravelExperience>> queryPageList(TravelExperience travelExperience, | |||||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||||
| HttpServletRequest req) { | |||||
| QueryWrapper<TravelExperience> queryWrapper = QueryGenerator.initQueryWrapper(travelExperience, req.getParameterMap()); | |||||
| Page<TravelExperience> page = new Page<TravelExperience>(pageNo, pageSize); | |||||
| IPage<TravelExperience> pageList = travelExperienceService.page(page, queryWrapper); | |||||
| return Result.OK(pageList); | |||||
| } | |||||
| /** | |||||
| * 添加 | |||||
| * | |||||
| * @param travelExperience | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "非遗体验表-添加") | |||||
| @ApiOperation(value="非遗体验表-添加", notes="非遗体验表-添加") | |||||
| @PostMapping(value = "/add") | |||||
| public Result<String> add(@RequestBody TravelExperience travelExperience) { | |||||
| travelExperienceService.save(travelExperience); | |||||
| return Result.OK("添加成功!"); | |||||
| } | |||||
| /** | |||||
| * 编辑 | |||||
| * | |||||
| * @param travelExperience | |||||
| * @return | |||||
| */ | |||||
| @AutoLog(value = "非遗体验表-编辑") | |||||
| @ApiOperation(value="非遗体验表-编辑", notes="非遗体验表-编辑") | |||||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||||
| public Result<String> edit(@RequestBody TravelExperience travelExperience) { | |||||
| travelExperienceService.updateById(travelExperience); | |||||
| 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) { | |||||
| travelExperienceService.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.travelExperienceService.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<TravelExperience> queryById(@RequestParam(name="id",required=true) String id) { | |||||
| TravelExperience travelExperience = travelExperienceService.getById(id); | |||||
| if(travelExperience==null) { | |||||
| return Result.error("未找到对应数据"); | |||||
| } | |||||
| return Result.OK(travelExperience); | |||||
| } | |||||
| /** | |||||
| * 导出excel | |||||
| * | |||||
| * @param request | |||||
| * @param travelExperience | |||||
| */ | |||||
| @RequestMapping(value = "/exportXls") | |||||
| public ModelAndView exportXls(HttpServletRequest request, TravelExperience travelExperience) { | |||||
| return super.exportXls(request, travelExperience, TravelExperience.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, TravelExperience.class); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,54 @@ | |||||
| package org.jeecg.modules.travelExperience.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-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Data | |||||
| @TableName("travel_experience") | |||||
| @Accessors(chain = true) | |||||
| @EqualsAndHashCode(callSuper = false) | |||||
| @ApiModel(value="travel_experience对象", description="非遗体验表") | |||||
| public class TravelExperience implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| /**主键*/ | |||||
| @TableId(type = IdType.ASSIGN_ID) | |||||
| @ApiModelProperty(value = "主键") | |||||
| private java.lang.String id; | |||||
| /**非遗体验标题*/ | |||||
| @Excel(name = "非遗体验标题", width = 15) | |||||
| @ApiModelProperty(value = "非遗体验标题") | |||||
| private java.lang.String experienceTitle; | |||||
| /**非遗体验封面*/ | |||||
| @Excel(name = "非遗体验封面", width = 15) | |||||
| @ApiModelProperty(value = "非遗体验封面") | |||||
| private java.lang.String experienceImage; | |||||
| /**开放时间*/ | |||||
| @Excel(name = "开放时间", width = 15) | |||||
| @ApiModelProperty(value = "开放时间") | |||||
| private java.lang.String experienceOpentime; | |||||
| /**非遗体验详情*/ | |||||
| @Excel(name = "非遗体验详情", width = 15) | |||||
| @ApiModelProperty(value = "非遗体验详情") | |||||
| private java.lang.String experienceDetail; | |||||
| } | |||||
| @ -0,0 +1,17 @@ | |||||
| package org.jeecg.modules.travelExperience.mapper; | |||||
| import java.util.List; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.jeecg.modules.travelExperience.entity.TravelExperience; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| /** | |||||
| * @Description: 非遗体验表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface TravelExperienceMapper extends BaseMapper<TravelExperience> { | |||||
| } | |||||
| @ -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.travelExperience.mapper.TravelExperienceMapper"> | |||||
| </mapper> | |||||
| @ -0,0 +1,14 @@ | |||||
| package org.jeecg.modules.travelExperience.service; | |||||
| import org.jeecg.modules.travelExperience.entity.TravelExperience; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| /** | |||||
| * @Description: 非遗体验表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| public interface ITravelExperienceService extends IService<TravelExperience> { | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package org.jeecg.modules.travelExperience.service.impl; | |||||
| import org.jeecg.modules.travelExperience.entity.TravelExperience; | |||||
| import org.jeecg.modules.travelExperience.mapper.TravelExperienceMapper; | |||||
| import org.jeecg.modules.travelExperience.service.ITravelExperienceService; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| /** | |||||
| * @Description: 非遗体验表 | |||||
| * @Author: jeecg-boot | |||||
| * @Date: 2024-09-23 | |||||
| * @Version: V1.0 | |||||
| */ | |||||
| @Service | |||||
| public class TravelExperienceServiceImpl extends ServiceImpl<TravelExperienceMapper, TravelExperience> implements ITravelExperienceService { | |||||
| } | |||||
| @ -0,0 +1,191 @@ | |||||
| <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> | |||||
| <travel-experience-modal ref="modalForm" @ok="modalFormOk"></travel-experience-modal> | |||||
| </a-card> | |||||
| </template> | |||||
| <script> | |||||
| import '@/assets/less/TableExpand.less' | |||||
| import { mixinDevice } from '@/utils/mixin' | |||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||||
| import TravelExperienceModal from './modules/TravelExperienceModal' | |||||
| export default { | |||||
| name: 'TravelExperienceList', | |||||
| mixins:[JeecgListMixin, mixinDevice], | |||||
| components: { | |||||
| TravelExperienceModal | |||||
| }, | |||||
| 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: 'experienceTitle' | |||||
| }, | |||||
| { | |||||
| title:'非遗体验封面', | |||||
| align:"center", | |||||
| dataIndex: 'experienceImage', | |||||
| scopedSlots: {customRender: 'imgSlot'} | |||||
| }, | |||||
| { | |||||
| title:'开放时间', | |||||
| align:"center", | |||||
| dataIndex: 'experienceOpentime' | |||||
| }, | |||||
| { | |||||
| title:'非遗体验详情', | |||||
| align:"center", | |||||
| dataIndex: 'experienceDetail', | |||||
| scopedSlots: {customRender: 'htmlSlot'} | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| dataIndex: 'action', | |||||
| align:"center", | |||||
| fixed:"right", | |||||
| width:147, | |||||
| scopedSlots: { customRender: 'action' } | |||||
| } | |||||
| ], | |||||
| url: { | |||||
| list: "/travelExperience/travelExperience/list", | |||||
| delete: "/travelExperience/travelExperience/delete", | |||||
| deleteBatch: "/travelExperience/travelExperience/deleteBatch", | |||||
| exportXlsUrl: "/travelExperience/travelExperience/exportXls", | |||||
| importExcelUrl: "travelExperience/travelExperience/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:'experienceTitle',text:'非遗体验标题',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'experienceImage',text:'非遗体验封面',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'experienceOpentime',text:'开放时间',dictCode:''}) | |||||
| fieldList.push({type:'string',value:'experienceDetail',text:'非遗体验详情',dictCode:''}) | |||||
| this.superFieldList = fieldList | |||||
| } | |||||
| } | |||||
| } | |||||
| </script> | |||||
| <style scoped> | |||||
| @import '~@assets/less/common.less'; | |||||
| </style> | |||||
| @ -0,0 +1,119 @@ | |||||
| <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="experienceTitle"> | |||||
| <a-input v-model="model.experienceTitle" placeholder="请输入非遗体验标题" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="非遗体验封面" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="experienceImage"> | |||||
| <j-image-upload isMultiple v-model="model.experienceImage" ></j-image-upload> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="开放时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="experienceOpentime"> | |||||
| <a-input v-model="model.experienceOpentime" placeholder="请输入开放时间" ></a-input> | |||||
| </a-form-model-item> | |||||
| </a-col> | |||||
| <a-col :span="24"> | |||||
| <a-form-model-item label="非遗体验详情" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="experienceDetail"> | |||||
| <j-editor v-model="model.experienceDetail" /> | |||||
| </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: 'TravelExperienceForm', | |||||
| 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: "/travelExperience/travelExperience/add", | |||||
| edit: "/travelExperience/travelExperience/edit", | |||||
| queryById: "/travelExperience/travelExperience/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"> | |||||
| <travel-experience-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></travel-experience-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 TravelExperienceForm from './TravelExperienceForm' | |||||
| export default { | |||||
| name: 'TravelExperienceModal', | |||||
| components: { | |||||
| TravelExperienceForm | |||||
| }, | |||||
| 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="关闭"> | |||||
| <travel-experience-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></travel-experience-form> | |||||
| </j-modal> | |||||
| </template> | |||||
| <script> | |||||
| import TravelExperienceForm from './TravelExperienceForm' | |||||
| export default { | |||||
| name: 'TravelExperienceModal', | |||||
| components: { | |||||
| TravelExperienceForm | |||||
| }, | |||||
| 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 = '/travelExperience/travelExperience/list', | |||||
| save='/travelExperience/travelExperience/add', | |||||
| edit='/travelExperience/travelExperience/edit', | |||||
| deleteOne = '/travelExperience/travelExperience/delete', | |||||
| deleteBatch = '/travelExperience/travelExperience/deleteBatch', | |||||
| importExcel = '/travelExperience/travelExperience/importExcel', | |||||
| exportXls = '/travelExperience/travelExperience/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,57 @@ | |||||
| 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: 'experienceTitle' | |||||
| }, | |||||
| { | |||||
| title: '非遗体验封面', | |||||
| align:"center", | |||||
| dataIndex: 'experienceImage', | |||||
| customRender:render.renderAvatar, | |||||
| }, | |||||
| { | |||||
| title: '开放时间', | |||||
| align:"center", | |||||
| dataIndex: 'experienceOpentime' | |||||
| }, | |||||
| { | |||||
| title: '非遗体验详情', | |||||
| align:"center", | |||||
| dataIndex: 'experienceDetail', | |||||
| slots: { customRender: 'htmlSlot' }, | |||||
| }, | |||||
| ]; | |||||
| //查询数据 | |||||
| export const searchFormSchema: FormSchema[] = [ | |||||
| ]; | |||||
| //表单数据 | |||||
| export const formSchema: FormSchema[] = [ | |||||
| { | |||||
| label: '非遗体验标题', | |||||
| field: 'experienceTitle', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '非遗体验封面', | |||||
| field: 'experienceImage', | |||||
| component: 'JImageUpload', | |||||
| componentProps:{ | |||||
| }, | |||||
| }, | |||||
| { | |||||
| label: '开放时间', | |||||
| field: 'experienceOpentime', | |||||
| component: 'Input', | |||||
| }, | |||||
| { | |||||
| label: '非遗体验详情', | |||||
| field: 'experienceDetail', | |||||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||||
| }, | |||||
| ]; | |||||
| @ -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> | |||||
| <!-- 表单区域 --> | |||||
| <TravelExperienceModal @register="registerModal" @success="handleSuccess"></TravelExperienceModal> | |||||
| </div> | |||||
| </template> | |||||
| <script lang="ts" name="travelExperience-travelExperience" 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 TravelExperienceModal from './components/TravelExperienceModal.vue' | |||||
| import {columns, searchFormSchema} from './travelExperience.data'; | |||||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './travelExperience.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 '../travelExperience.data'; | |||||
| import {saveOrUpdate} from '../travelExperience.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> | |||||