|
|
@ -513,7 +513,7 @@ export default {
|
|
|
|
if (this.isSeas) {
|
|
|
|
if (this.isSeas) {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.crmType == 'business' && ['statusName', 'typeName'].includes(item.form_type)) {
|
|
|
|
if (this.crmType == 'business' && ['business_type', 'business_status'].includes(item.form_type)) {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
} else if (this.crmType == 'contract' && ['business', 'contacts', 'customer'].includes(item.form_type)) {
|
|
|
|
} else if (this.crmType == 'contract' && ['business', 'contacts', 'customer'].includes(item.form_type)) {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
@ -578,7 +578,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
editConfirm() {
|
|
|
|
editConfirm() {
|
|
|
|
// customerId fieldId fieldType field formType value
|
|
|
|
// customerId fieldId fieldType field form_type value
|
|
|
|
// this.editCancel()
|
|
|
|
// this.editCancel()
|
|
|
|
this.$refs.editForm0[0].validate(valid => {
|
|
|
|
this.$refs.editForm0[0].validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
@ -640,38 +640,38 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
getRealValue(element, value) {
|
|
|
|
getRealValue(element, value) {
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
element.formType == 'customer' ||
|
|
|
|
element.form_type == 'customer' ||
|
|
|
|
element.formType == 'contacts' ||
|
|
|
|
element.form_type == 'contacts' ||
|
|
|
|
element.formType == 'business' ||
|
|
|
|
element.form_type == 'business' ||
|
|
|
|
element.formType == 'leads' ||
|
|
|
|
element.form_type == 'leads' ||
|
|
|
|
element.formType == 'contract'
|
|
|
|
element.form_type == 'contract'
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
if (value && value.length) {
|
|
|
|
if (value && value.length) {
|
|
|
|
return value[0][`${element.formType}Id`]
|
|
|
|
return value[0][`${element.form_type}_id`]
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return ''
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (
|
|
|
|
} else if (
|
|
|
|
element.formType == 'user' ||
|
|
|
|
element.form_type == 'user' ||
|
|
|
|
element.formType == 'single_user' ||
|
|
|
|
element.form_type == 'single_user' ||
|
|
|
|
element.formType == 'structure'
|
|
|
|
element.form_type == 'structure'
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
.map(item => {
|
|
|
|
.map(item => {
|
|
|
|
return (element.formType == 'user' || element.formType == 'single_user') ? item.userId : item.id
|
|
|
|
return (element.form_type == 'user' || element.form_type == 'single_user') ? item.id : item.id
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.join(',')
|
|
|
|
// .join(',')
|
|
|
|
} else if (element.formType == 'file') {
|
|
|
|
} else if (element.form_type == 'file') {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
return value[0].batchId
|
|
|
|
return value.map(item => item.file_id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
return []
|
|
|
|
} else if (element.formType == 'category') {
|
|
|
|
} else if (element.form_type == 'category') {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
return value[value.length - 1]
|
|
|
|
return value[value.length - 1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
return ''
|
|
|
|
} else if (element.formType == 'checkbox') {
|
|
|
|
} else if (element.form_type == 'checkbox') {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
if (value && value.length > 0) {
|
|
|
|
return value.join(',')
|
|
|
|
return value.join(',')
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -766,12 +766,15 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证唯一
|
|
|
|
// 验证唯一
|
|
|
|
if (item.isUnique == 1) {
|
|
|
|
if (item.is_unique == 1) {
|
|
|
|
var validateUnique = (rule, value, callback) => {
|
|
|
|
var validateUnique = (rule, value, callback) => {
|
|
|
|
if ((isArray(value) && value.length == 0) || !value) {
|
|
|
|
if ((isArray(value) && value.length == 0) || !value) {
|
|
|
|
callback()
|
|
|
|
callback()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var validatesParams = {}
|
|
|
|
var validatesParams = {
|
|
|
|
|
|
|
|
field: item.field,
|
|
|
|
|
|
|
|
types: 'crm_' + this.crmType
|
|
|
|
|
|
|
|
}
|
|
|
|
validatesParams.fieldId = item.fieldId
|
|
|
|
validatesParams.fieldId = item.fieldId
|
|
|
|
if (isArray(value)) {
|
|
|
|
if (isArray(value)) {
|
|
|
|
let postValue = ''
|
|
|
|
let postValue = ''
|
|
|
@ -798,15 +801,15 @@ export default {
|
|
|
|
postValue = value.join(',')
|
|
|
|
postValue = value.join(',')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
validatesParams.value = postValue
|
|
|
|
validatesParams.val = postValue
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
validatesParams.value = value
|
|
|
|
validatesParams.val = value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
validatesParams.batchId = this.detail.batchId
|
|
|
|
validatesParams.batchId = this.detail.batchId
|
|
|
|
filedValidatesAPI(validatesParams)
|
|
|
|
filedValidatesAPI(validatesParams)
|
|
|
|
.then(res => {
|
|
|
|
.then(res => {
|
|
|
|
// status 1 通过 0
|
|
|
|
// code 200 通过
|
|
|
|
if (res.data.status === 1) {
|
|
|
|
if (res.code == 200) {
|
|
|
|
callback()
|
|
|
|
callback()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
callback(new Error(item.name + '已存在'))
|
|
|
|
callback(new Error(item.name + '已存在'))
|
|
|
@ -874,7 +877,7 @@ export default {
|
|
|
|
tempList.push({
|
|
|
|
tempList.push({
|
|
|
|
validator: validateCRMMobile,
|
|
|
|
validator: validateCRMMobile,
|
|
|
|
item: item,
|
|
|
|
item: item,
|
|
|
|
trigger: []
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else if (item.form_type == 'email') {
|
|
|
|
} else if (item.form_type == 'email') {
|
|
|
|
var validateCRMEmail = (rule, value, callback) => {
|
|
|
|
var validateCRMEmail = (rule, value, callback) => {
|
|
|
@ -890,7 +893,7 @@ export default {
|
|
|
|
tempList.push({
|
|
|
|
tempList.push({
|
|
|
|
validator: validateCRMEmail,
|
|
|
|
validator: validateCRMEmail,
|
|
|
|
item: item,
|
|
|
|
item: item,
|
|
|
|
trigger: []
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tempList
|
|
|
|
return tempList
|
|
|
|