|
|
@@ -119,6 +119,7 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
|
|
|
import { addPerformanceTemp } from '@/services/proto/performance';
|
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
|
import { onMounted } from '@vue/runtime-core';
|
|
|
+import { RuleObject } from 'ant-design-vue/lib/form/interface';
|
|
|
|
|
|
// 初始化 模板
|
|
|
const initTemp = (): PermanceTemp => {
|
|
|
@@ -155,17 +156,21 @@ const useEditeTemp = (typeList: Ref<QueryWrPerformanceStepTypeRsp[]>) => {
|
|
|
}
|
|
|
// 汇总
|
|
|
function isSummary({ steptypename }: PermanceTemp) {
|
|
|
- return steptypename === '买方支付汇总' || steptypename === '卖方收款汇总' ? true : false;
|
|
|
+ return steptypename === '买方支付' || steptypename === '卖方收款' ? false : true;
|
|
|
}
|
|
|
// 切换步骤类型
|
|
|
function stepTypeChange(item: PermanceTemp) {
|
|
|
const stepType = findTemp(item)!;
|
|
|
item.steptypename = stepType.steptypename;
|
|
|
// 卖方收款汇总值必须为100%;
|
|
|
- if (isSummary(item)) {
|
|
|
- item.stepvalue = 100;
|
|
|
- }
|
|
|
+ // if (!isSummary(item)) {
|
|
|
+ // item.stepvalue = 100;
|
|
|
+ // }
|
|
|
}
|
|
|
+ // function isDisable(temp: PermanceTemp) {
|
|
|
+ // const { steptypename } = findTemp(temp)!;
|
|
|
+ // return steptypename === '买方支付' || steptypename === '卖方收款';
|
|
|
+ // }
|
|
|
return { isSummary, stepTypeChange };
|
|
|
};
|
|
|
|
|
|
@@ -203,23 +208,39 @@ const userForm = (selectedRow: QueryPermancePlanTmpRsp) => {
|
|
|
}
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
- function validateStepValue(value: any) {
|
|
|
- const buyTotal = total('买方支付');
|
|
|
- const sellTotal = total('卖方收款');
|
|
|
- if (findIndex('买方支付') !== -1) {
|
|
|
- if (buyTotal !== 100) {
|
|
|
- return Promise.reject('买方支付汇总值必须为100%');
|
|
|
- }
|
|
|
- }
|
|
|
- if (findIndex('卖方收款') !== -1) {
|
|
|
- if (sellTotal !== 100) {
|
|
|
- return Promise.reject('卖方收款汇总值必须为100%');
|
|
|
+
|
|
|
+ function validateStepValue(rule: any, value: number) {
|
|
|
+ debugger;
|
|
|
+ if (rule.field) {
|
|
|
+ const arr = rule.fullField.split('.');
|
|
|
+ if (Array.isArray(arr) && arr.length === 3) {
|
|
|
+ const index = +arr[1];
|
|
|
+ const item = formState.domains[index];
|
|
|
+ const steptypename = item.steptypename;
|
|
|
+ if (steptypename === '买方支付' || steptypename === '卖方收款') {
|
|
|
+ if (!value) {
|
|
|
+ return Promise.reject('请输入步骤值');
|
|
|
+ }
|
|
|
+ const buyTotal = total('买方支付');
|
|
|
+ const sellTotal = total('卖方收款');
|
|
|
+ if (findIndex('买方支付') !== -1) {
|
|
|
+ if (buyTotal !== 100) {
|
|
|
+ return Promise.reject('买方支付汇总值必须为100%');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (findIndex('卖方收款') !== -1) {
|
|
|
+ if (sellTotal !== 100) {
|
|
|
+ return Promise.reject('卖方收款汇总值必须为100%');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sellTotal > buyTotal) {
|
|
|
+ return Promise.reject('卖方收款不能多于买方付款');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (sellTotal > buyTotal) {
|
|
|
- return Promise.reject('卖方收款不能多于买方付款');
|
|
|
- }
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
const rules = {
|
|
|
@@ -230,8 +251,8 @@ const userForm = (selectedRow: QueryPermancePlanTmpRsp) => {
|
|
|
{ required: true, validator: validateSepeTypeId },
|
|
|
],
|
|
|
stepvalue: [
|
|
|
- { required: true, message: '请输入步骤值', trigger: 'blur', type: 'number' },
|
|
|
- { required: true, validator: validateStepValue },
|
|
|
+ // { required: true, message: '请输入步骤值', trigger: 'blur', type: 'number' },
|
|
|
+ { required: true, validator: validateStepValue, type: 'number' },
|
|
|
],
|
|
|
stepdays: { required: true, message: '请输入距离上一步天数', trigger: 'blur', type: 'number' },
|
|
|
},
|