|
|
@ -142,6 +142,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 { tableFormBlurVer,FormBlur,getListByBottonInput } from '@/api/wms/business/business' |
|
|
|
import { isString } from 'min-dash' |
|
|
|
const props = defineProps({ |
|
|
|
// 显示窗口宽度设置 |
|
|
|
basicFormWidth: { |
|
|
@ -324,7 +325,17 @@ const props = defineProps({ |
|
|
|
type: Array, |
|
|
|
required: false, |
|
|
|
default: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
byCodespageApi: { |
|
|
|
type: Function, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
}, //输入框校验是否正确的方法 |
|
|
|
byCodesParams: { |
|
|
|
type: Object, |
|
|
|
required: true, |
|
|
|
default: null |
|
|
|
} //输入框校验是否正确的参数 |
|
|
|
}) |
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
@ -783,15 +794,135 @@ const onChange = (field, cur) => { |
|
|
|
* @param field 当前操作字段 |
|
|
|
* @param e |
|
|
|
*/ |
|
|
|
const onBlur = async (field, e) => { |
|
|
|
const onBlur = async (field, e) => { |
|
|
|
isExecute.value = false |
|
|
|
await FormBlur(field, e,routeName.value,formRef.value,props.detailData,formSchema.value,(searchField, list)=>{ |
|
|
|
emit('searchTableSuccess', field, searchField, list, formRef.value, 'form') |
|
|
|
}) |
|
|
|
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) { |
|
|
|
if (e && isString(e)) { |
|
|
|
let setV = {} |
|
|
|
setV[field] = '' |
|
|
|
let obj = {} |
|
|
|
console.log(233,searchCondition1) |
|
|
|
// 循环参数设置参数为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] |
|
|
|
? 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) { |
|
|
|
isNull = true |
|
|
|
} |
|
|
|
if (isNull) { |
|
|
|
message.warning( |
|
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 扩展 转换为筛选条件进行查询 |
|
|
|
if (searchCondition1[i].isSearch) { |
|
|
|
if (searchCondition1[i].isFormModel) { |
|
|
|
//用formModel中的值 |
|
|
|
if (searchCondition1[i].required) { |
|
|
|
if ( |
|
|
|
formRef.value.formModel[searchCondition1[i].value] == '' || |
|
|
|
formRef.value.formModel[searchCondition1[i].value] == undefined |
|
|
|
) { |
|
|
|
message.warning( |
|
|
|
searchCondition1[i].message |
|
|
|
? searchCondition1[i].message |
|
|
|
: '前置条件未选择!' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
obj[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
} else { |
|
|
|
obj[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!formSchemaObj?.componentProps.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 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' |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
} |
|
|
|
isExecute.value = true |
|
|
|
emit('onBlur', field, e) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 批量增加 |
|
|
|
const batchAdd = async (val) => { |
|
|
|
const row = {} |
|
|
|