haiwei-module-admin 1.0.5 → 1.0.6

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
@@ -2,7 +2,7 @@
2
2
  "id": 0,
3
3
  "name": "haiwei-module-admin",
4
4
  "code": "admin",
5
- "version": "1.0.5",
5
+ "version": "1.0.6",
6
6
  "description": "haiwei前端Admin模块组件",
7
7
  "author": "Eric",
8
8
  "license": "ISC",
@@ -130,9 +130,9 @@ export default {
130
130
  }
131
131
 
132
132
  // 根据枚举文本内容智能判断
133
- const enumItem = this.enumList.find(item => item.value == this.value)
134
- if (enumItem && enumItem.label) {
135
- const label = enumItem.label.toLowerCase()
133
+ const foundEnumItem = this.enumList.find(item => item.value == this.value)
134
+ if (foundEnumItem && foundEnumItem.label) {
135
+ const label = foundEnumItem.label.toLowerCase()
136
136
 
137
137
  // 根据标签文本判断颜色
138
138
  if (label.includes('成功') || label.includes('完成') || label.includes('通过') || label.includes('确认') || label.includes('出仓')) {
@@ -190,6 +190,14 @@ export default {
190
190
  try {
191
191
  this.loading = true
192
192
  const { moduleCode, enumName, libName } = this
193
+
194
+ // 确保$api存在
195
+ if (typeof $api === 'undefined' || !$api.admin || !$api.admin.tool || !$api.admin.tool.enumSelect) {
196
+ console.warn('API未定义,无法加载枚举列表')
197
+ this.enumList = []
198
+ return
199
+ }
200
+
193
201
  const result = await $api.admin.tool.enumSelect({ moduleCode, enumName, libName })
194
202
 
195
203
  if (result && result.data) {