kz-ui-base 1.0.160 → 2.5.162

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.
@@ -11,11 +11,9 @@
11
11
  >
12
12
  <template slot="title">
13
13
  <div class="title-text">
14
- <span class="title-main">添加文件</span
14
+ <span class="title-main">{{ t('common.addFile') }}</span
15
15
  ><span class="title-supplement"
16
- >(只能添加"jpg", "jpeg", "bmp", "png", "gif", "pdf", "doc", "docx",
17
- "md", "xmind", "mp4", "xlsx"
18
- ,"bmp","tif","avi","wmv","xls"大小不超过5M。)</span
16
+ >{{ t('common.addFileTip') }}</span
19
17
  >
20
18
  </div>
21
19
  </template>
@@ -27,7 +25,7 @@
27
25
  class="material"
28
26
  style="height: 500px"
29
27
  >
30
- <el-tab-pane label="我的文件" name="first">
28
+ <el-tab-pane :label="t('common.myFiles')" name="first">
31
29
  <el-container>
32
30
  <el-header class="container-header">
33
31
  <el-row :gutter="20" type="flex" justify="space-between">
@@ -54,7 +52,7 @@
54
52
  icon="el-icon-upload2"
55
53
  :loading="upload.isUploading"
56
54
  >
57
- 直接上传
55
+ {{ t('common.uploadDirectly') }}
58
56
  </el-button>
59
57
  </el-upload>
60
58
  </el-col>
@@ -65,14 +63,14 @@
65
63
  icon="el-icon-folder-add"
66
64
  @click="handleAddFolder"
67
65
  :loading="upload.isUploading"
68
- >新增文件夹
66
+ >{{ t('common.addFolder') }}
69
67
  </el-button>
70
68
  </el-col>
71
69
  </el-row>
72
70
  </el-col>
73
71
  <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4" :pull="2">
74
72
  <el-input
75
- placeholder="搜索所有文件"
73
+ :placeholder="t('common.searchAllFiles')"
76
74
  v-model="form.folderName"
77
75
  class="header-search"
78
76
  @change="searchChange"
@@ -233,18 +231,18 @@
233
231
  </el-main>
234
232
  </el-container>
235
233
  </el-tab-pane>
236
- <el-tab-pane label="图库中心" name="second"></el-tab-pane>
234
+ <el-tab-pane :label="t('common.galleryCenter')" name="second"></el-tab-pane>
237
235
  </el-tabs>
238
236
  </div>
239
237
  <div slot="footer" class="dialog-footer dialogTop-footer">
240
238
  <el-button class="dialogTop-footer-button" @click="handleClose"
241
- >取 消</el-button
239
+ >{{ t('common.cancel') }}</el-button
242
240
  >
243
241
  <el-button
244
242
  class="dialogTop-footer-button"
245
243
  type="primary"
246
244
  @click="onSubmit"
247
- >确 定</el-button
245
+ >{{ t('common.confirm') }}</el-button
248
246
  >
249
247
  </div>
250
248
  </el-dialog>
@@ -262,7 +260,7 @@
262
260
  <template slot="title">
263
261
  <div class="minor-title-text">
264
262
  <span class="minor-increase"
265
- >待添加({{ choiceList.length }}/{{ max }})</span
263
+ {{ t('common.toBeAdded') }}({{ choiceList.length }}/{{ max }})</span
266
264
  >
267
265
  </div>
268
266
  </template>
