kz-ui-base 1.0.161 → 2.0.148

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 (70) hide show
  1. package/api/system/config.js +0 -17
  2. package/common/src/components/base/dialog/BaseDialog.vue +4 -15
  3. package/common/src/components/base/dialog/editDialog.vue +2 -2
  4. package/common/src/components/basics/RightToolbar/advancedQuery.vue +26 -5
  5. package/common/src/components/basics/RightToolbar/advancedQueryClose.vue +26 -5
  6. package/common/src/components/basics/RightToolbar/index.vue +5 -6
  7. package/common/src/components/custom/Material/index.vue +27 -25
  8. package/common/src/components/custom/Material/indexTs.vue +27 -25
  9. package/common/src/utils/request.js +0 -5
  10. package/common/src/views/login.vue +0 -5
  11. package/common/src/views/tenantLogin.vue +0 -5
  12. package/components/base/dialog/elTable.vue +2 -2
  13. package/components/base/dialog/sampleEditDialog.vue +38 -61
  14. package/components/base/dialog/smapleDialog.vue +12 -12
  15. package/components/base/dialog/tableForm.vue +6 -6
  16. package/components/customForm/OpMenus.vue +5 -5
  17. package/components/customForm/datePicker.vue +5 -4
  18. package/components/customForm/dropDownList.vue +8 -8
  19. package/components/customForm/lookupDialog.vue +3 -3
  20. package/components/customForm/printDialog.vue +17 -17
  21. package/components/customForm/sampleEditDialog.vue +3 -3
  22. package/components/customForm/searchTable.vue +4 -4
  23. package/components/customForm/table.vue +5 -5
  24. package/components/customForm/textarea.vue +1 -1
  25. package/components/customForm/treeDownList.vue +1 -1
  26. package/components/customForm/upload.vue +1 -1
  27. package/components/customForm/uploadButton.vue +7 -7
  28. package/components/customForm/uploadDialog.vue +1 -1
  29. package/list-base-page/doublelistBasePageTs.vue +16 -16
  30. package/list-base-page/listBasePageTs.vue +64 -228
  31. package/package.json +1 -1
  32. package/views/bd/common/modal/AddressInfoModal.vue +8 -8
  33. package/views/bd/common/modal/BankInfoModal.vue +10 -10
  34. package/views/bd/common/modal/CustomerContactsModal.vue +13 -13
  35. package/views/bd/common/modal/CustomerModal.vue +49 -51
  36. package/views/bd/common/modal/DeptModal.vue +10 -10
  37. package/views/bd/common/modal/EmployeeModal.vue +22 -26
  38. package/views/bd/common/modal/ItemModal.vue +20 -23
  39. package/views/bd/common/modal/ItemModalBk.vue +8 -8
  40. package/views/bd/common/modal/NumberingRuleModal.vue +8 -8
  41. package/views/bd/common/modal/PostModal.vue +22 -22
  42. package/views/bd/common/modal/ProjectModal.vue +8 -8
  43. package/views/bd/common/modal/SalesmanInfoModel.vue +7 -7
  44. package/views/bd/common/modal/VendorModal.vue +24 -28
  45. package/views/bd/common/modal/WorkGroupModal.vue +40 -44
  46. package/views/bd/common/modal/materialCodeModal.vue +30 -23
  47. package/views/fd/common/modal/AddResourceModal.vue +6 -8
  48. package/views/fd/common/modal/AssetModal.vue +17 -17
  49. package/views/fd/common/modal/EquipmentModal.vue +10 -10
  50. package/views/fd/common/modal/FactoryTreeModal.vue +1 -3
  51. package/views/fd/common/modal/ResourceModal.vue +6 -6
  52. package/views/fd/common/modal/SiteModal.vue +11 -9
  53. package/views/fd/common/modal/StorageUnitModal.vue +9 -9
  54. package/views/fd/common/modal/StorageZoneModal.vue +11 -11
  55. package/views/fd/common/modal/WorkAreaModal.vue +9 -9
  56. package/views/fd/common/modal/WorkCenterModal.vue +9 -9
  57. package/views/fd/common/modal/WorkUnitModal.vue +9 -9
  58. package/views/pd/common/modal/BopModal.vue +10 -10
  59. package/views/pd/common/modal/DrawingPathModal.vue +52 -52
  60. package/views/pd/common/modal/ParameterModal.vue +18 -18
  61. package/views/pd/common/modal/ProcessModal.vue +15 -15
  62. package/views/pd/common/modal/ProdRoutingDtlModal.vue +19 -19
  63. package/views/pd/common/modal/ProdRoutingModal.vue +14 -14
  64. package/views/pd/common/modal/ProdStructureModal.vue +14 -14
  65. package/views/pd/common/modal/ProdstructTemplateHdrModal.vue +25 -27
  66. package/views/pd/common/modal/ProductionVersionModal.vue +35 -35
  67. package/views/pd/common/modal/technicalStandardModal.vue +20 -20
  68. package/views/system/common/modal/UserModal.vue +70 -72
  69. package/components/base/dialog/MultiLanguageDialog.vue +0 -308
  70. package/components/base/dialog/config.js +0 -85
