check.js 941 Bytes
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
import Utils from "~/utils"
import moment from 'moment';
import CfagitCheck from '~/components/business/Cfagit/model/check.js';
import BigNumber from "bignumber.js";

/**
 * Nitplb Check规则
 */
export default {
	data(){
		return {
			rules: {
				...new CfagitCheck(this).check,


				"chgdat": [{
					required: false,
					message: "输入正确的日期"
				},
					{
						validator: (rule, value, callback) => {
							if (moment(value).diff(moment(new Date()), 'days') < 0) {
								callback(new Error('输入日期不得小于当前日期!'))
							} else {
								callback()
							}
							callback()
						}
					}
				],
				"chgamt": [{
					required: true,
					message: "必输项"
				},
					{
						validator: (rule, value, callback) => {
							if (value > 0) {
								callback(new Error('不允许做增额操作!'));
							}

							callback();
						}, trigger: ['blur', 'change']
					},
				],
			}
		}
	}
}