|
|
@ -6,9 +6,7 @@ |
|
|
|
:close-on-click-modal="false" |
|
|
|
:vLoading="formLoading" |
|
|
|
> |
|
|
|
|
|
|
|
<div |
|
|
|
style="max-height: 60vh;overflow-y: auto;"> |
|
|
|
<div style="max-height: 60vh; overflow-y: auto"> |
|
|
|
<Form |
|
|
|
ref="formRef" |
|
|
|
:rules="rules" |
|
|
@ -21,10 +19,16 @@ |
|
|
|
@onChange="onChange" |
|
|
|
@onBlur="onBlur" |
|
|
|
@onEnter="onEnter" |
|
|
|
@onFocus="onFocus" |
|
|
|
> |
|
|
|
<template #crontab="formSchema1" v-if="fromeWhere == 'countPlan'"> |
|
|
|
|
|
|
|
<crontab v-if="formSchema1.type=='CYCLE'" v-model="formSchema1.crontab" :disabled="formSchema?.find(item=>item.field == 'crontab')?.componentProps?.disabled "/> |
|
|
|
<crontab |
|
|
|
v-if="formSchema1.type == 'CYCLE'" |
|
|
|
v-model="formSchema1.crontab" |
|
|
|
:disabled=" |
|
|
|
formSchema?.find((item) => item.field == 'crontab')?.componentProps?.disabled |
|
|
|
" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
<template #type="formSchema" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<el-select |
|
|
@ -97,8 +101,9 @@ |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@tableFormSelectOnBlur="tableFormSelectOnBlur" |
|
|
|
@formFormDateChange="formFormDateChange" |
|
|
|
@clearInput='clearInput' |
|
|
|
@inputFocusPlan='inputFocusPlan' |
|
|
|
@clearInput="clearInput" |
|
|
|
@inputFocusPlan="inputFocusPlan" |
|
|
|
@inputStringFcous="inputStringFcous" |
|
|
|
> |
|
|
|
<template v-slot="{ row }"> |
|
|
|
<slot :row="row"></slot> |
|
|
@ -116,8 +121,9 @@ |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@inpuFocus="inpuFocus" |
|
|
|
@inputStringBlur="inputStringBlur" |
|
|
|
@inputStringFcous="inputStringFcous" |
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
<Form |
|
|
|
ref="formRef1" |
|
|
@ -125,7 +131,6 @@ |
|
|
|
:schema="CountPlanMain1FormAllSchemas" |
|
|
|
:is-col="true" |
|
|
|
style="margin-top: 20px" |
|
|
|
|
|
|
|
@opensearchTable="opensearchTable1" |
|
|
|
@hiddenFilterButton="hiddenSearchTableFilterButton" |
|
|
|
@changeDialogWidth="changeDialogWidth" |
|
|
@ -133,15 +138,23 @@ |
|
|
|
@onChange="onChange" |
|
|
|
@onBlur="onBlur" |
|
|
|
@onEnter="onEnter" |
|
|
|
@onFocus="onFocus" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<template #footer> |
|
|
|
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> |
|
|
|
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" :key="count" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
</Dialog> |
|
|
|
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" /> |
|
|
|
<SearchTable ref="searchTableRef1" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess1" /> |
|
|
|
<SearchTable |
|
|
|
ref="searchTableRef" |
|
|
|
:showSearchTableQueryFields="showSearchTableQueryFields" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
/> |
|
|
|
<SearchTable |
|
|
|
ref="searchTableRef1" |
|
|
|
:showSearchTableQueryFields="showSearchTableQueryFields" |
|
|
|
@searchTableSuccess="searchTableSuccess1" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { SearchTable } from '@/components/SearchTable' |
|
|
@ -151,6 +164,7 @@ import TableForm from '@/components/TableForm/src/TableForm.vue' |
|
|
|
import TableFormCountPlan from '@/components/TableFormCountPlan/src/TableFormCountPlan.vue' |
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
import { debounce } from 'lodash-es' |
|
|
|
import { tableFormBlurVer, FormBlur, getListByBottonInput } from '@/api/wms/business/inputBlur' |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
// 显示窗口宽度设置 |
|
|
@ -166,7 +180,7 @@ const props = defineProps({ |
|
|
|
// 是否显示删除按钮--多选 |
|
|
|
isShowReduceButtonSelection: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 是否显示tableForm 删除按钮 |
|
|
|
isShowReduceButton: { |
|
|
@ -418,17 +432,24 @@ const opensearchTable = ( |
|
|
|
: '' |
|
|
|
// 是否含有空参数情况 |
|
|
|
let isNull = false |
|
|
|
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) { |
|
|
|
if ( |
|
|
|
_searchCondition[searchCondition[i].key] == '' || |
|
|
|
_searchCondition[searchCondition[i].key] == undefined |
|
|
|
) { |
|
|
|
isNull = true |
|
|
|
} |
|
|
|
if (isNull) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} else if (searchCondition[i].isTableRowValue) { |
|
|
|
if (searchCondition[i].required) { |
|
|
|
if (row[searchCondition[i].value] == '' || row[searchCondition[i].value] == undefined) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -441,8 +462,13 @@ const opensearchTable = ( |
|
|
|
if (searchCondition[i].isFormModel) { |
|
|
|
//用formModel中的值 |
|
|
|
if (searchCondition[i].required) { |
|
|
|
if (formRef.value.formModel[searchCondition[i].value] == '' ||formRef.value.formModel[searchCondition[i].value] == undefined) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
if ( |
|
|
|
formRef.value.formModel[searchCondition[i].value] == '' || |
|
|
|
formRef.value.formModel[searchCondition[i].value] == undefined |
|
|
|
) { |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -458,7 +484,6 @@ const opensearchTable = ( |
|
|
|
value: searchCondition[i].value |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
|
|
|
} |
|
|
@ -510,7 +535,9 @@ const opensearchTable1 = ( |
|
|
|
// searchCondition.forEach((item) => { |
|
|
|
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
|
|
|
if (searchCondition[i].isMainValue) { |
|
|
|
_searchCondition[searchCondition[i].key] = formRef1.value.formModel[searchCondition[i].value] |
|
|
|
_searchCondition[searchCondition[i].key] = formRef1.value.formModel[ |
|
|
|
searchCondition[i].value |
|
|
|
] |
|
|
|
? formRef1.value.formModel[searchCondition[i].value] |
|
|
|
: props.detailData |
|
|
|
? props.detailData[searchCondition[i].value] |
|
|
@ -519,17 +546,24 @@ const opensearchTable1 = ( |
|
|
|
: '' |
|
|
|
// 是否含有空参数情况 |
|
|
|
let isNull = false |
|
|
|
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) { |
|
|
|
if ( |
|
|
|
_searchCondition[searchCondition[i].key] == '' || |
|
|
|
_searchCondition[searchCondition[i].key] == undefined |
|
|
|
) { |
|
|
|
isNull = true |
|
|
|
} |
|
|
|
if (isNull) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} else if (searchCondition[i].isTableRowValue) { |
|
|
|
if (searchCondition[i].required) { |
|
|
|
if (row[searchCondition[i].value] == '' || row[searchCondition[i].value] == undefined) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -542,8 +576,13 @@ const opensearchTable1 = ( |
|
|
|
if (searchCondition[i].isFormModel) { |
|
|
|
//用formModel中的值 |
|
|
|
if (searchCondition[i].required) { |
|
|
|
if (formRef1.value.formModel[searchCondition[i].value] == '' ||formRef1.value.formModel[searchCondition[i].value] == undefined) { |
|
|
|
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|
|
|
if ( |
|
|
|
formRef1.value.formModel[searchCondition[i].value] == '' || |
|
|
|
formRef1.value.formModel[searchCondition[i].value] == undefined |
|
|
|
) { |
|
|
|
message.warning( |
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -559,7 +598,6 @@ const opensearchTable1 = ( |
|
|
|
value: searchCondition[i].value |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
|
|
|
} |
|
|
@ -602,30 +640,40 @@ const clearSearchInput = (field)=>{ |
|
|
|
const sumFormDataByTable = () => { |
|
|
|
if (props.sumFormDataField) { |
|
|
|
const sumObject = {} |
|
|
|
props.sumFormDataField.forEach(sumItem=>{ |
|
|
|
sumObject[sumItem?.formField]= props.tableData.reduce((prev, item) => prev + item[sumItem?.tableField],0) |
|
|
|
props.sumFormDataField.forEach((sumItem) => { |
|
|
|
sumObject[sumItem?.formField] = props.tableData.reduce( |
|
|
|
(prev, item) => prev + item[sumItem?.tableField], |
|
|
|
0 |
|
|
|
) |
|
|
|
}) |
|
|
|
nextTick(() => { |
|
|
|
formRef.value.setValues(sumObject) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
watch(()=>props.tableData,() => { |
|
|
|
watch( |
|
|
|
() => props.tableData, |
|
|
|
() => { |
|
|
|
sumFormDataByTable() |
|
|
|
if (props?.sumFormDataByTableCustom && unref(formRef)?.formModel && props.tableData) { |
|
|
|
props?.sumFormDataByTableCustom(formRef, unref(formRef)?.formModel, props.tableData) |
|
|
|
} |
|
|
|
|
|
|
|
},{ |
|
|
|
}, |
|
|
|
{ |
|
|
|
deep: true |
|
|
|
}) |
|
|
|
watch(()=>unref(formRef)?.formModel,() => { |
|
|
|
} |
|
|
|
) |
|
|
|
watch( |
|
|
|
() => unref(formRef)?.formModel, |
|
|
|
() => { |
|
|
|
if (props?.sumFormDataByForm && unref(formRef)?.formModel) { |
|
|
|
props?.sumFormDataByForm(formRef, unref(formRef)?.formModel) |
|
|
|
} |
|
|
|
},{ |
|
|
|
}, |
|
|
|
{ |
|
|
|
deep: true |
|
|
|
}) |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
// 弹层确定返回所选数据 |
|
|
|
// val : 弹层列表row 数据 |
|
|
@ -636,7 +684,13 @@ const searchTableSuccess1 = (formField, searchField, val, type, row) => { |
|
|
|
emit('searchTableSuccess', formField, searchField, val, formRef1.value, type, row) |
|
|
|
} |
|
|
|
/** 打开弹窗 */ |
|
|
|
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any, alltitleName?: any) => { |
|
|
|
const open = async ( |
|
|
|
type: string, |
|
|
|
row?: any, |
|
|
|
masterParmas?: any, |
|
|
|
titleName?: any, |
|
|
|
alltitleName?: any |
|
|
|
) => { |
|
|
|
dialogVisible.value = true |
|
|
|
if (alltitleName) { |
|
|
|
dialogTitle.value = alltitleName |
|
|
@ -680,16 +734,19 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any |
|
|
|
const handleAddTable = () => { |
|
|
|
if (props.isOpenSearchTable) { |
|
|
|
const tableFormKeys = {} |
|
|
|
tableAllSchemas.value.tableFormColumns.forEach(item => { |
|
|
|
tableAllSchemas.value.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
if (props.fieldTableColumn != '') { |
|
|
|
inpuFocus(tableAllSchemas.value.tableFormColumns.find(item=>item.field==props.fieldTableColumn),tableFormKeys,0) |
|
|
|
inpuFocus( |
|
|
|
tableAllSchemas.value.tableFormColumns.find((item) => item.field == props.fieldTableColumn), |
|
|
|
tableFormKeys, |
|
|
|
0 |
|
|
|
) |
|
|
|
} |
|
|
|
} else { |
|
|
|
emit('handleAddTable') |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** 弹窗按钮 */ |
|
|
@ -861,10 +918,9 @@ const inputFocusPlan = (row)=>{ |
|
|
|
emit('inputFocusPlan', row) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 输入框聚焦 |
|
|
|
const inpuFocus = (headerItem, row) => { |
|
|
|
console.log(headerItem, row) |
|
|
|
console.log(233, headerItem, row) |
|
|
|
emit('inpuFocus', headerItem, row) |
|
|
|
|
|
|
|
opensearchTable( |
|
|
@ -892,15 +948,88 @@ const clearInput = (field, row, index) => { |
|
|
|
const onChange = (field, cur) => { |
|
|
|
emit('onChange', field, cur, formRef) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 监听失焦事件 |
|
|
|
* @param field 当前操作字段 |
|
|
|
* @param e |
|
|
|
*/ |
|
|
|
const onBlur = (field, e) => { |
|
|
|
const count = ref(0) |
|
|
|
const onBlur = async (field, e) => { |
|
|
|
let formSchemaObj = CountPlanMain1FormAllSchemas.value.find((item) => item.field == field)?.componentProps |
|
|
|
if (formSchemaObj?.enterSearch) { |
|
|
|
await FormBlur(field, e, null, formRef1.value, props.detailData, formSchemaObj, (list) => { |
|
|
|
emit('searchTableSuccess', field, formSchemaObj.searchField, list, formRef.value, 'form') |
|
|
|
}) |
|
|
|
|
|
|
|
if (props.isShowFooterButtton && !props.footButttondata) { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
count.value++ |
|
|
|
} |
|
|
|
} else { |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const inputStringBlur = async (headerItem, val, row, index) => { |
|
|
|
headerItem.tableForm.searchPage = row?.searchTable?.searchPage |
|
|
|
await tableFormBlurVer( |
|
|
|
headerItem, |
|
|
|
val, |
|
|
|
row, |
|
|
|
index, |
|
|
|
null, |
|
|
|
formRef.value, |
|
|
|
props.detailData, |
|
|
|
props.tableData, |
|
|
|
(list) => { |
|
|
|
emit( |
|
|
|
'searchTableSuccess', |
|
|
|
headerItem.field, |
|
|
|
headerItem.tableForm.searchField, |
|
|
|
list, |
|
|
|
formRef.value, |
|
|
|
'tableForm', |
|
|
|
row, |
|
|
|
'blur', |
|
|
|
index |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
if (props.isShowFooterButtton && !props.footButttondata) { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
count.value++ |
|
|
|
} |
|
|
|
} |
|
|
|
// 聚焦 |
|
|
|
const onFocus = (field) => { |
|
|
|
let formSchemaObj = CountPlanMain1FormAllSchemas.value.find((item) => item.field == field)?.componentProps |
|
|
|
if (formSchemaObj?.enterSearch) { |
|
|
|
if (props.isShowFooterButtton && !props.footButttondata) { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn({ disabled: true }), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
} |
|
|
|
count.value++ |
|
|
|
} |
|
|
|
} |
|
|
|
const inputStringFcous = (headerItem) => { |
|
|
|
if (headerItem?.tableForm?.searchPage && headerItem?.tableForm?.verificationParams) { |
|
|
|
if (props.isShowFooterButtton && !props.footButttondata) { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn({ disabled: true }), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
} |
|
|
|
count.value++ |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
* 回车事件 |
|
|
|
* @param field 当前操作字段 |
|
|
@ -920,20 +1049,23 @@ const selectChangeDetail = (field, val,formSchema) => { |
|
|
|
emit('selectChangeDetail', field, val) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const tableFormChange = (field, val, row) => { |
|
|
|
emit('tableFormChange', field, val, row) |
|
|
|
} |
|
|
|
|
|
|
|
const buttonOperationClick = (row, label, index) => { |
|
|
|
emit("buttonOperationClick", row, label, index); |
|
|
|
} |
|
|
|
|
|
|
|
const inputStringBlur = (headerItem, row, index)=> { |
|
|
|
emit("inputStringBlur", headerItem, row, index); |
|
|
|
emit('buttonOperationClick', row, label, index) |
|
|
|
} |
|
|
|
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth}) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
defineExpose({ |
|
|
|
open, |
|
|
|
formRef, |
|
|
|
opensearchTable, |
|
|
|
dialogVisible, |
|
|
|
formLoading, |
|
|
|
handleAddTable, |
|
|
|
changeDialogWidth |
|
|
|
}) // 提供 open 方法,用于打开弹窗 |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.table { |
|
|
@ -962,8 +1094,8 @@ defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handl |
|
|
|
|
|
|
|
::v-deep(.el-icon) { |
|
|
|
display: block; |
|
|
|
}button |
|
|
|
.button { |
|
|
|
} |
|
|
|
button .button { |
|
|
|
> div { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|