monkey 4 年前
父节点
当前提交
3b49fafe04

+ 12
- 6
src/components/NewCom/WkCheckbox/index.vue 查看文件

40
 </template>
40
 </template>
41
 
41
 
42
 <script>
42
 <script>
43
-import { isObject, isEmpty } from '@/utils/types'
43
+import { isObject, isEmpty, isArray } from '@/utils/types'
44
 import { valueEquals } from 'element-ui/lib/utils/util'
44
 import { valueEquals } from 'element-ui/lib/utils/util'
45
 import Emitter from 'element-ui/lib/mixins/emitter'
45
 import Emitter from 'element-ui/lib/mixins/emitter'
46
-
47
 export default {
46
 export default {
48
   // 自定义字段库 多选
47
   // 自定义字段库 多选
49
   name: 'WkCheckbox',
48
   name: 'WkCheckbox',
96
         this.validValue()
95
         this.validValue()
97
       },
96
       },
98
       immediate: true
97
       immediate: true
98
+    },
99
+    options: {
100
+      handler() {
101
+        this.validValue()
102
+      },
103
+      deep: true
99
     }
104
     }
100
   },
105
   },
101
 
106
 
118
         }
123
         }
119
       } else {
124
       } else {
120
         if (this.otherShowInput) {
125
         if (this.otherShowInput) {
121
-          const otherItem = this.value.filter((name) => !this.options.includes(name))
126
+          const value = isArray(this.value) ? this.value : []
127
+          const otherItem = value.filter((name) => !this.options.includes(name))
122
           if (otherItem.length > 0) {
128
           if (otherItem.length > 0) {
123
-            const newValue = this.value.filter((name) => !otherItem.includes(name))
129
+            const newValue = value.filter((name) => !otherItem.includes(name))
124
             newValue.push('其他')
130
             newValue.push('其他')
125
             this.dataValue = {
131
             this.dataValue = {
126
               select: newValue,
132
               select: newValue,
127
               otherValue: otherItem[otherItem.length - 1]
133
               otherValue: otherItem[otherItem.length - 1]
128
             }
134
             }
129
           } else {
135
           } else {
130
-            if (!valueEquals(this.value, this.dataValue.select)) {
136
+            if (!valueEquals(value, this.dataValue.select)) {
131
               this.dataValue = {
137
               this.dataValue = {
132
-                select: this.value,
138
+                select: value,
133
                 otherValue: ''
139
                 otherValue: ''
134
               }
140
               }
135
             }
141
             }

+ 23
- 2
src/components/NewCom/WkDepSelect/index.vue 查看文件

3
     v-elclickoutside="handleClose"
3
     v-elclickoutside="handleClose"
4
     ref="reference"
4
     ref="reference"
5
     :class="[disabled ? 'is_disabled' : 'is_valid', { 'is_focus': visible }]"
5
     :class="[disabled ? 'is_disabled' : 'is_valid', { 'is_focus': visible }]"
6
+    :style="{ height: `${height}px` }"
6
     wrap="wrap"
7
     wrap="wrap"
7
     class="wk-dep-select xh-form-border"
8
     class="wk-dep-select xh-form-border"
8
     @click="containerClick">
9
     @click="containerClick">
9
 
10
 
10
-    <div class="el-select__tags">
11
+    <div ref="tags" class="el-select__tags">
11
       <span
12
       <span
12
         v-for="(item, index) in showSelects"
13
         v-for="(item, index) in showSelects"
13
         :key="index"
14
         :key="index"
119
       visible: false,
120
       visible: false,
120
       dataValue: [], // 校准传入值
121
       dataValue: [], // 校准传入值
121
       loading: false,
122
       loading: false,
123
+      height: 34,
122
 
124
 
123
       optionsList: []
125
       optionsList: []
124
     }
126
     }
175
           this.$emit('input', this.dataValue)
177
           this.$emit('input', this.dataValue)
176
         }
178
         }
177
       }
179
       }
180
+    },
181
+    showSelects: {
182
+      handler() {
183
+        this.resetHeight()
184
+      },
185
+      immediate: true
178
     }
186
     }
179
   },
187
   },
180
 
188
 
183
   },
191
   },
184
 
192
 
