bri-components 1.2.38 → 1.2.40

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.2.38",
3
+ "version": "1.2.40",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -209,52 +209,41 @@
209
209
  getFormVDom () {
210
210
  return this.$refs.form;
211
211
  },
212
+ // 校验
212
213
  submit () {
213
214
  this.errorObj = {
214
215
  errors: []
215
216
  };
216
217
 
217
- this.$refs.form.validate(valid => {
218
- // 此函数有时早于某些字段的validateCb,不稳定,所以加setTimeout目的确保最后执行
219
- setTimeout(() => {
220
- // if (!valid) {
221
- // this.displayFormList.forEach(formItem => {
222
- // const resultObj = this.$getFieldRuleResult(formItem, this.formData);
223
- // if (resultObj.bool === false) {
224
- // this.errorObj.errors.push(resultObj);
225
- // }
226
- // });
227
- // }
228
- const selfValid = this.selfValidate((valid, errorFormList) => {
229
- if (valid === false) {
230
- errorFormList.forEach(formItem => {
231
- this.errorObj.errors.push({
232
- bool: false,
233
- message: `${formItem._name} 内部校验不正确!`
234
- });
235
- });
236
- }
237
- });
218
+ const bool = this.getValid();
219
+ if (bool) {
220
+ this.validateSuccess({});
221
+ } else {
222
+ this.validateFailed(this.errorObj);
223
+ }
238
224
 
239
- if (valid && selfValid) {
240
- this.rulesSuccess({});
241
- } else {
242
- this.rulesFailed(this.errorObj);
243
- }
244
- }, 0);
245
- });
225
+ return bool;
246
226
  },
247
- // iview的校验回调
248
- validateCb (prop, status, error) {
249
- if (status === false) {
250
- this.errorObj.errors.push({
251
- bool: false,
252
- message: error
227
+ // 获取校验结果
228
+ getValid () {
229
+ let bool = true;
230
+
231
+ this.getFormVDom().validate(valid => {
232
+ bool = bool && valid;
233
+ });
234
+ this.selfValidate((valid, errorFormList) => {
235
+ bool = bool && valid;
236
+
237
+ errorFormList.forEach(formItem => {
238
+ this.validateCb(formItem._key, false, `${formItem._name} 内部校验不正确!`);
253
239
  });
254
- }
240
+ });
241
+
242
+ return bool;
255
243
  },
244
+
256
245
  // 控件自己的校验
257
- selfValidate (callback) {
246
+ selfValidate (cb) {
258
247
  let bool = true;
259
248
  let errorRefs = [];
260
249
 
@@ -264,17 +253,26 @@
264
253
  } else {
265
254
  bool = true;
266
255
  }
267
- callback && callback(bool, errorRefs.map(errorRefItem => errorRefItem.formItem));
256
+ cb && cb(bool, errorRefs.map(errorRefItem => errorRefItem.formItem));
268
257
 
269
258
  return bool;
270
259
  },
260
+ // iview的校验回调
261
+ validateCb (prop, valid, error) {
262
+ if (valid === false) {
263
+ this.errorObj.errors.push({
264
+ bool: false,
265
+ message: error
266
+ });
267
+ }
268
+ },
271
269
  // 校验成功
272
- rulesSuccess (obj) {
273
- this.$emit("rulesSuccess", obj);
270
+ validateSuccess (obj) {
271
+ this.$emit("validateSuccess", obj);
274
272
  },
275
273
  // 校验失败
276
- rulesFailed (errorObj) {
277
- this.$emit("rulesFailed", errorObj);
274
+ validateFailed (errorObj) {
275
+ this.$emit("validateFailed", errorObj);
278
276
  },
279
277
 
280
278
  // 点击控件
@@ -7,11 +7,11 @@
7
7
  :size="selfPropsObj._size"
8
8
  >
9
9
  <Step
10
- class="DshSteps-item"
11
10
  v-for="(stepItem, stepIndex) in list"
12
- :key="stepItem.type || stepItem._id || stepItem._key || stepIndex"
11
+ :key="stepItem._key || stepItem._id || tepItem.type || stepIndex"
12
+ class="DshSteps-item"
13
13
  :status="stepItem.status"
14
- :title="stepItem.name"
14
+ :title="stepItem.name || stepItem._name"
15
15
  :content="stepItem.description"
16
16
  :icon="stepItem.icon"
17
17
  @click.native="clickStepItem(stepItem, stepIndex)"
@@ -14,19 +14,21 @@
14
14
  <slot
15
15
  v-if="renderStatusMap[tabItem._key]"
16
16
  :tabItem="tabItem"
17
- ></slot>
17
+ >
18
+ <span></span>
19
+ </slot>
18
20
  </TabPane>
19
21
 
20
22
  <div
21
23
  slot="extra"
22
- class="DshTabs-extra"
24
+ class="extra"
23
25
  >
24
26
  <span
25
27
  v-for="tabItem in rightTabList"
26
28
  :key="tabItem._key"
27
29
  :class="{
28
- 'DshTabs-extra-item': true,
29
- 'DshTabs-extra-item-active': tabItem._key === curTabKey
30
+ 'extra-item': true,
31
+ 'extra-item-active': tabItem._key === curTabKey
30
32
  }"
31
33
  @click="curTabKey = tabItem._key"
32
34
  >
@@ -119,7 +121,7 @@
119
121
  padding-top: 20px;
120
122
  }
121
123
 
122
- &-extra {
124
+ .extra {
123
125
  height: 100%;
124
126
 
125
127
  &-item {
@@ -132,16 +134,16 @@
132
134
  color: @themeColor;
133
135
  position: relative;
134
136
 
135
- &::after {
136
- content: "";
137
- width: 100%;
138
- height: 2px;
139
- position: absolute;
140
- bottom: 0px;
141
- left: 0;
142
- z-index: 1;
143
- background-color: @themeColor;
144
- }
137
+ // &::after {
138
+ // content: "";
139
+ // width: 100%;
140
+ // height: 2px;
141
+ // position: absolute;
142
+ // bottom: 0px;
143
+ // left: 0;
144
+ // z-index: 1;
145
+ // background-color: @themeColor;
146
+ // }
145
147
  }
146
148
  }
147
149
  }
@@ -163,7 +165,6 @@
163
165
 
164
166
  .ivu-tabs-nav-container {
165
167
  height: 100%;
166
- overflow: visible;
167
168
 
168
169
  .ivu-tabs-nav-wrap {
169
170
 
@@ -231,6 +232,7 @@
231
232
  }
232
233
 
233
234
  .ivu-tabs-nav-container {
235
+ overflow: visible;
234
236
 
235
237
  .ivu-tabs-nav-wrap {
236
238
 
@@ -274,6 +276,23 @@
274
276
 
275
277
  // 页面编辑版
276
278
  &-page {
279
+ .extra {
280
+ &-item {
281
+ &-active {
282
+ &::after {
283
+ content: "";
284
+ width: 100%;
285
+ height: 2px;
286
+ position: absolute;
287
+ bottom: 0px;
288
+ left: 0;
289
+ z-index: 1;
290
+ background-color: @themeColor;
291
+ }
292
+ }
293
+ }
294
+ }
295
+
277
296
  .ivu-tabs {
278
297
 
279
298
  &-bar {
@@ -1,7 +1,7 @@
1
1
  .DshSwitch {
2
2
  width: 100%;
3
-
4
- &-show {
3
+
4
+ .DshSwitch-show {
5
5
  .bri-unit-show();
6
6
  }
7
7
  }