xianniu-ui 0.8.13 → 0.8.15

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": "xianniu-ui",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -9,6 +9,7 @@
9
9
  size="small"
10
10
  >
11
11
  <div class="xn-import">
12
+ <slot name="form"></slot>
12
13
  <el-link
13
14
  class="mb-20"
14
15
  type="success"
@@ -45,8 +46,8 @@
45
46
  </template>
46
47
  <div v-if="tip" slot="tip" class="el-upload__tip">{{ tip }}</div>
47
48
  </el-upload>
48
- <slot name="desc" class="xn-import-desc mt-10 fz-12">
49
- <el-alert title="注:" type="warning">
49
+ <slot name="desc" v-if="showDesc" class="xn-import-desc fz-12">
50
+ <el-alert title="注:" class=" mt-10" type="warning">
50
51
  <div>
51
52
  <p>
52
53
  1、非系统模板的文件会导入失败,请务必使用系统模板,点击上方按钮进行下载
@@ -84,10 +85,18 @@ export default {
84
85
  type: String,
85
86
  default: ".xls,.xlsx",
86
87
  },
88
+ showDesc: {
89
+ type: Boolean,
90
+ default: true,
91
+ },
87
92
  templateConfig: {
88
93
  type: Object,
89
94
  default: () => {},
90
95
  },
96
+ beforeConfirm: {
97
+ type: Function,
98
+ default: () => {},
99
+ },
91
100
  },
92
101
  data() {
93
102
  return {
@@ -133,10 +142,26 @@ export default {
133
142
  this.$utils.download(this.templateConfig);
134
143
  },
135
144
  handleConfirm() {
136
- if (!this.fileList.length) {
137
- return this.$message.warning("请选择要上传的文件");
145
+ if (
146
+ this.beforeConfirm &&
147
+ typeof this.beforeConfirm === "function" &&
148
+ this.isPromise(this.beforeConfirm())
149
+ ) {
150
+ this.beforeConfirm().then(() => {
151
+ if (!this.fileList.length) {
152
+ return this.$message.warning("请选择要上传的文件");
153
+ }
154
+ this.submit();
155
+ });
156
+ } else {
157
+ if (!this.fileList.length) {
158
+ return this.$message.warning("请选择要上传的文件");
159
+ }
160
+ this.submit();
138
161
  }
139
- this.submit();
162
+ },
163
+ isPromise(obj) {
164
+ return obj && Object.prototype.toString.call(obj) === "[object Promise]";
140
165
  },
141
166
  },
142
167
  };
@@ -22,6 +22,7 @@
22
22
  :key="item.prop"
23
23
  :data-level="(item.options && item.options.dataLevel) || 2"
24
24
  v-model="item.modelVal"
25
+ v-bind="item.options ? { ...item.options } : {}"
25
26
  @on-city="handleChangeCity"
26
27
 
27
28
  />