bri-components 1.2.49 → 1.2.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/controls/BriControlInput.vue +13 -9
- package/src/components/controls/base/DshCascader/DshCascader.vue +40 -23
- package/src/components/controls/base/DshCascader/InfoCascader.vue +7 -15
- package/src/components/controls/base/DshDate/DshDate.vue +146 -0
- package/src/components/controls/base/{DshDaterange.vue → DshDate/DshDaterange.vue} +74 -64
- package/src/components/controls/base/DshEditor.vue +1 -1
- package/src/components/controls/base/{BriInputs.vue → DshInput/BriInputs.vue} +1 -1
- package/src/components/controls/base/{DshInput.vue → DshInput/DshInput.vue} +21 -4
- package/src/components/controls/base/DshNumber/DshNumber.vue +33 -2
- package/src/components/controls/base/{DshNumberange.vue → DshNumber/DshNumberange.vue} +37 -2
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +280 -0
- package/src/components/controls/base/DshSelect/DshSelect.vue +319 -0
- package/src/components/controls/base/DshSelect/selectMixin.js +239 -0
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +79 -0
- package/src/components/controls/base/DshSwitch/switchMixin.js +73 -0
- package/src/components/controls/controlMap.js +8 -11
- package/src/components/controls/controlMixin.js +38 -6
- package/src/components/controls/senior/BriLabels.vue +1 -1
- package/src/components/controls/senior/selectDepartments.vue +9 -13
- package/src/components/controls/senior/selectUsers/selectUsers.vue +23 -21
- package/src/components/controls/special/DshBack.vue +1 -1
- package/src/components/controls/special/DshUndeveloped.vue +1 -1
- package/src/components/form/DshAdvSearch.vue +155 -3
- package/src/components/form/DshDefaultSearch.vue +84 -40
- package/src/components/form/DshForm.vue +24 -0
- package/src/components/form/searchMixin.js +5 -18
- package/src/components/other/BriGantt.vue +2 -2
- package/src/components/unit/DshFormUnit.vue +111 -2
- package/src/components/unit/DshListUnit.vue +6 -0
- package/src/index.js +10 -10
- package/src/styles/components/controls/base/DshInput.less +0 -16
- package/src/styles/components/index.less +0 -14
- package/src/styles/components/other/BriGantt.less +1 -12
- package/src/styles/index.less +5 -3
- package/src/styles/reset-iview-controls.less +104 -0
- package/src/abolish/BriTransfer.less +0 -65
- package/src/abolish/BriTransfer.vue +0 -71
- package/src/abolish/BriTree.less +0 -57
- package/src/abolish/DshCascaders.less +0 -11
- package/src/abolish/DshCascaders.vue +0 -151
- package/src/abolish/DshCrumbs.less +0 -0
- package/src/abolish/DshCrumbs.vue +0 -62
- package/src/abolish/DshCrumbsItem.vue +0 -109
- package/src/abolish/DshEditPanel.less +0 -70
- package/src/abolish/DshEditPanel.vue +0 -152
- package/src/abolish/DshFileShow.less +0 -61
- package/src/abolish/DshFileShow.vue +0 -0
- package/src/abolish/DshFlatTable.less +0 -93
- package/src/abolish/DshFlatTable.vue +0 -605
- package/src/abolish/DshMenu.less +0 -37
- package/src/abolish/DshMenu.vue +0 -133
- package/src/abolish/DshTexts.less +0 -13
- package/src/abolish/DshTexts.vue +0 -89
- package/src/components/controls/base/DshCheckbox.vue +0 -213
- package/src/components/controls/base/DshDate.vue +0 -122
- package/src/components/controls/base/DshSelect.vue +0 -242
- package/src/components/controls/base/DshSwitch.vue +0 -70
- package/src/components/controls/base/selectMixin.js +0 -110
- package/src/styles/components/controls/base/DshCheckbox.less +0 -115
- package/src/styles/components/controls/base/DshDate.less +0 -15
- package/src/styles/components/controls/base/DshDaterange.less +0 -49
- package/src/styles/components/controls/base/DshNumber.less +0 -55
- package/src/styles/components/controls/base/DshNumberange.less +0 -29
- package/src/styles/components/controls/base/DshSelect.less +0 -190
- package/src/styles/components/form/DshAdvSearch.less +0 -149
- package/src/styles/components/form/DshDefaultSearch.less +0 -82
- package/src/styles/components/form/DshForm.less +0 -18
- package/src/styles/components/unit/DshFormUnit.less +0 -105
- package/src/styles/components/unit/DshListUnit.less +0 -3
- /package/src/{abolish/DshCrumbItem.less → styles/reset-iview-other.less} +0 -0
- /package/src/styles/{reset-iview.less → reset-iview-variables.less} +0 -0
|
@@ -1,605 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="DshFlatTable">
|
|
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
|
-
}"
|
|
78
|
-
>
|
|
79
|
-
<!--对比值 -->
|
|
80
|
-
<Tooltip
|
|
81
|
-
v-if="isShowCompare(col, row, oldListData[rowIndex])"
|
|
82
|
-
class="td-inner-compare"
|
|
83
|
-
:content="$isEmptyData(oldListData[rowIndex][col._key]) ? '空' : `${oldListData[rowIndex][col._key]}`"
|
|
84
|
-
placement="top"
|
|
85
|
-
:transfer="true"
|
|
86
|
-
maxWidth="200"
|
|
87
|
-
>
|
|
88
|
-
<dsh-list-unit
|
|
89
|
-
class="td-inner-compare-unit"
|
|
90
|
-
:canEdit="getUnitCanEdit(col, row)"
|
|
91
|
-
:parentData="listData"
|
|
92
|
-
:formData="row"
|
|
93
|
-
:formItem="col"
|
|
94
|
-
:rowIndex="rowIndex"
|
|
95
|
-
@blur="controlBlur(null, col, row, arguments)"
|
|
96
|
-
@change="$dispatchEvent(operationMap.changeVal, col, row, rowIndex, arguments)"
|
|
97
|
-
></dsh-list-unit>
|
|
98
|
-
</Tooltip>
|
|
99
|
-
|
|
100
|
-
<dsh-list-unit
|
|
101
|
-
v-else
|
|
102
|
-
:canEdit="getUnitCanEdit(col, row)"
|
|
103
|
-
:parentData="listData"
|
|
104
|
-
:formData="row"
|
|
105
|
-
:formItem="col"
|
|
106
|
-
:rowIndex="rowIndex"
|
|
107
|
-
@blur="controlBlur(null, col, row, arguments)"
|
|
108
|
-
@change="$dispatchEvent(operationMap.changeVal, col, row, rowIndex, arguments)"
|
|
109
|
-
></dsh-list-unit>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<!-- 必填提示 -->
|
|
113
|
-
<span
|
|
114
|
-
v-if="!getRuleResult(col, row).bool"
|
|
115
|
-
class="table-row-td-tip"
|
|
116
|
-
>
|
|
117
|
-
{{ getRuleResult(col, row).message }}
|
|
118
|
-
</span>
|
|
119
|
-
|
|
120
|
-
<!-- 添加图标 -->
|
|
121
|
-
<a
|
|
122
|
-
v-if="col._type === 'index' && operationMap.create && !operationMap.create.disabled"
|
|
123
|
-
class="table-row-td-add"
|
|
124
|
-
href="javascript:void(0)"
|
|
125
|
-
@click="$dispatchEvent(operationMap.create, row, rowIndex, listData)"
|
|
126
|
-
>
|
|
127
|
-
<Icon
|
|
128
|
-
type="md-add-circle"
|
|
129
|
-
size="20"
|
|
130
|
-
/>
|
|
131
|
-
</a>
|
|
132
|
-
</td>
|
|
133
|
-
</tr>
|
|
134
|
-
|
|
135
|
-
<!-- 汇总行 -->
|
|
136
|
-
<tr
|
|
137
|
-
v-if="useSummary && listData.length"
|
|
138
|
-
:key="listData.length + 1"
|
|
139
|
-
class="table-row"
|
|
140
|
-
>
|
|
141
|
-
<td
|
|
142
|
-
v-for="(col, colIndex) in showColumns"
|
|
143
|
-
:key="colIndex"
|
|
144
|
-
:style="getThStyle('foot', col)"
|
|
145
|
-
>
|
|
146
|
-
<span>{{ getSummaryRowVal(col) }}</span>
|
|
147
|
-
</td>
|
|
148
|
-
</tr>
|
|
149
|
-
</tbody>
|
|
150
|
-
|
|
151
|
-
<!-- 脚 -->
|
|
152
|
-
<tfoot v-else>
|
|
153
|
-
<tr>
|
|
154
|
-
<td
|
|
155
|
-
class="table-row-nodata"
|
|
156
|
-
:colspan="showColumns.length"
|
|
157
|
-
>暂无内容……</td>
|
|
158
|
-
</tr>
|
|
159
|
-
</tfoot>
|
|
160
|
-
</table>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<!-- 添加行 -->
|
|
164
|
-
<dsh-buttons
|
|
165
|
-
class="DshFlatTable-create"
|
|
166
|
-
:list="$getOperationList(['create'])"
|
|
167
|
-
@click="$dispatchEvent($event, null, null, listData)"
|
|
168
|
-
></dsh-buttons>
|
|
169
|
-
</div>
|
|
170
|
-
</template>
|
|
171
|
-
|
|
172
|
-
<script>
|
|
173
|
-
import DshListUnit from "../unit/DshListUnit.vue";
|
|
174
|
-
|
|
175
|
-
export default {
|
|
176
|
-
name: "DshFlatTable",
|
|
177
|
-
components: {
|
|
178
|
-
DshListUnit
|
|
179
|
-
},
|
|
180
|
-
props: {
|
|
181
|
-
canEdit: {
|
|
182
|
-
type: Boolean,
|
|
183
|
-
default: true
|
|
184
|
-
},
|
|
185
|
-
columns: {
|
|
186
|
-
type: Array,
|
|
187
|
-
default () {
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
data: {
|
|
192
|
-
type: Array,
|
|
193
|
-
default () {
|
|
194
|
-
return [];
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
oldData: {
|
|
198
|
-
type: Array,
|
|
199
|
-
default () {
|
|
200
|
-
return [];
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
rowDefault: {
|
|
204
|
-
type: Object,
|
|
205
|
-
default () {
|
|
206
|
-
return {};
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
outObj: {
|
|
211
|
-
type: Object,
|
|
212
|
-
default () {
|
|
213
|
-
return {};
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
propsObj: {
|
|
217
|
-
type: Object,
|
|
218
|
-
default () {
|
|
219
|
-
return {};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
data () {
|
|
224
|
-
return {
|
|
225
|
-
selections: [],
|
|
226
|
-
|
|
227
|
-
showRuleMessage: false, // 显示校验文字
|
|
228
|
-
ruleRecordMap: {}
|
|
229
|
-
// createRowMap: {} // 用作标记哪些是新增行
|
|
230
|
-
};
|
|
231
|
-
},
|
|
232
|
-
computed: {
|
|
233
|
-
listData () {
|
|
234
|
-
this.data.forEach(item => {
|
|
235
|
-
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
236
|
-
});
|
|
237
|
-
return this.data;
|
|
238
|
-
},
|
|
239
|
-
oldListData () {
|
|
240
|
-
this.oldData.forEach(item => {
|
|
241
|
-
!item._id && this.$set(item, "_id", this.$ObjectID().str);
|
|
242
|
-
});
|
|
243
|
-
return this.oldData;
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
selfPropsObj () {
|
|
247
|
-
return {
|
|
248
|
-
isShare: false, // 是否是分享页在用
|
|
249
|
-
_contentHeight: 500,
|
|
250
|
-
_useSelection: false, // 使用选择列
|
|
251
|
-
_useIndex: true, // 使用序号列
|
|
252
|
-
_useSummary: false, // 使用汇总行
|
|
253
|
-
_disabledBtns: false, // 禁用增删按钮
|
|
254
|
-
_disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
|
|
255
|
-
_disabledOldDataRow: false, // 置灰老数据行包含删除
|
|
256
|
-
|
|
257
|
-
...this.propsObj
|
|
258
|
-
};
|
|
259
|
-
},
|
|
260
|
-
isShare () {
|
|
261
|
-
return this.selfPropsObj.isShare;
|
|
262
|
-
},
|
|
263
|
-
contentHeight () {
|
|
264
|
-
return this.selfPropsObj._contentHeight;
|
|
265
|
-
},
|
|
266
|
-
useSelection () {
|
|
267
|
-
return this.selfPropsObj._useSelection;
|
|
268
|
-
},
|
|
269
|
-
useIndex () {
|
|
270
|
-
return this.selfPropsObj._useIndex;
|
|
271
|
-
},
|
|
272
|
-
useSummary () {
|
|
273
|
-
return this.selfPropsObj._useSummary;
|
|
274
|
-
},
|
|
275
|
-
disabledBtns () {
|
|
276
|
-
return this.selfPropsObj._disabledBtns;
|
|
277
|
-
},
|
|
278
|
-
disabledCreateBtn () {
|
|
279
|
-
return this.selfPropsObj._disabledCreateBtn;
|
|
280
|
-
},
|
|
281
|
-
disabledOldDataRow () {
|
|
282
|
-
return this.selfPropsObj._disabledOldDataRow;
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
useCompare () {
|
|
286
|
-
return !!this.oldListData.length;
|
|
287
|
-
},
|
|
288
|
-
showColumns () {
|
|
289
|
-
const operationList = this.$getOperationList(["delete"]);
|
|
290
|
-
const showColumns = [
|
|
291
|
-
...(
|
|
292
|
-
this.useSelection === true
|
|
293
|
-
? [
|
|
294
|
-
{
|
|
295
|
-
_id: this.$ObjectID().str,
|
|
296
|
-
_name: "全选",
|
|
297
|
-
_type: "selection",
|
|
298
|
-
_key: "selection",
|
|
299
|
-
_align: "center",
|
|
300
|
-
render: (h, { row, index, column }) => {
|
|
301
|
-
return h("Checkbox", {
|
|
302
|
-
props: {
|
|
303
|
-
value: this.selections.some(item => item._id === row._id)
|
|
304
|
-
},
|
|
305
|
-
on: {
|
|
306
|
-
input: ($event) => this.clickRowCheck($event, row)
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
: []
|
|
313
|
-
),
|
|
314
|
-
|
|
315
|
-
...(
|
|
316
|
-
this.useIndex === true
|
|
317
|
-
? [
|
|
318
|
-
{
|
|
319
|
-
_id: this.$ObjectID().str,
|
|
320
|
-
_name: "序号",
|
|
321
|
-
_type: "index",
|
|
322
|
-
_key: "index",
|
|
323
|
-
_align: "center"
|
|
324
|
-
}
|
|
325
|
-
]
|
|
326
|
-
: []
|
|
327
|
-
),
|
|
328
|
-
|
|
329
|
-
...this.columns.filter(colItem => this.$isAdvRelyShow(colItem, this.outObj)),
|
|
330
|
-
|
|
331
|
-
...(
|
|
332
|
-
this.canEdit && operationList.length
|
|
333
|
-
? [
|
|
334
|
-
{
|
|
335
|
-
_id: this.$ObjectID().str,
|
|
336
|
-
_name: "操作",
|
|
337
|
-
_type: "operation",
|
|
338
|
-
_key: "operation",
|
|
339
|
-
_align: "center",
|
|
340
|
-
_width: 80,
|
|
341
|
-
render: (h, params) => {
|
|
342
|
-
return h("dsh-buttons", {
|
|
343
|
-
props: {
|
|
344
|
-
list: this.disabledOldDataRow && !params.row.__isCreate__ ? [] : operationList
|
|
345
|
-
// list: this.disabledOldDataRow && !this.createRowMap[params.row._id] ? [] : operationList
|
|
346
|
-
},
|
|
347
|
-
on: {
|
|
348
|
-
click: (operationItem) => {
|
|
349
|
-
this.$dispatchEvent(operationItem, params.row, params.index, this.listData);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
]
|
|
356
|
-
: []
|
|
357
|
-
)
|
|
358
|
-
];
|
|
359
|
-
|
|
360
|
-
return showColumns;
|
|
361
|
-
},
|
|
362
|
-
selfRowDefault () {
|
|
363
|
-
return this.$filterObj(this.columns, this.rowDefault);
|
|
364
|
-
},
|
|
365
|
-
checkAll () {
|
|
366
|
-
return !!this.selections.length && !!this.listData.length && this.selections.length === this.listData.length;
|
|
367
|
-
},
|
|
368
|
-
indeterminate () {
|
|
369
|
-
return !!this.selections.length && !!this.listData.length && this.selections.length !== this.listData.length;
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
operationMap () {
|
|
373
|
-
const allOperationMap = {
|
|
374
|
-
create: {
|
|
375
|
-
name: "添加一行",
|
|
376
|
-
type: "create",
|
|
377
|
-
icon: "md-add",
|
|
378
|
-
size: "default",
|
|
379
|
-
long: true,
|
|
380
|
-
disabled: !!this.disabledCreateBtn,
|
|
381
|
-
event: "clickCreate"
|
|
382
|
-
},
|
|
383
|
-
delete: {
|
|
384
|
-
name: "删除",
|
|
385
|
-
type: "delete",
|
|
386
|
-
color: "#ed4014",
|
|
387
|
-
btnType: "text",
|
|
388
|
-
// icon: "md-trash",
|
|
389
|
-
disabled: false,
|
|
390
|
-
event: "clickDelete"
|
|
391
|
-
},
|
|
392
|
-
// expand: {
|
|
393
|
-
// name: "展开",
|
|
394
|
-
// type: "expand",
|
|
395
|
-
// event: "clickExpand"
|
|
396
|
-
// },
|
|
397
|
-
changeVal: {
|
|
398
|
-
name: "改变输入框值",
|
|
399
|
-
type: "changeVal",
|
|
400
|
-
event: "changeVal"
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
return this.canEdit
|
|
405
|
-
? this.$categoryMapToMap(
|
|
406
|
-
allOperationMap,
|
|
407
|
-
null,
|
|
408
|
-
this.disabledBtns ? ["create", "delete"] : []
|
|
409
|
-
)
|
|
410
|
-
: {};
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
created () {},
|
|
414
|
-
methods: {
|
|
415
|
-
// 共外部使用
|
|
416
|
-
validate () {
|
|
417
|
-
this.showRuleMessage = true;
|
|
418
|
-
|
|
419
|
-
return this.listData.every(dataItem =>
|
|
420
|
-
this.showColumns.every(col => this.getRuleResult(col, dataItem, true).bool)
|
|
421
|
-
);
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
// 点击表头
|
|
425
|
-
clickTh (col, colIndex) {
|
|
426
|
-
this.$emit("clickTh", col, colIndex);
|
|
427
|
-
},
|
|
428
|
-
// 点击单元格
|
|
429
|
-
clickTd (row, col) {},
|
|
430
|
-
// // 点击 -打开行
|
|
431
|
-
// clickExpand (operationItem, row, index, list) {},
|
|
432
|
-
// 点击全选
|
|
433
|
-
clickCheckAll () {
|
|
434
|
-
if (this.selections.length) {
|
|
435
|
-
this.selections = [];
|
|
436
|
-
} else {
|
|
437
|
-
this.selections = this.listData;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
this.$emit("selectAll", this.selections);
|
|
441
|
-
},
|
|
442
|
-
// 点击行选择
|
|
443
|
-
clickRowCheck (bool, row) {
|
|
444
|
-
if (bool) {
|
|
445
|
-
this.selections.push(row);
|
|
446
|
-
} else {
|
|
447
|
-
this.selections = this.selections.filter(checkItem => checkItem._id !== row._id);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
this.$emit("changeSelect", this.selections, row, bool);
|
|
451
|
-
},
|
|
452
|
-
// 点击 -添加行
|
|
453
|
-
clickCreate (operationItem, row, index, list) {
|
|
454
|
-
const newRow = {
|
|
455
|
-
...this.$deepCopy(this.selfRowDefault),
|
|
456
|
-
__isCreate__: true,
|
|
457
|
-
_id: this.$ObjectID().str
|
|
458
|
-
};
|
|
459
|
-
const newRowIndex = index == null ? list.length : index + 1;
|
|
460
|
-
list.splice(newRowIndex, 0, newRow);
|
|
461
|
-
|
|
462
|
-
// this.$set(this.createRowMap, newRow._id, true);
|
|
463
|
-
this.$forceUpdate(); // 自定义页中点击添加一行没有更新页面
|
|
464
|
-
|
|
465
|
-
this.change("createRow", null, newRow, newRowIndex);
|
|
466
|
-
},
|
|
467
|
-
// 点击 -删除行
|
|
468
|
-
clickDelete (operationItem, row, rowIndex, list) {
|
|
469
|
-
this.$Modal.confirm({
|
|
470
|
-
title: "警告",
|
|
471
|
-
content: "确定删除吗?",
|
|
472
|
-
onOk: () => {
|
|
473
|
-
list.splice(rowIndex, 1);
|
|
474
|
-
this.selections = [];
|
|
475
|
-
|
|
476
|
-
this.change("deleteRow", null, row, rowIndex);
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
},
|
|
480
|
-
// 表单控件值改变
|
|
481
|
-
changeVal (operationItem, col, row, rowIndex, params) {
|
|
482
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
483
|
-
|
|
484
|
-
this.change("changeVal", col, row, rowIndex, ...params);
|
|
485
|
-
},
|
|
486
|
-
// 表单控件失去焦点
|
|
487
|
-
controlBlur (operationItem, col, row, params) {
|
|
488
|
-
this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
|
|
489
|
-
},
|
|
490
|
-
change (...params) {
|
|
491
|
-
this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
/* --------------- 工具方法 ------------- */
|
|
495
|
-
getUnitCanEdit (col, row) {
|
|
496
|
-
return this.canEdit && // 是否是编辑状态
|
|
497
|
-
// (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
|
|
498
|
-
(!this.disabledOldDataRow || !!row.__isCreate__) && // 是否让老数据行置灰
|
|
499
|
-
(!col.dependRowCanEdit || row.canEdit !== false); // 在老数据行里某些列不可编辑
|
|
500
|
-
},
|
|
501
|
-
isShowCompare (col, row, oldRow = {}) {
|
|
502
|
-
return this.useCompare && ["number"].includes(col._type) &&
|
|
503
|
-
!(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
|
|
504
|
-
row[col._key] !== oldRow[col._key];
|
|
505
|
-
},
|
|
506
|
-
// 获取单元格样式
|
|
507
|
-
getThStyle (type, col) {
|
|
508
|
-
let textAlign = col._align || "left";
|
|
509
|
-
if (["index", "selection"].includes(col._type)) {
|
|
510
|
-
col.width = col._width || 46;
|
|
511
|
-
} else if (["text", "textarea", "email"].includes(col._type)) {
|
|
512
|
-
col.width = col._width || 200;
|
|
513
|
-
} else if (["idcard"].includes(col._type)) {
|
|
514
|
-
col.width = col._width || 190;
|
|
515
|
-
} else if (["phone"].includes(col._type)) {
|
|
516
|
-
col.width = col._width || 130;
|
|
517
|
-
} else if (["number"].includes(col._type)) {
|
|
518
|
-
col.width = col._width || 120;
|
|
519
|
-
// textAlign = col._align || "right";
|
|
520
|
-
} else if (["date"].includes(col._type)) {
|
|
521
|
-
switch (col._dateType) {
|
|
522
|
-
case "date": col.width = col._width || 120; break;
|
|
523
|
-
case "year": col.width = col._width || 96; break;
|
|
524
|
-
case "month": col.width = col._width || 120; break;
|
|
525
|
-
case "time": col.width = col._width || 120; break;
|
|
526
|
-
case "datetime": col.width = col._width || 180; break;
|
|
527
|
-
default: col.width = 120; break;
|
|
528
|
-
}
|
|
529
|
-
} else if (["switch"].includes(col._type)) {
|
|
530
|
-
col.width = col._width || 80;
|
|
531
|
-
textAlign = col._align || "center";
|
|
532
|
-
} else if (["select"].includes(col._type)) {
|
|
533
|
-
col.width = col._width || 120;
|
|
534
|
-
textAlign = col._align || "center";
|
|
535
|
-
} else if (["checkbox"].includes(col._type)) {
|
|
536
|
-
col.width = col._width || 180;
|
|
537
|
-
} else if (["cascader"].includes(col._type)) {
|
|
538
|
-
col.width = col._width || 150;
|
|
539
|
-
} else if (["region"].includes(col._type)) {
|
|
540
|
-
col.width = col._width || 212;
|
|
541
|
-
} else if (["file", "image"].includes(col._type)) {
|
|
542
|
-
col.width = col._width || 170;
|
|
543
|
-
textAlign = col._align || "center";
|
|
544
|
-
} else if (["flatTable", "cascaderTable", "editor"].includes(col._type)) {
|
|
545
|
-
col.width = col._width || 100;
|
|
546
|
-
textAlign = col._align || "center";
|
|
547
|
-
} else if (["departments"].includes(col._type)) {
|
|
548
|
-
col.width = col._width || 100;
|
|
549
|
-
} else if (["users"].includes(col._type)) {
|
|
550
|
-
col.width = col._width || 120;
|
|
551
|
-
} else if (["reference"].includes(col._type)) {
|
|
552
|
-
col.width = (col._name ? col._name.length * 14 : 36) + 60;
|
|
553
|
-
} else if (["referenceBy"].includes(col._type)) {
|
|
554
|
-
col.width = col._width || 100;
|
|
555
|
-
} else {
|
|
556
|
-
col.width = col._width || 120;
|
|
557
|
-
}
|
|
558
|
-
let styleObj = {
|
|
559
|
-
width: col.width && `${col.width}px`,
|
|
560
|
-
minWidth: col.width && `${col.width}px`,
|
|
561
|
-
maxWidth: col.width && `${col.width}px`,
|
|
562
|
-
// width: colIndex === this.showColumns.length - 1 ? col.width && `${col.width}px` : undefined,
|
|
563
|
-
padding: "5px 8px 16px",
|
|
564
|
-
textAlign: textAlign,
|
|
565
|
-
|
|
566
|
-
...(
|
|
567
|
-
type === "head"
|
|
568
|
-
? {
|
|
569
|
-
cursor: "pointer"
|
|
570
|
-
}
|
|
571
|
-
: type === "row"
|
|
572
|
-
? {
|
|
573
|
-
height: "30px",
|
|
574
|
-
padding: undefined
|
|
575
|
-
}
|
|
576
|
-
: {
|
|
577
|
-
height: "30px"
|
|
578
|
-
}
|
|
579
|
-
)
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
return styleObj;
|
|
583
|
-
},
|
|
584
|
-
// 获取汇总单元格的值
|
|
585
|
-
getSummaryRowVal (col) {
|
|
586
|
-
return col._type === "index"
|
|
587
|
-
? "汇总"
|
|
588
|
-
: col._type === "number"
|
|
589
|
-
? this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 })
|
|
590
|
-
: null;
|
|
591
|
-
|
|
592
|
-
},
|
|
593
|
-
// 是否显示 单元格校验提示文字
|
|
594
|
-
getRuleResult (col, row, showRuleMessage = this.showRuleMessage) {
|
|
595
|
-
if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || showRuleMessage) {
|
|
596
|
-
return this.$getFieldRuleResult(col, row);
|
|
597
|
-
} else {
|
|
598
|
-
return {
|
|
599
|
-
bool: true
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
</script>
|
package/src/abolish/DshMenu.less
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
.DshMenu {
|
|
2
|
-
&-item {
|
|
3
|
-
&-badge {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
&-icon {
|
|
8
|
-
margin-right: 8px;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&-submenu {
|
|
13
|
-
&-title {
|
|
14
|
-
&-icon {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.DshMenu {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.ivu-menu {
|
|
23
|
-
&-item {
|
|
24
|
-
padding: 10px 16px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&-submenu-title {
|
|
28
|
-
padding: 10px 16px;
|
|
29
|
-
|
|
30
|
-
// 组标题行 右侧下拉图标
|
|
31
|
-
&-icon {
|
|
32
|
-
margin-right: 0px!important;
|
|
33
|
-
right: 16px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|