bri-components 1.3.89 → 1.3.91
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 +1 -1
- package/src/components/controls/base/BriUpload/BriUpload.vue +1 -1
- package/src/components/controls/base/BriUpload/uploadList.vue +0 -1
- package/src/components/controls/base/DshCascader/DshCascader.vue +2 -2
- package/src/components/controls/base/DshInput/DshInput.vue +1 -1
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +1 -1
- package/src/components/controls/base/DshSelect/DshSelect.vue +1 -1
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +1 -1
- package/src/components/controls/mixins/controlMixin.js +1 -1
- package/src/components/controls/senior/cascaderTable.vue +1 -1
- package/src/components/controls/senior/flatTable.vue +1 -1
- package/src/components/form/DshForm.vue +2 -3
- package/src/components/list/BriTable.vue +1 -1
- package/src/components/list/DshBox/DshTable.vue +1 -1
- package/src/components/list/DshFlatTable.vue +63 -15
- package/src/components/list/mixins/DshCascaderTableMixin.js +1 -1
- package/src/components/list/mixins/DshFlatTableMixin.js +26 -7
- package/src/components/list/mixins/DshTreeTableMixin.js +8 -8
- package/src/components/list/mixins/tableBaseMixin.js +156 -33
- package/src/components/unit/unitMixin.js +1 -1
- package/src/utils/table.js +3 -3
package/package.json
CHANGED
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
selfPropsObj () {
|
|
143
143
|
return {
|
|
144
144
|
_fileType: "file",
|
|
145
|
-
_showMode: this.isHeightAuto ? "old" : "inline", // 宽度为100
|
|
145
|
+
_showMode: this.isHeightAuto ? "old" : "inline", // 宽度为100%、且不在表格字段里的 显示老版
|
|
146
146
|
|
|
147
147
|
_multiple: true,
|
|
148
148
|
_useType: "drag",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
>
|
|
30
30
|
<!-- 有值 -->
|
|
31
31
|
<template v-if="!$isEmptyData(curValList)">
|
|
32
|
-
<!-- 高度自由时
|
|
32
|
+
<!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
|
|
33
33
|
<div
|
|
34
34
|
v-if="isHeightAuto"
|
|
35
35
|
:class="{
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
>
|
|
104
104
|
<!-- 有值 -->
|
|
105
105
|
<template v-if="!$isEmptyData(curValList)">
|
|
106
|
-
<!-- 高度自由时
|
|
106
|
+
<!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
|
|
107
107
|
<dsh-tags
|
|
108
108
|
v-if="isHeightAuto"
|
|
109
109
|
:class="{
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
|
|
138
|
-
/*
|
|
138
|
+
/* 表格字段内用到的 */
|
|
139
139
|
inTableType: {
|
|
140
140
|
type: String,
|
|
141
141
|
validator (val) {
|
|
@@ -201,8 +201,7 @@
|
|
|
201
201
|
"users", "departments", "labels", "flatTable", "cascaderTable", "reference", "referenceBy"
|
|
202
202
|
],
|
|
203
203
|
ignoreProperties: [
|
|
204
|
-
"_name", "_key", "
|
|
205
|
-
"_disabledBtns", "_disabledOldDataRow"
|
|
204
|
+
"_name", "_key", "_span", "_br", "_line", "_noLabel", "_required", "_regStr", "_regMessage", "_clearable", "_default"
|
|
206
205
|
]
|
|
207
206
|
// subIgnoreProperties: []
|
|
208
207
|
};
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
// 自定义表格事件,也可配置鼠标事件
|
|
123
123
|
eventCustomOption () {
|
|
124
124
|
return {
|
|
125
|
-
bodyCellEvents: ({ row,
|
|
125
|
+
bodyCellEvents: ({ row, rowIndex, column }) => {
|
|
126
126
|
return {
|
|
127
127
|
click: (event) => {
|
|
128
128
|
if (!["checkbox"].includes(column.type)) {
|
|
@@ -19,7 +19,13 @@
|
|
|
19
19
|
:key="row._id"
|
|
20
20
|
class="item"
|
|
21
21
|
>
|
|
22
|
+
<div class="item-index">
|
|
23
|
+
<p>第{{ rowIndex + 1 }}条</p>
|
|
24
|
+
<span></span>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
22
27
|
<dsh-form
|
|
28
|
+
class="item-form"
|
|
23
29
|
:canEdit="getRowCanEdit(row)"
|
|
24
30
|
:formData="row"
|
|
25
31
|
:formList="getRowFormList(row)"
|
|
@@ -121,6 +127,7 @@
|
|
|
121
127
|
<script>
|
|
122
128
|
import tableBaseMixin from "./mixins/tableBaseMixin.js";
|
|
123
129
|
import DshFlatTableMixin from "./mixins/DshFlatTableMixin.js";
|
|
130
|
+
import DshDivider from "../controls/base/DshDivider.vue";
|
|
124
131
|
|
|
125
132
|
export default {
|
|
126
133
|
name: "DshFlatTable",
|
|
@@ -128,7 +135,9 @@
|
|
|
128
135
|
tableBaseMixin,
|
|
129
136
|
DshFlatTableMixin
|
|
130
137
|
],
|
|
131
|
-
components: {
|
|
138
|
+
components: {
|
|
139
|
+
DshDivider
|
|
140
|
+
},
|
|
132
141
|
props: {},
|
|
133
142
|
data () {
|
|
134
143
|
return {};
|
|
@@ -143,9 +152,61 @@
|
|
|
143
152
|
.DshFlatTable {
|
|
144
153
|
&-form {
|
|
145
154
|
.item {
|
|
146
|
-
border: 1px solid #E5E5E6;
|
|
147
155
|
margin-bottom: 5px;
|
|
156
|
+
// border: 1px solid #E5E5E6;
|
|
148
157
|
position: relative;
|
|
158
|
+
|
|
159
|
+
&-index {
|
|
160
|
+
min-width: 130px;
|
|
161
|
+
max-width: 100%;
|
|
162
|
+
height: 32px;
|
|
163
|
+
padding: 0px 16px;
|
|
164
|
+
color: @themeColor;
|
|
165
|
+
|
|
166
|
+
p {
|
|
167
|
+
height: 32px;
|
|
168
|
+
line-height: 32px;
|
|
169
|
+
font-size:14px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
span {
|
|
173
|
+
display: block;
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 1px;
|
|
176
|
+
background: linear-gradient(270deg,rgba(166,215,250,0) 0%,rgba(109,174,242,1) 100%) bottom left no-repeat;
|
|
177
|
+
position: relative;
|
|
178
|
+
|
|
179
|
+
&::before {
|
|
180
|
+
position: absolute;
|
|
181
|
+
left: 0px;
|
|
182
|
+
top: -2px;
|
|
183
|
+
content: "";
|
|
184
|
+
width: 5px;
|
|
185
|
+
height: 5px;
|
|
186
|
+
border-radius: 5px;
|
|
187
|
+
background: #6DAEF2;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&-form {
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&-icons {
|
|
197
|
+
position: absolute;
|
|
198
|
+
top: 10px;
|
|
199
|
+
right: 10px;
|
|
200
|
+
line-height: 18px;
|
|
201
|
+
z-index: 2;
|
|
202
|
+
display: none;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:hover {
|
|
206
|
+
.item-icons {
|
|
207
|
+
display: block !important;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
149
210
|
}
|
|
150
211
|
}
|
|
151
212
|
|
|
@@ -165,20 +226,7 @@
|
|
|
165
226
|
.DshFlatTable {
|
|
166
227
|
&-form {
|
|
167
228
|
.item {
|
|
168
|
-
&-icons {
|
|
169
|
-
position: absolute;
|
|
170
|
-
top: -10px;
|
|
171
|
-
right: -10px;
|
|
172
|
-
line-height: 18px;
|
|
173
|
-
z-index: 2;
|
|
174
|
-
display: none;
|
|
175
|
-
}
|
|
176
229
|
|
|
177
|
-
&:hover {
|
|
178
|
-
.item-icons {
|
|
179
|
-
display: block !important;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
230
|
}
|
|
183
231
|
}
|
|
184
232
|
}
|
|
@@ -594,7 +594,7 @@ export default {
|
|
|
594
594
|
]);
|
|
595
595
|
};
|
|
596
596
|
},
|
|
597
|
-
// 表头单元格渲染函数 (无法共用contentColumns的renderHeaderCell
|
|
597
|
+
// 表头单元格渲染函数 (无法共用contentColumns的renderHeaderCell,因为级联老版表头的无renderHeaderCell)
|
|
598
598
|
getThRender (column, colIndex) {
|
|
599
599
|
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
600
600
|
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
|
|
14
14
|
if (this.initFlag) {
|
|
15
15
|
item.__old__ = true; // 标记老数据(initFlag不用在data中声明)
|
|
16
|
+
item.__isDefault__ = item.__isDefault__ === undefined ? this.controlKey === "_default" : item.__isDefault__; // 配置端-默认数据打上标记
|
|
16
17
|
}
|
|
17
18
|
item.__isRendered__ = true;
|
|
18
19
|
item.__isShow__ = true;
|
|
@@ -71,14 +72,14 @@ export default {
|
|
|
71
72
|
width: 76,
|
|
72
73
|
align: "center",
|
|
73
74
|
fixed: "left",
|
|
74
|
-
renderBodyCell: ({ row,
|
|
75
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
75
76
|
return [
|
|
76
77
|
h("div", rowIndex + 1),
|
|
77
78
|
|
|
78
|
-
//
|
|
79
|
+
// 插入一行添加符
|
|
79
80
|
(this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
|
|
80
|
-
!this.isSearching
|
|
81
|
-
|
|
81
|
+
!this.isSearching &&
|
|
82
|
+
!this.showCreateBtnColKeys.length
|
|
82
83
|
? h("div", {
|
|
83
84
|
style: {
|
|
84
85
|
position: "absolute",
|
|
@@ -106,7 +107,7 @@ export default {
|
|
|
106
107
|
},
|
|
107
108
|
on: {
|
|
108
109
|
click: () => {
|
|
109
|
-
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex);
|
|
110
|
+
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
})
|
|
@@ -120,14 +121,32 @@ export default {
|
|
|
120
121
|
created () { },
|
|
121
122
|
methods: {
|
|
122
123
|
// 点击 -添加行
|
|
123
|
-
clickCreate (operationItem, row, rowIndex) {
|
|
124
|
+
clickCreate (operationItem, row, rowIndex, col) {
|
|
125
|
+
// 处理单元格合并相关
|
|
126
|
+
let mergeRowData = {};
|
|
127
|
+
if (col && col._mergeRow) {
|
|
128
|
+
const newList = this.showListData.slice(rowIndex);
|
|
129
|
+
const newIndex = newList.findIndex(rowItem => row[col._key] !== rowItem[col._key]);
|
|
130
|
+
row = newList[newIndex - 1];
|
|
131
|
+
|
|
132
|
+
const curIndex = this.mergeRowColumns.findIndex(column => col._key === column._key);
|
|
133
|
+
mergeRowData = this.mergeRowColumns.reduce((obj, column, colIndex) => {
|
|
134
|
+
// 该列之前的合并列,要复制这一行对应列的值
|
|
135
|
+
return colIndex < curIndex
|
|
136
|
+
? Object.assign(obj, { [column._key]: row[column._key] })
|
|
137
|
+
: obj;
|
|
138
|
+
}, {});
|
|
139
|
+
}
|
|
140
|
+
|
|
124
141
|
const newRow = {
|
|
125
142
|
...this.$deepCopy(this.selfRowDefault),
|
|
143
|
+
...this.$deepCopy(mergeRowData),
|
|
126
144
|
_id: this.$ObjectID().str,
|
|
127
145
|
__isRendered__: true,
|
|
128
146
|
__isShow__: true,
|
|
129
147
|
__isTmpShow__: true,
|
|
130
|
-
__isSearchShow__: false
|
|
148
|
+
__isSearchShow__: false,
|
|
149
|
+
__isDefault__: this.controlKey === "_default"
|
|
131
150
|
};
|
|
132
151
|
const list = this.data;
|
|
133
152
|
const newRowIndex = row
|
|
@@ -85,7 +85,7 @@ export default {
|
|
|
85
85
|
defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
|
|
86
86
|
},
|
|
87
87
|
cellStyleOption: {
|
|
88
|
-
bodyCellClass: ({ row,
|
|
88
|
+
bodyCellClass: ({ row, rowIndex, column }) => {
|
|
89
89
|
return "bri-table-td" +
|
|
90
90
|
`${this.getRowCanEdit(row)
|
|
91
91
|
? " bri-table-td-edit"
|
|
@@ -135,7 +135,7 @@ export default {
|
|
|
135
135
|
width: 48,
|
|
136
136
|
align: "center",
|
|
137
137
|
fixed: "left",
|
|
138
|
-
renderBodyCell: ({ row,
|
|
138
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
139
139
|
return this.isSearching && this.searchMode === "flat"
|
|
140
140
|
? h("span", "")
|
|
141
141
|
: row.children && row.children.length
|
|
@@ -170,7 +170,7 @@ export default {
|
|
|
170
170
|
width: 28 + 16 + (this.maxLevel - 1) * 38,
|
|
171
171
|
align: "left",
|
|
172
172
|
fixed: "left",
|
|
173
|
-
renderBodyCell: ({ row,
|
|
173
|
+
renderBodyCell: ({ row, rowIndex, column }, h) => {
|
|
174
174
|
return [
|
|
175
175
|
h("div", {
|
|
176
176
|
style: {
|
|
@@ -179,10 +179,10 @@ export default {
|
|
|
179
179
|
}
|
|
180
180
|
}, row.__treeIndex__),
|
|
181
181
|
|
|
182
|
-
//
|
|
182
|
+
// 插入一行添加符
|
|
183
183
|
(this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
|
|
184
|
-
!this.isSearching
|
|
185
|
-
|
|
184
|
+
!this.isSearching &&
|
|
185
|
+
!this.showCreateBtnColKeys.length
|
|
186
186
|
? h("div", {
|
|
187
187
|
style: {
|
|
188
188
|
position: "absolute",
|
|
@@ -210,14 +210,14 @@ export default {
|
|
|
210
210
|
},
|
|
211
211
|
on: {
|
|
212
212
|
click: () => {
|
|
213
|
-
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex);
|
|
213
|
+
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
})
|
|
217
217
|
])
|
|
218
218
|
: h("span", ""),
|
|
219
219
|
|
|
220
|
-
//
|
|
220
|
+
// 插入一行下级添加符
|
|
221
221
|
(this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
|
|
222
222
|
!this.isSearching &&
|
|
223
223
|
row.level < this.maxLevel
|
|
@@ -66,6 +66,7 @@ export default {
|
|
|
66
66
|
initFlag: true,
|
|
67
67
|
showRuleMessage: false, // 进行全体校验
|
|
68
68
|
ruleRecordMap: {}, // 单元格是否发生校验的记录映射
|
|
69
|
+
hoverRecordMap: {},
|
|
69
70
|
|
|
70
71
|
hideStatus: true,
|
|
71
72
|
dftAdvSearch: {
|
|
@@ -139,16 +140,17 @@ export default {
|
|
|
139
140
|
btnType: "default",
|
|
140
141
|
icon: "md-add-circle",
|
|
141
142
|
size: "default",
|
|
143
|
+
color: "#3DB8C5",
|
|
142
144
|
long: true,
|
|
143
145
|
disabled: false,
|
|
144
146
|
event: "clickCreate"
|
|
145
147
|
},
|
|
146
148
|
canCreateChild: {
|
|
147
|
-
name: "
|
|
149
|
+
name: "添加一行下级",
|
|
148
150
|
type: "canCreateChild",
|
|
149
151
|
btnType: "default",
|
|
150
152
|
size: "default",
|
|
151
|
-
|
|
153
|
+
color: "#3DB8C5",
|
|
152
154
|
disabled: false,
|
|
153
155
|
event: "clickCreateChild"
|
|
154
156
|
},
|
|
@@ -158,6 +160,7 @@ export default {
|
|
|
158
160
|
btnType: "errorText",
|
|
159
161
|
icon: "ios-trash-outline",
|
|
160
162
|
size: "small",
|
|
163
|
+
color: "#E83636",
|
|
161
164
|
disabled: false,
|
|
162
165
|
event: "clickDelete"
|
|
163
166
|
},
|
|
@@ -194,6 +197,9 @@ export default {
|
|
|
194
197
|
selfColumns () {
|
|
195
198
|
return this.columns;
|
|
196
199
|
},
|
|
200
|
+
mergeRowColumns () {
|
|
201
|
+
return this.columns.filter(column => column._mergeRow === true);
|
|
202
|
+
},
|
|
197
203
|
filterColumns () {
|
|
198
204
|
// console.log("filterColumns");
|
|
199
205
|
return this.selfColumns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
|
|
@@ -214,9 +220,12 @@ export default {
|
|
|
214
220
|
_useSummary: false, // 使用汇总行
|
|
215
221
|
_disabledBtns: false, // 禁用增删按钮
|
|
216
222
|
// _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
|
|
223
|
+
_disabledFootCreateBtn: false, // 禁用底部新增按钮
|
|
224
|
+
_disabledDeleteDftRow: false, // 默认数据行禁止删除
|
|
217
225
|
_disabledOldDataRow: false, // 置灰老数据行包含删除
|
|
218
|
-
|
|
226
|
+
_showCreateBtnColKeys: [], // 显示插入一行按钮的列
|
|
219
227
|
_hideColKeys: [], // 隐藏/查看列字段的keys
|
|
228
|
+
|
|
220
229
|
_searchList: [], // 作为搜索的字段
|
|
221
230
|
_searchLabelWidth: 100, // 搜索的label宽度
|
|
222
231
|
_tableAdvSearch: {
|
|
@@ -283,13 +292,22 @@ export default {
|
|
|
283
292
|
return this.selfPropsObj._useSummary;
|
|
284
293
|
},
|
|
285
294
|
disabledBtns () {
|
|
286
|
-
return this.selfPropsObj._disabledBtns;
|
|
295
|
+
return this.controlKey === "_default" ? false : this.selfPropsObj._disabledBtns;
|
|
287
296
|
},
|
|
288
297
|
// disabledCreateBtn () {
|
|
289
298
|
// return this.selfPropsObj._disabledCreateBtn;
|
|
290
299
|
// },
|
|
300
|
+
disabledFootCreateBtn () {
|
|
301
|
+
return this.selfPropsObj._disabledFootCreateBtn;
|
|
302
|
+
},
|
|
303
|
+
disabledDeleteDftRow () {
|
|
304
|
+
return this.selfPropsObj._disabledDeleteDftRow;
|
|
305
|
+
},
|
|
291
306
|
disabledOldDataRow () {
|
|
292
|
-
return this.selfPropsObj._disabledOldDataRow;
|
|
307
|
+
return this.controlKey === "_default" ? false : this.selfPropsObj._disabledOldDataRow;
|
|
308
|
+
},
|
|
309
|
+
showCreateBtnColKeys () {
|
|
310
|
+
return this.selfPropsObj._showCreateBtnColKeys;
|
|
293
311
|
},
|
|
294
312
|
hideColKeys () {
|
|
295
313
|
return this.selfPropsObj._hideColKeys || [];
|
|
@@ -299,7 +317,7 @@ export default {
|
|
|
299
317
|
return this.selfPropsObj._searchLabelWidth;
|
|
300
318
|
},
|
|
301
319
|
searchList () {
|
|
302
|
-
return this.selfPropsObj._searchList
|
|
320
|
+
return this.selfPropsObj._searchList;
|
|
303
321
|
},
|
|
304
322
|
searchListMap () {
|
|
305
323
|
return this.$arrToMap(this.searchList, "_key");
|
|
@@ -345,7 +363,7 @@ export default {
|
|
|
345
363
|
: this.allListData.length;
|
|
346
364
|
},
|
|
347
365
|
rowsNumStr () {
|
|
348
|
-
return
|
|
366
|
+
return `当前${this.isSearching ? "筛选" : "全部"}数据, 共 ${this.rowsNum} ${this.showMode === "form" ? "条" : "行"}`;
|
|
349
367
|
},
|
|
350
368
|
|
|
351
369
|
renderedListData () {
|
|
@@ -378,13 +396,16 @@ export default {
|
|
|
378
396
|
},
|
|
379
397
|
selfRowDefault () {
|
|
380
398
|
return this.selfColumns.reduce((obj, column) => {
|
|
381
|
-
const
|
|
399
|
+
const dftInRowVal = this.rowDefault[column._key];
|
|
400
|
+
const dftVal = column._default;
|
|
382
401
|
const initDftVal = this.initDftValMap[column._type];
|
|
383
402
|
|
|
384
403
|
return Object.assign(obj, {
|
|
385
|
-
[column._key]: this.$isEmptyData(
|
|
386
|
-
?
|
|
387
|
-
|
|
404
|
+
[column._key]: this.$isEmptyData(dftInRowVal)
|
|
405
|
+
? this.$isEmptyData(dftVal)
|
|
406
|
+
? initDftVal
|
|
407
|
+
: dftVal
|
|
408
|
+
: dftInRowVal
|
|
388
409
|
});
|
|
389
410
|
}, {});
|
|
390
411
|
},
|
|
@@ -424,6 +445,56 @@ export default {
|
|
|
424
445
|
: ""
|
|
425
446
|
}`;
|
|
426
447
|
}
|
|
448
|
+
},
|
|
449
|
+
cellSpanOption: {
|
|
450
|
+
bodyCellSpan: ({ row, rowIndex, column }) => {
|
|
451
|
+
if (column._mergeRow === true) {
|
|
452
|
+
if (this.$isEmptyData(row[column._key])) {
|
|
453
|
+
return {
|
|
454
|
+
rowspan: 1,
|
|
455
|
+
colspan: 1
|
|
456
|
+
};
|
|
457
|
+
} else {
|
|
458
|
+
if (
|
|
459
|
+
rowIndex !== 0 &&
|
|
460
|
+
row[column._key] === this.showListData[rowIndex - 1][column._key]
|
|
461
|
+
) {
|
|
462
|
+
return {
|
|
463
|
+
rowspan: 0,
|
|
464
|
+
colspan: 0
|
|
465
|
+
};
|
|
466
|
+
} else {
|
|
467
|
+
const newList = this.showListData.slice(rowIndex);
|
|
468
|
+
const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
|
|
469
|
+
return {
|
|
470
|
+
rowspan: newIndex === -1 ? newList.length : newIndex,
|
|
471
|
+
colspan: 1
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
eventCustomOption: {
|
|
479
|
+
bodyCellEvents: ({ row, rowIndex, column }) => {
|
|
480
|
+
return {
|
|
481
|
+
click: (event) => {
|
|
482
|
+
// console.log("click::", row, rowIndex, column, event);
|
|
483
|
+
},
|
|
484
|
+
dblclick: (event) => {
|
|
485
|
+
// console.log("dblclick::", row, rowIndex, column, event);
|
|
486
|
+
},
|
|
487
|
+
contextmenu: (event) => {
|
|
488
|
+
// console.log("contextmenu::", row, rowIndex, column, event);
|
|
489
|
+
},
|
|
490
|
+
mouseenter: (event) => {
|
|
491
|
+
this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
|
|
492
|
+
},
|
|
493
|
+
mouseleave: (event) => {
|
|
494
|
+
this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, false);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
}
|
|
427
498
|
}
|
|
428
499
|
};
|
|
429
500
|
},
|
|
@@ -432,6 +503,15 @@ export default {
|
|
|
432
503
|
return this.filterColumns.map(colItem => ({
|
|
433
504
|
filter: undefined,
|
|
434
505
|
sortBy: undefined,
|
|
506
|
+
renderHeaderCell: ({ column }, h) => {
|
|
507
|
+
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
508
|
+
|
|
509
|
+
return this.$getHeadRender(h, column, {
|
|
510
|
+
showRequired: this.showRequired,
|
|
511
|
+
showDescription: this.showDescription,
|
|
512
|
+
headHeightAuto: this.headHeightAuto
|
|
513
|
+
});
|
|
514
|
+
},
|
|
435
515
|
renderBodyCell: ({ column, row, rowIndex }, h) => {
|
|
436
516
|
column = this.$transformDynamicProperty(column, row, this.parentObj);
|
|
437
517
|
column = this.resetCol(column, row);
|
|
@@ -495,17 +575,48 @@ export default {
|
|
|
495
575
|
? h("span", {
|
|
496
576
|
class: "bri-table-td-tip"
|
|
497
577
|
}, ruleResultObj.message)
|
|
498
|
-
: undefined
|
|
499
|
-
];
|
|
500
|
-
},
|
|
501
|
-
renderHeaderCell: ({ column }, h) => {
|
|
502
|
-
column = this.$transformDynamicProperty(column, undefined, this.parentObj);
|
|
578
|
+
: undefined,
|
|
503
579
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
580
|
+
// 插入一行添加符
|
|
581
|
+
(this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
|
|
582
|
+
!this.isSearching &&
|
|
583
|
+
this.showCreateBtnColKeys.includes(column._key) &&
|
|
584
|
+
this.hoverRecordMap[`${row._id}dsh${column._key}`]
|
|
585
|
+
? h("div", {
|
|
586
|
+
style: {
|
|
587
|
+
position: "absolute",
|
|
588
|
+
bottom: "0px",
|
|
589
|
+
right: "0px",
|
|
590
|
+
display: "inline-block",
|
|
591
|
+
width: "16px",
|
|
592
|
+
height: " 16px",
|
|
593
|
+
// border: "1px solid #3DB8C5",
|
|
594
|
+
// backgroundColor: "#ffffff",
|
|
595
|
+
lineHeight: "12px",
|
|
596
|
+
cursor: "pointer",
|
|
597
|
+
verticalAlign: "middle",
|
|
598
|
+
transition: "color .2s ease-in-out,border-color .2s ease-in-out"
|
|
599
|
+
}
|
|
600
|
+
}, [
|
|
601
|
+
h("Icon", {
|
|
602
|
+
style: {
|
|
603
|
+
fontWeight: "500",
|
|
604
|
+
color: "#3DB8C5"
|
|
605
|
+
},
|
|
606
|
+
props: {
|
|
607
|
+
type: "md-add-circle", // "ios-add"
|
|
608
|
+
size: "16"
|
|
609
|
+
// size: "14"
|
|
610
|
+
},
|
|
611
|
+
on: {
|
|
612
|
+
click: () => {
|
|
613
|
+
this.$dispatchEvent(this.operationMap.canCreate, row, rowIndex, column);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
})
|
|
617
|
+
])
|
|
618
|
+
: h("span", "")
|
|
619
|
+
];
|
|
509
620
|
},
|
|
510
621
|
...colItem
|
|
511
622
|
}));
|
|
@@ -537,7 +648,8 @@ export default {
|
|
|
537
648
|
props: {
|
|
538
649
|
list: operationList.map(btnItem => ({
|
|
539
650
|
...btnItem,
|
|
540
|
-
disabled: !this.getRowBtnCanEdit(row)
|
|
651
|
+
disabled: !this.getRowBtnCanEdit(row) ||
|
|
652
|
+
(this.disabledDeleteDftRow ? this.isDftRowDisabled(row) : false)
|
|
541
653
|
}))
|
|
542
654
|
},
|
|
543
655
|
on: {
|
|
@@ -625,15 +737,21 @@ export default {
|
|
|
625
737
|
canHideOrShow: {
|
|
626
738
|
...this.topOperationMap.canHideOrShow,
|
|
627
739
|
name: this.hideStatus ? "显示字段" : "隐藏字段"
|
|
740
|
+
},
|
|
741
|
+
canCreate: {
|
|
742
|
+
...this.baseOperationMap.canCreate,
|
|
743
|
+
name: this.showMode === "form"
|
|
744
|
+
? this.baseOperationMap.canCreate.name.replace("行", "条")
|
|
745
|
+
: this.baseOperationMap.canCreate.name
|
|
746
|
+
// disabled: !!this.disabledCreateBtn
|
|
747
|
+
},
|
|
748
|
+
canCreateChild: {
|
|
749
|
+
...this.baseOperationMap.canCreateChild,
|
|
750
|
+
name: this.showMode === "form"
|
|
751
|
+
? this.baseOperationMap.canCreateChild.name.replace("行", "条")
|
|
752
|
+
: this.baseOperationMap.canCreateChild.name
|
|
753
|
+
// disabled: !!this.disabledCreateBtn
|
|
628
754
|
}
|
|
629
|
-
// canCreate: {
|
|
630
|
-
// ...this.baseOperationMap.canCreate,
|
|
631
|
-
// disabled: !!this.disabledCreateBtn
|
|
632
|
-
// },
|
|
633
|
-
// canCreateChild: {
|
|
634
|
-
// ...this.baseOperationMap.canCreateChild,
|
|
635
|
-
// disabled: !!this.disabledCreateBtn
|
|
636
|
-
// }
|
|
637
755
|
};
|
|
638
756
|
},
|
|
639
757
|
operationMap () {
|
|
@@ -986,7 +1104,7 @@ export default {
|
|
|
986
1104
|
});
|
|
987
1105
|
},
|
|
988
1106
|
createOperationRender (h, params) {
|
|
989
|
-
return !this.isSearching
|
|
1107
|
+
return !this.isSearching && this.disabledFootCreateBtn !== true
|
|
990
1108
|
? h("dsh-buttons", {
|
|
991
1109
|
style: {
|
|
992
1110
|
"margin-top": "3px"
|
|
@@ -1026,6 +1144,10 @@ export default {
|
|
|
1026
1144
|
!(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
|
|
1027
1145
|
row[col._key] !== oldRow[col._key];
|
|
1028
1146
|
},
|
|
1147
|
+
// 是否禁止操作 在关于默认行方面
|
|
1148
|
+
isDftRowDisabled (row) {
|
|
1149
|
+
return this.controlKey === "_default" ? false : row.__isDefault__;
|
|
1150
|
+
},
|
|
1029
1151
|
// 整行校验结果
|
|
1030
1152
|
getRowRuleResult (row, rowIndex) {
|
|
1031
1153
|
return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
|
|
@@ -1076,11 +1198,12 @@ export default {
|
|
|
1076
1198
|
: true
|
|
1077
1199
|
: true
|
|
1078
1200
|
) &&
|
|
1079
|
-
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && //
|
|
1201
|
+
!(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 层级表格的固定字段不可编辑
|
|
1080
1202
|
(col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
|
|
1081
1203
|
(row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
|
|
1082
|
-
col._enterType
|
|
1204
|
+
!["calculate"].includes(col._enterType) && // 计算的不可编辑
|
|
1083
1205
|
col._readonly !== true && // 不能为只读
|
|
1206
|
+
(!this.isDftRowDisabled(row) || col._readonlyOnDftRow !== true) && // 合并单元格的且不配置"新增数据的可编辑"的不可编辑
|
|
1084
1207
|
col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
|
|
1085
1208
|
},
|
|
1086
1209
|
// 单元格最终编辑状态
|
package/src/utils/table.js
CHANGED
|
@@ -132,7 +132,7 @@ const transformToColumns = function (form, {
|
|
|
132
132
|
},
|
|
133
133
|
renderBodyCell: col._type
|
|
134
134
|
? col._type === "operation"
|
|
135
|
-
? ({ row,
|
|
135
|
+
? ({ row, rowIndex, column }, h) => {
|
|
136
136
|
return h("dsh-buttons", {
|
|
137
137
|
class: "bri-table-td-operation",
|
|
138
138
|
props: {
|
|
@@ -141,12 +141,12 @@ const transformToColumns = function (form, {
|
|
|
141
141
|
},
|
|
142
142
|
on: {
|
|
143
143
|
click: (operationItem) => {
|
|
144
|
-
this.$dispatchEvent(operationItem, { row,
|
|
144
|
+
this.$dispatchEvent(operationItem, { row, rowIndex, column });
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
: ({ row,
|
|
149
|
+
: ({ row, rowIndex, column }, h) => {
|
|
150
150
|
return h("dsh-list-unit", {
|
|
151
151
|
props: {
|
|
152
152
|
canEdit: false,
|