@@ -7,7 +7,7 @@
7
7
  <div class="head-container">
8
8
  <el-input
9
9
  v-model="deptName"
10
- :placeholder="t('userModal.placeholder.deptPostName')"
10
+ placeholder="请输入部门|岗位名称"
11
11
  clearable
12
12
  size="small"
13
13
  prefix-icon="el-icon-search"
@@ -34,50 +34,50 @@
34
34
  <el-col :span="20" :xs="24">
35
35
  <div class="wrapper-container" v-show="showSearch">
36
36
  <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
37
- <el-form-item :label="t('userModal.userCode')" prop="userCode">
37
+ <el-form-item label="用户编码" prop="userCode">
38
38
  <el-input
39
39
  v-model="queryParams.userCode"
40
- :placeholder="t('userModal.placeholder.userCode')"
40
+ placeholder="请输入用户编码"
41
41
  clearable
42
42
  size="small"
43
43
  style="width: 240px"
44
44
  @keyup.enter.native="handleQuery"
45
45
  />
46
46
  </el-form-item>
47
- <el-form-item :label="t('userModal.userName')" prop="userName">
47
+ <el-form-item label="用户账号" prop="userName">
48
48
  <el-input
49
49
  v-model="queryParams.userName"
50
- :placeholder="t('userModal.placeholder.userName')"
50
+ placeholder="请输入用户账号"
51
51
  clearable
52
52
  size="small"
53
53
  style="width: 240px"
54
54
  @keyup.enter.native="handleQuery"
55
55
  />
56
56
  </el-form-item>
57
- <el-form-item :label="t('userModal.nickName')" prop="nickName">
57
+ <el-form-item label="用户名称" prop="nickName">
58
58
  <el-input
59
59
  v-model="queryParams.nickName"
60
- :placeholder="t('userModal.placeholder.nickName')"
60
+ placeholder="请输入用户名称"
61
61
  clearable
62
62
  size="small"
63
63
  style="width: 240px"
64
64
  @keyup.enter.native="handleQuery"
65
65
  />
66
66
  </el-form-item>
67
- <el-form-item :label="t('userModal.phone')" prop="phone">
67
+ <el-form-item label="手机号码" prop="phone">
68
68
  <el-input
69
69
  v-model="queryParams.phone"
70
- :placeholder="t('userModal.placeholder.phone')"
70
+ placeholder="请输入手机号码"
71
71
  clearable
72
72
  size="small"
73
73
  style="width: 240px"
74
74
  @keyup.enter.native="handleQuery"
75
75
  />
76
76
  </el-form-item>
77
- <el-form-item :label="t('userModal.status')" prop="status">
77
+ <el-form-item label="在职状态" prop="status">
78
78
  <el-select
79
79
  v-model="queryParams.status"
80
- :placeholder="t('userModal.placeholder.status')"
80
+ placeholder="在职状态"
81
81
  clearable
82
82
  size="small"
83
83
  style="width: 240px"