185
   methods: {
193
   methods: {
194
+    resetHeight() {
195
+      const tags = this.$refs.tags
196
+      if (tags) {
197
+        this.$nextTick(() => {
198
+          this.height = tags.clientHeight > 34 ? tags.clientHeight + 6 : 34
199
+        })
200
+      } else {
201
+        this.height = 34
202
+      }
203
+    },
186
 
204
 
187
     /**
205
     /**
188
      * 获取展示的数组
206
      * 获取展示的数组
215
       }
233
       }
216
 
234
 
217
       if (this.radio && (Array.isArray(this.value) || this.value === null || this.value === undefined)) {
235
       if (this.radio && (Array.isArray(this.value) || this.value === null || this.value === undefined)) {
218
-        this.$emit('input', '')
236
+        // this.$emit('input', '')
219
       }
237
       }
220
 
238
 
221
       if (this.radio) {
239
       if (this.radio) {
318
       this.$nextTick(() => {
336
       this.$nextTick(() => {
319
         if (this.radio) {
337
         if (this.radio) {
320
           this.dispatch('ElFormItem', 'el.form.change', this.dataValue && this.dataValue.length ? this.dataValue[0] : '')
338
           this.dispatch('ElFormItem', 'el.form.change', this.dataValue && this.dataValue.length ? this.dataValue[0] : '')
339
+          this.$emit('input', this.dataValue && this.dataValue.length ? this.dataValue[0] : '')
321
         } else {
340
         } else {
322
           this.dispatch('ElFormItem', 'el.form.change', this.dataValue)
341
           this.dispatch('ElFormItem', 'el.form.change', this.dataValue)
342
+          this.$emit('input', this.dataValue)
323
         }
343
         }
324
         this.$emit('change', this.dataValue, this.selects)
344
         this.$emit('change', this.dataValue, this.selects)
325
       })
345
       })
358
     color: #ddd;
378
     color: #ddd;
359
     line-height: 34px;
379
     line-height: 34px;
360
     cursor: pointer;
380
     cursor: pointer;
381
+    user-select: none;
361
   }
382
   }
362
   .delete-icon {
383
   .delete-icon {
363
     color: #999;
384
     color: #999;

+ 10
- 10
src/components/NewCom/WkDetailTable/View.vue 查看文件

17
             <div
17
             <div
18
               v-if="getShowValue(item)"
18
               v-if="getShowValue(item)"
19
               :key="index"
19
               :key="index"
20
-              :class="[`is-${item.formType}`]"
20
+              :class="[`is-${item.form_type}`]"
21
               :label="item.name"
21
               :label="item.name"
22
               :style="{width: item.stylePercent ? `${item.stylePercent}%` : 'auto'}"
22
               :style="{width: item.stylePercent ? `${item.stylePercent}%` : 'auto'}"
23
               class="wk-form-item">
23
               class="wk-form-item">
24
               <div class="wk-form-item__label">{{ item.name }}</div>
24
               <div class="wk-form-item__label">{{ item.name }}</div>
25
               <wk-field-view
25
               <wk-field-view
26
                 :props="item"
26
                 :props="item"
27
-                :form-type="item.formType"
27
+                :form_type="item.form_type"
28
                 :value="fieldForm[sectionIndex][item.field]"
28
                 :value="fieldForm[sectionIndex][item.field]"
29
               >
29
               >
30
                 <template slot-scope="{ data }">
30
                 <template slot-scope="{ data }">
50
           :key="index"
50
           :key="index"
51
           :prop="item.field"
51
           :prop="item.field"
52
           :label="item.name"
52
           :label="item.name"
53
-          :min-width="getMinWidth(item.formType)">
53
+          :min-width="getMinWidth(item.form_type)">
54
           <template slot-scope="{ row, column, $index }">
54
           <template slot-scope="{ row, column, $index }">
55
             <wk-field-view
55
             <wk-field-view
56
               :props="item"
56
               :props="item"
57
-              :form-type="item.formType"
57
+              :form_type="item.form_type"
58
               :value="row[item.field]"
58
               :value="row[item.field]"
59
             >
59
             >
60
               <template slot-scope="{ data }">
60
               <template slot-scope="{ data }">
115
   beforeDestroy() {},
115
   beforeDestroy() {},
116
 
116
 
117
   methods: {
117
   methods: {
118
-    getMinWidth(formType) {
119
-      if (formType === 'date_interval' ||
120
-      formType === 'dateRange' ||
121
-       formType === 'file' ||
122
-       formType === 'location' ||
123
-       formType === 'position') {
118
+    getMinWidth(form_type) {
119
+      if (form_type === 'date_interval' ||
120
+      form_type === 'dateRange' ||
121
+       form_type === 'file' ||
122
+       form_type === 'location' ||
123
+       form_type === 'position') {
124
         return 250
124
         return 250
125
       }
125
       }
126
       return 150
126
       return 150

+ 127
- 12
src/components/NewCom/WkForm/GenerateRules.js 查看文件

8
   regexIsCRMMobile,
8
   regexIsCRMMobile,
9
   regexIsCRMEmail
9
   regexIsCRMEmail
10
 } from '@/utils'
10
 } from '@/utils'
11
-import { isEmpty } from '@/utils/types'
11
+import { isEmpty, isObject, isArray } from '@/utils/types'
12
 
12
 
13
 
13
 
14
 export default {
14
 export default {
41
           message: item.name + '不能为空',
41
           message: item.name + '不能为空',
42
           trigger: ['blur', 'change']
42
           trigger: ['blur', 'change']
43
         })
43
         })
44
+        if (item.form_type == 'detail_table') {
45
+          tempList.push({
46
+            validator: ({ item }, value, callback) => {
47
+              if (this.getDetailTableIsEmpty(item.fieldExtendList, value)) {
48
+                callback(new Error(item.name + '不能为空'))
49
+              } else {
50
+                callback()
51
+              }
52
+            },
53
+            item: item,
54
+            trigger: ['blur', 'change']
55
+          })
56
+        } else if (item.form_type == 'checkbox') {
57
+          tempList.push({
58
+            validator: ({ item }, value, callback) => {
59
+              if (!isArray(value) || value.length === 0) {
60
+                callback(new Error(item.name + '不能为空'))
61
+              } else {
62
+                const emptyObj = value.find(valueItem => isEmpty(valueItem))
63
+                emptyObj === '' ? callback(new Error(item.name + '不能为空')) : callback()
64
+              }
65
+            },
66
+            item: item,
67
+            trigger: ['blur', 'change']
68
+          })
69
+        }
44
       }
70
       }
45
 
71
 
46
       // 验证唯一
72
       // 验证唯一
65
           validator: validateUnique,
91
           validator: validateUnique,
66
           item: item,
92
           item: item,
67
           trigger:
93
           trigger:
68
-            item.formType == 'checkbox' || item.formType == 'select' || item.form_type == 'checkbox' || item.form_type == 'select'
94
+            item.form_type == 'checkbox' || item.form_type == 'select'
69
               ? ['change']
95
               ? ['change']
70
               : ['blur']
96
               : ['blur']
71
         })
97
         })
72
       }
98
       }
73
       // 特殊类型
99
       // 特殊类型
74
-      if (item.formType === 'number' || item.form_type === 'number') {
100
+      if (item.form_type === 'number' || item.form_type === 'percent') {
75
         const validateCRMNumber = (rule, value, callback) => {
101
         const validateCRMNumber = (rule, value, callback) => {
76
-          if (isEmpty(value) || regexIsCRMNumber(value)) {
77
-            callback()
102
+          if (item.hasOwnProperty('precisions')) {
103
+            this._getNumberRule(rule, value, callback)
78
           } else {
104
           } else {
79
-            callback(new Error('数字的整数部分须少于15位,小数部分须少于4位'))
105
+            if (isEmpty(value) || regexIsCRMNumber(value)) {
106
+              callback()
107
+            } else {
108
+              callback(new Error('数字的整数部分须少于15位,小数部分须少于4位'))
109
+            }
80
           }
110
           }
81
         }
111
         }
82
         tempList.push({
112
         tempList.push({
84
           item: item,
114
           item: item,
85
           trigger: ['blur']
115
           trigger: ['blur']
86
         })
116
         })
87
-      } else if (item.formType === 'floatnumber' || item.form_type === 'floatnumber') {
117
+      } else if (item.form_type === 'floatnumber') {
88
         const validateCRMMoneyNumber = (rule, value, callback) => {
118
         const validateCRMMoneyNumber = (rule, value, callback) => {
89
-          if (isEmpty(value) || regexIsCRMMoneyNumber(value)) {
90
-            callback()
119
+          if (item.hasOwnProperty('precisions')) {
120
+            this._getNumberRule(rule, value, callback)
91
           } else {
121
           } else {
92
-            callback(new Error('货币的整数部分须少于15位,小数部分须少于2位'))
122
+            if (isEmpty(value) || regexIsCRMMoneyNumber(value)) {
123
+              callback()
124
+            } else {
125
+              callback(new Error('货币的整数部分须少于15位,小数部分须少于2位'))
126
+            }
93
           }
127
           }
94
         }
128
         }
95
         tempList.push({
129
         tempList.push({
97
           item: item,
131
           item: item,
98
           trigger: ['blur']
132
           trigger: ['blur']
99
         })
133
         })
100
-      } else if (item.formType === 'mobile' || item.form_type === 'mobile') {
134
+      } else if (item.form_type === 'mobile') {
101
         const validateCRMMobile = (rule, value, callback) => {
135
         const validateCRMMobile = (rule, value, callback) => {
102
           if (isEmpty(value) || regexIsCRMMobile(value)) {
136
           if (isEmpty(value) || regexIsCRMMobile(value)) {
103
             callback()
137
             callback()
110
           item: item,
144
           item: item,
111
           trigger: ['blur']
145
           trigger: ['blur']
112
         })
146
         })
113
-      } else if (item.formType === 'email' || item.form_type === 'email') {
147
+      } else if (item.form_type === 'email') {
114
         const validateCRMEmail = (rule, value, callback) => {
148
         const validateCRMEmail = (rule, value, callback) => {
115
           if (isEmpty(value) || regexIsCRMEmail(value)) {
149
           if (isEmpty(value) || regexIsCRMEmail(value)) {
116
             callback()
150
             callback()
123
           item: item,
157
           item: item,
124
           trigger: ['blur']
158
           trigger: ['blur']
125
         })
159
         })
160
+      } else if (item.form_type === 'location' && item.is_null == 1) {
161
+        const validateLocation = (rule, value, callback) => {
162
+          if (!isObject(value) || (
163
+            isObject(value) && isEmpty(value.lat) && isEmpty(value.lng) && isEmpty(value.address)
164
+          )) {
165
+            callback(new Error(item.name + '不能为空'))
166
+          } else {
167
+            callback()
168
+          }
169
+        }
170
+        tempList.push({
171
+          validator: validateLocation,
172
+          item: item,
173
+          trigger: ['change']
174
+        })
126
       }
175
       }
127
 
176
 
128
       return tempList
177
       return tempList
178
+    },
179
+
180
+    /**
181
+     * 获取数值规则
182
+     */
183
+    _getNumberRule(rule, value, callback) {
184
+      const field = rule.item
185
+
186
+      const arr = String(value).split('.')
187
+
188
+      const len = String(value)
189
+        .replace('.', '')
190
+        .replace('-', '')
191
+        .length
192
+      const maxlength = field.form_type === 'percent' ? 10 : 15
193
+
194
+      const min = isEmpty(field.minNumRestrict) ? -Infinity : Number(field.minNumRestrict || -Infinity)
195
+      const max = isEmpty(field.maxNumRestrict) ? Infinity : Number(field.maxNumRestrict || Infinity)
196
+
197
+      if (len > maxlength) {
198
+        callback(new Error(`最多支持${maxlength}位数字(包含小数位)`))
199
+      } else if (isEmpty(field.precisions) && String(value).includes('.')) {
200
+        // null 不支持小数  0 不限制小数位
201
+        callback(new Error(`不支持小数`))
202
+      } else if (arr.length > 1 && arr[1].length > Number(field.precisions)) {
203
+        callback(new Error(`小数位不能大于${field.precisions}`))
204
+      } else if (value < min) {
205
+        callback(new Error(`不能小于${min}`))
206
+      } else if (value > max) {
207
+        callback(new Error(`不能大于${max}`))
208
+      } else {
209
+        callback()
210
+      }
211
+    },
212
+
213
+    /**
214
+     * 判断明细表格是否是空
215
+     * @param {*} fieldList
216
+     * @param {*} valueObj
217
+     */
218
+    getDetailTableIsEmpty(fieldList, valueObjs) {
219
+      for (let index = 0; index < valueObjs.length; index++) {
220
+        const valueObj = valueObjs[index]
221
+        if (this.judgeFormValueIsEmpty(fieldList, valueObj)) {
222
+          return true
223
+        }
224
+      }
225
+      return false
226
+    },
227
+
228
+    /**
229
+     * 判断对象值是否是空
230
+     */
231
+    judgeFormValueIsEmpty(fieldList, valueObj) {
232
+      for (let index = 0; index < fieldList.length; index++) {
233
+        const field = fieldList[index]
234
+        const value = valueObj[field.field]
235
+        if (field.form_type === 'location') {
236
+          if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) {
237
+            return false
238
+          }
239
+        } else if (!isEmpty(value)) {
240
+          return false
241
+        }
242
+      }
243
+      return true
129
     }
244
     }
