master_merge v11.1.1
monkey 3 years ago
parent 346eeb432e
commit 3b49fafe04

@ -40,10 +40,9 @@
</template> </template>
<script> <script>
import { isObject, isEmpty } from '@/utils/types' import { isObject, isEmpty, isArray } from '@/utils/types'
import { valueEquals } from 'element-ui/lib/utils/util' import { valueEquals } from 'element-ui/lib/utils/util'
import Emitter from 'element-ui/lib/mixins/emitter' import Emitter from 'element-ui/lib/mixins/emitter'
export default { export default {
// //
name: 'WkCheckbox', name: 'WkCheckbox',
@ -96,6 +95,12 @@ export default {
this.validValue() this.validValue()
}, },
immediate: true immediate: true
},
options: {
handler() {
this.validValue()
},
deep: true
} }
}, },
@ -118,18 +123,19 @@ export default {
} }
} else { } else {
if (this.otherShowInput) { if (this.otherShowInput) {
const otherItem = this.value.filter((name) => !this.options.includes(name)) const value = isArray(this.value) ? this.value : []
const otherItem = value.filter((name) => !this.options.includes(name))
if (otherItem.length > 0) { if (otherItem.length > 0) {
const newValue = this.value.filter((name) => !otherItem.includes(name)) const newValue = value.filter((name) => !otherItem.includes(name))
newValue.push('其他') newValue.push('其他')
this.dataValue = { this.dataValue = {
select: newValue, select: newValue,
otherValue: otherItem[otherItem.length - 1] otherValue: otherItem[otherItem.length - 1]
} }
} else { } else {
if (!valueEquals(this.value, this.dataValue.select)) { if (!valueEquals(value, this.dataValue.select)) {
this.dataValue = { this.dataValue = {
select: this.value, select: value,
otherValue: '' otherValue: ''
} }
} }

@ -3,11 +3,12 @@
v-elclickoutside="handleClose" v-elclickoutside="handleClose"
ref="reference" ref="reference"
:class="[disabled ? 'is_disabled' : 'is_valid', { 'is_focus': visible }]" :class="[disabled ? 'is_disabled' : 'is_valid', { 'is_focus': visible }]"
:style="{ height: `${height}px` }"
wrap="wrap" wrap="wrap"
class="wk-dep-select xh-form-border" class="wk-dep-select xh-form-border"
@click="containerClick"> @click="containerClick">
<div class="el-select__tags"> <div ref="tags" class="el-select__tags">
<span <span
v-for="(item, index) in showSelects" v-for="(item, index) in showSelects"
:key="index" :key="index"
@ -119,6 +120,7 @@ export default {
visible: false, visible: false,
dataValue: [], // dataValue: [], //
loading: false, loading: false,
height: 34,
optionsList: [] optionsList: []
} }
@ -175,6 +177,12 @@ export default {
this.$emit('input', this.dataValue) this.$emit('input', this.dataValue)
} }
} }
},
showSelects: {
handler() {
this.resetHeight()
},
immediate: true
} }
}, },
@ -183,6 +191,16 @@ export default {
}, },
methods: { methods: {
resetHeight() {
const tags = this.$refs.tags
if (tags) {
this.$nextTick(() => {
this.height = tags.clientHeight > 34 ? tags.clientHeight + 6 : 34
})
} else {
this.height = 34
}
},
/** /**
* 获取展示的数组 * 获取展示的数组
@ -215,7 +233,7 @@ export default {
} }
if (this.radio && (Array.isArray(this.value) || this.value === null || this.value === undefined)) { if (this.radio && (Array.isArray(this.value) || this.value === null || this.value === undefined)) {
this.$emit('input', '') // this.$emit('input', '')
} }
if (this.radio) { if (this.radio) {
@ -318,8 +336,10 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if (this.radio) { if (this.radio) {
this.dispatch('ElFormItem', 'el.form.change', this.dataValue && this.dataValue.length ? this.dataValue[0] : '') this.dispatch('ElFormItem', 'el.form.change', this.dataValue && this.dataValue.length ? this.dataValue[0] : '')
this.$emit('input', this.dataValue && this.dataValue.length ? this.dataValue[0] : '')
} else { } else {
this.dispatch('ElFormItem', 'el.form.change', this.dataValue) this.dispatch('ElFormItem', 'el.form.change', this.dataValue)
this.$emit('input', this.dataValue)
} }
this.$emit('change', this.dataValue, this.selects) this.$emit('change', this.dataValue, this.selects)
}) })
@ -358,6 +378,7 @@ export default {
color: #ddd; color: #ddd;
line-height: 34px; line-height: 34px;
cursor: pointer; cursor: pointer;
user-select: none;
} }
.delete-icon { .delete-icon {
color: #999; color: #999;

@ -17,14 +17,14 @@
<div <div
v-if="getShowValue(item)" v-if="getShowValue(item)"
:key="index" :key="index"
:class="[`is-${item.formType}`]" :class="[`is-${item.form_type}`]"
:label="item.name" :label="item.name"
:style="{width: item.stylePercent ? `${item.stylePercent}%` : 'auto'}" :style="{width: item.stylePercent ? `${item.stylePercent}%` : 'auto'}"
class="wk-form-item"> class="wk-form-item">
<div class="wk-form-item__label">{{ item.name }}</div> <div class="wk-form-item__label">{{ item.name }}</div>
<wk-field-view <wk-field-view
:props="item" :props="item"
:form-type="item.formType" :form_type="item.form_type"
:value="fieldForm[sectionIndex][item.field]" :value="fieldForm[sectionIndex][item.field]"
> >
<template slot-scope="{ data }"> <template slot-scope="{ data }">
@ -50,11 +50,11 @@
:key="index" :key="index"
:prop="item.field" :prop="item.field"
:label="item.name" :label="item.name"
:min-width="getMinWidth(item.formType)"> :min-width="getMinWidth(item.form_type)">
<template slot-scope="{ row, column, $index }"> <template slot-scope="{ row, column, $index }">
<wk-field-view <wk-field-view
:props="item" :props="item"
:form-type="item.formType" :form_type="item.form_type"
:value="row[item.field]" :value="row[item.field]"
> >
<template slot-scope="{ data }"> <template slot-scope="{ data }">
@ -115,12 +115,12 @@ export default {
beforeDestroy() {}, beforeDestroy() {},
methods: { methods: {
getMinWidth(formType) { getMinWidth(form_type) {
if (formType === 'date_interval' || if (form_type === 'date_interval' ||
formType === 'dateRange' || form_type === 'dateRange' ||
formType === 'file' || form_type === 'file' ||
formType === 'location' || form_type === 'location' ||
formType === 'position') { form_type === 'position') {
return 250 return 250
} }
return 150 return 150

@ -8,7 +8,7 @@ import {
regexIsCRMMobile, regexIsCRMMobile,
regexIsCRMEmail regexIsCRMEmail
} from '@/utils' } from '@/utils'
import { isEmpty } from '@/utils/types' import { isEmpty, isObject, isArray } from '@/utils/types'
export default { export default {
@ -41,6 +41,32 @@ export default {
message: item.name + '不能为空', message: item.name + '不能为空',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}) })
if (item.form_type == 'detail_table') {
tempList.push({
validator: ({ item }, value, callback) => {
if (this.getDetailTableIsEmpty(item.fieldExtendList, value)) {
callback(new Error(item.name + '不能为空'))
} else {
callback()
}
},
item: item,
trigger: ['blur', 'change']
})
} else if (item.form_type == 'checkbox') {
tempList.push({
validator: ({ item }, value, callback) => {
if (!isArray(value) || value.length === 0) {
callback(new Error(item.name + '不能为空'))
} else {
const emptyObj = value.find(valueItem => isEmpty(valueItem))
emptyObj === '' ? callback(new Error(item.name + '不能为空')) : callback()
}
},
item: item,
trigger: ['blur', 'change']
})
}
} }
// 验证唯一 // 验证唯一
@ -65,39 +91,47 @@ export default {
validator: validateUnique, validator: validateUnique,
item: item, item: item,
trigger: trigger:
item.formType == 'checkbox' || item.formType == 'select' || item.form_type == 'checkbox' || item.form_type == 'select' item.form_type == 'checkbox' || item.form_type == 'select'
? ['change'] ? ['change']
: ['blur'] : ['blur']
}) })
} }
// 特殊类型 // 特殊类型
if (item.formType === 'number' || item.form_type === 'number') { if (item.form_type === 'number' || item.form_type === 'percent') {
const validateCRMNumber = (rule, value, callback) => { const validateCRMNumber = (rule, value, callback) => {
if (item.hasOwnProperty('precisions')) {
this._getNumberRule(rule, value, callback)
} else {
if (isEmpty(value) || regexIsCRMNumber(value)) { if (isEmpty(value) || regexIsCRMNumber(value)) {
callback() callback()
} else { } else {
callback(new Error('数字的整数部分须少于15位小数部分须少于4位')) callback(new Error('数字的整数部分须少于15位小数部分须少于4位'))
} }
} }
}
tempList.push({ tempList.push({
validator: validateCRMNumber, validator: validateCRMNumber,
item: item, item: item,
trigger: ['blur'] trigger: ['blur']
}) })
} else if (item.formType === 'floatnumber' || item.form_type === 'floatnumber') { } else if (item.form_type === 'floatnumber') {
const validateCRMMoneyNumber = (rule, value, callback) => { const validateCRMMoneyNumber = (rule, value, callback) => {
if (item.hasOwnProperty('precisions')) {
this._getNumberRule(rule, value, callback)
} else {
if (isEmpty(value) || regexIsCRMMoneyNumber(value)) { if (isEmpty(value) || regexIsCRMMoneyNumber(value)) {
callback() callback()
} else { } else {
callback(new Error('货币的整数部分须少于15位小数部分须少于2位')) callback(new Error('货币的整数部分须少于15位小数部分须少于2位'))
} }
} }
}
tempList.push({ tempList.push({
validator: validateCRMMoneyNumber, validator: validateCRMMoneyNumber,
item: item, item: item,
trigger: ['blur'] trigger: ['blur']
}) })
} else if (item.formType === 'mobile' || item.form_type === 'mobile') { } else if (item.form_type === 'mobile') {
const validateCRMMobile = (rule, value, callback) => { const validateCRMMobile = (rule, value, callback) => {
if (isEmpty(value) || regexIsCRMMobile(value)) { if (isEmpty(value) || regexIsCRMMobile(value)) {
callback() callback()
@ -110,7 +144,7 @@ export default {
item: item, item: item,
trigger: ['blur'] trigger: ['blur']
}) })
} else if (item.formType === 'email' || item.form_type === 'email') { } else if (item.form_type === 'email') {
const validateCRMEmail = (rule, value, callback) => { const validateCRMEmail = (rule, value, callback) => {
if (isEmpty(value) || regexIsCRMEmail(value)) { if (isEmpty(value) || regexIsCRMEmail(value)) {
callback() callback()
@ -123,9 +157,90 @@ export default {
item: item, item: item,
trigger: ['blur'] trigger: ['blur']
}) })
} else if (item.form_type === 'location' && item.is_null == 1) {
const validateLocation = (rule, value, callback) => {
if (!isObject(value) || (
isObject(value) && isEmpty(value.lat) && isEmpty(value.lng) && isEmpty(value.address)
)) {
callback(new Error(item.name + '不能为空'))
} else {
callback()
}
}
tempList.push({
validator: validateLocation,
item: item,
trigger: ['change']
})
} }
return tempList return tempList
},
/**
* 获取数值规则
*/
_getNumberRule(rule, value, callback) {
const field = rule.item
const arr = String(value).split('.')
const len = String(value)
.replace('.', '')
.replace('-', '')
.length
const maxlength = field.form_type === 'percent' ? 10 : 15
const min = isEmpty(field.minNumRestrict) ? -Infinity : Number(field.minNumRestrict || -Infinity)
const max = isEmpty(field.maxNumRestrict) ? Infinity : Number(field.maxNumRestrict || Infinity)
if (len > maxlength) {
callback(new Error(`最多支持${maxlength}位数字(包含小数位)`))
} else if (isEmpty(field.precisions) && String(value).includes('.')) {
// null 不支持小数 0 不限制小数位
callback(new Error(`不支持小数`))
} else if (arr.length > 1 && arr[1].length > Number(field.precisions)) {
callback(new Error(`小数位不能大于${field.precisions}`))
} else if (value < min) {
callback(new Error(`不能小于${min}`))
} else if (value > max) {
callback(new Error(`不能大于${max}`))
} else {
callback()
}
},
/**
* 判断明细表格是否是空
* @param {*} fieldList
* @param {*} valueObj
*/
getDetailTableIsEmpty(fieldList, valueObjs) {
for (let index = 0; index < valueObjs.length; index++) {
const valueObj = valueObjs[index]
if (this.judgeFormValueIsEmpty(fieldList, valueObj)) {
return true
}
}
return false
},
/**
* 判断对象值是否是空
*/
judgeFormValueIsEmpty(fieldList, valueObj) {
for (let index = 0; index < fieldList.length; index++) {
const field = fieldList[index]
const value = valueObj[field.field]
if (field.form_type === 'location') {
if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) {
return false
}
} else if (!isEmpty(value)) {
return false
}
}
return true
} }
} }
} }