@@ -90,7 +90,7 @@
90
90
  />
91
91
  </el-select>
92
92
  </el-form-item>
93
- <el-form-item :label="t('userModal.createTime')">
93
+ <el-form-item label="创建时间">
94
94
  <el-date-picker
95
95
  v-model="dateRange"
96
96
  size="small"
@@ -98,13 +98,13 @@
98
98
  value-format="yyyy-MM-dd"
99
99
  type="daterange"
100
100
  range-separator="-"
101
- :start-placeholder="t('userModal.placeholder.startDate')"
102
- :end-placeholder="t('userModal.placeholder.endDate')"
101
+ start-placeholder="开始日期"
102
+ end-placeholder="结束日期"
103
103
  ></el-date-picker>
104
104
  </el-form-item>
105
105
  <el-form-item>
106
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ t('userModal.search') }}</el-button>
107
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ t('userModal.reset') }}</el-button>
106
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
107
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
108
108
  </el-form-item>
109
109
  </el-form>
110
110
  </div>
@@ -119,20 +119,20 @@
119
119
  @select="handleSelect"
120
120
  @selection-change="handleSelectionChange">
121
121
  <el-table-column type="selection" width="50" align="center" />
122
- <el-table-column :label="t('userModal.userCode')" align="center" key="userCode" prop="userCode" v-if="columns[0].visible" min-width="120" />
123
- <el-table-column :label="t('userModal.userName')" align="center" key="userName" prop="userName" v-if="columns[1].visible"
122
+ <el-table-column label="用户编码" align="center" key="userCode" prop="userCode" v-if="columns[0].visible" min-width="120" />
123
+ <el-table-column label="用户账号" align="center" key="userName" prop="userName" v-if="columns[1].visible"
124
124
  :show-overflow-tooltip="true" min-width="120" />
125
- <el-table-column :label="t('userModal.nickName')" align="center" key="nickName" prop="nickName" v-if="columns[2].visible"
125
+ <el-table-column label="用户名称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible"
126
126
  :show-overflow-tooltip="true" min-width="120" />
127
- <el-table-column :label="t('userModal.deptPost')" align="center" key="post.postName" v-if="columns[3].visible"
127
+ <el-table-column label="部门|岗位" align="center" key="post.postName" v-if="columns[3].visible"
128
128
  :show-overflow-tooltip="true" min-width="120">
129
129
  <template slot-scope="scope">
130
130
  <span>{{ scope.row.dept.deptName }}/{{ scope.row.post.postName }}</span>
131
131
  </template>
132
132
  </el-table-column>
133
- <el-table-column :label="t('userModal.phone')" align="center" key="phone" prop="phone" v-if="columns[4].visible"
133
+ <el-table-column label="手机号码" align="center" key="phone" prop="phone" v-if="columns[4].visible"
134
134
  min-width="120" />
135
- <el-table-column :label="t('userModal.status')" align="center" key="status" v-if="columns[5].visible" min-width="120">
135
+ <el-table-column label="在职状态" align="center" key="status" v-if="columns[5].visible" min-width="120">
136
136
  <template slot-scope="scope">
137
137
  <el-switch v-model="scope.row.status"
138
138
  active-value="0"
@@ -140,12 +140,12 @@
140
140
  @change="handleStatusChange(scope.row)"></el-switch>
141
141
  </template>
142
142
  </el-table-column>
143
- <el-table-column :label="t('userModal.createTime')" align="center" prop="createTime" v-if="columns[6].visible" min-width="160">
143
+ <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" min-width="160">
144
144
  <template slot-scope="scope">
145
145
  <span>{{ parseTime(scope.row.createTime) }}</span>
146
146
  </template>
147
147
  </el-table-column>
148
- <el-table-column :label="t('userModal.createBy')" align="center" prop="createBy" v-if="columns[7].visible" min-width="160" :formatter="userDisplayFormat">
148
+ <el-table-column label="创建人" align="center" prop="createBy" v-if="columns[7].visible" min-width="160" :formatter="userDisplayFormat">
149
149
  </el-table-column>
