t20-common-lib 0.15.28 → 0.15.30

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": "t20-common-lib",
3
- "version": "0.15.28",
3
+ "version": "0.15.30",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -12,7 +12,7 @@
12
12
  :type="type"
13
13
  :is-clearable="true"
14
14
  v-model="_value"
15
- :d-num="6"
15
+ :d-num="$attrs.dNum ? $attrs.dNum : 6"
16
16
  :placeholder="$attrs.placeholder ? $attrs.placeholder : '请输入' | $l"
17
17
  v-bind="$attrs"
18
18
  v-on="$listeners"
@@ -287,8 +287,8 @@ export default {
287
287
  if (!item.prop) return;
288
288
  const cfg = byFieldNo[item.prop];
289
289
  if (!cfg) return;
290
- if (cfg.isShow !== undefined && cfg.isShow !== null) {
291
- item.isShow = this.templateShowOrEditable(cfg.isShow);
290
+ if (cfg.isEnabled !== undefined && cfg.isEnabled !== null) {
291
+ item.isShow = this.templateShowOrEditable(cfg.isEnabled);
292
292
  }
293
293
  if (cfg.showName != null && String(cfg.showName).trim() !== "") {
294
294
  item.label = cfg.showName;
@@ -412,7 +412,7 @@ export default {
412
412
  this.$set(field, "options", options);
413
413
  this.patchLinkageOverride(groupProp, fieldProp, { options });
414
414
  },
415
- /**
415
+ /**
416
416
  * 场景5:切换字段渲染的 elementType(如 INPUT / SELECT),须在 elementTypeChange 中已注册。
417
417
  */
418
418
  setFieldElementType(groupProp, fieldProp, elementType) {
@@ -490,21 +490,6 @@ export default {
490
490
  this.isApplyingLinkage = false;
491
491
  });
492
492
  },
493
- /**
494
- * 提交校验失败时,将可视区域滚动到第一个未通过的表单项(依赖 Element 的 .is-error)。
495
- */
496
- scrollToFirstFormError() {
497
- const formRef = this.$refs.dynamicForms;
498
- const formEl = formRef && formRef.$el;
499
- if (!formEl || typeof formEl.querySelector !== "function") return;
500
- const firstError = formEl.querySelector(".el-form-item.is-error");
501
- if (!firstError || typeof firstError.scrollIntoView !== "function") return;
502
- firstError.scrollIntoView({
503
- behavior: "smooth",
504
- block: "center",
505
- inline: "nearest",
506
- });
507
- },
508
493
  /**
509
494
  * 触发表单校验;通过后由返回值携带表单数据与附件(与 needFile 一致时含已落档行)。
510
495
  * @returns {Promise<{ valid: false, formData: object } | { valid: true, formData: object, operate?: string, fileUploadTableData?: array }>}
@@ -157,8 +157,8 @@ export default {
157
157
  if (!item.prop) return
158
158
  const cfg = byFieldNo[item.prop]
159
159
  if (!cfg) return
160
- if (cfg.isShow !== undefined && cfg.isShow !== null) {
161
- item.isShow = this.templateShowOrEditable(cfg.isShow)
160
+ if (cfg.isEnabled !== undefined && cfg.isEnabled !== null) {
161
+ item.isShow = this.templateShowOrEditable(cfg.isEnabled)
162
162
  }
163
163
  if (cfg.showName != null && String(cfg.showName).trim() !== '') {
164
164
  item.label = cfg.showName
@@ -192,10 +192,11 @@ export default {
192
192
  if (Number.isNaN(n)) return val
193
193
  return n.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
194
194
  },
195
- formatRate(val) {
195
+ formatRate(val, props) {
196
+ const dNum = props?.dNum ? props.dNum : 6
196
197
  const n = Number(val)
197
198
  if (Number.isNaN(n)) return val
198
- return String(n)
199
+ return String(n).toFixed(dNum)
199
200
  },
200
201
  labelFromOptions(options, raw, multiple) {
201
202
  const opts = options || []
@@ -249,7 +250,7 @@ export default {
249
250
  case 'AMOUNT':
250
251
  return this.formatMoney(raw)
251
252
  case 'RATE':
252
- return this.formatRate(raw)
253
+ return this.formatRate(raw, item.props)
253
254
  case 'DATE_RANGE': {
254
255
  const s = String(raw)
255
256
  const parts = s.split(',')