bri-components 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/lib/0.bri-components.min.js +1 -1
  2. package/lib/1.bri-components.min.js +1 -1
  3. package/lib/2.bri-components.min.js +1 -1
  4. package/lib/3.bri-components.min.js +1 -1
  5. package/lib/4.bri-components.min.js +1 -1
  6. package/lib/5.bri-components.min.js +1 -1
  7. package/lib/6.bri-components.min.js +1 -1
  8. package/lib/7.bri-components.min.js +1 -0
  9. package/lib/8.bri-components.min.js +1 -0
  10. package/lib/9.bri-components.min.js +1 -0
  11. package/lib/bri-components.min.js +13 -5
  12. package/lib/styles/bundle.css +0 -2
  13. package/package.json +2 -1
  14. package/src/components/controls/base/BriLabels.vue +117 -0
  15. package/src/components/controls/base/DshCascader.vue +23 -38
  16. package/src/components/controls/base/DshCascaderMultiple.vue +1 -1
  17. package/src/components/controls/base/DshCheckbox.vue +14 -4
  18. package/src/components/controls/base/DshCoordinates.vue +5 -9
  19. package/src/components/controls/base/DshDate.vue +10 -34
  20. package/src/components/controls/base/DshDivider.vue +1 -1
  21. package/src/components/controls/base/DshEditor.vue +52 -44
  22. package/src/components/controls/base/DshInput.vue +18 -45
  23. package/src/components/controls/base/DshLabels.vue +8 -4
  24. package/src/components/controls/base/DshNumber/DshNumber.vue +6 -20
  25. package/src/components/controls/base/DshNumberange.vue +1 -1
  26. package/src/components/controls/base/DshPackage.vue +7 -1
  27. package/src/components/controls/base/DshSelect.vue +15 -5
  28. package/src/components/controls/base/DshSwitch.vue +2 -6
  29. package/src/components/controls/base/YSerialNumber.vue +0 -1
  30. package/src/components/controls/base/ZUpload/index.vue +16 -10
  31. package/src/components/controls/base/ZUpload/upload-list.vue +17 -12
  32. package/src/components/controls/base/ZUpload/uploadMixin.js +1 -5
  33. package/src/components/controls/base/controlShow.vue +52 -0
  34. package/src/components/controls/base/textMultiple/DshTextMultiple.vue +1 -1
  35. package/src/components/controls/controlMap.js +4 -0
  36. package/src/components/controls/controlMixin.js +18 -12
  37. package/src/components/controls/senior/cascaderTable.vue +188 -0
  38. package/src/components/controls/senior/flatTable.vue +131 -0
  39. package/src/components/form/DshForm.vue +0 -3
  40. package/src/components/list/BriFlatTable.vue +430 -0
  41. package/src/components/list/BriTable.vue +184 -0
  42. package/src/components/list/DshBox/DshPanel.vue +4 -9
  43. package/src/components/list/DshBox/DshTable.vue +29 -39
  44. package/src/components/list/DshCascaderTable.vue +6 -11
  45. package/src/components/other/BriTransfer.vue +71 -0
  46. package/src/components/small/BriButton.vue +65 -0
  47. package/src/components/small/BriTree.vue +42 -0
  48. package/src/components/small/Ctooltip.vue +1 -1
  49. package/src/components/small/DshButtons.vue +12 -42
  50. package/src/components/unit/DshFormItem.vue +0 -2
  51. package/src/components/unit/DshUnit.vue +1 -1
  52. package/src/components/unit/unitMixin.js +4 -1
  53. package/src/index.js +24 -4
  54. package/src/styles/bundle.css +0 -2
  55. package/src/styles/common/common.less +2 -2
  56. package/src/styles/common/control.less +53 -0
  57. package/src/styles/common/index.less +1 -0
  58. package/src/styles/components/controls/BriLabels.less +23 -0
  59. package/src/styles/components/controls/DshCascader.less +3 -3
  60. package/src/styles/components/controls/DshCheckbox.less +1 -1
  61. package/src/styles/components/controls/DshCoordinates.less +3 -3
  62. package/src/styles/components/controls/DshDate.less +54 -0
  63. package/src/styles/components/controls/DshDaterange.less +1 -1
  64. package/src/styles/components/controls/DshEditor.less +27 -9
  65. package/src/styles/components/controls/DshInput.less +5 -5
  66. package/src/styles/components/controls/DshLabels.less +1 -1
  67. package/src/styles/components/controls/DshSelect.less +46 -30
  68. package/src/styles/components/controls/ZUpload.less +82 -91
  69. package/src/styles/components/controls/cascaderTable.less +33 -0
  70. package/src/styles/components/controls/controlShow.less +12 -0
  71. package/src/styles/components/controls/flatTable.less +33 -0
  72. package/src/styles/components/form/DshAdvSearchForm.less +6 -6
  73. package/src/styles/components/index.less +10 -0
  74. package/src/styles/components/list/BriFlatTable.less +8 -0
  75. package/src/styles/components/list/BriTable.less +155 -0
  76. package/src/styles/components/list/DshFlatTable.less +3 -8
  77. package/src/styles/components/list/evTable.less +1 -1
  78. package/src/styles/components/other/BriTransfer.less +65 -0
  79. package/src/styles/components/other/DshEditPanel.less +2 -2
  80. package/src/styles/components/other/DshMenuNav.less +5 -5
  81. package/src/styles/components/other/ZGantt.less +5 -5
  82. package/src/styles/components/small/BriButton.less +259 -0
  83. package/src/styles/components/small/BriTree.less +57 -0
  84. package/src/styles/components/small/Ctooltip.less +14 -0
  85. package/src/styles/components/small/DshButtons.less +1 -1
  86. package/src/styles/components/small/DshControlDefine.less +2 -2
  87. package/src/styles/components/small/DshDropdown.less +1 -1
  88. package/src/styles/components/small/DshPage.less +1 -1
  89. package/src/styles/components/small/DshTabs.less +2 -2
  90. package/src/styles/components/unit/DshFormItem.less +5 -6
  91. package/src/styles/index.less +1 -5
  92. package/src/styles/plugin/easytable.less +22 -0
  93. package/src/styles/plugin/index.less +2 -0
  94. package/src/styles/plugin/iview.less +33 -0
  95. package/src/styles/variables.less +71 -88
  96. package/src/utils/table.js +72 -978
  97. package/src/styles/define.less +0 -374
  98. package/src/styles/view_reset.less +0 -452
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <div class="flatTable">
3
+ <span v-if="isUnit" class="flatTable-unit">
4
+ <dsh-icons
5
+ :list="$getOperationList(['link'])"
6
+ ></dsh-icons>
7
+ <span class="flatTable-unit-text">
8
+ {{ val.list.length || 0 }}行
9
+ </span>
10
+ </span>
11
+
12
+ <!-- 设置默认值所用的控件 -->
13
+ <dsh-btn-modal v-else-if="propsObj._key === '_default'">
14
+ <bri-flat-table
15
+ :canEdit="finalCanEdit"
16
+ :columns="columns"
17
+ :data="val.list"
18
+ :rowDefault="val.rowDefault"
19
+ :propsObj="propsObj"
20
+ @change="change"
21
+ ></bri-flat-table>
22
+ </dsh-btn-modal>
23
+
24
+ <!-- 操作按钮 -->
25
+ <template v-else>
26
+ <dsh-buttons
27
+ class="flatTable-btns"
28
+ itemClass="flatTable-btns-item"
29
+ :list="$getOperationList(['canEnlarge'])"
30
+ @click="$dispatchEvent($event)"
31
+ ></dsh-buttons>
32
+
33
+ <bri-flat-table
34
+ ref="dshFatTable"
35
+ :canEdit="finalCanEdit"
36
+ :columns="columns"
37
+ :data="val.list"
38
+ :oldData="val.oldList"
39
+ :rowDefault="val.rowDefault"
40
+ :isShare="isShare"
41
+ :propsObj="propsObj"
42
+ @change="change"
43
+ ></bri-flat-table>
44
+
45
+ <dsh-modal
46
+ v-model="isEnlarge"
47
+ mode="custom"
48
+ :propsObj="modalPropsObj"
49
+ >
50
+ <bri-flat-table
51
+ v-if="value[controlKey] && isEnlarge"
52
+ :canEdit="finalCanEdit"
53
+ :columns="columns"
54
+ :data="val.list"
55
+ :oldData="val.oldList"
56
+ :rowDefault="val.rowDefault"
57
+ :isShare="isShare"
58
+ :propsObj="propsObj"
59
+ @change="change"
60
+ ></bri-flat-table>
61
+ </dsh-modal>
62
+ </template>
63
+ </div>
64
+ </template>
65
+
66
+ <script>
67
+ import controlMixin from "../controlMixin.js";
68
+
69
+ export default {
70
+ name: "flatTable",
71
+ mixins: [controlMixin],
72
+ components: {},
73
+ props: {
74
+ },
75
+ data () {
76
+ return {
77
+ operationMap: {
78
+ canEnlarge: {
79
+ name: "全屏展示",
80
+ type: "canEnlarge",
81
+ icon: "md-expand",
82
+ size: "small",
83
+ btnType: "text",
84
+ event: "enlarge"
85
+ },
86
+ link: {
87
+ customIcon: "bico-internaltable"
88
+ }
89
+ },
90
+ isEnlarge: false
91
+ };
92
+ },
93
+ computed: {
94
+ modalPropsObj () {
95
+ return {
96
+ title: this.propsObj._name,
97
+ fullscreen: true,
98
+ showSlotClose: false,
99
+ closable: true
100
+ };
101
+ },
102
+ val () {
103
+ // TODOS: 待定处理
104
+ return this.value[this.controlKey] || {
105
+ list: [],
106
+ oldList: [],
107
+ rowDefault: {}
108
+ };
109
+ },
110
+ columns () {
111
+ return this.propsObj._subForm;
112
+ }
113
+ },
114
+ created () {},
115
+ methods: {
116
+ // 校验方法 -供外部使用
117
+ validate () {
118
+ return this.$refs.dshFatTable.validate();
119
+ },
120
+
121
+ change (...params) {
122
+ this.$emit("change", ...params);
123
+ },
124
+
125
+ // 打开全屏模态框
126
+ enlarge () {
127
+ this.isEnlarge = true;
128
+ }
129
+ }
130
+ };
131
+ </script>
@@ -22,7 +22,6 @@
22
22
  >