150
150
  </el-table>
151
151
  <pagination
@@ -158,8 +158,8 @@
158
158
  </div>
159
159
  </el-col>
160
160
  <div v-if="value && value.btnShow" class="dialog-footer" style="margin-top: 10px;position:static;">
161
- <el-button type="primary" @click="submitForm">{{ t('userModal.confirm') }}</el-button>
162
- <el-button @click="cancel">{{ t('userModal.cancel') }}</el-button>
161
+ <el-button type="primary" @click="submitForm">确 定</el-button>
162
+ <el-button @click="cancel">取 消</el-button>
163
163
  </div>
164
164
  </el-row>
165
165
  </div>
@@ -280,9 +280,49 @@ export default {
280
280
  postId: undefined
281
281
  },
282
282
  // 列信息
283
- columns: [],
283
+ columns: [
284
+ {key: 0, label: `用户编码`, visible: true},
285
+ {key: 1, label: `用户账号`, visible: true},
286
+ {key: 2, label: `用户名称`, visible: true},
287
+ {key: 3, label: `部门|岗位`, visible: true},
288
+ {key: 4, label: `手机号码`, visible: true},
289
+ {key: 5, label: `状态`, visible: true},
290
+ { key: 6, label: `创建时间`, visible: true },
291
+ { key: 7, label: `创建人`, visible: true }
292
+ ],
284
293
  // 表单校验
285
- rules: {}
294
+ rules: {
295
+ postId: [
296
+ {required: true, message: "部门|岗位不能为空", trigger: "blur"}
297
+ ],
298
+ userCode: [
299
+ {required: true, message: "用户编码不能为空", trigger: "blur"}
300
+ ],
301
+ userName: [
302
+ {required: true, message: "用户账号不能为空", trigger: "blur"}
303
+ ],
304
+ nickName: [
305
+ {required: true, message: "用户名称不能为空", trigger: "blur"}
306
+ ],
307
+ password: [
308
+ {required: true, message: "用户密码不能为空", trigger: "blur"},
309
+ {min: 6, max: 20, message: '用户密码长度必须介于 6 和 20 之间', trigger: 'blur'}
310
+ ],
311
+ email: [
312
+ {
313
+ type: "email",
314
+ message: "'请输入正确的邮箱地址",
315
+ trigger: ["blur", "change"]
316
+ }
317
+ ],
318
+ phone: [
319
+ {
320
+ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
321
+ message: "请输入正确的手机号码",
322
+ trigger: "blur"
323
+ }
324
+ ]
325
+ }
286
326
  }
287
327
  },
288
328
  watch: {
@@ -301,48 +341,6 @@ export default {
301
341
  }
302
342
  },
