24282 преди 11 месеца
родител
ревизия
5125466e66
променени са 21 файла, в които са добавени 508 реда и са изтрити 53 реда
  1. 9 0
      jy-business/src/main/java/com/jy/business/payment/controller/PaymentRequestsController.java
  2. 20 0
      jy-business/src/main/java/com/jy/business/payment/dao/PaymentRemitDao.java
  3. 16 0
      jy-business/src/main/java/com/jy/business/payment/mapper/PaymentRemitMapper.java
  4. 5 0
      jy-business/src/main/java/com/jy/business/payment/mapper/xml/PaymentRemitMapper.xml
  5. 17 0
      jy-business/src/main/java/com/jy/business/payment/model/dto/PaymentRemitDto.java
  6. 17 0
      jy-business/src/main/java/com/jy/business/payment/model/dto/PaymentRemitSelectDto.java
  7. 87 0
      jy-business/src/main/java/com/jy/business/payment/model/entity/PaymentRemit.java
  8. 5 0
      jy-business/src/main/java/com/jy/business/payment/model/entity/PaymentRequests.java
  9. 84 0
      jy-business/src/main/java/com/jy/business/payment/model/table/PaymentRemitTable.java
  10. 5 0
      jy-business/src/main/java/com/jy/business/payment/model/table/PaymentRequestsTable.java
  11. 17 0
      jy-business/src/main/java/com/jy/business/payment/model/vo/PaymentRemitVo.java
  12. 15 0
      jy-business/src/main/java/com/jy/business/payment/service/PaymentRemitService.java
  13. 6 0
      jy-business/src/main/java/com/jy/business/payment/service/PaymentRequestsService.java
  14. 22 0
      jy-business/src/main/java/com/jy/business/payment/service/impl/PaymentRemitServiceImpl.java
  15. 47 0
      jy-business/src/main/java/com/jy/business/payment/service/impl/PaymentRequestsServiceImpl.java
  16. 9 0
      jy-framework/src/main/java/com/jy/framework/utils/AssertUtil.java
  17. 5 0
      jy-ui/src/api/business/payment/requests.ts
  18. 10 0
      jy-ui/src/components/AForm/index.vue
  19. 14 0
      jy-ui/src/components/AForm/type.ts
  20. 95 47
      jy-ui/src/views/business/payment/remit/index.vue
  21. 3 6
      jy-ui/src/views/business/payment/requests/index.vue

+ 9 - 0
jy-business/src/main/java/com/jy/business/payment/controller/PaymentRequestsController.java

@@ -3,6 +3,7 @@ package com.jy.business.payment.controller;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jy.business.payment.model.dto.PaymentRequestsDto;
 import com.jy.business.payment.model.dto.PaymentRequestsSelectDto;
+import com.jy.business.payment.model.entity.PaymentRemit;
 import com.jy.business.payment.model.vo.PaymentRequestsVo;
 import com.jy.business.payment.service.PaymentRequestsService;
 import com.jy.framework.model.base.BaseSelectDto;
@@ -76,4 +77,12 @@ public class PaymentRequestsController {
         return paymentRequestsService.getRemitPage(dto);
     }
 
+    /**
+     * 打款
+     */
+    @PostMapping("/remit")
+    public void remit(@RequestBody PaymentRemit dto) {
+        paymentRequestsService.remit(dto);
+    }
+
 }

+ 20 - 0
jy-business/src/main/java/com/jy/business/payment/dao/PaymentRemitDao.java

@@ -0,0 +1,20 @@
+package com.jy.business.payment.dao;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jy.business.payment.mapper.PaymentRemitMapper;
+import com.jy.business.payment.model.dto.PaymentRemitSelectDto;
+import com.jy.business.payment.model.entity.PaymentRemit;
+import com.jy.business.payment.model.table.PaymentRemitTable;
+import com.jy.business.payment.model.vo.PaymentRemitVo;
+import com.jy.framework.model.base.BaseDao;
+import com.jy.system.service.AuthService;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PaymentRemitDao extends BaseDao<PaymentRemitMapper, PaymentRemit> {
+
+    @Resource
+    private AuthService authService;
+
+}

