@truenewx/tnxvue3 3.4.0 → 3.4.2
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 +23 -42
- 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/{aj-captcha → element-plus/aj-captcha}/Verify/VerifySlide.vue +9 -9
- package/src/element-plus/aj-captcha/api/index.js +11 -0
- package/src/{aj-captcha → element-plus/aj-captcha}/utils/ase.js +1 -1
- 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 +11 -7
- 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 +105 -94
- 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/tdesign/desktop/tnxtdd.ts +16 -0
- package/src/tdesign/foundation/validator.ts +367 -0
- package/src/tdesign/mobile/tnxtdm.ts +16 -0
- package/src/tdesign/tnxtd.ts +20 -0
- package/src/{tnxvue-router.js → tnxvue-router.ts} +66 -48
- package/src/tnxvue.ts +248 -0
- package/src/types.d.ts +7 -0
- package/tsconfig.json +21 -0
- package/index.html +0 -12
- package/src/aj-captcha/api/index.js +0 -19
- package/src/tnxvue-validator.js +0 -365
- package/src/tnxvue.js +0 -439
- /package/src/{aj-captcha → element-plus/aj-captcha}/Verify/VerifyPoints.vue +0 -0
- /package/src/{aj-captcha → element-plus/aj-captcha}/Verify.vue +0 -0
- /package/src/{aj-captcha → element-plus/aj-captcha}/utils/util.js +0 -0
|
@@ -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
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span v-if="item">{{ item.caption }}</span>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
name: 'TnxelEnumView',
|
|
8
|
-
props: {
|
|
9
|
-
type: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
subtype: String,
|
|
14
|
-
itemKey: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
app: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
item: null,
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
mounted() {
|
|
29
|
-
window.tnx.app.rpc.resolveEnumType(this.type, this.subtype,
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
methods: {}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<style scoped>
|
|
40
|
-
|
|
41
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="item">{{ item.caption }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'TnxelEnumView',
|
|
8
|
+
props: {
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
subtype: String,
|
|
14
|
+
itemKey: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
app: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: () => window.tnx.componentDefaultApp, // 设置为方法以延时加载,确保更改的值生效
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
item: null,
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
mounted() {
|
|
29
|
+
window.tnx.app.rpc.resolveEnumType(this.type, this.subtype, {
|
|
30
|
+
app: this.app,
|
|
31
|
+
}).then(enumType => {
|
|
32
|
+
this.item = enumType.items.find(item => item.key === this.itemKey);
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
methods: {}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
|
|
41
|
+
</style>
|
|
@@ -121,10 +121,9 @@ export default {
|
|
|
121
121
|
return null;
|
|
122
122
|
},
|
|
123
123
|
load() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
vm.model = vm.getModel();
|
|
124
|
+
window.tnx.app.rpc.get(this.url, this.params).then((result) => {
|
|
125
|
+
this.items = this.transferItems(result);
|
|
126
|
+
this.model = this.getModel();
|
|
128
127
|
});
|
|
129
128
|
},
|
|
130
129
|
filter(node, keyword) {
|
|
@@ -122,25 +122,24 @@ export default {
|
|
|
122
122
|
if (this.url && this.params) { // 当url或参数函数被设置为null时,不进行取数操作,用于初始条件不满足的情况
|
|
123
123
|
this.loading = true;
|
|
124
124
|
let params = this.params(keyword);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
vm.loading = false;
|
|
125
|
+
window.tnx.app.rpc.get(this.url, params).then(result => {
|
|
126
|
+
this.loading = false;
|
|
128
127
|
if (Array.isArray(result)) {
|
|
129
|
-
|
|
128
|
+
this.items = result;
|
|
130
129
|
} else if (typeof result === 'object') {
|
|
131
|
-
|
|
130
|
+
this.items = result[this.resultName];
|
|
132
131
|
if (result.paged) {
|
|
133
|
-
|
|
132
|
+
this.more = result.paged.morePage;
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
// 确保选项的值均为字符串,以保证比较时的一致性
|
|
137
|
-
if (Array.isArray(
|
|
138
|
-
|
|
139
|
-
item[
|
|
136
|
+
if (Array.isArray(this.items)) {
|
|
137
|
+
this.items.forEach(item => {
|
|
138
|
+
item[this.valueName] += '';
|
|
140
139
|
});
|
|
141
140
|
}
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
this.$emit('items', params, this.items, this.more);
|
|
142
|
+
this.model = this.getModel();
|
|
144
143
|
});
|
|
145
144
|
}
|
|
146
145
|
},
|
|
@@ -94,13 +94,12 @@ export default {
|
|
|
94
94
|
if (this.keyword) {
|
|
95
95
|
params[this.keywordName] = this.keyword;
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
window.tnx.app.rpc.get(this.url, params, result => {
|
|
97
|
+
window.tnx.app.rpc.get(this.url, params).then(result => {
|
|
99
98
|
if (result instanceof Array) {
|
|
100
|
-
|
|
99
|
+
this.items = this.format(result);
|
|
101
100
|
} else if (result.records && result.paged) {
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
this.items = this.format(result.records);
|
|
102
|
+
this.paged = result.paged;
|
|
104
103
|
}
|
|
105
104
|
});
|
|
106
105
|
},
|
|
@@ -144,7 +144,12 @@ export default {
|
|
|
144
144
|
_initialize() {
|
|
145
145
|
const vm = this;
|
|
146
146
|
let fssConfig = vm.tnx.fss.getClientConfig(this.app);
|
|
147
|
-
vm.tnx.app.rpc.ensureLogined(
|
|
147
|
+
vm.tnx.app.rpc.ensureLogined({
|
|
148
|
+
app: window.tnx.componentDefaultApp || fssConfig.appName,
|
|
149
|
+
toLogin(loginFormUrl, originalUrl, originalMethod) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}).then(() => {
|
|
148
153
|
let locationUrls;
|
|
149
154
|
if (vm.modelValue) {
|
|
150
155
|
locationUrls = Array.isArray(vm.modelValue) ? vm.modelValue : [vm.modelValue];
|
|
@@ -154,7 +159,9 @@ export default {
|
|
|
154
159
|
if (locationUrls.length) {
|
|
155
160
|
vm.tnx.app.rpc.get(fssConfig.contextUrl + '/metas', {
|
|
156
161
|
locationUrls: locationUrls
|
|
157
|
-
},
|
|
162
|
+
}, {
|
|
163
|
+
app: fssConfig.appName
|
|
164
|
+
}).then(metas => {
|
|
158
165
|
let fileList = [];
|
|
159
166
|
metas.forEach(meta => {
|
|
160
167
|
if (meta) {
|
|
@@ -167,23 +174,16 @@ export default {
|
|
|
167
174
|
}
|
|
168
175
|
});
|
|
169
176
|
vm.fileList = fileList;
|
|
170
|
-
vm.$nextTick(
|
|
177
|
+
vm.$nextTick(() => {
|
|
171
178
|
vm._loadUploadOptions();
|
|
172
179
|
});
|
|
173
|
-
}, {
|
|
174
|
-
app: fssConfig.appName
|
|
175
180
|
});
|
|
176
181
|
} else {
|
|
177
182
|
vm.fileList = [];
|
|
178
|
-
vm.$nextTick(
|
|
183
|
+
vm.$nextTick(() => {
|
|
179
184
|
vm._loadUploadOptions();
|
|
180
185
|
});
|
|
181
186
|
}
|
|
182
|
-
}, {
|
|
183
|
-
app: window.tnx.componentDefaultApp || fssConfig.appName,
|
|
184
|
-
toLogin(loginFormUrl, originalUrl, originalMethod) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
187
|
});
|
|
188
188
|
},
|
|
189
189
|
_loadUploadOptions() {
|
|
@@ -191,7 +191,12 @@ export default {
|
|
|
191
191
|
if (Object.keys(this.uploadOptions).length === 0) {
|
|
192
192
|
this.errors = null;
|
|
193
193
|
let vm = this;
|
|
194
|
-
vm.tnx.fss.loadUploadOptions(this.type,
|
|
194
|
+
vm.tnx.fss.loadUploadOptions(this.type, {
|
|
195
|
+
app: vm.app,
|
|
196
|
+
error: function (errors) {
|
|
197
|
+
vm.errors = errors;
|
|
198
|
+
}
|
|
199
|
+
}).then(uploadOptions => {
|
|
195
200
|
if (vm.extension) {
|
|
196
201
|
let extensions = Array.isArray(vm.extension) ? vm.extension : [vm.extension];
|
|
197
202
|
let acceptedExtensions = [];
|
|
@@ -220,11 +225,6 @@ export default {
|
|
|
220
225
|
}
|
|
221
226
|
}
|
|
222
227
|
vm.uploadOptions = uploadOptions;
|
|
223
|
-
}, {
|
|
224
|
-
app: vm.app,
|
|
225
|
-
error: function (errors) {
|
|
226
|
-
vm.errors = errors;
|
|
227
|
-
}
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
},
|
|
@@ -314,7 +314,7 @@ export default {
|
|
|
314
314
|
if (typeof reject === 'function') {
|
|
315
315
|
reject(file);
|
|
316
316
|
} else {
|
|
317
|
-
this.tnx.alert('文件"' + file.name + '"还未上传完毕,请稍候'
|
|
317
|
+
this.tnx.alert('文件"' + file.name + '"还未上传完毕,请稍候').then(() => {
|
|
318
318
|
if (reject && typeof reject.disable === 'function') {
|
|
319
319
|
reject.disable(false);
|
|
320
320
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
<CircleClose v-else-if="value === 'CircleClose'"/>
|
|
17
17
|
<CircleCloseFilled v-else-if="value === 'CircleCloseFilled'"/>
|
|
18
18
|
<CirclePlus v-else-if="value === 'CirclePlus'"/>
|
|
19
|
+
<CirclePlusFilled v-else-if="value === 'CirclePlusFilled'"/>
|
|
19
20
|
<Close v-else-if="value === 'Close'"/>
|
|
20
21
|
<CloseBold v-else-if="value === 'CloseBold'"/>
|
|
21
22
|
<CopyDocument v-else-if="value === 'CopyDocument'"/>
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
<Sort v-else-if="value === 'Sort'"/>
|
|
67
68
|
<SuccessFilled v-else-if="value === 'SuccessFilled'"/>
|
|
68
69
|
<Switch v-else-if="value === 'Switch'"/>
|
|
70
|
+
<Tools v-else-if="value === 'Tools'"/>
|
|
69
71
|
<Top v-else-if="value === 'Top'"/>
|
|
70
72
|
<User v-else-if="value === 'User'"/>
|
|
71
73
|
<UserFilled v-else-if="value === 'UserFilled'"/>
|
|
@@ -92,6 +94,7 @@ import {
|
|
|
92
94
|
CircleClose,
|
|
93
95
|
CircleCloseFilled,
|
|
94
96
|
CirclePlus,
|
|
97
|
+
CirclePlusFilled,
|
|
95
98
|
Close,
|
|
96
99
|
CloseBold,
|
|
97
100
|
CopyDocument,
|
|
@@ -143,6 +146,7 @@ import {
|
|
|
143
146
|
Sort,
|
|
144
147
|
SuccessFilled,
|
|
145
148
|
Switch,
|
|
149
|
+
Tools,
|
|
146
150
|
Top,
|
|
147
151
|
User,
|
|
148
152
|
UserFilled,
|
|
@@ -167,6 +171,7 @@ const components = {
|
|
|
167
171
|
CircleClose,
|
|
168
172
|
CircleCloseFilled,
|
|
169
173
|
CirclePlus,
|
|
174
|
+
CirclePlusFilled,
|
|
170
175
|
Close,
|
|
171
176
|
CloseBold,
|
|
172
177
|
CopyDocument,
|
|
@@ -218,6 +223,7 @@ const components = {
|
|
|
218
223
|
Sort,
|
|
219
224
|
SuccessFilled,
|
|
220
225
|
Switch,
|
|
226
|
+
Tools,
|
|
221
227
|
Top,
|
|
222
228
|
User,
|
|
223
229
|
UserFilled,
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-input class="tnxel-input-dropdown"
|
|
3
|
-
v-model="model"
|
|
4
|
-
:disabled="disabled"
|
|
5
|
-
>
|
|
6
|
-
<template #append v-if="items?.length">
|
|
7
|
-
<el-dropdown :trigger="trigger" @command="selectItem">
|
|
8
|
-
<span class="el-dropdown-link">
|
|
9
|
-
<Icon value="ArrowDown"/>
|
|
10
|
-
</span>
|
|
11
|
-
<template #dropdown>
|
|
12
|
-
<el-dropdown-menu>
|
|
13
|
-
<template v-for="(item, index) of items" :key="index">
|
|
14
|
-
<el-dropdown-item
|
|
15
|
-
:command="item[valueName]"
|
|
16
|
-
:title="item[titleName]"
|
|
17
|
-
>
|
|
18
|
-
{{ item[textName] }}
|
|
19
|
-
</el-dropdown-item>
|
|
20
|
-
</template>
|
|
21
|
-
</el-dropdown-menu>
|
|
22
|
-
</template>
|
|
23
|
-
</el-dropdown>
|
|
24
|
-
</template>
|
|
25
|
-
</el-input>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
import Icon from '../icon/Icon.vue';
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
name: 'TnxelInputDropdown',
|
|
33
|
-
components: {Icon},
|
|
34
|
-
props: {
|
|
35
|
-
modelValue: String,
|
|
36
|
-
items: Array,
|
|
37
|
-
valueName: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: 'value',
|
|
40
|
-
},
|
|
41
|
-
textName: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: 'text',
|
|
44
|
-
},
|
|
45
|
-
titleName: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: 'title',
|
|
48
|
-
},
|
|
49
|
-
trigger: String,
|
|
50
|
-
disabled: Boolean,
|
|
51
|
-
},
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
model: this.modelValue,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
watch: {
|
|
58
|
-
model() {
|
|
59
|
-
this.$emit('update:modelValue', this.model);
|
|
60
|
-
},
|
|
61
|
-
modelValue() {
|
|
62
|
-
this.model = this.modelValue;
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
methods: {
|
|
66
|
-
selectItem(value) {
|
|
67
|
-
this.model = value;
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<style>
|
|
74
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-input class="tnxel-input-dropdown"
|
|
3
|
+
v-model="model"
|
|
4
|
+
:disabled="disabled"
|
|
5
|
+
>
|
|
6
|
+
<template #append v-if="items?.length">
|
|
7
|
+
<el-dropdown :trigger="trigger" @command="selectItem">
|
|
8
|
+
<span class="el-dropdown-link">
|
|
9
|
+
<Icon value="ArrowDown"/>
|
|
10
|
+
</span>
|
|
11
|
+
<template #dropdown>
|
|
12
|
+
<el-dropdown-menu>
|
|
13
|
+
<template v-for="(item, index) of items" :key="index">
|
|
14
|
+
<el-dropdown-item
|
|
15
|
+
:command="item[valueName]"
|
|
16
|
+
:title="item[titleName]"
|
|
17
|
+
>
|
|
18
|
+
{{ item[textName] }}
|
|
19
|
+
</el-dropdown-item>
|
|
20
|
+
</template>
|
|
21
|
+
</el-dropdown-menu>
|
|
22
|
+
</template>
|
|
23
|
+
</el-dropdown>
|
|
24
|
+
</template>
|
|
25
|
+
</el-input>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import Icon from '../icon/Icon.vue';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: 'TnxelInputDropdown',
|
|
33
|
+
components: {Icon},
|
|
34
|
+
props: {
|
|
35
|
+
modelValue: String,
|
|
36
|
+
items: Array,
|
|
37
|
+
valueName: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'value',
|
|
40
|
+
},
|
|
41
|
+
textName: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'text',
|
|
44
|
+
},
|
|
45
|
+
titleName: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'title',
|
|
48
|
+
},
|
|
49
|
+
trigger: String,
|
|
50
|
+
disabled: Boolean,
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
model: this.modelValue,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
watch: {
|
|
58
|
+
model() {
|
|
59
|
+
this.$emit('update:modelValue', this.model);
|
|
60
|
+
},
|
|
61
|
+
modelValue() {
|
|
62
|
+
this.model = this.modelValue;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
selectItem(value) {
|
|
67
|
+
this.model = value;
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
</style>
|
|
@@ -231,9 +231,9 @@ export default {
|
|
|
231
231
|
if (this.init) {
|
|
232
232
|
this.query();
|
|
233
233
|
}
|
|
234
|
-
let vm = this;
|
|
235
234
|
this.$nextTick(() => {
|
|
236
|
-
|
|
235
|
+
this.containerHeight = this.getContainerHeight();
|
|
236
|
+
this.tableKey = this.id + '-table';
|
|
237
237
|
});
|
|
238
238
|
},
|
|
239
239
|
methods: {
|
|
@@ -274,30 +274,29 @@ export default {
|
|
|
274
274
|
this.records = null;
|
|
275
275
|
this.paged = null;
|
|
276
276
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
vm.querying = false;
|
|
277
|
+
window.tnx.app.rpc.get(this.url, this.params).then(result => {
|
|
278
|
+
this.querying = false;
|
|
280
279
|
if (Array.isArray(result)) {
|
|
281
|
-
|
|
280
|
+
this.records = this.format(result);
|
|
282
281
|
} else {
|
|
283
|
-
let records =
|
|
284
|
-
if (result.paged.pageNo > 1 &&
|
|
285
|
-
|
|
282
|
+
let records = this.format(result.records);
|
|
283
|
+
if (result.paged.pageNo > 1 && this.appendMore) { // 追加记录
|
|
284
|
+
this.records = this.records || [];
|
|
286
285
|
// 结果页码大于当前页码才追加记录
|
|
287
|
-
if (result.paged.pageNo >
|
|
288
|
-
|
|
286
|
+
if (result.paged.pageNo > this.paged.pageNo) {
|
|
287
|
+
this.records = this.records.concat(records);
|
|
289
288
|
}
|
|
290
289
|
} else { // 替代记录
|
|
291
|
-
|
|
290
|
+
this.records = records;
|
|
292
291
|
}
|
|
293
|
-
|
|
292
|
+
this.paged = result.paged;
|
|
294
293
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
|
|
294
|
+
this.selectAllToPage();
|
|
295
|
+
this.tableKey = new Date().toString();
|
|
296
|
+
if (this.success) {
|
|
297
|
+
this.success(this.records, this.paged);
|
|
299
298
|
}
|
|
300
|
-
})
|
|
299
|
+
})
|
|
301
300
|
}
|
|
302
301
|
},
|
|
303
302
|
format(records) {
|
|
@@ -323,9 +322,8 @@ export default {
|
|
|
323
322
|
},
|
|
324
323
|
selectRow(row, column, cell) {
|
|
325
324
|
if (this.selectable && this.records && column.getColumnIndex() > 0 && !cell.innerHTML.contains('</a>')) {
|
|
326
|
-
let
|
|
327
|
-
|
|
328
|
-
return row[vm.selectName] === element[vm.selectName];
|
|
325
|
+
let index = window.tnx.util.array.indexOf(this.records, (element) => {
|
|
326
|
+
return row[this.selectName] === element[this.selectName];
|
|
329
327
|
});
|
|
330
328
|
if (index >= 0) {
|
|
331
329
|
this.pageSelectedIndexes[index] = !this.pageSelectedIndexes[index];
|
|
@@ -342,12 +340,11 @@ export default {
|
|
|
342
340
|
}
|
|
343
341
|
},
|
|
344
342
|
selectPageToAll() {
|
|
345
|
-
let vm = this;
|
|
346
343
|
for (let index = 0; index < this.pageSelectedIndexes.length; index++) {
|
|
347
344
|
let selectedInPage = this.pageSelectedIndexes[index];
|
|
348
345
|
let record = this.records[index];
|
|
349
|
-
let fnEquals =
|
|
350
|
-
return record[
|
|
346
|
+
let fnEquals = (element) => {
|
|
347
|
+
return record[this.selectName] === element[this.selectName];
|
|
351
348
|
};
|
|
352
349
|
let selectedInAll = this.allSelectedRecords.contains(fnEquals);
|
|
353
350
|
if (selectedInPage && !selectedInAll) { // 当前页已选但全局未选,则加入全局已选清单
|
|
@@ -360,7 +357,6 @@ export default {
|
|
|
360
357
|
},
|
|
361
358
|
selectAllToPage() {
|
|
362
359
|
if (this.selectable) {
|
|
363
|
-
let vm = this;
|
|
364
360
|
if (!Array.isArray(this.allSelectedRecords)) {
|
|
365
361
|
this.allSelectedRecords = [this.allSelectedRecords];
|
|
366
362
|
}
|
|
@@ -368,7 +364,7 @@ export default {
|
|
|
368
364
|
for (let selectedRecord of this.allSelectedRecords) {
|
|
369
365
|
for (let i = 0; i < this.records.length; i++) {
|
|
370
366
|
let record = this.records[i];
|
|
371
|
-
if (record[
|
|
367
|
+
if (record[this.selectName] === selectedRecord[this.selectName]) {
|
|
372
368
|
this.pageSelectedIndexes[i] = true;
|
|
373
369
|
}
|
|
374
370
|
}
|
|
@@ -60,12 +60,11 @@ export default {
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
created() {
|
|
63
|
-
|
|
64
|
-
window.tnx.app.rpc.loadRegion(this.scope, parseInt(this.maxLevel), function (region) {
|
|
65
|
-
vm.region = region;
|
|
66
|
-
vm.model = vm.getModel();
|
|
67
|
-
}, {
|
|
63
|
+
window.tnx.app.rpc.loadRegion(this.scope, parseInt(this.maxLevel), {
|
|
68
64
|
app: this.app,
|
|
65
|
+
}).then((region) => {
|
|
66
|
+
this.region = region;
|
|
67
|
+
this.model = this.getModel();
|
|
69
68
|
});
|
|
70
69
|
},
|
|
71
70
|
methods: {
|