@@ -467,7 +465,7 @@ export default {
467
465
  handleAddFolder() {
468
466
  this.upload.isUploading = true;
469
467
  addFolder(this.form).then((response) => {
470
- this.msgSuccess("新增成功");
468
+ this.msgSuccess(this.t('common.addSuccess'));
471
469
  this.getList();
472
470
  this.upload.isUploading = false;
473
471
  });
@@ -540,12 +538,12 @@ export default {
540
538
  updateMaterialNick(type, item, index) {
541
539
  if (type === 0) {
542
540
  updateFolder(item).then((response) => {
543
- this.msgSuccess("修改成功");
541
+ this.msgSuccess(this.t('common.modifySuccess'));
544
542
  this.getList();
545
543
  });
546
544
  } else if (type === 1) {
547
545
  updateMaterial(item).then((response) => {
548
- this.msgSuccess("修改成功");
546
+ this.msgSuccess(this.t('common.modifySuccess'));
549
547
  this.getList();
550
548
  });
551
549
  }
@@ -554,12 +552,12 @@ export default {
554
552
  imageDelete(type, item, index) {
555
553
  this.$confirm(
556
554
  type === 0
557
- ? "您确定将该文件夹以及该文件夹内的所有文件放入回收站吗?"
558
- : "将文件放入回收站会影响使用该文件的地方,确定放入回收站吗?",
559
- "提示",
555
+ ? this.t('common.deleteFolderConfirm')
556
+ : this.t('common.deleteFileConfirm'),
557
+ this.t('common.tip'),
560
558
  {
561
- confirmButtonText: "确定",
562
- cancelButtonText: "取消",
559
+ confirmButtonText: this.t('common.confirm'),
560
+ cancelButtonText: this.t('common.cancel'),
563
561
  type: "warning",
564
562
  center: true,
565
563
  }
@@ -575,13 +573,13 @@ export default {
575
573
  this.getList();
576
574
  this.$message({
577
575
  type: "success",
578
- message: "删除成功!",
576
+ message: this.t('common.deleteSuccess'),
579
577
  });
580
578
  })
581
579
  .catch(() => {
582
580
  this.$message({
583
581
  type: "info",
584
- message: "已取消删除",
582
+ message: this.t('common.deleteCancelled'),
585
583
  });
586
584
  });
587
585
  },
@@ -590,7 +588,7 @@ export default {
590
588
  const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
591
589
  if (this.upload.whiteList.indexOf(fileSuffix) === -1) {
592
590
  this.$message({
593
- message: "您上传的文件暂不支持,请联系管理员",
591
+ message: this.t('common.unsupportedFileType'),
594
592
  type: "warning",
595
593
  });
596
594
  return false;
@@ -598,7 +596,7 @@ export default {
598
596
  const isLt2M = file.size / 1024 / 1024 < 100;
599
597
  if (!isLt2M) {
600
598
  this.$message({
601
- message: "上传文件大小不能超过 100MB",
599
+ message: this.t('common.fileSizeLimit'),
602
600
  type: "warning",
603
601
  });
604
602
  return false;
@@ -613,10 +611,10 @@ export default {
613
611
  this.upload.fileList = [];
614
612
  this.upload.isUploading = false;
615
613
  if (response.code != 200) {
616
- this.$message.error("上传失败:" + response.msg);
614
+ this.$message.error(this.t('common.uploadFailed') + response.msg);
617
615
  } else {
618
616
  this.$message({
619
- message: "上传成功!",
617
+ message: this.t('common.uploadSuccess'),
620
618
  type: "success",
621
619
  });
622
620
  }
@@ -626,7 +624,7 @@ export default {
626
624
  handleFileError(err, file, fileList) {
627
625
  this.upload.fileList = [];
628
626
  this.upload.isUploading = false;
629
- this.$message.error("上传失败:" + err);
627
+ this.$message.error(this.t('common.uploadFailed') + err);
630
628
  },
631
629
  /** 确定 */
632
630
  onSubmit() {
@@ -11,11 +11,9 @@
11
11
  >
12
12
  <template slot="title">
13
13
  <div class="title-text">
14
- <span class="title-main">添加文件</span
14
+ <span class="title-main">{{ t('common.addFile') }}</span
15
15
  ><span class="title-supplement"
16
- >(只能添加"jpg", "jpeg", "bmp", "png", "gif", "pdf", "doc", "docx",
17
- "md", "xmind", "mp4", "xlsx"
18
- ,"bmp","tif","avi","wmv","xls"大小不超过5M。)</span
16
+ >{{ t('common.addFileTip') }}</span
19
17
  >
20
18
  </div>
21
19
  </template>
@@ -27,7 +25,7 @@
27
25
  class="material"
28
26
  style="height: 500px"
29
27
  >
30
- <el-tab-pane label="我的文件" name="first">
28
+ <el-tab-pane :label="t('common.myFiles')" name="first">
31
29
  <el-container>
32
30
  <el-header class="container-header">
33
31
  <el-row :gutter="20" type="flex" justify="space-between">
@@ -54,7 +52,7 @@
54
52
  icon="el-icon-upload2"
55
53
  :loading="upload.isUploading"
56
54
  >
57
- 直接上传
55
+ {{ t('common.uploadDirectly') }}
58
56
  </el-button>
59
57
  </el-upload>
60
58
  </el-col>
@@ -65,14 +63,14 @@
65
63
  icon="el-icon-folder-add"
66
64
  @click="handleAddFolder"
67
65
  :loading="upload.isUploading"
68
- >新增文件夹
66
+ >{{ t('common.addFolder') }}
69
67
  </el-button>
70
68
  </el-col>
71
69
  </el-row>
72
70
  </el-col>
73
71
  <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4" :pull="2">
74
72
  <el-input
75
- placeholder="搜索所有文件"
73
+ :placeholder="t('common.searchAllFiles')"
76
74
  v-model="form.folderName"
77
75
  class="header-search"
78
76
  @change="searchChange"
@@ -233,18 +231,18 @@
233
231
  </el-main>
234
232
  </el-container>
235
233
  </el-tab-pane>
236
- <el-tab-pane label="图库中心" name="second"></el-tab-pane>
234
+ <el-tab-pane :label="t('common.galleryCenter')" name="second"></el-tab-pane>
237
235
  </el-tabs>
238
236
  </div>
239
237
  <div slot="footer" class="dialog-footer dialogTop-footer">
240
238
  <el-button class="dialogTop-footer-button" @click="handleClose"
241
- >取 消</el-button
239
+ >{{ t('common.cancel') }}</el-button
242
240
  >
243
241
  <el-button
244
242
  class="dialogTop-footer-button"
245
243
  type="primary"
246
244
  @click="onSubmit"
247
- >确 定</el-button
245
+ >{{ t('common.confirm') }}</el-button
248
246
  >
249
247
  </div>
250
248
  </el-dialog>
@@ -262,7 +260,7 @@
262
260
  <template slot="title">
263
261
  <div class="minor-title-text">
264
262
  <span class="minor-increase"
265
- >待添加({{ choiceList.length }}/{{ max }})</span
263
+ {{ t('common.toBeAdded') }}({{ choiceList.length }}/{{ max }})</span
266
264
  >
267
265
  </div>
268
266
  </template>
@@ -465,7 +463,7 @@ export default class material extends Vue {
465
463
  public handleAddFolder() {
466
464
  this.upload.isUploading = true;
467
465
  addFolder(this.form).then((response) => {
468
- (this as any).msgSuccess("新增成功");
466
+ (this as any).msgSuccess((this as any).t('common.addSuccess'));
469
467
  this.getList();
470
468
  this.upload.isUploading = false;
471
469
  });
@@ -485,6 +483,7 @@ export default class material extends Vue {
485
483
  this.search.searchVisible = true;
486
484
  }
487
485
  }
486
+ /** 跳转文件夹 */
488
487
  public breadcrumbJump(item, index) {
489
488
  this.form.folderName = null;
490
489
  this.form.folderId = item.folderId;
@@ -536,12 +535,12 @@ export default class material extends Vue {
536
535
  public updateMaterialNick(type, item, index) {
537
536
  if (type === 0) {
538
537
  updateFolder(item).then((response) => {
539
- (this as any).msgSuccess("修改成功");
538
+ (this as any).msgSuccess((this as any).t('common.modifySuccess'));
540
539
  this.getList();
541
540
  });
542
541
  } else if (type === 1) {
543
542
  updateMaterial(item).then((response) => {
544
- (this as any).msgSuccess("修改成功");
543
+ (this as any).msgSuccess((this as any).t('common.modifySuccess'));
545
544
  this.getList();
546
545
  });
547
546
  }
@@ -551,12 +550,12 @@ export default class material extends Vue {
551
550
  (this as any)
552
551
  .$confirm(
553
552
  type === 0
554
- ? "您确定将该文件夹以及该文件夹内的所有文件放入回收站吗?"
555
- : "将文件放入回收站会影响使用该文件的地方,确定放入回收站吗?",
556
- "提示",
553
+ ? (this as any).t('common.deleteFolderConfirm')
554
+ : (this as any).t('common.deleteFileConfirm'),
555
+ (this as any).t('common.tip'),
557
556
  {
558
- confirmButtonText: "确定",
559
- cancelButtonText: "取消",
557
+ confirmButtonText: (this as any).t('common.confirm'),
558
+ cancelButtonText: (this as any).t('common.cancel'),
560
559
  type: "warning",
561
560
  center: true,
562
561
  }
@@ -572,13 +571,13 @@ export default class material extends Vue {
572
571
  this.getList();
573
572
  (this as any).$message({
574
573
  type: "success",
575
- message: "删除成功!",
574
+ message: (this as any).t('common.deleteSuccess'),
576
575
  });
577
576
  })
578
577
  .catch(() => {
579
578
  (this as any).$message({
580
579
  type: "info",
581
- message: "已取消删除",
580
+ message: (this as any).t('common.deleteCancelled'),
582
581
  });
583
582
  });
584
583
  }
@@ -587,7 +586,7 @@ export default class material extends Vue {
587
586
  const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
588
587
  if (this.upload.whiteList.indexOf(fileSuffix) === -1) {
589
588
  (this as any).$message({
590
- message: "您上传的文件暂不支持,请联系管理员",
589
+ message: (this as any).t('common.unsupportedFileType'),
591
590
  type: "warning",
592
591
  });
593
592
  return false;
@@ -595,7 +594,7 @@ export default class material extends Vue {
595
594
  const isLt2M = file.size / 1024 / 1024 < 100;
596
595
  if (!isLt2M) {
597
596
  (this as any).$message({
598
- message: "上传文件大小不能超过 100MB",
597
+ message: (this as any).t('common.fileSizeLimit'),
599
598
  type: "warning",
600
599
  });
601
600
  return false;
@@ -611,10 +610,10 @@ export default class material extends Vue {
611
610
  this.upload.fileList = [];
612
611
  this.upload.isUploading = false;
613
612
  if (response.code != 200) {
614
- (this as any).$message.error("上传失败:" + response.msg);
613
+ (this as any).$message.error((this as any).t('common.uploadFailed') + response.msg);
615
614
  } else {
616
615
  (this as any).$message({
617
- message: "上传成功!",
616
+ message: (this as any).t('common.uploadSuccess'),
618
617
  type: "success",
619
618
  });
620
619
  }
@@ -624,7 +623,7 @@ export default class material extends Vue {
624
623
  public handleFileError(err, file, fileList) {
625
624
  this.upload.fileList = [];
626
625
  this.upload.isUploading = false;
627
- (this as any).$message.error("上传失败:" + err);
626
+ (this as any).$message.error((this as any).t('common.uploadFailed') + err);
628
627
  }
629
628
  /** 确定 */
630
629
  public onSubmit() {
@@ -96,7 +96,7 @@ export default {
96
96
  */
97
97
  getFieldValueByMap(row, field) {
98
98
  // 如果直接能找到字段,直接返回
99
- if (row[field] !== undefined && row[field] !== null) {
99
+ if (row[field] !== undefined && row[field] !== null && row[field] !== '') {
100
100
  return row[field]
101
101
  }
102
102
  // 如果找不到,尝试通过 dataLangFieldMap 映射
@@ -104,7 +104,7 @@ export default {
104
104
  if (fieldMap) {
105
105
  // 查找映射关系中 value 等于 field 的 key
106
106
  const mappedKey = Object.keys(fieldMap).find(key => fieldMap[key] === field)
107
- if (mappedKey && row[mappedKey] !== undefined && row[mappedKey] !== null) {
107
+ if (mappedKey && row[mappedKey] !== undefined && row[mappedKey] !== null && row[mappedKey] !== '') {
108
108
  return row[mappedKey]
109
109
  }
110
110
  }
@@ -119,6 +119,7 @@ export default {
119
119
  const data = this.config.data.map((row, index) => {
120
120
  const item = {
121
121
  id: this.getFieldValueByMap(row, this.config.dataLangIdField) || row.configId,
122
+ // 使用 getFieldValueByMap 获取原始值(会处理字段映射)
122
123
  value: this.getFieldValueByMap(row, columnName) || '-',
123
124
  configKey: row.configKey
124
125
  }
@@ -137,6 +138,7 @@ export default {
137
138
  this.tableDataMap[columnName] = this.config.data.map((row, index) => {
138
139
  const item = {
139
140
  id: this.getFieldValueByMap(row, this.config.dataLangIdField) || row.configId,
141
+ // 使用 getFieldValueByMap 获取原始值(会处理字段映射)
140
142
  value: this.getFieldValueByMap(row, columnName) || '-',
141
143
  configKey: row.configKey
142
144
  }
@@ -159,6 +161,8 @@ export default {
159
161
  }))
160
162
  // 语言加载完成后初始化表格数据
161
163
  this.initTableData()
164
+ // 批量查询翻译并回填
165
+ this.fetchAndFillTranslations()
162
166
  }
163
167
  }).catch(error => {
164
168
  console.error('获取语言列表失败:', error)
@@ -169,6 +173,68 @@ export default {
169
173
  ]
170
174
  // 语言加载完成后初始化表格数据
171
175
  this.initTableData()
176
+ // 批量查询翻译并回填
177
+ this.fetchAndFillTranslations()
178
+ })
179
+ },
180
+ /** 批量获取翻译并回填 - 按每个语言调用接口 */
181
+ fetchAndFillTranslations() {
182
+ if (!this.config.data || this.config.data.length === 0 || this.languages.length === 0) {
183
+ return
184
+ }
185
+ const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
186
+ const tenantId = userInfo.tenantId
187
+
188
+ // 构建请求参数 - 公共部分
189
+ const recordIds = this.config.data.map((item) =>
190
+ String(this.getFieldValueByMap(item, this.config.dataLangIdField))
191
+ ).filter((id) => id && id !== "" && id !== "undefined" && id !== "null")
192
+
193
+ if (recordIds.length === 0) {
194
+ return
195
+ }
196
+
197
+ // 【重要】循环每个语言,分别调用接口回填
198
+ this.languages.forEach(lang => {
199
+ const params = {
200
+ entityName: this.config.entityName,
201
+ recordIds: recordIds,
202
+ columnNames: this.config.dataLangColumnFields,
203
+ locale: lang.value,
204
+ tenantId: tenantId
205
+ }
206
+
207
+ // 批量查询翻译接口 - 单语言
208
+ request({
209
+ url: '/system/api/i18n/translation/batch-get-multi',
210
+ method: 'post',
211
+ data: params
212
+ }).then(response => {
213
+ if (response.code === 200 && response.data) {
214
+ this.fillTranslationsByLocale(response.data, lang.value)
215
+ }
216
+ }).catch(error => {
217
+ console.error(`获取${lang.label}翻译失败:`, error)
218
+ })
219
+ })
220
+ },
221
+ /** 按指定语言回填到对应的 input 列 */
222
+ fillTranslationsByLocale(translationMap, currentLocale) {
223
+ // translationMap 格式:{"1": {"dictName": "用户性别"}}
224
+ // currentLocale: "zh_CN" / "en_US"
225
+ this.config.dataLangColumnFields.forEach(columnName => {
226
+ const tableData = this.tableDataMap[columnName] || []
227
+ tableData.forEach((rowData, rowIndex) => {
228
+ const originalRow = this.config.data[rowIndex]
229
+ const recordId = String(this.getFieldValueByMap(originalRow, this.config.dataLangIdField))
230
+
231
+ // 如果这条数据有翻译,放到对应语言的 input 中
232
+ if (translationMap[recordId] && translationMap[recordId][columnName]) {
233
+ const translationValue = translationMap[recordId][columnName]
234
+ // currentLocale = "zh_CN" 对应 rowData["zh_CN"]
235
+ rowData[currentLocale] = translationValue
236
+ }
237
+ })
172
238
  })
173
239
  },
174
240
  handleClose() {
@@ -1403,6 +1403,8 @@ export default class listBasePage extends Vue {
1403
1403
  dataLangIdField: undefined,
1404
1404
  data: []
1405
1405
  };
1406
+ // 原始数据副本(用于多语言对话框展示原始值)
1407
+ originalListData = [];
1406
1408
  // 树名称
1407
1409
  treeShapeName = undefined;
1408
1410
  defaultProps = {
@@ -2188,6 +2190,8 @@ export default class listBasePage extends Vue {
2188
2190
  )
2189
2191
  .then((response) => {
2190
2192
  this.listData = (response as any).rows;
2193
+ // 保存原始数据副本
2194
+ this.originalListData = JSON.parse(JSON.stringify((response as any).rows));
2191
2195
 
2192
2196
  this.listQueryParams.total = Number((response as any).total);
2193
2197
  this.contentLoading = false;
@@ -2753,8 +2757,11 @@ export default class listBasePage extends Vue {
2753
2757
  //this.setOpMenuEnable();
2754
2758
  this.currentEntities = selection;
2755
2759
  this.setOpMenuEnable();
2756
- // 更新多语言配置的数据
2757
- this.multiLanguageConfig.data = selection;
2760
+ // 更新多语言配置的数据 - 使用原始数据而不是已翻译的数据
2761
+ const selectedOriginalData = this.originalListData.filter(item =>
2762
+ selection.some(selected => selected[this.multiLanguageConfig.dataLangIdField] === item[this.multiLanguageConfig.dataLangIdField])
2763
+ );
2764
+ this.multiLanguageConfig.data = selectedOriginalData;
2758
2765
  }
2759
2766
  // 表单重置
2760
2767
  reset() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kz-ui-base",
3
- "version": "1.0.160",
3
+ "version": "2.5.162",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {