bri-components 1.5.22 → 1.6.0

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.
Files changed (153) hide show
  1. package/README.md +83 -83
  2. package/lib/styles/bundle.css +12 -12
  3. package/lib/styles/font/fontello.svg +31 -31
  4. package/package.json +125 -125
  5. package/src/components/Error/Error403.vue +42 -42
  6. package/src/components/Error/Error404.vue +40 -40
  7. package/src/components/Error/Error500.vue +51 -51
  8. package/src/components/Error/error.less +162 -162
  9. package/src/components/Error/errorBack.vue +40 -40
  10. package/src/components/controls/DshControlInput.vue +195 -195
  11. package/src/components/controls/base/BriUpload/BriUpload.vue +434 -434
  12. package/src/components/controls/base/BriUpload/BriUploadImage.vue +377 -377
  13. package/src/components/controls/base/BriUpload/uploadList.vue +727 -727
  14. package/src/components/controls/base/BriUpload/uploadMixin.js +446 -446
  15. package/src/components/controls/base/DshCascader/DshCascader.vue +215 -215
  16. package/src/components/controls/base/DshCascader/components/cascaderModal.vue +366 -366
  17. package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +416 -416
  18. package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -141
  19. package/src/components/controls/base/DshCascader/components/cascaderTree.vue +151 -151
  20. package/src/components/controls/base/DshCoordinates.vue +585 -585
  21. package/src/components/controls/base/DshDate/DshDate.vue +191 -191
  22. package/src/components/controls/base/DshDate/DshDaterange.vue +186 -186
  23. package/src/components/controls/base/DshDivider.vue +201 -201
  24. package/src/components/controls/base/DshEditor.vue +274 -274
  25. package/src/components/controls/base/DshInput/BriInputs.vue +166 -166
  26. package/src/components/controls/base/DshInput/DshInput.vue +260 -260
  27. package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +435 -435
  28. package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -34
  29. package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -14
  30. package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -322
  31. package/src/components/controls/base/DshNumber/DshNumber.vue +143 -143
  32. package/src/components/controls/base/DshNumber/DshNumberange.vue +109 -109
  33. package/src/components/controls/base/DshSelect/DshCheckbox.vue +168 -168
  34. package/src/components/controls/base/DshSelect/DshSelect.vue +180 -180
  35. package/src/components/controls/base/DshSelect/DshSelectAll.vue +269 -269
  36. package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
  37. package/src/components/controls/control.less +324 -324
  38. package/src/components/controls/controlMap.js +117 -117
  39. package/src/components/controls/extra/DshColor.vue +81 -81
  40. package/src/components/controls/extra/DshThemeColor.vue +100 -100
  41. package/src/components/controls/extra/DshThemeIcon.vue +122 -122
  42. package/src/components/controls/mixins/cascaderMixin.js +325 -325
  43. package/src/components/controls/mixins/cascaderPickerMixin.js +227 -227
  44. package/src/components/controls/mixins/cascaderTableMixin.js +130 -130
  45. package/src/components/controls/mixins/controlMixin.js +393 -393
  46. package/src/components/controls/mixins/dateMixin.js +149 -149
  47. package/src/components/controls/mixins/flatTableMixin.js +111 -111
  48. package/src/components/controls/mixins/numberMixin.js +112 -112
  49. package/src/components/controls/mixins/selectMixin.js +233 -233
  50. package/src/components/controls/mixins/switchMixin.js +87 -87
  51. package/src/components/controls/mixins/userAndDepartMixin.js +260 -260
  52. package/src/components/controls/senior/DshLabels.vue +333 -333
  53. package/src/components/controls/senior/DshPackage.vue +57 -57
  54. package/src/components/controls/senior/cascaderTable.vue +213 -213
  55. package/src/components/controls/senior/correlation.vue +135 -135
  56. package/src/components/controls/senior/flatTable.vue +138 -138
  57. package/src/components/controls/senior/selectDepartments.vue +399 -399
  58. package/src/components/controls/senior/selectUsers/departMenu.vue +293 -293
  59. package/src/components/controls/senior/selectUsers/selectUsers.vue +712 -712
  60. package/src/components/controls/special/DshBack.vue +42 -42
  61. package/src/components/controls/special/DshUndeveloped.vue +41 -41
  62. package/src/components/form/DshAdvSearch.vue +510 -510
  63. package/src/components/form/DshDefaultSearch.vue +260 -260
  64. package/src/components/form/DshForm.vue +494 -494
  65. package/src/components/form/searchMixin.js +376 -376
  66. package/src/components/list/BriCard.vue +95 -95
  67. package/src/components/list/BriTable.vue +205 -205
  68. package/src/components/list/BriTree.vue +529 -529
  69. package/src/components/list/BriTreeItem.vue +163 -163
  70. package/src/components/list/DshBox/DshBox.vue +219 -219
  71. package/src/components/list/DshBox/DshCard.vue +446 -446
  72. package/src/components/list/DshBox/DshCrossTable.vue +827 -827
  73. package/src/components/list/DshBox/DshList.vue +404 -404
  74. package/src/components/list/DshBox/DshPanel.vue +669 -669
  75. package/src/components/list/DshBox/DshSingleData.vue +119 -119
  76. package/src/components/list/DshBox/DshTable.vue +239 -239
  77. package/src/components/list/DshCascaderTable.vue +115 -115
  78. package/src/components/list/DshFlatTable.vue +337 -337
  79. package/src/components/list/DshPage.vue +194 -194
  80. package/src/components/list/DshTreeTable.vue +113 -113
  81. package/src/components/list/common/importModal.vue +243 -243
  82. package/src/components/list/common/quoteListModal.vue +206 -206
  83. package/src/components/list/mixins/DshCascaderTableMixin.js +278 -278
  84. package/src/components/list/mixins/DshFlatTableMixin.js +509 -509
  85. package/src/components/list/mixins/DshTreeTableMixin.js +286 -286
  86. package/src/components/list/mixins/tableBaseMixin.js +1653 -1653
  87. package/src/components/list/mixins/treeTableBaseMixin.js +145 -145
  88. package/src/components/other/BriAvatar.vue +166 -166
  89. package/src/components/other/BriCode.vue +125 -125
  90. package/src/components/other/BriCollapseTree.vue +207 -207
  91. package/src/components/other/BriGantt.vue +1087 -1087
  92. package/src/components/other/BriIframe.vue +116 -116
  93. package/src/components/other/BriLoading.vue +171 -171
  94. package/src/components/other/BriSvg.vue +27 -27
  95. package/src/components/other/DshColorPanel.vue +128 -128
  96. package/src/components/other/DshMenuNav.vue +188 -188
  97. package/src/components/small/BriButton.vue +71 -71
  98. package/src/components/small/BriDrawer.vue +169 -169
  99. package/src/components/small/BriTooltip.vue +87 -87
  100. package/src/components/small/DshBtnModal.vue +68 -68
  101. package/src/components/small/DshButtons.vue +324 -324
  102. package/src/components/small/DshDropdown.vue +225 -225
  103. package/src/components/small/DshIcons.vue +59 -59
  104. package/src/components/small/DshListRender.js +21 -21
  105. package/src/components/small/DshModal.vue +160 -160
  106. package/src/components/small/DshSteps.vue +141 -141
  107. package/src/components/small/DshTabs.vue +598 -598
  108. package/src/components/small/DshTabsSet.vue +309 -309
  109. package/src/components/small/DshTags.vue +251 -251
  110. package/src/components/small/DshTitle.vue +50 -50
  111. package/src/components/small/render.js +20 -20
  112. package/src/components/unit/DshFormUnit.vue +398 -398
  113. package/src/components/unit/DshListUnit.vue +115 -115
  114. package/src/components/unit/unitMixin.js +86 -86
  115. package/src/data/index.js +4 -4
  116. package/src/index.js +285 -285
  117. package/src/styles/bundle.css +12 -12
  118. package/src/styles/components/BriButton.less +307 -307
  119. package/src/styles/components/BriTable.less +344 -344
  120. package/src/styles/components/DshModal.less +257 -257
  121. package/src/styles/components/index.less +3 -3
  122. package/src/styles/global/animate.less +11 -11
  123. package/src/styles/global/base.less +45 -45
  124. package/src/styles/global/box.less +186 -186
  125. package/src/styles/global/control.less +122 -122
  126. package/src/styles/global/flex.less +282 -282
  127. package/src/styles/global/global.less +8 -8
  128. package/src/styles/global/text.less +59 -59
  129. package/src/styles/global/variables.less +85 -85
  130. package/src/styles/iconfont/iconfont.css +254 -254
  131. package/src/styles/iconfont/iconfont.json +422 -422
  132. package/src/styles/iconfont/iconfont.svg +137 -137
  133. package/src/styles/index.less +26 -26
  134. package/src/styles/reset-easytable.less +21 -21
  135. package/src/styles/reset-iview-controls.less +145 -145
  136. package/src/styles/reset-iview-other.less +49 -49
  137. package/src/styles/reset-iview-variables.less +43 -43
  138. package/src/styles/reset.less +45 -45
  139. package/src/utils/index.js +3 -5
  140. package/lib/0.bri-components.min.js +0 -1
  141. package/lib/1.bri-components.min.js +0 -1
  142. package/lib/10.bri-components.min.js +0 -1
  143. package/lib/11.bri-components.min.js +0 -1
  144. package/lib/2.bri-components.min.js +0 -1
  145. package/lib/3.bri-components.min.js +0 -1
  146. package/lib/4.bri-components.min.js +0 -1
  147. package/lib/5.bri-components.min.js +0 -1
  148. package/lib/6.bri-components.min.js +0 -1
  149. package/lib/7.bri-components.min.js +0 -1
  150. package/lib/8.bri-components.min.js +0 -1
  151. package/lib/9.bri-components.min.js +0 -1
  152. package/lib/bri-components.min.js +0 -18
  153. package/src/utils/table.js +0 -175
