mooho-base-admin-plus 2.3.7 → 2.3.8
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 +632 -145
- package/package/mooho-base-admin-plus.min.js +80 -43
- package/package.json +1 -1
- package/public/setting.js +1 -1
- package/src/components/view/column-edit.vue +4 -0
- package/src/components/view/filter-edit.vue +5 -1
- package/src/components/view/form-setting-layout.vue +1 -0
- package/src/components/view/table-filter.vue +193 -15
- package/src/components/view/view-chart.vue +5 -5
- package/src/components/view/view-form-draggable.vue +157 -35
- package/src/components/view/view-form.vue +147 -34
- package/src/components/view/view-table.vue +150 -41
- package/src/mixins/page.js +14 -5
|
@@ -205,14 +205,17 @@
|
|
|
205
205
|
<Option v-for="item in getDataSource(rowData(row, index), column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
206
206
|
</Select>
|
|
207
207
|
</template>
|
|
208
|
-
<template v-else-if="column.controlType === 'ComboSelect'">
|
|
208
|
+
<!-- <template v-else-if="column.controlType === 'ComboSelect'">
|
|
209
209
|
<Select
|
|
210
|
+
:ref="'control_' + column.code + '_' + index"
|
|
210
211
|
size="small"
|
|
211
|
-
:model-value="
|
|
212
|
+
:model-value="parseComboData(rowData(row, index), column, index)"
|
|
212
213
|
@update:model-value="$event => setData(rowData(row, index), column.code, $event)"
|
|
213
214
|
:disabled="isReadonly(rowData(row, index), column)"
|
|
214
|
-
clearable
|
|
215
|
+
:clearable="true"
|
|
215
216
|
filterable
|
|
217
|
+
remote
|
|
218
|
+
:remote-method="search => loadOption(rowData(row, index), column, search)"
|
|
216
219
|
:style="{ width: column.controlWidth == null ? null : column.controlWidth - 8 + 'px' }"
|
|
217
220
|
:placeholder="column.description"
|
|
218
221
|
:transfer="true"
|
|
@@ -221,6 +224,25 @@
|
|
|
221
224
|
<Option v-for="item in getDataSource(rowData(row, index), column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
222
225
|
</Select>
|
|
223
226
|
</template>
|
|
227
|
+
<template v-else-if="column.controlType === 'MultiComboSelect'">
|
|
228
|
+
<Select
|
|
229
|
+
:ref="'control_' + column.code + '_' + index"
|
|
230
|
+
:model-value="parseMultiComboData(rowData(row, index), column, index)"
|
|
231
|
+
@update:model-value="$event => setArrayData(rowData(row, index), column.code, $event)"
|
|
232
|
+
:disabled="isReadonly(rowData(row, index), column)"
|
|
233
|
+
:clearable="true"
|
|
234
|
+
:multiple="true"
|
|
235
|
+
filterable
|
|
236
|
+
remote
|
|
237
|
+
:remote-method="search => loadOption(rowData(row, index), column, search)"
|
|
238
|
+
:style="{ width: column.controlWidth == null ? null : column.controlWidth - 8 + 'px' }"
|
|
239
|
+
:placeholder="column.description"
|
|
240
|
+
:transfer="true"
|
|
241
|
+
@on-change="selected => onSelectDataChange(rowData(row, index), column, selected)"
|
|
242
|
+
>
|
|
243
|
+
<Option v-for="item in getDataSource(rowData(row, index), column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
244
|
+
</Select>
|
|
245
|
+
</template> -->
|
|
224
246
|
<template v-else-if="column.controlType === 'DialogSelect'">
|
|
225
247
|
<dialog-select
|
|
226
248
|
:model-value="parseData(rowData(row, index), column.code)"
|
|
@@ -1633,9 +1655,10 @@
|
|
|
1633
1655
|
this.columns.forEach(column => {
|
|
1634
1656
|
if (
|
|
1635
1657
|
column.controlType == 'Select' ||
|
|
1658
|
+
column.controlType == 'MultiSelect' ||
|
|
1636
1659
|
column.controlType == 'SelectWithOther' ||
|
|
1637
1660
|
column.controlType == 'ComboSelect' ||
|
|
1638
|
-
column.controlType == '
|
|
1661
|
+
column.controlType == 'MultiComboSelect' ||
|
|
1639
1662
|
column.controlType == 'Radio' ||
|
|
1640
1663
|
column.controlType == 'CheckGroup'
|
|
1641
1664
|
) {
|
|
@@ -1729,13 +1752,19 @@
|
|
|
1729
1752
|
data._needClear = {};
|
|
1730
1753
|
}
|
|
1731
1754
|
|
|
1755
|
+
if (column.controlType === 'ComboSelect' || column.controlType === 'MultiComboSelect') {
|
|
1756
|
+
param.per = 20;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1732
1759
|
// 参数完整,查询数据
|
|
1760
|
+
this.disableLoader();
|
|
1733
1761
|
let res;
|
|
1734
1762
|
if (column.isSourceCustom) {
|
|
1735
1763
|
res = await customModelApi.query(column.source, param);
|
|
1736
1764
|
} else {
|
|
1737
1765
|
res = await modelApi.query(column.source, param);
|
|
1738
1766
|
}
|
|
1767
|
+
this.enableLoader();
|
|
1739
1768
|
|
|
1740
1769
|
data._rawData[column.code] = res.data;
|
|
1741
1770
|
|
|
@@ -1775,42 +1804,13 @@
|
|
|
1775
1804
|
},
|
|
1776
1805
|
// 获取数据源
|
|
1777
1806
|
getDataSource(data, column) {
|
|
1778
|
-
if (!column.isStaticItem && column.dataType.
|
|
1807
|
+
if (!column.isStaticItem && column.dataType.startsWith('Enum:')) {
|
|
1779
1808
|
// 枚举
|
|
1780
1809
|
return this.getEnumList(column.dataType.split(':')[1]);
|
|
1781
1810
|
} else if (data._dataSource != null && data._dataSource[column.code] != null) {
|
|
1782
1811
|
return data._dataSource[column.code];
|
|
1783
1812
|
}
|
|
1784
1813
|
},
|
|
1785
|
-
// // 可筛选下拉框加载数据
|
|
1786
|
-
// loadOption(data, column, keyword) {
|
|
1787
|
-
// if (!data._dataSource) {
|
|
1788
|
-
// data._dataSource = {};
|
|
1789
|
-
// }
|
|
1790
|
-
|
|
1791
|
-
// let param = this.getParam(data, column, this.parentData);
|
|
1792
|
-
|
|
1793
|
-
// if (param != null) {
|
|
1794
|
-
// if (!(keyword || '').trim() && this.parseData(data, column.code) != null) {
|
|
1795
|
-
// param.id = this.parseData(data, column.code);
|
|
1796
|
-
// } else {
|
|
1797
|
-
// param.keyword = keyword;
|
|
1798
|
-
// }
|
|
1799
|
-
// param.per = 20;
|
|
1800
|
-
|
|
1801
|
-
// this.fillDataSource(data, column, param);
|
|
1802
|
-
// } else {
|
|
1803
|
-
// // 参数不完整,清空数据
|
|
1804
|
-
// data._dataSource[column.code] = [];
|
|
1805
|
-
// this.setData(data, column.code, null);
|
|
1806
|
-
// // column.displayValue = null;
|
|
1807
|
-
|
|
1808
|
-
// // 触发
|
|
1809
|
-
// column.triggers.forEach(item => {
|
|
1810
|
-
// item.needRefresh = true;
|
|
1811
|
-
// });
|
|
1812
|
-
// }
|
|
1813
|
-
// },
|
|
1814
1814
|
// 每页数量切换
|
|
1815
1815
|
pageSizeChange(size) {
|
|
1816
1816
|
this.size = size;
|
|
@@ -1838,7 +1838,7 @@
|
|
|
1838
1838
|
|
|
1839
1839
|
this.loadData();
|
|
1840
1840
|
},
|
|
1841
|
-
columnWidthResize(newWidth, oldWidth, column
|
|
1841
|
+
columnWidthResize(newWidth, oldWidth, column) {
|
|
1842
1842
|
let widthSetting = {};
|
|
1843
1843
|
let widthSettingStr = localStorage.getItem('columnWidth_' + this.tableView.code);
|
|
1844
1844
|
|
|
@@ -2098,7 +2098,10 @@
|
|
|
2098
2098
|
};
|
|
2099
2099
|
|
|
2100
2100
|
for (let key in filter) {
|
|
2101
|
-
if (
|
|
2101
|
+
if (this.isJSON(filter[key])) {
|
|
2102
|
+
// 数组转换为逗号分隔的字符串
|
|
2103
|
+
filter[key] = JSON.parse(filter[key]).join(',');
|
|
2104
|
+
} else if (typeof filter[key] == 'object' && !(filter[key] instanceof Date)) {
|
|
2102
2105
|
delete filter[key];
|
|
2103
2106
|
}
|
|
2104
2107
|
}
|
|
@@ -2213,12 +2216,11 @@
|
|
|
2213
2216
|
// 相等
|
|
2214
2217
|
let c = column;
|
|
2215
2218
|
if (typeof value == 'string') {
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2219
|
+
if (this.isJSON(value)) {
|
|
2220
|
+
return JSON.parse(value).some(i => i == this.parseData(item, c));
|
|
2221
|
+
} else {
|
|
2222
|
+
return value.split(',').some(i => i == this.parseData(item, c));
|
|
2220
2223
|
}
|
|
2221
|
-
return false;
|
|
2222
2224
|
} else if (value instanceof Date) {
|
|
2223
2225
|
return new Date(this.parseData(item, c)) == value;
|
|
2224
2226
|
} else {
|
|
@@ -2580,6 +2582,113 @@
|
|
|
2580
2582
|
} else {
|
|
2581
2583
|
return 'end';
|
|
2582
2584
|
}
|
|
2585
|
+
},
|
|
2586
|
+
// 可筛选下拉框加载数据
|
|
2587
|
+
async loadOption(data, column, keyword) {
|
|
2588
|
+
if (column.isStaticItem || (column.dataType && column.dataType.startsWith('Enum:'))) {
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
let param = this.getParam(data, column);
|
|
2593
|
+
|
|
2594
|
+
if (param != null) {
|
|
2595
|
+
param[column.sourceDisplayCode + '_c'] = keyword;
|
|
2596
|
+
this.fillDataSource(data, column, param);
|
|
2597
|
+
} else {
|
|
2598
|
+
// 参数不完整,清空数据
|
|
2599
|
+
data._rawData[column.code] = [];
|
|
2600
|
+
data._dataSource[column.code] = [];
|
|
2601
|
+
this.setData(data, column.code, null);
|
|
2602
|
+
// column.displayValue = null;
|
|
2603
|
+
|
|
2604
|
+
// 触发
|
|
2605
|
+
column.triggers.forEach(item => {
|
|
2606
|
+
item.needClear = true;
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
},
|
|
2610
|
+
// 根据表达式取值(可筛选选择框)
|
|
2611
|
+
parseComboData(model, column, index) {
|
|
2612
|
+
let value = this.parseData(model, column.code);
|
|
2613
|
+
|
|
2614
|
+
this.loadComboDataLabel(model, column, value, index);
|
|
2615
|
+
|
|
2616
|
+
return value;
|
|
2617
|
+
},
|
|
2618
|
+
// 根据表达式取值(可筛选多选选择框)
|
|
2619
|
+
parseMultiComboData(model, column, index) {
|
|
2620
|
+
let data = [];
|
|
2621
|
+
let value = this.parseData(model, column.code);
|
|
2622
|
+
|
|
2623
|
+
if (this.isJSON(value)) {
|
|
2624
|
+
data = JSON.parse(value);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
this.loadComboDataLabel(model, column, data, index);
|
|
2628
|
+
|
|
2629
|
+
return data;
|
|
2630
|
+
},
|
|
2631
|
+
// 加载可筛选选择框显示内容
|
|
2632
|
+
async loadComboDataLabel(model, column, data, index) {
|
|
2633
|
+
if (column.isStaticItem || (column.dataType && column.dataType.startsWith('Enum:'))) {
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
// 取不到ref对象,无法给values赋值。所以可筛选选择框控件在table中暂时不可用
|
|
2638
|
+
if (this.$refs['control_' + column.code + '_' + index]) {
|
|
2639
|
+
let values = this.$refs['control_' + column.code + '_' + index].$data.values;
|
|
2640
|
+
|
|
2641
|
+
let pendings = [];
|
|
2642
|
+
if (column.controlType == 'MultiComboSelect') {
|
|
2643
|
+
data.forEach(value => {
|
|
2644
|
+
if (!values.some(v => v.value == value)) {
|
|
2645
|
+
// 不在选中项中
|
|
2646
|
+
let newValue = { value, label: null, disabled: false };
|
|
2647
|
+
values.push(newValue);
|
|
2648
|
+
pendings.push(newValue);
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
} else {
|
|
2652
|
+
if (!values.some(v => v.value == data)) {
|
|
2653
|
+
// 不在选中项中
|
|
2654
|
+
let newValue = { value: data, label: null, disabled: false };
|
|
2655
|
+
values.push(newValue);
|
|
2656
|
+
pendings.push(newValue);
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
// 读取显示内容
|
|
2661
|
+
if (pendings.length > 0) {
|
|
2662
|
+
let param = this.getParam(model, column);
|
|
2663
|
+
param[column.sourceDataCode] = pendings.map(item => item.value).join(',');
|
|
2664
|
+
let res;
|
|
2665
|
+
|
|
2666
|
+
if (column.isSourceCustom) {
|
|
2667
|
+
res = await customModelApi.query(column.source, param);
|
|
2668
|
+
} else {
|
|
2669
|
+
res = await modelApi.query(column.source, param);
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
res.data.forEach(item => {
|
|
2673
|
+
let v = this.parseData(item, column.sourceDataCode);
|
|
2674
|
+
let label = this.parseData(item, column.sourceDisplayCode);
|
|
2675
|
+
|
|
2676
|
+
if (column.controlType == 'ComboSelect') {
|
|
2677
|
+
// 添加筛选内容
|
|
2678
|
+
this.$refs['control_' + column.code + '_' + index].$data.query = label;
|
|
2679
|
+
//this.$refs['control_' + column.code + '_' + index].setQuery(label);
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
let newValue = pendings.find(i => i.value == v);
|
|
2683
|
+
|
|
2684
|
+
if (newValue) {
|
|
2685
|
+
newValue.label = label;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
this.$forceUpdate();
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2583
2692
|
}
|
|
2584
2693
|
}
|
|
2585
2694
|
};
|
package/src/mixins/page.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util from '../libs/util';
|
|
2
2
|
import { cloneDeep, get, set } from 'lodash';
|
|
3
3
|
import router from '../router';
|
|
4
|
-
import { mapState, mapActions } from 'vuex';
|
|
4
|
+
import { mapState, mapActions, mapMutations } from 'vuex';
|
|
5
5
|
import dateFormat from 'date-fns/format';
|
|
6
6
|
import Setting from '../setting';
|
|
7
7
|
import sweetalert2 from 'sweetalert2';
|
|
@@ -98,6 +98,8 @@ export default {
|
|
|
98
98
|
},
|
|
99
99
|
methods: {
|
|
100
100
|
...mapActions('admin/cache', ['loadEnum', 'loadDict', 'loadUserName', 'loadCache']),
|
|
101
|
+
...mapMutations('admin/loader', { enableLoader: 'enable' }),
|
|
102
|
+
...mapMutations('admin/loader', { disableLoader: 'disable' }),
|
|
101
103
|
copy(model) {
|
|
102
104
|
return cloneDeep(model);
|
|
103
105
|
//return JSON.parse(JSON.stringify(model));
|
|
@@ -232,7 +234,7 @@ export default {
|
|
|
232
234
|
return null;
|
|
233
235
|
}
|
|
234
236
|
|
|
235
|
-
if (dataType.
|
|
237
|
+
if (dataType.startsWith('Enum:')) {
|
|
236
238
|
return this.getEnum(dataType.replace('Enum:', ''), this.parseData(model, expression));
|
|
237
239
|
} else if (dataType === 'BigInteger' && format == 'User') {
|
|
238
240
|
return this.getUserName(this.parseData(model, expression));
|
|
@@ -282,9 +284,16 @@ export default {
|
|
|
282
284
|
}
|
|
283
285
|
} else if (dataType === 'String') {
|
|
284
286
|
if (format === 'Array') {
|
|
285
|
-
let
|
|
287
|
+
let result = '';
|
|
288
|
+
try {
|
|
289
|
+
let array = JSON.parse(value);
|
|
286
290
|
|
|
287
|
-
|
|
291
|
+
result = array.join(', ');
|
|
292
|
+
} catch (e) {
|
|
293
|
+
//console.log(e);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return result;
|
|
288
297
|
} else {
|
|
289
298
|
//if (this.layout.showI18n) {
|
|
290
299
|
return this.tParam(value);
|
|
@@ -793,7 +802,7 @@ export default {
|
|
|
793
802
|
},
|
|
794
803
|
// 判断是否JSON
|
|
795
804
|
isJSON(str) {
|
|
796
|
-
if (!!(str || '').trim()) {
|
|
805
|
+
if (typeof str == 'string' && !!(str || '').trim()) {
|
|
797
806
|
try {
|
|
798
807
|
var obj = JSON.parse(str);
|
|
799
808
|
if (typeof obj == 'object' && obj) {
|