cloud-web-corejs 1.0.281 → 1.1.0-dev.4
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 +6 -2
- package/src/components/VabUpload/image-viewer.vue +442 -442
- package/src/components/VabUpload/index.vue +44 -2
- package/src/components/VabUpload/mixins.js +126 -19
- package/src/components/VabUpload/view.vue +247 -209
- package/src/components/baseTabs/mixins.js +181 -181
- package/src/components/bizTab/BizBillActions.vue +129 -0
- package/src/components/bizTab/BizTabListPage.vue +391 -0
- package/src/components/bizTab/README.md +378 -0
- package/src/components/bizTab/billTableUtil.js +48 -0
- package/src/components/bizTab/billValidators.js +136 -0
- package/src/components/bizTab/bizBillDetailMixin.js +705 -0
- package/src/components/bizTab/index.js +24 -0
- package/src/components/excelExport/exportFieldDialog.vue +23 -12
- package/src/components/excelExport/exportItemConfigUtil.js +30 -0
- package/src/components/excelExport/mixins.js +3 -3
- package/src/components/mobile/statusTag/mixins.js +1 -61
- package/src/components/mobile/wf/content.vue +1662 -1556
- package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +8 -6
- package/src/components/table/config.js +78 -78
- package/src/components/table/index.js +1276 -1276
- package/src/components/table/plugins/cell-area/index.js +1055 -0
- package/src/components/table/plugins/cell-area/index.scss +77 -0
- package/src/components/table/plugins/cell-area/util.js +224 -0
- package/src/components/table/tableForm.vue +330 -330
- package/src/components/table/tableFormMixin.js +318 -318
- package/src/components/table/vxeFilter/index.js +163 -163
- package/src/components/table/vxeFilter/mixin.js +316 -316
- package/src/components/wf/content.vue +1188 -1188
- package/src/components/wf/wf.js +40 -20
- package/src/components/wf/wfActionDropdown.vue +1 -1
- package/src/components/wf/wfActionItems.js +1 -1
- package/src/components/xform/docs/2026-08 xform H5 P0 /345/256/236/347/216/260/350/247/204/346/240/274.md" +528 -0
- package/src/components/xform/docs/2026-08 xform H5 P1 /345/256/236/347/216/260/350/247/204/346/240/274.md" +412 -0
- package/src/components/xform/docs/2026-08 xform H5 P2 /345/256/236/347/216/260/350/247/204/346/240/274.md" +287 -0
- package/src/components/xform/docs/2026-08 xform /347/247/273/345/212/250/347/253/257/345/270/203/345/261/200/345/257/271/351/275/220 bill_setting /346/226/271/346/241/210.md" +400 -0
- package/src/components/xform/form-designer/designer.js +15 -0
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +269 -269
- package/src/components/xform/form-designer/form-widget/container-widget/detail-temp-widget.vue +132 -0
- package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +250 -250
- package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +319 -320
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +365 -365
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +554 -555
- package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +409 -409
- package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +150 -132
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +114 -114
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +154 -154
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +47 -1
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +178 -178
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -77
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -0
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +139 -139
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +106 -106
- package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +134 -134
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +1 -0
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +39 -39
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +10 -10
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +438 -432
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +2103 -2103
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +90 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +82 -82
- package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +19 -5
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +8 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +137 -137
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +237 -237
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -96
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +42 -42
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +158 -158
- package/src/components/xform/form-designer/setting-panel/property-editor/h5Span-editor.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/itemStyle-editor.vue +39 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +188 -188
- package/src/components/xform/form-designer/setting-panel/property-editor/styleTempClass-editor.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +347 -347
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +4 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +59 -3
- package/src/components/xform/form-render/container-item/data-table-mixin.js +151 -93
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +183 -32
- package/src/components/xform/form-render/container-item/detail-temp-item.vue +110 -0
- package/src/components/xform/form-render/container-item/h5-card-pane-item.vue +160 -140
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1688 -1700
- package/src/components/xform/form-render/index.vue +153 -147
- package/src/components/xform/form-render/indexMixin.js +12 -0
- package/src/components/xform/lang/en-US.js +10 -0
- package/src/components/xform/lang/zh-CN.js +12 -0
- package/src/components/xform/mixins/defaultHandle.js +707 -707
- package/src/components/xform/styles/h5.scss +1992 -0
- package/src/components/xform/utils/textMaskUtil.js +182 -179
- package/src/components/xform/utils/treeTableUtil.js +1292 -1265
- package/src/components/xform/utils/util.js +56 -11
- package/src/index.js +9 -4
- package/src/layout/components/extractedCode/viewDialog.vue +7 -7
- package/src/router/index.js +21 -0
- package/src/router/modules/customer.js +71 -14
- package/src/store/modules/permission.js +17 -18
- package/src/utils/pdfUtil.js +429 -429
- package/src/utils/resolveViewComponent.js +142 -16
- package/src/views/bd/project/branch/bd_branch/edit.vue +145 -0
- package/src/views/bd/project/branch/bd_branch/list.vue +72 -0
- package/src/views/bd/project/branch/bd_branch/menuKindDialog.vue +106 -0
- package/src/views/bd/project/branch/bd_branch/mixins/edit.js +189 -0
- package/src/views/bd/project/branch/bd_branch/mixins/list.js +124 -0
- package/src/views/bd/project/branch/bd_branch/mixins/menuKindDialog.js +85 -0
- package/src/views/bd/project/branch/form_script/list.vue +31 -0
- package/src/views/bd/project/branch/form_template/list.vue +30 -0
- package/src/views/bd/project/branch/menu_kind/list.vue +31 -0
- package/src/views/bd/project/common/form_script/list.vue +16 -0
- package/src/views/bd/project/common/form_template/list.vue +15 -0
- package/src/views/bd/project/common/menu_kind/list.vue +15 -0
- package/src/views/bd/project/core/branchContext.js +100 -0
- package/src/views/bd/project/core/branchPage.js +78 -0
- package/src/views/bd/project/core/branchPageWrap.vue +225 -0
- package/src/views/bd/project/core/branchScope.js +44 -0
- package/src/views/bd/project/core/branchSearchPage.js +285 -0
- package/src/views/bd/project/core/branchSelect.vue +85 -0
- package/src/views/bd/project/core/branchTreeBar.vue +81 -0
- package/src/views/bd/project/core/httpBranchPatch.js +58 -0
- package/src/views/bd/project/datatable/menu_kind/list.vue +15 -0
- package/src/views/bd/project/datatable/table_model/list.vue +15 -0
- package/src/views/bd/setting/bd_company_env/dialog.vue +174 -174
- package/src/views/bd/setting/table_model/edit.vue +1066 -1066
- package/src/views/bd/setting/table_model/mixins/edit.js +1455 -1455
- package/src/views/bd/setting/table_model/mixins/zdDialog.js +148 -148
- package/src/views/demo/bizTab/bill/billConfig.js +41 -0
- package/src/views/demo/bizTab/bill/detail.vue +436 -0
- package/src/views/demo/bizTab/bill/list.vue +288 -0
- package/src/views/demo/bizTab/bill/productDialog.vue +176 -0
- package/src/views/demo/bizTab/simple/billApi.js +123 -0
- package/src/views/demo/bizTab/simple/detail.vue +407 -0
- package/src/views/demo/bizTab/simple/list.vue +217 -0
- package/src/views/demo/bizTab/standalone/index.vue +121 -0
- package/src/views/demo/bizTab/wf/billConfig.js +44 -0
- package/src/views/demo/bizTab/wf/detail.vue +661 -0
- package/src/views/demo/bizTab/wf/list.vue +242 -0
- package/src/views/support/form-dialog-demo/demoPickerDialog.vue +72 -0
- package/src/views/support/form-dialog-demo/index.vue +537 -0
- package/src/views/user/file_view_ins/list.vue +3 -3
- package/src/views/user/home/index.vue +8 -6
- package/src/views/user/home/wjl/content.vue +1569 -0
- package/src/views/user/notify_message/dialog.vue +7 -5
- package/src/views/user/outLink/cc_form_view.vue +188 -0
- package/src/views/user/outLink/form_view.vue +2 -2
- package/src/views/user/outLink/index.vue +4 -4
- package/src/views/user/outLink/view.vue +3 -3
- package/src/views/user/role/edit.vue +632 -632
- package/src/views/user/role/list.vue +260 -260
- package/src/views/user/wf/iframe/index.vue +3 -3
- package/src/views/user/wf/iframe/index2.vue +3 -3
- package/src/views/user/wf/wf_manage/list.vue +1112 -1116
- package/src/views/user/wf/wf_manage/list2.vue +9 -13
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +8 -5
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +0 -106
- package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +0 -99
- package/src/components/xform/form-render/container-item/list-h5-item2.vue +0 -1340
- package/src/utils/wf.js +0 -766
|
@@ -1,316 +1,316 @@
|
|
|
1
|
-
// 直接引用工具函数,不走 $table 实例上的补丁方法:
|
|
2
|
-
// initVxeTable 只把 getCellValue/createParams 挂在初始化时的那个 xTable 实例上,
|
|
3
|
-
// 页面若用 v-if 销毁重建 vxe-grid(如 product_problem_record/list.vue),
|
|
4
|
-
// 新实例上没有这两个方法,筛选面板会报 $table.getCellValue is not a function
|
|
5
|
-
import { getCellValue, createParams } from "../util/index";
|
|
6
|
-
|
|
7
|
-
let modules = {};
|
|
8
|
-
|
|
9
|
-
modules = {
|
|
10
|
-
contentMixin: {
|
|
11
|
-
name: "FilterContent",
|
|
12
|
-
props: {
|
|
13
|
-
params: Object,
|
|
14
|
-
},
|
|
15
|
-
data() {
|
|
16
|
-
return {
|
|
17
|
-
size: "mini",
|
|
18
|
-
isAll: false,
|
|
19
|
-
option: null,
|
|
20
|
-
colValList: [],
|
|
21
|
-
valList: [],
|
|
22
|
-
valMap: null,
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
created() {
|
|
26
|
-
this.load();
|
|
27
|
-
},
|
|
28
|
-
methods: {
|
|
29
|
-
getShowValue(val) {
|
|
30
|
-
if (this.valMap && Object.keys(this.valMap).length > 0) {
|
|
31
|
-
return this.valMap[val];
|
|
32
|
-
} else {
|
|
33
|
-
return val;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
load() {
|
|
37
|
-
const { $table, column } = this.params;
|
|
38
|
-
const { fullColumn, tableColumn } = $table.getTableColumn();
|
|
39
|
-
const { fullData } = $table.getTableData();
|
|
40
|
-
const option = column.filters[0];
|
|
41
|
-
if (!option.data) {
|
|
42
|
-
option.data = {
|
|
43
|
-
sVal: "",
|
|
44
|
-
};
|
|
45
|
-
} else if (option.data.sVal == null) {
|
|
46
|
-
option.data.sVal = "";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!option.data.hasFilter) {
|
|
50
|
-
this.isAll = true;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let vals = option.data && option.data.vals ? option.data.vals : [];
|
|
54
|
-
let valMap =
|
|
55
|
-
option.data && option.data.valMap ? option.data.valMap : null;
|
|
56
|
-
|
|
57
|
-
let lsm = {};
|
|
58
|
-
let colValList = [];
|
|
59
|
-
fullData.map((row, $rowIndex) => {
|
|
60
|
-
let cellValue = getCellValue({
|
|
61
|
-
row,
|
|
62
|
-
$rowIndex,
|
|
63
|
-
$table,
|
|
64
|
-
column,
|
|
65
|
-
});
|
|
66
|
-
let sortValue = cellValue
|
|
67
|
-
let sortField = column.params?.sortField;
|
|
68
|
-
if(sortField){
|
|
69
|
-
sortValue = row[sortField]??null;
|
|
70
|
-
}
|
|
71
|
-
if (lsm[cellValue]) {
|
|
72
|
-
lsm[cellValue].count = lsm[cellValue].count + 1;
|
|
73
|
-
} else {
|
|
74
|
-
lsm[cellValue] = {
|
|
75
|
-
checked: !option.data.hasFilter || vals.includes(cellValue),
|
|
76
|
-
value: cellValue,
|
|
77
|
-
sortValue: sortValue,
|
|
78
|
-
count: 1,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
for (let key in lsm) {
|
|
83
|
-
colValList.push(lsm[key]);
|
|
84
|
-
}
|
|
85
|
-
colValList = this.sortByField(colValList, "sortValue");
|
|
86
|
-
|
|
87
|
-
const columnsArr = [];
|
|
88
|
-
|
|
89
|
-
this.option = option;
|
|
90
|
-
this.colValList = colValList;
|
|
91
|
-
this.valList = colValList;
|
|
92
|
-
this.valMap = valMap;
|
|
93
|
-
|
|
94
|
-
let filterColumns = fullColumn.filter((row, $rowIndex) => {
|
|
95
|
-
return (
|
|
96
|
-
row.filterRender &&
|
|
97
|
-
row.filterRender.name == "FilterContent" &&
|
|
98
|
-
row.field != column.field
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
let datas = fullData.filter((row, $rowIndex) => {
|
|
103
|
-
let item = filterColumns.find((filterColumn) => {
|
|
104
|
-
let option1 = filterColumn.filters[0];
|
|
105
|
-
if (!option1.data.hasFilter) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
const vals = option1.data.vals || [];
|
|
109
|
-
let param = createParams({
|
|
110
|
-
$table: $table,
|
|
111
|
-
row,
|
|
112
|
-
column: filterColumn,
|
|
113
|
-
});
|
|
114
|
-
let cellValue = getCellValue(param);
|
|
115
|
-
return !vals.includes(cellValue);
|
|
116
|
-
});
|
|
117
|
-
return item == null;
|
|
118
|
-
});
|
|
119
|
-
let lsm2 = {};
|
|
120
|
-
datas.map((row, $rowIndex) => {
|
|
121
|
-
let cellValue = getCellValue({
|
|
122
|
-
row,
|
|
123
|
-
$rowIndex,
|
|
124
|
-
$table,
|
|
125
|
-
column,
|
|
126
|
-
});
|
|
127
|
-
if (lsm2[cellValue]) {
|
|
128
|
-
lsm2[cellValue].count = lsm2[cellValue].count + 1;
|
|
129
|
-
} else {
|
|
130
|
-
lsm2[cellValue] = {
|
|
131
|
-
value: cellValue,
|
|
132
|
-
count: 1,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
colValList.forEach((colVal) => {
|
|
137
|
-
let item = lsm2[colVal.value];
|
|
138
|
-
if (item) {
|
|
139
|
-
colVal.filterCount = item.count;
|
|
140
|
-
} else {
|
|
141
|
-
colVal.filterCount = 0;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
this.searchEvent();
|
|
146
|
-
},
|
|
147
|
-
sortByField(array, field) {
|
|
148
|
-
return [...array].sort((a, b) => {
|
|
149
|
-
const valA = a[field];
|
|
150
|
-
const valB = b[field];
|
|
151
|
-
|
|
152
|
-
// 处理 null/undefined(视为最小值)
|
|
153
|
-
if (valA == null) return -1;
|
|
154
|
-
if (valB == null) return 1;
|
|
155
|
-
if (valA == null && valB == null) return 0;
|
|
156
|
-
|
|
157
|
-
// 尝试数值比较
|
|
158
|
-
const numA = Number(valA);
|
|
159
|
-
const numB = Number(valB);
|
|
160
|
-
if (!isNaN(numA) && !isNaN(numB)) {
|
|
161
|
-
return numA - numB;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// 字符串比较
|
|
165
|
-
return String(valA).localeCompare(String(valB));
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
searchEvent() {
|
|
169
|
-
let that = this;
|
|
170
|
-
const { option, colValList } = this;
|
|
171
|
-
this.valList = option.data.sVal
|
|
172
|
-
? colValList.filter(function (item) {
|
|
173
|
-
let value = item.value;
|
|
174
|
-
// 空单元格的 value 为 null/undefined,数值列为 number,必须转字符串再匹配
|
|
175
|
-
return (
|
|
176
|
-
value != null &&
|
|
177
|
-
String(value).indexOf(option.data.sVal) > -1
|
|
178
|
-
);
|
|
179
|
-
})
|
|
180
|
-
: colValList;
|
|
181
|
-
let isAll = this.valList.every((item) => {
|
|
182
|
-
return item.checked == true;
|
|
183
|
-
});
|
|
184
|
-
this.isAll = isAll;
|
|
185
|
-
},
|
|
186
|
-
changeAllEvent() {
|
|
187
|
-
const { isAll } = this;
|
|
188
|
-
this.valList.forEach((item) => {
|
|
189
|
-
item.checked = isAll;
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
checkItem(checked) {
|
|
193
|
-
if (checked) {
|
|
194
|
-
let isAll = this.valList.every((item) => {
|
|
195
|
-
return item.checked == true;
|
|
196
|
-
});
|
|
197
|
-
this.isAll = isAll;
|
|
198
|
-
} else {
|
|
199
|
-
this.isAll = false;
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
confirmFilterEvent(evnt) {
|
|
203
|
-
const { params, option, valList, colValList } = this;
|
|
204
|
-
const { data } = option;
|
|
205
|
-
const { $panel, $table } = params;
|
|
206
|
-
let vals = valList
|
|
207
|
-
.filter((item) => item.checked)
|
|
208
|
-
.map((item) => item.value);
|
|
209
|
-
if (!option.data.sVal && colValList.length == vals.length) {
|
|
210
|
-
this.resetFilterEvent();
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
data.vals = vals;
|
|
214
|
-
option.data.hasFilter = true;
|
|
215
|
-
$panel.changeOption(evnt, true, option);
|
|
216
|
-
$panel.confirmFilter();
|
|
217
|
-
$table.setAllCheckboxRow(false);
|
|
218
|
-
},
|
|
219
|
-
resetFilterEvent() {
|
|
220
|
-
const { $panel, $table } = this.params;
|
|
221
|
-
this.option.data.hasFilter = false;
|
|
222
|
-
$panel.resetFilter();
|
|
223
|
-
$table.setAllCheckboxRow(false);
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
complexMixin: {
|
|
228
|
-
name: "FilterComplex",
|
|
229
|
-
props: {
|
|
230
|
-
params: Object,
|
|
231
|
-
events: Object,
|
|
232
|
-
},
|
|
233
|
-
data() {
|
|
234
|
-
return {
|
|
235
|
-
size: "mini", // 被所有子组件继承 size
|
|
236
|
-
column: null,
|
|
237
|
-
option: null,
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
created() {
|
|
241
|
-
this.load();
|
|
242
|
-
},
|
|
243
|
-
methods: {
|
|
244
|
-
load() {
|
|
245
|
-
const { column } = this.params;
|
|
246
|
-
const option = column.filters[0];
|
|
247
|
-
if (!option.data) {
|
|
248
|
-
option.data = {
|
|
249
|
-
type: "lt",
|
|
250
|
-
};
|
|
251
|
-
} else if (!option.data.type) {
|
|
252
|
-
option.data.type = "lt";
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
this.column = column;
|
|
256
|
-
this.option = option;
|
|
257
|
-
},
|
|
258
|
-
changeOptionEvent() {
|
|
259
|
-
const { params, option } = this;
|
|
260
|
-
const { $panel } = params;
|
|
261
|
-
const checked = !!option.data.name;
|
|
262
|
-
$panel.changeOption(null, checked, option);
|
|
263
|
-
},
|
|
264
|
-
confirmEvent() {
|
|
265
|
-
const { $panel, column } = this.params;
|
|
266
|
-
$panel.confirmFilter();
|
|
267
|
-
},
|
|
268
|
-
resetEvent() {
|
|
269
|
-
// eslint-disable-next-line no-unused-vars
|
|
270
|
-
const { $panel } = this.params;
|
|
271
|
-
$panel.resetFilter();
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
inputMixin: {
|
|
276
|
-
name: "FilterInput",
|
|
277
|
-
props: {
|
|
278
|
-
params: Object,
|
|
279
|
-
},
|
|
280
|
-
data() {
|
|
281
|
-
return {
|
|
282
|
-
column: null,
|
|
283
|
-
option: null,
|
|
284
|
-
};
|
|
285
|
-
},
|
|
286
|
-
created() {
|
|
287
|
-
this.load();
|
|
288
|
-
},
|
|
289
|
-
methods: {
|
|
290
|
-
load() {
|
|
291
|
-
const { column } = this.params;
|
|
292
|
-
const option = column.filters[0];
|
|
293
|
-
this.column = column;
|
|
294
|
-
this.option = option;
|
|
295
|
-
},
|
|
296
|
-
changeOptionEvent() {
|
|
297
|
-
const { params, option } = this;
|
|
298
|
-
const { $panel } = params;
|
|
299
|
-
const checked = !!option.data;
|
|
300
|
-
$panel.changeOption(null, checked, option);
|
|
301
|
-
},
|
|
302
|
-
keyupEvent({ $event }) {
|
|
303
|
-
const { params } = this;
|
|
304
|
-
const { $panel } = params;
|
|
305
|
-
if ($event.keyCode === 13) {
|
|
306
|
-
$panel.confirmFilter();
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
export const inputMixin = modules.inputMixin;
|
|
314
|
-
export const complexMixin = modules.complexMixin;
|
|
315
|
-
export const contentMixin = modules.contentMixin;
|
|
316
|
-
export default modules;
|
|
1
|
+
// 直接引用工具函数,不走 $table 实例上的补丁方法:
|
|
2
|
+
// initVxeTable 只把 getCellValue/createParams 挂在初始化时的那个 xTable 实例上,
|
|
3
|
+
// 页面若用 v-if 销毁重建 vxe-grid(如 product_problem_record/list.vue),
|
|
4
|
+
// 新实例上没有这两个方法,筛选面板会报 $table.getCellValue is not a function
|
|
5
|
+
import { getCellValue, createParams } from "../util/index";
|
|
6
|
+
|
|
7
|
+
let modules = {};
|
|
8
|
+
|
|
9
|
+
modules = {
|
|
10
|
+
contentMixin: {
|
|
11
|
+
name: "FilterContent",
|
|
12
|
+
props: {
|
|
13
|
+
params: Object,
|
|
14
|
+
},
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
size: "mini",
|
|
18
|
+
isAll: false,
|
|
19
|
+
option: null,
|
|
20
|
+
colValList: [],
|
|
21
|
+
valList: [],
|
|
22
|
+
valMap: null,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
created() {
|
|
26
|
+
this.load();
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
getShowValue(val) {
|
|
30
|
+
if (this.valMap && Object.keys(this.valMap).length > 0) {
|
|
31
|
+
return this.valMap[val];
|
|
32
|
+
} else {
|
|
33
|
+
return val;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
load() {
|
|
37
|
+
const { $table, column } = this.params;
|
|
38
|
+
const { fullColumn, tableColumn } = $table.getTableColumn();
|
|
39
|
+
const { fullData } = $table.getTableData();
|
|
40
|
+
const option = column.filters[0];
|
|
41
|
+
if (!option.data) {
|
|
42
|
+
option.data = {
|
|
43
|
+
sVal: "",
|
|
44
|
+
};
|
|
45
|
+
} else if (option.data.sVal == null) {
|
|
46
|
+
option.data.sVal = "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!option.data.hasFilter) {
|
|
50
|
+
this.isAll = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let vals = option.data && option.data.vals ? option.data.vals : [];
|
|
54
|
+
let valMap =
|
|
55
|
+
option.data && option.data.valMap ? option.data.valMap : null;
|
|
56
|
+
|
|
57
|
+
let lsm = {};
|
|
58
|
+
let colValList = [];
|
|
59
|
+
fullData.map((row, $rowIndex) => {
|
|
60
|
+
let cellValue = getCellValue({
|
|
61
|
+
row,
|
|
62
|
+
$rowIndex,
|
|
63
|
+
$table,
|
|
64
|
+
column,
|
|
65
|
+
});
|
|
66
|
+
let sortValue = cellValue
|
|
67
|
+
let sortField = column.params?.sortField;
|
|
68
|
+
if(sortField){
|
|
69
|
+
sortValue = row[sortField]??null;
|
|
70
|
+
}
|
|
71
|
+
if (lsm[cellValue]) {
|
|
72
|
+
lsm[cellValue].count = lsm[cellValue].count + 1;
|
|
73
|
+
} else {
|
|
74
|
+
lsm[cellValue] = {
|
|
75
|
+
checked: !option.data.hasFilter || vals.includes(cellValue),
|
|
76
|
+
value: cellValue,
|
|
77
|
+
sortValue: sortValue,
|
|
78
|
+
count: 1,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
for (let key in lsm) {
|
|
83
|
+
colValList.push(lsm[key]);
|
|
84
|
+
}
|
|
85
|
+
colValList = this.sortByField(colValList, "sortValue");
|
|
86
|
+
|
|
87
|
+
const columnsArr = [];
|
|
88
|
+
|
|
89
|
+
this.option = option;
|
|
90
|
+
this.colValList = colValList;
|
|
91
|
+
this.valList = colValList;
|
|
92
|
+
this.valMap = valMap;
|
|
93
|
+
|
|
94
|
+
let filterColumns = fullColumn.filter((row, $rowIndex) => {
|
|
95
|
+
return (
|
|
96
|
+
row.filterRender &&
|
|
97
|
+
row.filterRender.name == "FilterContent" &&
|
|
98
|
+
row.field != column.field
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
let datas = fullData.filter((row, $rowIndex) => {
|
|
103
|
+
let item = filterColumns.find((filterColumn) => {
|
|
104
|
+
let option1 = filterColumn.filters[0];
|
|
105
|
+
if (!option1.data.hasFilter) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const vals = option1.data.vals || [];
|
|
109
|
+
let param = createParams({
|
|
110
|
+
$table: $table,
|
|
111
|
+
row,
|
|
112
|
+
column: filterColumn,
|
|
113
|
+
});
|
|
114
|
+
let cellValue = getCellValue(param);
|
|
115
|
+
return !vals.includes(cellValue);
|
|
116
|
+
});
|
|
117
|
+
return item == null;
|
|
118
|
+
});
|
|
119
|
+
let lsm2 = {};
|
|
120
|
+
datas.map((row, $rowIndex) => {
|
|
121
|
+
let cellValue = getCellValue({
|
|
122
|
+
row,
|
|
123
|
+
$rowIndex,
|
|
124
|
+
$table,
|
|
125
|
+
column,
|
|
126
|
+
});
|
|
127
|
+
if (lsm2[cellValue]) {
|
|
128
|
+
lsm2[cellValue].count = lsm2[cellValue].count + 1;
|
|
129
|
+
} else {
|
|
130
|
+
lsm2[cellValue] = {
|
|
131
|
+
value: cellValue,
|
|
132
|
+
count: 1,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
colValList.forEach((colVal) => {
|
|
137
|
+
let item = lsm2[colVal.value];
|
|
138
|
+
if (item) {
|
|
139
|
+
colVal.filterCount = item.count;
|
|
140
|
+
} else {
|
|
141
|
+
colVal.filterCount = 0;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
this.searchEvent();
|
|
146
|
+
},
|
|
147
|
+
sortByField(array, field) {
|
|
148
|
+
return [...array].sort((a, b) => {
|
|
149
|
+
const valA = a[field];
|
|
150
|
+
const valB = b[field];
|
|
151
|
+
|
|
152
|
+
// 处理 null/undefined(视为最小值)
|
|
153
|
+
if (valA == null) return -1;
|
|
154
|
+
if (valB == null) return 1;
|
|
155
|
+
if (valA == null && valB == null) return 0;
|
|
156
|
+
|
|
157
|
+
// 尝试数值比较
|
|
158
|
+
const numA = Number(valA);
|
|
159
|
+
const numB = Number(valB);
|
|
160
|
+
if (!isNaN(numA) && !isNaN(numB)) {
|
|
161
|
+
return numA - numB;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// 字符串比较
|
|
165
|
+
return String(valA).localeCompare(String(valB));
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
searchEvent() {
|
|
169
|
+
let that = this;
|
|
170
|
+
const { option, colValList } = this;
|
|
171
|
+
this.valList = option.data.sVal
|
|
172
|
+
? colValList.filter(function (item) {
|
|
173
|
+
let value = item.value;
|
|
174
|
+
// 空单元格的 value 为 null/undefined,数值列为 number,必须转字符串再匹配
|
|
175
|
+
return (
|
|
176
|
+
value != null &&
|
|
177
|
+
String(value).indexOf(option.data.sVal) > -1
|
|
178
|
+
);
|
|
179
|
+
})
|
|
180
|
+
: colValList;
|
|
181
|
+
let isAll = this.valList.every((item) => {
|
|
182
|
+
return item.checked == true;
|
|
183
|
+
});
|
|
184
|
+
this.isAll = isAll;
|
|
185
|
+
},
|
|
186
|
+
changeAllEvent() {
|
|
187
|
+
const { isAll } = this;
|
|
188
|
+
this.valList.forEach((item) => {
|
|
189
|
+
item.checked = isAll;
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
checkItem(checked) {
|
|
193
|
+
if (checked) {
|
|
194
|
+
let isAll = this.valList.every((item) => {
|
|
195
|
+
return item.checked == true;
|
|
196
|
+
});
|
|
197
|
+
this.isAll = isAll;
|
|
198
|
+
} else {
|
|
199
|
+
this.isAll = false;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
confirmFilterEvent(evnt) {
|
|
203
|
+
const { params, option, valList, colValList } = this;
|
|
204
|
+
const { data } = option;
|
|
205
|
+
const { $panel, $table } = params;
|
|
206
|
+
let vals = valList
|
|
207
|
+
.filter((item) => item.checked)
|
|
208
|
+
.map((item) => item.value);
|
|
209
|
+
if (!option.data.sVal && colValList.length == vals.length) {
|
|
210
|
+
this.resetFilterEvent();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
data.vals = vals;
|
|
214
|
+
option.data.hasFilter = true;
|
|
215
|
+
$panel.changeOption(evnt, true, option);
|
|
216
|
+
$panel.confirmFilter();
|
|
217
|
+
$table.setAllCheckboxRow(false);
|
|
218
|
+
},
|
|
219
|
+
resetFilterEvent() {
|
|
220
|
+
const { $panel, $table } = this.params;
|
|
221
|
+
this.option.data.hasFilter = false;
|
|
222
|
+
$panel.resetFilter();
|
|
223
|
+
$table.setAllCheckboxRow(false);
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
complexMixin: {
|
|
228
|
+
name: "FilterComplex",
|
|
229
|
+
props: {
|
|
230
|
+
params: Object,
|
|
231
|
+
events: Object,
|
|
232
|
+
},
|
|
233
|
+
data() {
|
|
234
|
+
return {
|
|
235
|
+
size: "mini", // 被所有子组件继承 size
|
|
236
|
+
column: null,
|
|
237
|
+
option: null,
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
created() {
|
|
241
|
+
this.load();
|
|
242
|
+
},
|
|
243
|
+
methods: {
|
|
244
|
+
load() {
|
|
245
|
+
const { column } = this.params;
|
|
246
|
+
const option = column.filters[0];
|
|
247
|
+
if (!option.data) {
|
|
248
|
+
option.data = {
|
|
249
|
+
type: "lt",
|
|
250
|
+
};
|
|
251
|
+
} else if (!option.data.type) {
|
|
252
|
+
option.data.type = "lt";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
this.column = column;
|
|
256
|
+
this.option = option;
|
|
257
|
+
},
|
|
258
|
+
changeOptionEvent() {
|
|
259
|
+
const { params, option } = this;
|
|
260
|
+
const { $panel } = params;
|
|
261
|
+
const checked = !!option.data.name;
|
|
262
|
+
$panel.changeOption(null, checked, option);
|
|
263
|
+
},
|
|
264
|
+
confirmEvent() {
|
|
265
|
+
const { $panel, column } = this.params;
|
|
266
|
+
$panel.confirmFilter();
|
|
267
|
+
},
|
|
268
|
+
resetEvent() {
|
|
269
|
+
// eslint-disable-next-line no-unused-vars
|
|
270
|
+
const { $panel } = this.params;
|
|
271
|
+
$panel.resetFilter();
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
inputMixin: {
|
|
276
|
+
name: "FilterInput",
|
|
277
|
+
props: {
|
|
278
|
+
params: Object,
|
|
279
|
+
},
|
|
280
|
+
data() {
|
|
281
|
+
return {
|
|
282
|
+
column: null,
|
|
283
|
+
option: null,
|
|
284
|
+
};
|
|
285
|
+
},
|
|
286
|
+
created() {
|
|
287
|
+
this.load();
|
|
288
|
+
},
|
|
289
|
+
methods: {
|
|
290
|
+
load() {
|
|
291
|
+
const { column } = this.params;
|
|
292
|
+
const option = column.filters[0];
|
|
293
|
+
this.column = column;
|
|
294
|
+
this.option = option;
|
|
295
|
+
},
|
|
296
|
+
changeOptionEvent() {
|
|
297
|
+
const { params, option } = this;
|
|
298
|
+
const { $panel } = params;
|
|
299
|
+
const checked = !!option.data;
|
|
300
|
+
$panel.changeOption(null, checked, option);
|
|
301
|
+
},
|
|
302
|
+
keyupEvent({ $event }) {
|
|
303
|
+
const { params } = this;
|
|
304
|
+
const { $panel } = params;
|
|
305
|
+
if ($event.keyCode === 13) {
|
|
306
|
+
$panel.confirmFilter();
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export const inputMixin = modules.inputMixin;
|
|
314
|
+
export const complexMixin = modules.complexMixin;
|
|
315
|
+
export const contentMixin = modules.contentMixin;
|
|
316
|
+
export default modules;
|