mooho-base-admin-plus 2.10.94 → 2.10.96

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,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.10.94",
4
+ "version": "2.10.96",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -0,0 +1,230 @@
1
+ <template>
2
+ <Modal
3
+ ref="modal"
4
+ v-model="opened"
5
+ scrollable
6
+ :fullscreen="isFullscreen"
7
+ :mask-closable="maskClosable == null ? layout.maskClosable : maskClosable"
8
+ :draggable="draggable == null ? layout.draggable : draggable"
9
+ :sticky="true"
10
+ :reset-drag-position="true"
11
+ :width="modalWidth"
12
+ :before-close="beforeClose"
13
+ :footer-hide="!footerEnable"
14
+ @on-visible-change="onVisibleChange"
15
+ >
16
+ <template #header>
17
+ <div>
18
+ <slot name="header">
19
+ <span class="title">{{ getNameI18n(tableView) }}</span>
20
+ <span class="description">{{ getDescI18n(tableView) }}</span>
21
+ </slot>
22
+ </div>
23
+ </template>
24
+ <template #close>
25
+ <div @click.stop>
26
+ <Icon v-if="!isFullscreen" style="font-size: 20px; color: #999; position: relative; top: -3px" type="ios-expand" @click="setFullscreen(true)" />
27
+ <Icon v-if="isFullscreen" style="font-size: 20px; color: #999; position: relative; top: -3px" type="ios-contract" @click="setFullscreen(false)" />
28
+ <Icon type="ios-close" @click="clickClose()" />
29
+ </div>
30
+ </template>
31
+ <div class="ivu-ml-8 ivu-mr-8">
32
+ <view-table-excel
33
+ ref="table"
34
+ :view-code="viewCode"
35
+ :readonly="readonly"
36
+ :parent-data="mergedParentData"
37
+ :setting-enable="settingEnable"
38
+ :auto-load="false"
39
+ :height="height"
40
+ @after-init="afterInit"
41
+ @on-change="onChange"
42
+ @on-load-data="onLoadData"
43
+ >
44
+ <template #top>
45
+ <slot name="top"></slot>
46
+ </template>
47
+ </view-table-excel>
48
+ </div>
49
+ <template #footer>
50
+ <div>
51
+ <slot name="footer"></slot>
52
+ </div>
53
+ </template>
54
+ </Modal>
55
+ </template>
56
+ <script>
57
+ import mixinPage from '../../mixins/page';
58
+
59
+ /**
60
+ * @displayName modal-table-excel 表格对话框(Handsontable / view-table-excel)
61
+ */
62
+ export default {
63
+ mixins: [mixinPage],
64
+ components: {},
65
+ emits: ['after-init', 'on-close', 'on-change', 'on-load-data'],
66
+ data() {
67
+ return {
68
+ opened: false,
69
+ isFullscreen: false,
70
+ tableView: {},
71
+ param: {}
72
+ };
73
+ },
74
+ props: {
75
+ viewCode: {
76
+ type: String
77
+ },
78
+ readonly: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ parentData: {
83
+ type: Object,
84
+ default() {
85
+ return {};
86
+ }
87
+ },
88
+ footerEnable: {
89
+ type: Boolean,
90
+ default: false
91
+ },
92
+ maskClosable: {
93
+ type: Boolean,
94
+ default: null
95
+ },
96
+ draggable: {
97
+ type: Boolean,
98
+ default: null
99
+ },
100
+ settingEnable: {
101
+ type: Boolean,
102
+ default: true
103
+ },
104
+ height: {
105
+ type: Number,
106
+ default: null
107
+ },
108
+ beforeClose: {
109
+ type: Function
110
+ }
111
+ },
112
+ computed: {
113
+ data() {
114
+ return this.$refs.table?.data;
115
+ },
116
+ table() {
117
+ return this.$refs.table;
118
+ },
119
+ screenWidth() {
120
+ return document.body.clientWidth * 0.8;
121
+ },
122
+ modalWidth() {
123
+ return this.tableView.width || this.screenWidth;
124
+ },
125
+ mergedParentData() {
126
+ return { ...this.parentData, ...this.param };
127
+ }
128
+ },
129
+ methods: {
130
+ async init(viewCode, callback, onFail) {
131
+ await this.$refs.table.init(viewCode, callback, onFail);
132
+ this.tableView = this.$refs.table.tableView || {};
133
+ },
134
+ open(param) {
135
+ setTimeout(() => {
136
+ this.param = param || {};
137
+ if (this.$refs.table) {
138
+ this.$refs.table.loadData();
139
+ }
140
+ this.opened = true;
141
+ });
142
+ },
143
+ async close() {
144
+ this.opened = false;
145
+ },
146
+ validate() {
147
+ return this.$refs.table.validate();
148
+ },
149
+ loadData(staticData) {
150
+ this.$refs.table.loadData(staticData);
151
+ },
152
+ getData() {
153
+ return this.$refs.table.getData();
154
+ },
155
+ getDefaultData() {
156
+ return this.$refs.table.getDefaultData();
157
+ },
158
+ clear() {
159
+ this.$refs.table.clear();
160
+ },
161
+ resetFilter() {},
162
+ onVisibleChange(show) {
163
+ if (!show) {
164
+ this.$refs.table?.loadData?.([]);
165
+ this.$emit('on-close');
166
+ }
167
+ },
168
+ onLoadData() {
169
+ this.$emit('on-load-data');
170
+ },
171
+ afterInit() {
172
+ this.tableView = this.$refs.table?.tableView || {};
173
+ this.$emit('after-init');
174
+ },
175
+ clickClose() {
176
+ if (typeof this.beforeClose == 'function') {
177
+ this.beforeClose().then(
178
+ () => {
179
+ this.close();
180
+ },
181
+ () => {}
182
+ );
183
+ } else {
184
+ this.close();
185
+ }
186
+ },
187
+ getNameI18n(tableView) {
188
+ if (!tableView || !tableView.code) {
189
+ return '';
190
+ }
191
+ if (this.layout.showI18n) {
192
+ let key = 'DataView_' + tableView.code;
193
+ let text = this.$t(key);
194
+ if (text == key) {
195
+ return tableView.name;
196
+ } else {
197
+ return text;
198
+ }
199
+ } else {
200
+ return tableView.name;
201
+ }
202
+ },
203
+ getDescI18n(tableView) {
204
+ if (!tableView || !tableView.code) {
205
+ return '';
206
+ }
207
+ if (this.layout.showI18n) {
208
+ let key = 'DataView_' + tableView.code + '_$Desc';
209
+ let text = this.$t(key);
210
+ if (text == key) {
211
+ return tableView.description || '';
212
+ } else {
213
+ return text;
214
+ }
215
+ } else {
216
+ return tableView.description || '';
217
+ }
218
+ },
219
+ setFullscreen(isFullscreen) {
220
+ if (this.$refs.table) {
221
+ this.$refs.table.isMaxHight = isFullscreen;
222
+ }
223
+ this.isFullscreen = isFullscreen;
224
+ },
225
+ onChange(data, sender, selected) {
226
+ this.$emit('on-change', data, sender, selected);
227
+ }
228
+ }
229
+ };
230
+ </script>
@@ -4,6 +4,7 @@
4
4
  -->
5
5
  <slot name="top"></slot>
6
6
  <hot-table ref="table" :settings="hotSetting"></hot-table>
7
+ <!-- DialogSelect 弹窗仍用 modal-table + view-table(行内「选择」列插槽);modal-table-excel 供全站按需使用 -->
7
8
  <modal-table ref="dialogTable">
8
9
  <template #command="{ row }">
9
10
  <Button size="small" title="选择" type="primary" custom-icon="fa fa-check" @click="dialogCheck(row)"></Button>
@@ -887,6 +888,11 @@
887
888
  cells: (row, col, prop) => {
888
889
  let column = this.columns.find(item => item.code == prop);
889
890
 
891
+ if (column == null) {
892
+ console.log('column not found!', row, col, prop);
893
+ return;
894
+ }
895
+
890
896
  let isShow = column.isShow;
891
897
  let isReadonly = column.isReadonly;
892
898