130
   }
245
   }
131
 }
246
 }

+ 1
- 1
src/components/NewCom/WkForm/Mixin.js 查看文件

70
      * 获取提示语
70
      * 获取提示语
71
      */
71
      */
72
     getTips(data) {
72
     getTips(data) {
73
-      const tips = data.tips || data.inputTips
73
+      const tips = data.tips || data.input_tips
74
       return tips ? `(${tips})` : ''
74
       return tips ? `(${tips})` : ''
75
     },
75
     },
76
     /**
76
     /**

+ 8
- 0
src/components/NewCom/WkForm/WkFormItem.vue 查看文件

127
   padding: 12px 12px 0;
127
   padding: 12px 12px 0;
128
   margin-bottom: 0;
128
   margin-bottom: 0;
129
 }
129
 }
130
+.el-form-item.is-user {
131
+  display: flex ;
132
+  flex-direction: column ;
133
+}
134
+.el-form-item.is-structure {
135
+  display: flex;
136
+  flex-direction: column;
137
+}
130
 </style>
138
 </style>

+ 5
- 1
src/components/NewCom/WkForm/utils.js 查看文件

42
     if (isEmpty(newValue)) {
42
     if (isEmpty(newValue)) {
43
       return placeholder
43
       return placeholder
44
     } else {
44
     } else {
45
-      return newValue
45
+      if (isArray(newValue)) {
46
+        return newValue.join(',')
47
+      } else {
48
+        return newValue
49
+      }
46
     }
50
     }
47
   } else if (form_type === 'structure') {
51
   } else if (form_type === 'structure') {
48
     if (isArray(value)) {
52
     if (isArray(value)) {

+ 1
- 16
src/components/XrUpgradeDialog.vue 查看文件

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

+ 2
- 2
src/config.js 查看文件

3
 }
3
 }
4
 
4
 
5
 const companyName = '悟空CRM'
5
 const companyName = '悟空CRM'
6
-const version = 'V11.1.0'
7
-const baiduKey = 'lcuOQ71SCZhqpxsr1vL2mXoplWEoVctL'
6
+const version = 'V11.1.1'
7
+const baiduKey = '百度key'
8
 
8
 
9
 export default {
9
 export default {
10
   version,
10
   version,

+ 19
- 23
src/mixins/CustomFields.js 查看文件

17
      */
