|
|
@ -1,7 +1,8 @@ |
|
|
|
<!-- 附件组件 --> |
|
|
|
<template> |
|
|
|
<div class="table-form"> |
|
|
|
<el-table class="multipleTableComponents" |
|
|
|
<el-table |
|
|
|
class="multipleTableComponents" |
|
|
|
ref="TableBaseComponents_Ref" |
|
|
|
v-loading="tableLoading" |
|
|
|
:data="showTableData()" |
|
|
@ -13,7 +14,13 @@ |
|
|
|
@row-click="handleTableSelect" |
|
|
|
> |
|
|
|
<!-- 删除按钮多选 --> |
|
|
|
<el-table-column fixed="left" type="selection" width="50" v-if="isShowReduceButtonSelection" :reserve-selection="true" /> |
|
|
|
<el-table-column |
|
|
|
fixed="left" |
|
|
|
type="selection" |
|
|
|
width="50" |
|
|
|
v-if="isShowReduceButtonSelection" |
|
|
|
:reserve-selection="true" |
|
|
|
/> |
|
|
|
<!-- 删除按钮 --> |
|
|
|
<el-table-column |
|
|
|
fixed="left" |
|
|
@ -21,7 +28,13 @@ |
|
|
|
v-else-if="isShowReduceButton" |
|
|
|
v-slot="{ row, $index }" |
|
|
|
> |
|
|
|
<Icon icon="ep:remove" color="#757575" :size="26" style="cursor: pointer;margin-top: -16px;" @click="handleDeleteTable (row, $index)" /> |
|
|
|
<Icon |
|
|
|
icon="ep:remove" |
|
|
|
color="#757575" |
|
|
|
:size="26" |
|
|
|
style="cursor: pointer; margin-top: -16px" |
|
|
|
@click.stop="handleDeleteTable(row, $index)" |
|
|
|
/> |
|
|
|
</el-table-column> |
|
|
|
<!-- 多选 --> |
|
|
|
<el-table-column |
|
|
@ -30,7 +43,6 @@ |
|
|
|
:reserve-selection="true" |
|
|
|
type="selection" |
|
|
|
:width="50" |
|
|
|
|
|
|
|
/> |
|
|
|
<!-- 序号 --> |
|
|
|
<el-table-column |
|
|
@ -43,145 +55,179 @@ |
|
|
|
/> |
|
|
|
<el-table-column |
|
|
|
v-slot="{ row, $index }" |
|
|
|
v-for="(headerItem) in tableFields.filter(item=>(!item.hidden))" |
|
|
|
v-for="headerItem in tableFields.filter((item) => !item.hidden)" |
|
|
|
:key="headerItem" |
|
|
|
:fixed="headerItem.tableForm?.fixed" |
|
|
|
:label="t(`ts.${headerItem.label}`).replace('ts.','')" :prop="headerItem.field" |
|
|
|
:label="t(`ts.${headerItem.label}`).replace('ts.', '')" |
|
|
|
:prop="headerItem.field" |
|
|
|
:align="headerItem?.tableForm?.align || 'center'" |
|
|
|
:sortable="headerItem?.tableForm?.sortable || false" |
|
|
|
:width="headerItem?.tableForm?.width || '200px'" |
|
|
|
:min-width="headerItem?.tableForm?.minWidth || 'auto'"> |
|
|
|
:min-width="headerItem?.tableForm?.minWidth || 'auto'" |
|
|
|
> |
|
|
|
<el-form |
|
|
|
ref="TableBaseForm_Ref" |
|
|
|
:model="row" |
|
|
|
style="width: 100%;" |
|
|
|
style="width: 100%" |
|
|
|
:rules="tableFormRules" |
|
|
|
:class="tableFormRules ? '' : 'noRulesForm'"> |
|
|
|
:class="tableFormRules ? '' : 'noRulesForm'" |
|
|
|
@click.stop="" |
|
|
|
> |
|
|
|
<!-- 字符串输入框 --> |
|
|
|
<el-form-item |
|
|
|
v-if="!headerItem?.tableForm?.type || headerItem?.tableForm?.type == 'InputString'" |
|
|
|
:prop="headerItem.field" style="display: flex;align-items: center;"> |
|
|
|
<el-input :key="headerItem.field+$index" |
|
|
|
:prop="headerItem.field" |
|
|
|
style="display: flex; align-items: center" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
clearable |
|
|
|
:type="headerItem?.tableForm?.inputType" |
|
|
|
:placeholder="t(`ts.${headerItem?.tableForm?.placeholder || '请输入' + headerItem.label}`).replace('ts.','')" |
|
|
|
:disabled="disabledInput(headerItem,row)" |
|
|
|
style="flex:1" |
|
|
|
@blur="inputStringBlur(headerItem, row[headerItem.field], row,index)" |
|
|
|
:placeholder=" |
|
|
|
t( |
|
|
|
`ts.${headerItem?.tableForm?.placeholder || '请输入' + headerItem.label}` |
|
|
|
).replace('ts.', '') |
|
|
|
" |
|
|
|
:disabled="disabledInput(headerItem, row)" |
|
|
|
style="flex: 1" |
|
|
|
@blur.stop="inputStringBlur(headerItem, row[headerItem.field], row, index)" |
|
|
|
/> |
|
|
|
<Icon icon="ep:circle-close" v-if="headerItem?.tableForm?.isInpuFocusShow && headerItem?.tableForm?.disabled&& headerItem?.tableForm?.clearable" style='position:absolute;right:50px;cursor: pointer;' @click="clearInput(headerItem.field,row,index)"/> |
|
|
|
<el-button :key="headerItem.field+$index+'button'" v-if="headerItem?.tableForm?.isInpuFocusShow" @click="inpuFocus(headerItem,row,index)"><Icon icon="ep:search" size="14"/></el-button> |
|
|
|
<Icon |
|
|
|
icon="ep:circle-close" |
|
|
|
v-if=" |
|
|
|
headerItem?.tableForm?.isInpuFocusShow && |
|
|
|
headerItem?.tableForm?.disabled && |
|
|
|
headerItem?.tableForm?.clearable |
|
|
|
" |
|
|
|
style="position: absolute; right: 50px; cursor: pointer" |
|
|
|
@click.stop="clearInput(headerItem.field, row, index)" |
|
|
|
/> |
|
|
|
<el-button |
|
|
|
:key="headerItem.field + $index + 'button'" |
|
|
|
v-if="headerItem?.tableForm?.isInpuFocusShow" |
|
|
|
@click.stop="inpuFocus(headerItem, row, index)" |
|
|
|
><Icon icon="ep:search" size="14" |
|
|
|
/></el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'slot'"> |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'slot'"> |
|
|
|
<slot :row="row"></slot> |
|
|
|
</el-form-item> |
|
|
|
<!-- 金额输入框 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'number'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-input :key="headerItem.field+$index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
clearable |
|
|
|
type="number" |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '请输入' + headerItem.label" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
style="width: 100%;" |
|
|
|
@input="row[headerItem.field] = row[headerItem.field].replace(/[^\d\.-]/g, '')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'number'" :prop="headerItem.field" > |
|
|
|
<el-input |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
clearable |
|
|
|
type="number" |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '请输入' + headerItem.label" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
style="width: 100%" |
|
|
|
@input.stop="row[headerItem.field] = row[headerItem.field].replace(/[^\d\.-]/g, '')" |
|
|
|
@click.stop="" |
|
|
|
@focus.stop="" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- 数字输入框 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'InputNumber'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
:prop="headerItem.field" |
|
|
|
> |
|
|
|
<el-input-number |
|
|
|
style="width: 100%;" |
|
|
|
:key="headerItem.field+$index" |
|
|
|
style="width: 100%" |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:max="headerItem?.tableForm?.max" |
|
|
|
:min="headerItem?.tableForm?.min" |
|
|
|
:precision="headerItem?.tableForm?.precision" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
@change="(e)=>{inputNumberChange(headerItem.field, $index, row, e)}" |
|
|
|
@change.stop=" |
|
|
|
(e) => { |
|
|
|
inputNumberChange(headerItem.field, $index, row, e) |
|
|
|
} |
|
|
|
" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- 下拉框 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'Select'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-select :key="headerItem.field+$index" |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'Select'" :prop="headerItem.field"> |
|
|
|
<el-select |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:clearable="headerItem?.tableForm.clearable || true" |
|
|
|
:multiple="headerItem?.tableForm.multiple" |
|
|
|
:size="headerItem?.tableForm.size" |
|
|
|
:collapse-tags ="headerItem?.tableForm.collapseTags" |
|
|
|
:collapse-tags-tooltip ="headerItem?.tableForm.collapseTagsTooltip" |
|
|
|
:multiple-limit ="headerItem?.tableForm.multipleLimit" |
|
|
|
:collapse-tags="headerItem?.tableForm.collapseTags" |
|
|
|
:collapse-tags-tooltip="headerItem?.tableForm.collapseTagsTooltip" |
|
|
|
:multiple-limit="headerItem?.tableForm.multipleLimit" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:filterable="headerItem?.tableForm.filterable" |
|
|
|
:allow-create="headerItem?.tableForm.allowCreate" |
|
|
|
style="width: 100%" |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label" |
|
|
|
@change="formSelectChange(headerItem.field, $event,row)" |
|
|
|
@blur="tableFormSelectOnBlur(headerItem.field, $event,row, $index)"> |
|
|
|
@change.stop="formSelectChange(headerItem.field, $event, row)" |
|
|
|
@blur.stop="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="op in initSelectOptions(headerItem)" |
|
|
|
:label="t(`ts.${op.label}`).replace('ts.','')" |
|
|
|
:label="t(`ts.${op.label}`).replace('ts.', '')" |
|
|
|
:value="op.value" |
|
|
|
:key="op.value" /> |
|
|
|
:key="op.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<!-- 下拉框 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'SelectGroup'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-select :key="headerItem.field+$index" |
|
|
|
:prop="headerItem.field" |
|
|
|
> |
|
|
|
<el-select |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:clearable="headerItem?.tableForm.clearable || true" |
|
|
|
:multiple="headerItem?.tableForm.multiple" |
|
|
|
:size="headerItem?.tableForm.size" |
|
|
|
:collapse-tags ="headerItem?.tableForm.collapseTags" |
|
|
|
:collapse-tags-tooltip ="headerItem?.tableForm.collapseTagsTooltip" |
|
|
|
:multiple-limit ="headerItem?.tableForm.multipleLimit" |
|
|
|
:collapse-tags="headerItem?.tableForm.collapseTags" |
|
|
|
:collapse-tags-tooltip="headerItem?.tableForm.collapseTagsTooltip" |
|
|
|
:multiple-limit="headerItem?.tableForm.multipleLimit" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:filterable="headerItem?.tableForm.filterable" |
|
|
|
:allow-create="headerItem?.tableForm.allowCreate" |
|
|
|
style="width: 100%" |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label" |
|
|
|
@change="formSelectChange(headerItem.field, $event,row)" |
|
|
|
@blur="tableFormSelectOnBlur(headerItem.field, $event,row, $index)"> |
|
|
|
<el-option-group |
|
|
|
v-for="group in initSelectOptions(headerItem)" |
|
|
|
:key="group.type" |
|
|
|
:label="t(`ts.${group.name}`).replace('ts.','')" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in group.options" |
|
|
|
:key="item.value" |
|
|
|
:label="t(`ts.${item.label}`).replace('ts.','')" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-option-group> |
|
|
|
@change.stop="formSelectChange(headerItem.field, $event, row)" |
|
|
|
@blur.stop="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" |
|
|
|
> |
|
|
|
<el-option-group |
|
|
|
v-for="group in initSelectOptions(headerItem)" |
|
|
|
:key="group.type" |
|
|
|
:label="t(`ts.${group.name}`).replace('ts.', '')" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in group.options" |
|
|
|
:key="item.value" |
|
|
|
:label="t(`ts.${item.label}`).replace('ts.', '')" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-option-group> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<!-- 时间选择器 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'FormTime'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-time-picker :key="headerItem.field+$index" |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'FormTime'" :prop="headerItem.field"> |
|
|
|
<el-time-picker |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:clearable="true" |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '选择时间'" |
|
|
|
style="width: 100%" :disabled="itemIsDisabled(headerItem, row)" |
|
|
|
style="width: 100%" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:format="headerItem?.tableForm?.format || 'HH:mm:ss'" |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'HH:mm:ss'" /> |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'HH:mm:ss'" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- 日期选择器 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'FormDate'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'FormDate'" :prop="headerItem.field"> |
|
|
|
<el-date-picker |
|
|
|
:key="headerItem.field+$index" |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:clearable="true" |
|
|
|
style="width: 100%" |
|
|
@ -189,14 +235,16 @@ |
|
|
|
:placeholder="headerItem?.tableForm?.placeholder || '选择日期'" |
|
|
|
:format="headerItem?.tableForm?.format || 'YYYY-MM-DD'" |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'YYYY-MM-DD'" |
|
|
|
@change="formFormDateChange(headerItem.field, $event,row, $index)" /> |
|
|
|
@change.stop="formFormDateChange(headerItem.field, $event, row, $index)" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- 日期时间选择器 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'FormDateTime'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
:prop="headerItem.field" |
|
|
|
> |
|
|
|
<el-date-picker |
|
|
|
:key="headerItem.field+$index" |
|
|
|
:key="headerItem.field + $index" |
|
|
|
type="datetime" |
|
|
|
:clearable="true" |
|
|
|
v-model="row[headerItem.field]" |
|
|
@ -204,13 +252,16 @@ |
|
|
|
style="width: 100%" |
|
|
|
:format="headerItem?.tableForm?.format || 'YYYY-MM-DD HH:mm:ss'" |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'YYYY-MM-DDTHH:mm:ss'" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" /> |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!--开始时间结束时间选择器 (原类型datetimerange已弃用 使用type+timeType结合方式)--> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'FormTimerange'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-date-picker :key="headerItem.field+$index" |
|
|
|
:prop="headerItem.field" |
|
|
|
> |
|
|
|
<el-date-picker |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:clearable="true" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
@ -219,13 +270,13 @@ |
|
|
|
start-placeholder="开始日期" |
|
|
|
end-placeholder="结束日期" |
|
|
|
:format="headerItem?.tableForm?.format || 'YYYY-MM-DD HH:mm:ss'" |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'YYYY-MM-DDTHH:mm:ss'" /> |
|
|
|
:value-format="headerItem?.tableForm?.valueFormat || 'YYYY-MM-DDTHH:mm:ss'" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- Switch 开关 --> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'Switch'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-switch :key="headerItem.field+$index" |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'Switch'" :prop="headerItem.field"> |
|
|
|
<el-switch |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:loading="headerItem?.tableForm?.loading" |
|
|
@ -237,69 +288,79 @@ |
|
|
|
:active-value="headerItem?.tableForm?.activeValue" |
|
|
|
:inactive-value="headerItem?.tableForm?.inactiveValue" |
|
|
|
:active-color="headerItem?.tableForm?.inactiveColor" |
|
|
|
:inactive-color="headerItem?.tableForm?.inactiveColor" /> |
|
|
|
:inactive-color="headerItem?.tableForm?.inactiveColor" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<!-- Radio 单选--> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'Radio'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-radio-group :key="headerItem.field+$index" |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'Radio'" :prop="headerItem.field"> |
|
|
|
<el-radio-group |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:size="headerItem?.tableForm?.size" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:text-color="headerItem?.tableForm?.textColor" |
|
|
|
:fill="headerItem?.tableForm?.fill" |
|
|
|
:name="headerItem?.tableForm?.name" |
|
|
|
:id="headerItem?.tableForm?.id"> |
|
|
|
:id="headerItem?.tableForm?.id" |
|
|
|
> |
|
|
|
<el-radio |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem)" |
|
|
|
:key="index" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.','')" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.', '')" |
|
|
|
:size="headerItem?.tableForm?.size" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:border="headerItem?.tableForm?.border"> |
|
|
|
:border="headerItem?.tableForm?.border" |
|
|
|
> |
|
|
|
{{ item.label }} |
|
|
|
</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
<!-- Checkbox 多选--> |
|
|
|
<el-form-item |
|
|
|
v-if="headerItem?.tableForm?.type == 'Checkbox'" |
|
|
|
:prop="headerItem.field"> |
|
|
|
<el-checkbox-group :key="headerItem.field+$index" |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'Checkbox'" :prop="headerItem.field"> |
|
|
|
<el-checkbox-group |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:size="headerItem?.tableForm?.size" |
|
|
|
:min="headerItem?.tableForm?.min" |
|
|
|
:max="headerItem?.tableForm?.max" |
|
|
|
:text-color="headerItem?.tableForm?.textColor" |
|
|
|
:fill="headerItem?.tableForm?.fill"> |
|
|
|
:fill="headerItem?.tableForm?.fill" |
|
|
|
> |
|
|
|
<el-checkbox |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem)" |
|
|
|
:key="index" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.','')" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.', '')" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
|
:true-label="t(`ts.${headerItem?.tableForm?.trueLabel}`).replace('ts.','')" |
|
|
|
:false-label="t(`ts.${headerItem?.tableForm?.falseLabel}`).replace('ts.','')" |
|
|
|
:true-label="t(`ts.${headerItem?.tableForm?.trueLabel}`).replace('ts.', '')" |
|
|
|
:false-label="t(`ts.${headerItem?.tableForm?.falseLabel}`).replace('ts.', '')" |
|
|
|
:border="headerItem?.tableForm?.border" |
|
|
|
:size="headerItem?.tableForm?.size" |
|
|
|
:name="headerItem?.tableForm?.name" |
|
|
|
:checked="headerItem?.tableForm?.checked"> |
|
|
|
:checked="headerItem?.tableForm?.checked" |
|
|
|
> |
|
|
|
{{ item.label }} |
|
|
|
</el-checkbox> |
|
|
|
</el-checkbox-group> |
|
|
|
</el-form-item> |
|
|
|
<!-- table表添加操作列 --> |
|
|
|
<!-- <el-form-item> --> |
|
|
|
<div v-if="headerItem?.tableForm?.type == 'action'" :key="headerItem.field+$index"> |
|
|
|
<el-button |
|
|
|
v-for="(itemButton, indexButton) in headerItem?.tableForm?.buttonText.split('|')" |
|
|
|
:key="indexButton" |
|
|
|
type="text" |
|
|
|
style="padding-top: 0px;align-items:unsafe;" |
|
|
|
@click="buttonOperationClick(row, headerItem?.tableForm?.buttonName.split('|')[indexButton], $index)" |
|
|
|
>{{itemButton}}</el-button> |
|
|
|
</div> |
|
|
|
<div v-if="headerItem?.tableForm?.type == 'action'" :key="headerItem.field + $index"> |
|
|
|
<el-button |
|
|
|
v-for="(itemButton, indexButton) in headerItem?.tableForm?.buttonText.split('|')" |
|
|
|
:key="indexButton" |
|
|
|
type="text" |
|
|
|
style="padding-top: 0px; align-items: unsafe" |
|
|
|
@click.stop=" |
|
|
|
buttonOperationClick( |
|
|
|
row, |
|
|
|
headerItem?.tableForm?.buttonName.split('|')[indexButton], |
|
|
|
$index |
|
|
|
) |
|
|
|
" |
|
|
|
>{{ itemButton }}</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
<!-- </el-form-item> --> |
|
|
|
</el-form> |
|
|
|
</el-table-column> |
|
|
@ -312,30 +373,48 @@ |
|
|
|
v-if="isShowReduceButtonSelection" |
|
|
|
v-slot="{ row, $index }" |
|
|
|
> |
|
|
|
<ButtonBase :Butttondata="[defaultButtons.mainListDeleteBtn(),]" @button-base-click="handleDeleteTable (row, $index)" /> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="[defaultButtons.mainListDeleteBtn()]" |
|
|
|
@button-base-click="handleDeleteTable(row, $index)" |
|
|
|
/> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!-- :page-sizes="[ 10,20, 30, 50, 100]" sizes--> |
|
|
|
<el-pagination v-show="tableData.length>10" style="margin-top:10px" |
|
|
|
v-model:current-page="currentPage" |
|
|
|
v-model:page-size="pageSize" |
|
|
|
:small="true" |
|
|
|
:background="false" |
|
|
|
layout="total, prev, pager, next, jumper" |
|
|
|
:total="tableData.length" |
|
|
|
/> |
|
|
|
<div class="button flex" v-if="isShowButton||isShowReduceButtonSelection"> |
|
|
|
<div class="p-12px" v-if="isShowButton" @click="handleAddTable"> |
|
|
|
<Icon icon="ep:circle-plus" color="#409eff" size="26" style="cursor: pointer;" /> |
|
|
|
<div>{{t('ts.添加明细')}}</div> |
|
|
|
<el-pagination |
|
|
|
v-show="tableData.length > 10" |
|
|
|
style="margin-top: 10px" |
|
|
|
v-model:current-page="currentPage" |
|
|
|
v-model:page-size="pageSize" |
|
|
|
:small="true" |
|
|
|
:background="false" |
|
|
|
layout="total, prev, pager, next, jumper" |
|
|
|
:total="tableData.length" |
|
|
|
/> |
|
|
|
<div class="button flex" v-if="isShowButton || isShowReduceButtonSelection"> |
|
|
|
<div class="p-12px" v-if="isShowButton" @click.stop="handleAddTable"> |
|
|
|
<Icon icon="ep:circle-plus" color="#409eff" size="26" style="cursor: pointer" /> |
|
|
|
<div>{{ t('ts.添加明细') }}</div> |
|
|
|
</div> |
|
|
|
<div class="p-12px" v-if="isShowReduceButtonSelection" @click="handleSelectionDelete"> |
|
|
|
<Icon icon="ep:delete" color="#409eff" size="26" style="cursor: pointer;" /> |
|
|
|
<div>{{t('ts.批量删除')}}</div> |
|
|
|
<div class="p-12px" v-if="isShowReduceButtonSelection" @click.stop="handleSelectionDelete"> |
|
|
|
<Icon icon="ep:delete" color="#409eff" size="26" style="cursor: pointer" /> |
|
|
|
<div>{{ t('ts.批量删除') }}</div> |
|
|
|
</div> |
|
|
|
<div class="p-12px" v-if="routeName == 'PurchaseMain'||routeName == 'ProductionMain'||routeName == 'ZZBJDeliverPlanMain'||routeName == 'DeliverPlanMain'||routeName == 'DeliverRequestMain'||routeName == 'ZZBJDeliverRequestMain'||routeName == 'UnplannedreceiptRequestMain'"> |
|
|
|
<el-input v-model="keyWord" style="width: 240px" placeholder="回车自动添加"/> |
|
|
|
<el-button type="primary" style="margin-left: 10px" @click="batchAdd">{{t('批量添加')}}</el-button> |
|
|
|
<div |
|
|
|
class="p-12px" |
|
|
|
v-if=" |
|
|
|
routeName == 'PurchaseMain' || |
|
|
|
routeName == 'ProductionMain' || |
|
|
|
routeName == 'ZZBJDeliverPlanMain' || |
|
|
|
routeName == 'DeliverPlanMain' || |
|
|
|
routeName == 'DeliverRequestMain' || |
|
|
|
routeName == 'ZZBJDeliverRequestMain' || |
|
|
|
routeName == 'UnplannedreceiptRequestMain' |
|
|
|
" |
|
|
|
> |
|
|
|
<el-input v-model="keyWord" style="width: 240px" placeholder="回车自动添加" /> |
|
|
|
<el-button type="primary" style="margin-left: 10px" @click.stop="batchAdd">{{ |
|
|
|
t('批量添加') |
|
|
|
}}</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -349,46 +428,46 @@ const props = defineProps({ |
|
|
|
// 是否显示添加按钮 |
|
|
|
isShowButton: { |
|
|
|
type: Boolean, |
|
|
|
default: true, |
|
|
|
default: true |
|
|
|
}, |
|
|
|
// 是否显示选择框 :custom="headerItem.sortable?headerItem.sortable:false" |
|
|
|
selectionTable: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 是否显示序号 |
|
|
|
isShowIndex: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 是否显示删除按钮--多选 |
|
|
|
isShowReduceButtonSelection:{ |
|
|
|
isShowReduceButtonSelection: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 是否显示删除按钮 |
|
|
|
isShowReduceButton:{ |
|
|
|
isShowReduceButton: { |
|
|
|
type: Boolean, |
|
|
|
default: true, |
|
|
|
default: true |
|
|
|
}, |
|
|
|
// 加载状态 |
|
|
|
tableLoading: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 列表数据 |
|
|
|
tableData: { |
|
|
|
type: Array, |
|
|
|
default: () => { |
|
|
|
return [] |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
// 列表头定义 |
|
|
|
tableFields: { |
|
|
|
type: Array, |
|
|
|
default: () => { |
|
|
|
return [] |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
// table高度 |
|
|
|
height: { |
|
|
@ -406,7 +485,7 @@ const props = defineProps({ |
|
|
|
// 是否有边框(可拖拽) |
|
|
|
border: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// table输入表单的rules |
|
|
|
tableFormRules: { |
|
|
@ -418,7 +497,7 @@ const props = defineProps({ |
|
|
|
type: String, |
|
|
|
required: false, |
|
|
|
default: '' |
|
|
|
}, |
|
|
|
} |
|
|
|
}) |
|
|
|
// 传递给父类 |
|
|
|
const emit = defineEmits([ |
|
|
@ -444,16 +523,16 @@ const initSelectOptions = (item) => { |
|
|
|
return item.dictType ? getStrDictOptions(item.dictType) : item.tableForm.initOptions |
|
|
|
} |
|
|
|
//普通下拉改变事件 |
|
|
|
const formSelectChange = (field, val,row) => { |
|
|
|
emit('formSelectChange', field, val,row) |
|
|
|
const formSelectChange = (field, val, row) => { |
|
|
|
emit('formSelectChange', field, val, row) |
|
|
|
} |
|
|
|
// 日期改变事件 |
|
|
|
const formFormDateChange = (field, val,row, index) => { |
|
|
|
emit('formFormDateChange', field, val,row, index) |
|
|
|
const formFormDateChange = (field, val, row, index) => { |
|
|
|
emit('formFormDateChange', field, val, row, index) |
|
|
|
} |
|
|
|
// 普通下拉失焦事件 |
|
|
|
const tableFormSelectOnBlur = (field, val,row,index) => { |
|
|
|
emit('tableFormSelectOnBlur', field, val,row,index) |
|
|
|
const tableFormSelectOnBlur = (field, val, row, index) => { |
|
|
|
emit('tableFormSelectOnBlur', field, val, row, index) |
|
|
|
} |
|
|
|
// 数字输入-改变事件 |
|
|
|
const inputNumberChange = (field, index, row, e) => { |
|
|
@ -465,18 +544,18 @@ const deleteTableData = ref([]) |
|
|
|
|
|
|
|
// 点击selection框 |
|
|
|
const tableSelectionChange = (val) => { |
|
|
|
if(props.isShowReduceButtonSelection){ |
|
|
|
if (props.isShowReduceButtonSelection) { |
|
|
|
//勾选删除 |
|
|
|
deleteTableData.value = val |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
emit('tableSelectionChange', val) |
|
|
|
} |
|
|
|
} |
|
|
|
const handleSelectionDelete = ()=>{ |
|
|
|
const handleSelectionDelete = () => { |
|
|
|
emit('tableSelectionDelete', deleteTableData.value) |
|
|
|
nextTick(()=>{ |
|
|
|
deleteTableData.value.forEach(row=>{ |
|
|
|
TableBaseComponents_Ref.value!.toggleRowSelection(row,false) |
|
|
|
nextTick(() => { |
|
|
|
deleteTableData.value.forEach((row) => { |
|
|
|
TableBaseComponents_Ref.value!.toggleRowSelection(row, false) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
@ -491,12 +570,25 @@ const tableSortChange = (column, prop, order) => { |
|
|
|
|
|
|
|
// 行点击 |
|
|
|
const handleTableSelect = (row, column, event) => { |
|
|
|
const selected = TableBaseComponents_Ref.value |
|
|
|
?.getSelectionRows() |
|
|
|
.some((item) => item.id === row.id) |
|
|
|
if (!selected) { |
|
|
|
TableBaseComponents_Ref.value?.toggleRowSelection(row, true) |
|
|
|
} else { |
|
|
|
// 取消 |
|
|
|
TableBaseComponents_Ref.value?.toggleRowSelection(row, false) |
|
|
|
} |
|
|
|
emit('handleTableSelect', row, column, event) |
|
|
|
} |
|
|
|
|
|
|
|
// 某个item是否禁用 |
|
|
|
const itemIsDisabled = (colum, row) => { |
|
|
|
return Boolean(colum.tableForm?.disabled) || Boolean(row.disabled) || Boolean(row['disabled_' + colum.field]) |
|
|
|
return ( |
|
|
|
Boolean(colum.tableForm?.disabled) || |
|
|
|
Boolean(row.disabled) || |
|
|
|
Boolean(row['disabled_' + colum.field]) |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
// const { t } = useI18n() // 国际化 |
|
|
@ -506,25 +598,27 @@ const TableBaseComponents_Ref = ref() |
|
|
|
const TableBaseForm_Ref = ref() |
|
|
|
|
|
|
|
/** |
|
|
|
* 验证表单是否符合rules |
|
|
|
* @param {*} success 如果验证【成功】走的方法 |
|
|
|
* @param {*} error 如果验证【不成功】走的方法 |
|
|
|
*/ |
|
|
|
* 验证表单是否符合rules |
|
|
|
* @param {*} success 如果验证【成功】走的方法 |
|
|
|
* @param {*} error 如果验证【不成功】走的方法 |
|
|
|
*/ |
|
|
|
|
|
|
|
const validateForm = () => { |
|
|
|
console.log(TableBaseForm_Ref.value) |
|
|
|
let _lists = TableBaseForm_Ref.value?.map(v => v.validate()) |
|
|
|
return Promise.all(_lists).then(() => { |
|
|
|
return true |
|
|
|
}).catch(() => { |
|
|
|
return false |
|
|
|
}) |
|
|
|
let _lists = TableBaseForm_Ref.value?.map((v) => v.validate()) |
|
|
|
return Promise.all(_lists) |
|
|
|
.then(() => { |
|
|
|
return true |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
return false |
|
|
|
}) |
|
|
|
} |
|
|
|
// 删除数据 |
|
|
|
const handleDeleteTable = (row, index) => { |
|
|
|
emit('handleDeleteTable', row, index) |
|
|
|
nextTick(()=>{ |
|
|
|
TableBaseComponents_Ref.value!.toggleRowSelection(row,false) |
|
|
|
nextTick(() => { |
|
|
|
TableBaseComponents_Ref.value!.toggleRowSelection(row, false) |
|
|
|
}) |
|
|
|
} |
|
|
|
// 添加数据 |
|
|
@ -532,59 +626,67 @@ const handleAddTable = () => { |
|
|
|
emit('handleAddTable') |
|
|
|
} |
|
|
|
// 输入框聚焦 |
|
|
|
const inpuFocus = (headerItem, row, index)=>{ |
|
|
|
if(headerItem?.tableForm?.isInpuFocusShow){ |
|
|
|
emit('inpuFocus', headerItem, row, index) |
|
|
|
const inpuFocus = (headerItem, row, index) => { |
|
|
|
if (headerItem?.tableForm?.isInpuFocusShow) { |
|
|
|
emit('inpuFocus', headerItem, row, index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// input输入失去焦点事件 |
|
|
|
const inputStringBlur = (headerItem, val,row,index) => { |
|
|
|
emit('inputStringBlur', headerItem, val,row,index) |
|
|
|
const inputStringBlur = (headerItem, val, row, index) => { |
|
|
|
emit('inputStringBlur', headerItem, val, row, index) |
|
|
|
} |
|
|
|
const clearInput= (field, row, index) => { |
|
|
|
emit('clearInput',field, row, index) |
|
|
|
const clearInput = (field, row, index) => { |
|
|
|
emit('clearInput', field, row, index) |
|
|
|
} |
|
|
|
//点击table操作列按钮 |
|
|
|
const buttonOperationClick = (row, label, index)=> { |
|
|
|
emit("buttonOperationClick", row, label, index); |
|
|
|
const buttonOperationClick = (row, label, index) => { |
|
|
|
emit('buttonOperationClick', row, label, index) |
|
|
|
} |
|
|
|
|
|
|
|
const currentPage =ref(1) |
|
|
|
const currentPage = ref(1) |
|
|
|
const pageSize = ref(10) |
|
|
|
const showTableData = ()=>{ |
|
|
|
if(props.tableData.length>10){ |
|
|
|
return props.tableData.slice((currentPage.value-1)*pageSize.value,currentPage.value*pageSize.value) |
|
|
|
}else{ |
|
|
|
const showTableData = () => { |
|
|
|
if (props.tableData.length > 10) { |
|
|
|
return props.tableData.slice( |
|
|
|
(currentPage.value - 1) * pageSize.value, |
|
|
|
currentPage.value * pageSize.value |
|
|
|
) |
|
|
|
} else { |
|
|
|
return props.tableData |
|
|
|
} |
|
|
|
} |
|
|
|
const keyWord = ref('') |
|
|
|
console.log(9999,props.tableFields) |
|
|
|
const batchAdd = ()=>{ |
|
|
|
console.log(9999, props.tableFields) |
|
|
|
const batchAdd = () => { |
|
|
|
console.log(keyWord.value) |
|
|
|
let field = '' |
|
|
|
const itemCodeFields = props.tableFields.find(item=>item.field == 'itemCode') |
|
|
|
const supplierFields = props.tableFields.find(item=>item.field == 'supplierCode') |
|
|
|
if(itemCodeFields){ |
|
|
|
const itemCodeFields = props.tableFields.find((item) => item.field == 'itemCode') |
|
|
|
const supplierFields = props.tableFields.find((item) => item.field == 'supplierCode') |
|
|
|
if (itemCodeFields) { |
|
|
|
field = itemCodeFields.field |
|
|
|
}else { |
|
|
|
if(itemCodeFields){ |
|
|
|
} else { |
|
|
|
if (itemCodeFields) { |
|
|
|
field = supplierFields.field |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(field) |
|
|
|
emit('batchAdd',keyWord.value) |
|
|
|
console.log(field) |
|
|
|
emit('batchAdd', keyWord.value) |
|
|
|
} |
|
|
|
const disabledInput=(headerItem,row)=>{ |
|
|
|
if(headerItem.tableForm?.isInpuFocusShow){ |
|
|
|
if(headerItem.tableForm?.enterSearch){ |
|
|
|
const disabledInput = (headerItem, row) => { |
|
|
|
if (headerItem.tableForm?.isInpuFocusShow) { |
|
|
|
if (headerItem.tableForm?.enterSearch) { |
|
|
|
return false |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return true |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return headerItem?.tableForm?.disabled || Boolean(row.disabled) || Boolean(row['disabled_' + headerItem.field]) ||false |
|
|
|
} else { |
|
|
|
return ( |
|
|
|
headerItem?.tableForm?.disabled || |
|
|
|
Boolean(row.disabled) || |
|
|
|
Boolean(row['disabled_' + headerItem.field]) || |
|
|
|
false |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -594,13 +696,12 @@ defineExpose({ |
|
|
|
validateForm, |
|
|
|
keyWord |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
::v-deep(.el-table__body){ |
|
|
|
padding:10px 0px |
|
|
|
::v-deep(.el-table__body) { |
|
|
|
padding: 10px 0px; |
|
|
|
} |
|
|
|
::v-deep(.el-table--default .el-table__cell) { |
|
|
|
padding: 2px 0px; |
|
|
@ -623,20 +724,23 @@ defineExpose({ |
|
|
|
display: block; |
|
|
|
} |
|
|
|
|
|
|
|
.table-form ::v-deep(.is-horizontal) { |
|
|
|
height: 12px !important; |
|
|
|
display: block !important; |
|
|
|
} |
|
|
|
|
|
|
|
.button { |
|
|
|
>div { |
|
|
|
> div { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
>div { |
|
|
|
> div { |
|
|
|
margin-left: 6px; |
|
|
|
text-decoration: underline; |
|
|
|
color: #409eff; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|