|
@@ -173,6 +173,15 @@ export default {
|
|
}
|
|
}
|
|
callback()
|
|
callback()
|
|
}
|
|
}
|
|
|
|
+ const validateCharacter = (rule, value, callback) => {
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback()
|
|
|
|
+ } else if (/[\u4e00-\u9fa5]/.test(value)) {
|
|
|
|
+ callback(new Error('请输入英文'))
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return {
|
|
return {
|
|
ruleForm: {
|
|
ruleForm: {
|
|
paymentWay: '',
|
|
paymentWay: '',
|
|
@@ -218,13 +227,13 @@ export default {
|
|
],
|
|
],
|
|
|
|
|
|
'i18n.accountName': [
|
|
'i18n.accountName': [
|
|
- { required: true, message: `请输入账户名称`, trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: `请输入账户名称`, trigger: 'blur' }, { validator: validateCharacter, trigger: 'blur' }
|
|
],
|
|
],
|
|
'i18n.openingBank': [
|
|
'i18n.openingBank': [
|
|
- { required: true, message: `请输入开户行`, trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: `请输入开户行`, trigger: 'blur' }, { validator: validateCharacter, trigger: 'blur' }
|
|
],
|
|
],
|
|
'i18n.bankName': [
|
|
'i18n.bankName': [
|
|
- { required: true, message: `请输入银行名称`, trigger: 'blur' }
|
|
|
|
|
|
+ { required: true, message: `请输入银行名称`, trigger: 'blur' }, { validator: validateCharacter, trigger: 'blur' }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
paymentInfo: [
|
|
paymentInfo: [
|
|
@@ -628,15 +637,24 @@ export default {
|
|
obj.paymentRatio = Number(item.paymentRatio)
|
|
obj.paymentRatio = Number(item.paymentRatio)
|
|
obj.paymentTerm = Number(item.paymentTerm)
|
|
obj.paymentTerm = Number(item.paymentTerm)
|
|
paymentInfo.push(obj)
|
|
paymentInfo.push(obj)
|
|
|
|
+
|
|
|
|
+ item.paymentRatio = Number(item.paymentRatio)
|
|
|
|
+ item.paymentTerm = Number(item.paymentTerm)
|
|
})
|
|
})
|
|
params.paymentInfo = paymentInfo.length ? paymentInfo : null
|
|
params.paymentInfo = paymentInfo.length ? paymentInfo : null
|
|
|
|
|
|
const titleInfo = []
|
|
const titleInfo = []
|
|
this.titleInfo.map(item => {
|
|
this.titleInfo.map(item => {
|
|
const obj = {}
|
|
const obj = {}
|
|
|
|
+ for (const k in item) {
|
|
|
|
+ if (k !== 'i18n') {
|
|
|
|
+ obj[k] = item[k]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const i18n = {}
|
|
for (const key in item.i18n) {
|
|
for (const key in item.i18n) {
|
|
if (item.i18n[key] !== '') {
|
|
if (item.i18n[key] !== '') {
|
|
- obj.i18n[key] = [
|
|
|
|
|
|
+ i18n[key] = [
|
|
{
|
|
{
|
|
language: 'cn',
|
|
language: 'cn',
|
|
value: item[key]
|
|
value: item[key]
|
|
@@ -648,11 +666,7 @@ export default {
|
|
]
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (const k in item) {
|
|
|
|
- if (k !== 'i18n') {
|
|
|
|
- obj[k] = item[k]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ obj.i18n = Object.keys(i18n).length ? i18n : null
|
|
titleInfo.push(obj)
|
|
titleInfo.push(obj)
|
|
})
|
|
})
|
|
params.titleInfo = titleInfo.length ? titleInfo : null
|
|
params.titleInfo = titleInfo.length ? titleInfo : null
|
|
@@ -663,6 +677,12 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (this.titleInfo && this.titleInfo.length) {
|
|
|
|
+ if (!this.validateTitleInfo()) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 付款款项表格的款项比例之和必须为100,且表格最大值的付款期限必须等于结算账期
|
|
// 付款款项表格的款项比例之和必须为100,且表格最大值的付款期限必须等于结算账期
|
|
if (this.paymentInfo.length > 0) {
|
|
if (this.paymentInfo.length > 0) {
|
|
const paymentRatioSum = this.paymentInfo.reduce((acc, cur) => acc + cur.paymentRatio, 0)
|
|
const paymentRatioSum = this.paymentInfo.reduce((acc, cur) => acc + cur.paymentRatio, 0)
|
|
@@ -715,7 +735,6 @@ export default {
|
|
this.titleInfo.splice(index, 1)
|
|
this.titleInfo.splice(index, 1)
|
|
},
|
|
},
|
|
validatePayInfo() {
|
|
validatePayInfo() {
|
|
- console.log(this.paymentInfo)
|
|
|
|
let i = 0
|
|
let i = 0
|
|
while (i < this.paymentInfo.length) {
|
|
while (i < this.paymentInfo.length) {
|
|
if (!this.paymentInfo[i].paymentRatio) {
|
|
if (!this.paymentInfo[i].paymentRatio) {
|
|
@@ -726,8 +745,22 @@ export default {
|
|
this.$message.warning(`请输入付款条件列表第${i + 1}行付款时点`)
|
|
this.$message.warning(`请输入付款条件列表第${i + 1}行付款时点`)
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- if (!this.paymentInfo[i].paymentRatio) {
|
|
|
|
- this.$message.warning(`请输入付款条件列表第${i + 1}行款项比例`)
|
|
|
|
|
|
+ if (!this.paymentInfo[i].i18n.paymentTime) {
|
|
|
|
+ this.$message.warning(`请输入付款条件列表第${i + 1}行付款时点(英文)`)
|
|
|
|
+ return false
|
|
|
|
+ } else if (/[\u4e00-\u9fa5]/.test(this.paymentInfo[i].i18n.paymentTime)) {
|
|
|
|
+ this.$message.warning(`付款条件列表第${i + 1}行付款时点(英文)格式有误`)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if (!this.paymentInfo[i].paymentName) {
|
|
|
|
+ this.$message.warning(`请输入付款条件列表第${i + 1}行款项名称`)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if (!this.paymentInfo[i].i18n.paymentName) {
|
|
|
|
+ this.$message.warning(`请输入付款条件列表第${i + 1}行款项名称(英文)`)
|
|
|
|
+ return false
|
|
|
|
+ } else if (/[\u4e00-\u9fa5]/.test(this.paymentInfo[i].i18n.paymentName)) {
|
|
|
|
+ this.$message.warning(`付款条件列表第${i + 1}行款项名称(英文)格式有误`)
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
if (this.paymentInfo[i].paymentTerm === '') {
|
|
if (this.paymentInfo[i].paymentTerm === '') {
|
|
@@ -743,6 +776,27 @@ export default {
|
|
}
|
|
}
|
|
return true
|
|
return true
|
|
},
|
|
},
|
|
|
|
+ validateTitleInfo() {
|
|
|
|
+ let i = 0
|
|
|
|
+ while (i < this.titleInfo.length) {
|
|
|
|
+ if (!this.titleInfo[i].i18n.termTitle) {
|
|
|
|
+ this.$message.warning(`请输入特殊约定列表第${i + 1}行条款标题(英文)`)
|
|
|
|
+ return false
|
|
|
|
+ } else if (/[\u4e00-\u9fa5]/.test(this.titleInfo[i].i18n.termTitle)) {
|
|
|
|
+ this.$message.warning(`特殊约定列表第${i + 1}行条款标题(英文)格式有误`)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if (!this.titleInfo[i].i18n.content) {
|
|
|
|
+ this.$message.warning(`请输入特殊约定列表第${i + 1}行条款内容(英文)`)
|
|
|
|
+ return false
|
|
|
|
+ } else if (/[\u4e00-\u9fa5]/.test(this.titleInfo[i].i18n.content)) {
|
|
|
|
+ this.$message.warning(`特殊约定列表第${i + 1}行条款内容(英文)格式有误`)
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ i++
|
|
|
|
+ }
|
|
|
|
+ return true
|
|
|
|
+ },
|
|
handleAddTitleInfo() {
|
|
handleAddTitleInfo() {
|
|
this.titleInfo.push(
|
|
this.titleInfo.push(
|
|
{
|
|
{
|