bri-components 1.0.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.
- package/README.md +30 -0
- package/lib/.DS_Store +0 -0
- package/lib/0.bri-components.min.js +2 -0
- package/lib/0.bri-components.min.js.map +1 -0
- package/lib/1.bri-components.min.js +2 -0
- package/lib/1.bri-components.min.js.map +1 -0
- package/lib/2.bri-components.min.js +2 -0
- package/lib/2.bri-components.min.js.map +1 -0
- package/lib/3.bri-components.min.js +2 -0
- package/lib/3.bri-components.min.js.gz +0 -0
- package/lib/3.bri-components.min.js.map +1 -0
- package/lib/4.bri-components.min.js +2 -0
- package/lib/4.bri-components.min.js.gz +0 -0
- package/lib/4.bri-components.min.js.map +1 -0
- package/lib/5.bri-components.min.js +2 -0
- package/lib/5.bri-components.min.js.map +1 -0
- package/lib/6.bri-components.min.js +2 -0
- package/lib/6.bri-components.min.js.map +1 -0
- package/lib/bri-components.min.js +21 -0
- package/lib/bri-components.min.js.gz +0 -0
- package/lib/bri-components.min.js.map +1 -0
- package/lib/styles/bri-components.css +1 -0
- package/lib/styles/bundle.css +14 -0
- package/lib/styles/font/fontello.eot +0 -0
- package/lib/styles/font/fontello.svg +32 -0
- package/lib/styles/font/fontello.ttf +0 -0
- package/lib/styles/font/fontello.woff +0 -0
- package/lib/styles/font/fontello.woff2 +0 -0
- package/package.json +121 -0
- package/src/.DS_Store +0 -0
- package/src/components/controls/base/DshBack.vue +36 -0
- package/src/components/controls/base/DshCascader.vue +366 -0
- package/src/components/controls/base/DshCascaderMultiple.vue +158 -0
- package/src/components/controls/base/DshCheckbox.vue +199 -0
- package/src/components/controls/base/DshCoordinates.vue +497 -0
- package/src/components/controls/base/DshDate.vue +148 -0
- package/src/components/controls/base/DshDaterange.vue +335 -0
- package/src/components/controls/base/DshDivider.vue +59 -0
- package/src/components/controls/base/DshEditor.vue +166 -0
- package/src/components/controls/base/DshInput.vue +139 -0
- package/src/components/controls/base/DshLabels.vue +302 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +425 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -0
- package/src/components/controls/base/DshNumber/DshNumber.vue +148 -0
- package/src/components/controls/base/DshNumberange.vue +137 -0
- package/src/components/controls/base/DshPackage.vue +72 -0
- package/src/components/controls/base/DshSelect.vue +231 -0
- package/src/components/controls/base/DshSwitch.vue +112 -0
- package/src/components/controls/base/DshUndeveloped.vue +39 -0
- package/src/components/controls/base/YSerialNumber.vue +37 -0
- package/src/components/controls/base/ZUpload/YUploadImage.vue +228 -0
- package/src/components/controls/base/ZUpload/index.vue +356 -0
- package/src/components/controls/base/ZUpload/upload-list.vue +277 -0
- package/src/components/controls/base/ZUpload/upload-listItem.vue +0 -0
- package/src/components/controls/base/ZUpload/uploadMixin.js +397 -0
- package/src/components/controls/base/selectMixin.js +110 -0
- package/src/components/controls/base/textMultiple/DshTextMultiple.vue +94 -0
- package/src/components/controls/base/textMultiple/MultipleInput.vue +106 -0
- package/src/components/controls/controlMap.js +94 -0
- package/src/components/controls/controlMixin.js +84 -0
- package/src/components/form/DshAdvSearchForm.vue +341 -0
- package/src/components/form/DshDefaultSearch.vue +203 -0
- package/src/components/form/DshForm.vue +364 -0
- package/src/components/form/searchMixin.js +205 -0
- package/src/components/list/DshBox/DshBox.vue +168 -0
- package/src/components/list/DshBox/DshCard.vue +219 -0
- package/src/components/list/DshBox/DshCrossTable.vue +624 -0
- package/src/components/list/DshBox/DshList.vue +442 -0
- package/src/components/list/DshBox/DshPanel.vue +407 -0
- package/src/components/list/DshBox/DshSingleData.vue +82 -0
- package/src/components/list/DshBox/DshTable.vue +273 -0
- package/src/components/list/DshCascaderTable.vue +817 -0
- package/src/components/list/DshFlatTable.vue +622 -0
- package/src/components/list/ZTree.vue +527 -0
- package/src/components/list/easyTable/index.js +23 -0
- package/src/components/list/easyTable/src/directives/clickoutside.js +32 -0
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +62 -0
- package/src/components/list/easyTable/src/settings/settings.js +11 -0
- package/src/components/list/easyTable/src/utils/deepClone.js +256 -0
- package/src/components/list/easyTable/src/utils/dom.js +41 -0
- package/src/components/list/easyTable/src/utils/utils.js +190 -0
- package/src/components/list/easyTable/v-checkbox/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +127 -0
- package/src/components/list/easyTable/v-checkbox-group/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +68 -0
- package/src/components/list/easyTable/v-dropdown/index.js +7 -0
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +337 -0
- package/src/components/list/easyTable/v-table/index.js +7 -0
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +141 -0
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +102 -0
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +189 -0
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +56 -0
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +202 -0
- package/src/components/list/easyTable/v-table/src/export-csv.js +74 -0
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +134 -0
- package/src/components/list/easyTable/v-table/src/loading.vue +49 -0
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +21 -0
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +92 -0
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +108 -0
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +73 -0
- package/src/components/list/easyTable/v-table/src/table-empty.vue +66 -0
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +126 -0
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +122 -0
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +279 -0
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +123 -0
- package/src/components/list/easyTable/v-table/src/table.vue +1565 -0
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +115 -0
- package/src/components/list/evTable/EvTable.vue +323 -0
- package/src/components/list/evTable/EvTableMixin.js +26 -0
- package/src/components/other/DshAvatar.vue +149 -0
- package/src/components/other/DshBtnModal.vue +64 -0
- package/src/components/other/DshColorPanel.vue +128 -0
- package/src/components/other/DshEditPanel.vue +130 -0
- package/src/components/other/InfoCascader.vue +258 -0
- package/src/components/other/YNoPermission.vue +45 -0
- package/src/components/other/ZCode.vue +125 -0
- package/src/components/other/ZCollapseTree.vue +84 -0
- package/src/components/other/ZGantt.vue +669 -0
- package/src/components/other/ZIframe.vue +105 -0
- package/src/components/other/ZLoading.vue +59 -0
- package/src/components/other/menu/DshMenu.vue +133 -0
- package/src/components/other/menu/DshMenuNav.vue +104 -0
- package/src/components/pages/Error/Error403.vue +34 -0
- package/src/components/pages/Error/Error404.vue +34 -0
- package/src/components/pages/Error/Error500.vue +34 -0
- package/src/components/pages/Error/error.less +163 -0
- package/src/components/pages/Error/errorBack.vue +38 -0
- package/src/components/small/Ctooltip.vue +90 -0
- package/src/components/small/DshButtons.vue +195 -0
- package/src/components/small/DshControlDefine.vue +110 -0
- package/src/components/small/DshCrumbs.vue +61 -0
- package/src/components/small/DshCrumbsItem.vue +107 -0
- package/src/components/small/DshDropdown.vue +159 -0
- package/src/components/small/DshFileShow.vue +212 -0
- package/src/components/small/DshIcons.vue +63 -0
- package/src/components/small/DshModal.vue +255 -0
- package/src/components/small/DshPage.vue +98 -0
- package/src/components/small/DshSteps.vue +68 -0
- package/src/components/small/DshTabs.vue +227 -0
- package/src/components/small/DshTags.vue +58 -0
- package/src/components/small/DshTdRender.js +21 -0
- package/src/components/small/DshTitle.vue +36 -0
- package/src/components/small/render.js +20 -0
- package/src/components/unit/DshFormItem.vue +157 -0
- package/src/components/unit/DshUnit.vue +72 -0
- package/src/components/unit/unitMixin.js +43 -0
- package/src/datas/.DS_Store +0 -0
- package/src/datas/common/region.json +1 -0
- package/src/datas/common/resourceData.json +20 -0
- package/src/datas/index.js +11 -0
- package/src/index.js +243 -0
- package/src/styles/animate.less +16 -0
- package/src/styles/bundle.css +14 -0
- package/src/styles/common/box.less +157 -0
- package/src/styles/common/common.less +31 -0
- package/src/styles/common/flex.less +282 -0
- package/src/styles/common/index.less +4 -0
- package/src/styles/common/text.less +43 -0
- package/src/styles/components/controls/DshCascader.less +75 -0
- package/src/styles/components/controls/DshCheckbox.less +156 -0
- package/src/styles/components/controls/DshCoordinates.less +72 -0
- package/src/styles/components/controls/DshDaterange.less +49 -0
- package/src/styles/components/controls/DshDivider.less +115 -0
- package/src/styles/components/controls/DshEditor.less +52 -0
- package/src/styles/components/controls/DshInput.less +40 -0
- package/src/styles/components/controls/DshLabels.less +187 -0
- package/src/styles/components/controls/DshNumberange.less +24 -0
- package/src/styles/components/controls/DshPackage.less +25 -0
- package/src/styles/components/controls/DshSelect.less +172 -0
- package/src/styles/components/controls/MultipleInput.less +55 -0
- package/src/styles/components/controls/ZUpload.less +446 -0
- package/src/styles/components/form/DshAdvSearchForm.less +159 -0
- package/src/styles/components/form/DshDefaultSearch.less +71 -0
- package/src/styles/components/index.less +49 -0
- package/src/styles/components/list/DshCascaderTable.less +113 -0
- package/src/styles/components/list/DshCrossTable.less +175 -0
- package/src/styles/components/list/DshFlatTable.less +98 -0
- package/src/styles/components/list/DshSingleData.less +30 -0
- package/src/styles/components/list/evTable.less +79 -0
- package/src/styles/components/list/evtable/animation.less +141 -0
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +32 -0
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +68 -0
- package/src/styles/components/list/evtable/index.less +5 -0
- package/src/styles/components/list/evtable/v-checkbox.less +167 -0
- package/src/styles/components/list/evtable/v-dropdown.less +235 -0
- package/src/styles/components/list/evtable/v-table.less +334 -0
- package/src/styles/components/list/ivu_reset.less +49 -0
- package/src/styles/components/other/DshEditPanel.less +70 -0
- package/src/styles/components/other/DshMenu.less +37 -0
- package/src/styles/components/other/DshMenuNav.less +82 -0
- package/src/styles/components/other/InfoCascader.less +55 -0
- package/src/styles/components/other/ZCode.less +1 -0
- package/src/styles/components/other/ZCollapseTree.less +62 -0
- package/src/styles/components/other/ZGantt.less +278 -0
- package/src/styles/components/other/ZLoading.less +36 -0
- package/src/styles/components/small/Ctooltip.less +5 -0
- package/src/styles/components/small/DshButtons.less +40 -0
- package/src/styles/components/small/DshControlDefine.less +64 -0
- package/src/styles/components/small/DshDropdown.less +61 -0
- package/src/styles/components/small/DshPage.less +94 -0
- package/src/styles/components/small/DshSteps.less +58 -0
- package/src/styles/components/small/DshTabs.less +82 -0
- package/src/styles/components/small/DshTitle.less +18 -0
- package/src/styles/components/unit/DshFormItem.less +124 -0
- package/src/styles/define.less +374 -0
- package/src/styles/index.less +10 -0
- package/src/styles/reset.less +83 -0
- package/src/styles/variables.less +98 -0
- package/src/styles/view_reset.less +446 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`DshFlatTable control-${mode}`">
|
|
3
|
+
<!-- 表格内容 -->
|
|
4
|
+
<div class="DshFlatTable-block">
|
|
5
|
+
<table
|
|
6
|
+
class="table"
|
|
7
|
+
border="1"
|
|
8
|
+
cellspacing="0"
|
|
9
|
+
bordercolor="#CFD9EB"
|
|
10
|
+
>
|
|
11
|
+
<!-- 表头 -->
|
|
12
|
+
<thead>
|
|
13
|
+
<tr class="table-head">
|
|
14
|
+
<th
|
|
15
|
+
v-for="(col, colIndex) in showColumns"
|
|
16
|
+
:key="colIndex"
|
|
17
|
+
:style="getThStyle('head', col)"
|
|
18
|
+
@click="clickTh(col, colIndex)"
|
|
19
|
+
>
|
|
20
|
+
<span>
|
|
21
|
+
<i
|
|
22
|
+
v-if="col._required"
|
|
23
|
+
style="color:#ed4014"
|
|
24
|
+
>*</i>
|
|
25
|
+
|
|
26
|
+
<template v-if="col._type === 'selection'">
|
|
27
|
+
<Checkbox
|
|
28
|
+
:indeterminate="indeterminate"
|
|
29
|
+
:value="checkAll"
|
|
30
|
+
@click.prevent.native="clickCheckAll"
|
|
31
|
+
></Checkbox>
|
|
32
|
+
</template>
|
|
33
|
+
<template v-else>
|
|
34
|
+
{{ col._name }}
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<Tooltip
|
|
38
|
+
v-if="col._description"
|
|
39
|
+
transfer
|
|
40
|
+
max-width="200"
|
|
41
|
+
>
|
|
42
|
+
<Icon
|
|
43
|
+
class="table-head-description"
|
|
44
|
+
custom="bico-font bico-explain"
|
|
45
|
+
></Icon>
|
|
46
|
+
<div slot="content">
|
|
47
|
+
<span style="font-weight:normal;">{{ col._description }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</Tooltip>
|
|
50
|
+
</span>
|
|
51
|
+
</th>
|
|
52
|
+
</tr>
|
|
53
|
+
</thead>
|
|
54
|
+
|
|
55
|
+
<!-- 行数据 -->
|
|
56
|
+
<tbody
|
|
57
|
+
v-if="listData.length"
|
|
58
|
+
:style="{ 'max-height': contentHeight + 'px' }"
|
|
59
|
+
>
|
|
60
|
+
<tr
|
|
61
|
+
v-for="(row, rowIndex) in listData"
|
|
62
|
+
:key="rowIndex"
|
|
63
|
+
class="table-row"
|
|
64
|
+
>
|
|
65
|
+
<!-- 单元格 -->
|
|
66
|
+
<td
|
|
67
|
+
v-for="(col, colIndex) in showColumns"
|
|
68
|
+
:key="colIndex"
|
|
69
|
+
:style="getThStyle('row', col)"
|
|
70
|
+
class="table-row-td"
|
|
71
|
+
@click="clickTd(row, col)"
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
class="td-inner"
|
|
75
|
+
:style="{
|
|
76
|
+
padding: '5px 8px 16px'
|
|
77
|
+
// margin: isShowCompare(col, row, oldListData[rowIndex]) ? '-1px' : undefined,
|
|
78
|
+
// border: isShowCompare(col, row, oldListData[rowIndex]) ? '1px solid #ed4014' : undefined
|
|
79
|
+
}"
|
|
80
|
+
>
|
|
81
|
+
<!--对比值 -->
|
|
82
|
+
<Tooltip
|
|
83
|
+
v-if="isShowCompare(col, row, oldListData[rowIndex])"
|
|
84
|
+
class="td-inner-compare"
|
|
85
|
+
:content="$isEmptyData(oldListData[rowIndex][col._key]) ? '空' : `${oldListData[rowIndex][col._key]}`"
|
|
86
|
+
placement="top"
|
|
87
|
+
:transfer="true"
|
|
88
|
+
maxWidth="200"
|
|
89
|
+
>
|
|
90
|
+
<dsh-unit
|
|
91
|
+
class="td-inner-compare-unit"
|
|
92
|
+
:mode="mode"
|
|
93
|
+
:canEdit="getUnitCanEdit(col, row)"
|
|
94
|
+
:parentData="listData"
|
|
95
|
+
:formData="row"
|
|
96
|
+
:formItem="col"
|
|
97
|
+
:isShare="isShare"
|
|
98
|
+
:rowIndex="rowIndex"
|
|
99
|
+
@blur="controlBlur(null, col, row, arguments)"
|
|
100
|
+
@change="$dispatchEvent(operationMap.changeVal, col, row, rowIndex, arguments)"
|
|
101
|
+
></dsh-unit>
|
|
102
|
+
</Tooltip>
|
|
103
|
+
|
|
104
|
+
<dsh-unit
|
|
105
|
+
v-else
|
|
106
|
+
:mode="mode"
|
|
107
|
+
:canEdit="getUnitCanEdit(col, row)"
|
|
108
|
+
:parentData="listData"
|
|
109
|
+
:formData="row"
|
|
110
|
+
:formItem="col"
|
|
111
|
+
:isShare="isShare"
|
|
112
|
+
:rowIndex="rowIndex"
|
|
113
|
+
@blur="controlBlur(null, col, row, arguments)"
|
|
114
|
+
@change="$dispatchEvent(operationMap.changeVal, col, row, rowIndex, arguments)"
|
|
115
|
+
></dsh-unit>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<!-- 必填提示 -->
|
|
119
|
+
<span
|
|
120
|
+
v-if="!getRuleResult(col, row).bool"
|
|
121
|
+
class="table-row-td-tip"
|
|
122
|
+
>
|
|
123
|
+
{{ getRuleResult(col, row).message }}
|
|
124
|
+
</span>
|
|
125
|
+
|
|
126
|
+
<!-- 添加图标 -->
|
|
127
|
+
<a
|
|
128
|
+
v-if="col._type === 'index' && operationMap.create && !operationMap.create.disabled"
|
|
129
|
+
class="table-row-td-add"
|
|
130
|
+
href="javascript:void(0)"
|
|
131
|
+
@click="$dispatchEvent(operationMap.create, row, rowIndex, listData)"
|
|
132
|
+
>
|
|
133
|
+
<Icon
|
|
134
|
+
type="md-add-circle"
|
|
135
|
+
size="20"
|
|
136
|
+
/>
|
|
137
|
+
</a>
|
|
138
|
+
</td>
|
|
139
|
+
</tr>
|
|
140
|
+
|
|
141
|
+
<!-- 汇总行 -->
|
|
142
|
+
<tr
|
|
143
|
+
v-if="useSummary && listData.length"
|
|
144
|
+
:key="listData.length + 1"
|
|
145
|
+
class="table-row"
|
|
146
|
+
>
|
|
147
|
+
<td
|
|
148
|
+
v-for="(col, colIndex) in showColumns"
|
|
149
|
+
:key="colIndex"
|
|
150
|
+
:style="getThStyle('foot', col)"
|
|
151
|
+
>
|
|
152
|
+
<span>{{ getSummaryRowVal(col) }}</span>
|
|
153
|
+
</td>
|
|
154
|
+
</tr>
|
|
155
|
+
</tbody>
|
|
156
|
+
|
|
157
|
+
<!-- 脚 -->
|
|
158
|
+
<tfoot v-else>
|
|
159
|
+
<tr>
|
|
160
|
+
<td
|
|
161
|
+
class="table-row-nodata"
|
|
162
|
+
:colspan="showColumns.length"
|
|
163
|
+
>暂无数据……</td>
|
|
164
|
+
</tr>
|
|
165
|
+
</tfoot>
|
|
166
|
+
</table>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<!-- 添加行 -->
|
|
170
|
+
<dsh-buttons
|
|
171
|
+
class="DshFlatTable-create"
|
|
172
|
+
:list="$getOperationList(['create'])"
|
|
173
|
+
@click="$dispatchEvent($event, null, null, listData)"
|
|
174
|
+
></dsh-buttons>
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
177
|
+
|
|
178
|
+
<script>
|
|
179
|
+
import DshUnit from "../unit/DshUnit.vue";
|
|
180
|
+
|
|
181
|
+
export default {
|
|
182
|
+
name: "DshFlatTable",
|
|
183
|
+
components: {
|
|
184
|
+
DshUnit
|
|
185
|
+
},
|
|
186
|
+
props: {
|
|
187
|
+
mode: {
|
|
188
|
+
type: String,
|
|
189
|
+
default: "default"
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
canEdit: {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
default: true
|
|
195
|
+
},
|
|
196
|
+
columns: {
|
|
197
|
+
type: Array,
|
|
198
|
+
default () {
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
data: {
|
|
203
|
+
type: Array,
|
|
204
|
+
default () {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
oldData: {
|
|
209
|
+
type: Array,
|
|
210
|
+
default () {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
rowDefault: {
|
|
215
|
+
type: Object,
|
|
216
|
+
default () {
|
|
217
|
+
return {};
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
propsObj: {
|
|
222
|
+
type: Object,
|
|
223
|
+
default () {
|
|
224
|
+
return {};
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
isShare: Boolean
|
|
228
|
+
},
|
|
229
|
+
data () {
|
|
230
|
+
return {
|
|
231
|
+
selections: [],
|
|
232
|
+
|
|
233
|
+
showRuleMessage: false, // 显示校验文字
|
|
234
|
+
ruleRecordMap: {}
|
|
235
|
+
// createRowMap: {} // 用作标记哪些是新增行
|
|
236
|
+
};
|
|
237
|
+
},
|
|
238
|
+
computed: {
|
|
239
|
+
listData () {
|
|
240
|
+
this.data.forEach(item => {
|
|
241
|
+
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
242
|
+
});
|
|
243
|
+
return this.data;
|
|
244
|
+
},
|
|
245
|
+
oldListData () {
|
|
246
|
+
this.oldData.forEach(item => {
|
|
247
|
+
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
248
|
+
});
|
|
249
|
+
return this.oldData;
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
selfPropsObj () {
|
|
253
|
+
return {
|
|
254
|
+
_contentHeight: 500,
|
|
255
|
+
_useSelection: false, // 使用选择列
|
|
256
|
+
_useIndex: true, // 使用序号列
|
|
257
|
+
_useSummary: false, // 使用汇总行
|
|
258
|
+
_disabledBtns: false, // 禁用增删按钮
|
|
259
|
+
_disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
|
|
260
|
+
_disabledOldDataRow: false, // 置灰老数据行包含删除
|
|
261
|
+
|
|
262
|
+
...this.propsObj
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
contentHeight () {
|
|
266
|
+
return this.selfPropsObj._contentHeight;
|
|
267
|
+
},
|
|
268
|
+
useSelection () {
|
|
269
|
+
return this.selfPropsObj._useSelection;
|
|
270
|
+
},
|
|
271
|
+
useIndex () {
|
|
272
|
+
return this.selfPropsObj._useIndex;
|
|
273
|
+
},
|
|
274
|
+
useSummary () {
|
|
275
|
+
return this.selfPropsObj._useSummary;
|
|
276
|
+
},
|
|
277
|
+
disabledBtns () {
|
|
278
|
+
return this.selfPropsObj._disabledBtns;
|
|
279
|
+
},
|
|
280
|
+
disabledCreateBtn () {
|
|
281
|
+
return this.selfPropsObj._disabledCreateBtn;
|
|
282
|
+
},
|
|
283
|
+
disabledOldDataRow () {
|
|
284
|
+
return this.selfPropsObj._disabledOldDataRow;
|
|
285
|
+
},
|
|
286
|
+
useCampare () {
|
|
287
|
+
return !!this.oldListData.length;
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
showColumns () {
|
|
291
|
+
const operationList = this.$getOperationList(["delete"]);
|
|
292
|
+
const showColumns = [
|
|
293
|
+
...(
|
|
294
|
+
this.useSelection === true
|
|
295
|
+
? [
|
|
296
|
+
{
|
|
297
|
+
_id: this.$ObjectID().str,
|
|
298
|
+
_name: "全选",
|
|
299
|
+
_type: "selection",
|
|
300
|
+
_key: "selection",
|
|
301
|
+
_align: "center",
|
|
302
|
+
render: (h, { row, index, column }) => {
|
|
303
|
+
return h("Checkbox", {
|
|
304
|
+
props: {
|
|
305
|
+
value: this.selections.some(item => item._id === row._id)
|
|
306
|
+
},
|
|
307
|
+
on: {
|
|
308
|
+
input: ($event) => this.clickRowCheck($event, row)
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
: []
|
|
315
|
+
),
|
|
316
|
+
|
|
317
|
+
...(
|
|
318
|
+
this.useIndex === true
|
|
319
|
+
? [
|
|
320
|
+
{
|
|
321
|
+
_id: this.$ObjectID().str,
|
|
322
|
+
_name: "序号",
|
|
323
|
+
_type: "index",
|
|
324
|
+
_key: "index",
|
|
325
|
+
_align: "center"
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
: []
|
|
329
|
+
),
|
|
330
|
+
|
|
331
|
+
...this.columns.filter(colItem => colItem._displayType !== "hide"),
|
|
332
|
+
|
|
333
|
+
...(
|
|
334
|
+
this.canEdit && operationList.length
|
|
335
|
+
? [
|
|
336
|
+
{
|
|
337
|
+
_id: this.$ObjectID().str,
|
|
338
|
+
_name: "操作",
|
|
339
|
+
_type: "operation",
|
|
340
|
+
_key: "operation",
|
|
341
|
+
_align: "center",
|
|
342
|
+
_width: 80,
|
|
343
|
+
render: (h, params) => {
|
|
344
|
+
return h("dsh-buttons", {
|
|
345
|
+
props: {
|
|
346
|
+
list: this.disabledOldDataRow && !params.row.__isCreate__ ? [] : operationList
|
|
347
|
+
// list: this.disabledOldDataRow && !this.createRowMap[params.row._id] ? [] : operationList
|
|
348
|
+
},
|
|
349
|
+
on: {
|
|
350
|
+
click: (operationItem) => {
|
|
351
|
+
this.$dispatchEvent(operationItem, params.row, params.index, this.listData);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
]
|
|
358
|
+
: []
|
|
359
|
+
)
|
|
360
|
+
];
|
|
361
|
+
|
|
362
|
+
return showColumns;
|
|
363
|
+
},
|
|
364
|
+
selfRowDefault () {
|
|
365
|
+
return this.$filterObj(this.columns, this.rowDefault);
|
|
366
|
+
},
|
|
367
|
+
checkAll () {
|
|
368
|
+
return !!this.selections.length && !!this.listData.length && this.selections.length === this.listData.length;
|
|
369
|
+
},
|
|
370
|
+
indeterminate () {
|
|
371
|
+
return !!this.selections.length && !!this.listData.length && this.selections.length !== this.listData.length;
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
operationMap () {
|
|
375
|
+
const allOperationMap = {
|
|
376
|
+
create: {
|
|
377
|
+
name: "添加一行",
|
|
378
|
+
type: "create",
|
|
379
|
+
icon: "md-add",
|
|
380
|
+
size: "default",
|
|
381
|
+
long: true,
|
|
382
|
+
disabled: !!this.disabledCreateBtn,
|
|
383
|
+
event: "clickCreate"
|
|
384
|
+
},
|
|
385
|
+
delete: {
|
|
386
|
+
name: "删除",
|
|
387
|
+
type: "delete",
|
|
388
|
+
color: "#ed4014",
|
|
389
|
+
btnType: "text",
|
|
390
|
+
// icon: "md-trash",
|
|
391
|
+
disabled: false,
|
|
392
|
+
event: "clickDelete"
|
|
393
|
+
},
|
|
394
|
+
// expand: {
|
|
395
|
+
// name: "展开",
|
|
396
|
+
// type: "expand",
|
|
397
|
+
// event: "clickExpand"
|
|
398
|
+
// },
|
|
399
|
+
changeVal: {
|
|
400
|
+
name: "改变输入框值",
|
|
401
|
+
type: "changeVal",
|
|
402
|
+
event: "changeVal"
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
return this.canEdit
|
|
407
|
+
? this.$categoryMapToMap(
|
|
408
|
+
allOperationMap,
|
|
409
|
+
null,
|
|
410
|
+
this.disabledBtns ? ["create", "delete"] : []
|
|
411
|
+
)
|
|
412
|
+
: {};
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
created () {},
|
|
416
|
+
methods: {
|
|
417
|
+
// 共外部使用
|
|
418
|
+
validate () {
|
|
419
|
+
this.showRuleMessage = true;
|
|
420
|
+
|
|
421
|
+
return this.listData.every(dataItem =>
|
|
422
|
+
this.showColumns.every(col => this.getRuleResult(col, dataItem, true).bool)
|
|
423
|
+
);
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
// 点击表头
|
|
427
|
+
clickTh (col, colIndex) {
|
|
428
|
+
this.$emit("clickTh", col, colIndex);
|
|
429
|
+
},
|
|
430
|
+
// 点击单元格
|
|
431
|
+
clickTd (row, col) {},
|
|
432
|
+
// // 点击 -打开行
|
|
433
|
+
// clickExpand (operationItem, row, index, list) {},
|
|
434
|
+
// 点击全选
|
|
435
|
+
clickCheckAll () {
|
|
436
|
+
if (this.selections.length) {
|
|
437
|
+
this.selections = [];
|
|
438
|
+
} else {
|
|
439
|
+
this.selections = this.listData;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
this.$emit("selectAll", this.selections);
|
|
443
|
+
},
|
|
444
|
+
// 点击行选择
|
|
445
|
+
clickRowCheck (bool, row) {
|
|
446
|
+
if (bool) {
|
|
447
|
+
this.selections.push(row);
|
|
448
|
+
} else {
|
|
449
|
+
this.selections = this.selections.filter(checkItem => checkItem._id !== row._id);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.$emit("selectChange", this.selections, row, bool);
|
|
453
|
+
},
|
|
454
|
+
// 点击 -添加行
|
|
455
|
+
clickCreate (operationItem, row, index, list) {
|
|
456
|
+
const newRow = {
|
|
457
|
+
...this.$deepCopy(this.selfRowDefault),
|
|
458
|
+
__isCreate__: true,
|
|
459
|
+
_id: this.$ObjectID().str
|
|
460
|
+
};
|
|
461
|
+
const newRowIndex = index == null ? list.length : index + 1;
|
|
462
|
+
list.splice(newRowIndex, 0, newRow);
|
|
463
|
+
|
|
464
|
+
// this.$set(this.createRowMap, newRow._id, true);
|
|
465
|
+
this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
|
|
466
|
+
|
|
467
|
+
this.change("createRow", null, newRow, newRowIndex);
|
|
468
|
+
},
|
|
469
|
+
// 点击 -删除行
|
|
470
|
+
clickDelete (operationItem, row, rowIndex, list) {
|
|
471
|
+
this.$Modal.confirm({
|
|
472
|
+
title: "警告",
|
|
473
|
+
content: "确定删除吗?",
|
|
474
|
+
onOk: () => {
|
|
475
|
+
list.splice(rowIndex, 1);
|
|
476
|
+
this.selections = [];
|
|
477
|
+
|
|
478
|
+
this.change("deleteRow", null, row, rowIndex);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
},
|
|
482
|
+
// 表单控件值改变
|
|
483
|
+
changeVal (operationItem, col, row, rowIndex, params) {
|
|
484
|
+
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
485
|
+
|
|
486
|
+
this.change("changeVal", col, row, rowIndex, ...params);
|
|
487
|
+
},
|
|
488
|
+
// 表单控件失去焦点
|
|
489
|
+
controlBlur (operationItem, col, row, params) {
|
|
490
|
+
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
491
|
+
},
|
|
492
|
+
change (...params) {
|
|
493
|
+
this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
/* --------------- 工具方法 ------------- */
|
|
497
|
+
getUnitCanEdit (col, row) {
|
|
498
|
+
return this.canEdit && // 是否是编辑状态
|
|
499
|
+
// (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
|
|
500
|
+
(!this.disabledOldDataRow || !!row.__isCreate__) && // 是否让老数据行置灰
|
|
501
|
+
(!col.dependRowCanEdit || row.canEdit !== false); // 在老数据行里某些列不可编辑
|
|
502
|
+
},
|
|
503
|
+
isShowCompare (col, row, oldRow = {}) {
|
|
504
|
+
return this.useCampare && ["number"].includes(col._type) &&
|
|
505
|
+
!(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
|
|
506
|
+
row[col._key] !== oldRow[col._key];
|
|
507
|
+
},
|
|
508
|
+
// 获取单元格样式
|
|
509
|
+
getThStyle (type, col) {
|
|
510
|
+
let textAlign = col._align || "left";
|
|
511
|
+
if (["index", "selection"].includes(col._type)) {
|
|
512
|
+
col.width = col._width || 46;
|
|
513
|
+
} else if (["text", "textarea", "email"].includes(col._type)) {
|
|
514
|
+
col.width = col._width || 200;
|
|
515
|
+
} else if (["idcard"].includes(col._type)) {
|
|
516
|
+
col.width = col._width || 190;
|
|
517
|
+
} else if (["phone"].includes(col._type)) {
|
|
518
|
+
col.width = col._width || 130;
|
|
519
|
+
} else if (["number"].includes(col._type)) {
|
|
520
|
+
col.width = col._width || 120;
|
|
521
|
+
// textAlign = col._align || "right";
|
|
522
|
+
} else if (["date"].includes(col._type)) {
|
|
523
|
+
switch (col._dateType) {
|
|
524
|
+
case "date": col.width = col._width || 120; break;
|
|
525
|
+
case "year": col.width = col._width || 96; break;
|
|
526
|
+
case "month": col.width = col._width || 120; break;
|
|
527
|
+
case "time": col.width = col._width || 120; break;
|
|
528
|
+
case "datetime": col.width = col._width || 180; break;
|
|
529
|
+
default: col.width = 120; break;
|
|
530
|
+
}
|
|
531
|
+
} else if (["switch"].includes(col._type)) {
|
|
532
|
+
col.width = col._width || 80;
|
|
533
|
+
textAlign = col._align || "center";
|
|
534
|
+
} else if (["select"].includes(col._type)) {
|
|
535
|
+
col.width = col._width || 120;
|
|
536
|
+
textAlign = col._align || "center";
|
|
537
|
+
} else if (["checkbox"].includes(col._type)) {
|
|
538
|
+
col.width = col._width || 180;
|
|
539
|
+
} else if (["cascader"].includes(col._type)) {
|
|
540
|
+
col.width = col._width || 150;
|
|
541
|
+
} else if (["region"].includes(col._type)) {
|
|
542
|
+
col.width = col._width || 212;
|
|
543
|
+
} else if (["file", "image"].includes(col._type)) {
|
|
544
|
+
col.width = col._width || 170;
|
|
545
|
+
textAlign = col._align || "center";
|
|
546
|
+
} else if (["flatTable", "cascaderTable", "editor"].includes(col._type)) {
|
|
547
|
+
col.width = col._width || 100;
|
|
548
|
+
textAlign = col._align || "center";
|
|
549
|
+
} else if (["departments"].includes(col._type)) {
|
|
550
|
+
col.width = col._width || 100;
|
|
551
|
+
} else if (["users"].includes(col._type)) {
|
|
552
|
+
col.width = col._width || 120;
|
|
553
|
+
} else if (["reference"].includes(col._type)) {
|
|
554
|
+
col.width = (col._name ? col._name.length * 14 : 36) + 60;
|
|
555
|
+
} else if (["referenceBy"].includes(col._type)) {
|
|
556
|
+
col.width = col._width || 100;
|
|
557
|
+
} else {
|
|
558
|
+
col.width = col._width || 120;
|
|
559
|
+
}
|
|
560
|
+
let styleObj = {
|
|
561
|
+
width: col.width && `${col.width}px`,
|
|
562
|
+
minWidth: col.width && `${col.width}px`,
|
|
563
|
+
maxWidth: col.width && `${col.width}px`,
|
|
564
|
+
// width: colIndex === this.showColumns.length - 1 ? col.width && `${col.width}px` : undefined,
|
|
565
|
+
padding: "5px 8px 16px",
|
|
566
|
+
textAlign: textAlign,
|
|
567
|
+
|
|
568
|
+
...(
|
|
569
|
+
type === "head"
|
|
570
|
+
? {
|
|
571
|
+
cursor: "pointer"
|
|
572
|
+
}
|
|
573
|
+
: type === "row"
|
|
574
|
+
? {
|
|
575
|
+
height: "30px",
|
|
576
|
+
padding: undefined
|
|
577
|
+
}
|
|
578
|
+
: {
|
|
579
|
+
height: "30px"
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
return styleObj;
|
|
585
|
+
},
|
|
586
|
+
// 获取汇总单元格的值
|
|
587
|
+
getSummaryRowVal (col) {
|
|
588
|
+
return col._type === "index"
|
|
589
|
+
? "汇总"
|
|
590
|
+
: col._type === "number"
|
|
591
|
+
? this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 })
|
|
592
|
+
: null;
|
|
593
|
+
|
|
594
|
+
},
|
|
595
|
+
// 是否显示 单元格校验提示文字
|
|
596
|
+
getRuleResult (col, row, showRuleMessage = this.showRuleMessage) {
|
|
597
|
+
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || showRuleMessage) {
|
|
598
|
+
const val = row[col._key];
|
|
599
|
+
const ruleConfig = this.$getFormTypeRuleConfig(col);
|
|
600
|
+
// 为空 校验必填;不为空 格式校验 (不是必填也要校验格式)
|
|
601
|
+
return this.$isEmptyData(val)
|
|
602
|
+
? {
|
|
603
|
+
bool: !col._required,
|
|
604
|
+
message: `${col._name}为必填项`
|
|
605
|
+
}
|
|
606
|
+
: ruleConfig.regs && ruleConfig.regs.length
|
|
607
|
+
? {
|
|
608
|
+
bool: ruleConfig.regs.every(regItem => regItem.test(val)),
|
|
609
|
+
message: col.regMessage || `${col._name}格式不正确`
|
|
610
|
+
}
|
|
611
|
+
: {
|
|
612
|
+
bool: true
|
|
613
|
+
};
|
|
614
|
+
} else {
|
|
615
|
+
return {
|
|
616
|
+
bool: true
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
</script>
|