@v2coding/ui 0.1.5 → 0.1.9
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/dist/v2coding-ui.esm.js +557 -842
- package/dist/v2coding-ui.min.js +1 -1
- package/dist/v2coding-ui.ssr.js +578 -836
- package/package.json +2 -3
- package/src/components/dialog/dialog.vue +0 -179
- package/src/components/drawer/drawer.vue +0 -523
- package/src/components/exports/index.vue +0 -53
- package/src/components/exports/remote-exports-dialog.vue +0 -202
- package/src/components/field/field.autocomplete.vue +0 -21
- package/src/components/field/field.calendar.vue +0 -117
- package/src/components/field/field.cascade.vue +0 -233
- package/src/components/field/field.checkbox.vue +0 -134
- package/src/components/field/field.color.vue +0 -24
- package/src/components/field/field.date.vue +0 -145
- package/src/components/field/field.fence.vue +0 -856
- package/src/components/field/field.icons.vue +0 -123
- package/src/components/field/field.lnglat.vue +0 -236
- package/src/components/field/field.number.vue +0 -43
- package/src/components/field/field.radio.vue +0 -100
- package/src/components/field/field.rate.vue +0 -37
- package/src/components/field/field.rich.vue +0 -155
- package/src/components/field/field.select.vue +0 -210
- package/src/components/field/field.slider.vue +0 -66
- package/src/components/field/field.switch.vue +0 -14
- package/src/components/field/field.text.vue +0 -66
- package/src/components/field/field.timepicker.vue +0 -70
- package/src/components/field/field.timeselect.vue +0 -24
- package/src/components/field/field.trigger.dialog.vue +0 -50
- package/src/components/field/field.trigger.popover.vue +0 -63
- package/src/components/field/field.upload.file.vue +0 -241
- package/src/components/field/field.upload.image.vue +0 -125
- package/src/components/fill-view/fill-view.vue +0 -43
- package/src/components/form/form.dialog.vue +0 -174
- package/src/components/form/form.drawer.vue +0 -246
- package/src/components/form/form.fieldset.vue +0 -110
- package/src/components/form/form.item.vue +0 -210
- package/src/components/form/form.vue +0 -302
- package/src/components/head-menu/head-menu.vue +0 -188
- package/src/components/head-menu/menu-item.vue +0 -80
- package/src/components/history/history.vue +0 -361
- package/src/components/icon/icon.vue +0 -63
- package/src/components/minimize/minimize.vue +0 -342
- package/src/components/page/page.vue +0 -43
- package/src/components/page/search-page.vue +0 -202
- package/src/components/provider/provider.vue +0 -15
- package/src/components/scroll-view/scroll-view.vue +0 -384
- package/src/components/table/column.vue +0 -262
- package/src/components/table/table.pagination.vue +0 -71
- package/src/components/table/table.select.vue +0 -165
- package/src/components/table/table.vue +0 -807
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ui-file-upload-field">
|
|
3
|
-
<el-upload v-if="!preview" v-show="!limit || !pickerValue || pickerValue.length < limit" action="1" :show-file-list="false" :disabled="disabled" :http-request="upload" class="uploader" :class="{disabled: disabled || uploading}">
|
|
4
|
-
<div class="upload-btn" :class="{disabled: uploading}">浏览...</div>
|
|
5
|
-
</el-upload>
|
|
6
|
-
<div class="files">
|
|
7
|
-
<template v-for="(url, index) in pickerValue">
|
|
8
|
-
<div :key="index" v-if="!!url" class="file">
|
|
9
|
-
<i class="el-icon-document"> </i>
|
|
10
|
-
<a :href="url" target="_blank">{{ getFileName(url) }}</a>
|
|
11
|
-
<span v-if="hasDeleteBtn" class="close" @click="remove(url)"><i class="el-icon-close"></i></span>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import FieldMixin from './field.mixin';
|
|
20
|
-
import Upload from './field.helper.upload';
|
|
21
|
-
|
|
22
|
-
const getUrlSuffix = (url) => {
|
|
23
|
-
if (!url) {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
26
|
-
const index = url.lastIndexOf('.');
|
|
27
|
-
if (index === -1) {
|
|
28
|
-
return '';
|
|
29
|
-
}
|
|
30
|
-
return url.substring(index + 1);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
name: 'ui-field-upload-file',
|
|
35
|
-
mixins: [FieldMixin],
|
|
36
|
-
props: {
|
|
37
|
-
url: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: '/aliyun/oss',
|
|
40
|
-
},
|
|
41
|
-
params: Object,
|
|
42
|
-
filename: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: 'file',
|
|
45
|
-
},
|
|
46
|
-
uploadType: {
|
|
47
|
-
type: String,
|
|
48
|
-
validator: (val) => ['oss', 'default'].includes(val),
|
|
49
|
-
default: 'oss',
|
|
50
|
-
},
|
|
51
|
-
limit: {
|
|
52
|
-
type: Number,
|
|
53
|
-
default: 0,
|
|
54
|
-
},
|
|
55
|
-
deleteBtn: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: true,
|
|
58
|
-
},
|
|
59
|
-
/**
|
|
60
|
-
* eg: beforeUpload(file) { ... }
|
|
61
|
-
*
|
|
62
|
-
* return false will cancel upload
|
|
63
|
-
**/
|
|
64
|
-
beforeUpload: {
|
|
65
|
-
type: Function,
|
|
66
|
-
default: () => () => void 0,
|
|
67
|
-
},
|
|
68
|
-
disabled: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: false,
|
|
71
|
-
},
|
|
72
|
-
preview: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: false,
|
|
75
|
-
},
|
|
76
|
-
needCreateAttachment: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: false,
|
|
79
|
-
},
|
|
80
|
-
createAttachmentUrl: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: '/Sys/SysAttachment/create',
|
|
83
|
-
},
|
|
84
|
-
createAttachmentParams: null,
|
|
85
|
-
createAttachment: {
|
|
86
|
-
type: Function,
|
|
87
|
-
default: function(file, url) {
|
|
88
|
-
const params = {name: file.name, suffix: getUrlSuffix(url), url, ...(this.createAttachmentParams || {})};
|
|
89
|
-
return this.$axios.post(this.createAttachmentUrl, params);
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
data() {
|
|
94
|
-
return {
|
|
95
|
-
uploading: false,
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
computed: {
|
|
99
|
-
pickerValue() {
|
|
100
|
-
if (!this.value || typeof this.value !== 'string') {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
return this.value.split(',');
|
|
104
|
-
},
|
|
105
|
-
hasDeleteBtn() {
|
|
106
|
-
if (this.preview || this.disabled) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
return this.deleteBtn;
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
methods: {
|
|
113
|
-
upload(opt) {
|
|
114
|
-
const {file} = opt;
|
|
115
|
-
const allow = this.beforeUpload(file);
|
|
116
|
-
if (allow === false) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (this.uploading) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
this.uploading = true;
|
|
123
|
-
const uploadServer = Upload[this.uploadType] || Upload.default;
|
|
124
|
-
uploadServer(this.url, {filename: file.name}, {file, filename: this.filename}).then((result) => {
|
|
125
|
-
this.uploading = false;
|
|
126
|
-
if (!result.success) {
|
|
127
|
-
this.$message.error(result.message || '上传失败');
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
this.$message.success('上传成功');
|
|
131
|
-
const url = result.content.url;
|
|
132
|
-
this.onChange([...this.pickerValue, url].join(','));
|
|
133
|
-
this.$emit('afterUpload', result);
|
|
134
|
-
if (this.needCreateAttachment && typeof this.createAttachment === 'function') {
|
|
135
|
-
this.createAttachment(file, url).then(result => {
|
|
136
|
-
this.$emit('create-attachment', result);
|
|
137
|
-
}).catch(error => {
|
|
138
|
-
this.$emit('create-attachment', error);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}).catch(() => {
|
|
142
|
-
this.uploading = false;
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
remove(url) {
|
|
146
|
-
console.log(this.pickerValue);
|
|
147
|
-
console.log(url);
|
|
148
|
-
const index = this.pickerValue.indexOf(url);
|
|
149
|
-
console.log(index);
|
|
150
|
-
if (index === -1) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const cloneValue = [...this.pickerValue];
|
|
154
|
-
cloneValue.splice(index, 1);
|
|
155
|
-
this.onChange(cloneValue.join(','));
|
|
156
|
-
this.$emit('deleteUpload', url);
|
|
157
|
-
},
|
|
158
|
-
getFileName(url) {
|
|
159
|
-
const pathname = new URL(url).pathname;
|
|
160
|
-
return pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
</script>
|
|
165
|
-
|
|
166
|
-
<style lang="less" scoped>
|
|
167
|
-
@primary-color: #409eff;
|
|
168
|
-
|
|
169
|
-
.ui-file-upload-field {
|
|
170
|
-
width: 100%;
|
|
171
|
-
.uploader {
|
|
172
|
-
margin-bottom: 5px;
|
|
173
|
-
|
|
174
|
-
&.disabled ::v-deep .el-upload {
|
|
175
|
-
cursor: not-allowed;
|
|
176
|
-
pointer-events: none;
|
|
177
|
-
|
|
178
|
-
.upload-btn {
|
|
179
|
-
color: #888c94;
|
|
180
|
-
background-color: #edeef0;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.upload-btn {
|
|
186
|
-
padding: 5px 10px;
|
|
187
|
-
line-height: 1;
|
|
188
|
-
background-color: @primary-color;
|
|
189
|
-
color: #fff;
|
|
190
|
-
font-size: 12px;
|
|
191
|
-
transition: background-color 0.3s;
|
|
192
|
-
|
|
193
|
-
&:hover {
|
|
194
|
-
background-color: darken(@primary-color, 10%);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.files {
|
|
199
|
-
.file {
|
|
200
|
-
color: #606266;
|
|
201
|
-
font-size: 14px;
|
|
202
|
-
transition: all 0.3s;
|
|
203
|
-
cursor: pointer;
|
|
204
|
-
line-height: 28px;
|
|
205
|
-
display: flex;
|
|
206
|
-
align-items: center;
|
|
207
|
-
|
|
208
|
-
a {
|
|
209
|
-
flex: 1;
|
|
210
|
-
color: #606266;
|
|
211
|
-
transition: all 0.3s;
|
|
212
|
-
overflow: hidden;
|
|
213
|
-
text-overflow: ellipsis;
|
|
214
|
-
white-space: nowrap;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.close {
|
|
218
|
-
color: transparent;
|
|
219
|
-
width: 28px;
|
|
220
|
-
text-align: center;
|
|
221
|
-
visibility: hidden;
|
|
222
|
-
transition: color 0.3s;
|
|
223
|
-
font-weight: bold;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
&:hover {
|
|
227
|
-
background-color: #f5f7fa;
|
|
228
|
-
|
|
229
|
-
a {
|
|
230
|
-
color: #409eff;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.close {
|
|
234
|
-
color: @primary-color;
|
|
235
|
-
visibility: visible;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
</style>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ui-image-upload-field">
|
|
3
|
-
<div v-for="(url, index) in pickerValue" :key="index" class="item">
|
|
4
|
-
<el-image :src="url" :preview-src-list="previewBtn ? pickerValue : []" style="width: 100%; height: 100%;"/>
|
|
5
|
-
<div v-if="hasDeleteBtn" class="remove" @click="remove(url)">
|
|
6
|
-
<i class="el-icon-close"></i>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
<el-upload v-if="!preview" action="1" :show-file-list="false" :http-request="upload" class="uploader" :disabled="disabled" :class="{disabled: disabled || uploading}">
|
|
10
|
-
<div v-show="!limit || !pickerValue || pickerValue.length < limit" class="item upload-btn">
|
|
11
|
-
<i class="el-icon-plus"></i>
|
|
12
|
-
<span>上传图片</span>
|
|
13
|
-
</div>
|
|
14
|
-
</el-upload>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import FileUploadField from './field.upload.file';
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
name: 'ui-field-upload-image',
|
|
23
|
-
mixins: [FileUploadField],
|
|
24
|
-
props: {
|
|
25
|
-
previewBtn: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: true,
|
|
28
|
-
},
|
|
29
|
-
url: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: '/aliyun/oss',
|
|
32
|
-
},
|
|
33
|
-
uploadType: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: 'oss',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style lang="less" scoped>
|
|
42
|
-
.ui-image-upload-field {
|
|
43
|
-
width: 100%;
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: row;
|
|
46
|
-
flex-wrap: wrap;
|
|
47
|
-
|
|
48
|
-
.uploader.disabled ::v-deep .el-upload {
|
|
49
|
-
cursor: not-allowed;
|
|
50
|
-
pointer-events: none;
|
|
51
|
-
|
|
52
|
-
.upload-btn {
|
|
53
|
-
background: #edeef0;
|
|
54
|
-
color: #888c94;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.item {
|
|
59
|
-
position: relative;
|
|
60
|
-
display: flex;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
align-items: center;
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
width: 140px;
|
|
65
|
-
height: 140px;
|
|
66
|
-
margin-bottom: 10px;
|
|
67
|
-
margin-right: 10px;
|
|
68
|
-
border: 1px dashed #d0d2d7;
|
|
69
|
-
padding: 8px;
|
|
70
|
-
border-radius: 2px;
|
|
71
|
-
box-sizing: border-box;
|
|
72
|
-
|
|
73
|
-
.remove {
|
|
74
|
-
position: absolute;
|
|
75
|
-
top: 0;
|
|
76
|
-
right: 0;
|
|
77
|
-
width: 24px;
|
|
78
|
-
height: 24px;
|
|
79
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
80
|
-
border-radius: 0 0 0 22px;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
|
|
83
|
-
.el-icon-close {
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 4px;
|
|
86
|
-
right: 4px;
|
|
87
|
-
color: #fff;
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&.upload-btn {
|
|
93
|
-
background: #f7f8f9;
|
|
94
|
-
display: flex;
|
|
95
|
-
flex-direction: column;
|
|
96
|
-
align-items: center;
|
|
97
|
-
justify-content: center;
|
|
98
|
-
border: none;
|
|
99
|
-
color: #409eff;
|
|
100
|
-
|
|
101
|
-
& > .el-icon-plus {
|
|
102
|
-
font-size: 1.6em;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
& > span {
|
|
106
|
-
font-size: 16px;
|
|
107
|
-
line-height: 1.2;
|
|
108
|
-
margin-top: 5px;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.item:hover .modal {
|
|
114
|
-
visibility: visible;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
::v-deep .preview {
|
|
118
|
-
display: inline-block;
|
|
119
|
-
width: auto;
|
|
120
|
-
max-width: 60%;
|
|
121
|
-
left: 50%;
|
|
122
|
-
transform: translateX(-50%);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
</style>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['ui-fill-view', direction]">
|
|
3
|
-
<div class="wrapper" :style="directionStyle">
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</div>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
export default {
|
|
11
|
-
name: 'ui-fill-view',
|
|
12
|
-
props: {
|
|
13
|
-
direction: {
|
|
14
|
-
validator: (val) => ['column', 'row'].includes(val),
|
|
15
|
-
default: 'column',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
computed: {
|
|
19
|
-
directionStyle() {
|
|
20
|
-
return {
|
|
21
|
-
flexDirection: this.direction,
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style lang="less" scoped>
|
|
29
|
-
.ui-fill-view {
|
|
30
|
-
flex: 1;
|
|
31
|
-
position: relative;
|
|
32
|
-
|
|
33
|
-
.wrapper {
|
|
34
|
-
position: absolute;
|
|
35
|
-
top: 0;
|
|
36
|
-
bottom: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
right: 0;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ui-dialog v-bind="$attrs" v-on="dialogListeners" :buttons="false" :visible="visible" :append-to-body="appendToBody" @open="onOpen" @opened="onOpened" @closed="onClosed" @update:visible="updateVisible">
|
|
3
|
-
<ui-form ref="form" :fields="fields" :label-width="labelWidth" :label-position="labelPosition" :disabled="disabled" v-loading="loading" @submit="onSubmit" @ready="onReady">
|
|
4
|
-
<slot></slot>
|
|
5
|
-
<div class="action-button" v-if="disabled !== true">
|
|
6
|
-
<el-button size="medium" icon="el-icon-error" @click="onCancel">{{cancelText}}</el-button>
|
|
7
|
-
<el-button size="medium" type="primary" icon="el-icon-success" native-type="submit" :disabled="!ready" :loading="submitting">{{confirmText}}</el-button>
|
|
8
|
-
</div>
|
|
9
|
-
</ui-form>
|
|
10
|
-
</ui-dialog>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
name: 'ui-form-dialog',
|
|
16
|
-
inheritAttrs: false,
|
|
17
|
-
props: {
|
|
18
|
-
value: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: () => ({}),
|
|
21
|
-
},
|
|
22
|
-
visible: Boolean,
|
|
23
|
-
method: {
|
|
24
|
-
type: String,
|
|
25
|
-
validator: (val) => ['get', 'post'].includes(val),
|
|
26
|
-
default: 'post',
|
|
27
|
-
},
|
|
28
|
-
url: String,
|
|
29
|
-
cancelText: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: '取消',
|
|
32
|
-
},
|
|
33
|
-
confirmText: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '确定',
|
|
36
|
-
},
|
|
37
|
-
cancel: {
|
|
38
|
-
type: Function,
|
|
39
|
-
default: () => void 0,
|
|
40
|
-
},
|
|
41
|
-
beforeSubmit: {
|
|
42
|
-
type: Function,
|
|
43
|
-
default: () => void 0,
|
|
44
|
-
},
|
|
45
|
-
afterSubmit: {
|
|
46
|
-
type: Function,
|
|
47
|
-
default: () => void 0,
|
|
48
|
-
},
|
|
49
|
-
fields: Array,
|
|
50
|
-
loading: Boolean,
|
|
51
|
-
appendToBody: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: true,
|
|
54
|
-
},
|
|
55
|
-
labelWidth: String,
|
|
56
|
-
labelPosition: String,
|
|
57
|
-
disabled: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: undefined,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
data () {
|
|
63
|
-
return {
|
|
64
|
-
ready: false,
|
|
65
|
-
submitting: false,
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
computed: {
|
|
69
|
-
dialogListeners () {
|
|
70
|
-
// submit/ready 属于当前组件自定义事件, 非 dialog 的事件
|
|
71
|
-
// eslint-disable-next-line
|
|
72
|
-
const { submit, ready, ...listeners } = this.$listeners;
|
|
73
|
-
return listeners;
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
watch: {
|
|
77
|
-
visible: 'onVisibleChange',
|
|
78
|
-
},
|
|
79
|
-
methods: {
|
|
80
|
-
onReady () {
|
|
81
|
-
this.ready = true;
|
|
82
|
-
this.$emit('ready');
|
|
83
|
-
},
|
|
84
|
-
onCancel () {
|
|
85
|
-
const allow = this.cancel();
|
|
86
|
-
if (allow === false) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.updateVisible(false);
|
|
90
|
-
},
|
|
91
|
-
updateVisible (visible) {
|
|
92
|
-
this.$emit('update:visible', visible);
|
|
93
|
-
},
|
|
94
|
-
async onVisibleChange(visible) {
|
|
95
|
-
if (!visible) {
|
|
96
|
-
await this.$nextTick();
|
|
97
|
-
this.clearValidate();
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
submit () {
|
|
101
|
-
this.$refs.form.onSubmit();
|
|
102
|
-
},
|
|
103
|
-
resetValues (values) {
|
|
104
|
-
if (!this.$refs.form) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
this.$refs.form.resetValues(values);
|
|
108
|
-
},
|
|
109
|
-
clearValidate () {
|
|
110
|
-
if (!this.$refs.form) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this.$refs.form.clearValidate()
|
|
114
|
-
},
|
|
115
|
-
getValues () {
|
|
116
|
-
if (!this.$refs.form) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
return this.$refs.form.getValues();
|
|
120
|
-
},
|
|
121
|
-
setValues (values) {
|
|
122
|
-
if (!this.$refs.form) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
this.$refs.form.setValues(values);
|
|
126
|
-
},
|
|
127
|
-
onSubmit (formData) {
|
|
128
|
-
if (!this.ready) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
this.$emit('submit', { ...formData });
|
|
132
|
-
const allow = this.beforeSubmit(formData);
|
|
133
|
-
if (typeof allow === 'boolean' && allow === false) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (typeof allow === 'object') {
|
|
137
|
-
formData = allow;
|
|
138
|
-
}
|
|
139
|
-
if (!this.url) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
let def;
|
|
143
|
-
this.submitting = true;
|
|
144
|
-
if (this.method === 'get') {
|
|
145
|
-
def = this.getWithMessage(this.url, { params: formData });
|
|
146
|
-
} else {
|
|
147
|
-
def = this.postWithMessage(this.url, formData);
|
|
148
|
-
}
|
|
149
|
-
def.then((...args) => {
|
|
150
|
-
this.submitting = false;
|
|
151
|
-
this.$emit('after-submit', ...args);
|
|
152
|
-
}).catch((...args) => {
|
|
153
|
-
this.submitting = false;
|
|
154
|
-
return Promise.reject(...args);
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
onOpen () {
|
|
158
|
-
},
|
|
159
|
-
onOpened () {
|
|
160
|
-
},
|
|
161
|
-
onClosed () {
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
</script>
|
|
166
|
-
|
|
167
|
-
<style lang="scss" scoped>
|
|
168
|
-
.action-button {
|
|
169
|
-
text-align: right;
|
|
170
|
-
margin: 0 -20px -20px;
|
|
171
|
-
padding: 10px 20px;
|
|
172
|
-
border-top: 1px solid #e8e8e8;
|
|
173
|
-
}
|
|
174
|
-
</style>
|