23
23
  <dsh-formItem
24
24
  ref="dshFormItem"
25
- :mode="mode"
26
25
  :canEdit="canEdit"
27
26
  :formData="formData"
28
27
  :formItem="formItem"
@@ -38,7 +37,6 @@
38
37
  @changeField="changeField"
39
38
  >
40
39
  <slot
41
- :mode="mode"
42
40
  :canEdit="canEdit"
43
41
  :formItem="formItem"
44
42
  :formData="formData"
@@ -97,7 +95,6 @@
97
95
  name: "DshForm",
98
96
  components: {},
99
97
  props: {
100
- mode: String,
101
98
  canEdit: {
102
99
  type: Boolean,
103
100
  default: true
@@ -0,0 +1,430 @@
1
+ <template>
2
+ <div class="BriFlatTable">
3
+ <bri-table
4
+ class="BriFlatTable-main"
5
+ :propsObj="tablePropsObj"
6
+ :columns="showColumns"
7
+ :data="listData"
8
+ :footer-data="footerData"
9
+ @selectChange="changeSelect"
10
+ @selectAll="changeSelect"
11
+ ></bri-table>
12
+
13
+ <!-- 添加行 -->
14
+ <dsh-buttons
15
+ class="BriFlatTable-create"
16
+ :list="$getOperationList(['create'])"
17
+ @click="$dispatchEvent($event, null, null, listData)"
18
+ ></dsh-buttons>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: "BriFlatTable",
25
+ props: {
26
+ canEdit: {
27
+ type: Boolean,
28
+ default: true
29
+ },
30
+ columns: {
31
+ type: Array,
32
+ default () {
33
+ return [];
34
+ }
35
+ },
36
+ data: {
37
+ type: Array,
38
+ default () {
39
+ return [];
40
+ }
41
+ },
42
+ oldData: {
43
+ type: Array,
44
+ default () {
45
+ return [];
46
+ }
47
+ },
48
+ rowDefault: {
49
+ type: Object,
50
+ default () {
51
+ return {};
52
+ }
53
+ },
54
+
55
+ outObj: {
56
+ type: Object,
57
+ default () {
58
+ return {};
59
+ }
60
+ },
61
+ propsObj: {
62
+ type: Object,
63
+ default () {
64
+ return {};
65
+ }
66
+ },
67
+ isShare: Boolean
68
+ },
69
+ model: {
70
+ prop: "data",
71
+ event: "change"
72
+ },
73
+ data () {
74
+ return {
75
+ showRuleMessage: false, // 显示校验文字
76
+ ruleRecordMap: {}
77
+ };
78
+ },
79
+ computed: {
80
+ tablePropsObj () {
81
+ return {
82
+ maxHeight: this.contentHeight
83
+ };
84
+ },
85
+ listData () {
86
+ this.data.forEach(item => {
87
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
88
+ });
89
+ return this.data;
90
+ },
91
+ footerData () {
92
+ let row = { _id: this.$ObjectID().str, custome: "汇总" };
93
+ this.filterColumns.map(col => {
94
+ if (col._type === "number") {
95
+ row[col._key] = this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 });
96
+ }
97
+ });
98
+ return this.useSummary && this.listData.length ? [row] : [];
99
+ },
100
+ oldListData () {
101
+ this.oldData.forEach(item => {
102
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
103
+ });
104
+ return this.oldData;
105
+ },
106
+
107
+ selfPropsObj () {
108
+ return {
109
+ _contentHeight: 500,
110
+ _useSelection: false, // 使用选择列
111
+ _useIndex: true, // 使用序号列
112
+ _useSummary: false, // 使用汇总行
113
+ _disabledBtns: false, // 禁用增删按钮
114
+ _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
115
+ _disabledOldDataRow: false, // 置灰老数据行包含删除
116
+
117
+ ...this.propsObj
118
+ };
119
+ },
120
+ contentHeight () {
121
+ return this.selfPropsObj._contentHeight;
122
+ },
123
+ useSelection () {
124
+ return this.selfPropsObj._useSelection;
125
+ },
126
+ useIndex () {
127
+ return this.selfPropsObj._useIndex;
128
+ },
129
+ useSummary () {
130
+ return this.selfPropsObj._useSummary;
131
+ },
132
+ disabledBtns () {
133
+ return this.selfPropsObj._disabledBtns;
134
+ },
135
+ disabledCreateBtn () {
136
+ return this.selfPropsObj._disabledCreateBtn;
137
+ },
138
+ disabledOldDataRow () {
139
+ return this.selfPropsObj._disabledOldDataRow;
140
+ },
141
+ useCampare () {
142
+ return !!this.oldListData.length;
143
+ },
144
+ filterColumns () {
145
+ return this.columns.filter(colItem => colItem._displayType !== "hide" && this.$isAdvRelyShow(colItem, this.outObj));
146
+ },
147
+ showColumns () {
148
+ const operationList = this.$getOperationList(["delete"]);
149
+ const showColumns = [
150
+ ...(
151
+ this.useSelection === true
152
+ ? [
153
+ {
154
+ field: "selection",
155
+ key: "selection",
156
+ type: "checkbox",
157
+ width: 66,
158
+ align: "center",
159
+ fixed: "left"
160
+ }
161
+ ]
162
+ : []
163
+ ),
164
+
165
+ ...(
166
+ this.useIndex === true
167
+ ? [
168
+ {
169
+ title: "序号",
170
+ field: "custome",
171
+ key: "customes",
172
+ width: 76,
173
+ align: "center",
174
+ fixed: "left",
175
+ renderBodyCell: ({ rowIndex }) => ++rowIndex
176
+ }
177
+ ]
178
+ : []
179
+ ),
180
+
181
+ ...this.$transformToColumns(this.filterColumns.map(item => ({
182
+ filter: undefined,
183
+ sortBy: undefined,
184
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
185
+ return [
186
+ this.isShowCompare(column, row, this.oldListData[rowIndex])
187
+ ? h("Tooltip", {
188
+ class: "td-inner-compare",
189
+ props: {
190
+ content: this.$isEmptyData(this.oldListData[rowIndex][column._key]) ? "" : this.oldListData[rowIndex][column._key],
191
+ transfer: true,
192
+ maxWidth: 200,
193
+ placement: "top"
194
+ },
195
+ scopedSlots: {
196
+ default: props => h("dsh-unit", {
197
+ props: {
198
+ canEdit: this.getUnitCanEdit(column, row),
199
+ parentData: this.listData,
200
+ formData: row,
201
+ formItem: this.resetCol(item),
202
+ isShare: this.isShare,
203
+ rowIndex: rowIndex,
204
+ isUnit: !this.finalCanEdit
205
+ },
206
+ on: {
207
+ blur: () => this.controlBlur(null, column, row, arguments),
208
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
209
+ }
210
+ })
211
+ }
212
+ })
213
+ : h("dsh-unit", {
214
+ props: {
215
+ canEdit: this.getUnitCanEdit(column, row),
216
+ parentData: this.listData,
217
+ formData: row,
218
+ formItem: this.resetCol(item),
219
+ isShare: this.isShare,
220
+ rowIndex: rowIndex,
221
+ isUnit: !this.finalCanEdit
222
+ },
223
+ on: {
224
+ blur: () => this.controlBlur(null, column, row, arguments),
225
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
226
+ }
227
+ }),
228
+ !this.getRuleResult(column, row).bool &&
229
+ h("span", { class: "table-row-td-tip" }, this.getRuleResult(column, row).message)
230
+ ];
231
+ },
232
+ renderHeaderCell: ({ column }, h) => {
233
+ return h("span", [
234
+ column._required && h("i", { style: { color: "#ed4014" } }, "*"),
235
+ h("span", column.title),
236
+ column._description &&
237
+ h("Tooltip", {
238
+ style: { display: "inline-block" },
239
+ props: {
240
+ content: column._description,
241
+ transfer: true,
242
+ maxWidth: 200
243
+ },
244
+ scopedSlots: {
245
+ default: props => h("i", { class: "table-head-description ivu-icon bico-font bico-explain" })
246
+ }
247
+ })
248
+ ]);
249
+ },
250
+ ...item
251
+ }))),
252
+
253
+ ...(
254
+ this.canEdit && operationList.length
255
+ ? [
256
+ {
257
+ title: "操作",
258
+ field: "operation",
259
+ key: "operation",
260
+ align: "center",
261
+ fixed: "right",
262
+ width: 100,
263
+ renderBodyCell: (params, h) => {
264
+ return h("dsh-buttons", {
265
+ props: {
266
+ list: operationList.map(btnItem => ({ ...btnItem, disabled: this.disabledOldDataRow && !params.row.__isCreate__ }))
267
+ },
268
+ on: {
269
+ click: (operationItem) => {
270
+ this.$dispatchEvent(operationItem, params.row, params.index, this.listData);
271
+ }
272
+ }
273
+ });
274
+ }
275
+ }
276
+ ]
277
+ : []
278
+ )
279
+ ];
280
+ return showColumns;
281
+ },
282
+ selfRowDefault () {
283
+ return this.$filterObj(this.columns, this.rowDefault);
284
+ },
285
+ operationMap () {
286
+ const allOperationMap = {
287
+ create: {
288
+ name: "添加一行",
289
+ type: "create",
290
+ size: "default",
291
+ long: true,
292
+ disabled: !!this.disabledCreateBtn,
293
+ event: "clickCreate",
294
+ btnType: "default"
295
+ },
296
+ delete: {
297
+ name: "删除",
298
+ type: "delete",
299
+ btnType: "errorText",
300
+ icon: "ios-trash-outline",
301
+ size: "small",
302
+ disabled: false,
303
+ event: "clickDelete"
304
+ },
305
+ // expand: {
306
+ // name: "展开",
307
+ // type: "expand",
308
+ // event: "clickExpand"
309
+ // },
310
+ changeVal: {
311
+ name: "改变输入框值",
312
+ type: "changeVal",
313
+ event: "changeVal"
314
+ }
315
+ };
316
+
317
+ return this.canEdit
318
+ ? this.$categoryMapToMap(
319
+ allOperationMap,
320
+ null,
321
+ this.disabledBtns ? ["create", "delete"] : []
322
+ )
323
+ : {};
324
+ }
325
+ },
326
+ created () {
327
+ },
328
+ methods: {
329
+ // 共外部使用
330
+ validate () {
331
+ this.showRuleMessage = true;
332
+
333
+ return this.listData.every(dataItem =>
334
+ this.filterColumns.every(col => this.getRuleResult(col, dataItem, true).bool)
335
+ );
336
+ },
337
+ // 点击 -添加行
338
+ clickCreate (operationItem, row, index, list) {
339
+ const newRow = {
340
+ ...this.$deepCopy(this.selfRowDefault),
341
+ __isCreate__: true,
342
+ _id: this.$ObjectID().str
343
+ };
344
+ const newRowIndex = index == null ? list.length : index + 1;
345
+ list.splice(newRowIndex, 0, newRow);
346
+
347
+ this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
348
+
349
+ this.change("createRow", null, newRow, newRowIndex);
350
+ },
351
+ // 点击 -删除行
352
+ clickDelete (operationItem, row, rowIndex, list) {
353
+ this.$Modal.confirm({
354
+ title: "警告",
355
+ content: "确定删除吗?",
356
+ onOk: () => {
357
+ list.splice(rowIndex, 1);
358
+
359
+ this.change("deleteRow", null, row, rowIndex);
360
+ }
361
+ });
362
+ },
363
+ changeSelect (list) {
364
+ this.$emit("selectChange", list);
365
+ },
366
+ // 表单控件值改变
367
+ changeVal (operationItem, col, row, rowIndex, params) {
368
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
369
+
370
+ this.change("changeVal", col, row, rowIndex, ...params);
371
+ },
372
+ // 表单控件失去焦点
373
+ controlBlur (operationItem, col, row, params) {
374
+ this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
375
+ },
376
+ change (...params) {
377
+ this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
378
+ },
379
+
380
+ /* --------------- 工具方法 ------------- */
381
+ resetCol (col) {
382
+ let obj = {
383
+ select: {
384
+ _optionKind: "dropdown"
385
+ },
386
+ checkbox: {
387
+ _optionKind: "dropdown"
388
+ }
389
+ };
390
+ return { ...col, ...(obj[col._type] || {}) };
391
+ },
392
+ getUnitCanEdit (col, row) {
393
+ return this.canEdit && // 是否是编辑状态
394
+ // (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
395
+ (!this.disabledOldDataRow || !!row.__isCreate__) && // 是否让老数据行置灰
396
+ (!col.dependRowCanEdit || row.canEdit !== false); // 在老数据行里某些列不可编辑
397
+ },
398
+ isShowCompare (col, row, oldRow = {}) {
399
+ return this.useCampare && ["number"].includes(col._type) &&
400
+ !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
401
+ row[col._key] !== oldRow[col._key];
402
+ },
403
+ // 是否显示 单元格校验提示文字
404
+ getRuleResult (col, row, showRuleMessage = this.showRuleMessage) {
405
+ if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || showRuleMessage) {
406
+ const val = row[col._key];
407
+ const ruleConfig = this.$getFormTypeRuleConfig(col);
408
+ // 为空 校验必填;不为空 格式校验 (不是必填也要校验格式)
409
+ return this.$isEmptyData(val)
410
+ ? {
411
+ bool: !col._required,
412
+ message: `${col._name}为必填项`
413
+ }
414
+ : ruleConfig.regs && ruleConfig.regs.length
415
+ ? {
416
+ bool: ruleConfig.regs.every(regItem => regItem.test(val)),
417
+ message: col.regMessage || `${col._name}格式不正确`
418
+ }
419
+ : {
420
+ bool: true
421
+ };
422
+ } else {
423
+ return {
424
+ bool: true
425
+ };
426
+ }
427
+ }
428
+ }
429
+ };
430
+ </script>