|
|
@ -7,131 +7,136 @@ |
|
|
|
:vLoading="formLoading" |
|
|
|
@updateFullscreen="updateFullscreen" |
|
|
|
> |
|
|
|
|
|
|
|
<div |
|
|
|
style="overflow-y: auto;" :style="{'max-height':formHeight}"> |
|
|
|
<Form |
|
|
|
ref="formRef" |
|
|
|
:rules="rules" |
|
|
|
:schema="formSchema" |
|
|
|
:is-col="true" |
|
|
|
@opensearchTable="opensearchTable" |
|
|
|
@hiddenFilterButton="hiddenSearchTableFilterButton" |
|
|
|
@changeDialogWidth="changeDialogWidth" |
|
|
|
@clearSearchInput="clearSearchInput" |
|
|
|
@onChange="onChange" |
|
|
|
@onBlur="onBlur" |
|
|
|
@onEnter="onEnter" |
|
|
|
> |
|
|
|
<template #crontab="formSchema1" v-if="fromeWhere == 'countPlan'"> |
|
|
|
|
|
|
|
<crontab v-model="formSchema1.crontab" :disabled="formSchema?.find(item=>item.field == 'crontab')?.componentProps?.disabled "/> |
|
|
|
</template> |
|
|
|
<template #type="formSchema" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.type" |
|
|
|
placeholder="选择盘点类型" |
|
|
|
@change="selectChange('type', $event)" |
|
|
|
v-if="!isDetail" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_TYPE)" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.type" |
|
|
|
placeholder="选择盘点范围类型" |
|
|
|
@change="selectChangeDetail('type', $event,formSchema)" |
|
|
|
v-if="isDetail" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_SCOPE_TYPE)" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
<template #value="formSchema" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.value" |
|
|
|
placeholder="选择盘点范围值" |
|
|
|
multiple |
|
|
|
v-if="isDetail&& formTypeDetail =='Select'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in countPlanAllList" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
<div style="overflow-y: auto" :style="{ 'max-height': formHeight }"> |
|
|
|
<Form |
|
|
|
ref="formRef" |
|
|
|
:rules="rules" |
|
|
|
:schema="formSchema" |
|
|
|
:is-col="true" |
|
|
|
@opensearchTable="opensearchTable" |
|
|
|
@hiddenFilterButton="hiddenSearchTableFilterButton" |
|
|
|
@changeDialogWidth="changeDialogWidth" |
|
|
|
@clearSearchInput="clearSearchInput" |
|
|
|
@onChange="onChange" |
|
|
|
@onBlur="onBlur" |
|
|
|
@onEnter="onEnter" |
|
|
|
> |
|
|
|
<template #crontab="formSchema1" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<crontab |
|
|
|
v-model="formSchema1.crontab" |
|
|
|
:disabled=" |
|
|
|
formSchema?.find((item) => item.field == 'crontab')?.componentProps?.disabled |
|
|
|
" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail =='InputString'"/> |
|
|
|
</template> |
|
|
|
</Form> |
|
|
|
<div class="table" v-if="isBusiness && formType == 'create' && fromeWhere != 'countPlan'"> |
|
|
|
<TableForm |
|
|
|
ref="tableFormRef" |
|
|
|
class="w-[100%]" |
|
|
|
:maxHeight = "490" |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" |
|
|
|
:tableData="tableData" |
|
|
|
:tableFormRules="tableFormRules" |
|
|
|
:isShowButton="isShowButton" |
|
|
|
:isShowReduceButton="isShowReduceButton" |
|
|
|
:isShowReduceButtonSelection="isShowReduceButtonSelection" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@tableSelectionChange="tableSelectionChange" |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@extendedButtonsClick="extendedButtonsClick" |
|
|
|
@formSelectChange="formSelectChange" |
|
|
|
@formSelectvVisibleChange="formSelectvVisibleChange" |
|
|
|
@tableSortChange="tableSortChange" |
|
|
|
@selectCallback="selectCallback" |
|
|
|
@handleTableSelect="handleTableSelect" |
|
|
|
@inpuFocus="inpuFocus" |
|
|
|
@buttonOperationClick="buttonOperationClick" |
|
|
|
@inputStringBlur="inputStringBlur" |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@tableFormSelectOnBlur="tableFormSelectOnBlur" |
|
|
|
@formFormDateChange="formFormDateChange" |
|
|
|
@clearInput='clearInput' |
|
|
|
</template> |
|
|
|
<template #type="formSchema" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.type" |
|
|
|
placeholder="选择盘点类型" |
|
|
|
@change="selectChange('type', $event)" |
|
|
|
v-if="!isDetail" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_TYPE)" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.type" |
|
|
|
placeholder="选择盘点范围类型" |
|
|
|
@change="selectChangeDetail('type', $event, formSchema)" |
|
|
|
v-if="isDetail" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_SCOPE_TYPE)" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
<template #value="formSchema" v-if="fromeWhere == 'countPlan'"> |
|
|
|
<el-select |
|
|
|
v-model="formSchema.value" |
|
|
|
placeholder="选择盘点范围值" |
|
|
|
multiple |
|
|
|
v-if="isDetail && formTypeDetail == 'Select'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="dict in countPlanAllList" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail == 'InputString'" /> |
|
|
|
</template> |
|
|
|
</Form> |
|
|
|
<div class="table" v-if="isBusiness && formType == 'create' && fromeWhere != 'countPlan'"> |
|
|
|
<TableForm |
|
|
|
ref="tableFormRef" |
|
|
|
class="w-[100%]" |
|
|
|
:maxHeight="490" |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" |
|
|
|
:tableData="tableData" |
|
|
|
:tableFormRules="tableFormRules" |
|
|
|
:isShowButton="isShowButton" |
|
|
|
:isShowReduceButton="isShowReduceButton" |
|
|
|
:isShowReduceButtonSelection="isShowReduceButtonSelection" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@tableSelectionChange="tableSelectionChange" |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@extendedButtonsClick="extendedButtonsClick" |
|
|
|
@formSelectChange="formSelectChange" |
|
|
|
@formSelectvVisibleChange="formSelectvVisibleChange" |
|
|
|
@tableSortChange="tableSortChange" |
|
|
|
@selectCallback="selectCallback" |
|
|
|
@handleTableSelect="handleTableSelect" |
|
|
|
@inpuFocus="inpuFocus" |
|
|
|
@buttonOperationClick="buttonOperationClick" |
|
|
|
@inputStringBlur="inputStringBlur" |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@tableFormSelectOnBlur="tableFormSelectOnBlur" |
|
|
|
@formFormDateChange="formFormDateChange" |
|
|
|
@clearInput="clearInput" |
|
|
|
@batchAdd="batchAdd" |
|
|
|
:routeName="routeName" |
|
|
|
@visibleChange='visibleChange' |
|
|
|
> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<slot :row="row"></slot> |
|
|
|
</template> |
|
|
|
</TableForm> |
|
|
|
</div> |
|
|
|
<div v-if="isBusiness && formType == 'create' && fromeWhere == 'countPlan'"> |
|
|
|
<TableFormCountPlan |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" |
|
|
|
:tableData="tableData" |
|
|
|
:countScopeType="countScopeType" |
|
|
|
:tableFormRules="tableFormRules" |
|
|
|
ref="tableFormRef" |
|
|
|
@tableFormChange="tableFormChange" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
/> |
|
|
|
@visibleChange="visibleChange" |
|
|
|
> |
|
|
|
<template v-slot="{ row }"> |
|
|
|
<slot :row="row"></slot> |
|
|
|
</template> |
|
|
|
</TableForm> |
|
|
|
</div> |
|
|
|
<div v-if="isBusiness && formType == 'create' && fromeWhere == 'countPlan'"> |
|
|
|
<TableFormCountPlan |
|
|
|
:tableFields="tableAllSchemas.tableFormColumns" |
|
|
|
:tableData="tableData" |
|
|
|
:countScopeType="countScopeType" |
|
|
|
:tableFormRules="tableFormRules" |
|
|
|
ref="tableFormRef" |
|
|
|
@tableFormChange="tableFormChange" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template #footer > |
|
|
|
<template #footer> |
|
|
|
<slot name="foorter"></slot> |
|
|
|
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
</Dialog> |
|
|
|
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" > |
|
|
|
<SearchTable |
|
|
|
ref="searchTableRef" |
|
|
|
:showSearchTableQueryFields="showSearchTableQueryFields" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
> |
|
|
|
<template v-for="name in Object.keys($slots)" :key="name" #[name]> |
|
|
|
<slot :name="name"></slot> |
|
|
|
</template> |
|
|
|
<slot :name="name"></slot> |
|
|
|
</template> |
|
|
|
</SearchTable> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
@ -140,9 +145,10 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import ButtonBase from '@/components/XButton/src/ButtonBase.vue' |
|
|
|
import TableForm from '@/components/TableForm/src/TableForm.vue' |
|
|
|
import TableFormCountPlan from '@/components/TableFormCountPlan/src/TableFormCountPlan.vue' |
|
|
|
import {DICT_TYPE, getStrDictOptions} from '@/utils/dict' |
|
|
|
import { tableFormBlurVer,FormBlur,getListByBottonInput } from '@/api/wms/business/business' |
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
import { tableFormBlurVer, FormBlur, getListByBottonInput } from '@/api/wms/business/business' |
|
|
|
import { isString } from 'min-dash' |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
// 显示窗口宽度设置 |
|
|
|
basicFormWidth: { |
|
|
@ -155,9 +161,9 @@ const props = defineProps({ |
|
|
|
default: true |
|
|
|
}, |
|
|
|
// 是否显示删除按钮--多选 |
|
|
|
isShowReduceButtonSelection:{ |
|
|
|
isShowReduceButtonSelection: { |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
// 是否显示tableForm 删除按钮 |
|
|
|
isShowReduceButton: { |
|
|
@ -290,13 +296,13 @@ const props = defineProps({ |
|
|
|
default: null |
|
|
|
}, |
|
|
|
//是否直接展示搜索表单 |
|
|
|
isOpenSearchTable:{ |
|
|
|
isOpenSearchTable: { |
|
|
|
type: Boolean, |
|
|
|
required: false, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
|
|
|
|
fieldTableColumn:{ |
|
|
|
|
|
|
|
fieldTableColumn: { |
|
|
|
type: String, |
|
|
|
required: false, |
|
|
|
default: '' |
|
|
@ -306,36 +312,32 @@ const props = defineProps({ |
|
|
|
formField:form中对应的field, |
|
|
|
tableField:searchtable中对应的field, |
|
|
|
}]*/ |
|
|
|
sumFormDataField:{ |
|
|
|
sumFormDataField: { |
|
|
|
type: Array, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
sumFormDataByForm:{ |
|
|
|
type:Function, |
|
|
|
sumFormDataByForm: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
sumFormDataByTableCustom:{ |
|
|
|
type:Function, |
|
|
|
sumFormDataByTableCustom: { |
|
|
|
type: Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
showSearchTableQueryFields:{ |
|
|
|
showSearchTableQueryFields: { |
|
|
|
type: Array, |
|
|
|
required: false, |
|
|
|
default: [] |
|
|
|
}, |
|
|
|
byCodespageApi: { |
|
|
|
type: Function, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
}, //输入框校验是否正确的方法 |
|
|
|
byCodesParams: { |
|
|
|
type: Object, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
} //输入框校验是否正确的参数 |
|
|
|
// 失去焦点之后是否进行校验, |
|
|
|
isJiaoyan: { |
|
|
|
type: Boolean, |
|
|
|
required: false, |
|
|
|
default: false |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
@ -347,8 +349,8 @@ if (props.basicFormWidth) { |
|
|
|
dialogWidth.value = props.isBusiness ? '60%' : '40%' |
|
|
|
} |
|
|
|
const formHeight = ref('60vh') |
|
|
|
const updateFullscreen = (isFullscreen)=>{ |
|
|
|
formHeight.value = isFullscreen?'auto':'60vh' |
|
|
|
const updateFullscreen = (isFullscreen) => { |
|
|
|
formHeight.value = isFullscreen ? 'auto' : '60vh' |
|
|
|
} |
|
|
|
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
|
|
@ -363,7 +365,7 @@ const tableFormRules = ref(props.tableFormRules) |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref('') |
|
|
|
routeName.value = route.name |
|
|
|
const isExecute = ref(true)//如果走失去焦点的方法只有为true的时候才能进行保存 |
|
|
|
const isExecute = ref(true) //如果走失去焦点的方法只有为true的时候才能进行保存 |
|
|
|
|
|
|
|
// 列表-按钮 |
|
|
|
// const buttondata = [ |
|
|
@ -373,9 +375,9 @@ const isExecute = ref(true)//如果走失去焦点的方法只有为true的时 |
|
|
|
// // 列表-操作按钮事件 |
|
|
|
// const buttonTableClick = async (val, row) => { |
|
|
|
// if (val == 'edit') { |
|
|
|
|
|
|
|
|
|
|
|
// } else if (val == 'delete') { |
|
|
|
|
|
|
|
|
|
|
|
// } else { |
|
|
|
// } |
|
|
|
// } |
|
|
@ -396,7 +398,7 @@ const opensearchTable = ( |
|
|
|
multiple, |
|
|
|
type, |
|
|
|
row, |
|
|
|
isConcatDetailSchemas=false, |
|
|
|
isConcatDetailSchemas = false, |
|
|
|
searchDetailSchemas: any |
|
|
|
) => { |
|
|
|
const _searchCondition = {} |
|
|
@ -404,8 +406,8 @@ const opensearchTable = ( |
|
|
|
if (searchCondition && searchCondition.length > 0) { |
|
|
|
// 转换筛选条件所需 |
|
|
|
let filters: any[] = [] |
|
|
|
for (var i=0; i< searchCondition.length; i++ ) { |
|
|
|
// searchCondition.forEach((item) => { |
|
|
|
for (var i = 0; i < searchCondition.length; i++) { |
|
|
|
// searchCondition.forEach((item) => { |
|
|
|
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
|
|
|
if (searchCondition[i].isMainValue) { |
|
|
|
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value] |
|
|
@ -417,19 +419,26 @@ 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:'前置条件未选择!') |
|
|
|
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 : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
row[searchCondition[i].value] |
|
|
|
//查询当前table表数据的值 |
|
|
@ -439,10 +448,15 @@ const opensearchTable = ( |
|
|
|
if (searchCondition[i].isSearch) { |
|
|
|
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:'前置条件未选择!') |
|
|
|
return |
|
|
|
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 : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
filters.push({ |
|
|
@ -450,14 +464,13 @@ const opensearchTable = ( |
|
|
|
column: searchCondition[i].key, |
|
|
|
value: formRef.value.formModel[searchCondition[i].value] |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
filters.push({ |
|
|
|
action: searchCondition[i].action, |
|
|
|
column: searchCondition[i].key, |
|
|
|
value: searchCondition[i].value |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
|
|
|
} |
|
|
@ -488,50 +501,76 @@ const opensearchTable = ( |
|
|
|
} |
|
|
|
|
|
|
|
//修改 searchTable 弹窗宽度 |
|
|
|
const changeDialogWidth = (width)=>{ |
|
|
|
const changeDialogWidth = (width) => { |
|
|
|
searchTableRef.value.changeDialogWidth(width) |
|
|
|
} |
|
|
|
const hiddenSearchTableFilterButton = ()=>{ |
|
|
|
const hiddenSearchTableFilterButton = () => { |
|
|
|
searchTableRef.value.hiddenFilterButton() |
|
|
|
} |
|
|
|
const clearSearchInput = (field)=>{ |
|
|
|
emit('clearSearchInput',field) |
|
|
|
const clearSearchInput = (field) => { |
|
|
|
emit('clearSearchInput', field) |
|
|
|
} |
|
|
|
const sumFormDataByTable = () => { |
|
|
|
if(props.sumFormDataField){ |
|
|
|
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(()=>{ |
|
|
|
nextTick(() => { |
|
|
|
formRef.value.setValues(sumObject) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
watch(()=>props.tableData,() => { |
|
|
|
sumFormDataByTable() |
|
|
|
if(props?.sumFormDataByTableCustom&&unref(formRef)?.formModel&&props.tableData){ |
|
|
|
props?.sumFormDataByTableCustom(formRef,unref(formRef)?.formModel,props.tableData) |
|
|
|
watch( |
|
|
|
() => props.tableData, |
|
|
|
() => { |
|
|
|
sumFormDataByTable() |
|
|
|
if (props?.sumFormDataByTableCustom && unref(formRef)?.formModel && props.tableData) { |
|
|
|
props?.sumFormDataByTableCustom(formRef, unref(formRef)?.formModel, props.tableData) |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
deep: true |
|
|
|
} |
|
|
|
|
|
|
|
},{ |
|
|
|
deep:true |
|
|
|
}) |
|
|
|
) |
|
|
|
let originFormModel = {} |
|
|
|
const updateOriginFormModel = (data)=>{ |
|
|
|
const updateOriginFormModel = (data) => { |
|
|
|
originFormModel = JSON.parse(JSON.stringify(data)) |
|
|
|
} |
|
|
|
const sumFormDataHandle1 = ()=>{ |
|
|
|
emit('sumFormDataHandle',formRef,unref(formRef)?.formModel,props.tableData,formType.value,originFormModel,updateOriginFormModel) |
|
|
|
const sumFormDataHandle1 = () => { |
|
|
|
emit( |
|
|
|
'sumFormDataHandle', |
|
|
|
formRef, |
|
|
|
unref(formRef)?.formModel, |
|
|
|
props.tableData, |
|
|
|
formType.value, |
|
|
|
originFormModel, |
|
|
|
updateOriginFormModel |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
watch(()=>unref(formRef)?.formModel,async () => { |
|
|
|
if(props?.sumFormDataByForm&&unref(formRef)?.formModel){ |
|
|
|
props?.sumFormDataByForm(formRef,unref(formRef)?.formModel,props.tableData,formType.value,originFormModel,updateOriginFormModel,sumFormDataHandle1) |
|
|
|
watch( |
|
|
|
() => unref(formRef)?.formModel, |
|
|
|
async () => { |
|
|
|
if (props?.sumFormDataByForm && unref(formRef)?.formModel) { |
|
|
|
props?.sumFormDataByForm( |
|
|
|
formRef, |
|
|
|
unref(formRef)?.formModel, |
|
|
|
props.tableData, |
|
|
|
formType.value, |
|
|
|
originFormModel, |
|
|
|
updateOriginFormModel, |
|
|
|
sumFormDataHandle1 |
|
|
|
) |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
deep: true |
|
|
|
} |
|
|
|
},{ |
|
|
|
deep:true |
|
|
|
}) |
|
|
|
) |
|
|
|
|
|
|
|
// 弹层确定返回所选数据 |
|
|
|
// val : 弹层列表row 数据 |
|
|
@ -540,11 +579,17 @@ const searchTableSuccess = (formField, searchField, val, 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){ |
|
|
|
if (alltitleName) { |
|
|
|
dialogTitle.value = alltitleName |
|
|
|
}else if (titleName) { |
|
|
|
} else if (titleName) { |
|
|
|
dialogTitle.value = t('action.' + titleName) |
|
|
|
} else { |
|
|
|
dialogTitle.value = t('action.' + type) |
|
|
@ -574,22 +619,25 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any |
|
|
|
} |
|
|
|
// 添加数据 |
|
|
|
const handleAddTable = () => { |
|
|
|
if(props.isOpenSearchTable){ |
|
|
|
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) |
|
|
|
if (props.fieldTableColumn != '') { |
|
|
|
inpuFocus( |
|
|
|
tableAllSchemas.value.tableFormColumns.find((item) => item.field == props.fieldTableColumn), |
|
|
|
tableFormKeys, |
|
|
|
0 |
|
|
|
) |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
emit('handleAddTable') |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** 弹窗按钮 */ |
|
|
|
let Butttondata:any = [] |
|
|
|
let Butttondata: any = [] |
|
|
|
if (props.isShowFooterButtton) { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
@ -604,9 +652,9 @@ if (props.footButttondata) { |
|
|
|
const buttonBaseClick = (val) => { |
|
|
|
// 扩展 按钮事件回调 |
|
|
|
if (props.footButttondata) { |
|
|
|
emit('footButtonClick',val) |
|
|
|
} |
|
|
|
// 保存 |
|
|
|
emit('footButtonClick', val) |
|
|
|
} |
|
|
|
// 保存 |
|
|
|
else if (val == 'save') { |
|
|
|
submitForm() |
|
|
|
} |
|
|
@ -708,15 +756,15 @@ const emit = defineEmits([ |
|
|
|
'visibleChange' |
|
|
|
]) |
|
|
|
const visibleChange = (field, val, row, index) => { |
|
|
|
emit('visibleChange',field, val, row, index) |
|
|
|
emit('visibleChange', field, val, row, index) |
|
|
|
} |
|
|
|
//普通下拉改变事件 |
|
|
|
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 formSelectvVisibleChange = (field, val, row) => { |
|
|
|
emit('formSelectvVisibleChange', field, val, row) |
|
|
@ -753,14 +801,11 @@ const handleTableSelect = (row, column, event) => { |
|
|
|
|
|
|
|
// 删除数据 |
|
|
|
const handleDeleteTable = (row, index) => { |
|
|
|
emit('handleDeleteTable', row, index,formRef.value) |
|
|
|
emit('handleDeleteTable', row, index, formRef.value) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输入框聚焦 |
|
|
|
const inpuFocus = (headerItem, row, index) => { |
|
|
|
|
|
|
|
emit('inpuFocus', headerItem, row, index) |
|
|
|
|
|
|
|
opensearchTable( |
|
|
@ -778,7 +823,7 @@ const inpuFocus = (headerItem, row, index) => { |
|
|
|
) |
|
|
|
} |
|
|
|
const clearInput = (field, row, index) => { |
|
|
|
emit('clearInput',field, row, index) |
|
|
|
emit('clearInput', field, row, index) |
|
|
|
} |
|
|
|
/** |
|
|
|
* 监听改变事件 |
|
|
@ -796,48 +841,31 @@ const onChange = (field, cur) => { |
|
|
|
*/ |
|
|
|
const onBlur = async (field, e) => { |
|
|
|
isExecute.value = false |
|
|
|
if ( |
|
|
|
field == 'supplierCode' || |
|
|
|
field == 'itemCode' || |
|
|
|
field == 'productItemCode' || |
|
|
|
field == 'componentItemCode' || |
|
|
|
field == 'packUnit' || |
|
|
|
field == 'inPackUnit' || |
|
|
|
field == 'fromPackingNumber' |
|
|
|
) { |
|
|
|
await FormBlur( |
|
|
|
field, |
|
|
|
e, |
|
|
|
routeName.value, |
|
|
|
formRef.value, |
|
|
|
props.detailData, |
|
|
|
formSchema.value, |
|
|
|
(searchField, list) => { |
|
|
|
emit('searchTableSuccess', field, searchField, list, formRef.value, 'form') |
|
|
|
} |
|
|
|
) |
|
|
|
} else { |
|
|
|
let formSchemaObj = formSchema.value.find((item) => item.field == field) |
|
|
|
let searchCondition1 = formSchema.value.find((item) => item.field == field).componentProps |
|
|
|
.searchCondition //获取data.ts参数信息 |
|
|
|
if (formSchemaObj?.componentProps?.enterSearch) { |
|
|
|
|
|
|
|
let formSchemaObj = formSchema.value.find((item) => item.field == field)?.componentProps |
|
|
|
if (formSchemaObj?.enterSearch) { |
|
|
|
if (formSchemaObj.verificationPage) { |
|
|
|
let searchCondition1 = formSchema.value.find((item) => item.field == field).componentProps |
|
|
|
.searchCondition //获取data.ts参数信息 |
|
|
|
let verificationParams = formSchema.value.find((item) => item.field == field).componentProps |
|
|
|
.verificationParams //获取失去焦点参数信息 |
|
|
|
console.log('走新方法啦') |
|
|
|
if (e && isString(e)) { |
|
|
|
let setV = {} |
|
|
|
setV[field] = '' |
|
|
|
let obj = {} |
|
|
|
console.log(233,searchCondition1) |
|
|
|
let params = {} |
|
|
|
// 循环参数设置参数为key:value格式 |
|
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
|
if (searchCondition1[i].isMainValue) { |
|
|
|
obj[searchCondition1[i].key] = formRef.value.formModel[searchCondition1[i].value] |
|
|
|
params[searchCondition1[i].key] = formRef.value.formModel[searchCondition1[i].value] |
|
|
|
? formRef.value.formModel[searchCondition1[i].value] |
|
|
|
: props.detailData |
|
|
|
? props.detailData[searchCondition1[i].value] |
|
|
|
: '' |
|
|
|
// 是否含有空参数情况 |
|
|
|
let isNull = false |
|
|
|
if (obj[searchCondition1[i].key] == '' || obj[searchCondition1[i].key] == undefined) { |
|
|
|
if (params[searchCondition1[i].key] == '' || params[searchCondition1[i].key] == undefined) { |
|
|
|
isNull = true |
|
|
|
} |
|
|
|
if (isNull) { |
|
|
@ -865,120 +893,188 @@ console.log(233,searchCondition1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
obj[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
} else { |
|
|
|
obj[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
params[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!formSchemaObj?.componentProps.multiple && e.indexOf(',') > -1) { |
|
|
|
// 循环参数设置参数为key:value格式 |
|
|
|
if (verificationParams && verificationParams.length > 0) { |
|
|
|
for (let i = 0; i < verificationParams.length; i++) { |
|
|
|
params[verificationParams[i].key] = e?.trim() |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(333,params) |
|
|
|
if (!formSchemaObj?.multiple && e.indexOf(',') > -1) { |
|
|
|
message.alert('该输入框只能输入一条数据') |
|
|
|
formRef.value.setValues(setV) |
|
|
|
return |
|
|
|
} |
|
|
|
if (props.byCodespageApi) { |
|
|
|
let params = {} |
|
|
|
if (props.byCodesParams) { |
|
|
|
params = { ...props.byCodesParams, ...obj, codes: e } |
|
|
|
} else { |
|
|
|
params = { ...obj, codes: e } |
|
|
|
await formSchemaObj.verificationPage(params).then((res) => { |
|
|
|
let arr1 = e.split(',') |
|
|
|
let list = ref([]) |
|
|
|
list.value = res |
|
|
|
console.log(222, list.value) |
|
|
|
if (list.value?.length == 0) { |
|
|
|
message.alert('暂无数据') |
|
|
|
formRef.value.setValues(setV) |
|
|
|
return |
|
|
|
} |
|
|
|
await props.byCodespageApi(params).then((res) => { |
|
|
|
let arr1 = e.split(',') |
|
|
|
let list = ref([]) |
|
|
|
list.value = res |
|
|
|
if (list.value?.length == 0) { |
|
|
|
message.alert('暂无数据') |
|
|
|
formRef.value.setValues(setV) |
|
|
|
return |
|
|
|
} |
|
|
|
if (arr1.length != list.value.length) { |
|
|
|
let arr2 = list.value.map((item) => item.code) |
|
|
|
let str = [ |
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
].join(',') |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
formRef.value.setValues(setV) |
|
|
|
return |
|
|
|
} |
|
|
|
emit( |
|
|
|
'searchTableSuccess', |
|
|
|
field, |
|
|
|
searchCondition1.searchField, |
|
|
|
list, |
|
|
|
formRef.value, |
|
|
|
'form' |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
if (arr1.length != list.value.length) { |
|
|
|
let arr2 = list.value.map((item) => item.code) |
|
|
|
let str = [ |
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
].join(',') |
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
formRef.value.setValues(setV) |
|
|
|
return |
|
|
|
} |
|
|
|
// emit('searchTableSuccess', formField, searchField, list.value, formRef.value, 'form') |
|
|
|
// callback(list.value) |
|
|
|
}) |
|
|
|
// emit( |
|
|
|
// 'onBlur', |
|
|
|
// field, |
|
|
|
// e, |
|
|
|
// formSchemaObj.componentProps.searchField, |
|
|
|
// formSchemaObj, |
|
|
|
// formRef.value, |
|
|
|
// 'form', |
|
|
|
// obj |
|
|
|
// ) |
|
|
|
} |
|
|
|
} else { |
|
|
|
emit('onBlur', field, e) |
|
|
|
if ( |
|
|
|
field == 'supplierCode' || |
|
|
|
field == 'itemCode' || |
|
|
|
field == 'productItemCode' || |
|
|
|
field == 'componentItemCode' || |
|
|
|
field == 'packUnit' || |
|
|
|
field == 'inPackUnit' || |
|
|
|
field == 'fromPackingNumber' |
|
|
|
) { |
|
|
|
await FormBlur( |
|
|
|
field, |
|
|
|
e, |
|
|
|
routeName.value, |
|
|
|
formRef.value, |
|
|
|
props.detailData, |
|
|
|
formSchema.value, |
|
|
|
(searchField, list) => { |
|
|
|
emit('searchTableSuccess', field, searchField, list, formRef.value, 'form') |
|
|
|
} |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
isExecute.value = true |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 批量增加 |
|
|
|
const batchAdd = async (val) => { |
|
|
|
const row = {} |
|
|
|
tableAllSchemas.value.tableFormColumns.forEach((item) => { |
|
|
|
row[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const headerItem = tableAllSchemas.value.tableColumns.find((item) => item.field == props.fieldTableColumn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await getListByBottonInput(headerItem, val,row,routeName.value,formRef.value,props.detailData,props.tableData,(list)=>{ |
|
|
|
emit('searchTableSuccess',headerItem.field,'itemCode',list, formRef.value,'tableForm',row) |
|
|
|
tableAllSchemas.value.tableFormColumns.forEach((item) => { |
|
|
|
row[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const headerItem = tableAllSchemas.value.tableColumns.find( |
|
|
|
(item) => item.field == props.fieldTableColumn |
|
|
|
) |
|
|
|
|
|
|
|
await getListByBottonInput( |
|
|
|
headerItem, |
|
|
|
val, |
|
|
|
row, |
|
|
|
routeName.value, |
|
|
|
formRef.value, |
|
|
|
props.detailData, |
|
|
|
props.tableData, |
|
|
|
(list) => { |
|
|
|
emit( |
|
|
|
'searchTableSuccess', |
|
|
|
headerItem.field, |
|
|
|
'itemCode', |
|
|
|
list, |
|
|
|
formRef.value, |
|
|
|
'tableForm', |
|
|
|
row |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const inputStringBlur = async (headerItem, val, row, index) => { |
|
|
|
// isExecute.value = false |
|
|
|
await tableFormBlurVer(headerItem,val,row,index,routeName.value,formRef.value,props.detailData,props.tableData,(searchField, list)=>{ |
|
|
|
emit('searchTableSuccess',headerItem.field,searchField,list, formRef.value,'tableForm',row,'blur',index) |
|
|
|
}) |
|
|
|
|
|
|
|
await tableFormBlurVer( |
|
|
|
headerItem, |
|
|
|
val, |
|
|
|
row, |
|
|
|
index, |
|
|
|
routeName.value, |
|
|
|
formRef.value, |
|
|
|
props.detailData, |
|
|
|
props.tableData, |
|
|
|
(searchField, list) => { |
|
|
|
emit( |
|
|
|
'searchTableSuccess', |
|
|
|
headerItem.field, |
|
|
|
searchField, |
|
|
|
list, |
|
|
|
formRef.value, |
|
|
|
'tableForm', |
|
|
|
row, |
|
|
|
'blur', |
|
|
|
index |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
// isExecute.value = true |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 回车事件 |
|
|
|
* @param field 当前操作字段 |
|
|
|
* @param e |
|
|
|
* @param e |
|
|
|
*/ |
|
|
|
const onEnter = (field,value, e) => { |
|
|
|
emit('onEnter', field,value, e) |
|
|
|
} |
|
|
|
const onEnter = (field, value, e) => { |
|
|
|
emit('onEnter', field, value, e) |
|
|
|
} |
|
|
|
|
|
|
|
// 修改盘点类型 |
|
|
|
const selectChange = (field, val) => { |
|
|
|
emit('selectChange', field, val) |
|
|
|
} |
|
|
|
// 修改盘点范围类型 |
|
|
|
const selectChangeDetail = (field, val,formSchema) => { |
|
|
|
const selectChangeDetail = (field, val, formSchema) => { |
|
|
|
formSchema.value = '' |
|
|
|
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 buttonOperationClick = (row, label, index) => { |
|
|
|
emit('buttonOperationClick', row, label, index) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth,searchTableRef,tableFormRef}) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
defineExpose({ |
|
|
|
open, |
|
|
|
formRef, |
|
|
|
opensearchTable, |
|
|
|
dialogVisible, |
|
|
|
formLoading, |
|
|
|
handleAddTable, |
|
|
|
changeDialogWidth, |
|
|
|
searchTableRef, |
|
|
|
tableFormRef |
|
|
|
}) // 提供 open 方法,用于打开弹窗 |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.table { |
|
|
@ -1007,8 +1103,8 @@ defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handl |
|
|
|
|
|
|
|
::v-deep(.el-icon) { |
|
|
|
display: block; |
|
|
|
}button |
|
|
|
.button { |
|
|
|
} |
|
|
|
button .button { |
|
|
|
> div { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|