|
|
|
@ -27,7 +27,7 @@ |
|
|
|
|
|
|
|
</div> |
|
|
|
<!-- 默认操作栏 --> |
|
|
|
<div class="custom-table-cell header-cell" :style="{ width: '245px' }" v-if="showOperation"> |
|
|
|
<div class="custom-table-cell header-cell" :style="{ width: operationWidth }" v-if="showOperation"> |
|
|
|
<div class="header-cell-content"> |
|
|
|
<div>操作</div> |
|
|
|
</div> |
|
|
|
@ -110,17 +110,16 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template v-else-if="col.bodyType === 'checkboxTag'"> |
|
|
|
<div class="flex flex-wrap"> |
|
|
|
<div class="flex flex-wrap" :class="{'error-border':hasError(rowIndex, colIndex, col.prop)}"> |
|
|
|
<HandleFormItem v-for="(tag, tagIndex) in row[col.prop]" :key="tagIndex" |
|
|
|
:fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex + '_' + tagIndex" |
|
|
|
:fieldItemLabel="fieldItemLabel" type="checkboxTag" |
|
|
|
@blur="onBlur(rowIndex, col.prop, $event)" |
|
|
|
:value="tag" |
|
|
|
:item="getBodyItem(col, rowIndex)" |
|
|
|
@change="onCheckboxTagChange(rowIndex, colIndex,tagIndex, $event)" |
|
|
|
@change="onCheckboxTagChange(rowIndex, col,tagIndex, $event)" |
|
|
|
@deleteTag="onDeleteCheckboxTag(rowIndex, col, tagIndex)" |
|
|
|
:error="hasError(rowIndex, colIndex, col.prop)" |
|
|
|
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" |
|
|
|
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" /> |
|
|
|
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"/> |
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
@ -190,7 +189,7 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 默认操作栏 --> |
|
|
|
<div class="custom-table-cell body-cell" :style="{ width: isBorder ? '245px' : 'auto' }" |
|
|
|
<div class="custom-table-cell body-cell" :style="{ width: isBorder ? operationWidth : 'auto' }" |
|
|
|
v-if="showOperation"> |
|
|
|
<div class="inner-table-cell"> |
|
|
|
<slot name="operation" :row="row" :rowIndex="rowIndex" :columns="getOperationColumns()"> |
|
|
|
@ -227,6 +226,10 @@ export default { |
|
|
|
HandleFormItem |
|
|
|
}, |
|
|
|
props: { |
|
|
|
operationWidth: { |
|
|
|
type: String, |
|
|
|
default: '245px', |
|
|
|
}, |
|
|
|
// 是否显示表头选择器 |
|
|
|
showHeaderSelect: { |
|
|
|
type: Boolean, |
|
|
|
@ -316,14 +319,26 @@ export default { |
|
|
|
unmounted() { |
|
|
|
this.oldLocalDataSource = []; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onCheckboxTagChange(rowIndex, colIndex,tagIndex, e) { |
|
|
|
console.log(e,"eee") |
|
|
|
}, |
|
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
|
this.$emit("clickButton", key, rowIndex, colIndex, e, data,) |
|
|
|
}, |
|
|
|
beforeSaveRecord(data, callback, rowIndex, col, row) { |
|
|
|
methods: { |
|
|
|
// 删除checkboxTag |
|
|
|
onDeleteCheckboxTag(rowIndex, col, tagIndex) { |
|
|
|
this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); |
|
|
|
this.$emit("onDeleteTag", rowIndex, col,tagIndex); |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord:null, |
|
|
|
resourceList: null, |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
}, |
|
|
|
onCheckboxTagChange(rowIndex, col,tagIndex, value) { |
|
|
|
this.localDataSource[rowIndex][col.prop][tagIndex] = value; |
|
|
|
this.$emit("onCheckboxTagChange", rowIndex, col,tagIndex, value) |
|
|
|
}, |
|
|
|
handleClickButton(e, data, key, rowIndex, colIndex) { |
|
|
|
this.$emit("clickButton", key, rowIndex, colIndex, e, data,) |
|
|
|
}, |
|
|
|
beforeSaveRecord(data, callback, rowIndex, col, row) { |
|
|
|
this.$emit("beforeSaveRecord", { inputData: data, callback, rowIndex, key: col.prop, rowData: row, dataSource: this.localDataSource }) |
|
|
|
}, |
|
|
|
getCellWidth(col) { |
|
|
|
@ -471,7 +486,8 @@ export default { |
|
|
|
if (col.bodyFillType === this.templateFillType || col.bodySubFillType === this.templateFillType) { |
|
|
|
// 检查主字段 |
|
|
|
const mainValue = row[col.prop]; |
|
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span') { |
|
|
|
console.log(mainValue,"mainValue") |
|
|
|
if (this.isValueEmpty(mainValue) && !col.bodyDisabled && col.bodyType !== 'span'&& col.bodyType !== 'button') { |
|
|
|
const errorItem = { |
|
|
|
rowIndex, |
|
|
|
colIndex, |
|
|
|
@ -484,7 +500,7 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
// 检查子字段(如果有) |
|
|
|
if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span') { |
|
|
|
if (col.bodySubKey && !col.bodySubDisabled && col.bodySubType !== 'span'&&col.bodySubType!=="button") { |
|
|
|
const subValue = row[col.bodySubKey]; |
|
|
|
console.log(col, subValue, "subValue") |
|
|
|
if (this.isValueEmpty(subValue)) { |
|
|
|
@ -884,7 +900,8 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
.custom-table-body { |
|
|
|
max-height: 300px; |
|
|
|
max-height: 500px; |
|
|
|
overflow-y: auto; |
|
|
|
/* 可根据需要调整或由父组件控制 */ |
|
|
|
} |
|
|
|
|
|
|
|
@ -1030,4 +1047,11 @@ export default { |
|
|
|
.flex-wrap{ |
|
|
|
flex-wrap: wrap; |
|
|
|
} |
|
|
|
.error-border{ |
|
|
|
border-color: #ff5d5d ; |
|
|
|
box-shadow: 0 0 6px #ffc3c3 ; |
|
|
|
padding: 8px; |
|
|
|
border-radius: 4px; |
|
|
|
border: 1px solid; |
|
|
|
} |
|
|
|
</style> |