303
343
  created() {
304
- this.columns = [
305
- {key: 0, label: this.t('userModal.userCode'), visible: true},
306
- {key: 1, label: this.t('userModal.userName'), visible: true},
307
- {key: 2, label: this.t('userModal.nickName'), visible: true},
308
- {key: 3, label: this.t('userModal.deptPost'), visible: true},
309
- {key: 4, label: this.t('userModal.phone'), visible: true},
310
- {key: 5, label: this.t('userModal.status'), visible: true},
311
- {key: 6, label: this.t('userModal.createTime'), visible: true},
312
- {key: 7, label: this.t('userModal.createBy'), visible: true}
313
- ];
314
- this.rules = {
315
- postId: [
316
- {required: true, message: this.t('userModal.required.deptPost'), trigger: "blur"}
317
- ],
318
- userCode: [
319
- {required: true, message: this.t('userModal.required.userCode'), trigger: "blur"}
320
- ],
321
- userName: [
322
- {required: true, message: this.t('userModal.required.userName'), trigger: "blur"}
323
- ],
324
- nickName: [
325
- {required: true, message: this.t('userModal.required.nickName'), trigger: "blur"}
326
- ],
327
- password: [
328
- {required: true, message: this.t('userModal.required.password'), trigger: "blur"},
329
- {min: 6, max: 20, message: this.t('userModal.required.passwordLength'), trigger: 'blur'}
330
- ],
331
- email: [
332
- {
333
- type: "email",
334
- message: this.t('userModal.required.email'),
335
- trigger: ["blur", "change"]
336
- }
337
- ],
338
- phone: [
339
- {
340
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
341
- message: this.t('userModal.required.phone'),
342
- trigger: "blur"
343
- }
344
- ]
345
- };
346
344
  this.getList()
347
345
  this.getTreeSelect()
348
346
  this.getDicts("sys_normal_disable").then(response => {
@@ -470,13 +468,13 @@ export default {
470
468
  debugger
471
469
  if (this.isReturnEntity) {
472
470
  if (!this.multipleSelection || this.multipleSelection.length === 0) {
473
- this.msgError(this.t('userModal.selectUserTip'));
471
+ this.msgError("请选择一笔用户数据!");
474
472
  } else {
475
473
  this.$emit("confirm", this.multipleChoice ? this.multipleSelection : this.multipleSelection?.[0])
476
474
  }
477
475
  } else {
478
476
  if (! this.ids || this.ids.length === 0) {
479
- this.msgError(this.t('userModal.selectUserTip'));
477
+ this.msgError("请选择一笔用户数据!");
480
478
  } else {
481
479
  this.$emit("confirm", this.ids);
482
480
  }
@@ -1,308 +0,0 @@
1
- <template>
2
- <el-dialog
3
- :title="t('config.multi_language_config')"
4
- :visible.sync="dialogVisible"
5
- width="900px"
6
- append-to-body
7
- v-dialogDrag
8
- @close="handleDialogClose"
9
- >
10
- <div v-for="(columnName, index) in config.dataLangColumnFields" :key="index">
11
- <el-card :body-style="{ padding: '10px' }" style="margin-bottom: 15px;">
12
- <div slot="header" class="clearfix">
13
- <span>{{ getLabelByKey(columnName) }}</span>
14
- </div>
15
- <el-table :data="getTableData(columnName)" height="300" border size="small">
16
- <el-table-column property="value" :label="t('config.value')" />
17
- <el-table-column v-for="(lang, langIndex) in languages" :key="langIndex">
18
- <template slot="header">
19
- <span>{{ lang.label }}</span>
20
- </template>
21
- <template slot-scope="scope">
22
- <el-input
23
- v-model="scope.row[lang.value]"
24
- :placeholder="`请输入${lang.label}`"
25
- size="small"
26
- />
27
- </template>
28
- </el-table-column>
29
- </el-table>
30
- </el-card>
31
- </div>
32
- <div slot="footer" class="dialog-footer">
33
- <el-button @click="handleClose">{{ t('config.close') }}</el-button>
34
- <el-button type="primary" @click="handleSubmit">{{ t('config.confirm') }}</el-button>
35
- </div>
36
- </el-dialog>
37
- </template>
38
-
39
- <script>
40
- import request from '@utils/request'
41
- import { batchSaveTranslation } from './config.js'
42
-
43
- export default {
44
- name: "MultiLanguageDialog",
45
- props: {
46
- visible: {
47
- type: Boolean,
48
- default: false
49
- },
50
- config: {
51
- type: Object,
52
- default: () => ({
53
- entityName: 'sys_config',
54
- dataLangColumnFields: [],
55
- dataLangIdField: 'id',
56
- data: []
57
- })
58
- }
59
- },
60
- data() {
61
- return {
62
- dialogVisible: false,
63
- languages: [],
64
- tableDataMap: {} // 存储每个字段的表格数据
65
- }
66
- },
67
- watch: {
68
- visible(val) {
69
- this.dialogVisible = val
70
- },
71
- dialogVisible(val) {
72
- this.$emit('update:visible', val)
73
- if (val) {
74
- // 弹框打开时重新初始化数据
75
- this.getLanguages()
76
- }
77
- }
78
- },
79
- methods: {
80
- getLabelByKey(key) {
81
- const labelMap = {
82
- configName: this.t('config.config_name'),
83
- configKey: this.t('config.config_key'),
84
- configValue: this.t('config.config_value'),
85
- configType: this.t('config.config_type'),
86
- remark: this.t('config.remark')
87
- }
88
- return labelMap[key] || key
89
- },
90
- /**
91
- * 通过 dataLangFieldMap 映射字段名
92
- * 如果原始字段找不到,尝试通过映射获取值
93
- * @param {Object} row - 数据行
94
- * @param {string} field - 原始字段名
95
- * @returns {any} 字段值
96
- */
97
- getFieldValueByMap(row, field) {
98
- // 如果直接能找到字段,直接返回
99
- if (row[field] !== undefined && row[field] !== null && row[field] !== '') {
100
- return row[field]
101
- }
102
- // 如果找不到,尝试通过 dataLangFieldMap 映射
103
- const fieldMap = this.config.dataLangFieldMap
104
- if (fieldMap) {
105
- // 查找映射关系中 value 等于 field 的 key
106
- const mappedKey = Object.keys(fieldMap).find(key => fieldMap[key] === field)
107
- if (mappedKey && row[mappedKey] !== undefined && row[mappedKey] !== null && row[mappedKey] !== '') {
108
- return row[mappedKey]
109
- }
110
- }
111
- return null
112
- },
113
- getTableData(columnName) {
114
- // 如果已经有数据,直接返回(保持响应式)
115
- if (this.tableDataMap[columnName]) {
116
- return this.tableDataMap[columnName]
117
- }
118
- // 初始化数据
119
- const data = this.config.data.map((row, index) => {
120
- const item = {
121
- id: this.getFieldValueByMap(row, this.config.dataLangIdField) || row.configId,
122
- // 使用 getFieldValueByMap 获取原始值(会处理字段映射)
123
- value: this.getFieldValueByMap(row, columnName) || '-',
124
- configKey: row.configKey
125
- }
126
- // 为每个语言初始化字段
127
- this.languages.forEach(lang => {
128
- item[lang.value] = ''
129
- })
130
- return item
131
- })
132
- this.tableDataMap[columnName] = data
133
- return data
134
- },
135
- initTableData() {
136
- // 初始化所有字段的数据
137
- this.config.dataLangColumnFields.forEach(columnName => {
138
- this.tableDataMap[columnName] = this.config.data.map((row, index) => {
139
- const item = {
140
- id: this.getFieldValueByMap(row, this.config.dataLangIdField) || row.configId,
141
- // 使用 getFieldValueByMap 获取原始值(会处理字段映射)
142
- value: this.getFieldValueByMap(row, columnName) || '-',
143
- configKey: row.configKey
144
- }
145
- this.languages.forEach(lang => {
146
- item[lang.value] = ''
147
- })
148
- return item
149
- })
150
- })
151
- },
152
- getLanguages() {
153
- request({
154
- url: '/system/api/i18n/locales',
155
- method: 'get'
156
- }).then(response => {
157
- if (response.data) {
158
- this.languages = Object.keys(response.data).map(key => ({
159
- label: response.data[key],
160
- value: key
161
- }))
162
- // 语言加载完成后初始化表格数据
163
- this.initTableData()
164
- // 批量查询翻译并回填
165
- this.fetchAndFillTranslations()
166
- }
167
- }).catch(error => {
168
- console.error('获取语言列表失败:', error)
169
- // 默认使用中英文
170
- this.languages = [
171
- { label: '中文 (中国)', value: 'zh_CN' },
172
- { label: 'English (United States)', value: 'en_US' }
173
- ]
174
- // 语言加载完成后初始化表格数据
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
- })
238
- })
239
- },
240
- handleClose() {
241
- this.dialogVisible = false
242
- },
243
- handleDialogClose() {
244
- // 弹框关闭时清空数据,确保下次打开时重新初始化
245
- this.languages = []
246
- this.tableDataMap = {}
247
- },
248
- handleSubmit() {
249
- // 构建批量保存翻译的请求数据
250
- const saveData = []
251
-
252
- this.config.dataLangColumnFields.forEach(columnName => {
253
- const tableData = this.tableDataMap[columnName] || []
254
- tableData.forEach((rowData, rowIndex) => {
255
- const originalRow = this.config.data[rowIndex]
256
- // 获取实际的记录 ID(通过 dataLangFieldMap 映射)
257
- const recordId = this.getFieldValueByMap(originalRow, this.config.dataLangIdField) || originalRow.configId
258
-
259
- this.languages.forEach(lang => {
260
- const translationValue = rowData[lang.value]
261
- // 只有当用户填写了翻译内容时才保存
262
- if (translationValue && translationValue.trim() !== '') {
263
- // 从 localStorage 获取 userInfo 中的 tenantId
264
- const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
265
- saveData.push({
266
- entityName: this.config.entityName || 'sys_config',
267
- recordId: String(recordId),
268
- columnName: columnName,
269
- locale: lang.value,
270
- translation: translationValue,
271
- tenantId: userInfo.tenantId || undefined
272
- })
273
- }
274
- })
275
- })
276
- })
277
-
278
- console.log('保存数据:', saveData)
279
-
280
- if (saveData.length === 0) {
281
- this.$message.warning(this.t('config.please_enter_translation'))
282
- return
283
- }
284
-
285
- // 调用批量保存翻译接口
286
- batchSaveTranslation(saveData).then(response => {
287
- if (response.code === 200) {
288
- this.$message.success(this.t('config.translation_save_success'))
289
- this.$emit('update:visible', false)
290
- this.$emit('saved')
291
- } else {
292
- this.$message.error(response.msg || this.t('config.translation_save_failed'))
293
- }
294
- }).catch(error => {
295
- console.error('批量保存翻译失败:', error)
296
- this.$message.error(this.t('config.translation_save_failed'))
297
- })
298
- }
299
- }
300
- }
301
- </script>
302
-
303
- <style scoped>
304
- .clearfix {
305
- font-weight: bold;
306
- font-size: 14px;
307
- }
308
- </style>
@@ -1,85 +0,0 @@
1
- import request from '@utils/request'
2
-
3
- // 查询参数列表
4
- export function listConfig(query) {
5
- return request({
6
- url: '/system/config/list',
7
- method: 'get',
8
- params: query
9
- })
10
- }
11
-
12
- // 查询参数详细
13
- export function getConfig(configId) {
14
- return request({
15
- url: '/system/config/' + configId,
16
- method: 'get'
17
- })
18
- }
19
-
20
- // 根据参数键名查询参数值
21
- export function getConfigKey(configKey) {
22
- return request({
23
- url: '/system/config/configKey/' + configKey,
24
- method: 'get'
25
- })
26
- }
27
-
28
- // 根据参数键名查询参数值
29
- export function innerConfigKey(configKey) {
30
- return request({
31
- url: '/system/config/innerConfigKey/' + configKey,
32
- method: 'get'
33
- })
34
- }
35
-
36
- // 新增参数配置
37
- export function addConfig(data) {
38
- return request({
39
- url: '/system/config',
40
- method: 'post',
41
- data: data
42
- })
43
- }
44
-
45
- // 修改参数配置
46
- export function updateConfig(data) {
47
- return request({
48
- url: '/system/config',
49
- method: 'put',
50
- data: data
51
- })
52
- }
53
-
54
- // 删除参数配置
55
- export function delConfig(configId) {
56
- return request({
57
- url: '/system/config/' + configId,
58
- method: 'delete'
59
- })
60
- }
61
-
62
- // 刷新参数缓存
63
- export function refreshCache() {
64
- return request({
65
- url: '/system/config/refreshCache',
66
- method: 'delete'
67
- })
68
- }
69
- // 批量保存或更新翻译
70
- export function batchSaveTranslation(data) {
71
- return request({
72
- url: '/system/api/i18n/translation/batch-save',
73
- method: 'post',
74
- data: data
75
- })
76
- }
77
-
78
- // 批量获取翻译
79
- export function batchGetTranslation(data) {
80
- return request({
81
- url: '/system/api/i18n/translation/batch-get-multi',
82
- method: 'post',
83
- data: data
84
- })
85
- }