+ 16 - 0
jy-business/src/main/java/com/jy/business/payment/mapper/PaymentRemitMapper.java

@@ -0,0 +1,16 @@
+package com.jy.business.payment.mapper;
+
+import com.jy.business.payment.model.entity.PaymentRemit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 打款 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+public interface PaymentRemitMapper extends BaseMapper<PaymentRemit> {
+
+}

+ 5 - 0
jy-business/src/main/java/com/jy/business/payment/mapper/xml/PaymentRemitMapper.xml

@@ -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="com.jy.business.payment.mapper.PaymentRemitMapper">
+
+</mapper>

+ 17 - 0
jy-business/src/main/java/com/jy/business/payment/model/dto/PaymentRemitDto.java

@@ -0,0 +1,17 @@
+package com.jy.business.payment.model.dto;
+
+import com.jy.business.payment.model.entity.PaymentRemit;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款新增编辑入参实体
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+@Getter
+@Setter
+public class PaymentRemitDto extends PaymentRemit {
+
+}

+ 17 - 0
jy-business/src/main/java/com/jy/business/payment/model/dto/PaymentRemitSelectDto.java

@@ -0,0 +1,17 @@
+package com.jy.business.payment.model.dto;
+
+import com.jy.framework.model.base.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款列表查询入参实体
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+@Getter
+@Setter
+public class PaymentRemitSelectDto extends BaseSelectDto {
+
+}

+ 87 - 0
jy-business/src/main/java/com/jy/business/payment/model/entity/PaymentRemit.java

@@ -0,0 +1,87 @@
+package com.jy.business.payment.model.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jy.framework.model.base.BaseIdPo;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 打款
+ * </p>
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+@Getter
+@Setter
+@TableName("payment_remit")
+public class PaymentRemit extends BaseIdPo {
+
+    /**
+     * 请款id
+     */
+    private Long paymentRequestsId;
+
+    /**
+     * 资金账户id
+     */
+    private Long capitalAccountId;
+
+    /**
+     * 请款金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 打款时间
+     */
+    private Date remitTime;
+
+    /**
+     * 摘要
+     */
+    private String remark;
+
+    /**
+     * 附件列表
+     */
+    private String atts;
+
+    /**
+     * 创建人
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUser;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateUser;
+
+    /**
+     * 更新时间
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    /**
+     * 逻辑删除标记
+     */
+    @TableLogic
+    @TableField(fill = FieldFill.INSERT)
+    private String delFlag;
+
+}

+ 5 - 0
jy-business/src/main/java/com/jy/business/payment/model/entity/PaymentRequests.java

@@ -105,6 +105,11 @@ public class PaymentRequests extends BaseIdPo {
     private Integer paymentStatus;
 
     /**
+     * 已打款金额
+     */
+    private BigDecimal remitAmount;
+
+    /**
      * 创建人
      */
     @TableField(fill = FieldFill.INSERT)

+ 84 - 0
jy-business/src/main/java/com/jy/business/payment/model/table/PaymentRemitTable.java

@@ -0,0 +1,84 @@
+package com.jy.business.payment.model.table;
+
+import com.jy.business.payment.model.entity.PaymentRemit;
+import com.jy.framework.mybatis.join.QueryColumn;
+import com.jy.framework.mybatis.join.Table;
+
+public class PaymentRemitTable extends Table<PaymentRemit> {
+
+    public static PaymentRemitTable payment_remit = new PaymentRemitTable();
+    public static PaymentRemitTable pr = payment_remit.as("pr");
+
+    /**
+     * 打款id
+     */
+    public QueryColumn id = this.field(PaymentRemit::getId);
+
+    /**
+     * 请款id
+     */
+    public QueryColumn paymentRequestsId = this.field(PaymentRemit::getPaymentRequestsId);
+
+    /**
+     * 资金账户id
+     */
+    public QueryColumn capitalAccountId = this.field(PaymentRemit::getCapitalAccountId);
+
+    /**
+     * 请款金额
+     */
+    public QueryColumn amount = this.field(PaymentRemit::getAmount);
+
+    /**
+     * 打款时间
+     */
+    public QueryColumn remitTime = this.field(PaymentRemit::getRemitTime);
+
+    /**
+     * 摘要
+     */
+    public QueryColumn remark = this.field(PaymentRemit::getRemark);
+
+    /**
+     * 附件列表
+     */
+    public QueryColumn atts = this.field(PaymentRemit::getAtts);
+
+    /**
+     * 创建人
+     */
+    public QueryColumn createUser = this.field(PaymentRemit::getCreateUser);
+
+    /**
+     * 创建时间
+     */
+    public QueryColumn createTime = this.field(PaymentRemit::getCreateTime);
+
+    /**
+     * 更新人
+     */
+    public QueryColumn updateUser = this.field(PaymentRemit::getUpdateUser);
+
+    /**
+     * 更新时间
+     */
+    public QueryColumn updateTime = this.field(PaymentRemit::getUpdateTime);
+
+    /**
+     * 逻辑删除标记
+     */
+    public QueryColumn delFlag = this.field(PaymentRemit::getDelFlag);
+
+    private PaymentRemitTable() {
+        super(PaymentRemit.class);
+    }
+
+    private PaymentRemitTable(String alias) {
+        super(PaymentRemit.class, alias);
+    }
+
+    public PaymentRemitTable as(String alias) {
+        return new PaymentRemitTable(alias);
+    }
+
+}

+ 5 - 0
jy-business/src/main/java/com/jy/business/payment/model/table/PaymentRequestsTable.java

@@ -95,6 +95,11 @@ public class PaymentRequestsTable extends Table<PaymentRequests> {
     public QueryColumn paymentStatus = this.field(PaymentRequests::getPaymentStatus);
 
     /**
+     * 已打款金额
+     */
+    public QueryColumn remitAmount = this.field(PaymentRequests::getRemitAmount);
+
+    /**
      * 创建人
      */
     public QueryColumn createUser = this.field(PaymentRequests::getCreateUser);

+ 17 - 0
jy-business/src/main/java/com/jy/business/payment/model/vo/PaymentRemitVo.java

@@ -0,0 +1,17 @@
+package com.jy.business.payment.model.vo;
+
+import com.jy.business.payment.model.entity.PaymentRemit;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 打款列表查询返回值实体
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+@Getter
+@Setter
+public class PaymentRemitVo extends PaymentRemit {
+
+}

+ 15 - 0
jy-business/src/main/java/com/jy/business/payment/service/PaymentRemitService.java

@@ -0,0 +1,15 @@
+package com.jy.business.payment.service;
+
+
+
+/**
+ * <p>
+ * 打款 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+public interface PaymentRemitService {
+
+}

+ 6 - 0
jy-business/src/main/java/com/jy/business/payment/service/PaymentRequestsService.java

@@ -3,6 +3,7 @@ package com.jy.business.payment.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jy.business.payment.model.dto.PaymentRequestsDto;
 import com.jy.business.payment.model.dto.PaymentRequestsSelectDto;
+import com.jy.business.payment.model.entity.PaymentRemit;
 import com.jy.business.payment.model.vo.PaymentRequestsVo;
 
 import java.util.List;
@@ -47,4 +48,9 @@ public interface PaymentRequestsService {
      */
     Page<PaymentRequestsVo> getRemitPage(PaymentRequestsSelectDto dto);
 
+    /**
+     * 打款
+     */
+    void remit(PaymentRemit dto);
+
 }

+ 22 - 0
jy-business/src/main/java/com/jy/business/payment/service/impl/PaymentRemitServiceImpl.java

@@ -0,0 +1,22 @@
+package com.jy.business.payment.service.impl;
+
+import com.jy.business.payment.dao.PaymentRemitDao;
+import com.jy.business.payment.service.PaymentRemitService;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 打款 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-10-23
+ */
+@Service
+public class PaymentRemitServiceImpl implements PaymentRemitService {
+
+    @Resource
+    private PaymentRemitDao paymentRemitDao;
+
+}

+ 47 - 0
jy-business/src/main/java/com/jy/business/payment/service/impl/PaymentRequestsServiceImpl.java

@@ -1,10 +1,15 @@
 package com.jy.business.payment.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jy.business.capital.model.dto.CapitalTransactionsDto;
+import com.jy.business.capital.service.CapitalTransactionsService;
+import com.jy.business.payment.dao.PaymentRemitDao;
 import com.jy.business.payment.dao.PaymentRequestsDao;
 import com.jy.business.payment.dao.PaymentRequestsDetailDao;
 import com.jy.business.payment.model.dto.PaymentRequestsDto;
 import com.jy.business.payment.model.dto.PaymentRequestsSelectDto;
+import com.jy.business.payment.model.entity.PaymentRemit;
+import com.jy.business.payment.model.entity.PaymentRequests;
 import com.jy.business.payment.model.entity.PaymentRequestsDetail;
 import com.jy.business.payment.model.vo.PaymentRequestsVo;
 import com.jy.business.payment.service.PaymentRequestsService;
@@ -17,6 +22,7 @@ import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -36,6 +42,12 @@ public class PaymentRequestsServiceImpl implements PaymentRequestsService {
     @Resource
     private PaymentRequestsDetailDao paymentRequestsDetailDao;
 
+    @Resource
+    private PaymentRemitDao paymentRemitDao;
+
+    @Resource
+    private CapitalTransactionsService capitalTransactionsService;
+
     @Override
     public Page<PaymentRequestsVo> getPage(PaymentRequestsSelectDto dto) {
         return paymentRequestsDao.getPage(dto);
@@ -56,6 +68,7 @@ public class PaymentRequestsServiceImpl implements PaymentRequestsService {
     public void add(PaymentRequestsDto dto) {
         dto.setApprovalStatus(FlowStatusEnum.UNDER_WAY.getKey());
         dto.setPaymentStatus(CommonConstant.NO);
+        dto.setRemitAmount(BigDecimal.ZERO);
         paymentRequestsDao.save(dto);
 
         List<PaymentRequestsDetail> paymentRequestsDetailList = dto.getPaymentRequestsDetailList();
@@ -89,4 +102,38 @@ public class PaymentRequestsServiceImpl implements PaymentRequestsService {
         return paymentRequestsDao.getRemitPage(dto);
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public synchronized void remit(PaymentRemit dto) {
+        PaymentRequests paymentRequests = paymentRequestsDao.getById(dto.getPaymentRequestsId());
+        AssertUtil.notNull(paymentRequests, "未知请款id");
+        AssertUtil.eqTrue(dto.getAmount().compareTo(BigDecimal.ZERO) > 0, "请款金额必须大于0");
+        AssertUtil.notEqual(paymentRequests.getPaymentStatus(), 2, "打款已完成");
+
+        BigDecimal totalAmount = paymentRequests.getRemitAmount().add(dto.getAmount());
+        int amountCompareTo = paymentRequests.getTotalAmount().compareTo(totalAmount);
+        AssertUtil.eqTrue(amountCompareTo >= 0, "打款金额超过请款金额");
+
+        // 更新打款金额和状态
+        paymentRequests.setRemitAmount(totalAmount);
+        paymentRequests.setPaymentStatus(amountCompareTo == 0 ? 2 : 1);
+        paymentRequestsDao.updateById(paymentRequests);
+
+        // 保存打款记录
+        paymentRemitDao.save(dto);
+
+        // 添加资金流水
+        CapitalTransactionsDto capitalTransactionsDto = new CapitalTransactionsDto();
+        capitalTransactionsDto.setCapitalAccountId(dto.getCapitalAccountId());
+        capitalTransactionsDto.setTradingTime(dto.getRemitTime());
+        capitalTransactionsDto.setType(0);
+        capitalTransactionsDto.setAmount(dto.getAmount());
+        capitalTransactionsDto.setTargetType(90);
+        capitalTransactionsDto.setTargetAccountName(paymentRequests.getAccountName());
+        capitalTransactionsDto.setTargetDepositBank(paymentRequests.getDepositBank());
+        capitalTransactionsDto.setTargetAccount(paymentRequests.getAccount());
+        capitalTransactionsDto.setRemark(dto.getRemark());
+        capitalTransactionsService.add(capitalTransactionsDto);
+    }
+
 }

+ 9 - 0
jy-framework/src/main/java/com/jy/framework/utils/AssertUtil.java

@@ -70,4 +70,13 @@ public class AssertUtil {
         }
     }
 
+    /**
+     * 断言对象相等
+     */
+    public static void notEqual(Object obj1, Object obj2, String errStr, Object... params) {
+        if (ObjectUtil.equal(obj1, obj2)) {
+            throw new ServiceException(StrUtil.format(errStr, params));
+        }
+    }
+
 }

+ 5 - 0
jy-ui/src/api/business/payment/requests.ts

@@ -30,3 +30,8 @@ export function deleteApi(data: StrAnyObj): Promise<void> {
 export function getRemitPageApi(params: StrAnyObj): Promise<PageType<StrAnyObj>> {
   return request.get('/paymentRequests/getRemitPage', params)
 }
+
+// 请款
+export function remitApi(data: StrAnyObj): Promise<PageType<StrAnyObj>> {
+  return request.post('/paymentRequests/remit', data)
+}

+ 10 - 0
jy-ui/src/components/AForm/index.vue

@@ -5,6 +5,7 @@ import type { ValidateFieldsError } from 'async-validator'
 import { FormConfigType } from '@/components/AForm/type'
 import { StrAnyObj } from '@/typings'
 import { getResult } from '@/utils'
+import FileUpload from '@/components/FlieUpload/index.vue'
 
 const props = withDefaults(
   defineProps<{
@@ -224,6 +225,15 @@ function clearOption(prop: string) {
                 :change="item.change"
               />
             </template>
+            <template v-else-if="item.type === 'upload'">
+              <file-upload
+                v-model="computedModelValue[item.prop]"
+                :disabled="getResult(item.disabled ?? disabled)"
+                :tip="item.tip"
+                :limit="item.limit"
+                :width="item.width"
+              />
+            </template>
             <template v-else-if="item.type === 'slot'">
               <slot :name="item.prop"></slot>
             </template>

+ 14 - 0
jy-ui/src/components/AForm/type.ts

@@ -10,6 +10,7 @@ export type FormConfigType =
   | CheckboxType
   | DatePickerType
   | FormSlotType
+  | UploadType
 
 export interface InputType extends FormCommonType {
   type: 'input'
@@ -154,6 +155,19 @@ export interface DatePickerType extends FormCommonType {
   change?: (value: any) => void
 }
 
+export interface UploadType extends FormCommonType {
+  // 类型
+  type: 'upload'
+  // 是否禁用
+  disabled?: boolean | (() => boolean)
+  // 提示
+  tip: string
+  // 最大上传数量
+  limit: number
+  // 组件宽度
+  width: string
+}
+
 export interface FormSlotType extends FormCommonType {
   // 类型
   type: 'slot'

+ 95 - 47
jy-ui/src/views/business/payment/remit/index.vue

@@ -4,7 +4,13 @@ import { FormConfigType } from '@/components/AForm/type'
 import { ToolbarConfigType } from '@/components/AToolbar/type'
 import { ColumnConfigType } from '@/components/ATable/type'
 import { StrAnyObj, StrAnyObjArr } from '@/typings'
-import { addApi, editApi, getDetailApi, getRemitPageApi } from '@/api/business/payment/requests'
+import {
+  addApi,
+  editApi,
+  getDetailApi,
+  getRemitPageApi,
+  remitApi
+} from '@/api/business/payment/requests'
 import { getPageApi as getCorporationPageApi } from '@/api/business/corporation/corporation'
 import DeptTreeSelect from '@/views/components/DeptTreeSelect/index.vue'
 import { getPageApi as getCapitalAccountPageApi } from '@/api/business/capital/account'
@@ -18,7 +24,8 @@ const pageTotal = ref<number>(0)
 
 const queryData = ref<StrAnyObj>({ pageNum: 1, pageSize: 10 })
 const tableData = ref<StrAnyObjArr>([])
-const formData = ref<StrAnyObj>({ paymentRequestsDetailList: [{}] })
+const detailData = ref<StrAnyObj>({ paymentRequestsDetailList: [{}] })
+const formData = ref<StrAnyObj>({})
 
 const dialogTitle = ref<string>('')
 const dialogVisible = ref<boolean>(false)
@@ -154,13 +161,29 @@ const columnConfig: ColumnConfigType[] = [
     width: 250,
     handleConfig: [
       {
+        text: '打款',
+        if: (row) => row.paymentStatus != 2,
+        click(row) {
+          dialogVisible.value = true
+          dialogTitle.value = '打款'
+          disabled.value = false
+          getDetailApi({ id: row.id }).then((resp: StrAnyObj) => {
+            detailData.value = resp
+            formData.value.capitalAccountId = resp.capitalAccountId
+            formData.value.amount = resp.totalAmount - resp.remitAmount
+            formData.value.remark = resp.useRemark
+            formData.value.paymentRequestsId = resp.id
+          })
+        }
+      },
+      {
         common: 'detail',
         click(row) {
           dialogVisible.value = true
           dialogTitle.value = '详情'
           disabled.value = true
           getDetailApi({ id: row.id }).then((resp: StrAnyObj) => {
-            formData.value = resp
+            detailData.value = resp
           })
         }
       }
@@ -168,19 +191,18 @@ const columnConfig: ColumnConfigType[] = [
   }
 ]
 
-const formConfig: FormConfigType[] = [
+const detailConfig: FormConfigType[] = [
   {
-    type: 'select',
-    prop: 'type',
-    label: '请款类型',
-    dict: 'payment_requests_type',
+    type: 'input',
+    prop: 'totalAmount',
+    label: '请款金额',
     placeholder: '',
     disabled: true
   },
   {
     type: 'input',
-    prop: 'totalAmount',
-    label: '款金额',
+    prop: 'remitAmount',
+    label: '已打款金额',
     placeholder: '',
     disabled: true
   },
@@ -242,6 +264,58 @@ const formConfig: FormConfigType[] = [
     span: 24,
     placeholder: '',
     disabled: true
+  },
+  {
+    type: 'upload',
+    prop: 'atts',
+    label: '附件',
+    span: 24
+  }
+]
+
+const formConfig: FormConfigType[] = [
+  {
+    type: 'select',
+    prop: 'capitalAccountId',
+    label: '付款账户',
+    keyName: 'id',
+    labelName: 'accountAlias',
+    async option() {
+      const data = await getCapitalAccountPageApi({ searchAll: true })
+      return data.records
+    },
+    rule: [{ required: true, message: '付款账户不能为空', trigger: 'blur' }]
+  },
+  {
+    type: 'inputNumber',
+    prop: 'amount',
+    label: '打款金额',
+    min: 0.01,
+    precision: 2,
+    rule: [{ required: true, message: '打款金额不能为空', trigger: 'blur' }]
+  },
+  {
+    type: 'datePicker',
+    prop: 'remitTime',
+    label: '打款时间',
+    datePickerType: 'datetime',
+    format: 'YYYY-MM-DD 00:00:00',
+    valueFormat: 'YYYY-MM-DD 00:00:00',
+    rule: [{ required: true, message: '打款时间不能为空', trigger: ['blur', 'change'] }]
+  },
+  {
+    type: 'input',
+    itemType: 'textarea',
+    prop: 'remark',
+    label: '摘要',
+    rows: 5,
+    span: 24
+  },
+  {
+    type: 'upload',
+    prop: 'atts',
+    label: '附件',
+    span: 24
   }
 ]
 
@@ -263,39 +337,11 @@ function tableSelectionChange(item: StrAnyObjArr) {
 
 function formSubmit() {
   formRef.value?.validate(() => {
-    if (formData.value.paymentRequestsDetailList.length === 0) {
-      ElMessage.error('请款明细为空,无法提交')
-      return
-    }
-
-    for (const item of formData.value.paymentRequestsDetailList) {
-      if (!item.expenseType) {
-        ElMessage.error('请款明细存在费用类型为空,无法提交')
-        return
-      }
-      if (!item.remark) {
-        ElMessage.error('请款明细存在款项说明为空,无法提交')
-        return
-      }
-      if (!item.amount) {
-        ElMessage.error('请款明细存在请款金额为空,无法提交')
-        return
-      }
-    }
-
-    if (formData.value.id) {
-      editApi(formData.value).then(() => {
-        dialogVisible.value = false
-        ElMessage.success('修改成功')
-        getPage()
-      })
-    } else {
-      addApi(formData.value).then(() => {
-        dialogVisible.value = false
-        ElMessage.success('新增成功')
-        getPage()
-      })
-    }
+    remitApi(formData.value).then(() => {
+      dialogVisible.value = false
+      ElMessage.success('打款成功')
+      getPage()
+    })
   })
 }
 
@@ -309,7 +355,7 @@ function formClosed() {
     <el-card v-if="showQuery">
       <a-form ref="queryRef" v-model="queryData" :config="queryConfig" :span="6">
         <template #deptId>
-          <dept-tree-select ref="selectDeptIdRef" v-model="formData.deptId" />
+          <dept-tree-select ref="selectDeptIdRef" v-model="queryData.deptId" />
         </template>
       </a-form>
     </el-card>
@@ -336,14 +382,16 @@ function formClosed() {
       width="1400px"
     >
       <div v-if="disabled">
-        <a-form ref="formRef" v-model="formData" :config="formConfig" :span="12" disabled></a-form>
+        <a-form v-model="detailData" :config="detailConfig" :span="12" disabled> </a-form>
       </div>
 
       <el-card v-if="!disabled" header="请款信息">
-        <a-form ref="formRef" v-model="formData" :config="formConfig" :span="12"></a-form>
+        <a-form v-model="detailData" :config="detailConfig" :span="12" disabled></a-form>
       </el-card>
 
-      <el-card v-if="!disabled" header="打款信息" style="margin-top: 10px"> </el-card>
+      <el-card v-if="!disabled" header="打款信息" style="margin-top: 10px">
+        <a-form ref="formRef" v-model="formData" :config="formConfig" :span="12"> </a-form>
+      </el-card>
     </a-dialog>
   </div>
 </template>

+ 3 - 6
jy-ui/src/views/business/payment/requests/index.vue

@@ -275,8 +275,8 @@ const formConfig: FormConfigType[] = [
     prop: 'useTime',
     label: '用款时间',
     datePickerType: 'datetime',
-    format: 'YYYY-MM-DD 00:00:00',
-    valueFormat: 'YYYY-MM-DD 00:00:00'
+    format: 'YYYY-MM-DD HH:mm:ss',
+    valueFormat: 'YYYY-MM-DD HH:mm:ss'
   },
   {
     type: 'input',
@@ -289,7 +289,7 @@ const formConfig: FormConfigType[] = [
     disabled: true
   },
   {
-    type: 'slot',
+    type: 'upload',
     prop: 'atts',
     label: '上传附件',
     span: 24
@@ -516,9 +516,6 @@ function updateAmount() {
         <template #deptId>
           <dept-tree-select ref="deptIdRef" v-model="formData.deptId" :disabled="disabled" />
         </template>
-        <template #atts>
-          <file-upload v-model="formData.atts" :disabled="disabled" />
-        </template>
         <template #detailTable>
           <a-table
             :data="formData.paymentRequestsDetailList"