@truenewx/tnxvue3 3.4.0 → 3.4.1
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/eslint.config.cjs +58 -0
- package/index.html +12 -12
- package/package.json +16 -40
- package/src/aj-captcha/Verify/VerifySlide.vue +9 -9
- package/src/aj-captcha/api/index.js +2 -10
- package/src/aj-captcha/utils/ase.js +1 -1
- package/src/bootstrap-vue/alert/Alert.vue +79 -79
- package/src/bootstrap-vue/button/Button.vue +40 -40
- package/src/bootstrap-vue/enum-select/EnumSelect.vue +4 -5
- package/src/bootstrap-vue/form/Form.vue +320 -320
- package/src/bootstrap-vue/form/FormGroup.vue +73 -73
- package/src/bootstrap-vue/loading-icon/LoadingIcon.vue +46 -46
- package/src/bootstrap-vue/paged/Paged.vue +119 -119
- package/src/bootstrap-vue/progress/Progress.vue +58 -58
- package/src/bootstrap-vue/query-table/QueryTable.vue +84 -84
- package/src/bootstrap-vue/region-cascader/RegionCascader.vue +119 -119
- package/src/bootstrap-vue/select/Select.vue +375 -375
- package/src/bootstrap-vue/submit-form/SubmitForm.vue +180 -176
- package/src/bootstrap-vue/tags-input/TagsInput.vue +64 -64
- package/src/bootstrap-vue/tnxbsv.css +107 -107
- package/src/bootstrap-vue/tnxbsv.js +109 -92
- package/src/bootstrap-vue/upload/Upload.vue +173 -173
- package/src/element-plus/avatar/Avatar.vue +8 -9
- package/src/element-plus/button/Button.vue +2 -2
- package/src/element-plus/curd/Curd.vue +20 -23
- package/src/element-plus/date-picker/DatePicker.vue +1 -1
- package/src/element-plus/detail-form/DetailForm.vue +1 -1
- package/src/element-plus/dialog/Dialog.vue +18 -20
- package/src/element-plus/drawer/Drawer.vue +10 -9
- package/src/element-plus/edit-table/EditTable.vue +3 -3
- package/src/element-plus/enum-select/EnumSelect.vue +3 -3
- package/src/element-plus/enum-view/EnumView.vue +41 -41
- package/src/element-plus/fetch-cascader/FetchCascader.vue +3 -4
- package/src/element-plus/fetch-select/FetchSelect.vue +10 -11
- package/src/element-plus/fetch-tags/FetchTags.vue +4 -5
- package/src/element-plus/fss-upload/FssUpload.vue +18 -18
- package/src/element-plus/fss-view/FssView.vue +1 -1
- package/src/element-plus/icon/Icon.vue +6 -0
- package/src/element-plus/input-dropdown/InputDropdown.vue +74 -74
- package/src/element-plus/query-form/QueryForm.vue +1 -1
- package/src/element-plus/query-table/QueryTable.vue +22 -26
- package/src/element-plus/region-cascader/RegionCascader.vue +4 -5
- package/src/element-plus/select/Select.vue +2 -2
- package/src/element-plus/steps-nav/StepsNav.vue +3 -4
- package/src/element-plus/submit-form/SubmitForm.vue +36 -39
- package/src/element-plus/tabs/Tabs.vue +1 -1
- package/src/element-plus/tnxel.css +22 -0
- package/src/element-plus/tnxel.js +101 -93
- package/src/element-plus/toolbar/ToolBarItem.js +15 -15
- package/src/element-plus/toolbar/Toolbar.vue +56 -56
- package/src/element-plus/transfer/Transfer.vue +8 -9
- package/src/element-plus/upload/Upload.vue +24 -24
- package/src/tnxvue-router.js +4 -4
- package/src/tnxvue-validator.js +8 -2
- package/src/tnxvue.js +13 -26
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="tnxbsv-upload">
|
|
3
|
-
<BOverlay :show="uploading" spinner-variant="primary" spinner-small>
|
|
4
|
-
<BInputGroup>
|
|
5
|
-
<BFormInput :value="file?.name" :placeholder="placeholder" tabindex="-1" readonly/>
|
|
6
|
-
<template #append>
|
|
7
|
-
<div class="input-group-append">
|
|
8
|
-
<i class="bi bi-x-circle icon-clear" @click="clear" v-if="empty"/>
|
|
9
|
-
<BButton :variant="buttonType" @click="toSelect">{{ buttonText }}</BButton>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
</BInputGroup>
|
|
13
|
-
<BFormFile class="d-none" v-model="file" :accept="uploadOptions.extensions || accept"/>
|
|
14
|
-
</BOverlay>
|
|
15
|
-
<div class="tnxbsv-upload-error" v-if="errorMessage">{{ errorMessage }}</div>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import {BOverlay, BInputGroup, BFormInput, BButton, BFormFile} from 'bootstrap-vue-next';
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
name: 'TnxbsvUpload',
|
|
24
|
-
components: {BOverlay, BInputGroup, BFormInput, BButton, BFormFile,},
|
|
25
|
-
props: {
|
|
26
|
-
app: String, // 上传目标应用名称
|
|
27
|
-
action: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
accept: [String, Array],
|
|
32
|
-
uploadOptions: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => ({}),
|
|
35
|
-
},
|
|
36
|
-
placeholder: String,
|
|
37
|
-
buttonType: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: 'light',
|
|
40
|
-
},
|
|
41
|
-
buttonText: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: '选择文件',
|
|
44
|
-
},
|
|
45
|
-
empty: Boolean,
|
|
46
|
-
beforeUpload: Function,
|
|
47
|
-
onSuccess: Function,
|
|
48
|
-
onError: Function,
|
|
49
|
-
},
|
|
50
|
-
data() {
|
|
51
|
-
return {
|
|
52
|
-
file: null,
|
|
53
|
-
uploading: false,
|
|
54
|
-
errorMessage: null,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
computed: {
|
|
58
|
-
actionUrl() {
|
|
59
|
-
let baseUrl;
|
|
60
|
-
if (this.app) {
|
|
61
|
-
baseUrl = window.tnx.app.rpc.getBaseUrl(this.app);
|
|
62
|
-
}
|
|
63
|
-
baseUrl = baseUrl || window.tnx.app.rpc.getDefaultBaseUrl();
|
|
64
|
-
return baseUrl + this.action;
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
watch: {
|
|
68
|
-
file(newFile, oldFile) {
|
|
69
|
-
if (newFile) {
|
|
70
|
-
if (!newFile.handled) {
|
|
71
|
-
this.uploadFile();
|
|
72
|
-
}
|
|
73
|
-
} else if (!oldFile.handled) {
|
|
74
|
-
oldFile.handled = true;
|
|
75
|
-
this.file = oldFile;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
mounted() {
|
|
80
|
-
this.file = null;
|
|
81
|
-
this.uploading = false;
|
|
82
|
-
this.errorMessage = null;
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
toSelect() {
|
|
86
|
-
const $ = window.tnx.libs.$;
|
|
87
|
-
$('.tnxbsv-upload input[type="file"]').trigger('click')
|
|
88
|
-
},
|
|
89
|
-
clear() {
|
|
90
|
-
this.file.handled = true;
|
|
91
|
-
this.$nextTick(() => {
|
|
92
|
-
this.file = null;
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
uploadFile() {
|
|
96
|
-
if (this.file) {
|
|
97
|
-
if (this.beforeUpload && this.beforeUpload(this.file) === false) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const formData = new FormData();
|
|
101
|
-
formData.append('file', this.file);
|
|
102
|
-
this.uploading = true;
|
|
103
|
-
this.errorMessage = null;
|
|
104
|
-
|
|
105
|
-
window.tnx.app.rpc.request(this.actionUrl, {
|
|
106
|
-
method: 'POST',
|
|
107
|
-
body: formData,
|
|
108
|
-
timeout: 0, // 文件上传不设置超时
|
|
109
|
-
app: this.app, // 指定目标应用
|
|
110
|
-
success: result => {
|
|
111
|
-
if (this.onSuccess) {
|
|
112
|
-
this.onSuccess(result);
|
|
113
|
-
} else {
|
|
114
|
-
console.log('文件上传成功:', result);
|
|
115
|
-
}
|
|
116
|
-
this.uploading = false;
|
|
117
|
-
},
|
|
118
|
-
error: error => {
|
|
119
|
-
this.uploading = false;
|
|
120
|
-
if (this.onError && this.onError(error) === false) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this.errorMessage = error.message;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<style>
|
|
133
|
-
.tnxbsv-upload input:focus {
|
|
134
|
-
outline: none;
|
|
135
|
-
box-shadow: none;
|
|
136
|
-
border-color: var(--bs-border-color);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.tnxbsv-upload .input-group-append {
|
|
140
|
-
position: relative;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.tnxbsv-upload .input-group-append .icon-clear {
|
|
144
|
-
position: absolute;
|
|
145
|
-
right: calc(100% + 0.75rem);
|
|
146
|
-
top: 50%;
|
|
147
|
-
transform: translateY(-50%);
|
|
148
|
-
cursor: pointer;
|
|
149
|
-
z-index: 10;
|
|
150
|
-
color: var(--bs-tertiary-color);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.tnxbsv-upload .input-group-append .icon-clear:hover {
|
|
154
|
-
color: var(--bs-secondary-color);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.tnxbsv-upload .input-group-append .btn {
|
|
158
|
-
border-top-left-radius: 0;
|
|
159
|
-
border-bottom-left-radius: 0;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.tnxbsv-upload-error {
|
|
163
|
-
margin-top: 0.25rem;
|
|
164
|
-
color: var(--bs-danger);
|
|
165
|
-
font-size: 87.5%;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.tnxbsv-upload-placeholder {
|
|
169
|
-
margin-top: 0.25rem;
|
|
170
|
-
color: var(--bs-tertiary-color);
|
|
171
|
-
font-size: 87.5%;
|
|
172
|
-
}
|
|
173
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tnxbsv-upload">
|
|
3
|
+
<BOverlay :show="uploading" spinner-variant="primary" spinner-small>
|
|
4
|
+
<BInputGroup>
|
|
5
|
+
<BFormInput :value="file?.name" :placeholder="placeholder" tabindex="-1" readonly/>
|
|
6
|
+
<template #append>
|
|
7
|
+
<div class="input-group-append">
|
|
8
|
+
<i class="bi bi-x-circle icon-clear" @click="clear" v-if="empty"/>
|
|
9
|
+
<BButton :variant="buttonType" @click="toSelect">{{ buttonText }}</BButton>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
</BInputGroup>
|
|
13
|
+
<BFormFile class="d-none" v-model="file" :accept="uploadOptions.extensions || accept"/>
|
|
14
|
+
</BOverlay>
|
|
15
|
+
<div class="tnxbsv-upload-error" v-if="errorMessage">{{ errorMessage }}</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import {BOverlay, BInputGroup, BFormInput, BButton, BFormFile} from 'bootstrap-vue-next';
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
name: 'TnxbsvUpload',
|
|
24
|
+
components: {BOverlay, BInputGroup, BFormInput, BButton, BFormFile,},
|
|
25
|
+
props: {
|
|
26
|
+
app: String, // 上传目标应用名称
|
|
27
|
+
action: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
accept: [String, Array],
|
|
32
|
+
uploadOptions: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({}),
|
|
35
|
+
},
|
|
36
|
+
placeholder: String,
|
|
37
|
+
buttonType: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'light',
|
|
40
|
+
},
|
|
41
|
+
buttonText: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '选择文件',
|
|
44
|
+
},
|
|
45
|
+
empty: Boolean,
|
|
46
|
+
beforeUpload: Function,
|
|
47
|
+
onSuccess: Function,
|
|
48
|
+
onError: Function,
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
file: null,
|
|
53
|
+
uploading: false,
|
|
54
|
+
errorMessage: null,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
actionUrl() {
|
|
59
|
+
let baseUrl;
|
|
60
|
+
if (this.app) {
|
|
61
|
+
baseUrl = window.tnx.app.rpc.getBaseUrl(this.app);
|
|
62
|
+
}
|
|
63
|
+
baseUrl = baseUrl || window.tnx.app.rpc.getDefaultBaseUrl();
|
|
64
|
+
return baseUrl + this.action;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
file(newFile, oldFile) {
|
|
69
|
+
if (newFile) {
|
|
70
|
+
if (!newFile.handled) {
|
|
71
|
+
this.uploadFile();
|
|
72
|
+
}
|
|
73
|
+
} else if (!oldFile.handled) {
|
|
74
|
+
oldFile.handled = true;
|
|
75
|
+
this.file = oldFile;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
mounted() {
|
|
80
|
+
this.file = null;
|
|
81
|
+
this.uploading = false;
|
|
82
|
+
this.errorMessage = null;
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
toSelect() {
|
|
86
|
+
const $ = window.tnx.libs.$;
|
|
87
|
+
$('.tnxbsv-upload input[type="file"]').trigger('click')
|
|
88
|
+
},
|
|
89
|
+
clear() {
|
|
90
|
+
this.file.handled = true;
|
|
91
|
+
this.$nextTick(() => {
|
|
92
|
+
this.file = null;
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
uploadFile() {
|
|
96
|
+
if (this.file) {
|
|
97
|
+
if (this.beforeUpload && this.beforeUpload(this.file) === false) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const formData = new FormData();
|
|
101
|
+
formData.append('file', this.file);
|
|
102
|
+
this.uploading = true;
|
|
103
|
+
this.errorMessage = null;
|
|
104
|
+
|
|
105
|
+
window.tnx.app.rpc.request(this.actionUrl, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
body: formData,
|
|
108
|
+
timeout: 0, // 文件上传不设置超时
|
|
109
|
+
app: this.app, // 指定目标应用
|
|
110
|
+
success: result => {
|
|
111
|
+
if (this.onSuccess) {
|
|
112
|
+
this.onSuccess(result);
|
|
113
|
+
} else {
|
|
114
|
+
console.log('文件上传成功:', result);
|
|
115
|
+
}
|
|
116
|
+
this.uploading = false;
|
|
117
|
+
},
|
|
118
|
+
error: error => {
|
|
119
|
+
this.uploading = false;
|
|
120
|
+
if (this.onError && this.onError(error) === false) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.errorMessage = error.message;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<style>
|
|
133
|
+
.tnxbsv-upload input:focus {
|
|
134
|
+
outline: none;
|
|
135
|
+
box-shadow: none;
|
|
136
|
+
border-color: var(--bs-border-color);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.tnxbsv-upload .input-group-append {
|
|
140
|
+
position: relative;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tnxbsv-upload .input-group-append .icon-clear {
|
|
144
|
+
position: absolute;
|
|
145
|
+
right: calc(100% + 0.75rem);
|
|
146
|
+
top: 50%;
|
|
147
|
+
transform: translateY(-50%);
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
z-index: 10;
|
|
150
|
+
color: var(--bs-tertiary-color);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tnxbsv-upload .input-group-append .icon-clear:hover {
|
|
154
|
+
color: var(--bs-secondary-color);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.tnxbsv-upload .input-group-append .btn {
|
|
158
|
+
border-top-left-radius: 0;
|
|
159
|
+
border-bottom-left-radius: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.tnxbsv-upload-error {
|
|
163
|
+
margin-top: 0.25rem;
|
|
164
|
+
color: var(--bs-danger);
|
|
165
|
+
font-size: 87.5%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.tnxbsv-upload-placeholder {
|
|
169
|
+
margin-top: 0.25rem;
|
|
170
|
+
color: var(--bs-tertiary-color);
|
|
171
|
+
font-size: 87.5%;
|
|
172
|
+
}
|
|
173
|
+
</style>
|
|
@@ -76,13 +76,12 @@ export default {
|
|
|
76
76
|
if (this.url && this.url.startsWith(window.tnx.fss.PROTOCOL)) {
|
|
77
77
|
let rpc = window.tnx.app.rpc;
|
|
78
78
|
let fssConfig = window.tnx.fss.getClientConfig();
|
|
79
|
-
|
|
80
|
-
if (vm.preview) {
|
|
79
|
+
if (this.preview) {
|
|
81
80
|
rpc.get(fssConfig.contextUrl + '/meta', {
|
|
82
|
-
locationUrl:
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
locationUrl: this.url
|
|
82
|
+
}, (meta) => {
|
|
83
|
+
this.src = meta.thumbnailReadUrl;
|
|
84
|
+
this.previewSrcList = [meta.readUrl];
|
|
86
85
|
}, {
|
|
87
86
|
app: fssConfig.appName,
|
|
88
87
|
error(errors) {
|
|
@@ -91,10 +90,10 @@ export default {
|
|
|
91
90
|
});
|
|
92
91
|
} else {
|
|
93
92
|
rpc.get(fssConfig.contextUrl + '/read/url', {
|
|
94
|
-
locationUrl:
|
|
93
|
+
locationUrl: this.url,
|
|
95
94
|
thumbnail: true,
|
|
96
|
-
},
|
|
97
|
-
|
|
95
|
+
}, (readUrl) => {
|
|
96
|
+
this.src = readUrl;
|
|
98
97
|
}, {
|
|
99
98
|
app: fssConfig.appName,
|
|
100
99
|
error(errors) {
|
|
@@ -161,7 +161,7 @@ export default {
|
|
|
161
161
|
this.finalDisabled = this.disabled || !this.granted;
|
|
162
162
|
} else if (this.menu && this.path) {
|
|
163
163
|
let vm = this;
|
|
164
|
-
this.menu.loadGrantedItems(
|
|
164
|
+
this.menu.loadGrantedItems(() => {
|
|
165
165
|
vm.finalDisabled = this.disabled || !vm.menu.isGranted(vm.path);
|
|
166
166
|
vm.buildDropdownItems();
|
|
167
167
|
});
|
|
@@ -201,7 +201,7 @@ export default {
|
|
|
201
201
|
} else if (this.$router && this.click !== true && item.menuItem && item.menuItem.path) {
|
|
202
202
|
// click属性为true时执行点击动作而不是跳转
|
|
203
203
|
let vm = this;
|
|
204
|
-
this.$router.push(item.path).catch(
|
|
204
|
+
this.$router.push(item.path).catch(() => {
|
|
205
205
|
// 指定路径无法跳转,则触发点击事件
|
|
206
206
|
vm.$emit('click', item.path);
|
|
207
207
|
});
|
|
@@ -109,19 +109,18 @@ export default {
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
toAdd() {
|
|
112
|
-
let vm = this;
|
|
113
112
|
window.tnx.open(this.page, this.pageProps, {
|
|
114
|
-
title:
|
|
115
|
-
click:
|
|
113
|
+
title: this.addText + (this.modelName || ''),
|
|
114
|
+
click: (yes, close) => {
|
|
116
115
|
if (yes) {
|
|
117
116
|
if (typeof this.validateForm === 'function') {
|
|
118
|
-
this.validateForm(
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
this.validateForm((model) => {
|
|
118
|
+
if (this.add) {
|
|
119
|
+
this.add(model, () => {
|
|
120
|
+
this._onAdded(model, close);
|
|
122
121
|
});
|
|
123
122
|
} else {
|
|
124
|
-
|
|
123
|
+
this._onAdded(model, close);
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
return false;
|
|
@@ -164,26 +163,25 @@ export default {
|
|
|
164
163
|
toUpdate(index) {
|
|
165
164
|
let model = Object.assign({}, this.list[index]);
|
|
166
165
|
if (model) {
|
|
167
|
-
let vm = this;
|
|
168
166
|
window.tnx.open(this.page, {
|
|
169
167
|
modelValue: model
|
|
170
168
|
}, {
|
|
171
|
-
title:
|
|
172
|
-
click:
|
|
169
|
+
title: this.updateText + (this.modelName || ''),
|
|
170
|
+
click: (yes, close) => {
|
|
173
171
|
if (yes) {
|
|
174
172
|
if (typeof this.validateForm === 'function') {
|
|
175
|
-
this.validateForm(
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
this.validateForm((model) => {
|
|
174
|
+
if (this.update) {
|
|
175
|
+
this.update(index, model, () => {
|
|
176
|
+
this._onUpdated(index, model, close);
|
|
179
177
|
});
|
|
180
178
|
} else {
|
|
181
|
-
|
|
179
|
+
this._onUpdated(index, model, close);
|
|
182
180
|
}
|
|
183
181
|
});
|
|
184
182
|
return false;
|
|
185
183
|
} else {
|
|
186
|
-
|
|
184
|
+
this._onUpdated(index, model, close);
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
}
|
|
@@ -199,16 +197,15 @@ export default {
|
|
|
199
197
|
close();
|
|
200
198
|
},
|
|
201
199
|
toRemove(index) {
|
|
202
|
-
let vm = this;
|
|
203
200
|
let modelName = this.modelName ? ('该' + this.modelName) : '';
|
|
204
|
-
window.tnx.confirm('确定要' + this.removeText + modelName + '吗?'
|
|
201
|
+
window.tnx.confirm('确定要' + this.removeText + modelName + '吗?').then((yes) => {
|
|
205
202
|
if (yes) {
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
if (this.remove) {
|
|
204
|
+
this.remove(index, () => {
|
|
205
|
+
this._onRemoved(index);
|
|
209
206
|
});
|
|
210
207
|
} else {
|
|
211
|
-
|
|
208
|
+
this._onRemoved(index);
|
|
212
209
|
}
|
|
213
210
|
}
|
|
214
211
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<slot></slot>
|
|
5
5
|
<el-form-item class="w-100 mb-0" :label="vertical ? undefined : ' '" v-if="update || back !== false">
|
|
6
6
|
<el-button :type="theme || 'primary'" @click="toUpdate" v-if="update">{{ updateText }}</el-button>
|
|
7
|
-
<el-button
|
|
7
|
+
<el-button @click="toBack" v-if="back !== false">{{ backText }}</el-button>
|
|
8
8
|
</el-form-item>
|
|
9
9
|
</el-form>
|
|
10
10
|
</template>
|
|
@@ -101,9 +101,8 @@ export default {
|
|
|
101
101
|
modelValue(newValue, oldValue) {
|
|
102
102
|
this.visible = this.modelValue;
|
|
103
103
|
if (newValue && !oldValue) { // 从隐藏到显示
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
vm.locate(true);
|
|
104
|
+
this.$nextTick(() => {
|
|
105
|
+
this.locate(true);
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
},
|
|
@@ -115,22 +114,21 @@ export default {
|
|
|
115
114
|
window.tnx.app.eventBus.once('tnx.error', options => {
|
|
116
115
|
this.buttonLoadings = [];
|
|
117
116
|
});
|
|
118
|
-
|
|
119
|
-
this.$nextTick(function () {
|
|
117
|
+
this.$nextTick(() => {
|
|
120
118
|
if (this.visible) {
|
|
121
|
-
|
|
119
|
+
this.locate(true);
|
|
122
120
|
}
|
|
123
121
|
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if (this.$refs.content && !this.$refs.content.close) {
|
|
123
|
+
this.$refs.content.close = () => {
|
|
124
|
+
this.close();
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
if (typeof
|
|
131
|
-
|
|
128
|
+
if (typeof this.options.onShown === 'function') {
|
|
129
|
+
this.options.onShown.call(this);
|
|
132
130
|
} else {
|
|
133
|
-
|
|
131
|
+
this.$emit('shown');
|
|
134
132
|
}
|
|
135
133
|
});
|
|
136
134
|
},
|
|
@@ -184,18 +182,18 @@ export default {
|
|
|
184
182
|
}
|
|
185
183
|
this.close();
|
|
186
184
|
},
|
|
187
|
-
close(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
close() {
|
|
186
|
+
return new Promise((resolve) => {
|
|
187
|
+
this.beforeClose(() => {
|
|
188
|
+
const originalOnClosed = this.options.onClosed;
|
|
189
|
+
this.options.onClosed = window.tnx.util.function.around(originalOnClosed, function (onClosed) {
|
|
192
190
|
if (onClosed) {
|
|
193
191
|
onClosed();
|
|
194
192
|
}
|
|
195
|
-
|
|
193
|
+
resolve();
|
|
196
194
|
});
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
this.visible = false;
|
|
196
|
+
});
|
|
199
197
|
});
|
|
200
198
|
},
|
|
201
199
|
beforeClose(done) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
<div class="tnxel-drawer-footer" v-if="buttons && buttons.length">
|
|
25
25
|
<el-button v-for="(button, index) in buttons" :type="button.type" :key="index"
|
|
26
|
-
|
|
26
|
+
@click="btnClick(index)">{{ button.caption || button.text }}
|
|
27
27
|
</el-button>
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
},
|
|
65
65
|
mounted() {
|
|
66
66
|
let vm = this;
|
|
67
|
-
this.$nextTick(
|
|
67
|
+
this.$nextTick(() => {
|
|
68
68
|
if (vm.$refs.content && !vm.$refs.content.close) {
|
|
69
69
|
vm.$refs.content.close = function () {
|
|
70
70
|
vm.close();
|
|
@@ -94,18 +94,19 @@ export default {
|
|
|
94
94
|
}
|
|
95
95
|
this.close();
|
|
96
96
|
},
|
|
97
|
-
close(
|
|
97
|
+
close() {
|
|
98
98
|
const vm = this;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
return new Promise((resolve) => {
|
|
100
|
+
this.beforeClose(() => {
|
|
101
|
+
const originalOnClosed = vm.options.onClosed;
|
|
102
|
+
vm.options.onClosed = util.function.around(originalOnClosed, function (onClosed) {
|
|
102
103
|
if (onClosed) {
|
|
103
104
|
onClosed();
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
+
resolve();
|
|
106
107
|
});
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
vm.visible = false;
|
|
109
|
+
});
|
|
109
110
|
});
|
|
110
111
|
},
|
|
111
112
|
beforeClose(done) {
|
|
@@ -172,7 +172,7 @@ export default {
|
|
|
172
172
|
initRules() {
|
|
173
173
|
if (this.rules) {
|
|
174
174
|
if (typeof this.rules === 'string') {
|
|
175
|
-
window.tnx.app.rpc.getMeta(this.rules, meta => {
|
|
175
|
+
window.tnx.app.rpc.getMeta(this.rules, this.rulesApp).then(meta => {
|
|
176
176
|
if (this.rulesLoaded) {
|
|
177
177
|
this.rulesLoaded(meta.$rules);
|
|
178
178
|
} else {
|
|
@@ -180,7 +180,7 @@ export default {
|
|
|
180
180
|
}
|
|
181
181
|
this.validationRules = meta.$rules;
|
|
182
182
|
this.bindRules();
|
|
183
|
-
}
|
|
183
|
+
});
|
|
184
184
|
} else {
|
|
185
185
|
this.validationRules = this.rules;
|
|
186
186
|
this.bindRules();
|
|
@@ -269,7 +269,7 @@ export default {
|
|
|
269
269
|
let model = {};
|
|
270
270
|
model[fieldName] = element.value;
|
|
271
271
|
let successful = true;
|
|
272
|
-
window.tnx.app.validator.validate(rules, model
|
|
272
|
+
window.tnx.app.validator.validate(rules, model).catch(errors => {
|
|
273
273
|
if (errors) {
|
|
274
274
|
successful = false;
|
|
275
275
|
let message = '';
|
|
@@ -116,11 +116,11 @@ export default {
|
|
|
116
116
|
this.initModel();
|
|
117
117
|
} else {
|
|
118
118
|
let vm = this;
|
|
119
|
-
window.tnx.app.rpc.resolveEnumItems(this.type, this.subtype,
|
|
119
|
+
window.tnx.app.rpc.resolveEnumItems(this.type, this.subtype, {
|
|
120
|
+
app: this.app,
|
|
121
|
+
}).then((items) => {
|
|
120
122
|
vm.items = items;
|
|
121
123
|
vm.initModel();
|
|
122
|
-
}, {
|
|
123
|
-
app: this.app,
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
}
|