n20-common-lib 3.3.8 → 3.3.9

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": "n20-common-lib",
3
- "version": "3.3.8",
3
+ "version": "3.3.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -152,10 +152,6 @@ export default {
152
152
  display: inline-block;
153
153
  }
154
154
 
155
- .n20-date-picker > .n20-date-editor {
156
- width: 100%;
157
- }
158
-
159
155
  .n20-date-picker.has-long-term {
160
156
  display: inline-flex;
161
157
  align-items: center;
@@ -163,7 +159,6 @@ export default {
163
159
 
164
160
  .n20-date-picker.has-long-term > .n20-date-editor {
165
161
  flex: 1;
166
- width: auto;
167
162
  min-width: 0;
168
163
  }
169
164
 
@@ -140,7 +140,10 @@
140
140
  <el-form-item
141
141
  :label="$lc('视图名称')"
142
142
  prop="viewName"
143
- :rules="[{ required: true, message: $lc('请输入'), trigger: 'blur' }]"
143
+ :rules="[
144
+ { required: true, message: $lc('请输入视图名称'), trigger: 'blur' },
145
+ { validator: validateViewName, trigger: 'blur' }
146
+ ]"
144
147
  >
145
148
  <el-input v-model="form.viewName" maxlength="30" show-word-limit />
146
149
  </el-form-item>
@@ -653,6 +656,22 @@ export default {
653
656
  return fallback
654
657
  }
655
658
  },
659
+ // 编辑时排除当前视图,避免将未修改的原名称误判为重复
660
+ validateViewName(rule, value, callback) {
661
+ const viewName = typeof value === 'string' ? value.trim() : ''
662
+ if (!viewName) {
663
+ callback()
664
+ return
665
+ }
666
+ const isDuplicate = this.list.some(
667
+ (item) => typeof item.viewName === 'string' && item.viewName.trim() === viewName && item.viewId !== this.viewId
668
+ )
669
+ if (isDuplicate) {
670
+ callback(new Error($lc('视图名称不能重复')))
671
+ return
672
+ }
673
+ callback()
674
+ },
656
675
  // 保存筛选条件
657
676
  saveCheckData(data = []) {
658
677
  this.form.keyIds = data.map((item) => item.id).filter((id) => id !== undefined && id !== null && id !== '')
@@ -704,9 +723,14 @@ export default {
704
723
  return
705
724
  }
706
725
 
726
+ if (typeof this.form.viewName === 'string') {
727
+ this.form.viewName = this.form.viewName.trim()
728
+ }
707
729
  this.$refs.form.validate(async (valid) => {
708
730
  if (!valid) {
709
- this.$message.error($lc('请输入视图名称'))
731
+ if (!this.form.viewName) {
732
+ this.$message.error($lc('请输入视图名称'))
733
+ }
710
734
  return
711
735
  }
712
736
  if (this.form.viewType === VIEW_TYPE.BASIC) {
package/src/i18n.json CHANGED
@@ -10121,6 +10121,13 @@
10121
10121
  "ja": "ビュー名を入力してください",
10122
10122
  "zh-hk": "請輸入視圖名稱"
10123
10123
  },
10124
+ "视图名称不能重复": {
10125
+ "en": "View names cannot be duplicated",
10126
+ "th": "ชื่อมุมมองต้องไม่ซ้ำกัน",
10127
+ "vi": "Tên chế độ xem không được trùng lặp",
10128
+ "ja": "ビュー名は重複できません",
10129
+ "zh-hk": "視圖名稱不能重複"
10130
+ },
10124
10131
  "至少添加一个条件": {
10125
10132
  "en": "Add at least one condition",
10126
10133
  "th": "เพิ่มอย่างน้อยหนึ่งเงื่อนไข",