|
|
@ -65,7 +65,8 @@ |
|
|
|
:width="headerItem?.tableForm?.width" |
|
|
|
:min-width="headerItem?.tableForm?.minWidth || '200px'" |
|
|
|
> |
|
|
|
<el-form @submit.native.prevent |
|
|
|
<el-form |
|
|
|
@submit.native.prevent |
|
|
|
ref="TableBaseForm_Ref" |
|
|
|
:model="row" |
|
|
|
style="width: 100%" |
|
|
@ -92,7 +93,7 @@ |
|
|
|
:disabled="disabledInput(headerItem, row)" |
|
|
|
style="flex: 1" |
|
|
|
@blur="inputStringBlur(headerItem, row[headerItem.field], row, index)" |
|
|
|
@clear='clearInput(headerItem.field, row, index)' |
|
|
|
@clear="clearInput(headerItem.field, row, index)" |
|
|
|
@focus="inputStringFcous(headerItem)" |
|
|
|
/> |
|
|
|
<Icon |
|
|
@ -116,7 +117,7 @@ |
|
|
|
<slot :row="row"></slot> |
|
|
|
</el-form-item> |
|
|
|
<!-- 金额输入框 --> |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'number'" :prop="headerItem.field" > |
|
|
|
<el-form-item v-if="headerItem?.tableForm?.type == 'number'" :prop="headerItem.field"> |
|
|
|
<el-input |
|
|
|
:key="headerItem.field + $index" |
|
|
|
v-model="row[headerItem.field]" |
|
|
@ -169,10 +170,10 @@ |
|
|
|
@visible-change="visibleChange(headerItem.field, $event, row, $index)" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="op in initSelectOptions(headerItem,row)" |
|
|
|
:label="t(`ts.${initLabel(headerItem,op)}`).replace('ts.', '')" |
|
|
|
:value="initValue(headerItem,op)" |
|
|
|
:key="initValue(headerItem,op)" |
|
|
|
v-for="op in initSelectOptions(headerItem, row)" |
|
|
|
:label="t(`ts.${initLabel(headerItem, op)}`).replace('ts.', '')" |
|
|
|
:value="initValue(headerItem, op)" |
|
|
|
:key="initValue(headerItem, op)" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
@ -199,7 +200,7 @@ |
|
|
|
@blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" |
|
|
|
> |
|
|
|
<el-option-group |
|
|
|
v-for="group in initSelectOptions(headerItem,row)" |
|
|
|
v-for="group in initSelectOptions(headerItem, row)" |
|
|
|
:key="group.type" |
|
|
|
:label="t(`ts.${group.name}`).replace('ts.', '')" |
|
|
|
> |
|
|
@ -305,7 +306,7 @@ |
|
|
|
:id="headerItem?.tableForm?.id" |
|
|
|
> |
|
|
|
<el-radio |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem,row)" |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem, row)" |
|
|
|
:key="index" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.', '')" |
|
|
|
:size="headerItem?.tableForm?.size" |
|
|
@ -329,7 +330,7 @@ |
|
|
|
:fill="headerItem?.tableForm?.fill" |
|
|
|
> |
|
|
|
<el-checkbox |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem,row)" |
|
|
|
v-for="(item, index) in initSelectOptions(headerItem, row)" |
|
|
|
:key="index" |
|
|
|
:label="t(`ts.${item.value}`).replace('ts.', '')" |
|
|
|
:disabled="itemIsDisabled(headerItem, row)" |
|
|
@ -391,32 +392,34 @@ |
|
|
|
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.stop="handleSelectionDelete"> |
|
|
|
<Icon icon="ep:delete" color="#409eff" size="26" style="cursor: pointer" /> |
|
|
|
<div>{{ t('ts.批量删除') }}</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
class="p-12px" |
|
|
|
v-if=" |
|
|
|
isShowTableFormSearch?.isShowTableFormSearch|| |
|
|
|
routeName == 'PurchaseMain' || |
|
|
|
routeName == 'PurchaseMain' || |
|
|
|
routeName == 'ProductionMain' || |
|
|
|
routeName == 'ZZBJDeliverPlanMain' || |
|
|
|
routeName == 'DeliverPlanMain' || |
|
|
|
routeName == 'DeliverRequestMain' || |
|
|
|
routeName == 'ZZBJDeliverRequestMain' || |
|
|
|
routeName == 'UnplannedreceiptRequestMain'|| |
|
|
|
routeName == 'RepleinshRequestMain' |
|
|
|
|
|
|
|
" |
|
|
|
<div class="button flex" style="padding-top: 10px" v-if="isShowButton || isShowReduceButtonSelection"> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
link |
|
|
|
v-if="isShowButton" |
|
|
|
@click.stop="handleAddTable" |
|
|
|
:disabled="sureDisabled" |
|
|
|
:icon="CirclePlus" |
|
|
|
size="large" |
|
|
|
> |
|
|
|
<span>{{ t('ts.添加明细') }}</span> |
|
|
|
</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
link |
|
|
|
v-if="isShowReduceButtonSelection" |
|
|
|
@click.stop="handleSelectionDelete" |
|
|
|
:icon="Remove" |
|
|
|
size="large" |
|
|
|
> |
|
|
|
<el-input v-model="keyWord" style="width: 240px" :placeholder="`请输入${isShowTableFormSearch?.label},多条数据逗号分隔`" /> |
|
|
|
<span>{{ t('ts.批量删除') }}</span> |
|
|
|
</el-button> |
|
|
|
<div class="p-12px" v-if="isShowTableFormSearch?.isShowTableFormSearch"> |
|
|
|
<el-input |
|
|
|
v-model="keyWord" |
|
|
|
style="width: 240px" |
|
|
|
:placeholder="`请输入${isShowTableFormSearch?.label},多条数据逗号分隔`" |
|
|
|
/> |
|
|
|
<el-button type="primary" style="margin-left: 10px" @click.stop="batchAdd">{{ |
|
|
|
t('批量添加') |
|
|
|
}}</el-button> |
|
|
@ -429,6 +432,7 @@ |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' |
|
|
|
import { CirclePlus, Remove } from '@element-plus/icons-vue' |
|
|
|
const props = defineProps({ |
|
|
|
// 是否显示添加按钮 |
|
|
|
isShowButton: { |
|
|
@ -502,11 +506,16 @@ const props = defineProps({ |
|
|
|
type: String, |
|
|
|
required: false, |
|
|
|
default: '' |
|
|
|
}, |
|
|
|
// 添加明细是否可点击 |
|
|
|
sureDisabled: { |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
} |
|
|
|
}) |
|
|
|
let isShowTableFormSearch = ref({}) |
|
|
|
console.log(33333,props.tableFields) |
|
|
|
isShowTableFormSearch.value =props.tableFields.find(item=>item.isShowTableFormSearch) |
|
|
|
console.log(33333, props.tableFields) |
|
|
|
isShowTableFormSearch.value = props.tableFields.find((item) => item.isShowTableFormSearch) |
|
|
|
|
|
|
|
// 传递给父类 |
|
|
|
const emit = defineEmits([ |
|
|
@ -531,11 +540,13 @@ const emit = defineEmits([ |
|
|
|
'inputStringFcous' |
|
|
|
]) |
|
|
|
// 获取下拉列表 | type = radio | type = select |
|
|
|
const initSelectOptions = (headerItem,row) => { |
|
|
|
if(row[headerItem.field+'InitOptions']){ |
|
|
|
return row[headerItem.field+'InitOptions'] |
|
|
|
}else{ |
|
|
|
return headerItem.dictType ? getStrDictOptions(headerItem.dictType) : headerItem.tableForm.initOptions |
|
|
|
const initSelectOptions = (headerItem, row) => { |
|
|
|
if (row[headerItem.field + 'InitOptions']) { |
|
|
|
return row[headerItem.field + 'InitOptions'] |
|
|
|
} else { |
|
|
|
return headerItem.dictType |
|
|
|
? getStrDictOptions(headerItem.dictType) |
|
|
|
: headerItem.tableForm.initOptions |
|
|
|
} |
|
|
|
} |
|
|
|
//普通下拉改变事件 |
|
|
@ -622,7 +633,7 @@ const TableBaseForm_Ref = ref() |
|
|
|
|
|
|
|
const validateForm = () => { |
|
|
|
let _lists = TableBaseForm_Ref.value?.map((v) => v.validate()) |
|
|
|
if(!_lists ||_lists.length == 0){ |
|
|
|
if (!_lists || _lists.length == 0) { |
|
|
|
return false |
|
|
|
} |
|
|
|
return Promise.all(_lists) |
|
|
@ -657,7 +668,7 @@ const inputStringBlur = (headerItem, val, row, index) => { |
|
|
|
} |
|
|
|
// 聚焦 |
|
|
|
const inputStringFcous = (headerItem) => { |
|
|
|
emit('inputStringFcous', headerItem) |
|
|
|
emit('inputStringFcous', headerItem) |
|
|
|
} |
|
|
|
const clearInput = (field, row, index) => { |
|
|
|
emit('clearInput', field, row, index) |
|
|
@ -667,7 +678,7 @@ const buttonOperationClick = (row, label, index) => { |
|
|
|
emit('buttonOperationClick', row, label, index) |
|
|
|
} |
|
|
|
const visibleChange = (field, val, row, index) => { |
|
|
|
emit('visibleChange',field, val, row, index) |
|
|
|
emit('visibleChange', field, val, row, index) |
|
|
|
} |
|
|
|
const currentPage = ref(1) |
|
|
|
const pageSize = ref(10) |
|
|
@ -711,19 +722,19 @@ const disabledInput = (headerItem, row) => { |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
const initLabel=(headerItem,op)=>{ |
|
|
|
if(headerItem?.tableForm?.labelField){ |
|
|
|
return op[headerItem?.tableForm?.labelField] |
|
|
|
}else{ |
|
|
|
return op.label |
|
|
|
} |
|
|
|
} |
|
|
|
const initValue=(headerItem,op)=>{ |
|
|
|
if(headerItem?.tableForm?.valueField){ |
|
|
|
return op[headerItem?.tableForm?.valueField] |
|
|
|
}else{ |
|
|
|
return op.value |
|
|
|
const initLabel = (headerItem, op) => { |
|
|
|
if (headerItem?.tableForm?.labelField) { |
|
|
|
return op[headerItem?.tableForm?.labelField] |
|
|
|
} else { |
|
|
|
return op.label |
|
|
|
} |
|
|
|
} |
|
|
|
const initValue = (headerItem, op) => { |
|
|
|
if (headerItem?.tableForm?.valueField) { |
|
|
|
return op[headerItem?.tableForm?.valueField] |
|
|
|
} else { |
|
|
|
return op.value |
|
|
|
} |
|
|
|
} |
|
|
|
// setup 语法糖 抛出方法 |
|
|
|
defineExpose({ |
|
|
|