mooho-base-admin-plus 2.10.50 → 2.10.51
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/history.md +1 -0
- package/package/mooho-base-admin-plus.min.esm.js +79 -35
- package/package/mooho-base-admin-plus.min.js +2 -2
- package/package/style.css +1 -1
- package/package.json +1 -1
- package/src/components/view/modal-form.vue +19 -1
- package/src/components/view/modal-table.vue +31 -0
- package/src/components/view/view-form.vue +1 -0
- package/src/components/view/view-table-excel.vue +32 -37
- package/src/components/view/view-table.vue +15 -0
package/package.json
CHANGED
|
@@ -31,7 +31,16 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
</template>
|
|
33
33
|
<div class="ivu-ml-8 ivu-mr-8">
|
|
34
|
-
<view-form
|
|
34
|
+
<view-form
|
|
35
|
+
ref="form"
|
|
36
|
+
:view-code="viewCode"
|
|
37
|
+
:readonly="!canSave()"
|
|
38
|
+
:defaultData="defaultData"
|
|
39
|
+
:setting-enable="settingEnable"
|
|
40
|
+
@on-change="onChange"
|
|
41
|
+
@on-ready="onReady"
|
|
42
|
+
@on-blur="onBlur"
|
|
43
|
+
>
|
|
35
44
|
<template #top="{ form }">
|
|
36
45
|
<!--
|
|
37
46
|
@slot 顶部
|
|
@@ -130,6 +139,7 @@
|
|
|
130
139
|
export default {
|
|
131
140
|
mixins: [mixinPage],
|
|
132
141
|
components: { formSetting, formSettingLayout },
|
|
142
|
+
emits: ['on-after-save', 'on-before-save', 'on-blur', 'on-change', 'on-close'],
|
|
133
143
|
data() {
|
|
134
144
|
return {
|
|
135
145
|
opened: false,
|
|
@@ -382,6 +392,14 @@
|
|
|
382
392
|
onReady(formView) {
|
|
383
393
|
this.formView = formView;
|
|
384
394
|
},
|
|
395
|
+
// 输入框失去焦点事件
|
|
396
|
+
onBlur(sender) {
|
|
397
|
+
/**
|
|
398
|
+
* 数据变化事件
|
|
399
|
+
* @property {object} sender 触发的列对象
|
|
400
|
+
*/
|
|
401
|
+
this.$emit('on-blur', sender);
|
|
402
|
+
},
|
|
385
403
|
onVisibleChange(show) {
|
|
386
404
|
// 关闭时清空数据
|
|
387
405
|
if (!show) {
|
|
@@ -63,7 +63,10 @@
|
|
|
63
63
|
@create="create"
|
|
64
64
|
@edit="edit"
|
|
65
65
|
@show="show"
|
|
66
|
+
@on-blur="onBlur"
|
|
67
|
+
@on-change="onChange"
|
|
66
68
|
@on-ready="onReady"
|
|
69
|
+
@on-remove="onRemove"
|
|
67
70
|
@on-load-data="onLoadData"
|
|
68
71
|
@after-init="afterInit"
|
|
69
72
|
@on-drag-drop="(index1, index2) => this.$emit('on-drag-drop', index1, index2)"
|
|
@@ -71,6 +74,7 @@
|
|
|
71
74
|
@on-row-click="onRowClick"
|
|
72
75
|
@on-row-dblclick="onRowDblclick"
|
|
73
76
|
@on-cell-click="onCellClick"
|
|
77
|
+
@on-select-change="onSelectChange"
|
|
74
78
|
>
|
|
75
79
|
<template #top>
|
|
76
80
|
<!--
|
|
@@ -154,6 +158,7 @@
|
|
|
154
158
|
export default {
|
|
155
159
|
mixins: [mixinPage],
|
|
156
160
|
components: {},
|
|
161
|
+
emits: ['after-init', 'create', 'on-close', 'edit', 'on-blur', 'on-cell-click', 'on-change', 'on-load-data', 'on-row-click', 'on-row-dblclick', 'on-select-change', 'show'],
|
|
157
162
|
data() {
|
|
158
163
|
return {
|
|
159
164
|
opened: false,
|
|
@@ -621,6 +626,32 @@
|
|
|
621
626
|
this.$refs.table.isMaxHight = isFullscreen;
|
|
622
627
|
|
|
623
628
|
this.isFullscreen = isFullscreen;
|
|
629
|
+
},
|
|
630
|
+
// 失去焦点事件
|
|
631
|
+
onBlur(data, sender) {
|
|
632
|
+
/**
|
|
633
|
+
* 失去焦点事件
|
|
634
|
+
* @property {object} data 行对象
|
|
635
|
+
* @property {object} sender 触发的列对象
|
|
636
|
+
*/
|
|
637
|
+
this.$emit('on-blur', data, sender);
|
|
638
|
+
},
|
|
639
|
+
// 变更事件
|
|
640
|
+
onChange(data, sender, selected) {
|
|
641
|
+
/**
|
|
642
|
+
* 数据变化事件
|
|
643
|
+
* @property {object} data 行对象
|
|
644
|
+
* @property {object} sender 触发的列对象
|
|
645
|
+
* @property {object} selected 选中对象(弹出选择框等有效)
|
|
646
|
+
*/
|
|
647
|
+
this.$emit('on-change', data, sender, selected);
|
|
648
|
+
},
|
|
649
|
+
// 选中项变化事件
|
|
650
|
+
onSelectChange() {
|
|
651
|
+
/**
|
|
652
|
+
* 数据变化事件
|
|
653
|
+
*/
|
|
654
|
+
this.$emit('on-select-change');
|
|
624
655
|
}
|
|
625
656
|
}
|
|
626
657
|
};
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
export default {
|
|
48
48
|
mixins: [mixin, mixinPage],
|
|
49
49
|
components: { HotTable, tableSetting },
|
|
50
|
-
emits: ['
|
|
50
|
+
emits: ['after-init', 'on-change', 'on-load-data'],
|
|
51
51
|
data() {
|
|
52
52
|
return {
|
|
53
53
|
inited: false,
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
licenseKey: 'non-commercial-and-evaluation'
|
|
76
76
|
},
|
|
77
77
|
coords: {},
|
|
78
|
-
data: [],
|
|
79
78
|
staticData: [],
|
|
80
79
|
setting: false,
|
|
81
80
|
tableSettingActive: false,
|
|
@@ -161,7 +160,11 @@
|
|
|
161
160
|
default: null
|
|
162
161
|
}
|
|
163
162
|
},
|
|
164
|
-
computed: {
|
|
163
|
+
computed: {
|
|
164
|
+
data() {
|
|
165
|
+
return this.staticData;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
165
168
|
watch: {
|
|
166
169
|
// value() {
|
|
167
170
|
// if (this.embedded) {
|
|
@@ -209,8 +212,6 @@
|
|
|
209
212
|
this.tableView = view.dataView;
|
|
210
213
|
this.tableView.columns = view.viewColumns;
|
|
211
214
|
|
|
212
|
-
console.log('this.$refs.table.hotInstance', this.$refs.table.hotInstance);
|
|
213
|
-
|
|
214
215
|
// 文本必填
|
|
215
216
|
Handsontable.validators.registerValidator('text-required', (value, callback) => {
|
|
216
217
|
if (!(value || '').trim()) {
|
|
@@ -229,8 +230,6 @@
|
|
|
229
230
|
}
|
|
230
231
|
});
|
|
231
232
|
|
|
232
|
-
console.log('Handsontable.validators.NumericValidator', Handsontable.validators.DateValidator);
|
|
233
|
-
|
|
234
233
|
// 日期必填
|
|
235
234
|
Handsontable.validators.registerValidator('date-required', (value, callback) => {
|
|
236
235
|
if (!(value || '').trim()) {
|
|
@@ -506,7 +505,7 @@
|
|
|
506
505
|
let data = this.$refs.table.hotInstance.getSourceData();
|
|
507
506
|
let delRows = data.splice(index, 1);
|
|
508
507
|
data.splice(index - 1, 0, delRows[0]);
|
|
509
|
-
this.$refs.table.hotInstance.
|
|
508
|
+
this.$refs.table.hotInstance.updateData(data);
|
|
510
509
|
}
|
|
511
510
|
}
|
|
512
511
|
};
|
|
@@ -518,7 +517,7 @@
|
|
|
518
517
|
if (index < data.length - 1) {
|
|
519
518
|
let delRows = data.splice(index, 1);
|
|
520
519
|
data.splice(index + 1, 0, delRows[0]);
|
|
521
|
-
this.$refs.table.hotInstance.
|
|
520
|
+
this.$refs.table.hotInstance.updateData(data);
|
|
522
521
|
}
|
|
523
522
|
}
|
|
524
523
|
};
|
|
@@ -553,18 +552,7 @@
|
|
|
553
552
|
}
|
|
554
553
|
|
|
555
554
|
this.confirm('确定要删除该行吗?', async () => {
|
|
556
|
-
|
|
557
|
-
// await modelApi.delete(this.viewCode, ids);
|
|
558
|
-
// }
|
|
559
|
-
let b = true;
|
|
560
|
-
|
|
561
|
-
this.$emit('on-remove', rows, val => {
|
|
562
|
-
b = val;
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
if (b) {
|
|
566
|
-
this.$refs.table.hotInstance.alter('remove_row', delArr);
|
|
567
|
-
}
|
|
555
|
+
this.$refs.table.hotInstance.alter('remove_row', delArr);
|
|
568
556
|
});
|
|
569
557
|
}
|
|
570
558
|
};
|
|
@@ -576,26 +564,26 @@
|
|
|
576
564
|
//console.log('afterChange', changes);
|
|
577
565
|
if (changes) {
|
|
578
566
|
changes.forEach(([row, property, oldValue, newValue]) => {
|
|
579
|
-
if (!this.readonly && this.tableView.createEnable && row == this.
|
|
580
|
-
this.
|
|
567
|
+
if (!this.readonly && this.tableView.createEnable && row == this.staticData.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
|
|
568
|
+
this.staticData.push(this.getDefaultData());
|
|
581
569
|
}
|
|
582
570
|
|
|
583
571
|
let column = this.columns.find(item => item.code == property);
|
|
584
572
|
|
|
585
573
|
if (column.controlType != 'DialogSelect') {
|
|
586
574
|
// 弹出框控件不触发数据变更事件,此处手动触发
|
|
587
|
-
this.onDataChange(this.
|
|
575
|
+
this.onDataChange(this.staticData[row], column);
|
|
588
576
|
}
|
|
589
577
|
|
|
590
578
|
if (column.controlType == 'Select') {
|
|
591
579
|
// 校验下拉框选项是否在列表中
|
|
592
580
|
if (!column.selectOptions.some(item => item == newValue)) {
|
|
593
|
-
this.
|
|
581
|
+
this.staticData[row][column.code] = null;
|
|
594
582
|
}
|
|
595
583
|
}
|
|
596
584
|
|
|
597
|
-
this.calc(this.
|
|
598
|
-
this.$refs.table.hotInstance.updateData(this.
|
|
585
|
+
this.calc(this.staticData[row]);
|
|
586
|
+
this.$refs.table.hotInstance.updateData(this.staticData);
|
|
599
587
|
});
|
|
600
588
|
}
|
|
601
589
|
});
|
|
@@ -668,10 +656,10 @@
|
|
|
668
656
|
});
|
|
669
657
|
}
|
|
670
658
|
|
|
671
|
-
this.data = this.staticData;
|
|
659
|
+
//this.data = this.staticData;
|
|
672
660
|
|
|
673
661
|
if (!this.readonly && staticData && this.tableView.createEnable) {
|
|
674
|
-
this.
|
|
662
|
+
this.staticData.push(this.getDefaultData());
|
|
675
663
|
}
|
|
676
664
|
|
|
677
665
|
//this.hotSetting.data = this.data;
|
|
@@ -688,11 +676,11 @@
|
|
|
688
676
|
//this.initDataSource();
|
|
689
677
|
|
|
690
678
|
// 重新计算公式
|
|
691
|
-
for (let i = 0; i < this.
|
|
692
|
-
this.calc(this.
|
|
679
|
+
for (let i = 0; i < this.staticData.length; i++) {
|
|
680
|
+
this.calc(this.staticData[i]);
|
|
693
681
|
}
|
|
694
682
|
|
|
695
|
-
this.$refs.table.hotInstance.loadData(this.
|
|
683
|
+
this.$refs.table.hotInstance.loadData(this.staticData);
|
|
696
684
|
|
|
697
685
|
setTimeout(() => {
|
|
698
686
|
this.$refs.table.hotInstance.render();
|
|
@@ -719,7 +707,15 @@
|
|
|
719
707
|
// }
|
|
720
708
|
},
|
|
721
709
|
/**
|
|
722
|
-
*
|
|
710
|
+
* 刷新
|
|
711
|
+
*
|
|
712
|
+
* @public
|
|
713
|
+
*/
|
|
714
|
+
refresh() {
|
|
715
|
+
this.$refs.table.hotInstance.updateData(this.staticData);
|
|
716
|
+
},
|
|
717
|
+
/**
|
|
718
|
+
* 验证
|
|
723
719
|
*
|
|
724
720
|
* @public
|
|
725
721
|
*/
|
|
@@ -729,10 +725,9 @@
|
|
|
729
725
|
for (let i = 0; i < this.staticData.length - 1; i++) {
|
|
730
726
|
rows.push(i);
|
|
731
727
|
}
|
|
732
|
-
console.log('rows', rows);
|
|
733
728
|
|
|
734
729
|
let valid = this.$refs.table.hotInstance.validateRows(rows, valid => {
|
|
735
|
-
console.log('valid', valid);
|
|
730
|
+
// console.log('valid', valid);
|
|
736
731
|
});
|
|
737
732
|
|
|
738
733
|
if (!valid) {
|
|
@@ -865,7 +860,7 @@
|
|
|
865
860
|
},
|
|
866
861
|
// 行数据
|
|
867
862
|
rowData(row, index) {
|
|
868
|
-
return this.
|
|
863
|
+
return this.staticData[index];
|
|
869
864
|
},
|
|
870
865
|
// 获取多语言名称
|
|
871
866
|
getNameI18n(column) {
|
|
@@ -888,7 +883,7 @@
|
|
|
888
883
|
// 清空数据
|
|
889
884
|
clear() {
|
|
890
885
|
this.staticData = [];
|
|
891
|
-
this.data = [];
|
|
886
|
+
//this.data = [];
|
|
892
887
|
},
|
|
893
888
|
// 弹出选择框选中
|
|
894
889
|
|
|
@@ -726,6 +726,21 @@
|
|
|
726
726
|
export default {
|
|
727
727
|
mixins: [mixin, mixinPage],
|
|
728
728
|
components: { tableFilter, tableSetting, filterSetting },
|
|
729
|
+
emits: [
|
|
730
|
+
'after-init',
|
|
731
|
+
'create',
|
|
732
|
+
'edit',
|
|
733
|
+
'on-blur',
|
|
734
|
+
'on-cell-click',
|
|
735
|
+
'on-change',
|
|
736
|
+
'on-load-data',
|
|
737
|
+
'on-ready',
|
|
738
|
+
'on-remove',
|
|
739
|
+
'on-row-click',
|
|
740
|
+
'on-row-dblclick',
|
|
741
|
+
'on-select-change',
|
|
742
|
+
'show'
|
|
743
|
+
],
|
|
729
744
|
data() {
|
|
730
745
|
return {
|
|
731
746
|
inited: false,
|