17
      */
18
     getItemValue(item, detail, type) {
18
     getItemValue(item, detail, type) {
19
       detail = detail || {}
19
       detail = detail || {}
20
-      if ((item.form_type || item.form_type) == 'contacts' ||
21
-          (item.form_type || item.form_type) == 'customer' ||
22
-          (item.form_type || item.form_type) == 'contract' ||
23
-          (item.form_type || item.form_type) == 'business'
20
+      if (item.form_type == 'contacts' ||
21
+          item.form_type == 'customer' ||
22
+          item.form_type == 'contract' ||
23
+          item.form_type == 'business'
24
       ) {
24
       ) {
25
         // crm相关信息特殊处理
25
         // crm相关信息特殊处理
26
         if (type === 'update') {
26
         if (type === 'update') {
55
             ? objDeepCopy(item.default_value.id)
55
             ? objDeepCopy(item.default_value.id)
56
             : ''
56
             : ''
57
         }
57
         }
58
-      } else if (item.form_type == 'user' ||
59
-            item.form_type == 'structure' ||
60
-            item.form_type == 'file' ||
61
-            item.form_type == 'user' ||
62
-            item.form_type == 'structure' ||
63
-            item.form_type == 'file'
58
+      } else if (
59
+        item.form_type == 'user' ||
60
+        item.form_type == 'structure' ||
61
+        item.form_type == 'file'
64
       ) {
62
       ) {
65
         if (type === 'update') {
63
         if (type === 'update') {
66
           return item.value ? objDeepCopy(item.value) : []
64
           return item.value ? objDeepCopy(item.value) : []
72
       } else {
70
       } else {
73
         if (
71
         if (
74
           item.form_type == 'number' ||
72
           item.form_type == 'number' ||
75
-        item.form_type == 'floatnumber' ||
76
-        item.form_type == 'percent' ||
77
-        item.form_type == 'number' ||
78
-        item.form_type == 'floatnumber' ||
79
-        item.form_type == 'percent'
73
+          item.form_type == 'floatnumber' ||
74
+          item.form_type == 'percent'
80
         ) {
75
         ) {
81
           if (type == 'update') {
76
           if (type == 'update') {
82
             return isEmpty(item.value) ? undefined : item.value
77
             return isEmpty(item.value) ? undefined : item.value
453
         }
448
         }
454
         return ''
449
         return ''
455
       } else if (field.form_type == 'checkbox') {
450
       } else if (field.form_type == 'checkbox') {
456
-        if (isArray(dataValue)) {
457
-          return dataValue.join(',')
458
-        }
451
+        // if (isArray(dataValue)) {
452
+        //   return dataValue.join(',')
453
+        // }
459
         return dataValue
454
         return dataValue
460
       } else if (field.form_type == 'date') {
455
       } else if (field.form_type == 'date') {
461
         if (dataValue) {
456
         if (dataValue) {
506
       for (let index = 0; index < fieldList.length; index++) {
501
       for (let index = 0; index < fieldList.length; index++) {
507
         const field = fieldList[index]
502
         const field = fieldList[index]
508
         const value = valueObj[field.field]
503
         const value = valueObj[field.field]
509
-        if (field.form_type === 'select' || field.form_type === 'checkbox') {
510
-          if (isObject(value) && !isEmpty(value.select)) {
511
-            return false
512
-          }
513
-        } else if (field.form_type === 'location') {
504
+        // if (field.form_type === 'select' || field.form_type === 'checkbox') {
505
+        //   if (isObject(value) && !isEmpty(value.select)) {
506
+        //     return false
507
+        //   }
508
+        // } else if (field.form_type === 'location') {
509
+        if (field.form_type === 'location') {
514
           if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) {
510
           if (isObject(value) && (!isEmpty(value.lat) || !isEmpty(value.lng) || !isEmpty(value.address))) {
515
             return false
511
             return false
516
           }
512
           }

+ 26
- 5
src/views/admin/fields/components/FieldItem/FieldDetailTable.vue 查看文件

43
               :key="index"
43
               :key="index"
44
               :prop="field.fieldName"
44
               :prop="field.fieldName"
45
               :label="field.name">
45
               :label="field.name">
46
-              <template slot-scope="scope">
47
-                <div class="input-box" />
46
+              <template slot-scope="{ row, column }">
47
+                <div class="input-box" >
48
+                  {{ row[column.property] }}
49
+                </div>
48
               </template>
50
               </template>
49
             </el-table-column>
51
             </el-table-column>
50
             <el-table-column label="操作" fixed="right">
52
             <el-table-column label="操作" fixed="right">
115
         fallbackClass: 'draggingStyle',
117
         fallbackClass: 'draggingStyle',
116
         filter: '.empty-box'
118
         filter: '.empty-box'
117
       },
119
       },
118
-      selectedPoint: [null, null],
120
+      selectedPoint: [null, null]
119
 
121
 
120
-      tableData: [{}]
122
+      // tableData: [{}]
121
     }
123
     }
122
   },
124
   },
123
   computed: {
125
   computed: {
129
     },
131
     },
130
     list() {
132
     list() {
131
       return this.isEmpty ? [] : this.field.fieldExtendList
133
       return this.isEmpty ? [] : this.field.fieldExtendList
134
+    },
135
+    tableData() {
136
+      const obj = {}
137
+      this.list.forEach(item => {
138
+        obj[item.fieldName] = this.formatterDefaultValue(item)
139
+      })
140
+      return [obj]
132
     }
141
     }
133
   },
142
   },
134
   methods: {
143
   methods: {
144
+    formatterDefaultValue(data) {
145
+      if (!data.default_value) return ''
146
+      if (data.form_type === 'boolean_value') {
147
+        return { '0': '不选中', '1': '选中' }[data.default_value] || '不选中'
148
+      } else if (data.form_type === 'datatime' || data.form_type === 'date_interval') {
149
+        return data.default_value.join('-')
150
+      } else if (data.form_type === 'checkbox') {
151
+        return data.default_value.join(',')
152
+      } else if (typeof data.default_value === 'string') {
153
+        return data.default_value
154
+      }
155
+    },
135
     dragListEnd(evt) {
156
     dragListEnd(evt) {
136
       // console.log('table drag list end', evt)
157
       // console.log('table drag list end', evt)
137
     },
158
     },
204
     width: 100%;
225
     width: 100%;
205
     height: 30px;
226
     height: 30px;
206
     border: 1px solid #dcdfe6;
227
     border: 1px solid #dcdfe6;
207
-    padding: 3px 0;
228
+    padding: 3px 5px;
208
   }
229
   }
209
 
230
 
210
   .table-field {
231
   .table-field {

+ 57
- 56
src/views/admin/fields/components/SettingField/SettingDefault.vue 查看文件

86
 import WkDistpicker from '@/components/NewCom/WkDistpicker'
86
 import WkDistpicker from '@/components/NewCom/WkDistpicker'
87
 
87
 
88
 import { isEmpty, isArray } from '@/utils/types'
88
 import { isEmpty, isArray } from '@/utils/types'
89
-import { regexIsCRMMobile, regexIsCRMEmail, objDeepCopy } from '@/utils'
89
+import { objDeepCopy } from '@/utils'
90
 import { getFieldAuth } from '../../utils'
90
 import { getFieldAuth } from '../../utils'
91
 
91
 
92
 export default {
92
 export default {
217
   methods: {
217
   methods: {
218
     inputBlur() {
218
     inputBlur() {
219
       // this.$emit('input', this.value)
219
       // this.$emit('input', this.value)
220
-      if (!this.field.default_value) return
221
-      if (this.field.form_type === 'mobile') {
222
-        // 校验手机号
223
-        if (!regexIsCRMMobile(this.field.default_value)) {
224
-          this.$message.error('输入的手机格式有误')
225
-          this.field.default_value = ''
226
-        }
227
-      } else if (this.field.form_type === 'email') {
228
-        // 校验邮箱
229
-        if (!regexIsCRMEmail(this.field.default_value)) {
230
-          this.$message.error('输入的邮箱格式有误')
231
-          this.field.default_value = ''
232
-        }
233
-      } else if (this.type === 'number') {
234
-        // 校验数字类型
235
-        const num = Number(this.field.default_value) // 去0
236
-        if (isNaN(num)) {
237
-          this.field.default_value = null
238
-          return
239
-        }
240
-        this.field.default_value = String(num)
241
-        const arr = String(num).split('.')
220
+      // if (!this.field.default_value) return
221
+      // if (this.field.form_type === 'mobile') {
222
+      //   // 校验手机号
223
+      //   if (!regexIsCRMMobile(this.field.default_value)) {
224
+      //     this.$message.error('输入的手机格式有误')
225
+      //     this.field.default_value = ''
226
+      //   }
227
+      // } else if (this.field.form_type === 'email') {
228
+      //   // 校验邮箱
229
+      //   if (!regexIsCRMEmail(this.field.default_value)) {
230
+      //     this.$message.error('输入的邮箱格式有误')
231
+      //     this.field.default_value = ''
232
+      //   }
233
+      // } else if (this.type === 'number') {
234
+      //   console.log(111)
235
+      //   // 校验数字类型
236
+      //   const num = Number(this.field.default_value) // 去0
237
+      //   if (isNaN(num)) {
238
+      //     this.field.default_value = null
239
+      //     return
240
+      //   }
241
+      //   this.field.default_value = String(num)
242
+      //   const arr = String(num).split('.')
242
 
243
 
243
-        const len = String(num)
244
-          .replace('.', '')
245
-          .replace('-', '')
246
-          .length
247
-        const maxlength = this.field.form_type === 'percent' ? 10 : 15
248
-        if (len > maxlength) {
249
-          this.$message.error(`最多支持${maxlength}位数字(包含小数位)`)
250
-          this.field.default_value = null
251
-          return
252
-        }
244
+      //   const len = String(num)
245
+      //     .replace('.', '')
246
+      //     .replace('-', '')
247
+      //     .length
248
+      //   const maxlength = this.field.form_type === 'percent' ? 10 : 15
249
+      //   if (len > maxlength) {
250
+      //     this.$message.error(`最多支持${maxlength}位数字(包含小数位)`)
251
+      //     this.field.default_value = null
252
+      //     return
253
+      //   }
253
 
254
 
254
-        const min = isEmpty(this.field.minNumRestrict) ? -Infinity : Number(this.field.minNumRestrict || -Infinity)
255
-        const max = isEmpty(this.field.maxNumRestrict) ? Infinity : Number(this.field.maxNumRestrict || Infinity)
256
-        if (num < min) {
257
-          this.$message.error('默认值不能小于最小值')
258
-          this.field.default_value = null
259
-          return
260
-        }
261
-        if (num > max) {
262
-          this.$message.error('默认值不能大于最大值')
263
-          this.field.default_value = null
264
-          return
265
-        }
255
+      //   const min = isEmpty(this.field.minNumRestrict) ? -Infinity : Number(this.field.minNumRestrict || -Infinity)
256
+      //   const max = isEmpty(this.field.maxNumRestrict) ? Infinity : Number(this.field.maxNumRestrict || Infinity)
257
+      //   if (num < min) {
258
+      //     this.$message.error('默认值不能小于最小值')
259
+      //     this.field.default_value = null
260
+      //     return
261
+      //   }
262
+      //   if (num > max) {
263
+      //     this.$message.error('默认值不能大于最大值')
264
+      //     this.field.default_value = null
265
+      //     return
266
+      //   }
266
 
267
 
267
-        // null 不支持小数  0 不限制小数位
268
-        if (isEmpty(this.field.precisions)) {
269
-          this.field.default_value = arr[0]
270
-          return
271
-        }
272
-        if (this.field.precisions === 0) return
273
-        if (arr.length > 1 && arr[1].length > Number(this.field.precisions)) {
274
-          this.$message.error(`默认值的小数位不能大于${this.field.precisions}`)
275
-          this.field.default_value = null
276
-        }
277
-      }
268
+      //   // null 不支持小数  0 不限制小数位
269
+      //   if (isEmpty(this.field.precisions)) {
270
+      //     this.field.default_value = arr[0]
271
+      //     return
272
+      //   }
273
+      //   if (this.field.precisions === 0) return
274
+      //   if (arr.length > 1 && arr[1].length > Number(this.field.precisions)) {
275
+      //     this.$message.error(`默认值的小数位不能大于${this.field.precisions}`)
276
+      //     this.field.default_value = null
277
+      //   }
278
+      // }
278
     },
279
     },
279
 
280
 
280
     /**
281
     /**

+ 1
- 1
src/views/admin/fields/components/SettingField/index.vue 查看文件

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

+ 71
- 0
src/views/admin/fields/index.vue 查看文件

120
 import FieldTypeLib from './fieldTypeLib'
120
 import FieldTypeLib from './fieldTypeLib'
121
 import { objDeepCopy } from '@/utils/index'
121
 import { objDeepCopy } from '@/utils/index'
122
 import { typeToComponent } from './utils'
122
 import { typeToComponent } from './utils'
123
+import { regexIsCRMMobile, regexIsCRMEmail } from '@/utils'
123
 
124
 
124
 export default {
125
 export default {
125
   name: 'FieldsIndex',
126
   name: 'FieldsIndex',
504
       const copyField = objDeepCopy(field)
505
       const copyField = objDeepCopy(field)
505
       delete copyField.field_id
506
       delete copyField.field_id
506
       delete copyField.fieldName
507
       delete copyField.fieldName
508
+      delete copyField.field
507
       delete copyField.relevant
509
       delete copyField.relevant
508
       copyField.field_type = 0
510
       copyField.field_type = 0
509
       copyField.operating = 255
511
       copyField.operating = 255
734
         if (item.hasOwnProperty('optionsData')) {
736
         if (item.hasOwnProperty('optionsData')) {
735
           delete item.optionsData
737
           delete item.optionsData
736
         }
738
         }
739
+
740
+        if (item.form_type === 'mobile' && item.default_value) {
741
+        // 校验手机号
742
+          if (!regexIsCRMMobile(item.default_value)) {
743
+            this.$message.error('输入的手机格式有误')
744
+            this.loading = false
745
+            return
746
+          }
747
+        }
748
+        if (item.form_type === 'email' && item.default_value) {
749
+        // 校验邮箱
750
+          if (!regexIsCRMEmail(item.default_value)) {
751
+            this.$message.error('输入的邮箱格式有误')
752
+
753
+            this.loading = false
754
+            return
755
+          }
756
+        }
757
+        if (item.form_type === 'number' && item.default_value) {
758
+          // 校验数字类型
759
+          const num = Number(item.default_value) // 去0
760
+          if (isNaN(num)) {
761
+            this.$message.error('数字输入错误')
762
+            this.loading = false
763
+            return
764
+          }
765
+          item.default_value = String(num)
766
+          const arr = String(num).split('.')
767
+
768
+          const len = String(num)
769
+            .replace('.', '')
770
+            .replace('-', '')
771
+            .length
772
+          const maxlength = item.form_type === 'percent' ? 10 : 15
773
+          if (len > maxlength) {
774
+            this.$message.error(`最多支持${maxlength}位数字(包含小数位)`)
775
+
776
+            this.loading = false
777
+            return
778
+          }
779
+
780
+          const min = isEmpty(item.minNumRestrict) ? -Infinity : Number(item.minNumRestrict || -Infinity)
781
+          const max = isEmpty(item.maxNumRestrict) ? Infinity : Number(item.maxNumRestrict || Infinity)
782
+          if (num < min) {
783
+            this.$message.error('默认值不能小于最小值')
784
+
785
+            this.loading = false
786
+            return
787
+          }
788
+          if (num > max) {
789
+            this.$message.error('默认值不能大于最大值')
790
+
791
+            this.loading = false
792
+            return
793
+          }
794
+
795
+          // null 不支持小数  0 不限制小数位
796
+          if (isEmpty(item.precisions)) {
797
+            this.loading = false
798
+            return
799
+          }
800
+          if (item.precisions === 0) return
801
+          if (arr.length > 1 && arr[1].length > Number(item.precisions)) {
802
+            this.$message.error(`默认值的小数位不能大于${item.precisions}`)
803
+
804
+            this.loading = false
805
+            return
806
+          }
807
+        }
737
       }
808
       }
738
 
809
 
739
       // 请求参数
810
       // 请求参数

+ 2
- 2
src/views/crm/components/CRMEditBaseInfo.vue 查看文件

733
     editClick(item) {
733
     editClick(item) {
734
       let dataValue = objDeepCopy(this.allForm[item.fieldName])
734
       let dataValue = objDeepCopy(this.allForm[item.fieldName])
735
       // 明细表格是空时,需要填充一条空数据,展示时未处理。这里增加
735
       // 明细表格是空时,需要填充一条空数据,展示时未处理。这里增加
736
-      if (item.formType === 'detail_table' && isEmpty(dataValue)) {
736
+      if (item.form_type === 'detail_table' && isEmpty(dataValue)) {
737
         dataValue = this.getItemValue(objDeepCopy(item), null, 'update')
737
         dataValue = this.getItemValue(objDeepCopy(item), null, 'update')
738
       }
738
       }
739
       this.$set(this.editForm, item.fieldName, dataValue)
739
       this.$set(this.editForm, item.fieldName, dataValue)
784
       for (let index = 0; index < this.editFieldData.length; index++) {
784
       for (let index = 0; index < this.editFieldData.length; index++) {
785
         const field = this.editFieldData[index]
785
         const field = this.editFieldData[index]
786
         // 获取当前编辑 和 隐藏的字段
786
         // 获取当前编辑 和 隐藏的字段
787
-        if (field.formType !== 'desc_text' && (field.isEdit || !field.show)) {
787
+        if (field.form_type !== 'desc_text' && (field.isEdit || !field.show)) {
788
           list.push({
788
           list.push({
789
             fieldName: field.fieldName,
789
             fieldName: field.fieldName,
790
             field: field.field,
790
             field: field.field,

+ 18
- 0
src/views/crm/components/FilterForm/index.vue 查看文件

667
             // start: new Date(o.value[0]).getTime() / 1000,
667
             // start: new Date(o.value[0]).getTime() / 1000,
668
             // end: new Date(o.value[1]).getTime() / 1000
668
             // end: new Date(o.value[1]).getTime() / 1000
669
           })
669
           })
670
+        } else if (
671
+          o.form_type == 'number' ||
672
+          o.form_type == 'floatnumber' ||
673
+          o.form_type == 'percent'
674
+        ) {
675
+          let dataValues = []
676
+          if (o.type === 14) {
677
+            dataValues = [isEmpty(o.min) ? '' : o.min, isEmpty(o.max) ? '' : o.max]
678
+          } else {
679
+            dataValues = [o.value]
680
+          }
681
+          obj.push({
682
+            condition: o.condition,
683
+            form_type: o.form_type,
684
+            name: o.name,
685
+            type: o.field,
686
+            value: dataValues
687
+          })
670
         } else if (o.form_type == 'business_type') {
688
         } else if (o.form_type == 'business_type') {
671
           obj.push({
689
           obj.push({
672
             // condition: o.condition,
690
             // condition: o.condition,