Merge branch 'wcd-2411-update' into wcd
10 files added
1 files modified
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="contract_mail") |
| | | public class ContractMail extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`contract_id`") |
| | | @ApiModelProperty(value = "合同ID") |
| | | private Long contractId; |
| | | |
| | | @Column(name = "`mail_send_time`") |
| | | @ApiModelProperty(value = "邮件发送时间") |
| | | private Timestamp mailSendTime; |
| | | |
| | | @Column(name = "`mail_tracking_no`") |
| | | @ApiModelProperty(value = "邮件运单号") |
| | | private String mailTrackingNo; |
| | | |
| | | @Column(name = "`mail_method`") |
| | | @ApiModelProperty(value = "邮寄方式") |
| | | private String mailMethod; |
| | | |
| | | @Column(name = "`mail_content`") |
| | | @ApiModelProperty(value = "邮件内容") |
| | | private String mailContent; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注信息") |
| | | private String remarks; |
| | | |
| | | public void copy(ContractMail source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.repository; |
| | | |
| | | import me.zhengjie.modules.contract.domain.ContractMail; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | public interface ContractMailRepository extends JpaRepository<ContractMail, Long>, JpaSpecificationExecutor<ContractMail> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.contract.domain.ContractMail; |
| | | import me.zhengjie.modules.contract.service.ContractMailService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同邮寄管理") |
| | | @RequestMapping("/api/contractMail") |
| | | public class ContractMailController { |
| | | |
| | | private final ContractMailService contractMailService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('contractMail:list')") |
| | | public void exportContractMail(HttpServletResponse response, ContractMailQueryCriteria criteria) throws IOException { |
| | | contractMailService.download(contractMailService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同邮寄") |
| | | @ApiOperation("查询合同邮寄") |
| | | @PreAuthorize("@el.check('contractMail:list')") |
| | | public ResponseEntity<Object> queryContractMail(ContractMailQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(contractMailService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同邮寄") |
| | | @ApiOperation("新增合同邮寄") |
| | | @PreAuthorize("@el.check('contractMail:add')") |
| | | public ResponseEntity<Object> createContractMail(@Validated @RequestBody ContractMail resources){ |
| | | return new ResponseEntity<>(contractMailService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同邮寄") |
| | | @ApiOperation("修改合同邮寄") |
| | | @PreAuthorize("@el.check('contractMail:edit')") |
| | | public ResponseEntity<Object> updateContractMail(@Validated @RequestBody ContractMail resources){ |
| | | contractMailService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同邮寄") |
| | | @ApiOperation("删除合同邮寄") |
| | | @PreAuthorize("@el.check('contractMail:del')") |
| | | public ResponseEntity<Object> deleteContractMail(@RequestBody Long[] ids) { |
| | | contractMailService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.service; |
| | | |
| | | import me.zhengjie.modules.contract.domain.ContractMail; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | public interface ContractMailService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ContractMailQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ContractMailDto> |
| | | */ |
| | | List<ContractMailDto> queryAll(ContractMailQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ContractMailDto |
| | | */ |
| | | ContractMailDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ContractMailDto |
| | | */ |
| | | ContractMailDto create(ContractMail resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ContractMail resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ContractMailDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @Data |
| | | public class ContractMailDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 合同ID */ |
| | | private Long contractId; |
| | | |
| | | /** 邮件发送时间 */ |
| | | private Timestamp mailSendTime; |
| | | |
| | | /** 邮件运单号 */ |
| | | private String mailTrackingNo; |
| | | |
| | | /** 邮寄方式 */ |
| | | private String mailMethod; |
| | | |
| | | /** 邮件内容 */ |
| | | private String mailContent; |
| | | |
| | | /** 备注信息 */ |
| | | private String remarks; |
| | | |
| | | /** 合同名称 */ |
| | | private String contractName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @Data |
| | | public class ContractMailQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long contractId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String mailMethod; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String mailTrackingNo; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.service.impl; |
| | | |
| | | import me.zhengjie.modules.contract.domain.Contract; |
| | | import me.zhengjie.modules.contract.domain.ContractMail; |
| | | import me.zhengjie.modules.contract.repository.ContractRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.contract.repository.ContractMailRepository; |
| | | import me.zhengjie.modules.contract.service.ContractMailService; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailDto; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailQueryCriteria; |
| | | import me.zhengjie.modules.contract.service.mapstruct.ContractMailMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractMailServiceImpl implements ContractMailService { |
| | | |
| | | private final ContractMailRepository contractMailRepository; |
| | | private final ContractRepository contractRepository; |
| | | private final ContractMailMapper contractMailMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ContractMailQueryCriteria criteria, Pageable pageable){ |
| | | Page<ContractMail> page = contractMailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | Function<ContractMail, ContractMailDto> func = new Function<ContractMail, ContractMailDto>(){ |
| | | @Override |
| | | public ContractMailDto apply(ContractMail t) { |
| | | // 将实体类转换成DTO |
| | | ContractMailDto contractMailDto = contractMailMapper.toDto(t); |
| | | // 查询合同数据 |
| | | Contract contract = contractRepository.findById(t.getContractId()).orElseGet(Contract::new); |
| | | // DTO赋值 |
| | | contractMailDto.setContractName(contract.getContractName()); |
| | | // 返回处理好的DTO |
| | | return contractMailDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ContractMailDto> queryAll(ContractMailQueryCriteria criteria){ |
| | | return contractMailMapper.toDto(contractMailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ContractMailDto findById(Long id) { |
| | | ContractMail contractMail = contractMailRepository.findById(id).orElseGet(ContractMail::new); |
| | | ValidationUtil.isNull(contractMail.getId(),"ContractMail","id",id); |
| | | return contractMailMapper.toDto(contractMail); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ContractMailDto create(ContractMail resources) { |
| | | return contractMailMapper.toDto(contractMailRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ContractMail resources) { |
| | | ContractMail contractMail = contractMailRepository.findById(resources.getId()).orElseGet(ContractMail::new); |
| | | ValidationUtil.isNull( contractMail.getId(),"ContractMail","id",resources.getId()); |
| | | contractMail.copy(resources); |
| | | contractMailRepository.save(contractMail); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | contractMailRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ContractMailDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ContractMailDto contractMail : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("合同ID", contractMail.getContractId()); |
| | | map.put("邮件发送时间", contractMail.getMailSendTime()); |
| | | map.put("邮件运单号", contractMail.getMailTrackingNo()); |
| | | map.put("邮寄方式", contractMail.getMailMethod()); |
| | | map.put("邮件内容", contractMail.getMailContent()); |
| | | map.put("备注信息", contractMail.getRemarks()); |
| | | map.put("创建者", contractMail.getCreateBy()); |
| | | map.put("更新者", contractMail.getUpdateBy()); |
| | | map.put("创建日期", contractMail.getCreateTime()); |
| | | map.put("更新时间", contractMail.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.contract.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.contract.domain.ContractMail; |
| | | import me.zhengjie.modules.contract.service.dto.ContractMailDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2026-02-26 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ContractMailMapper extends BaseMapper<ContractMailDto, ContractMail> { |
| | | |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/contractMail', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/contractMail/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/contractMail', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | |
| | | // 报销费用类型 |
| | | export const REIMBURSE_EXPENSE_TYPE = 'reimburse_expense_type' |
| | | |
| | | // 邮寄类型 |
| | | export const MAIL_METHOD = 'mail_method' |
| | | |
| | | export default { |
| | | ROLE_LEVEL_SUPER, |
| | | ROLE_LEVEL_GENERAL, |
| | |
| | | REIMBURSE_APPROVE_STATUS_AGREE, |
| | | REIMBURSE_APPROVE_STATUS_REFUSE, |
| | | REIMBURSE_TYPE, |
| | | REIMBURSE_EXPENSE_TYPE |
| | | REIMBURSE_EXPENSE_TYPE, |
| | | MAIL_METHOD |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.mailTrackingNo" clearable placeholder="运单号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.contractId" filterable clearable placeholder="所属合同" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in contractList" |
| | | :key="'query_contract_' + item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.mailMethod" filterable clearable placeholder="邮寄方式" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[mailMethod]" |
| | | :key="'query_mail_method_' + item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="540px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px"> |
| | | <el-form-item label="所属合同" prop="contractId"> |
| | | <el-select v-model="form.contractId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in contractList" |
| | | :key="'form_contract_' + item.contractId" |
| | | :label="item.contractNumber + ' - ' + item.contractName" |
| | | :value="item.contractId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="邮件发送时间" prop="mailSendTime"> |
| | | <el-date-picker v-model="form.mailSendTime" type="date" placeholder="请选择" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="邮件运单号" prop="mailTrackingNo"> |
| | | <el-input v-model="form.mailTrackingNo" placeholder="请输入" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="邮寄方式" prop="mailMethod"> |
| | | <el-select v-model="form.mailMethod" filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[mailMethod]" |
| | | :key="'form_mail_method_' + item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="邮件内容" prop="mailContent"> |
| | | <el-input v-model="form.mailContent" type="textarea" :rows="3" placeholder="请输入" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" type="textarea" :rows="3" placeholder="请输入" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="contractName" label="所属合同" :show-overflow-tooltip="true" /> |
| | | <el-table-column prop="mailSendTime" label="邮件发送时间"> |
| | | <template slot-scope="scope"> |
| | | {{ parseTime(scope.row.mailSendTime, '{y}年{m}月{d}日') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="mailTrackingNo" label="邮件运单号" /> |
| | | <el-table-column prop="mailMethod" label="邮寄方式" /> |
| | | <el-table-column prop="mailContent" label="邮件内容" :show-overflow-tooltip="true" /> |
| | | <el-table-column prop="remarks" label="备注" :show-overflow-tooltip="true" /> |
| | | <el-table-column v-if="checkPer(['admin','contractMail:edit','contractMail:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudContractMail from '@/api/contract/contractMail' |
| | | import crudContract from '@/api/contract/contract' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, contractId: null, mailSendTime: null, mailTrackingNo: null, mailMethod: null, mailContent: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null, contractName: null } |
| | | export default { |
| | | name: 'ContractMail', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.MAIL_METHOD], |
| | | cruds() { |
| | | return CRUD({ title: '合同邮寄', url: 'api/contractMail', idField: 'id', sort: 'id,desc', crudMethod: { ...crudContractMail }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'contractMail:add'], |
| | | edit: ['admin', 'contractMail:edit'], |
| | | del: ['admin', 'contractMail:del'], |
| | | download: ['admin', 'contractMail:download'] |
| | | }, |
| | | rules: { |
| | | contractId: [ |
| | | { required: true, message: '请选择所属合同', trigger: 'change' } |
| | | ], |
| | | mailSendTime: [ |
| | | { required: true, message: '请输入邮件发送时间', trigger: 'change' } |
| | | ], |
| | | mailTrackingNo: [ |
| | | { required: true, message: '请输入邮件运单号', trigger: 'blur' } |
| | | ], |
| | | mailMethod: [ |
| | | { required: true, message: '请选择邮寄方式', trigger: 'change' } |
| | | ], |
| | | mailContent: [ |
| | | { required: true, message: '请输入邮件内容', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 合同数据 |
| | | contractList: [], |
| | | // 字典:邮寄类型 |
| | | mailMethod: constant.MAIL_METHOD |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | const that = this |
| | | // 获取合同数据 |
| | | that.getContractList() |
| | | return true |
| | | }, |
| | | |
| | | // 获取合同数据 |
| | | getContractList() { |
| | | const that = this |
| | | // 获取合同数据 |
| | | crudContract.getAll().then(res => { |
| | | // 获取合同数据 |
| | | that.contractList = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |