bri-components 1.5.22 → 1.6.1
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/README.md +83 -83
- package/lib/styles/bundle.css +12 -12
- package/lib/styles/font/fontello.svg +31 -31
- package/package.json +127 -125
- package/src/components/Error/Error403.vue +42 -42
- package/src/components/Error/Error404.vue +40 -40
- package/src/components/Error/Error500.vue +51 -51
- package/src/components/Error/error.less +162 -162
- package/src/components/Error/errorBack.vue +40 -40
- package/src/components/controls/DshControlInput.vue +195 -195
- package/src/components/controls/base/BriUpload/BriUpload.vue +435 -434
- package/src/components/controls/base/BriUpload/BriUploadImage.vue +430 -377
- package/src/components/controls/base/BriUpload/uploadList.vue +738 -727
- package/src/components/controls/base/BriUpload/uploadMixin.js +453 -446
- package/src/components/controls/base/DshCascader/DshCascader.vue +215 -215
- package/src/components/controls/base/DshCascader/components/cascaderModal.vue +366 -366
- package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +416 -416
- package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -141
- package/src/components/controls/base/DshCascader/components/cascaderTree.vue +151 -151
- package/src/components/controls/base/DshCoordinates.vue +587 -585
- package/src/components/controls/base/DshDate/DshDate.vue +191 -191
- package/src/components/controls/base/DshDate/DshDaterange.vue +186 -186
- package/src/components/controls/base/DshDivider.vue +201 -201
- package/src/components/controls/base/DshEditor.vue +274 -274
- package/src/components/controls/base/DshInput/BriInputs.vue +166 -166
- package/src/components/controls/base/DshInput/DshInput.vue +260 -260
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +435 -435
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -34
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -14
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -322
- package/src/components/controls/base/DshNumber/DshNumber.vue +143 -143
- package/src/components/controls/base/DshNumber/DshNumberange.vue +109 -109
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +168 -168
- package/src/components/controls/base/DshSelect/DshSelect.vue +180 -180
- package/src/components/controls/base/DshSelect/DshSelectAll.vue +269 -269
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
- package/src/components/controls/control.less +324 -324
- package/src/components/controls/controlMap.js +117 -117
- package/src/components/controls/extra/DshColor.vue +81 -81
- package/src/components/controls/extra/DshThemeColor.vue +100 -100
- package/src/components/controls/extra/DshThemeIcon.vue +122 -122
- package/src/components/controls/mixins/cascaderMixin.js +325 -325
- package/src/components/controls/mixins/cascaderPickerMixin.js +227 -227
- package/src/components/controls/mixins/cascaderTableMixin.js +130 -130
- package/src/components/controls/mixins/controlMixin.js +393 -393
- package/src/components/controls/mixins/dateMixin.js +149 -149
- package/src/components/controls/mixins/flatTableMixin.js +111 -111
- package/src/components/controls/mixins/numberMixin.js +112 -112
- package/src/components/controls/mixins/selectMixin.js +233 -233
- package/src/components/controls/mixins/switchMixin.js +87 -87
- package/src/components/controls/mixins/userAndDepartMixin.js +260 -260
- package/src/components/controls/senior/DshLabels.vue +333 -333
- package/src/components/controls/senior/DshPackage.vue +57 -57
- package/src/components/controls/senior/cascaderTable.vue +213 -213
- package/src/components/controls/senior/correlation.vue +135 -135
- package/src/components/controls/senior/flatTable.vue +138 -138
- package/src/components/controls/senior/selectDepartments.vue +397 -399
- package/src/components/controls/senior/selectUsers/departMenu.vue +296 -293
- package/src/components/controls/senior/selectUsers/selectUsers.vue +712 -712
- package/src/components/controls/special/DshBack.vue +42 -42
- package/src/components/controls/special/DshUndeveloped.vue +41 -41
- package/src/components/form/DshAdvSearch.vue +510 -510
- package/src/components/form/DshDefaultSearch.vue +260 -260
- package/src/components/form/DshForm.vue +494 -494
- package/src/components/form/searchMixin.js +376 -376
- package/src/components/list/BriCard.vue +95 -95
- package/src/components/list/BriTable.vue +205 -205
- package/src/components/list/BriTree.vue +529 -529
- package/src/components/list/BriTreeItem.vue +163 -163
- package/src/components/list/DshBox/DshBox.vue +219 -219
- package/src/components/list/DshBox/DshCard.vue +446 -446
- package/src/components/list/DshBox/DshCrossTable.vue +827 -827
- package/src/components/list/DshBox/DshList.vue +404 -404
- package/src/components/list/DshBox/DshPanel.vue +669 -669
- package/src/components/list/DshBox/DshSingleData.vue +119 -119
- package/src/components/list/DshBox/DshTable.vue +239 -239
- package/src/components/list/DshCascaderTable.vue +115 -115
- package/src/components/list/DshFlatTable.vue +334 -337
- package/src/components/list/DshPage.vue +194 -194
- package/src/components/list/DshTreeTable.vue +113 -113
- package/src/components/list/common/importModal.vue +243 -243
- package/src/components/list/common/quoteListModal.vue +206 -206
- package/src/components/list/mixins/DshCascaderTableMixin.js +278 -278
- package/src/components/list/mixins/DshFlatTableMixin.js +509 -509
- package/src/components/list/mixins/DshTreeTableMixin.js +286 -286
- package/src/components/list/mixins/tableBaseMixin.js +1653 -1653
- package/src/components/list/mixins/treeTableBaseMixin.js +145 -145
- package/src/components/other/BriAvatar.vue +166 -166
- package/src/components/other/BriCode.vue +125 -125
- package/src/components/other/BriCollapseTree.vue +207 -207
- package/src/components/other/BriGantt.vue +1087 -1087
- package/src/components/other/BriIframe.vue +116 -116
- package/src/components/other/BriLoading.vue +171 -171
- package/src/components/other/BriSvg.vue +27 -27
- package/src/components/other/DshColorPanel.vue +128 -128
- package/src/components/other/DshMenuNav.vue +188 -188
- package/src/components/other/DshVideoPlayer.vue +184 -0
- package/src/components/small/BriButton.vue +71 -71
- package/src/components/small/BriDrawer.vue +169 -169
- package/src/components/small/BriTooltip.vue +87 -87
- package/src/components/small/DshBtnModal.vue +68 -68
- package/src/components/small/DshButtons.vue +324 -324
- package/src/components/small/DshDropdown.vue +225 -225
- package/src/components/small/DshIcons.vue +59 -59
- package/src/components/small/DshListRender.js +21 -21
- package/src/components/small/DshModal.vue +160 -160
- package/src/components/small/DshSteps.vue +141 -141
- package/src/components/small/DshTabs.vue +598 -598
- package/src/components/small/DshTabsSet.vue +309 -309
- package/src/components/small/DshTags.vue +251 -251
- package/src/components/small/DshTitle.vue +50 -50
- package/src/components/small/render.js +20 -20
- package/src/components/unit/DshFormUnit.vue +398 -398
- package/src/components/unit/DshListUnit.vue +115 -115
- package/src/components/unit/unitMixin.js +86 -86
- package/src/data/index.js +4 -4
- package/src/index.js +287 -285
- package/src/styles/bundle.css +12 -12
- package/src/styles/components/BriButton.less +307 -307
- package/src/styles/components/BriTable.less +344 -344
- package/src/styles/components/DshModal.less +257 -257
- package/src/styles/components/index.less +3 -3
- package/src/styles/global/animate.less +11 -11
- package/src/styles/global/base.less +45 -45
- package/src/styles/global/box.less +186 -186
- package/src/styles/global/control.less +122 -122
- package/src/styles/global/flex.less +282 -282
- package/src/styles/global/global.less +8 -8
- package/src/styles/global/text.less +59 -59
- package/src/styles/global/variables.less +85 -85
- package/src/styles/iconfont/iconfont.css +254 -254
- package/src/styles/iconfont/iconfont.json +422 -422
- package/src/styles/iconfont/iconfont.svg +137 -137
- package/src/styles/index.less +26 -26
- package/src/styles/reset-easytable.less +21 -21
- package/src/styles/reset-iview-controls.less +145 -145
- package/src/styles/reset-iview-other.less +49 -49
- package/src/styles/reset-iview-variables.less +43 -43
- package/src/styles/reset.less +45 -45
- package/src/utils/index.js +3 -5
- package/lib/0.bri-components.min.js +0 -1
- package/lib/1.bri-components.min.js +0 -1
- package/lib/10.bri-components.min.js +0 -1
- package/lib/11.bri-components.min.js +0 -1
- package/lib/2.bri-components.min.js +0 -1
- package/lib/3.bri-components.min.js +0 -1
- package/lib/4.bri-components.min.js +0 -1
- package/lib/5.bri-components.min.js +0 -1
- package/lib/6.bri-components.min.js +0 -1
- package/lib/7.bri-components.min.js +0 -1
- package/lib/8.bri-components.min.js +0 -1
- package/lib/9.bri-components.min.js +0 -1
- package/lib/bri-components.min.js +0 -18
- package/src/utils/table.js +0 -175
|
@@ -1,1653 +1,1653 @@
|
|
|
1
|
-
import DshListUnit from "../../unit/DshListUnit.vue";
|
|
2
|
-
import importModal from "../common/importModal.vue";
|
|
3
|
-
import quoteListModal from "../common/quoteListModal.vue";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
mixins: [],
|
|
7
|
-
components: {
|
|
8
|
-
DshListUnit,
|
|
9
|
-
importModal,
|
|
10
|
-
quoteListModal
|
|
11
|
-
},
|
|
12
|
-
props: {
|
|
13
|
-
canEdit: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: true
|
|
16
|
-
},
|
|
17
|
-
tableDataObj: {
|
|
18
|
-
type: Object,
|
|
19
|
-
default () {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
data: {
|
|
24
|
-
type: Array,
|
|
25
|
-
default () {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
rowDefault: {
|
|
30
|
-
type: Object,
|
|
31
|
-
default () {
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
columns: {
|
|
36
|
-
type: Array,
|
|
37
|
-
default () {
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
propsObj: {
|
|
42
|
-
type: Object,
|
|
43
|
-
default () {
|
|
44
|
-
return {};
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
parentObj: {
|
|
49
|
-
type: Object,
|
|
50
|
-
default () {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
parentFormList: {
|
|
55
|
-
type: Array,
|
|
56
|
-
default () {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// compareData: {
|
|
62
|
-
// type: Array,
|
|
63
|
-
// default () {
|
|
64
|
-
// return [];
|
|
65
|
-
// }
|
|
66
|
-
// }
|
|
67
|
-
},
|
|
68
|
-
data () {
|
|
69
|
-
return {
|
|
70
|
-
widthMap: this.$getModFieldPropertyMap("width"),
|
|
71
|
-
dftInitValMap: this.$getModFieldPropertyMap("initDefaultVal"),
|
|
72
|
-
// saveProperties: ["__readonly__", "__isDefault__", "__old__", "__isQuote__"],
|
|
73
|
-
// resetProperties: ["__treeIndex__", "__isExpand__", "__isShow__", "__isTmpShow__"],
|
|
74
|
-
resetProperties: ["__treeIndex__", "__isExpand__", "__isShow__", "__isTmpShow__", "__isSearchShow__", "__isRendered__"],
|
|
75
|
-
|
|
76
|
-
initFlag: true,
|
|
77
|
-
isExpandAction: false,
|
|
78
|
-
// showRuleMessage: false, // 进行全体校验
|
|
79
|
-
|
|
80
|
-
idRecordMap: {}, // 默认id转换映射
|
|
81
|
-
// hoverRecordMap: {},
|
|
82
|
-
ruleRecordMap: {}, // 单元格是否发生校验的记录映射
|
|
83
|
-
|
|
84
|
-
showTopSearch: true,
|
|
85
|
-
selfLogicPropsObj: {
|
|
86
|
-
_name: "逻辑",
|
|
87
|
-
_key: "logic",
|
|
88
|
-
_optionKind: "flat",
|
|
89
|
-
_clearable: false,
|
|
90
|
-
_data: [
|
|
91
|
-
{ _key: "and", name: "且" },
|
|
92
|
-
{ _key: "or", name: "或" }
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
|
-
dftAdvSearch: {
|
|
96
|
-
logic: "and",
|
|
97
|
-
conditions: []
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
isLoading: false,
|
|
101
|
-
selectIds: [],
|
|
102
|
-
|
|
103
|
-
dshRenderName: undefined,
|
|
104
|
-
hideStatus: true,
|
|
105
|
-
showQuoteModal: false,
|
|
106
|
-
showImportModal: false,
|
|
107
|
-
exportTimer: null,
|
|
108
|
-
isEnlarge: false,
|
|
109
|
-
isEnlargeFlag: false, // 为重渲染膜态框内容而用
|
|
110
|
-
|
|
111
|
-
baseOperationMap: {
|
|
112
|
-
canCreate: {
|
|
113
|
-
name: "添加一行",
|
|
114
|
-
tip: "添加一行",
|
|
115
|
-
type: "canCreate",
|
|
116
|
-
btnType: "default",
|
|
117
|
-
icon: "md-add",
|
|
118
|
-
size: "default",
|
|
119
|
-
long: true,
|
|
120
|
-
disabled: false,
|
|
121
|
-
event: "clickCreate"
|
|
122
|
-
},
|
|
123
|
-
canInsert: {
|
|
124
|
-
name: "插入一行",
|
|
125
|
-
tip: "插入一行",
|
|
126
|
-
type: "canInsert",
|
|
127
|
-
btnType: "primaryText",
|
|
128
|
-
icon: "md-add",
|
|
129
|
-
size: "small",
|
|
130
|
-
disabled: false,
|
|
131
|
-
event: "clickCreate"
|
|
132
|
-
},
|
|
133
|
-
canDelete: {
|
|
134
|
-
name: "删除",
|
|
135
|
-
tip: "删除该行",
|
|
136
|
-
type: "canDelete",
|
|
137
|
-
btnType: "errorText",
|
|
138
|
-
icon: "md-trash",
|
|
139
|
-
size: "small",
|
|
140
|
-
disabled: false,
|
|
141
|
-
event: "clickDelete"
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
otherOperationMap: {
|
|
145
|
-
canQuickChangeVal: {
|
|
146
|
-
name: "立即改变值事件",
|
|
147
|
-
type: "canQuickChangeVal",
|
|
148
|
-
event: "quickChangeVal"
|
|
149
|
-
},
|
|
150
|
-
canChangeVal: {
|
|
151
|
-
name: "改变值事件",
|
|
152
|
-
type: "canChangeVal",
|
|
153
|
-
event: "changeVal"
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
topOperationMap: {
|
|
157
|
-
canHideOrShow: {
|
|
158
|
-
name: "显示/隐藏字段",
|
|
159
|
-
type: "canHideOrShow",
|
|
160
|
-
// icon: "md-share-alt",
|
|
161
|
-
size: "small",
|
|
162
|
-
btnType: "text",
|
|
163
|
-
event: "toggleHideOrShow"
|
|
164
|
-
},
|
|
165
|
-
canQuote: {
|
|
166
|
-
name: "引用",
|
|
167
|
-
type: "canQuote",
|
|
168
|
-
icon: "ios-copy",
|
|
169
|
-
size: "small",
|
|
170
|
-
btnType: "text",
|
|
171
|
-
event: "clickQuote"
|
|
172
|
-
},
|
|
173
|
-
canImport: {
|
|
174
|
-
name: "导入",
|
|
175
|
-
type: "canImport",
|
|
176
|
-
icon: "ios-create-outline",
|
|
177
|
-
size: "small",
|
|
178
|
-
btnType: "text",
|
|
179
|
-
event: "clickImport"
|
|
180
|
-
},
|
|
181
|
-
canExport: {
|
|
182
|
-
name: "导出",
|
|
183
|
-
type: "canExport",
|
|
184
|
-
icon: "md-share-alt",
|
|
185
|
-
size: "small",
|
|
186
|
-
btnType: "text",
|
|
187
|
-
event: "clickExport"
|
|
188
|
-
},
|
|
189
|
-
canEnlarge: {
|
|
190
|
-
name: "全屏",
|
|
191
|
-
type: "canEnlarge",
|
|
192
|
-
icon: "md-expand",
|
|
193
|
-
size: "small",
|
|
194
|
-
btnType: "text",
|
|
195
|
-
event: "clickEnlarge"
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
},
|
|
200
|
-
computed: {
|
|
201
|
-
dshRender () {
|
|
202
|
-
return this[this.dshRenderName];
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
controlKey () {
|
|
206
|
-
return this.propsObj._key;
|
|
207
|
-
},
|
|
208
|
-
// 是否在字段默认值设置里使用
|
|
209
|
-
isDftSet () {
|
|
210
|
-
return this.controlKey === "_default";
|
|
211
|
-
},
|
|
212
|
-
controlType () {
|
|
213
|
-
return this.propsObj._type;
|
|
214
|
-
},
|
|
215
|
-
controlName () {
|
|
216
|
-
return this.propsObj._name;
|
|
217
|
-
},
|
|
218
|
-
modKey () {
|
|
219
|
-
return this.propsObj.modKey;
|
|
220
|
-
},
|
|
221
|
-
screenKey () {
|
|
222
|
-
return this.propsObj.screenKey;
|
|
223
|
-
},
|
|
224
|
-
allScreenKey () {
|
|
225
|
-
return this.propsObj.allScreenKey;
|
|
226
|
-
},
|
|
227
|
-
flowInstId () {
|
|
228
|
-
return this.propsObj.flowInstId;
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
commonPropsObj () {
|
|
232
|
-
return {
|
|
233
|
-
// isShare: false, // 是否是分享页在用
|
|
234
|
-
_subType: "default", // "default", "cross", "old"
|
|
235
|
-
_showMode: "default", // "default", "form"
|
|
236
|
-
|
|
237
|
-
_showRequired: true, // 表头显示校验符号*
|
|
238
|
-
_showDescription: true, // 表头显示提示
|
|
239
|
-
_contentHeight: 500, // 表格最大高度
|
|
240
|
-
_headHeightAuto: false, // 表头高度自适应
|
|
241
|
-
_heightAuto: false, // 单元格高度自适应
|
|
242
|
-
_useIndex: true, // 使用序号列
|
|
243
|
-
_useSummary: false, // 使用汇总行
|
|
244
|
-
_noborderColKeys: [], // 无边线的列
|
|
245
|
-
_bgColKeys: [], // 带背景色的列
|
|
246
|
-
|
|
247
|
-
_disabledBtns: false, // 禁用增删按钮
|
|
248
|
-
_showCreateBtnColKeys: [], // 显示增删图标的列
|
|
249
|
-
_useInsertInOperationCol: false, // 操作列出现插入行按钮
|
|
250
|
-
_disabledFootCreateBtn: false, // 禁用底部新增按钮
|
|
251
|
-
_disabledDeleteDftRow: false, // 默认的数据行禁止删除
|
|
252
|
-
_disabledDeleteOldRow: false, // 保存的数据行禁止删除
|
|
253
|
-
_dftReadonly: false, // 默认的数据只读
|
|
254
|
-
_dftReadonlyColKeys: [], // 默认的数据只读的列
|
|
255
|
-
_oldReadonly: false, // 保存的数据只读
|
|
256
|
-
_oldReadonlyColKeys: [], // 保存的数据只读的列
|
|
257
|
-
|
|
258
|
-
_searchList: [], // 作为搜索的字段
|
|
259
|
-
_searchLabelWidth: 100, // 搜索的label宽度
|
|
260
|
-
_tableAdvSearch: {
|
|
261
|
-
logic: "and",
|
|
262
|
-
conditions: []
|
|
263
|
-
}, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
|
|
264
|
-
|
|
265
|
-
_showOrHideColKeys: [], // 联动隐藏字段的keys
|
|
266
|
-
_showByNumFieldKey: "", // 控制联动隐藏字段的外层字段
|
|
267
|
-
_hideColKeys: [], // 隐藏/查看列字段的keys
|
|
268
|
-
_isQuote: false, // 引用
|
|
269
|
-
_quoteDisabledColKeys: [], // 引用数据行不可编辑列
|
|
270
|
-
_quoteListFields: [], // 引用列表的显示字段
|
|
271
|
-
_quoteAdvSearch: {
|
|
272
|
-
logic: "and",
|
|
273
|
-
conditions: []
|
|
274
|
-
}, // 引用列表筛选条件
|
|
275
|
-
_isImport: false, // 导入
|
|
276
|
-
_importAsDft: false, // 导入的数据作为默认数据
|
|
277
|
-
_isExport: false, // 导出
|
|
278
|
-
_useEnlarge: true, // 全屏
|
|
279
|
-
|
|
280
|
-
_default: {
|
|
281
|
-
rowDefault: {},
|
|
282
|
-
list: [],
|
|
283
|
-
tree: []
|
|
284
|
-
},
|
|
285
|
-
...(this.selfBasePropsObj || {}),
|
|
286
|
-
|
|
287
|
-
...this.propsObj
|
|
288
|
-
};
|
|
289
|
-
},
|
|
290
|
-
selfPropsObj () {
|
|
291
|
-
return {
|
|
292
|
-
...this.commonPropsObj
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
// isShare () {
|
|
296
|
-
// return this.selfPropsObj.isShare;
|
|
297
|
-
// },
|
|
298
|
-
subType () {
|
|
299
|
-
return this.selfPropsObj._subType;
|
|
300
|
-
},
|
|
301
|
-
showMode () {
|
|
302
|
-
return this.selfPropsObj._showMode;
|
|
303
|
-
},
|
|
304
|
-
inTableType () {
|
|
305
|
-
return ["cascaderTable"].includes(this.controlType) && !["old"].includes(this.subType)
|
|
306
|
-
? "treeTable"
|
|
307
|
-
: this.controlType;
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
contentHeight () {
|
|
311
|
-
return this.selfPropsObj._contentHeight === undefined
|
|
312
|
-
? undefined
|
|
313
|
-
: this.selfPropsObj._contentHeight || 500;
|
|
314
|
-
},
|
|
315
|
-
showRequired () {
|
|
316
|
-
return this.selfPropsObj._showRequired;
|
|
317
|
-
},
|
|
318
|
-
showDescription () {
|
|
319
|
-
return this.selfPropsObj._showDescription;
|
|
320
|
-
},
|
|
321
|
-
headHeightAuto () {
|
|
322
|
-
return this.selfPropsObj._headHeightAuto;
|
|
323
|
-
},
|
|
324
|
-
heightAuto () {
|
|
325
|
-
return this.selfPropsObj._heightAuto;
|
|
326
|
-
},
|
|
327
|
-
useIndex () {
|
|
328
|
-
return this.selfPropsObj._useIndex;
|
|
329
|
-
},
|
|
330
|
-
useSummary () {
|
|
331
|
-
return this.selfPropsObj._useSummary;
|
|
332
|
-
},
|
|
333
|
-
noborderColKeys () {
|
|
334
|
-
return this.selfPropsObj._noborderColKeys;
|
|
335
|
-
},
|
|
336
|
-
bgColKeys () {
|
|
337
|
-
return this.selfPropsObj._bgColKeys;
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
disabledBtns () {
|
|
341
|
-
return this.isDftSet ? false : this.selfPropsObj._disabledBtns;
|
|
342
|
-
},
|
|
343
|
-
showCreateBtnColKeys () {
|
|
344
|
-
return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
345
|
-
},
|
|
346
|
-
useInsertInOperationCol () {
|
|
347
|
-
return this.selfPropsObj._useInsertInOperationCol;
|
|
348
|
-
},
|
|
349
|
-
disabledFootCreateBtn () {
|
|
350
|
-
return this.isDftSet ? false : this.selfPropsObj._disabledFootCreateBtn;
|
|
351
|
-
},
|
|
352
|
-
disabledDeleteDftRow () {
|
|
353
|
-
return this.isDftSet ? false : this.selfPropsObj._disabledDeleteDftRow;
|
|
354
|
-
},
|
|
355
|
-
disabledDeleteOldRow () {
|
|
356
|
-
return this.isDftSet ? false : this.selfPropsObj._disabledDeleteOldRow;
|
|
357
|
-
},
|
|
358
|
-
dftReadonly () {
|
|
359
|
-
return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
|
|
360
|
-
},
|
|
361
|
-
dftReadonlyColKeys () {
|
|
362
|
-
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
363
|
-
},
|
|
364
|
-
oldReadonly () {
|
|
365
|
-
return this.isDftSet ? false : this.selfPropsObj._oldReadonly;
|
|
366
|
-
},
|
|
367
|
-
oldReadonlyColKeys () {
|
|
368
|
-
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
/* --- 筛选 --- */
|
|
372
|
-
searchLabelWidth () {
|
|
373
|
-
return this.selfPropsObj._searchLabelWidth;
|
|
374
|
-
},
|
|
375
|
-
searchList () {
|
|
376
|
-
return this.selfPropsObj._searchList;
|
|
377
|
-
},
|
|
378
|
-
searchListMap () {
|
|
379
|
-
return this.$arrToMap(this.searchList, "_key");
|
|
380
|
-
},
|
|
381
|
-
searchListFields () {
|
|
382
|
-
return this.searchList.map(searchItem => searchItem._key);
|
|
383
|
-
},
|
|
384
|
-
searchFormList () {
|
|
385
|
-
return this.$filterList(this.searchListFields, this.selfColumns).map(formItem => ({
|
|
386
|
-
...formItem,
|
|
387
|
-
...this.searchListMap[formItem._key],
|
|
388
|
-
_name: formItem._name
|
|
389
|
-
}));
|
|
390
|
-
},
|
|
391
|
-
tableAdvSearch () {
|
|
392
|
-
return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.parentFormList, this.parentObj);
|
|
393
|
-
},
|
|
394
|
-
// 默认筛选配置里-隐藏的筛选条件
|
|
395
|
-
hideAdvSearch () {
|
|
396
|
-
return {
|
|
397
|
-
logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
|
|
398
|
-
conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
|
|
399
|
-
!this.searchListFields.includes(conditionItem.fieldKey)
|
|
400
|
-
)
|
|
401
|
-
};
|
|
402
|
-
},
|
|
403
|
-
// 过滤行数据的 最终的筛选条件
|
|
404
|
-
finalTableAdvSearch () {
|
|
405
|
-
return {
|
|
406
|
-
logic: "and",
|
|
407
|
-
conditions: [
|
|
408
|
-
this.hideAdvSearch,
|
|
409
|
-
this.dftAdvSearch
|
|
410
|
-
]
|
|
411
|
-
};
|
|
412
|
-
},
|
|
413
|
-
|
|
414
|
-
// 是否筛选状态
|
|
415
|
-
isSearching () {
|
|
416
|
-
return this.parentObj.__isCreate__ === true
|
|
417
|
-
? false
|
|
418
|
-
: this.$isAdvSearching(this.finalTableAdvSearch);
|
|
419
|
-
},
|
|
420
|
-
searchTitle () {
|
|
421
|
-
return `${this.isSearching ? "筛选" : "全部"}数据;`;
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
/* --- 列字段 --- */
|
|
425
|
-
// columns => selfColumns => usedColumns => contentColumns => showContentColumns => showColumns
|
|
426
|
-
selfColumns () {
|
|
427
|
-
// console.log("selfColumns");
|
|
428
|
-
return this.columns;
|
|
429
|
-
},
|
|
430
|
-
usedColumns () {
|
|
431
|
-
// console.log("usedColumns");
|
|
432
|
-
const list = this.selfColumns.filter(colItem =>
|
|
433
|
-
this.showOrHideColKeys.includes(colItem._key)
|
|
434
|
-
? this.showColKeys.includes(colItem._key)
|
|
435
|
-
: true
|
|
436
|
-
);
|
|
437
|
-
|
|
438
|
-
return list.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
|
|
439
|
-
},
|
|
440
|
-
contentColumns () {
|
|
441
|
-
return this.usedColumns.map(colItem => ({
|
|
442
|
-
renderHeaderCell: ({ column }, h) => {
|
|
443
|
-
return this.contentThCellRender(h, { column });
|
|
444
|
-
},
|
|
445
|
-
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
446
|
-
return this.contentTdCellRender(h, { row, rowIndex, column });
|
|
447
|
-
},
|
|
448
|
-
...colItem
|
|
449
|
-
}));
|
|
450
|
-
},
|
|
451
|
-
showContentColumns () {
|
|
452
|
-
return this.contentColumns.filter(colItem =>
|
|
453
|
-
this.hideStatus === true
|
|
454
|
-
? !this.hideColKeys.includes(colItem._key)
|
|
455
|
-
: true
|
|
456
|
-
);
|
|
457
|
-
},
|
|
458
|
-
selectionColumn () {
|
|
459
|
-
return {
|
|
460
|
-
_key: "__selection__",
|
|
461
|
-
key: "__selection__",
|
|
462
|
-
field: "__selection__",
|
|
463
|
-
type: "checkbox",
|
|
464
|
-
width: 50,
|
|
465
|
-
align: "center",
|
|
466
|
-
fixed: "left"
|
|
467
|
-
};
|
|
468
|
-
},
|
|
469
|
-
operationColumn () {
|
|
470
|
-
return {
|
|
471
|
-
title: "操作",
|
|
472
|
-
_key: "__operation__",
|
|
473
|
-
key: "__operation__",
|
|
474
|
-
field: "__operation__",
|
|
475
|
-
_align: "center",
|
|
476
|
-
align: "center",
|
|
477
|
-
_fixed: "right",
|
|
478
|
-
fixed: "right",
|
|
479
|
-
_width: 100 + (this.rowOperationList.length - 1) * 110,
|
|
480
|
-
width: 100 + (this.rowOperationList.length - 1) * 110,
|
|
481
|
-
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
482
|
-
return this.operationTdCellRender(h, { row, rowIndex, column });
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
},
|
|
486
|
-
|
|
487
|
-
/* --- 表格参数 --- */
|
|
488
|
-
tablePropsObj () {
|
|
489
|
-
return {
|
|
490
|
-
// rowStyleOption: {
|
|
491
|
-
// hoverHighlight: true,
|
|
492
|
-
// clickHighlight: true,
|
|
493
|
-
// stripe: true // 斑马纹
|
|
494
|
-
// },
|
|
495
|
-
maxHeight: this.contentHeight,
|
|
496
|
-
// 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
|
|
497
|
-
columnHiddenOption: {
|
|
498
|
-
// defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
|
|
499
|
-
},
|
|
500
|
-
cellStyleOption: {
|
|
501
|
-
bodyCellClass: this.bodyCellClass
|
|
502
|
-
},
|
|
503
|
-
cellSpanOption: {
|
|
504
|
-
bodyCellSpan: this.bodyCellSpan
|
|
505
|
-
},
|
|
506
|
-
eventCustomOption: {
|
|
507
|
-
bodyCellEvents: this.eventCustomOption
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
},
|
|
511
|
-
tableInModalPropsObj () {
|
|
512
|
-
return {
|
|
513
|
-
...this.tablePropsObj,
|
|
514
|
-
maxHeight: undefined
|
|
515
|
-
};
|
|
516
|
-
},
|
|
517
|
-
checkboxOption () {
|
|
518
|
-
return {
|
|
519
|
-
selectedRowKeys: this.selectIds
|
|
520
|
-
};
|
|
521
|
-
},
|
|
522
|
-
|
|
523
|
-
/* --- 联动隐藏 --- */
|
|
524
|
-
showColKeys () {
|
|
525
|
-
return this.showByNumFieldVal != null && this.showByNumFieldVal >= 0
|
|
526
|
-
? this.showOrHideColKeys.slice(0, this.showByNumFieldVal)
|
|
527
|
-
: this.showOrHideColKeys;
|
|
528
|
-
},
|
|
529
|
-
showOrHideColKeys () {
|
|
530
|
-
return this.selfPropsObj._showOrHideColKeys || [];
|
|
531
|
-
},
|
|
532
|
-
// 控制联动隐藏的数字类型字段
|
|
533
|
-
showByNumFieldKey () {
|
|
534
|
-
return this.selfPropsObj._showByNumFieldKey;
|
|
535
|
-
},
|
|
536
|
-
// 控制联动隐藏的数字类型字段的值
|
|
537
|
-
showByNumFieldVal () {
|
|
538
|
-
return this.showByNumFieldKey
|
|
539
|
-
? this.parentObj[this.showByNumFieldKey]
|
|
540
|
-
: undefined;
|
|
541
|
-
},
|
|
542
|
-
|
|
543
|
-
/* --- 显示/隐藏 --- */
|
|
544
|
-
hideColKeys () {
|
|
545
|
-
return this.selfPropsObj._hideColKeys;
|
|
546
|
-
},
|
|
547
|
-
|
|
548
|
-
/* --- 引用 --- */
|
|
549
|
-
isQuote () {
|
|
550
|
-
return this.selfPropsObj._isQuote;
|
|
551
|
-
},
|
|
552
|
-
quoteReadonlyColKeys () {
|
|
553
|
-
return this.selfPropsObj._quoteDisabledColKeys;
|
|
554
|
-
},
|
|
555
|
-
quoteListFields () {
|
|
556
|
-
return this.selfPropsObj._quoteListFields;
|
|
557
|
-
},
|
|
558
|
-
quoteAdvSearch () {
|
|
559
|
-
return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
|
|
560
|
-
},
|
|
561
|
-
quoteParams () {
|
|
562
|
-
return {
|
|
563
|
-
screenKey: this.allScreenKey,
|
|
564
|
-
fields: [
|
|
565
|
-
...this.quoteListFields,
|
|
566
|
-
this.controlKey,
|
|
567
|
-
"createdAt"
|
|
568
|
-
],
|
|
569
|
-
advSearch: {
|
|
570
|
-
logic: "and",
|
|
571
|
-
conditions: [
|
|
572
|
-
{
|
|
573
|
-
fieldKey: "_id",
|
|
574
|
-
fieldOperator: "ne",
|
|
575
|
-
fieldValue: [this.parentDataId]
|
|
576
|
-
},
|
|
577
|
-
this.quoteAdvSearch
|
|
578
|
-
]
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
},
|
|
582
|
-
|
|
583
|
-
/* --- 导入 --- */
|
|
584
|
-
isImport () {
|
|
585
|
-
return this.selfPropsObj._isImport;
|
|
586
|
-
},
|
|
587
|
-
importAsDft () {
|
|
588
|
-
return this.selfPropsObj._importAsDft;
|
|
589
|
-
},
|
|
590
|
-
importParams () {
|
|
591
|
-
return {
|
|
592
|
-
_id: this.parentDataId,
|
|
593
|
-
_key: this.controlKey,
|
|
594
|
-
importType: this.inTableType
|
|
595
|
-
};
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
/* --- 导出 --- */
|
|
599
|
-
isExport () {
|
|
600
|
-
return this.selfPropsObj._isExport;
|
|
601
|
-
},
|
|
602
|
-
exportParams () {
|
|
603
|
-
return {
|
|
604
|
-
screenKey: this.screenKey,
|
|
605
|
-
_id: this.parentDataId,
|
|
606
|
-
_key: this.controlKey,
|
|
607
|
-
flowinst: this.flowInstId,
|
|
608
|
-
advSearch: this.finalTableAdvSearch
|
|
609
|
-
};
|
|
610
|
-
},
|
|
611
|
-
|
|
612
|
-
/* --- 全屏 --- */
|
|
613
|
-
useEnlarge () {
|
|
614
|
-
return this.selfPropsObj._useEnlarge;
|
|
615
|
-
},
|
|
616
|
-
modalPropsObj () {
|
|
617
|
-
return {
|
|
618
|
-
mode: "fullscreen",
|
|
619
|
-
title: this.controlName
|
|
620
|
-
};
|
|
621
|
-
},
|
|
622
|
-
|
|
623
|
-
/* --- 数据 --- */
|
|
624
|
-
// 默认值数据
|
|
625
|
-
defaultListData () {
|
|
626
|
-
const loop = (tree = [], list = []) => {
|
|
627
|
-
return tree.reduce((newList, rowItem) => {
|
|
628
|
-
newList = [...newList, rowItem];
|
|
629
|
-
|
|
630
|
-
return rowItem.children && rowItem.children.length
|
|
631
|
-
? loop(rowItem.children, newList)
|
|
632
|
-
: newList;
|
|
633
|
-
}, list);
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
return ["cascaderTable"].includes(this.controlType)
|
|
637
|
-
? loop(this.selfPropsObj._default.tree)
|
|
638
|
-
: this.selfPropsObj._default.list;
|
|
639
|
-
},
|
|
640
|
-
defaultListDataIds () {
|
|
641
|
-
return this.defaultListData
|
|
642
|
-
.map(rowItem => rowItem._id)
|
|
643
|
-
.filter(id => !!id);
|
|
644
|
-
},
|
|
645
|
-
// 全部数据(或筛选出的数据)-总数
|
|
646
|
-
totalNum () {
|
|
647
|
-
return this.showListData.length;
|
|
648
|
-
},
|
|
649
|
-
|
|
650
|
-
// 新增行的默认值
|
|
651
|
-
selfRowDft () {
|
|
652
|
-
return this.selfColumns.reduce((obj, column) => {
|
|
653
|
-
const dftInRowVal = this.rowDefault[column._key];
|
|
654
|
-
const dftVal = column._default;
|
|
655
|
-
const dftInitVal = this.dftInitValMap[column._type];
|
|
656
|
-
|
|
657
|
-
return Object.assign(obj, {
|
|
658
|
-
[column._key]: dftInRowVal === undefined // 不用isEmptyData判断原因:为空值时可能是故意置空的
|
|
659
|
-
? this.$isEmptyData(dftVal)
|
|
660
|
-
? dftInitVal
|
|
661
|
-
: dftVal
|
|
662
|
-
: dftInRowVal
|
|
663
|
-
});
|
|
664
|
-
}, {});
|
|
665
|
-
},
|
|
666
|
-
parentDataId () {
|
|
667
|
-
return this.parentObj._id;
|
|
668
|
-
},
|
|
669
|
-
// compareListData () {
|
|
670
|
-
// this.compareData.forEach(item => {
|
|
671
|
-
// !item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
672
|
-
// });
|
|
673
|
-
// return this.compareData;
|
|
674
|
-
// },
|
|
675
|
-
// useCampare () {
|
|
676
|
-
// return !!this.compareListData.length;
|
|
677
|
-
// },
|
|
678
|
-
changedCols () {
|
|
679
|
-
return [];
|
|
680
|
-
},
|
|
681
|
-
|
|
682
|
-
/* --- 功能按钮 --- */
|
|
683
|
-
baseOperationBtns () {
|
|
684
|
-
return Object.keys(this.baseOperationMap);
|
|
685
|
-
},
|
|
686
|
-
otherOperationBtns () {
|
|
687
|
-
return Object.keys(this.otherOperationMap);
|
|
688
|
-
},
|
|
689
|
-
topOperationBtns () {
|
|
690
|
-
return Object.keys(this.topOperationMap);
|
|
691
|
-
},
|
|
692
|
-
allOperationMap () {
|
|
693
|
-
return {
|
|
694
|
-
...(this.baseOperationMap || {}),
|
|
695
|
-
...(this.otherOperationMap || {}),
|
|
696
|
-
...(this.topOperationMap || {}),
|
|
697
|
-
|
|
698
|
-
canCreate: {
|
|
699
|
-
...this.baseOperationMap.canCreate,
|
|
700
|
-
name: this.showMode === "form"
|
|
701
|
-
? this.baseOperationMap.canCreate.name.replace("行", "条")
|
|
702
|
-
: this.baseOperationMap.canCreate.name,
|
|
703
|
-
tip: this.showMode === "form"
|
|
704
|
-
? this.baseOperationMap.canCreate.tip.replace("行", "条")
|
|
705
|
-
: this.baseOperationMap.canCreate.tip
|
|
706
|
-
},
|
|
707
|
-
canInsert: {
|
|
708
|
-
...this.baseOperationMap.canInsert,
|
|
709
|
-
name: this.showMode === "form"
|
|
710
|
-
? this.baseOperationMap.canInsert.name.replace("行", "条")
|
|
711
|
-
: this.baseOperationMap.canInsert.name,
|
|
712
|
-
tip: this.showMode === "form"
|
|
713
|
-
? this.baseOperationMap.canInsert.tip.replace("行", "条")
|
|
714
|
-
: this.baseOperationMap.canInsert.tip
|
|
715
|
-
},
|
|
716
|
-
canHideOrShow: {
|
|
717
|
-
...this.topOperationMap.canHideOrShow,
|
|
718
|
-
name: this.hideStatus ? "显示字段" : "隐藏字段"
|
|
719
|
-
},
|
|
720
|
-
|
|
721
|
-
...(this.selfAllOperationMap || {})
|
|
722
|
-
};
|
|
723
|
-
},
|
|
724
|
-
operationMap () {
|
|
725
|
-
return this.$categoryMapToMap(
|
|
726
|
-
this.allOperationMap,
|
|
727
|
-
undefined,
|
|
728
|
-
undefined,
|
|
729
|
-
[
|
|
730
|
-
...(
|
|
731
|
-
this.canEdit
|
|
732
|
-
? [
|
|
733
|
-
...(this.disabledBtns ? [] : this.baseOperationBtns),
|
|
734
|
-
...this.otherOperationBtns,
|
|
735
|
-
...(this.isQuote ? ["canQuote"] : []),
|
|
736
|
-
...(this.isImport ? ["canImport"] : [])
|
|
737
|
-
]
|
|
738
|
-
: []
|
|
739
|
-
),
|
|
740
|
-
...(this.isExport ? ["canExport"] : []),
|
|
741
|
-
...(this.useEnlarge ? ["canEnlarge"] : []),
|
|
742
|
-
...(this.hideColKeys.length ? ["canHideOrShow"] : [])
|
|
743
|
-
]
|
|
744
|
-
);
|
|
745
|
-
},
|
|
746
|
-
rowOperationList () {
|
|
747
|
-
const btns = [
|
|
748
|
-
...(this.useInsertInOperationCol ? ["canInsert"] : []),
|
|
749
|
-
"canDelete"
|
|
750
|
-
];
|
|
751
|
-
return this.$getOperationList(btns);
|
|
752
|
-
}
|
|
753
|
-
},
|
|
754
|
-
watch: {
|
|
755
|
-
isEnlarge (bool) {
|
|
756
|
-
setTimeout(() => {
|
|
757
|
-
this.isEnlargeFlag = bool;
|
|
758
|
-
// this.dealingOpenModal && this.dealingOpenModal();
|
|
759
|
-
}, 0);
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
created () {
|
|
763
|
-
this.baseInit();
|
|
764
|
-
},
|
|
765
|
-
methods: {
|
|
766
|
-
baseInit () {
|
|
767
|
-
this.dftAdvSearch = {
|
|
768
|
-
logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
|
|
769
|
-
conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
|
|
770
|
-
this.searchListFields.includes(conditionItem.fieldKey)
|
|
771
|
-
)
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
this.loadingFunc();
|
|
775
|
-
},
|
|
776
|
-
|
|
777
|
-
// 共外部使用
|
|
778
|
-
validate () {
|
|
779
|
-
// this.showRuleMessage = true;
|
|
780
|
-
// return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
|
|
781
|
-
|
|
782
|
-
let bool = true;
|
|
783
|
-
this.allListData.forEach((row, rowIndex) => {
|
|
784
|
-
const resultBool = this.getRowRuleResult(row, rowIndex);
|
|
785
|
-
|
|
786
|
-
if (resultBool === false) {
|
|
787
|
-
bool = false;
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
return bool;
|
|
792
|
-
},
|
|
793
|
-
// 重置
|
|
794
|
-
reset () {
|
|
795
|
-
this.initFlag = true;
|
|
796
|
-
this.isExpandAction = false;
|
|
797
|
-
// this.showRuleMessage = false;
|
|
798
|
-
|
|
799
|
-
this.idRecordMap = {};
|
|
800
|
-
// this.hoverRecordMap = {};
|
|
801
|
-
this.ruleRecordMap = {};
|
|
802
|
-
|
|
803
|
-
this.dftAdvSearch = {
|
|
804
|
-
logic: "and",
|
|
805
|
-
conditions: []
|
|
806
|
-
};
|
|
807
|
-
this.hideStatus = true;
|
|
808
|
-
|
|
809
|
-
this.changePage && this.changePage(1);
|
|
810
|
-
this.selfReset && this.selfReset();
|
|
811
|
-
},
|
|
812
|
-
loadingFunc () {
|
|
813
|
-
this.isLoading = true;
|
|
814
|
-
this.changeSelect();
|
|
815
|
-
|
|
816
|
-
setTimeout(() => {
|
|
817
|
-
this.isLoading = false;
|
|
818
|
-
});
|
|
819
|
-
},
|
|
820
|
-
|
|
821
|
-
// 筛选回调
|
|
822
|
-
searchCb (conditions) {
|
|
823
|
-
if (this.parentObj.__isCreate__ !== true) {
|
|
824
|
-
this.isExpandAction = false;
|
|
825
|
-
this.dftAdvSearch.conditions = conditions;
|
|
826
|
-
|
|
827
|
-
this.changePage && this.changePage(1);
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
// 列表选择项改变 (!!!外部在使用)
|
|
831
|
-
changeSelect (selections = [], ...params) {
|
|
832
|
-
this.selectIds = selections.map(item => item._id);
|
|
833
|
-
this.$emit("changeSelect", this.selectIds, selections, ...params);
|
|
834
|
-
},
|
|
835
|
-
|
|
836
|
-
// 输入框失去焦点
|
|
837
|
-
controlBlur (operationItem, row, rowIndex, column, params) {
|
|
838
|
-
this.dealRuleRecord(row, column);
|
|
839
|
-
},
|
|
840
|
-
// 输入框值改变立即
|
|
841
|
-
quickChangeVal (operationItem, row, rowIndex, column, params) {
|
|
842
|
-
if (["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
|
|
843
|
-
this.dealRuleRecord(row, column);
|
|
844
|
-
this.change("quickChangeVal", row, rowIndex, column, ...params);
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
// 输入框值改变
|
|
848
|
-
changeVal (operationItem, row, rowIndex, column, params) {
|
|
849
|
-
if (!["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
|
|
850
|
-
this.dealRuleRecord(row, column);
|
|
851
|
-
this.change("changeVal", row, rowIndex, column, ...params);
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
change (eventType, row, rowIndex, column, ...params) {
|
|
855
|
-
this.$emit("change", this.tableDataObj, eventType, column, row, rowIndex, ...params);
|
|
856
|
-
},
|
|
857
|
-
|
|
858
|
-
/* ----------- 隐藏/显示字段 ---------- */
|
|
859
|
-
toggleHideOrShow () {
|
|
860
|
-
// if (this.$refs.briTable) {
|
|
861
|
-
// if (this.hideStatus === true) {
|
|
862
|
-
// this.$refs.briTable.showColumnsByKeys(this.hideColKeys);
|
|
863
|
-
// } else {
|
|
864
|
-
// this.$refs.briTable.hideColumnsByKeys(this.hideColKeys);
|
|
865
|
-
// }
|
|
866
|
-
// }
|
|
867
|
-
|
|
868
|
-
this.hideStatus = !this.hideStatus;
|
|
869
|
-
},
|
|
870
|
-
|
|
871
|
-
/* ----------- 引用 ---------- */
|
|
872
|
-
// 点击引用
|
|
873
|
-
clickQuote () {
|
|
874
|
-
this.dshRenderName = "quoteModalRender";
|
|
875
|
-
this.showQuoteModal = true;
|
|
876
|
-
},
|
|
877
|
-
// 引用模态框渲染函数
|
|
878
|
-
quoteModalRender (h, params) {
|
|
879
|
-
return this.showQuoteModal
|
|
880
|
-
? h("quote-list-modal", {
|
|
881
|
-
props: {
|
|
882
|
-
value: this.showQuoteModal,
|
|
883
|
-
propsObj: this.propsObj,
|
|
884
|
-
listParams: this.quoteParams
|
|
885
|
-
},
|
|
886
|
-
on: {
|
|
887
|
-
input: bool => {
|
|
888
|
-
this.showQuoteModal = bool;
|
|
889
|
-
},
|
|
890
|
-
confirm: this.quoteCb
|
|
891
|
-
}
|
|
892
|
-
})
|
|
893
|
-
: undefined;
|
|
894
|
-
},
|
|
895
|
-
// 引用回调
|
|
896
|
-
quoteCb (dataObj) {
|
|
897
|
-
if (dataObj) {
|
|
898
|
-
const fieldVal = dataObj[this.controlKey];
|
|
899
|
-
const isEmpty = this.$isEmptyData(fieldVal) || (
|
|
900
|
-
["cascaderTable"].includes(this.controlType)
|
|
901
|
-
? !fieldVal.tree || !fieldVal.tree.length
|
|
902
|
-
: ["flatTable"].includes(this.controlType)
|
|
903
|
-
? !fieldVal.list || !fieldVal.list.length
|
|
904
|
-
: false
|
|
905
|
-
);
|
|
906
|
-
|
|
907
|
-
if (isEmpty) {
|
|
908
|
-
this.$Modal.confirm({
|
|
909
|
-
title: "提示",
|
|
910
|
-
content: "该数据下此内容为空,无法引用!",
|
|
911
|
-
onOk: () => { }
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
else {
|
|
915
|
-
if (["cascaderTable"].includes(this.controlType)) {
|
|
916
|
-
const transformData = (list = []) => {
|
|
917
|
-
const loop = (list = []) =>
|
|
918
|
-
list.map(item => ({
|
|
919
|
-
...item,
|
|
920
|
-
children: item.children ? loop(item.children) : item.children,
|
|
921
|
-
__isQuote__: true,
|
|
922
|
-
__old__: false
|
|
923
|
-
}));
|
|
924
|
-
|
|
925
|
-
return loop(list);
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
this.parentObj[this.controlKey] = {
|
|
929
|
-
...fieldVal,
|
|
930
|
-
tree: transformData(fieldVal.tree)
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
else if (["flatTable"].includes(this.controlType)) {
|
|
934
|
-
this.parentObj[this.controlKey] = {
|
|
935
|
-
...fieldVal,
|
|
936
|
-
list: fieldVal.list.map(item => ({
|
|
937
|
-
...item,
|
|
938
|
-
__isQuote__: true,
|
|
939
|
-
__old__: false
|
|
940
|
-
}))
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
this.$Message.success("引用成功!");
|
|
945
|
-
this.reset();
|
|
946
|
-
this.showTopSearch = false;
|
|
947
|
-
this.$nextTick(() => {
|
|
948
|
-
this.showTopSearch = true;
|
|
949
|
-
});
|
|
950
|
-
|
|
951
|
-
this.change("quote");
|
|
952
|
-
}
|
|
953
|
-
} else {
|
|
954
|
-
this.$Message.error("未选择引用数据!");
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
|
|
958
|
-
/* ----------- 导入 ---------- */
|
|
959
|
-
// 点击导入
|
|
960
|
-
clickImport () {
|
|
961
|
-
this.dshRenderName = "importModalRender";
|
|
962
|
-
this.showImportModal = true;
|
|
963
|
-
},
|
|
964
|
-
// 导入模态框渲染函数
|
|
965
|
-
importModalRender (h, params) {
|
|
966
|
-
return this.showImportModal
|
|
967
|
-
? h("import-modal", {
|
|
968
|
-
props: {
|
|
969
|
-
value: this.showImportModal,
|
|
970
|
-
propsObj: this.propsObj,
|
|
971
|
-
importParams: this.importParams
|
|
972
|
-
},
|
|
973
|
-
on: {
|
|
974
|
-
input: bool => {
|
|
975
|
-
this.showImportModal = bool;
|
|
976
|
-
},
|
|
977
|
-
importCb: this.importCb
|
|
978
|
-
}
|
|
979
|
-
})
|
|
980
|
-
: undefined;
|
|
981
|
-
},
|
|
982
|
-
// 导入回调
|
|
983
|
-
importCb (dataObj) {
|
|
984
|
-
const fieldVal = dataObj;
|
|
985
|
-
if (this.importAsDft) {
|
|
986
|
-
if (["cascaderTable"].includes(this.controlType)) {
|
|
987
|
-
const transformData = (list = []) => {
|
|
988
|
-
const loop = (list = []) =>
|
|
989
|
-
list.map(item => ({
|
|
990
|
-
...item,
|
|
991
|
-
children: item.children ? loop(item.children) : item.children,
|
|
992
|
-
__isDefault__: true,
|
|
993
|
-
__old__: false
|
|
994
|
-
}));
|
|
995
|
-
|
|
996
|
-
return loop(list);
|
|
997
|
-
};
|
|
998
|
-
|
|
999
|
-
this.parentObj[this.controlKey] = {
|
|
1000
|
-
...fieldVal,
|
|
1001
|
-
tree: transformData(fieldVal.tree)
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
else if (["flatTable"].includes(this.controlType)) {
|
|
1005
|
-
this.parentObj[this.controlKey] = {
|
|
1006
|
-
...fieldVal,
|
|
1007
|
-
list: fieldVal.list.map(item => ({
|
|
1008
|
-
...item,
|
|
1009
|
-
__isDefault__: true,
|
|
1010
|
-
__old__: false
|
|
1011
|
-
}))
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
} else {
|
|
1015
|
-
this.parentObj[this.controlKey] = dataObj;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
// 因为data和rowspanMap不马上更新
|
|
1019
|
-
this.$nextTick(() => {
|
|
1020
|
-
this.reset();
|
|
1021
|
-
this.change("import");
|
|
1022
|
-
});
|
|
1023
|
-
},
|
|
1024
|
-
|
|
1025
|
-
/* ----------- 导出 ---------- */
|
|
1026
|
-
// 点击导出
|
|
1027
|
-
clickExport (operationItem) {
|
|
1028
|
-
this.handleExport(operationItem);
|
|
1029
|
-
},
|
|
1030
|
-
// 接口 -导出
|
|
1031
|
-
handleExport (operationItem) {
|
|
1032
|
-
operationItem.disabled = true;
|
|
1033
|
-
|
|
1034
|
-
this.$https({
|
|
1035
|
-
url: {
|
|
1036
|
-
module: "sheet",
|
|
1037
|
-
name: ["cascaderTable"].includes(this.controlType) ? "exportCascaderTableExcel" : "exportFlatTableExcel"
|
|
1038
|
-
},
|
|
1039
|
-
params: this.exportParams,
|
|
1040
|
-
callback: data => {
|
|
1041
|
-
this.getJobStatus(operationItem, data.jobId, data.excel_url);
|
|
1042
|
-
this.exportTimer = setInterval(() => {
|
|
1043
|
-
this.getJobStatus(operationItem, data.jobId, data.excel_url);
|
|
1044
|
-
}, 1000);
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
},
|
|
1048
|
-
// 接口 -获取导出地址
|
|
1049
|
-
getJobStatus (operationItem, id, url) {
|
|
1050
|
-
this.$https({
|
|
1051
|
-
url: {
|
|
1052
|
-
module: "sheet",
|
|
1053
|
-
name: "getJobStatus"
|
|
1054
|
-
},
|
|
1055
|
-
params: {
|
|
1056
|
-
jobId: id
|
|
1057
|
-
},
|
|
1058
|
-
callback: data => {
|
|
1059
|
-
if (data.status === "completed") {
|
|
1060
|
-
operationItem.disabled = false;
|
|
1061
|
-
clearInterval(this.exportTimer);
|
|
1062
|
-
window.location.href = data.url;
|
|
1063
|
-
} else if (data.status === "failed") {
|
|
1064
|
-
this.$Message.info({
|
|
1065
|
-
content: "操作失败,请稍后再试!"
|
|
1066
|
-
});
|
|
1067
|
-
}
|
|
1068
|
-
},
|
|
1069
|
-
error: res => {
|
|
1070
|
-
operationItem.disabled = false;
|
|
1071
|
-
this.exportTimer = null;
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1074
|
-
},
|
|
1075
|
-
|
|
1076
|
-
/* ----------- 全屏 ---------- */
|
|
1077
|
-
// 打开全屏模态框
|
|
1078
|
-
clickEnlarge (operationItem) {
|
|
1079
|
-
this.isEnlarge = true;
|
|
1080
|
-
},
|
|
1081
|
-
|
|
1082
|
-
/* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
|
|
1083
|
-
getTableTopRender (inEnlarge = false) {
|
|
1084
|
-
return (h, params) => {
|
|
1085
|
-
return h("div", {
|
|
1086
|
-
style: {
|
|
1087
|
-
"margin-bottom": "3px",
|
|
1088
|
-
"display": "flex",
|
|
1089
|
-
"flex-direction": "row",
|
|
1090
|
-
"justify-content": "space-between",
|
|
1091
|
-
"align-items": "center"
|
|
1092
|
-
}
|
|
1093
|
-
}, [
|
|
1094
|
-
// 左 -统计,逻辑
|
|
1095
|
-
this.topSummaryRender(h),
|
|
1096
|
-
|
|
1097
|
-
// 右 -功能按钮
|
|
1098
|
-
this.topOperationRender(h, inEnlarge)
|
|
1099
|
-
]);
|
|
1100
|
-
};
|
|
1101
|
-
},
|
|
1102
|
-
topSummaryRender (h) {
|
|
1103
|
-
return this.searchFormList.length
|
|
1104
|
-
? h("div", {
|
|
1105
|
-
style: {
|
|
1106
|
-
"display": "flex",
|
|
1107
|
-
"flex-direction": "row",
|
|
1108
|
-
"align-items": "center"
|
|
1109
|
-
}
|
|
1110
|
-
}, [
|
|
1111
|
-
h("span", {
|
|
1112
|
-
style: {
|
|
1113
|
-
"font-weight": "500"
|
|
1114
|
-
}
|
|
1115
|
-
}, this.searchTitle),
|
|
1116
|
-
|
|
1117
|
-
h("div", {
|
|
1118
|
-
style: {
|
|
1119
|
-
"display": "flex",
|
|
1120
|
-
"flex-direction": "row",
|
|
1121
|
-
"align-items": "center",
|
|
1122
|
-
"margin-left": "12px"
|
|
1123
|
-
}
|
|
1124
|
-
}, [
|
|
1125
|
-
h("div", {
|
|
1126
|
-
style: {
|
|
1127
|
-
"font-weight": "500"
|
|
1128
|
-
}
|
|
1129
|
-
}, this.selfLogicPropsObj._name + ":"),
|
|
1130
|
-
|
|
1131
|
-
h("dsh-select", {
|
|
1132
|
-
style: {
|
|
1133
|
-
"margin-left": "8px",
|
|
1134
|
-
"margin-top": "-4px"
|
|
1135
|
-
},
|
|
1136
|
-
props: {
|
|
1137
|
-
value: this.dftAdvSearch,
|
|
1138
|
-
propsObj: this.selfLogicPropsObj
|
|
1139
|
-
}
|
|
1140
|
-
})
|
|
1141
|
-
])
|
|
1142
|
-
])
|
|
1143
|
-
: h("div", "");
|
|
1144
|
-
},
|
|
1145
|
-
// 全屏里不显示功能按钮
|
|
1146
|
-
topOperationRender (h, inEnlarge) {
|
|
1147
|
-
return inEnlarge
|
|
1148
|
-
? undefined
|
|
1149
|
-
: h("dsh-buttons", {
|
|
1150
|
-
style: {
|
|
1151
|
-
"text-align": "right"
|
|
1152
|
-
},
|
|
1153
|
-
props: {
|
|
1154
|
-
itemClass: undefined,
|
|
1155
|
-
list: this.$getOperationList(this.topOperationBtns)
|
|
1156
|
-
},
|
|
1157
|
-
on: {
|
|
1158
|
-
click: (event) => {
|
|
1159
|
-
this.$dispatchEvent(event);
|
|
1160
|
-
}
|
|
1161
|
-
},
|
|
1162
|
-
nativeOn: {
|
|
1163
|
-
click: (e) => {
|
|
1164
|
-
e.stopPropagation();
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
},
|
|
1169
|
-
topSearchRender (h) {
|
|
1170
|
-
return this.searchFormList.length
|
|
1171
|
-
? h("dsh-default-search", {
|
|
1172
|
-
props: {
|
|
1173
|
-
formList: this.searchFormList,
|
|
1174
|
-
initValue: this.dftAdvSearch.conditions,
|
|
1175
|
-
labelWidth: this.searchLabelWidth
|
|
1176
|
-
},
|
|
1177
|
-
on: {
|
|
1178
|
-
change: this.searchCb
|
|
1179
|
-
}
|
|
1180
|
-
})
|
|
1181
|
-
: undefined;
|
|
1182
|
-
},
|
|
1183
|
-
createBtnRender (h) {
|
|
1184
|
-
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
1185
|
-
? h("dsh-buttons", {
|
|
1186
|
-
style: {
|
|
1187
|
-
"margin-top": "3px"
|
|
1188
|
-
},
|
|
1189
|
-
props: {
|
|
1190
|
-
itemClass: undefined,
|
|
1191
|
-
list: this.$getOperationList(["canCreate"])
|
|
1192
|
-
},
|
|
1193
|
-
on: {
|
|
1194
|
-
click: (event) => {
|
|
1195
|
-
this.$dispatchEvent(event);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
})
|
|
1199
|
-
: undefined;
|
|
1200
|
-
},
|
|
1201
|
-
contentThCellRender (h, { column }) {
|
|
1202
|
-
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
1203
|
-
// console.log(column._name);
|
|
1204
|
-
|
|
1205
|
-
return this.$getHeadRender(h, column, {
|
|
1206
|
-
showRequired: this.showRequired,
|
|
1207
|
-
showDescription: this.showDescription,
|
|
1208
|
-
headHeightAuto: this.headHeightAuto
|
|
1209
|
-
});
|
|
1210
|
-
},
|
|
1211
|
-
contentTdCellRender (h, { row, rowIndex, column }) {
|
|
1212
|
-
// console.log(rowIndex);
|
|
1213
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1214
|
-
column = this.getResetCol({ row, rowIndex, column });
|
|
1215
|
-
const unitCanEdit = this.getUnitCanEdit({ row, rowIndex, column });
|
|
1216
|
-
const ruleResultObj = this.getColRuleResult({ row, rowIndex, column });
|
|
1217
|
-
|
|
1218
|
-
return [
|
|
1219
|
-
// this.isShowCompare({ row, rowIndex, column })
|
|
1220
|
-
// ? h("Tooltip", {
|
|
1221
|
-
// style: {
|
|
1222
|
-
// width: "100%"
|
|
1223
|
-
// },
|
|
1224
|
-
// props: {
|
|
1225
|
-
// content: this.$isEmptyData(this.compareListData[rowIndex][column._key]) ? "" : this.compareListData[rowIndex][column._key],
|
|
1226
|
-
// transfer: true,
|
|
1227
|
-
// maxWidth: 200,
|
|
1228
|
-
// placement: "top"
|
|
1229
|
-
// },
|
|
1230
|
-
// scopedSlots: {
|
|
1231
|
-
// default: props => h("dsh-list-unit", {
|
|
1232
|
-
// props: {
|
|
1233
|
-
// canEdit: unitCanEdit,
|
|
1234
|
-
// formData: row,
|
|
1235
|
-
// formItem: {
|
|
1236
|
-
// ...column,
|
|
1237
|
-
// _key: column.colType === "tree" ? "name" : column._key
|
|
1238
|
-
// },
|
|
1239
|
-
// allFormList: this.selfColumns,
|
|
1240
|
-
// inTableType: this.inTableType,
|
|
1241
|
-
// allListRows: this.allListData,
|
|
1242
|
-
// rowIndex: rowIndex,
|
|
1243
|
-
// parentFormList: this.parentFormList,
|
|
1244
|
-
// parentObj: this.parentObj
|
|
1245
|
-
// },
|
|
1246
|
-
// on: {
|
|
1247
|
-
// blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1248
|
-
// quickChange: () => this.$dispatchEvent(this.operationMap.canQuickChangeVal, row, rowIndex, column, arguments),
|
|
1249
|
-
// change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
|
|
1250
|
-
// }
|
|
1251
|
-
// })
|
|
1252
|
-
// }
|
|
1253
|
-
// })
|
|
1254
|
-
h("dsh-list-unit", {
|
|
1255
|
-
key: `${row._id}--${column._key}`,
|
|
1256
|
-
props: {
|
|
1257
|
-
canEdit: unitCanEdit,
|
|
1258
|
-
formData: row,
|
|
1259
|
-
formItem: {
|
|
1260
|
-
...column,
|
|
1261
|
-
_key: column.colType === "tree" ? "name" : column._key
|
|
1262
|
-
},
|
|
1263
|
-
allFormList: this.selfColumns,
|
|
1264
|
-
changedCols: this.changedCols,
|
|
1265
|
-
changedFields: (row.__changed__ || []).map(item => item.fieldKey),
|
|
1266
|
-
inTableType: this.inTableType,
|
|
1267
|
-
allListRows: this.allListData,
|
|
1268
|
-
rowIndex: rowIndex,
|
|
1269
|
-
parentFormList: this.parentFormList,
|
|
1270
|
-
parentObj: this.parentObj
|
|
1271
|
-
},
|
|
1272
|
-
on: {
|
|
1273
|
-
blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1274
|
-
quickChange: () => this.$dispatchEvent(this.operationMap.canQuickChangeVal, row, rowIndex, column, arguments),
|
|
1275
|
-
change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
|
|
1276
|
-
}
|
|
1277
|
-
}),
|
|
1278
|
-
|
|
1279
|
-
// 校验文字
|
|
1280
|
-
!ruleResultObj.bool
|
|
1281
|
-
? h("span", {
|
|
1282
|
-
class: "bri-table-td-tip"
|
|
1283
|
-
}, ruleResultObj.message)
|
|
1284
|
-
: undefined,
|
|
1285
|
-
|
|
1286
|
-
// 添加符
|
|
1287
|
-
...this.operationIconRender(h, { row, rowIndex, column }, 12)
|
|
1288
|
-
];
|
|
1289
|
-
},
|
|
1290
|
-
operationTdCellRender (h, { row, rowIndex, column }) {
|
|
1291
|
-
const operationList = this.rowOperationList.map(btnItem => ({
|
|
1292
|
-
...btnItem,
|
|
1293
|
-
disabled: btnItem.type === "canDelete"
|
|
1294
|
-
? !this.getRowDelBtnCanEdit(row, rowIndex)
|
|
1295
|
-
: btnItem.disabled
|
|
1296
|
-
}));
|
|
1297
|
-
|
|
1298
|
-
return [
|
|
1299
|
-
h("dsh-buttons", {
|
|
1300
|
-
props: {
|
|
1301
|
-
list: operationList
|
|
1302
|
-
},
|
|
1303
|
-
on: {
|
|
1304
|
-
click: (operationItem) => {
|
|
1305
|
-
this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
})
|
|
1309
|
-
];
|
|
1310
|
-
},
|
|
1311
|
-
operationIconRender (h, { row, rowIndex, column }, iconSize = 14) {
|
|
1312
|
-
const baseBool = !this.isSearching &&
|
|
1313
|
-
(this.showCreateBtnColKeys.length ? this.showCreateBtnColKeys.includes(column._key) : ["__index__", "__treeIndex__"].includes(column._key));
|
|
1314
|
-
// this.hoverRecordMap[`${row._id}`];
|
|
1315
|
-
|
|
1316
|
-
return [
|
|
1317
|
-
// 插入一行图标
|
|
1318
|
-
baseBool
|
|
1319
|
-
? this.getOperationIconRender(h, { row, rowIndex, column }, "canInsert", iconSize)
|
|
1320
|
-
: h("span", ""),
|
|
1321
|
-
|
|
1322
|
-
// 添加一行下级图标
|
|
1323
|
-
baseBool &&
|
|
1324
|
-
row.level < this.maxLevel &&
|
|
1325
|
-
!["cascaderTable"].includes(this.inTableType) // 老版级联表格类型不要“添加下级”图标
|
|
1326
|
-
? this.getOperationIconRender(h, { row, rowIndex, column }, "canCreateChild", iconSize, true)
|
|
1327
|
-
: h("span", ""),
|
|
1328
|
-
|
|
1329
|
-
// 删除该行图标
|
|
1330
|
-
baseBool &&
|
|
1331
|
-
this.getRowDelBtnCanEdit(row, rowIndex) &&
|
|
1332
|
-
["cascaderTable"].includes(this.inTableType)
|
|
1333
|
-
? this.getOperationIconRender(h, { row, rowIndex, column }, "canDelete", iconSize, true)
|
|
1334
|
-
: h("span", "")
|
|
1335
|
-
];
|
|
1336
|
-
},
|
|
1337
|
-
getOperationIconRender (h, { row, rowIndex, column }, operationType, iconSize = 14, isLeft = false) {
|
|
1338
|
-
const operationItem = this.operationMap[operationType];
|
|
1339
|
-
|
|
1340
|
-
return operationItem && operationItem.disabled !== true
|
|
1341
|
-
? h("div", {
|
|
1342
|
-
class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
|
|
1343
|
-
style: {
|
|
1344
|
-
position: "absolute",
|
|
1345
|
-
bottom: "0px",
|
|
1346
|
-
right: isLeft ? `${iconSize + 3}px` : "0px",
|
|
1347
|
-
width: `${iconSize + 2}px`,
|
|
1348
|
-
height: `${iconSize + 2}px`,
|
|
1349
|
-
borderRadius: "2px",
|
|
1350
|
-
backgroundColor: "#ffffff",
|
|
1351
|
-
lineHeight: `${iconSize - 2}px`,
|
|
1352
|
-
cursor: "pointer",
|
|
1353
|
-
verticalAlign: "middle",
|
|
1354
|
-
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
1355
|
-
}
|
|
1356
|
-
}, [
|
|
1357
|
-
h("Tooltip", {
|
|
1358
|
-
props: {
|
|
1359
|
-
content: operationItem.tip,
|
|
1360
|
-
maxWidth: "250",
|
|
1361
|
-
transfer: true
|
|
1362
|
-
}
|
|
1363
|
-
}, [
|
|
1364
|
-
h("Icon", {
|
|
1365
|
-
class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
|
|
1366
|
-
style: {
|
|
1367
|
-
fontWeight: "500"
|
|
1368
|
-
},
|
|
1369
|
-
props: {
|
|
1370
|
-
type: operationItem.icon,
|
|
1371
|
-
size: iconSize
|
|
1372
|
-
},
|
|
1373
|
-
on: {
|
|
1374
|
-
click: () => {
|
|
1375
|
-
this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
})
|
|
1379
|
-
])
|
|
1380
|
-
])
|
|
1381
|
-
: h("span", "");
|
|
1382
|
-
},
|
|
1383
|
-
bodyCellClass ({ row, rowIndex, column }) {
|
|
1384
|
-
return "bri-table-td" +
|
|
1385
|
-
`${["__treeIndex__"].includes(column._key)
|
|
1386
|
-
? " bri-table-td-treeIndex"
|
|
1387
|
-
: this.getRowCanEdit(row, rowIndex)
|
|
1388
|
-
? " bri-table-td-edit"
|
|
1389
|
-
: ""
|
|
1390
|
-
}` +
|
|
1391
|
-
`${this.isExpandAction
|
|
1392
|
-
? " bri-table-td-visible"
|
|
1393
|
-
: ""
|
|
1394
|
-
}` +
|
|
1395
|
-
`${this.noborderColKeys.includes(column._key)
|
|
1396
|
-
? " bri-table-td-noborder"
|
|
1397
|
-
: ""
|
|
1398
|
-
}` +
|
|
1399
|
-
`${this.bgColKeys.includes(column._key)
|
|
1400
|
-
? " bri-table-td-bg"
|
|
1401
|
-
: ""
|
|
1402
|
-
}`;
|
|
1403
|
-
},
|
|
1404
|
-
eventCustomOption ({ row, rowIndex, column }) {
|
|
1405
|
-
return {
|
|
1406
|
-
click: (event) => {
|
|
1407
|
-
|
|
1408
|
-
},
|
|
1409
|
-
dblclick: (event) => {
|
|
1410
|
-
|
|
1411
|
-
},
|
|
1412
|
-
contextmenu: (event) => {
|
|
1413
|
-
|
|
1414
|
-
},
|
|
1415
|
-
mouseenter: (event) => {
|
|
1416
|
-
// this.$set(this.hoverRecordMap, `${row._id}`, true);
|
|
1417
|
-
},
|
|
1418
|
-
mouseleave: (event) => {
|
|
1419
|
-
// this.$set(this.hoverRecordMap, `${row._id}`, false);
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
},
|
|
1423
|
-
|
|
1424
|
-
/* ----------- 方法 ---------- */
|
|
1425
|
-
// 整行校验结果
|
|
1426
|
-
getRowRuleResult (row, rowIndex) {
|
|
1427
|
-
// return this.usedColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
|
|
1428
|
-
|
|
1429
|
-
let bool = true;
|
|
1430
|
-
this.usedColumns.forEach(column => {
|
|
1431
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1432
|
-
|
|
1433
|
-
const resultObj = this.getColRuleResultObj({ row, rowIndex, column });
|
|
1434
|
-
if (!resultObj.bool) {
|
|
1435
|
-
bool = false;
|
|
1436
|
-
this.dealRuleRecord(row, column);
|
|
1437
|
-
}
|
|
1438
|
-
});
|
|
1439
|
-
|
|
1440
|
-
return bool;
|
|
1441
|
-
},
|
|
1442
|
-
getRowFormList (row, rowIndex) {
|
|
1443
|
-
return this.selfColumns.map(column => {
|
|
1444
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1445
|
-
const unitCanEdit = this.getColCanEdit({ row, rowIndex, column });
|
|
1446
|
-
|
|
1447
|
-
return {
|
|
1448
|
-
...column,
|
|
1449
|
-
canEdit: unitCanEdit
|
|
1450
|
-
};
|
|
1451
|
-
});
|
|
1452
|
-
},
|
|
1453
|
-
// 是否默认行
|
|
1454
|
-
getIsDftRow (row, rowIndex) {
|
|
1455
|
-
return this.isDftSet ? false : row.__isDefault__;
|
|
1456
|
-
},
|
|
1457
|
-
// 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
|
|
1458
|
-
getRowDelBtnCanEdit (row, rowIndex) {
|
|
1459
|
-
return row.__readonly__ !== true && // 不能为只读数据
|
|
1460
|
-
(this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
|
|
1461
|
-
(this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据可删除
|
|
1462
|
-
},
|
|
1463
|
-
// 行内容是否可编辑
|
|
1464
|
-
getRowCanEdit (row, rowIndex) {
|
|
1465
|
-
return this.canEdit && // 是编辑状态
|
|
1466
|
-
(this.getIsDftRow(row) ? !this.dftReadonly : true) && // 默认数据可编辑
|
|
1467
|
-
(row.__old__ === true ? !this.oldReadonly : true) && // 老数据可编辑
|
|
1468
|
-
row.__readonly__ !== true; // 不能为只读数据
|
|
1469
|
-
},
|
|
1470
|
-
|
|
1471
|
-
// 单元格校验结果
|
|
1472
|
-
getColRuleResult ({ row, rowIndex, column }) {
|
|
1473
|
-
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1474
|
-
|
|
1475
|
-
// 未触发校验时 不显示错误
|
|
1476
|
-
// return this.ruleRecordMap[this.getMixKey(row, column)] || this.showRuleMessage
|
|
1477
|
-
return this.ruleRecordMap[this.getMixKey(row, column)]
|
|
1478
|
-
? this.getColRuleResultObj({ row, rowIndex, column })
|
|
1479
|
-
: {
|
|
1480
|
-
bool: true,
|
|
1481
|
-
message: "未触发校验,通过!"
|
|
1482
|
-
};
|
|
1483
|
-
},
|
|
1484
|
-
// 获取单元格校验对象
|
|
1485
|
-
getColRuleResultObj ({ row, rowIndex, column }) {
|
|
1486
|
-
// 校验必填不通过 => 校验对比
|
|
1487
|
-
const resultObj = {};
|
|
1488
|
-
this.$getFieldRuleResult(column, row, resultObj) &&
|
|
1489
|
-
this.$normalComparedFunc(column, row, this.selfColumns, this.parentObj, this.parentFormList, this.inTableType, resultObj) &&
|
|
1490
|
-
this.$levelComparedFunc(column, row, this.allListData, this.inTableType, resultObj);
|
|
1491
|
-
|
|
1492
|
-
return resultObj;
|
|
1493
|
-
},
|
|
1494
|
-
// 加工单元格对应的配置
|
|
1495
|
-
getResetCol ({ row, rowIndex, column }) {
|
|
1496
|
-
return {
|
|
1497
|
-
// isShare: this.isShare,
|
|
1498
|
-
...column,
|
|
1499
|
-
_heightAuto: this.heightAuto,
|
|
1500
|
-
...(
|
|
1501
|
-
this.noborderColKeys.includes(column._key)
|
|
1502
|
-
? { _placeholder: " " }
|
|
1503
|
-
: {}
|
|
1504
|
-
),
|
|
1505
|
-
...(
|
|
1506
|
-
this.getSelfResetCol
|
|
1507
|
-
? this.getSelfResetCol({ row, rowIndex, column })
|
|
1508
|
-
: {}
|
|
1509
|
-
)
|
|
1510
|
-
};
|
|
1511
|
-
},
|
|
1512
|
-
// 单元格最终是否可编辑性
|
|
1513
|
-
getUnitCanEdit ({ row, rowIndex, column }) {
|
|
1514
|
-
return this.getRowCanEdit(row, rowIndex) &&
|
|
1515
|
-
this.getColCanEdit({ row, rowIndex, column }) &&
|
|
1516
|
-
this.$isAdvRelyShow(column, row, this.parentObj, true);
|
|
1517
|
-
},
|
|
1518
|
-
// 单元格本身是否可编辑性
|
|
1519
|
-
getColCanEdit ({ row, rowIndex, column }) {
|
|
1520
|
-
return (this.getIsDftRow(row) ? !this.dftReadonlyColKeys.includes(column._key) : true) && // 默认行的某列是否可编辑
|
|
1521
|
-
(row.__old__ === true ? !this.oldReadonlyColKeys.includes(column._key) : true) && // 老数据行里某些列不可编辑
|
|
1522
|
-
(row.__isQuote__ ? !this.quoteReadonlyColKeys.includes(column._key) : true) && // 引用的数据是否可编辑
|
|
1523
|
-
(this.getSelfColCanEdit ? this.getSelfColCanEdit({ row, rowIndex, column }) : true) &&
|
|
1524
|
-
(
|
|
1525
|
-
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(column._type)
|
|
1526
|
-
? column._summaryType
|
|
1527
|
-
? row.isLeaf === true
|
|
1528
|
-
: ["downToUp", "upToDown"].includes(column._writeSort)
|
|
1529
|
-
? column._noLimitWrite === true
|
|
1530
|
-
? true
|
|
1531
|
-
: ["downToUp"].includes(column._writeSort)
|
|
1532
|
-
? !(row.children && row.children.length) || row.children.every(sonRow => !this.$isEmptyData(sonRow[column._key]))
|
|
1533
|
-
: row.level === 1 || !this.$isEmptyData(this.getParentRow(row, this.data)[column._key])
|
|
1534
|
-
: true
|
|
1535
|
-
: true
|
|
1536
|
-
) &&
|
|
1537
|
-
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(column._key)) && // 层级表格的固定字段不可编辑
|
|
1538
|
-
column._enterType !== "calculate" && // 计算的不可编辑
|
|
1539
|
-
column._readonly !== true && // 只读
|
|
1540
|
-
column._disabled !== true && // 只读
|
|
1541
|
-
column.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
|
|
1542
|
-
},
|
|
1543
|
-
|
|
1544
|
-
/* ----------- 工具方法 ---------- */
|
|
1545
|
-
// 初始化时 修复数据
|
|
1546
|
-
fixRowData (row, levelNum) {
|
|
1547
|
-
if (this.initFlag) {
|
|
1548
|
-
// 配置端设置的地方,不会运行下面的,因为_default被过滤掉没值,defaultListDataIds就是空的
|
|
1549
|
-
if (row._id) {
|
|
1550
|
-
if (this.defaultListDataIds.includes(row._id)) {
|
|
1551
|
-
row.__isDefault__ = true;
|
|
1552
|
-
|
|
1553
|
-
// 默认数据的id置换一遍,不然每条数据里该列表的id都是重复的
|
|
1554
|
-
const oldId = row._id;
|
|
1555
|
-
const newId = this.$ObjectID().str;
|
|
1556
|
-
row._id = newId;
|
|
1557
|
-
this.idRecordMap[newId] = oldId;
|
|
1558
|
-
}
|
|
1559
|
-
} else {
|
|
1560
|
-
row._id = this.$ObjectID().str;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
row.__old__ = this.isDftSet ? false : this.parentObj.__isCreate__ !== true; // 标记老数据
|
|
1564
|
-
row.__isDefault__ = this.isDftSet ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
|
|
1565
|
-
|
|
1566
|
-
// 初次进来 把关于展示的状态值全部清除(只有层级表在用,按理说应放在DshTreeTableMixin.js,但为了清除三大表格的老数据,才放在这)
|
|
1567
|
-
this.resetProperties.forEach(property => {
|
|
1568
|
-
delete row[property];
|
|
1569
|
-
});
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
this.fixSelfRowData && this.fixSelfRowData(row, levelNum);
|
|
1573
|
-
},
|
|
1574
|
-
// 生成新的一行数据
|
|
1575
|
-
getNewRowData (level, list) {
|
|
1576
|
-
if (["cascaderTable"].includes(this.controlType)) {
|
|
1577
|
-
return {
|
|
1578
|
-
...this.$deepCopy(this.selfRowDft),
|
|
1579
|
-
...(this.getSelfNewRowData ? this.$deepCopy(this.getSelfNewRowData(level, list)) : {}),
|
|
1580
|
-
_id: this.$ObjectID().str,
|
|
1581
|
-
level: level,
|
|
1582
|
-
isLeaf: true,
|
|
1583
|
-
children: [],
|
|
1584
|
-
// __old__: false,
|
|
1585
|
-
__isDefault__: this.isDftSet
|
|
1586
|
-
};
|
|
1587
|
-
} else {
|
|
1588
|
-
return {
|
|
1589
|
-
...this.$deepCopy(this.selfRowDft),
|
|
1590
|
-
_id: this.$ObjectID().str,
|
|
1591
|
-
// __old__: false,
|
|
1592
|
-
__isDefault__: this.isDftSet
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
},
|
|
1596
|
-
// 获取父级行
|
|
1597
|
-
getParentRow (row, tree = []) {
|
|
1598
|
-
if (row.level === 1) {
|
|
1599
|
-
return {
|
|
1600
|
-
children: tree
|
|
1601
|
-
};
|
|
1602
|
-
} else {
|
|
1603
|
-
let parentRow;
|
|
1604
|
-
|
|
1605
|
-
const loop = (list = []) => {
|
|
1606
|
-
return list.some(rowItem => {
|
|
1607
|
-
if (rowItem.level === row.level - 1) {
|
|
1608
|
-
const isExist = rowItem.children.some(childRowItem => childRowItem._id === row._id);
|
|
1609
|
-
parentRow = rowItem;
|
|
1610
|
-
return isExist;
|
|
1611
|
-
} else {
|
|
1612
|
-
return loop(rowItem.children);
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
};
|
|
1616
|
-
loop(tree);
|
|
1617
|
-
|
|
1618
|
-
return parentRow;
|
|
1619
|
-
}
|
|
1620
|
-
},
|
|
1621
|
-
// // 单元格是否显示对比
|
|
1622
|
-
// isShowCompare ({ row, rowIndex, column }) {
|
|
1623
|
-
// const oldRow = this.compareListData[rowIndex] || {};
|
|
1624
|
-
// const curVal = row[column._key];
|
|
1625
|
-
// const oldVal = oldRow[column._key];
|
|
1626
|
-
|
|
1627
|
-
// return this.useCampare &&
|
|
1628
|
-
// ["number"].includes(column._type) &&
|
|
1629
|
-
// !(this.$isEmptyData(curVal) && this.$isEmptyData(oldVal)) &&
|
|
1630
|
-
// curVal !== oldVal;
|
|
1631
|
-
// },
|
|
1632
|
-
// 比较两行某列的值是否相等
|
|
1633
|
-
isCompareSame (column, row, compareRow) {
|
|
1634
|
-
const curColKey = column ? column._key : undefined;
|
|
1635
|
-
const curColType = column ? column._type : undefined;
|
|
1636
|
-
|
|
1637
|
-
return this.$isEmptyData(compareRow[curColKey]) && this.$isEmptyData(row[curColKey])
|
|
1638
|
-
? true
|
|
1639
|
-
: ["users", "departments"].includes(curColType)
|
|
1640
|
-
? compareRow[curColKey].length === row[curColKey].length && compareRow[curColKey].every((item, index) => item._key === row[curColKey][index]._key)
|
|
1641
|
-
: compareRow[curColKey] === row[curColKey];
|
|
1642
|
-
},
|
|
1643
|
-
// 行id + 分隔符 + 列key 组成键
|
|
1644
|
-
getMixKey (row, column, splitStr = "--") {
|
|
1645
|
-
return `${row._id}${splitStr}${column._key}`;
|
|
1646
|
-
},
|
|
1647
|
-
// 更新校验显示的标记
|
|
1648
|
-
dealRuleRecord (row, column) {
|
|
1649
|
-
// this.$set(this.ruleRecordMap, this.getMixKey(row, column), true);
|
|
1650
|
-
this.ruleRecordMap[this.getMixKey(row, column)] = true;
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
};
|
|
1
|
+
import DshListUnit from "../../unit/DshListUnit.vue";
|
|
2
|
+
import importModal from "../common/importModal.vue";
|
|
3
|
+
import quoteListModal from "../common/quoteListModal.vue";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
mixins: [],
|
|
7
|
+
components: {
|
|
8
|
+
DshListUnit,
|
|
9
|
+
importModal,
|
|
10
|
+
quoteListModal
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
canEdit: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
tableDataObj: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default () {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
data: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default () {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
rowDefault: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default () {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
columns: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default () {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
propsObj: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default () {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
parentObj: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default () {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
parentFormList: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default () {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// compareData: {
|
|
62
|
+
// type: Array,
|
|
63
|
+
// default () {
|
|
64
|
+
// return [];
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
},
|
|
68
|
+
data () {
|
|
69
|
+
return {
|
|
70
|
+
widthMap: this.$getModFieldPropertyMap("width"),
|
|
71
|
+
dftInitValMap: this.$getModFieldPropertyMap("initDefaultVal"),
|
|
72
|
+
// saveProperties: ["__readonly__", "__isDefault__", "__old__", "__isQuote__"],
|
|
73
|
+
// resetProperties: ["__treeIndex__", "__isExpand__", "__isShow__", "__isTmpShow__"],
|
|
74
|
+
resetProperties: ["__treeIndex__", "__isExpand__", "__isShow__", "__isTmpShow__", "__isSearchShow__", "__isRendered__"],
|
|
75
|
+
|
|
76
|
+
initFlag: true,
|
|
77
|
+
isExpandAction: false,
|
|
78
|
+
// showRuleMessage: false, // 进行全体校验
|
|
79
|
+
|
|
80
|
+
idRecordMap: {}, // 默认id转换映射
|
|
81
|
+
// hoverRecordMap: {},
|
|
82
|
+
ruleRecordMap: {}, // 单元格是否发生校验的记录映射
|
|
83
|
+
|
|
84
|
+
showTopSearch: true,
|
|
85
|
+
selfLogicPropsObj: {
|
|
86
|
+
_name: "逻辑",
|
|
87
|
+
_key: "logic",
|
|
88
|
+
_optionKind: "flat",
|
|
89
|
+
_clearable: false,
|
|
90
|
+
_data: [
|
|
91
|
+
{ _key: "and", name: "且" },
|
|
92
|
+
{ _key: "or", name: "或" }
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
dftAdvSearch: {
|
|
96
|
+
logic: "and",
|
|
97
|
+
conditions: []
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
isLoading: false,
|
|
101
|
+
selectIds: [],
|
|
102
|
+
|
|
103
|
+
dshRenderName: undefined,
|
|
104
|
+
hideStatus: true,
|
|
105
|
+
showQuoteModal: false,
|
|
106
|
+
showImportModal: false,
|
|
107
|
+
exportTimer: null,
|
|
108
|
+
isEnlarge: false,
|
|
109
|
+
isEnlargeFlag: false, // 为重渲染膜态框内容而用
|
|
110
|
+
|
|
111
|
+
baseOperationMap: {
|
|
112
|
+
canCreate: {
|
|
113
|
+
name: "添加一行",
|
|
114
|
+
tip: "添加一行",
|
|
115
|
+
type: "canCreate",
|
|
116
|
+
btnType: "default",
|
|
117
|
+
icon: "md-add",
|
|
118
|
+
size: "default",
|
|
119
|
+
long: true,
|
|
120
|
+
disabled: false,
|
|
121
|
+
event: "clickCreate"
|
|
122
|
+
},
|
|
123
|
+
canInsert: {
|
|
124
|
+
name: "插入一行",
|
|
125
|
+
tip: "插入一行",
|
|
126
|
+
type: "canInsert",
|
|
127
|
+
btnType: "primaryText",
|
|
128
|
+
icon: "md-add",
|
|
129
|
+
size: "small",
|
|
130
|
+
disabled: false,
|
|
131
|
+
event: "clickCreate"
|
|
132
|
+
},
|
|
133
|
+
canDelete: {
|
|
134
|
+
name: "删除",
|
|
135
|
+
tip: "删除该行",
|
|
136
|
+
type: "canDelete",
|
|
137
|
+
btnType: "errorText",
|
|
138
|
+
icon: "md-trash",
|
|
139
|
+
size: "small",
|
|
140
|
+
disabled: false,
|
|
141
|
+
event: "clickDelete"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
otherOperationMap: {
|
|
145
|
+
canQuickChangeVal: {
|
|
146
|
+
name: "立即改变值事件",
|
|
147
|
+
type: "canQuickChangeVal",
|
|
148
|
+
event: "quickChangeVal"
|
|
149
|
+
},
|
|
150
|
+
canChangeVal: {
|
|
151
|
+
name: "改变值事件",
|
|
152
|
+
type: "canChangeVal",
|
|
153
|
+
event: "changeVal"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
topOperationMap: {
|
|
157
|
+
canHideOrShow: {
|
|
158
|
+
name: "显示/隐藏字段",
|
|
159
|
+
type: "canHideOrShow",
|
|
160
|
+
// icon: "md-share-alt",
|
|
161
|
+
size: "small",
|
|
162
|
+
btnType: "text",
|
|
163
|
+
event: "toggleHideOrShow"
|
|
164
|
+
},
|
|
165
|
+
canQuote: {
|
|
166
|
+
name: "引用",
|
|
167
|
+
type: "canQuote",
|
|
168
|
+
icon: "ios-copy",
|
|
169
|
+
size: "small",
|
|
170
|
+
btnType: "text",
|
|
171
|
+
event: "clickQuote"
|
|
172
|
+
},
|
|
173
|
+
canImport: {
|
|
174
|
+
name: "导入",
|
|
175
|
+
type: "canImport",
|
|
176
|
+
icon: "ios-create-outline",
|
|
177
|
+
size: "small",
|
|
178
|
+
btnType: "text",
|
|
179
|
+
event: "clickImport"
|
|
180
|
+
},
|
|
181
|
+
canExport: {
|
|
182
|
+
name: "导出",
|
|
183
|
+
type: "canExport",
|
|
184
|
+
icon: "md-share-alt",
|
|
185
|
+
size: "small",
|
|
186
|
+
btnType: "text",
|
|
187
|
+
event: "clickExport"
|
|
188
|
+
},
|
|
189
|
+
canEnlarge: {
|
|
190
|
+
name: "全屏",
|
|
191
|
+
type: "canEnlarge",
|
|
192
|
+
icon: "md-expand",
|
|
193
|
+
size: "small",
|
|
194
|
+
btnType: "text",
|
|
195
|
+
event: "clickEnlarge"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
computed: {
|
|
201
|
+
dshRender () {
|
|
202
|
+
return this[this.dshRenderName];
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
controlKey () {
|
|
206
|
+
return this.propsObj._key;
|
|
207
|
+
},
|
|
208
|
+
// 是否在字段默认值设置里使用
|
|
209
|
+
isDftSet () {
|
|
210
|
+
return this.controlKey === "_default";
|
|
211
|
+
},
|
|
212
|
+
controlType () {
|
|
213
|
+
return this.propsObj._type;
|
|
214
|
+
},
|
|
215
|
+
controlName () {
|
|
216
|
+
return this.propsObj._name;
|
|
217
|
+
},
|
|
218
|
+
modKey () {
|
|
219
|
+
return this.propsObj.modKey;
|
|
220
|
+
},
|
|
221
|
+
screenKey () {
|
|
222
|
+
return this.propsObj.screenKey;
|
|
223
|
+
},
|
|
224
|
+
allScreenKey () {
|
|
225
|
+
return this.propsObj.allScreenKey;
|
|
226
|
+
},
|
|
227
|
+
flowInstId () {
|
|
228
|
+
return this.propsObj.flowInstId;
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
commonPropsObj () {
|
|
232
|
+
return {
|
|
233
|
+
// isShare: false, // 是否是分享页在用
|
|
234
|
+
_subType: "default", // "default", "cross", "old"
|
|
235
|
+
_showMode: "default", // "default", "form"
|
|
236
|
+
|
|
237
|
+
_showRequired: true, // 表头显示校验符号*
|
|
238
|
+
_showDescription: true, // 表头显示提示
|
|
239
|
+
_contentHeight: 500, // 表格最大高度
|
|
240
|
+
_headHeightAuto: false, // 表头高度自适应
|
|
241
|
+
_heightAuto: false, // 单元格高度自适应
|
|
242
|
+
_useIndex: true, // 使用序号列
|
|
243
|
+
_useSummary: false, // 使用汇总行
|
|
244
|
+
_noborderColKeys: [], // 无边线的列
|
|
245
|
+
_bgColKeys: [], // 带背景色的列
|
|
246
|
+
|
|
247
|
+
_disabledBtns: false, // 禁用增删按钮
|
|
248
|
+
_showCreateBtnColKeys: [], // 显示增删图标的列
|
|
249
|
+
_useInsertInOperationCol: false, // 操作列出现插入行按钮
|
|
250
|
+
_disabledFootCreateBtn: false, // 禁用底部新增按钮
|
|
251
|
+
_disabledDeleteDftRow: false, // 默认的数据行禁止删除
|
|
252
|
+
_disabledDeleteOldRow: false, // 保存的数据行禁止删除
|
|
253
|
+
_dftReadonly: false, // 默认的数据只读
|
|
254
|
+
_dftReadonlyColKeys: [], // 默认的数据只读的列
|
|
255
|
+
_oldReadonly: false, // 保存的数据只读
|
|
256
|
+
_oldReadonlyColKeys: [], // 保存的数据只读的列
|
|
257
|
+
|
|
258
|
+
_searchList: [], // 作为搜索的字段
|
|
259
|
+
_searchLabelWidth: 100, // 搜索的label宽度
|
|
260
|
+
_tableAdvSearch: {
|
|
261
|
+
logic: "and",
|
|
262
|
+
conditions: []
|
|
263
|
+
}, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
|
|
264
|
+
|
|
265
|
+
_showOrHideColKeys: [], // 联动隐藏字段的keys
|
|
266
|
+
_showByNumFieldKey: "", // 控制联动隐藏字段的外层字段
|
|
267
|
+
_hideColKeys: [], // 隐藏/查看列字段的keys
|
|
268
|
+
_isQuote: false, // 引用
|
|
269
|
+
_quoteDisabledColKeys: [], // 引用数据行不可编辑列
|
|
270
|
+
_quoteListFields: [], // 引用列表的显示字段
|
|
271
|
+
_quoteAdvSearch: {
|
|
272
|
+
logic: "and",
|
|
273
|
+
conditions: []
|
|
274
|
+
}, // 引用列表筛选条件
|
|
275
|
+
_isImport: false, // 导入
|
|
276
|
+
_importAsDft: false, // 导入的数据作为默认数据
|
|
277
|
+
_isExport: false, // 导出
|
|
278
|
+
_useEnlarge: true, // 全屏
|
|
279
|
+
|
|
280
|
+
_default: {
|
|
281
|
+
rowDefault: {},
|
|
282
|
+
list: [],
|
|
283
|
+
tree: []
|
|
284
|
+
},
|
|
285
|
+
...(this.selfBasePropsObj || {}),
|
|
286
|
+
|
|
287
|
+
...this.propsObj
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
selfPropsObj () {
|
|
291
|
+
return {
|
|
292
|
+
...this.commonPropsObj
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
// isShare () {
|
|
296
|
+
// return this.selfPropsObj.isShare;
|
|
297
|
+
// },
|
|
298
|
+
subType () {
|
|
299
|
+
return this.selfPropsObj._subType;
|
|
300
|
+
},
|
|
301
|
+
showMode () {
|
|
302
|
+
return this.selfPropsObj._showMode;
|
|
303
|
+
},
|
|
304
|
+
inTableType () {
|
|
305
|
+
return ["cascaderTable"].includes(this.controlType) && !["old"].includes(this.subType)
|
|
306
|
+
? "treeTable"
|
|
307
|
+
: this.controlType;
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
contentHeight () {
|
|
311
|
+
return this.selfPropsObj._contentHeight === undefined
|
|
312
|
+
? undefined
|
|
313
|
+
: this.selfPropsObj._contentHeight || 500;
|
|
314
|
+
},
|
|
315
|
+
showRequired () {
|
|
316
|
+
return this.selfPropsObj._showRequired;
|
|
317
|
+
},
|
|
318
|
+
showDescription () {
|
|
319
|
+
return this.selfPropsObj._showDescription;
|
|
320
|
+
},
|
|
321
|
+
headHeightAuto () {
|
|
322
|
+
return this.selfPropsObj._headHeightAuto;
|
|
323
|
+
},
|
|
324
|
+
heightAuto () {
|
|
325
|
+
return this.selfPropsObj._heightAuto;
|
|
326
|
+
},
|
|
327
|
+
useIndex () {
|
|
328
|
+
return this.selfPropsObj._useIndex;
|
|
329
|
+
},
|
|
330
|
+
useSummary () {
|
|
331
|
+
return this.selfPropsObj._useSummary;
|
|
332
|
+
},
|
|
333
|
+
noborderColKeys () {
|
|
334
|
+
return this.selfPropsObj._noborderColKeys;
|
|
335
|
+
},
|
|
336
|
+
bgColKeys () {
|
|
337
|
+
return this.selfPropsObj._bgColKeys;
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
disabledBtns () {
|
|
341
|
+
return this.isDftSet ? false : this.selfPropsObj._disabledBtns;
|
|
342
|
+
},
|
|
343
|
+
showCreateBtnColKeys () {
|
|
344
|
+
return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
345
|
+
},
|
|
346
|
+
useInsertInOperationCol () {
|
|
347
|
+
return this.selfPropsObj._useInsertInOperationCol;
|
|
348
|
+
},
|
|
349
|
+
disabledFootCreateBtn () {
|
|
350
|
+
return this.isDftSet ? false : this.selfPropsObj._disabledFootCreateBtn;
|
|
351
|
+
},
|
|
352
|
+
disabledDeleteDftRow () {
|
|
353
|
+
return this.isDftSet ? false : this.selfPropsObj._disabledDeleteDftRow;
|
|
354
|
+
},
|
|
355
|
+
disabledDeleteOldRow () {
|
|
356
|
+
return this.isDftSet ? false : this.selfPropsObj._disabledDeleteOldRow;
|
|
357
|
+
},
|
|
358
|
+
dftReadonly () {
|
|
359
|
+
return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
|
|
360
|
+
},
|
|
361
|
+
dftReadonlyColKeys () {
|
|
362
|
+
return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
363
|
+
},
|
|
364
|
+
oldReadonly () {
|
|
365
|
+
return this.isDftSet ? false : this.selfPropsObj._oldReadonly;
|
|
366
|
+
},
|
|
367
|
+
oldReadonlyColKeys () {
|
|
368
|
+
return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
/* --- 筛选 --- */
|
|
372
|
+
searchLabelWidth () {
|
|
373
|
+
return this.selfPropsObj._searchLabelWidth;
|
|
374
|
+
},
|
|
375
|
+
searchList () {
|
|
376
|
+
return this.selfPropsObj._searchList;
|
|
377
|
+
},
|
|
378
|
+
searchListMap () {
|
|
379
|
+
return this.$arrToMap(this.searchList, "_key");
|
|
380
|
+
},
|
|
381
|
+
searchListFields () {
|
|
382
|
+
return this.searchList.map(searchItem => searchItem._key);
|
|
383
|
+
},
|
|
384
|
+
searchFormList () {
|
|
385
|
+
return this.$filterList(this.searchListFields, this.selfColumns).map(formItem => ({
|
|
386
|
+
...formItem,
|
|
387
|
+
...this.searchListMap[formItem._key],
|
|
388
|
+
_name: formItem._name
|
|
389
|
+
}));
|
|
390
|
+
},
|
|
391
|
+
tableAdvSearch () {
|
|
392
|
+
return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.parentFormList, this.parentObj);
|
|
393
|
+
},
|
|
394
|
+
// 默认筛选配置里-隐藏的筛选条件
|
|
395
|
+
hideAdvSearch () {
|
|
396
|
+
return {
|
|
397
|
+
logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
|
|
398
|
+
conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
|
|
399
|
+
!this.searchListFields.includes(conditionItem.fieldKey)
|
|
400
|
+
)
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
// 过滤行数据的 最终的筛选条件
|
|
404
|
+
finalTableAdvSearch () {
|
|
405
|
+
return {
|
|
406
|
+
logic: "and",
|
|
407
|
+
conditions: [
|
|
408
|
+
this.hideAdvSearch,
|
|
409
|
+
this.dftAdvSearch
|
|
410
|
+
]
|
|
411
|
+
};
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
// 是否筛选状态
|
|
415
|
+
isSearching () {
|
|
416
|
+
return this.parentObj.__isCreate__ === true
|
|
417
|
+
? false
|
|
418
|
+
: this.$isAdvSearching(this.finalTableAdvSearch);
|
|
419
|
+
},
|
|
420
|
+
searchTitle () {
|
|
421
|
+
return `${this.isSearching ? "筛选" : "全部"}数据;`;
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
/* --- 列字段 --- */
|
|
425
|
+
// columns => selfColumns => usedColumns => contentColumns => showContentColumns => showColumns
|
|
426
|
+
selfColumns () {
|
|
427
|
+
// console.log("selfColumns");
|
|
428
|
+
return this.columns;
|
|
429
|
+
},
|
|
430
|
+
usedColumns () {
|
|
431
|
+
// console.log("usedColumns");
|
|
432
|
+
const list = this.selfColumns.filter(colItem =>
|
|
433
|
+
this.showOrHideColKeys.includes(colItem._key)
|
|
434
|
+
? this.showColKeys.includes(colItem._key)
|
|
435
|
+
: true
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
return list.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
|
|
439
|
+
},
|
|
440
|
+
contentColumns () {
|
|
441
|
+
return this.usedColumns.map(colItem => ({
|
|
442
|
+
renderHeaderCell: ({ column }, h) => {
|
|
443
|
+
return this.contentThCellRender(h, { column });
|
|
444
|
+
},
|
|
445
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
446
|
+
return this.contentTdCellRender(h, { row, rowIndex, column });
|
|
447
|
+
},
|
|
448
|
+
...colItem
|
|
449
|
+
}));
|
|
450
|
+
},
|
|
451
|
+
showContentColumns () {
|
|
452
|
+
return this.contentColumns.filter(colItem =>
|
|
453
|
+
this.hideStatus === true
|
|
454
|
+
? !this.hideColKeys.includes(colItem._key)
|
|
455
|
+
: true
|
|
456
|
+
);
|
|
457
|
+
},
|
|
458
|
+
selectionColumn () {
|
|
459
|
+
return {
|
|
460
|
+
_key: "__selection__",
|
|
461
|
+
key: "__selection__",
|
|
462
|
+
field: "__selection__",
|
|
463
|
+
type: "checkbox",
|
|
464
|
+
width: 50,
|
|
465
|
+
align: "center",
|
|
466
|
+
fixed: "left"
|
|
467
|
+
};
|
|
468
|
+
},
|
|
469
|
+
operationColumn () {
|
|
470
|
+
return {
|
|
471
|
+
title: "操作",
|
|
472
|
+
_key: "__operation__",
|
|
473
|
+
key: "__operation__",
|
|
474
|
+
field: "__operation__",
|
|
475
|
+
_align: "center",
|
|
476
|
+
align: "center",
|
|
477
|
+
_fixed: "right",
|
|
478
|
+
fixed: "right",
|
|
479
|
+
_width: 100 + (this.rowOperationList.length - 1) * 110,
|
|
480
|
+
width: 100 + (this.rowOperationList.length - 1) * 110,
|
|
481
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
482
|
+
return this.operationTdCellRender(h, { row, rowIndex, column });
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
/* --- 表格参数 --- */
|
|
488
|
+
tablePropsObj () {
|
|
489
|
+
return {
|
|
490
|
+
// rowStyleOption: {
|
|
491
|
+
// hoverHighlight: true,
|
|
492
|
+
// clickHighlight: true,
|
|
493
|
+
// stripe: true // 斑马纹
|
|
494
|
+
// },
|
|
495
|
+
maxHeight: this.contentHeight,
|
|
496
|
+
// 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
|
|
497
|
+
columnHiddenOption: {
|
|
498
|
+
// defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
|
|
499
|
+
},
|
|
500
|
+
cellStyleOption: {
|
|
501
|
+
bodyCellClass: this.bodyCellClass
|
|
502
|
+
},
|
|
503
|
+
cellSpanOption: {
|
|
504
|
+
bodyCellSpan: this.bodyCellSpan
|
|
505
|
+
},
|
|
506
|
+
eventCustomOption: {
|
|
507
|
+
bodyCellEvents: this.eventCustomOption
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
},
|
|
511
|
+
tableInModalPropsObj () {
|
|
512
|
+
return {
|
|
513
|
+
...this.tablePropsObj,
|
|
514
|
+
maxHeight: undefined
|
|
515
|
+
};
|
|
516
|
+
},
|
|
517
|
+
checkboxOption () {
|
|
518
|
+
return {
|
|
519
|
+
selectedRowKeys: this.selectIds
|
|
520
|
+
};
|
|
521
|
+
},
|
|
522
|
+
|
|
523
|
+
/* --- 联动隐藏 --- */
|
|
524
|
+
showColKeys () {
|
|
525
|
+
return this.showByNumFieldVal != null && this.showByNumFieldVal >= 0
|
|
526
|
+
? this.showOrHideColKeys.slice(0, this.showByNumFieldVal)
|
|
527
|
+
: this.showOrHideColKeys;
|
|
528
|
+
},
|
|
529
|
+
showOrHideColKeys () {
|
|
530
|
+
return this.selfPropsObj._showOrHideColKeys || [];
|
|
531
|
+
},
|
|
532
|
+
// 控制联动隐藏的数字类型字段
|
|
533
|
+
showByNumFieldKey () {
|
|
534
|
+
return this.selfPropsObj._showByNumFieldKey;
|
|
535
|
+
},
|
|
536
|
+
// 控制联动隐藏的数字类型字段的值
|
|
537
|
+
showByNumFieldVal () {
|
|
538
|
+
return this.showByNumFieldKey
|
|
539
|
+
? this.parentObj[this.showByNumFieldKey]
|
|
540
|
+
: undefined;
|
|
541
|
+
},
|
|
542
|
+
|
|
543
|
+
/* --- 显示/隐藏 --- */
|
|
544
|
+
hideColKeys () {
|
|
545
|
+
return this.selfPropsObj._hideColKeys;
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
/* --- 引用 --- */
|
|
549
|
+
isQuote () {
|
|
550
|
+
return this.selfPropsObj._isQuote;
|
|
551
|
+
},
|
|
552
|
+
quoteReadonlyColKeys () {
|
|
553
|
+
return this.selfPropsObj._quoteDisabledColKeys;
|
|
554
|
+
},
|
|
555
|
+
quoteListFields () {
|
|
556
|
+
return this.selfPropsObj._quoteListFields;
|
|
557
|
+
},
|
|
558
|
+
quoteAdvSearch () {
|
|
559
|
+
return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
|
|
560
|
+
},
|
|
561
|
+
quoteParams () {
|
|
562
|
+
return {
|
|
563
|
+
screenKey: this.allScreenKey,
|
|
564
|
+
fields: [
|
|
565
|
+
...this.quoteListFields,
|
|
566
|
+
this.controlKey,
|
|
567
|
+
"createdAt"
|
|
568
|
+
],
|
|
569
|
+
advSearch: {
|
|
570
|
+
logic: "and",
|
|
571
|
+
conditions: [
|
|
572
|
+
{
|
|
573
|
+
fieldKey: "_id",
|
|
574
|
+
fieldOperator: "ne",
|
|
575
|
+
fieldValue: [this.parentDataId]
|
|
576
|
+
},
|
|
577
|
+
this.quoteAdvSearch
|
|
578
|
+
]
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
},
|
|
582
|
+
|
|
583
|
+
/* --- 导入 --- */
|
|
584
|
+
isImport () {
|
|
585
|
+
return this.selfPropsObj._isImport;
|
|
586
|
+
},
|
|
587
|
+
importAsDft () {
|
|
588
|
+
return this.selfPropsObj._importAsDft;
|
|
589
|
+
},
|
|
590
|
+
importParams () {
|
|
591
|
+
return {
|
|
592
|
+
_id: this.parentDataId,
|
|
593
|
+
_key: this.controlKey,
|
|
594
|
+
importType: this.inTableType
|
|
595
|
+
};
|
|
596
|
+
},
|
|
597
|
+
|
|
598
|
+
/* --- 导出 --- */
|
|
599
|
+
isExport () {
|
|
600
|
+
return this.selfPropsObj._isExport;
|
|
601
|
+
},
|
|
602
|
+
exportParams () {
|
|
603
|
+
return {
|
|
604
|
+
screenKey: this.screenKey,
|
|
605
|
+
_id: this.parentDataId,
|
|
606
|
+
_key: this.controlKey,
|
|
607
|
+
flowinst: this.flowInstId,
|
|
608
|
+
advSearch: this.finalTableAdvSearch
|
|
609
|
+
};
|
|
610
|
+
},
|
|
611
|
+
|
|
612
|
+
/* --- 全屏 --- */
|
|
613
|
+
useEnlarge () {
|
|
614
|
+
return this.selfPropsObj._useEnlarge;
|
|
615
|
+
},
|
|
616
|
+
modalPropsObj () {
|
|
617
|
+
return {
|
|
618
|
+
mode: "fullscreen",
|
|
619
|
+
title: this.controlName
|
|
620
|
+
};
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
/* --- 数据 --- */
|
|
624
|
+
// 默认值数据
|
|
625
|
+
defaultListData () {
|
|
626
|
+
const loop = (tree = [], list = []) => {
|
|
627
|
+
return tree.reduce((newList, rowItem) => {
|
|
628
|
+
newList = [...newList, rowItem];
|
|
629
|
+
|
|
630
|
+
return rowItem.children && rowItem.children.length
|
|
631
|
+
? loop(rowItem.children, newList)
|
|
632
|
+
: newList;
|
|
633
|
+
}, list);
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
return ["cascaderTable"].includes(this.controlType)
|
|
637
|
+
? loop(this.selfPropsObj._default.tree)
|
|
638
|
+
: this.selfPropsObj._default.list;
|
|
639
|
+
},
|
|
640
|
+
defaultListDataIds () {
|
|
641
|
+
return this.defaultListData
|
|
642
|
+
.map(rowItem => rowItem._id)
|
|
643
|
+
.filter(id => !!id);
|
|
644
|
+
},
|
|
645
|
+
// 全部数据(或筛选出的数据)-总数
|
|
646
|
+
totalNum () {
|
|
647
|
+
return this.showListData.length;
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
// 新增行的默认值
|
|
651
|
+
selfRowDft () {
|
|
652
|
+
return this.selfColumns.reduce((obj, column) => {
|
|
653
|
+
const dftInRowVal = this.rowDefault[column._key];
|
|
654
|
+
const dftVal = column._default;
|
|
655
|
+
const dftInitVal = this.dftInitValMap[column._type];
|
|
656
|
+
|
|
657
|
+
return Object.assign(obj, {
|
|
658
|
+
[column._key]: dftInRowVal === undefined // 不用isEmptyData判断原因:为空值时可能是故意置空的
|
|
659
|
+
? this.$isEmptyData(dftVal)
|
|
660
|
+
? dftInitVal
|
|
661
|
+
: dftVal
|
|
662
|
+
: dftInRowVal
|
|
663
|
+
});
|
|
664
|
+
}, {});
|
|
665
|
+
},
|
|
666
|
+
parentDataId () {
|
|
667
|
+
return this.parentObj._id;
|
|
668
|
+
},
|
|
669
|
+
// compareListData () {
|
|
670
|
+
// this.compareData.forEach(item => {
|
|
671
|
+
// !item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
672
|
+
// });
|
|
673
|
+
// return this.compareData;
|
|
674
|
+
// },
|
|
675
|
+
// useCampare () {
|
|
676
|
+
// return !!this.compareListData.length;
|
|
677
|
+
// },
|
|
678
|
+
changedCols () {
|
|
679
|
+
return [];
|
|
680
|
+
},
|
|
681
|
+
|
|
682
|
+
/* --- 功能按钮 --- */
|
|
683
|
+
baseOperationBtns () {
|
|
684
|
+
return Object.keys(this.baseOperationMap);
|
|
685
|
+
},
|
|
686
|
+
otherOperationBtns () {
|
|
687
|
+
return Object.keys(this.otherOperationMap);
|
|
688
|
+
},
|
|
689
|
+
topOperationBtns () {
|
|
690
|
+
return Object.keys(this.topOperationMap);
|
|
691
|
+
},
|
|
692
|
+
allOperationMap () {
|
|
693
|
+
return {
|
|
694
|
+
...(this.baseOperationMap || {}),
|
|
695
|
+
...(this.otherOperationMap || {}),
|
|
696
|
+
...(this.topOperationMap || {}),
|
|
697
|
+
|
|
698
|
+
canCreate: {
|
|
699
|
+
...this.baseOperationMap.canCreate,
|
|
700
|
+
name: this.showMode === "form"
|
|
701
|
+
? this.baseOperationMap.canCreate.name.replace("行", "条")
|
|
702
|
+
: this.baseOperationMap.canCreate.name,
|
|
703
|
+
tip: this.showMode === "form"
|
|
704
|
+
? this.baseOperationMap.canCreate.tip.replace("行", "条")
|
|
705
|
+
: this.baseOperationMap.canCreate.tip
|
|
706
|
+
},
|
|
707
|
+
canInsert: {
|
|
708
|
+
...this.baseOperationMap.canInsert,
|
|
709
|
+
name: this.showMode === "form"
|
|
710
|
+
? this.baseOperationMap.canInsert.name.replace("行", "条")
|
|
711
|
+
: this.baseOperationMap.canInsert.name,
|
|
712
|
+
tip: this.showMode === "form"
|
|
713
|
+
? this.baseOperationMap.canInsert.tip.replace("行", "条")
|
|
714
|
+
: this.baseOperationMap.canInsert.tip
|
|
715
|
+
},
|
|
716
|
+
canHideOrShow: {
|
|
717
|
+
...this.topOperationMap.canHideOrShow,
|
|
718
|
+
name: this.hideStatus ? "显示字段" : "隐藏字段"
|
|
719
|
+
},
|
|
720
|
+
|
|
721
|
+
...(this.selfAllOperationMap || {})
|
|
722
|
+
};
|
|
723
|
+
},
|
|
724
|
+
operationMap () {
|
|
725
|
+
return this.$categoryMapToMap(
|
|
726
|
+
this.allOperationMap,
|
|
727
|
+
undefined,
|
|
728
|
+
undefined,
|
|
729
|
+
[
|
|
730
|
+
...(
|
|
731
|
+
this.canEdit
|
|
732
|
+
? [
|
|
733
|
+
...(this.disabledBtns ? [] : this.baseOperationBtns),
|
|
734
|
+
...this.otherOperationBtns,
|
|
735
|
+
...(this.isQuote ? ["canQuote"] : []),
|
|
736
|
+
...(this.isImport ? ["canImport"] : [])
|
|
737
|
+
]
|
|
738
|
+
: []
|
|
739
|
+
),
|
|
740
|
+
...(this.isExport ? ["canExport"] : []),
|
|
741
|
+
...(this.useEnlarge ? ["canEnlarge"] : []),
|
|
742
|
+
...(this.hideColKeys.length ? ["canHideOrShow"] : [])
|
|
743
|
+
]
|
|
744
|
+
);
|
|
745
|
+
},
|
|
746
|
+
rowOperationList () {
|
|
747
|
+
const btns = [
|
|
748
|
+
...(this.useInsertInOperationCol ? ["canInsert"] : []),
|
|
749
|
+
"canDelete"
|
|
750
|
+
];
|
|
751
|
+
return this.$getOperationList(btns);
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
watch: {
|
|
755
|
+
isEnlarge (bool) {
|
|
756
|
+
setTimeout(() => {
|
|
757
|
+
this.isEnlargeFlag = bool;
|
|
758
|
+
// this.dealingOpenModal && this.dealingOpenModal();
|
|
759
|
+
}, 0);
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
created () {
|
|
763
|
+
this.baseInit();
|
|
764
|
+
},
|
|
765
|
+
methods: {
|
|
766
|
+
baseInit () {
|
|
767
|
+
this.dftAdvSearch = {
|
|
768
|
+
logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
|
|
769
|
+
conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
|
|
770
|
+
this.searchListFields.includes(conditionItem.fieldKey)
|
|
771
|
+
)
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
this.loadingFunc();
|
|
775
|
+
},
|
|
776
|
+
|
|
777
|
+
// 共外部使用
|
|
778
|
+
validate () {
|
|
779
|
+
// this.showRuleMessage = true;
|
|
780
|
+
// return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
|
|
781
|
+
|
|
782
|
+
let bool = true;
|
|
783
|
+
this.allListData.forEach((row, rowIndex) => {
|
|
784
|
+
const resultBool = this.getRowRuleResult(row, rowIndex);
|
|
785
|
+
|
|
786
|
+
if (resultBool === false) {
|
|
787
|
+
bool = false;
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
return bool;
|
|
792
|
+
},
|
|
793
|
+
// 重置
|
|
794
|
+
reset () {
|
|
795
|
+
this.initFlag = true;
|
|
796
|
+
this.isExpandAction = false;
|
|
797
|
+
// this.showRuleMessage = false;
|
|
798
|
+
|
|
799
|
+
this.idRecordMap = {};
|
|
800
|
+
// this.hoverRecordMap = {};
|
|
801
|
+
this.ruleRecordMap = {};
|
|
802
|
+
|
|
803
|
+
this.dftAdvSearch = {
|
|
804
|
+
logic: "and",
|
|
805
|
+
conditions: []
|
|
806
|
+
};
|
|
807
|
+
this.hideStatus = true;
|
|
808
|
+
|
|
809
|
+
this.changePage && this.changePage(1);
|
|
810
|
+
this.selfReset && this.selfReset();
|
|
811
|
+
},
|
|
812
|
+
loadingFunc () {
|
|
813
|
+
this.isLoading = true;
|
|
814
|
+
this.changeSelect();
|
|
815
|
+
|
|
816
|
+
setTimeout(() => {
|
|
817
|
+
this.isLoading = false;
|
|
818
|
+
});
|
|
819
|
+
},
|
|
820
|
+
|
|
821
|
+
// 筛选回调
|
|
822
|
+
searchCb (conditions) {
|
|
823
|
+
if (this.parentObj.__isCreate__ !== true) {
|
|
824
|
+
this.isExpandAction = false;
|
|
825
|
+
this.dftAdvSearch.conditions = conditions;
|
|
826
|
+
|
|
827
|
+
this.changePage && this.changePage(1);
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
// 列表选择项改变 (!!!外部在使用)
|
|
831
|
+
changeSelect (selections = [], ...params) {
|
|
832
|
+
this.selectIds = selections.map(item => item._id);
|
|
833
|
+
this.$emit("changeSelect", this.selectIds, selections, ...params);
|
|
834
|
+
},
|
|
835
|
+
|
|
836
|
+
// 输入框失去焦点
|
|
837
|
+
controlBlur (operationItem, row, rowIndex, column, params) {
|
|
838
|
+
this.dealRuleRecord(row, column);
|
|
839
|
+
},
|
|
840
|
+
// 输入框值改变立即
|
|
841
|
+
quickChangeVal (operationItem, row, rowIndex, column, params) {
|
|
842
|
+
if (["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
|
|
843
|
+
this.dealRuleRecord(row, column);
|
|
844
|
+
this.change("quickChangeVal", row, rowIndex, column, ...params);
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
// 输入框值改变
|
|
848
|
+
changeVal (operationItem, row, rowIndex, column, params) {
|
|
849
|
+
if (!["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
|
|
850
|
+
this.dealRuleRecord(row, column);
|
|
851
|
+
this.change("changeVal", row, rowIndex, column, ...params);
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
change (eventType, row, rowIndex, column, ...params) {
|
|
855
|
+
this.$emit("change", this.tableDataObj, eventType, column, row, rowIndex, ...params);
|
|
856
|
+
},
|
|
857
|
+
|
|
858
|
+
/* ----------- 隐藏/显示字段 ---------- */
|
|
859
|
+
toggleHideOrShow () {
|
|
860
|
+
// if (this.$refs.briTable) {
|
|
861
|
+
// if (this.hideStatus === true) {
|
|
862
|
+
// this.$refs.briTable.showColumnsByKeys(this.hideColKeys);
|
|
863
|
+
// } else {
|
|
864
|
+
// this.$refs.briTable.hideColumnsByKeys(this.hideColKeys);
|
|
865
|
+
// }
|
|
866
|
+
// }
|
|
867
|
+
|
|
868
|
+
this.hideStatus = !this.hideStatus;
|
|
869
|
+
},
|
|
870
|
+
|
|
871
|
+
/* ----------- 引用 ---------- */
|
|
872
|
+
// 点击引用
|
|
873
|
+
clickQuote () {
|
|
874
|
+
this.dshRenderName = "quoteModalRender";
|
|
875
|
+
this.showQuoteModal = true;
|
|
876
|
+
},
|
|
877
|
+
// 引用模态框渲染函数
|
|
878
|
+
quoteModalRender (h, params) {
|
|
879
|
+
return this.showQuoteModal
|
|
880
|
+
? h("quote-list-modal", {
|
|
881
|
+
props: {
|
|
882
|
+
value: this.showQuoteModal,
|
|
883
|
+
propsObj: this.propsObj,
|
|
884
|
+
listParams: this.quoteParams
|
|
885
|
+
},
|
|
886
|
+
on: {
|
|
887
|
+
input: bool => {
|
|
888
|
+
this.showQuoteModal = bool;
|
|
889
|
+
},
|
|
890
|
+
confirm: this.quoteCb
|
|
891
|
+
}
|
|
892
|
+
})
|
|
893
|
+
: undefined;
|
|
894
|
+
},
|
|
895
|
+
// 引用回调
|
|
896
|
+
quoteCb (dataObj) {
|
|
897
|
+
if (dataObj) {
|
|
898
|
+
const fieldVal = dataObj[this.controlKey];
|
|
899
|
+
const isEmpty = this.$isEmptyData(fieldVal) || (
|
|
900
|
+
["cascaderTable"].includes(this.controlType)
|
|
901
|
+
? !fieldVal.tree || !fieldVal.tree.length
|
|
902
|
+
: ["flatTable"].includes(this.controlType)
|
|
903
|
+
? !fieldVal.list || !fieldVal.list.length
|
|
904
|
+
: false
|
|
905
|
+
);
|
|
906
|
+
|
|
907
|
+
if (isEmpty) {
|
|
908
|
+
this.$Modal.confirm({
|
|
909
|
+
title: "提示",
|
|
910
|
+
content: "该数据下此内容为空,无法引用!",
|
|
911
|
+
onOk: () => { }
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
if (["cascaderTable"].includes(this.controlType)) {
|
|
916
|
+
const transformData = (list = []) => {
|
|
917
|
+
const loop = (list = []) =>
|
|
918
|
+
list.map(item => ({
|
|
919
|
+
...item,
|
|
920
|
+
children: item.children ? loop(item.children) : item.children,
|
|
921
|
+
__isQuote__: true,
|
|
922
|
+
__old__: false
|
|
923
|
+
}));
|
|
924
|
+
|
|
925
|
+
return loop(list);
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
this.parentObj[this.controlKey] = {
|
|
929
|
+
...fieldVal,
|
|
930
|
+
tree: transformData(fieldVal.tree)
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
else if (["flatTable"].includes(this.controlType)) {
|
|
934
|
+
this.parentObj[this.controlKey] = {
|
|
935
|
+
...fieldVal,
|
|
936
|
+
list: fieldVal.list.map(item => ({
|
|
937
|
+
...item,
|
|
938
|
+
__isQuote__: true,
|
|
939
|
+
__old__: false
|
|
940
|
+
}))
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
this.$Message.success("引用成功!");
|
|
945
|
+
this.reset();
|
|
946
|
+
this.showTopSearch = false;
|
|
947
|
+
this.$nextTick(() => {
|
|
948
|
+
this.showTopSearch = true;
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
this.change("quote");
|
|
952
|
+
}
|
|
953
|
+
} else {
|
|
954
|
+
this.$Message.error("未选择引用数据!");
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
|
|
958
|
+
/* ----------- 导入 ---------- */
|
|
959
|
+
// 点击导入
|
|
960
|
+
clickImport () {
|
|
961
|
+
this.dshRenderName = "importModalRender";
|
|
962
|
+
this.showImportModal = true;
|
|
963
|
+
},
|
|
964
|
+
// 导入模态框渲染函数
|
|
965
|
+
importModalRender (h, params) {
|
|
966
|
+
return this.showImportModal
|
|
967
|
+
? h("import-modal", {
|
|
968
|
+
props: {
|
|
969
|
+
value: this.showImportModal,
|
|
970
|
+
propsObj: this.propsObj,
|
|
971
|
+
importParams: this.importParams
|
|
972
|
+
},
|
|
973
|
+
on: {
|
|
974
|
+
input: bool => {
|
|
975
|
+
this.showImportModal = bool;
|
|
976
|
+
},
|
|
977
|
+
importCb: this.importCb
|
|
978
|
+
}
|
|
979
|
+
})
|
|
980
|
+
: undefined;
|
|
981
|
+
},
|
|
982
|
+
// 导入回调
|
|
983
|
+
importCb (dataObj) {
|
|
984
|
+
const fieldVal = dataObj;
|
|
985
|
+
if (this.importAsDft) {
|
|
986
|
+
if (["cascaderTable"].includes(this.controlType)) {
|
|
987
|
+
const transformData = (list = []) => {
|
|
988
|
+
const loop = (list = []) =>
|
|
989
|
+
list.map(item => ({
|
|
990
|
+
...item,
|
|
991
|
+
children: item.children ? loop(item.children) : item.children,
|
|
992
|
+
__isDefault__: true,
|
|
993
|
+
__old__: false
|
|
994
|
+
}));
|
|
995
|
+
|
|
996
|
+
return loop(list);
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
this.parentObj[this.controlKey] = {
|
|
1000
|
+
...fieldVal,
|
|
1001
|
+
tree: transformData(fieldVal.tree)
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
else if (["flatTable"].includes(this.controlType)) {
|
|
1005
|
+
this.parentObj[this.controlKey] = {
|
|
1006
|
+
...fieldVal,
|
|
1007
|
+
list: fieldVal.list.map(item => ({
|
|
1008
|
+
...item,
|
|
1009
|
+
__isDefault__: true,
|
|
1010
|
+
__old__: false
|
|
1011
|
+
}))
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
} else {
|
|
1015
|
+
this.parentObj[this.controlKey] = dataObj;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// 因为data和rowspanMap不马上更新
|
|
1019
|
+
this.$nextTick(() => {
|
|
1020
|
+
this.reset();
|
|
1021
|
+
this.change("import");
|
|
1022
|
+
});
|
|
1023
|
+
},
|
|
1024
|
+
|
|
1025
|
+
/* ----------- 导出 ---------- */
|
|
1026
|
+
// 点击导出
|
|
1027
|
+
clickExport (operationItem) {
|
|
1028
|
+
this.handleExport(operationItem);
|
|
1029
|
+
},
|
|
1030
|
+
// 接口 -导出
|
|
1031
|
+
handleExport (operationItem) {
|
|
1032
|
+
operationItem.disabled = true;
|
|
1033
|
+
|
|
1034
|
+
this.$https({
|
|
1035
|
+
url: {
|
|
1036
|
+
module: "sheet",
|
|
1037
|
+
name: ["cascaderTable"].includes(this.controlType) ? "exportCascaderTableExcel" : "exportFlatTableExcel"
|
|
1038
|
+
},
|
|
1039
|
+
params: this.exportParams,
|
|
1040
|
+
callback: data => {
|
|
1041
|
+
this.getJobStatus(operationItem, data.jobId, data.excel_url);
|
|
1042
|
+
this.exportTimer = setInterval(() => {
|
|
1043
|
+
this.getJobStatus(operationItem, data.jobId, data.excel_url);
|
|
1044
|
+
}, 1000);
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
},
|
|
1048
|
+
// 接口 -获取导出地址
|
|
1049
|
+
getJobStatus (operationItem, id, url) {
|
|
1050
|
+
this.$https({
|
|
1051
|
+
url: {
|
|
1052
|
+
module: "sheet",
|
|
1053
|
+
name: "getJobStatus"
|
|
1054
|
+
},
|
|
1055
|
+
params: {
|
|
1056
|
+
jobId: id
|
|
1057
|
+
},
|
|
1058
|
+
callback: data => {
|
|
1059
|
+
if (data.status === "completed") {
|
|
1060
|
+
operationItem.disabled = false;
|
|
1061
|
+
clearInterval(this.exportTimer);
|
|
1062
|
+
window.location.href = data.url;
|
|
1063
|
+
} else if (data.status === "failed") {
|
|
1064
|
+
this.$Message.info({
|
|
1065
|
+
content: "操作失败,请稍后再试!"
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
error: res => {
|
|
1070
|
+
operationItem.disabled = false;
|
|
1071
|
+
this.exportTimer = null;
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
/* ----------- 全屏 ---------- */
|
|
1077
|
+
// 打开全屏模态框
|
|
1078
|
+
clickEnlarge (operationItem) {
|
|
1079
|
+
this.isEnlarge = true;
|
|
1080
|
+
},
|
|
1081
|
+
|
|
1082
|
+
/* ----------- 渲染函数(声明:为了代码更加规范清晰,return的是h相关的函数,则函数名get开头;return的是h的直接调用,函数名不要get开头)---------- */
|
|
1083
|
+
getTableTopRender (inEnlarge = false) {
|
|
1084
|
+
return (h, params) => {
|
|
1085
|
+
return h("div", {
|
|
1086
|
+
style: {
|
|
1087
|
+
"margin-bottom": "3px",
|
|
1088
|
+
"display": "flex",
|
|
1089
|
+
"flex-direction": "row",
|
|
1090
|
+
"justify-content": "space-between",
|
|
1091
|
+
"align-items": "center"
|
|
1092
|
+
}
|
|
1093
|
+
}, [
|
|
1094
|
+
// 左 -统计,逻辑
|
|
1095
|
+
this.topSummaryRender(h),
|
|
1096
|
+
|
|
1097
|
+
// 右 -功能按钮
|
|
1098
|
+
this.topOperationRender(h, inEnlarge)
|
|
1099
|
+
]);
|
|
1100
|
+
};
|
|
1101
|
+
},
|
|
1102
|
+
topSummaryRender (h) {
|
|
1103
|
+
return this.searchFormList.length
|
|
1104
|
+
? h("div", {
|
|
1105
|
+
style: {
|
|
1106
|
+
"display": "flex",
|
|
1107
|
+
"flex-direction": "row",
|
|
1108
|
+
"align-items": "center"
|
|
1109
|
+
}
|
|
1110
|
+
}, [
|
|
1111
|
+
h("span", {
|
|
1112
|
+
style: {
|
|
1113
|
+
"font-weight": "500"
|
|
1114
|
+
}
|
|
1115
|
+
}, this.searchTitle),
|
|
1116
|
+
|
|
1117
|
+
h("div", {
|
|
1118
|
+
style: {
|
|
1119
|
+
"display": "flex",
|
|
1120
|
+
"flex-direction": "row",
|
|
1121
|
+
"align-items": "center",
|
|
1122
|
+
"margin-left": "12px"
|
|
1123
|
+
}
|
|
1124
|
+
}, [
|
|
1125
|
+
h("div", {
|
|
1126
|
+
style: {
|
|
1127
|
+
"font-weight": "500"
|
|
1128
|
+
}
|
|
1129
|
+
}, this.selfLogicPropsObj._name + ":"),
|
|
1130
|
+
|
|
1131
|
+
h("dsh-select", {
|
|
1132
|
+
style: {
|
|
1133
|
+
"margin-left": "8px",
|
|
1134
|
+
"margin-top": "-4px"
|
|
1135
|
+
},
|
|
1136
|
+
props: {
|
|
1137
|
+
value: this.dftAdvSearch,
|
|
1138
|
+
propsObj: this.selfLogicPropsObj
|
|
1139
|
+
}
|
|
1140
|
+
})
|
|
1141
|
+
])
|
|
1142
|
+
])
|
|
1143
|
+
: h("div", "");
|
|
1144
|
+
},
|
|
1145
|
+
// 全屏里不显示功能按钮
|
|
1146
|
+
topOperationRender (h, inEnlarge) {
|
|
1147
|
+
return inEnlarge
|
|
1148
|
+
? undefined
|
|
1149
|
+
: h("dsh-buttons", {
|
|
1150
|
+
style: {
|
|
1151
|
+
"text-align": "right"
|
|
1152
|
+
},
|
|
1153
|
+
props: {
|
|
1154
|
+
itemClass: undefined,
|
|
1155
|
+
list: this.$getOperationList(this.topOperationBtns)
|
|
1156
|
+
},
|
|
1157
|
+
on: {
|
|
1158
|
+
click: (event) => {
|
|
1159
|
+
this.$dispatchEvent(event);
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
nativeOn: {
|
|
1163
|
+
click: (e) => {
|
|
1164
|
+
e.stopPropagation();
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
},
|
|
1169
|
+
topSearchRender (h) {
|
|
1170
|
+
return this.searchFormList.length
|
|
1171
|
+
? h("dsh-default-search", {
|
|
1172
|
+
props: {
|
|
1173
|
+
formList: this.searchFormList,
|
|
1174
|
+
initValue: this.dftAdvSearch.conditions,
|
|
1175
|
+
labelWidth: this.searchLabelWidth
|
|
1176
|
+
},
|
|
1177
|
+
on: {
|
|
1178
|
+
change: this.searchCb
|
|
1179
|
+
}
|
|
1180
|
+
})
|
|
1181
|
+
: undefined;
|
|
1182
|
+
},
|
|
1183
|
+
createBtnRender (h) {
|
|
1184
|
+
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
1185
|
+
? h("dsh-buttons", {
|
|
1186
|
+
style: {
|
|
1187
|
+
"margin-top": "3px"
|
|
1188
|
+
},
|
|
1189
|
+
props: {
|
|
1190
|
+
itemClass: undefined,
|
|
1191
|
+
list: this.$getOperationList(["canCreate"])
|
|
1192
|
+
},
|
|
1193
|
+
on: {
|
|
1194
|
+
click: (event) => {
|
|
1195
|
+
this.$dispatchEvent(event);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
})
|
|
1199
|
+
: undefined;
|
|
1200
|
+
},
|
|
1201
|
+
contentThCellRender (h, { column }) {
|
|
1202
|
+
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
1203
|
+
// console.log(column._name);
|
|
1204
|
+
|
|
1205
|
+
return this.$getHeadRender(h, column, {
|
|
1206
|
+
showRequired: this.showRequired,
|
|
1207
|
+
showDescription: this.showDescription,
|
|
1208
|
+
headHeightAuto: this.headHeightAuto
|
|
1209
|
+
});
|
|
1210
|
+
},
|
|
1211
|
+
contentTdCellRender (h, { row, rowIndex, column }) {
|
|
1212
|
+
// console.log(rowIndex);
|
|
1213
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1214
|
+
column = this.getResetCol({ row, rowIndex, column });
|
|
1215
|
+
const unitCanEdit = this.getUnitCanEdit({ row, rowIndex, column });
|
|
1216
|
+
const ruleResultObj = this.getColRuleResult({ row, rowIndex, column });
|
|
1217
|
+
|
|
1218
|
+
return [
|
|
1219
|
+
// this.isShowCompare({ row, rowIndex, column })
|
|
1220
|
+
// ? h("Tooltip", {
|
|
1221
|
+
// style: {
|
|
1222
|
+
// width: "100%"
|
|
1223
|
+
// },
|
|
1224
|
+
// props: {
|
|
1225
|
+
// content: this.$isEmptyData(this.compareListData[rowIndex][column._key]) ? "" : this.compareListData[rowIndex][column._key],
|
|
1226
|
+
// transfer: true,
|
|
1227
|
+
// maxWidth: 200,
|
|
1228
|
+
// placement: "top"
|
|
1229
|
+
// },
|
|
1230
|
+
// scopedSlots: {
|
|
1231
|
+
// default: props => h("dsh-list-unit", {
|
|
1232
|
+
// props: {
|
|
1233
|
+
// canEdit: unitCanEdit,
|
|
1234
|
+
// formData: row,
|
|
1235
|
+
// formItem: {
|
|
1236
|
+
// ...column,
|
|
1237
|
+
// _key: column.colType === "tree" ? "name" : column._key
|
|
1238
|
+
// },
|
|
1239
|
+
// allFormList: this.selfColumns,
|
|
1240
|
+
// inTableType: this.inTableType,
|
|
1241
|
+
// allListRows: this.allListData,
|
|
1242
|
+
// rowIndex: rowIndex,
|
|
1243
|
+
// parentFormList: this.parentFormList,
|
|
1244
|
+
// parentObj: this.parentObj
|
|
1245
|
+
// },
|
|
1246
|
+
// on: {
|
|
1247
|
+
// blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1248
|
+
// quickChange: () => this.$dispatchEvent(this.operationMap.canQuickChangeVal, row, rowIndex, column, arguments),
|
|
1249
|
+
// change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
|
|
1250
|
+
// }
|
|
1251
|
+
// })
|
|
1252
|
+
// }
|
|
1253
|
+
// })
|
|
1254
|
+
h("dsh-list-unit", {
|
|
1255
|
+
key: `${row._id}--${column._key}`,
|
|
1256
|
+
props: {
|
|
1257
|
+
canEdit: unitCanEdit,
|
|
1258
|
+
formData: row,
|
|
1259
|
+
formItem: {
|
|
1260
|
+
...column,
|
|
1261
|
+
_key: column.colType === "tree" ? "name" : column._key
|
|
1262
|
+
},
|
|
1263
|
+
allFormList: this.selfColumns,
|
|
1264
|
+
changedCols: this.changedCols,
|
|
1265
|
+
changedFields: (row.__changed__ || []).map(item => item.fieldKey),
|
|
1266
|
+
inTableType: this.inTableType,
|
|
1267
|
+
allListRows: this.allListData,
|
|
1268
|
+
rowIndex: rowIndex,
|
|
1269
|
+
parentFormList: this.parentFormList,
|
|
1270
|
+
parentObj: this.parentObj
|
|
1271
|
+
},
|
|
1272
|
+
on: {
|
|
1273
|
+
blur: () => this.controlBlur(null, row, rowIndex, column, arguments),
|
|
1274
|
+
quickChange: () => this.$dispatchEvent(this.operationMap.canQuickChangeVal, row, rowIndex, column, arguments),
|
|
1275
|
+
change: () => this.$dispatchEvent(this.operationMap.canChangeVal, row, rowIndex, column, arguments)
|
|
1276
|
+
}
|
|
1277
|
+
}),
|
|
1278
|
+
|
|
1279
|
+
// 校验文字
|
|
1280
|
+
!ruleResultObj.bool
|
|
1281
|
+
? h("span", {
|
|
1282
|
+
class: "bri-table-td-tip"
|
|
1283
|
+
}, ruleResultObj.message)
|
|
1284
|
+
: undefined,
|
|
1285
|
+
|
|
1286
|
+
// 添加符
|
|
1287
|
+
...this.operationIconRender(h, { row, rowIndex, column }, 12)
|
|
1288
|
+
];
|
|
1289
|
+
},
|
|
1290
|
+
operationTdCellRender (h, { row, rowIndex, column }) {
|
|
1291
|
+
const operationList = this.rowOperationList.map(btnItem => ({
|
|
1292
|
+
...btnItem,
|
|
1293
|
+
disabled: btnItem.type === "canDelete"
|
|
1294
|
+
? !this.getRowDelBtnCanEdit(row, rowIndex)
|
|
1295
|
+
: btnItem.disabled
|
|
1296
|
+
}));
|
|
1297
|
+
|
|
1298
|
+
return [
|
|
1299
|
+
h("dsh-buttons", {
|
|
1300
|
+
props: {
|
|
1301
|
+
list: operationList
|
|
1302
|
+
},
|
|
1303
|
+
on: {
|
|
1304
|
+
click: (operationItem) => {
|
|
1305
|
+
this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
})
|
|
1309
|
+
];
|
|
1310
|
+
},
|
|
1311
|
+
operationIconRender (h, { row, rowIndex, column }, iconSize = 14) {
|
|
1312
|
+
const baseBool = !this.isSearching &&
|
|
1313
|
+
(this.showCreateBtnColKeys.length ? this.showCreateBtnColKeys.includes(column._key) : ["__index__", "__treeIndex__"].includes(column._key));
|
|
1314
|
+
// this.hoverRecordMap[`${row._id}`];
|
|
1315
|
+
|
|
1316
|
+
return [
|
|
1317
|
+
// 插入一行图标
|
|
1318
|
+
baseBool
|
|
1319
|
+
? this.getOperationIconRender(h, { row, rowIndex, column }, "canInsert", iconSize)
|
|
1320
|
+
: h("span", ""),
|
|
1321
|
+
|
|
1322
|
+
// 添加一行下级图标
|
|
1323
|
+
baseBool &&
|
|
1324
|
+
row.level < this.maxLevel &&
|
|
1325
|
+
!["cascaderTable"].includes(this.inTableType) // 老版级联表格类型不要“添加下级”图标
|
|
1326
|
+
? this.getOperationIconRender(h, { row, rowIndex, column }, "canCreateChild", iconSize, true)
|
|
1327
|
+
: h("span", ""),
|
|
1328
|
+
|
|
1329
|
+
// 删除该行图标
|
|
1330
|
+
baseBool &&
|
|
1331
|
+
this.getRowDelBtnCanEdit(row, rowIndex) &&
|
|
1332
|
+
["cascaderTable"].includes(this.inTableType)
|
|
1333
|
+
? this.getOperationIconRender(h, { row, rowIndex, column }, "canDelete", iconSize, true)
|
|
1334
|
+
: h("span", "")
|
|
1335
|
+
];
|
|
1336
|
+
},
|
|
1337
|
+
getOperationIconRender (h, { row, rowIndex, column }, operationType, iconSize = 14, isLeft = false) {
|
|
1338
|
+
const operationItem = this.operationMap[operationType];
|
|
1339
|
+
|
|
1340
|
+
return operationItem && operationItem.disabled !== true
|
|
1341
|
+
? h("div", {
|
|
1342
|
+
class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
|
|
1343
|
+
style: {
|
|
1344
|
+
position: "absolute",
|
|
1345
|
+
bottom: "0px",
|
|
1346
|
+
right: isLeft ? `${iconSize + 3}px` : "0px",
|
|
1347
|
+
width: `${iconSize + 2}px`,
|
|
1348
|
+
height: `${iconSize + 2}px`,
|
|
1349
|
+
borderRadius: "2px",
|
|
1350
|
+
backgroundColor: "#ffffff",
|
|
1351
|
+
lineHeight: `${iconSize - 2}px`,
|
|
1352
|
+
cursor: "pointer",
|
|
1353
|
+
verticalAlign: "middle",
|
|
1354
|
+
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
1355
|
+
}
|
|
1356
|
+
}, [
|
|
1357
|
+
h("Tooltip", {
|
|
1358
|
+
props: {
|
|
1359
|
+
content: operationItem.tip,
|
|
1360
|
+
maxWidth: "250",
|
|
1361
|
+
transfer: true
|
|
1362
|
+
}
|
|
1363
|
+
}, [
|
|
1364
|
+
h("Icon", {
|
|
1365
|
+
class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
|
|
1366
|
+
style: {
|
|
1367
|
+
fontWeight: "500"
|
|
1368
|
+
},
|
|
1369
|
+
props: {
|
|
1370
|
+
type: operationItem.icon,
|
|
1371
|
+
size: iconSize
|
|
1372
|
+
},
|
|
1373
|
+
on: {
|
|
1374
|
+
click: () => {
|
|
1375
|
+
this.$dispatchEvent(operationItem, row, rowIndex, column);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
})
|
|
1379
|
+
])
|
|
1380
|
+
])
|
|
1381
|
+
: h("span", "");
|
|
1382
|
+
},
|
|
1383
|
+
bodyCellClass ({ row, rowIndex, column }) {
|
|
1384
|
+
return "bri-table-td" +
|
|
1385
|
+
`${["__treeIndex__"].includes(column._key)
|
|
1386
|
+
? " bri-table-td-treeIndex"
|
|
1387
|
+
: this.getRowCanEdit(row, rowIndex)
|
|
1388
|
+
? " bri-table-td-edit"
|
|
1389
|
+
: ""
|
|
1390
|
+
}` +
|
|
1391
|
+
`${this.isExpandAction
|
|
1392
|
+
? " bri-table-td-visible"
|
|
1393
|
+
: ""
|
|
1394
|
+
}` +
|
|
1395
|
+
`${this.noborderColKeys.includes(column._key)
|
|
1396
|
+
? " bri-table-td-noborder"
|
|
1397
|
+
: ""
|
|
1398
|
+
}` +
|
|
1399
|
+
`${this.bgColKeys.includes(column._key)
|
|
1400
|
+
? " bri-table-td-bg"
|
|
1401
|
+
: ""
|
|
1402
|
+
}`;
|
|
1403
|
+
},
|
|
1404
|
+
eventCustomOption ({ row, rowIndex, column }) {
|
|
1405
|
+
return {
|
|
1406
|
+
click: (event) => {
|
|
1407
|
+
|
|
1408
|
+
},
|
|
1409
|
+
dblclick: (event) => {
|
|
1410
|
+
|
|
1411
|
+
},
|
|
1412
|
+
contextmenu: (event) => {
|
|
1413
|
+
|
|
1414
|
+
},
|
|
1415
|
+
mouseenter: (event) => {
|
|
1416
|
+
// this.$set(this.hoverRecordMap, `${row._id}`, true);
|
|
1417
|
+
},
|
|
1418
|
+
mouseleave: (event) => {
|
|
1419
|
+
// this.$set(this.hoverRecordMap, `${row._id}`, false);
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
},
|
|
1423
|
+
|
|
1424
|
+
/* ----------- 方法 ---------- */
|
|
1425
|
+
// 整行校验结果
|
|
1426
|
+
getRowRuleResult (row, rowIndex) {
|
|
1427
|
+
// return this.usedColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
|
|
1428
|
+
|
|
1429
|
+
let bool = true;
|
|
1430
|
+
this.usedColumns.forEach(column => {
|
|
1431
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1432
|
+
|
|
1433
|
+
const resultObj = this.getColRuleResultObj({ row, rowIndex, column });
|
|
1434
|
+
if (!resultObj.bool) {
|
|
1435
|
+
bool = false;
|
|
1436
|
+
this.dealRuleRecord(row, column);
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
return bool;
|
|
1441
|
+
},
|
|
1442
|
+
getRowFormList (row, rowIndex) {
|
|
1443
|
+
return this.selfColumns.map(column => {
|
|
1444
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1445
|
+
const unitCanEdit = this.getColCanEdit({ row, rowIndex, column });
|
|
1446
|
+
|
|
1447
|
+
return {
|
|
1448
|
+
...column,
|
|
1449
|
+
canEdit: unitCanEdit
|
|
1450
|
+
};
|
|
1451
|
+
});
|
|
1452
|
+
},
|
|
1453
|
+
// 是否默认行
|
|
1454
|
+
getIsDftRow (row, rowIndex) {
|
|
1455
|
+
return this.isDftSet ? false : row.__isDefault__;
|
|
1456
|
+
},
|
|
1457
|
+
// 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
|
|
1458
|
+
getRowDelBtnCanEdit (row, rowIndex) {
|
|
1459
|
+
return row.__readonly__ !== true && // 不能为只读数据
|
|
1460
|
+
(this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
|
|
1461
|
+
(this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据可删除
|
|
1462
|
+
},
|
|
1463
|
+
// 行内容是否可编辑
|
|
1464
|
+
getRowCanEdit (row, rowIndex) {
|
|
1465
|
+
return this.canEdit && // 是编辑状态
|
|
1466
|
+
(this.getIsDftRow(row) ? !this.dftReadonly : true) && // 默认数据可编辑
|
|
1467
|
+
(row.__old__ === true ? !this.oldReadonly : true) && // 老数据可编辑
|
|
1468
|
+
row.__readonly__ !== true; // 不能为只读数据
|
|
1469
|
+
},
|
|
1470
|
+
|
|
1471
|
+
// 单元格校验结果
|
|
1472
|
+
getColRuleResult ({ row, rowIndex, column }) {
|
|
1473
|
+
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
1474
|
+
|
|
1475
|
+
// 未触发校验时 不显示错误
|
|
1476
|
+
// return this.ruleRecordMap[this.getMixKey(row, column)] || this.showRuleMessage
|
|
1477
|
+
return this.ruleRecordMap[this.getMixKey(row, column)]
|
|
1478
|
+
? this.getColRuleResultObj({ row, rowIndex, column })
|
|
1479
|
+
: {
|
|
1480
|
+
bool: true,
|
|
1481
|
+
message: "未触发校验,通过!"
|
|
1482
|
+
};
|
|
1483
|
+
},
|
|
1484
|
+
// 获取单元格校验对象
|
|
1485
|
+
getColRuleResultObj ({ row, rowIndex, column }) {
|
|
1486
|
+
// 校验必填不通过 => 校验对比
|
|
1487
|
+
const resultObj = {};
|
|
1488
|
+
this.$getFieldRuleResult(column, row, resultObj) &&
|
|
1489
|
+
this.$normalComparedFunc(column, row, this.selfColumns, this.parentObj, this.parentFormList, this.inTableType, resultObj) &&
|
|
1490
|
+
this.$levelComparedFunc(column, row, this.allListData, this.inTableType, resultObj);
|
|
1491
|
+
|
|
1492
|
+
return resultObj;
|
|
1493
|
+
},
|
|
1494
|
+
// 加工单元格对应的配置
|
|
1495
|
+
getResetCol ({ row, rowIndex, column }) {
|
|
1496
|
+
return {
|
|
1497
|
+
// isShare: this.isShare,
|
|
1498
|
+
...column,
|
|
1499
|
+
_heightAuto: this.heightAuto,
|
|
1500
|
+
...(
|
|
1501
|
+
this.noborderColKeys.includes(column._key)
|
|
1502
|
+
? { _placeholder: " " }
|
|
1503
|
+
: {}
|
|
1504
|
+
),
|
|
1505
|
+
...(
|
|
1506
|
+
this.getSelfResetCol
|
|
1507
|
+
? this.getSelfResetCol({ row, rowIndex, column })
|
|
1508
|
+
: {}
|
|
1509
|
+
)
|
|
1510
|
+
};
|
|
1511
|
+
},
|
|
1512
|
+
// 单元格最终是否可编辑性
|
|
1513
|
+
getUnitCanEdit ({ row, rowIndex, column }) {
|
|
1514
|
+
return this.getRowCanEdit(row, rowIndex) &&
|
|
1515
|
+
this.getColCanEdit({ row, rowIndex, column }) &&
|
|
1516
|
+
this.$isAdvRelyShow(column, row, this.parentObj, true);
|
|
1517
|
+
},
|
|
1518
|
+
// 单元格本身是否可编辑性
|
|
1519
|
+
getColCanEdit ({ row, rowIndex, column }) {
|
|
1520
|
+
return (this.getIsDftRow(row) ? !this.dftReadonlyColKeys.includes(column._key) : true) && // 默认行的某列是否可编辑
|
|
1521
|
+
(row.__old__ === true ? !this.oldReadonlyColKeys.includes(column._key) : true) && // 老数据行里某些列不可编辑
|
|
1522
|
+
(row.__isQuote__ ? !this.quoteReadonlyColKeys.includes(column._key) : true) && // 引用的数据是否可编辑
|
|
1523
|
+
(this.getSelfColCanEdit ? this.getSelfColCanEdit({ row, rowIndex, column }) : true) &&
|
|
1524
|
+
(
|
|
1525
|
+
["treeTable"].includes(this.inTableType) && ["number", "date"].includes(column._type)
|
|
1526
|
+
? column._summaryType
|
|
1527
|
+
? row.isLeaf === true
|
|
1528
|
+
: ["downToUp", "upToDown"].includes(column._writeSort)
|
|
1529
|
+
? column._noLimitWrite === true
|
|
1530
|
+
? true
|
|
1531
|
+
: ["downToUp"].includes(column._writeSort)
|
|
1532
|
+
? !(row.children && row.children.length) || row.children.every(sonRow => !this.$isEmptyData(sonRow[column._key]))
|
|
1533
|
+
: row.level === 1 || !this.$isEmptyData(this.getParentRow(row, this.data)[column._key])
|
|
1534
|
+
: true
|
|
1535
|
+
: true
|
|
1536
|
+
) &&
|
|
1537
|
+
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(column._key)) && // 层级表格的固定字段不可编辑
|
|
1538
|
+
column._enterType !== "calculate" && // 计算的不可编辑
|
|
1539
|
+
column._readonly !== true && // 只读
|
|
1540
|
+
column._disabled !== true && // 只读
|
|
1541
|
+
column.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
|
|
1542
|
+
},
|
|
1543
|
+
|
|
1544
|
+
/* ----------- 工具方法 ---------- */
|
|
1545
|
+
// 初始化时 修复数据
|
|
1546
|
+
fixRowData (row, levelNum) {
|
|
1547
|
+
if (this.initFlag) {
|
|
1548
|
+
// 配置端设置的地方,不会运行下面的,因为_default被过滤掉没值,defaultListDataIds就是空的
|
|
1549
|
+
if (row._id) {
|
|
1550
|
+
if (this.defaultListDataIds.includes(row._id)) {
|
|
1551
|
+
row.__isDefault__ = true;
|
|
1552
|
+
|
|
1553
|
+
// 默认数据的id置换一遍,不然每条数据里该列表的id都是重复的
|
|
1554
|
+
const oldId = row._id;
|
|
1555
|
+
const newId = this.$ObjectID().str;
|
|
1556
|
+
row._id = newId;
|
|
1557
|
+
this.idRecordMap[newId] = oldId;
|
|
1558
|
+
}
|
|
1559
|
+
} else {
|
|
1560
|
+
row._id = this.$ObjectID().str;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
row.__old__ = this.isDftSet ? false : this.parentObj.__isCreate__ !== true; // 标记老数据
|
|
1564
|
+
row.__isDefault__ = this.isDftSet ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
|
|
1565
|
+
|
|
1566
|
+
// 初次进来 把关于展示的状态值全部清除(只有层级表在用,按理说应放在DshTreeTableMixin.js,但为了清除三大表格的老数据,才放在这)
|
|
1567
|
+
this.resetProperties.forEach(property => {
|
|
1568
|
+
delete row[property];
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
this.fixSelfRowData && this.fixSelfRowData(row, levelNum);
|
|
1573
|
+
},
|
|
1574
|
+
// 生成新的一行数据
|
|
1575
|
+
getNewRowData (level, list) {
|
|
1576
|
+
if (["cascaderTable"].includes(this.controlType)) {
|
|
1577
|
+
return {
|
|
1578
|
+
...this.$deepCopy(this.selfRowDft),
|
|
1579
|
+
...(this.getSelfNewRowData ? this.$deepCopy(this.getSelfNewRowData(level, list)) : {}),
|
|
1580
|
+
_id: this.$ObjectID().str,
|
|
1581
|
+
level: level,
|
|
1582
|
+
isLeaf: true,
|
|
1583
|
+
children: [],
|
|
1584
|
+
// __old__: false,
|
|
1585
|
+
__isDefault__: this.isDftSet
|
|
1586
|
+
};
|
|
1587
|
+
} else {
|
|
1588
|
+
return {
|
|
1589
|
+
...this.$deepCopy(this.selfRowDft),
|
|
1590
|
+
_id: this.$ObjectID().str,
|
|
1591
|
+
// __old__: false,
|
|
1592
|
+
__isDefault__: this.isDftSet
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
// 获取父级行
|
|
1597
|
+
getParentRow (row, tree = []) {
|
|
1598
|
+
if (row.level === 1) {
|
|
1599
|
+
return {
|
|
1600
|
+
children: tree
|
|
1601
|
+
};
|
|
1602
|
+
} else {
|
|
1603
|
+
let parentRow;
|
|
1604
|
+
|
|
1605
|
+
const loop = (list = []) => {
|
|
1606
|
+
return list.some(rowItem => {
|
|
1607
|
+
if (rowItem.level === row.level - 1) {
|
|
1608
|
+
const isExist = rowItem.children.some(childRowItem => childRowItem._id === row._id);
|
|
1609
|
+
parentRow = rowItem;
|
|
1610
|
+
return isExist;
|
|
1611
|
+
} else {
|
|
1612
|
+
return loop(rowItem.children);
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1616
|
+
loop(tree);
|
|
1617
|
+
|
|
1618
|
+
return parentRow;
|
|
1619
|
+
}
|
|
1620
|
+
},
|
|
1621
|
+
// // 单元格是否显示对比
|
|
1622
|
+
// isShowCompare ({ row, rowIndex, column }) {
|
|
1623
|
+
// const oldRow = this.compareListData[rowIndex] || {};
|
|
1624
|
+
// const curVal = row[column._key];
|
|
1625
|
+
// const oldVal = oldRow[column._key];
|
|
1626
|
+
|
|
1627
|
+
// return this.useCampare &&
|
|
1628
|
+
// ["number"].includes(column._type) &&
|
|
1629
|
+
// !(this.$isEmptyData(curVal) && this.$isEmptyData(oldVal)) &&
|
|
1630
|
+
// curVal !== oldVal;
|
|
1631
|
+
// },
|
|
1632
|
+
// 比较两行某列的值是否相等
|
|
1633
|
+
isCompareSame (column, row, compareRow) {
|
|
1634
|
+
const curColKey = column ? column._key : undefined;
|
|
1635
|
+
const curColType = column ? column._type : undefined;
|
|
1636
|
+
|
|
1637
|
+
return this.$isEmptyData(compareRow[curColKey]) && this.$isEmptyData(row[curColKey])
|
|
1638
|
+
? true
|
|
1639
|
+
: ["users", "departments"].includes(curColType)
|
|
1640
|
+
? compareRow[curColKey].length === row[curColKey].length && compareRow[curColKey].every((item, index) => item._key === row[curColKey][index]._key)
|
|
1641
|
+
: compareRow[curColKey] === row[curColKey];
|
|
1642
|
+
},
|
|
1643
|
+
// 行id + 分隔符 + 列key 组成键
|
|
1644
|
+
getMixKey (row, column, splitStr = "--") {
|
|
1645
|
+
return `${row._id}${splitStr}${column._key}`;
|
|
1646
|
+
},
|
|
1647
|
+
// 更新校验显示的标记
|
|
1648
|
+
dealRuleRecord (row, column) {
|
|
1649
|
+
// this.$set(this.ruleRecordMap, this.getMixKey(row, column), true);
|
|
1650
|
+
this.ruleRecordMap[this.getMixKey(row, column)] = true;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
};
|