@ -70,7 +70,7 @@ export default {
* 获取提示语 * 获取提示语
*/ */
getTips(data) { getTips(data) {
const tips = data.tips || data.inputTips const tips = data.tips || data.input_tips
return tips ? `${tips}` : '' return tips ? `${tips}` : ''
}, },
/** /**

@ -127,4 +127,12 @@ export default {
padding: 12px 12px 0; padding: 12px 12px 0;
margin-bottom: 0; margin-bottom: 0;
} }
.el-form-item.is-user {
display: flex ;
flex-direction: column ;
}
.el-form-item.is-structure {
display: flex;
flex-direction: column;
}
</style> </style>

@ -41,9 +41,13 @@ export function getFormFieldShowName(form_type, value, placeholder = '--', item)
const newValue = CustomFieldsMixin.methods.getRealParams({ form_type }, value) const newValue = CustomFieldsMixin.methods.getRealParams({ form_type }, value)
if (isEmpty(newValue)) { if (isEmpty(newValue)) {
return placeholder return placeholder
} else {
if (isArray(newValue)) {
return newValue.join(',')
} else { } else {
return newValue return newValue
} }
}
} else if (form_type === 'structure') { } else if (form_type === 'structure') {
if (isArray(value)) { if (isArray(value)) {
return value.map(item => item.name).join() || placeholder return value.map(item => item.name).join() || placeholder

@ -33,22 +33,7 @@ export default {
}, },
data() { data() {
return { return {
message: `新增: message: `
1增加多种自定义字段类型支持自定义字段占比配置及布局调整
2客户管理新增团队成员有效时间优化团队成员权限联系人和回款模块增加团队成员功能增加相关团队字段支持通过相关团队对团队成员进行筛选
3新增日志点赞互动功能
4新增发票模块自定义字段发票导出功能
5增加市场活动自定义表单
6跟进记录增加导入导出功能
7导入数据时增加负责人字段
8角色权限系统管理角色新增权限"角色权限查看"控制在新建员工选择角色和编辑员工角色时可查看和选择角色的范围
优化
1优化客户管理仪表盘图表展示和统计数据等
2优化导出支持操作一万条以上数据
3高级筛选判断符优化调整时间筛选增加固定时间段例如今日本月本年等
4权限优化
修复 修复
1修复其他已知bug` 1修复其他已知bug`
} }

@ -3,8 +3,8 @@ const getLocationOrigin = () => {
} }
const companyName = '悟空CRM' const companyName = '悟空CRM'
const version = 'V11.1.0' const version = 'V11.1.1'
const baiduKey = 'lcuOQ71SCZhqpxsr1vL2mXoplWEoVctL' const baiduKey = '百度key'
export default { export default {
version, version,

@ -17,10 +17,10 @@ export default {
*/ */
getItemValue(item, detail, type) { getItemValue(item, detail, type) {
detail = detail || {} detail = detail || {}
if ((item.form_type || item.form_type) == 'contacts' || if (item.form_type == 'contacts' ||
(item.form_type || item.form_type) == 'customer' || item.form_type == 'customer' ||
(item.form_type || item.form_type) == 'contract' || item.form_type == 'contract' ||
(item.form_type || item.form_type) == 'business' item.form_type == 'business'
) { ) {
// crm相关信息特殊处理 // crm相关信息特殊处理
if (type === 'update') { if (type === 'update') {
@ -55,9 +55,7 @@ export default {
? objDeepCopy(item.default_value.id) ? objDeepCopy(item.default_value.id)
: '' : ''
} }
} else if (item.form_type == 'user' || } else if (
item.form_type == 'structure' ||
item.form_type == 'file' ||
item.form_type == 'user' || item.form_type == 'user' ||
item.form_type == 'structure' || item.form_type == 'structure' ||
item.form_type == 'file' item.form_type == 'file'
@ -73,9 +71,6 @@ export default {
if ( if (
item.form_type == 'number' || item.form_type == 'number' ||
item.form_type == 'floatnumber' || item.form_type == 'floatnumber' ||
item.form_type == 'percent' ||
item.form_type == 'number' ||
item.form_type == 'floatnumber' ||
item.form_type == 'percent' item.form_type == 'percent'
) { ) {
if (type == 'update') { if (type == 'update') {
@ -453,9 +448,9 @@ export default {
} }
return '' return ''
} else if (field.form_type == 'checkbox') { } else if (field.form_type == 'checkbox') {
if (isArray(dataValue)) { // if (isArray(dataValue)) {
return dataValue.join(',') // return dataValue.join(',')
} // }
return dataValue return dataValue
} else if (field.form_type == 'date') { } else if (field.form_type == 'date') {
if (dataValue) { if (dataValue) {
@ -506,11 +501,12 @@ export default {
for (let index = 0; index < fieldList.length; index++) { for (let index = 0; index < fieldList.length; index++) {
const field = fieldList[index] const field = fieldList[index]
const value = valueObj[field.field] const value = valueObj[field.field]
if (field.form_type === 'select' || field.form_type === 'checkbox') { // if (field.form_type === 'select' || field.form_type === 'checkbox') {
if (isObject(value) && !isEmpty(value.select)) { // if (isObject(value) && !isEmpty(value.select)) {
return false // return false
} // }
} else if (field.form_type === 'location') { // } else if (field.form_type === 'location') {
if (field.form_type === 'location') {
if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) { if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) {
return false return false
} }

@ -43,8 +43,10 @@
:key="index" :key="index"
:prop="field.fieldName" :prop="field.fieldName"
:label="field.name"> :label="field.name">
<template slot-scope="scope"> <template slot-scope="{ row, column }">
<div class="input-box" /> <div class="input-box" >
{{ row[column.property] }}
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right"> <el-table-column label="操作" fixed="right">
@ -115,9 +117,9 @@ export default {
fallbackClass: 'draggingStyle', fallbackClass: 'draggingStyle',
filter: '.empty-box' filter: '.empty-box'
}, },
selectedPoint: [null, null], selectedPoint: [null, null]
tableData: [{}] // tableData: [{}]
} }
}, },
computed: { computed: {
@ -129,9 +131,28 @@ export default {
}, },
list() { list() {
return this.isEmpty ? [] : this.field.fieldExtendList return this.isEmpty ? [] : this.field.fieldExtendList
},
tableData() {
const obj = {}
this.list.forEach(item => {
obj[item.fieldName] = this.formatterDefaultValue(item)
})
return [obj]
} }
}, },
methods: { methods: {
formatterDefaultValue(data) {
if (!data.default_value) return ''
if (data.form_type === 'boolean_value') {
return { '0': '不选中', '1': '选中' }[data.default_value] || '不选中'
} else if (data.form_type === 'datatime' || data.form_type === 'date_interval') {
return data.default_value.join('-')
} else if (data.form_type === 'checkbox') {
return data.default_value.join(',')
} else if (typeof data.default_value === 'string') {
return data.default_value
}
},
dragListEnd(evt) { dragListEnd(evt) {
// console.log('table drag list end', evt) // console.log('table drag list end', evt)
}, },
@ -204,7 +225,7 @@ export default {
width: 100%; width: 100%;
height: 30px; height: 30px;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
padding: 3px 0; padding: 3px 5px;
} }
.table-field { .table-field {

@ -86,7 +86,7 @@
import WkDistpicker from '@/components/NewCom/WkDistpicker' import WkDistpicker from '@/components/NewCom/WkDistpicker'
import { isEmpty, isArray } from '@/utils/types' import { isEmpty, isArray } from '@/utils/types'
import { regexIsCRMMobile, regexIsCRMEmail, objDeepCopy } from '@/utils' import { objDeepCopy } from '@/utils'
import { getFieldAuth } from '../../utils' import { getFieldAuth } from '../../utils'
export default { export default {
@ -217,64 +217,65 @@ export default {
methods: { methods: {
inputBlur() { inputBlur() {
// this.$emit('input', this.value) // this.$emit('input', this.value)
if (!this.field.default_value) return // if (!this.field.default_value) return
if (this.field.form_type === 'mobile') { // if (this.field.form_type === 'mobile') {
// // //
if (!regexIsCRMMobile(this.field.default_value)) { // if (!regexIsCRMMobile(this.field.default_value)) {
this.$message.error('输入的手机格式有误') // this.$message.error('')
this.field.default_value = '' // this.field.default_value = ''
} // }
} else if (this.field.form_type === 'email') { // } else if (this.field.form_type === 'email') {
// // //
if (!regexIsCRMEmail(this.field.default_value)) { // if (!regexIsCRMEmail(this.field.default_value)) {
this.$message.error('输入的邮箱格式有误') // this.$message.error('')
this.field.default_value = '' // this.field.default_value = ''
} // }
} else if (this.type === 'number') { // } else if (this.type === 'number') {
// // console.log(111)
const num = Number(this.field.default_value) // 0 // //
if (isNaN(num)) { // const num = Number(this.field.default_value) // 0
this.field.default_value = null // if (isNaN(num)) {
return // this.field.default_value = null
} // return
this.field.default_value = String(num) // }
const arr = String(num).split('.') // this.field.default_value = String(num)
// const arr = String(num).split('.')
const len = String(num) // const len = String(num)
.replace('.', '') // .replace('.', '')
.replace('-', '') // .replace('-', '')
.length // .length
const maxlength = this.field.form_type === 'percent' ? 10 : 15 // const maxlength = this.field.form_type === 'percent' ? 10 : 15
if (len > maxlength) { // if (len > maxlength) {
this.$message.error(`最多支持${maxlength}位数字(包含小数位)`) // this.$message.error(`${maxlength}`)
this.field.default_value = null // this.field.default_value = null
return // return
} // }
const min = isEmpty(this.field.minNumRestrict) ? -Infinity : Number(this.field.minNumRestrict || -Infinity) // const min = isEmpty(this.field.minNumRestrict) ? -Infinity : Number(this.field.minNumRestrict || -Infinity)
const max = isEmpty(this.field.maxNumRestrict) ? Infinity : Number(this.field.maxNumRestrict || Infinity) // const max = isEmpty(this.field.maxNumRestrict) ? Infinity : Number(this.field.maxNumRestrict || Infinity)
if (num < min) { // if (num < min) {
this.$message.error('默认值不能小于最小值') // this.$message.error('')
this.field.default_value = null // this.field.default_value = null
return // return
} // }
if (num > max) { // if (num > max) {
this.$message.error('默认值不能大于最大值') // this.$message.error('')
this.field.default_value = null // this.field.default_value = null
return // return
} // }
// null 0 // // null 0
if (isEmpty(this.field.precisions)) { // if (isEmpty(this.field.precisions)) {
this.field.default_value = arr[0] // this.field.default_value = arr[0]
return // return
} // }
if (this.field.precisions === 0) return // if (this.field.precisions === 0) return
if (arr.length > 1 && arr[1].length > Number(this.field.precisions)) { // if (arr.length > 1 && arr[1].length > Number(this.field.precisions)) {
this.$message.error(`默认值的小数位不能大于${this.field.precisions}`) // this.$message.error(`${this.field.precisions}`)
this.field.default_value = null // this.field.default_value = null
} // }
} // }
}, },
/** /**

@ -117,7 +117,7 @@
</div> </div>
<div <div
v-if="fieldAuth.uniqueEdit" v-if="fieldAuth.uniqueEdit && !['checkbox','file'].includes(field.form_type)"
class="item-check-section"> class="item-check-section">
<el-checkbox <el-checkbox
v-model="field.is_unique" v-model="field.is_unique"

@ -120,6 +120,7 @@ import Field from './field'
import FieldTypeLib from './fieldTypeLib' import FieldTypeLib from './fieldTypeLib'
import { objDeepCopy } from '@/utils/index' import { objDeepCopy } from '@/utils/index'
import { typeToComponent } from './utils' import { typeToComponent } from './utils'
import { regexIsCRMMobile, regexIsCRMEmail } from '@/utils'
export default { export default {
name: 'FieldsIndex', name: 'FieldsIndex',
@ -504,6 +505,7 @@ export default {
const copyField = objDeepCopy(field) const copyField = objDeepCopy(field)
delete copyField.field_id delete copyField.field_id
delete copyField.fieldName delete copyField.fieldName
delete copyField.field
delete copyField.relevant delete copyField.relevant
copyField.field_type = 0 copyField.field_type = 0
copyField.operating = 255 copyField.operating = 255
@ -734,6 +736,75 @@ export default {
if (item.hasOwnProperty('optionsData')) { if (item.hasOwnProperty('optionsData')) {
delete item.optionsData delete item.optionsData
} }
if (item.form_type === 'mobile' && item.default_value) {
//
if (!regexIsCRMMobile(item.default_value)) {
this.$message.error('输入的手机格式有误')
this.loading = false
return
}
}
if (item.form_type === 'email' && item.default_value) {
//
if (!regexIsCRMEmail(item.default_value)) {
this.$message.error('输入的邮箱格式有误')
this.loading = false
return
}
}
if (item.form_type === 'number' && item.default_value) {
//
const num = Number(item.default_value) // 0
if (isNaN(num)) {
this.$message.error('数字输入错误')
this.loading = false
return
}
item.default_value = String(num)
const arr = String(num).split('.')
const len = String(num)
.replace('.', '')
.replace('-', '')
.length
const maxlength = item.form_type === 'percent' ? 10 : 15
if (len > maxlength) {
this.$message.error(`最多支持${maxlength}位数字(包含小数位)`)
this.loading = false
return
}
const min = isEmpty(item.minNumRestrict) ? -Infinity : Number(item.minNumRestrict || -Infinity)
const max = isEmpty(item.maxNumRestrict) ? Infinity : Number(item.maxNumRestrict || Infinity)
if (num < min) {
this.$message.error('默认值不能小于最小值')
this.loading = false
return
}
if (num > max) {
this.$message.error('默认值不能大于最大值')
this.loading = false
return
}
// null 0
if (isEmpty(item.precisions)) {
this.loading = false
return
}
if (item.precisions === 0) return
if (arr.length > 1 && arr[1].length > Number(item.precisions)) {
this.$message.error(`默认值的小数位不能大于${item.precisions}`)
this.loading = false
return
}
}
} }
// //

@ -733,7 +733,7 @@ export default {
editClick(item) { editClick(item) {
let dataValue = objDeepCopy(this.allForm[item.fieldName]) let dataValue = objDeepCopy(this.allForm[item.fieldName])
// //
if (item.formType === 'detail_table' && isEmpty(dataValue)) { if (item.form_type === 'detail_table' && isEmpty(dataValue)) {
dataValue = this.getItemValue(objDeepCopy(item), null, 'update') dataValue = this.getItemValue(objDeepCopy(item), null, 'update')
} }
this.$set(this.editForm, item.fieldName, dataValue) this.$set(this.editForm, item.fieldName, dataValue)
@ -784,7 +784,7 @@ export default {
for (let index = 0; index < this.editFieldData.length; index++) { for (let index = 0; index < this.editFieldData.length; index++) {
const field = this.editFieldData[index] const field = this.editFieldData[index]
// //
if (field.formType !== 'desc_text' && (field.isEdit || !field.show)) { if (field.form_type !== 'desc_text' && (field.isEdit || !field.show)) {
list.push({ list.push({
fieldName: field.fieldName, fieldName: field.fieldName,
field: field.field, field: field.field,

@ -667,6 +667,24 @@ export default {
// start: new Date(o.value[0]).getTime() / 1000, // start: new Date(o.value[0]).getTime() / 1000,
// end: new Date(o.value[1]).getTime() / 1000 // end: new Date(o.value[1]).getTime() / 1000
}) })
} else if (
o.form_type == 'number' ||
o.form_type == 'floatnumber' ||
o.form_type == 'percent'
) {
let dataValues = []
if (o.type === 14) {
dataValues = [isEmpty(o.min) ? '' : o.min, isEmpty(o.max) ? '' : o.max]
} else {
dataValues = [o.value]
}
obj.push({
condition: o.condition,
form_type: o.form_type,
name: o.name,
type: o.field,
value: dataValues
})
} else if (o.form_type == 'business_type') { } else if (o.form_type == 'business_type') {
obj.push({ obj.push({
// condition: o.condition, // condition: o.condition,

Loading…
Cancel
Save