@@ -1,393 +1,393 @@
1
- export default {
2
- props: {
3
- canEdit: {
4
- type: Boolean,
5
- default: true
6
- },
7
- value: {
8
- type: Object,
9
- default () {
10
- return {};
11
- }
12
- },
13
- propsObj: {
14
- type: Object,
15
- default () {
16
- return {};
17
- }
18
- },
19
- // 暂时是dshDate里在用,时间对比时需要用其他时间字段
20
- allFormList: {
21
- type: Array,
22
- default () {
23
- return [];
24
- }
25
- },
26
-
27
- /* 表格字段内用到的 */
28
- inTableType: {
29
- type: String,
30
- validator (val) {
31
- return ["flatTable", "treeTable", "cascaderTable"].includes(val);
32
- }
33
- },
34
- allListRows: {
35
- type: Array,
36
- default () {
37
- return [];
38
- }
39
- },
40
- rowIndex: Number,
41
- parentObj: {
42
- type: Object,
43
- default () {
44
- return {};
45
- }
46
- },
47
- parentFormList: {
48
- type: Array,
49
- default () {
50
- return [];
51
- }
52
- }
53
- },
54
- data () {
55
- return {
56
- showModal: false,
57
- showUnitModal: false,
58
-
59
- tagStyle: {
60
- display: "inline-block",
61
- "max-width": "100%",
62
- height: "24px",
63
- "min-height": "24px",
64
- padding: "4px 8px",
65
- margin: "2px 0px",
66
- "border-radius": "4px",
67
- "line-height": "16px",
68
- "font-size": "12px",
69
-
70
- backgroundColor: "#E5E5E5",
71
- color: "rgb(0, 0, 0, 0.9)"
72
- }
73
- };
74
- },
75
- computed: {
76
- typeInfoData () {
77
- return this.$modFieldMap[this.controlType] || {};
78
- },
79
- unitModalPropsObj () {
80
- return {
81
- mode: "fullscreen",
82
- title: this.controlName
83
- };
84
- },
85
-
86
- /* ----- 基本 ----- */
87
- finalCanEdit () {
88
- return this.canEdit && (this.propsObj.canEdit == undefined ? true : this.propsObj.canEdit);
89
- },
90
- controlKey () {
91
- return this.propsObj._key;
92
- },
93
- // 字段的真实key
94
- fieldKey () {
95
- return this.isDftSet
96
- ? this.value._key
97
- : (this.propsObj.__realKey__ || this.controlKey);
98
- },
99
- controlType () {
100
- return this.propsObj._type;
101
- },
102
- controlName () {
103
- return this.propsObj._name;
104
- },
105
- commonDealPropsObj () {
106
- const selectControlTypes = [
107
- "date", "daterange", "switch", "select", "checkbox", "region", "regions", "cascader", "cascaders",
108
- "file", "coordinates", "users", "departments", "reference"
109
- ];
110
- return {
111
- _placeholder: this.canEdit && this.propsObj._enterType !== "calculate" && this.propsObj._disabled !== true && this.propsObj._readonly !== true
112
- ? (this.propsObj._placeholder || `${selectControlTypes.includes(this.controlType) ? "选择" : "输入"}${this.propsObj._name}`)
113
- : "",
114
- _clearable: this.finalCanEdit && !this.propsObj._disabled && !this.propsObj._readonly && (this.propsObj._clearable === undefined ? true : this.propsObj._clearable),
115
- _disabled: !(this.finalCanEdit && !this.propsObj._disabled && !this.propsObj._readonly),
116
- // 目前部门、用户在用,以后还会增多
117
- _useDeleteTip: this.isInAnySearch
118
- ? false
119
- : this.propsObj._useDeleteTip == undefined
120
- ? false
121
- : this.propsObj._useDeleteTip // 删除项进行提示(筛选下删除项不提示)
122
- };
123
- },
124
- // 是否为多选模式
125
- multipleMode () {
126
- return this.isInAnySearch
127
- ? true
128
- : ["numberange", "daterange", "checkbox", "regions", "cascaders", "labels", "refCheckbox"].includes(this.controlType)
129
- ? true
130
- : !!this.selfPropsObj && !!this.selfPropsObj._multiple;
131
- },
132
- // 是否高度自由(在表格内且_heightAuto为true,2.详情页内且独占一行)
133
- isHeightAuto () {
134
- return this.isInTable
135
- ? !!this.propsObj._heightAuto
136
- : this.isFullRow;
137
- },
138
- // 是否为tag显示
139
- isTagShow () {
140
- return ["switch", "select", "checkbox", "regions", "cascaders", "users", "departments", "labels", "refSelect", "refCheckbox"].includes(this.controlType);
141
- },
142
- // 全称showDetailOnClickUnitContent,点击行或单元格查看详细内容 -"flatTable", "cascaderTable", "reference", "referenceBy"在用
143
- showDetailOnCUC () {
144
- return !!this.selfPropsObj && [true, false].includes(this.selfPropsObj._showDetailOnCUC)
145
- ? this.selfPropsObj._showDetailOnCUC
146
- : true;
147
- },
148
-
149
- /* ----- 表单相关 ----- */
150
- clearable () {
151
- return this.commonDealPropsObj._clearable;
152
- },
153
- disabled () {
154
- return this.commonDealPropsObj._disabled;
155
- },
156
- // 单独一行
157
- isFullRow () {
158
- return this.propsObj._span === 24 || !this.propsObj._span;
159
- },
160
- // 查看页下的展示模式
161
- showStatusMode () {
162
- return this.propsObj.showStatusMode || "defaut"; // "default", "frame", "backdrop"
163
- },
164
- commonClass () {
165
- return {
166
- "bri-control-edit": this.canEdit && !this.disabled,
167
- "bri-control-disabled": this.canEdit && this.disabled,
168
- "bri-control-unit": this.isUnitShow,
169
- "bri-control-show": this.isDetailShow,
170
- [`control-show-${this.showStatusMode}${this.isTagShow ? "-tag" : ""}`]: this.isDetailShow,
171
- "dsh-ellipsis": this.isUnitShow,
172
- "bri-control-nodata": this.$isEmptyData(this.curVal)
173
- };
174
- },
175
-
176
- /* ----- 单元格相关 ----- */
177
- unitAlign () {
178
- return this.propsObj._align || this.typeInfoData.align || "left"; // "left", "center", "right"
179
- },
180
-
181
- /* ----- 部分条件下 才使用的属性 ----- */
182
- // isShare () {
183
- // return !!this.propsObj.isShare;
184
- // },
185
- // 是否在设置默认值下
186
- isDftSet () {
187
- return this.controlKey === "_default";
188
- },
189
- // 在单元格内
190
- isInTable () {
191
- return !!this.propsObj.inTable;
192
- },
193
- // 在高级搜索下
194
- isInSearch () {
195
- return !!this.propsObj.inSearch;
196
- },
197
- // 在默认搜索下
198
- isInDftSearch () {
199
- return !!this.propsObj.inDftSearch;
200
- },
201
- // 在任何搜索下
202
- isInAnySearch () {
203
- return this.isInDftSearch || this.isInSearch;
204
- },
205
- isUnitUpdate () {
206
- return this.isInTable && !!this.canEdit;
207
- },
208
- isUnitShow () {
209
- return this.isInTable && !this.canEdit;
210
- },
211
- isDetailUpdate () {
212
- return !this.isInTable && !!this.canEdit;
213
- },
214
- isDetailShow () {
215
- return !this.isInTable && !this.canEdit;
216
- },
217
-
218
- /* ----- 部分控件下 才使用的属性 ----- */
219
- isMobile () {
220
- return this.propsObj.isMobile;
221
- },
222
- controlThemeColor () {
223
- return this.propsObj.controlThemeColor;
224
- },
225
- compKey () {
226
- return this.propsObj.compKey;
227
- },
228
- appKey () {
229
- return this.propsObj.appKey;
230
- },
231
- entityKey () {
232
- return this.propsObj.entityKey;
233
- },
234
- modKey () {
235
- return this.propsObj.modKey;
236
- },
237
- screenKey () {
238
- return this.propsObj.screenKey;
239
- },
240
- allScreenKey () {
241
- return this.propsObj.allScreenKey;
242
- },
243
- // 单条关联内 使用详情模式的
244
- isInRefDetail () {
245
- return !!this.propsObj.inRefDetail;
246
- },
247
-
248
- /* ----- 移动端在用 ----- */
249
- // 只做校验而隐藏的的field框,所用的propsObj
250
- ruleFieldPropsObj () {
251
- return {
252
- _rules: this.propsObj._rules
253
- };
254
- },
255
- // 只做校验而隐藏的的field框,所用的value
256
- ruleFieldStr () {
257
- return this.$isEmptyData(this.curVal) && this.$isEmptyData(this.curValList)
258
- ? ""
259
- : "有值";
260
- },
261
-
262
- /* ----- 值 ----- */
263
- // 值为不是[]类型用的
264
- curVal: {
265
- get () {
266
- // // 原选项变动了或选项动态改变时,过滤掉已不存在的选项值
267
- // if (!this.isInTable) {
268
- // if (["select"].includes(this.controlType)) {
269
- // if (!this.$dataType(this.propsObj._filterFunc, "function")) {
270
- // this.value[this.controlKey] = this.listData.some(item => item[this.saveKey] === this.value[this.controlKey])
271
- // ? this.value[this.controlKey]
272
- // : "";
273
- // }
274
- // }
275
- // }
276
-
277
- return this.value[this.controlKey];
278
- },
279
- set (val) {
280
- // 修复文本框clear后值为undefined,后端无法更新保存数据bug
281
- if (["select"].includes(this.controlType) && val === undefined) {
282
- val = "";
283
- }
284
-
285
- this.$set(this.value, this.controlKey, val);
286
- this.change();
287
- }
288
- },
289
- // 值为[]类型用的
290
- curValList: {
291
- get () {
292
- // // 原选项变动了或选项动态改变时,过滤掉已不存在的选项值
293
- // if (!this.isInTable) {
294
- // const valList = this.value[this.controlKey] || [];
295
- // if ((["select"].includes(this.controlType) && this.multipleMode) || ["checkbox"].includes(this.controlType)) {
296
- // this.value[this.controlKey] = valList.some(valKey => !this.listDataKeys.includes(valKey))
297
- // ? valList.filter(valKey => this.listDataKeys.includes(valKey))
298
- // : valList;
299
- // }
300
- // // else if (["region", "cascader"].includes(this.controlType)) {
301
- // // this.value[this.controlKey] = this.$getTreeLinealDatas(valList, this.cascaderAllData, undefined, this.saveKey).length
302
- // // ? valList
303
- // // : [];
304
- // // }
305
- // // else if (["regions", "cascaders"].includes(this.controlType)) {
306
- // // this.value[this.controlKey] = valList.filter(valListItem =>
307
- // // this.$getTreeLinealDatas(valListItem, this.cascaderAllData, undefined, this.saveKey).length
308
- // // );
309
- // // }
310
- // }
311
-
312
- return this.value[this.controlKey] || [];
313
- },
314
- set (valList) {
315
- this.$set(this.value, this.controlKey, valList);
316
- this.change();
317
- }
318
- },
319
- emptyShowVal () {
320
- return this.canEdit
321
- ? this.commonDealPropsObj._placeholder
322
- : this.isUnitShow
323
- ? "--"
324
- : "暂无内容";
325
- },
326
- showVal () {
327
- return this.$isEmptyData(this.curVal)
328
- ? this.emptyShowVal
329
- : this.curVal;
330
- }
331
- },
332
- methods: {
333
- change (...params) {
334
- this.$emit("change", this.value[this.controlKey]);
335
- },
336
- refChange (...params) {
337
- this.$emit("refChange", this.value[this.controlKey]);
338
- },
339
- quickChange (...params) {
340
- this.$emit("quickChange", this.value[this.controlKey]);
341
- },
342
-
343
- // 点击输入框
344
- clickInput () {
345
- if (!this.disabled) {
346
- this.openModal();
347
- }
348
- },
349
- // 点击清除
350
- clickClear () {
351
- if (this.controlType === "coordinates") {
352
- this.curVal = {
353
- name: "",
354
- lnglat: []
355
- };
356
- }
357
- else if (this.typeInfoData.dataType === "array" || this.multipleMode) {
358
- this.curValList = [];
359
- } else {
360
- this.curVal = "";
361
- }
362
- },
363
-
364
- /* ----- 工具方法 ------- */
365
- // 切换弹框
366
- toggleModal (bool) {
367
- this.showModal = bool;
368
- },
369
- // 打开弹框 ---!!!!pc端的selectUsers、selectDepartments控件,外部调用组件时也在使用,不能轻易删除
370
- openModal () {
371
- this.showModal = true;
372
- },
373
- // 关闭弹框 ---!!!!pc端的selectUsers、selectDepartments控件,外部调用组件时也在使用,不能轻易删除
374
- closeModal () {
375
- this.showModal = false;
376
- },
377
-
378
- // 点击外层dom(主要针对单元格空白处)
379
- clickControlWrapper (event) {
380
- // 点击行是选择数据效果时,点击单元格空白和点击行效果一样(啥也不做);点击表格行进的是详情的话,点某列单元格空白处,显示谁都有争议,没有效果最好
381
- if ((this.isUnitShow && this.showDetailOnCUC) || !this.isUnitShow) {
382
- event.stopPropagation();
383
- }
384
- },
385
- // 点击单元格里的内容 -打开详情模态框
386
- clickUnitContent (event) {
387
- if ((this.isUnitShow && this.showDetailOnCUC) || this.isUnitUpdate) {
388
- // event.stopPropagation(); // 可有可无,最外层已经阻止冒泡
389
- this.showUnitModal = true;
390
- }
391
- }
392
- }
393
- };
1
+ export default {
2
+ props: {
3
+ canEdit: {
4
+ type: Boolean,
5
+ default: true
6
+ },
7
+ value: {
8
+ type: Object,
9
+ default () {
10
+ return {};
11
+ }
12
+ },
13
+ propsObj: {
14
+ type: Object,
15
+ default () {
16
+ return {};
17
+ }
18
+ },
19
+ // 暂时是dshDate里在用,时间对比时需要用其他时间字段
20
+ allFormList: {
21
+ type: Array,
22
+ default () {
23
+ return [];
24
+ }
25
+ },
26
+
27
+ /* 表格字段内用到的 */
28
+ inTableType: {
29
+ type: String,
30
+ validator (val) {
31
+ return ["flatTable", "treeTable", "cascaderTable"].includes(val);
32
+ }
33
+ },
34
+ allListRows: {
35
+ type: Array,
36
+ default () {
37
+ return [];
38
+ }
39
+ },
40
+ rowIndex: Number,
41
+ parentObj: {
42
+ type: Object,
43
+ default () {
44
+ return {};
45
+ }
46
+ },
47
+ parentFormList: {
48
+ type: Array,
49
+ default () {
50
+ return [];
51
+ }
52
+ }
53
+ },
54
+ data () {
55
+ return {
56
+ showModal: false,
57
+ showUnitModal: false,
58
+
59
+ tagStyle: {
60
+ display: "inline-block",
61
+ "max-width": "100%",
62
+ height: "24px",
63
+ "min-height": "24px",
64
+ padding: "4px 8px",
65
+ margin: "2px 0px",
66
+ "border-radius": "4px",
67
+ "line-height": "16px",
68
+ "font-size": "12px",
69
+
70
+ backgroundColor: "#E5E5E5",
71
+ color: "rgb(0, 0, 0, 0.9)"
72
+ }
73
+ };
74
+ },
75
+ computed: {
76
+ typeInfoData () {
77
+ return this.$modFieldMap[this.controlType] || {};
78
+ },
79
+ unitModalPropsObj () {
80
+ return {
81
+ mode: "fullscreen",
82
+ title: this.controlName
83
+ };
84
+ },
85
+
86
+ /* ----- 基本 ----- */
87
+ finalCanEdit () {
88
+ return this.canEdit && (this.propsObj.canEdit == undefined ? true : this.propsObj.canEdit);
89
+ },
90
+ controlKey () {
91
+ return this.propsObj._key;
92
+ },
93
+ // 字段的真实key
94
+ fieldKey () {
95
+ return this.isDftSet
96
+ ? this.value._key
97
+ : (this.propsObj.__realKey__ || this.controlKey);
98
+ },
99
+ controlType () {
100
+ return this.propsObj._type;
101
+ },
102
+ controlName () {
103
+ return this.propsObj._name;
104
+ },
105
+ commonDealPropsObj () {
106
+ const selectControlTypes = [
107
+ "date", "daterange", "switch", "select", "checkbox", "region", "regions", "cascader", "cascaders",
108
+ "file", "coordinates", "users", "departments", "reference"
109
+ ];
110
+ return {
111
+ _placeholder: this.canEdit && this.propsObj._enterType !== "calculate" && this.propsObj._disabled !== true && this.propsObj._readonly !== true
112
+ ? (this.propsObj._placeholder || `${selectControlTypes.includes(this.controlType) ? "选择" : "输入"}${this.propsObj._name}`)
113
+ : "",
114
+ _clearable: this.finalCanEdit && !this.propsObj._disabled && !this.propsObj._readonly && (this.propsObj._clearable === undefined ? true : this.propsObj._clearable),
115
+ _disabled: !(this.finalCanEdit && !this.propsObj._disabled && !this.propsObj._readonly),
116
+ // 目前部门、用户在用,以后还会增多
117
+ _useDeleteTip: this.isInAnySearch
118
+ ? false
119
+ : this.propsObj._useDeleteTip == undefined
120
+ ? false
121
+ : this.propsObj._useDeleteTip // 删除项进行提示(筛选下删除项不提示)
122
+ };
123
+ },
124
+ // 是否为多选模式
125
+ multipleMode () {
126
+ return this.isInAnySearch
127
+ ? true
128
+ : ["numberange", "daterange", "checkbox", "regions", "cascaders", "labels", "refCheckbox"].includes(this.controlType)
129
+ ? true
130
+ : !!this.selfPropsObj && !!this.selfPropsObj._multiple;
131
+ },
132
+ // 是否高度自由(在表格内且_heightAuto为true,2.详情页内且独占一行)
133
+ isHeightAuto () {
134
+ return this.isInTable
135
+ ? !!this.propsObj._heightAuto
136
+ : this.isFullRow;
137
+ },
138
+ // 是否为tag显示
139
+ isTagShow () {
140
+ return ["switch", "select", "checkbox", "regions", "cascaders", "users", "departments", "labels", "refSelect", "refCheckbox"].includes(this.controlType);
141
+ },
142
+ // 全称showDetailOnClickUnitContent,点击行或单元格查看详细内容 -"flatTable", "cascaderTable", "reference", "referenceBy"在用
143
+ showDetailOnCUC () {
144
+ return !!this.selfPropsObj && [true, false].includes(this.selfPropsObj._showDetailOnCUC)
145
+ ? this.selfPropsObj._showDetailOnCUC
146
+ : true;
147
+ },
148
+
149
+ /* ----- 表单相关 ----- */
150
+ clearable () {
151
+ return this.commonDealPropsObj._clearable;
152
+ },
153
+ disabled () {
154
+ return this.commonDealPropsObj._disabled;
155
+ },
156
+ // 单独一行
157
+ isFullRow () {
158
+ return this.propsObj._span === 24 || !this.propsObj._span;
159
+ },
160
+ // 查看页下的展示模式
161
+ showStatusMode () {
162
+ return this.propsObj.showStatusMode || "defaut"; // "default", "frame", "backdrop"
163
+ },
164
+ commonClass () {
165
+ return {
166
+ "bri-control-edit": this.canEdit && !this.disabled,
167
+ "bri-control-disabled": this.canEdit && this.disabled,
168
+ "bri-control-unit": this.isUnitShow,
169
+ "bri-control-show": this.isDetailShow,
170
+ [`control-show-${this.showStatusMode}${this.isTagShow ? "-tag" : ""}`]: this.isDetailShow,
171
+ "dsh-ellipsis": this.isUnitShow,
172
+ "bri-control-nodata": this.$isEmptyData(this.curVal)
173
+ };
174
+ },
175
+
176
+ /* ----- 单元格相关 ----- */
177
+ unitAlign () {
178
+ return this.propsObj._align || this.typeInfoData.align || "left"; // "left", "center", "right"
179
+ },
180
+
181
+ /* ----- 部分条件下 才使用的属性 ----- */
182
+ // isShare () {
183
+ // return !!this.propsObj.isShare;
184
+ // },
185
+ // 是否在设置默认值下
186
+ isDftSet () {
187
+ return this.controlKey === "_default";
188
+ },
189
+ // 在单元格内
190
+ isInTable () {
191
+ return !!this.propsObj.inTable;
192
+ },
193
+ // 在高级搜索下
194
+ isInSearch () {
195
+ return !!this.propsObj.inSearch;
196
+ },
197
+ // 在默认搜索下
198
+ isInDftSearch () {
199
+ return !!this.propsObj.inDftSearch;
200
+ },
201
+ // 在任何搜索下
202
+ isInAnySearch () {
203
+ return this.isInDftSearch || this.isInSearch;
204
+ },
205
+ isUnitUpdate () {
206
+ return this.isInTable && !!this.canEdit;
207
+ },
208
+ isUnitShow () {
209
+ return this.isInTable && !this.canEdit;
210
+ },
211
+ isDetailUpdate () {
212
+ return !this.isInTable && !!this.canEdit;
213
+ },
214
+ isDetailShow () {
215
+ return !this.isInTable && !this.canEdit;
216
+ },
217
+
218
+ /* ----- 部分控件下 才使用的属性 ----- */
219
+ isMobile () {
220
+ return this.propsObj.isMobile;
221
+ },
222
+ controlThemeColor () {
223
+ return this.propsObj.controlThemeColor;
224
+ },
225
+ compKey () {
226
+ return this.propsObj.compKey;
227
+ },
228
+ appKey () {
229
+ return this.propsObj.appKey;
230
+ },
231
+ entityKey () {
232
+ return this.propsObj.entityKey;
233
+ },
234
+ modKey () {
235
+ return this.propsObj.modKey;
236
+ },
237
+ screenKey () {
238
+ return this.propsObj.screenKey;
239
+ },
240
+ allScreenKey () {
241
+ return this.propsObj.allScreenKey;
242
+ },
243
+ // 单条关联内 使用详情模式的
244
+ isInRefDetail () {
245
+ return !!this.propsObj.inRefDetail;
246
+ },
247
+
248
+ /* ----- 移动端在用 ----- */
249
+ // 只做校验而隐藏的的field框,所用的propsObj
250
+ ruleFieldPropsObj () {
251
+ return {
252
+ _rules: this.propsObj._rules
253
+ };
254
+ },
255
+ // 只做校验而隐藏的的field框,所用的value
256
+ ruleFieldStr () {
257
+ return this.$isEmptyData(this.curVal) && this.$isEmptyData(this.curValList)
258
+ ? ""
259
+ : "有值";
260
+ },
261
+
262
+ /* ----- 值 ----- */
263
+ // 值为不是[]类型用的
264
+ curVal: {
265
+ get () {
266
+ // // 原选项变动了或选项动态改变时,过滤掉已不存在的选项值
267
+ // if (!this.isInTable) {
268
+ // if (["select"].includes(this.controlType)) {
269
+ // if (!this.$dataType(this.propsObj._filterFunc, "function")) {
270
+ // this.value[this.controlKey] = this.listData.some(item => item[this.saveKey] === this.value[this.controlKey])
271
+ // ? this.value[this.controlKey]
272
+ // : "";
273
+ // }
274
+ // }
275
+ // }
276
+
277
+ return this.value[this.controlKey];
278
+ },
279
+ set (val) {
280
+ // 修复文本框clear后值为undefined,后端无法更新保存数据bug
281
+ if (["select"].includes(this.controlType) && val === undefined) {
282
+ val = "";
283
+ }
284
+
285
+ this.$set(this.value, this.controlKey, val);
286
+ this.change();
287
+ }
288
+ },
289
+ // 值为[]类型用的
290
+ curValList: {
291
+ get () {
292
+ // // 原选项变动了或选项动态改变时,过滤掉已不存在的选项值
293
+ // if (!this.isInTable) {
294
+ // const valList = this.value[this.controlKey] || [];
295
+ // if ((["select"].includes(this.controlType) && this.multipleMode) || ["checkbox"].includes(this.controlType)) {
296
+ // this.value[this.controlKey] = valList.some(valKey => !this.listDataKeys.includes(valKey))
297
+ // ? valList.filter(valKey => this.listDataKeys.includes(valKey))
298
+ // : valList;
299
+ // }
300
+ // // else if (["region", "cascader"].includes(this.controlType)) {
301
+ // // this.value[this.controlKey] = this.$getTreeLinealDatas(valList, this.cascaderAllData, undefined, this.saveKey).length
302
+ // // ? valList
303
+ // // : [];
304
+ // // }
305
+ // // else if (["regions", "cascaders"].includes(this.controlType)) {
306
+ // // this.value[this.controlKey] = valList.filter(valListItem =>
307
+ // // this.$getTreeLinealDatas(valListItem, this.cascaderAllData, undefined, this.saveKey).length
308
+ // // );
309
+ // // }
310
+ // }
311
+
312
+ return this.value[this.controlKey] || [];
313
+ },
314
+ set (valList) {
315
+ this.$set(this.value, this.controlKey, valList);
316
+ this.change();
317
+ }
318
+ },
319
+ emptyShowVal () {
320
+ return this.canEdit
321
+ ? this.commonDealPropsObj._placeholder
322
+ : this.isUnitShow
323
+ ? "--"
324
+ : "暂无内容";
325
+ },
326
+ showVal () {
327
+ return this.$isEmptyData(this.curVal)
328
+ ? this.emptyShowVal
329
+ : this.curVal;
330
+ }
331
+ },
332
+ methods: {
333
+ change (...params) {
334
+ this.$emit("change", this.value[this.controlKey]);
335
+ },
336
+ refChange (...params) {
337
+ this.$emit("refChange", this.value[this.controlKey]);
338
+ },
339
+ quickChange (...params) {
340
+ this.$emit("quickChange", this.value[this.controlKey]);
341
+ },
342
+
343
+ // 点击输入框
344
+ clickInput () {
345
+ if (!this.disabled) {
346
+ this.openModal();
347
+ }
348
+ },
349
+ // 点击清除
350
+ clickClear () {
351
+ if (this.controlType === "coordinates") {
352
+ this.curVal = {
353
+ name: "",
354
+ lnglat: []
355
+ };
356
+ }
357
+ else if (this.typeInfoData.dataType === "array" || this.multipleMode) {
358
+ this.curValList = [];
359
+ } else {
360
+ this.curVal = "";
361
+ }
362
+ },
363
+
364
+ /* ----- 工具方法 ------- */
365
+ // 切换弹框
366
+ toggleModal (bool) {
367
+ this.showModal = bool;
368
+ },
369
+ // 打开弹框 ---!!!!pc端的selectUsers、selectDepartments控件,外部调用组件时也在使用,不能轻易删除
370
+ openModal () {
371
+ this.showModal = true;
372
+ },
373
+ // 关闭弹框 ---!!!!pc端的selectUsers、selectDepartments控件,外部调用组件时也在使用,不能轻易删除
374
+ closeModal () {
375
+ this.showModal = false;
376
+ },
377
+
378
+ // 点击外层dom(主要针对单元格空白处)
379
+ clickControlWrapper (event) {
380
+ // 点击行是选择数据效果时,点击单元格空白和点击行效果一样(啥也不做);点击表格行进的是详情的话,点某列单元格空白处,显示谁都有争议,没有效果最好
381
+ if ((this.isUnitShow && this.showDetailOnCUC) || !this.isUnitShow) {
382
+ event.stopPropagation();
383
+ }
384
+ },
385
+ // 点击单元格里的内容 -打开详情模态框
386
+ clickUnitContent (event) {
387
+ if ((this.isUnitShow && this.showDetailOnCUC) || this.isUnitUpdate) {
388
+ // event.stopPropagation(); // 可有可无,最外层已经阻止冒泡
389
+ this.showUnitModal = true;
390
+ }
391
+ }
392
+ }
393
+ };