haiwei-ui 1.0.8 → 1.0.91

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": "haiwei-ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.91",
4
4
  "description": "HaiWei前端组件库",
5
5
  "author": "Eric",
6
6
  "license": "ISC",
@@ -9,6 +9,8 @@
9
9
  <slot name="toolbar" />
10
10
  <!--导出按钮-->
11
11
  <nm-button v-if="exportEnabled" icon="export" @click="onExportClick" v-nm-has="exportBtnCode" />
12
+ <!--导入按钮-->
13
+ <nm-button v-if="importEnabled" icon="import" @click="onImportClick" v-nm-has="importBtnCode" />
12
14
  <!--刷新按钮-->
13
15
  <nm-button v-if="!noRefresh" icon="refresh" @click="refresh" />
14
16
  <!--全屏按钮-->
@@ -33,7 +35,11 @@
33
35
  /**显示导出按钮 */
34
36
  exportEnabled: Boolean,
35
37
  /**导出按钮权限编码 */
36
- exportBtnCode: String
38
+ exportBtnCode: String,
39
+ /**显示导入按钮 */
40
+ importEnabled: Boolean,
41
+ /**导入按钮权限编码 */
42
+ importBtnCode: String
37
43
  },
38
44
  methods: {
39
45
  query() {
@@ -51,6 +57,9 @@
51
57
  },
52
58
  onExportClick() {
53
59
  this.$parent.triggerExport()
60
+ },
61
+ onImportClick() {
62
+ this.$parent.triggerImport()
54
63
  }
55
64
  }
56
65
  }
@@ -190,7 +190,7 @@
190
190
  computed: {
191
191
  ...mapState('app/user', { token: 'token' }),
192
192
  uploadUrl() {
193
- return `${this.$api.baseURL}/api/admin/excel/parseexcel`
193
+ return '/api/admin/excel/parseexcel'
194
194
  },
195
195
  headers() {
196
196
  return {
@@ -338,17 +338,23 @@
338
338
  formData.append('maxPreviewRows', this.model.maxPreviewRows)
339
339
  formData.append('skipEmptyRows', this.model.skipEmptyRows)
340
340
 
341
- this.$api.post('/api/admin/excel/parseexcel', formData, {
342
- headers: { 'Content-Type': 'multipart/form-data' }
343
- })
341
+ // 使用axios直接发送请求,避免$api可能为undefined的问题
342
+ const config = {
343
+ headers: {
344
+ 'Content-Type': 'multipart/form-data',
345
+ 'Authorization': `Bearer ${this.token}`
346
+ }
347
+ }
348
+
349
+ this.$http.post('/api/admin/excel/parseexcel', formData, config)
344
350
  .then(response => {
345
- if (response.successful) {
346
- this.fileInfo = response.data.basicInfo
347
- this.parseResult = response.data
351
+ if (response.data.successful) {
352
+ this.fileInfo = response.data.data.basicInfo
353
+ this.parseResult = response.data.data
348
354
  this.initColumnMapping()
349
355
  this._success('文件解析成功')
350
356
  } else {
351
- this._error(response.msg || '文件解析失败')
357
+ this._error(response.data.msg || '文件解析失败')
352
358
  }
353
359
  })
354
360
  .catch(error => {
@@ -12,6 +12,9 @@
12
12
  <el-form-item v-if="exportEnabled" v-nm-has="exportBtnCode">
13
13
  <nm-button type="primary" @click="onExport" icon="export" text="导出" />
14
14
  </el-form-item>
15
+ <el-form-item v-if="importEnabled" v-nm-has="importBtnCode">
16
+ <nm-button type="primary" @click="onImport" icon="import" text="导入" />
17
+ </el-form-item>
15
18
  <el-form-item v-if="advanced_.enabled">
16
19
  <nm-button ref="showAdvnacedBtn" type="warning" @click="onAdvancedClick">
17
20
  高级查询
@@ -90,7 +93,11 @@
90
93
  /**显示导出按钮 */
91
94
  exportEnabled: Boolean,
92
95
  /**导出按钮权限编码 */
93
- exportBtnCode: String
96
+ exportBtnCode: String,
97
+ /**显示导入按钮 */
98
+ importEnabled: Boolean,
99
+ /**导入按钮权限编码 */
100
+ importBtnCode: String
94
101
  },
95
102
  computed: {
96
103
  model_() {
@@ -186,6 +193,9 @@
186
193
  },
187
194
  onExport() {
188
195
  this.$parent.triggerExport()
196
+ },
197
+ onImport() {
198
+ this.$parent.triggerImport()
189
199
  }
190
200
  },
191
201
  mounted() {
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <section :class="class_" v-loading="showLoading" :element-loading-text="loadingText || loadingText_" :element-loading-background="loadingBackground" :element-loading-spinner="loadingSpinner">
3
3
  <!--header-->
4
- <query-header v-if="!noHeader" :title="title" :icon="icon" :no-fullscreen="noFullscreen" :fullscreen="fullscreen" :no-refresh="noRefresh" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation !== 'querybar'" :exportBtnCode="exportOptions_.btnCode">
4
+ <query-header v-if="!noHeader" :title="title" :icon="icon" :no-fullscreen="noFullscreen" :fullscreen="fullscreen" :no-refresh="noRefresh" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation !== 'querybar'" :exportBtnCode="exportOptions_.btnCode" :import-enabled="importOptions_.enabled && importOptions_.btnLocation !== 'querybar'" :importBtnCode="importOptions_.btnCode">
5
5
  <template v-slot:toolbar>
6
6
  <slot name="header-toolbar" :total="total" :selection="selection" />
7
7
  </template>
8
8
  </query-header>
9
9
 
10
10
  <!--查询栏-->
11
- <querybar ref="querybar" v-if="!noQuerybar" :model="model" :rules="rules" :input-width="inputWidth" :advanced="advanced" :no-search="noSearch" :no-reset="noReset" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation === 'querybar'" :export-btn-code="exportOptions_.btnCode" @reset="onQueryBarReset">
11
+ <querybar ref="querybar" v-if="!noQuerybar" :model="model" :rules="rules" :input-width="inputWidth" :advanced="advanced" :no-search="noSearch" :no-reset="noReset" :export-enabled="exportOptions_.enabled && exportOptions_.btnLocation === 'querybar'" :export-btn-code="exportOptions_.btnCode" :import-enabled="importOptions_.enabled && importOptions_.btnLocation === 'querybar'" :import-btn-code="importOptions_.btnCode" @reset="onQueryBarReset">
12
12
  <template v-slot>
13
13
  <slot name="querybar" />
14
14
  </template>