Browse Source

basicform组件修改

master
陈薪名 1 year ago
parent
commit
7586fe9254
  1. 56
      src/components/BasicForm/src/BasicForm.vue

56
src/components/BasicForm/src/BasicForm.vue

@ -1,99 +1,104 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="isBusiness?'60%':'40%'">
<Form ref="formRef" v-loading="formLoading" :rules="rules" :schema="formSchema" :is-col="true" >
<!-- <template #productItemCode="form">
<slot name="productItemCode" :param="form"></slot>
</template> -->
<template #itemCode="form">
<template #itemCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'itemCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['itemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('itemCode', 'code')" />
</div>
</template>
<template #productItemCode="form">
<template #productItemCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'productItemCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['productItemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('productItemCode', 'code')" />
</div>
</template>
<template #componentItemCode="form">
<template #componentItemCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'componentItemCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['componentItemCode']" :placeholder="'请选择物料代码'" @click="opensearchTable('componentItemCode', 'code')" />
</div>
</template>
<template #supplierCode="form">
<template #supplierCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'supplierCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['supplierCode']" :placeholder="'请选择供应商代码'" @click="opensearchTable('supplierCode', 'code')" />
</div>
</template>
<template #productionLineCode="form">
<template #productionLineCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'productionLineCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['productionLineCode']" :placeholder="'请选择生产线代码'" @click="opensearchTable('productionLineCode', 'code')" />
</div>
</template>
<template #fgLocationCode="form">
<template #fgLocationCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'fgLocationCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['fgLocationCode']" :placeholder="'请选择库位代码'" @click="opensearchTable('fgLocationCode', 'code')" />
</div>
</template>
<template #defaultWarehouseCode="form">
<template #defaultWarehouseCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'defaultWarehouseCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['defaultWarehouseCode']" :placeholder="'请选择仓库代码'" @click="opensearchTable('defaultWarehouseCode', 'code')" />
</div>
</template>
<template #defaultLocationCode="form">
<template #defaultLocationCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'defaultLocationCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['defaultLocationCode']" :placeholder="'请选择库位代码'" @click="opensearchTable('defaultLocationCode', 'code')" />
</div>
</template>
<template #customerCode="form">
<template #customerCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'customerCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['customerCode']" :placeholder="'请选择客户代码'" @click="opensearchTable('customerCode', 'code')" />
</div>
</template>
<template #warehouseCode="form">
<template #warehouseCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'warehouseCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['warehouseCode']" :placeholder="'请选择仓库代码'" @click="opensearchTable('warehouseCode', 'code')" />
</div>
</template>
<template #areaCode="form">
<template #areaCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'areaCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['areaCode']" :placeholder="'请选择库区代码'" @click="opensearchTable('areaCode', 'code')" />
</div>
</template>
<template #locationGroupCode="form">
<template #locationGroupCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'locationGroupCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['locationGroupCode']" :placeholder="'请选择库位组代码'" @click="opensearchTable('locationGroupCode', 'code')" />
</div>
</template>
<template #rawLocationCode="form">
<template #rawLocationCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'rawLocationCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['rawLocationCode']" :placeholder="'请选择库位代码'" @click="opensearchTable('rawLocationCode', 'code')" />
</div>
</template>
<template #workshopCode="form">
<template #workshopCode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'workshopCode'))">
<div class="w-[100%] flex">
<el-input v-model="form['workshopCode']" :placeholder="'请选择车间代码'" @click="opensearchTable('workshopCode', 'code')" />
</div>
</template>
<template #outAreaCodes="form">
<template #outAreaCodes="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'outAreaCodes'))">
<div class="w-[100%] flex">
<el-input v-model="form['outAreaCodes']" :placeholder="'请选择库区代码'" @click="opensearchTable('outAreaCodes', 'code')" />
</div>
</template>
<template #inAreaCodes="form">
<template #inAreaCodes="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'inAreaCodes'))">
<div class="w-[100%] flex">
<el-input v-model="form['inAreaCodes']" :placeholder="'请选择库区代码'" @click="opensearchTable('inAreaCodes', 'code')" />
</div>
</template>
<template #customercode="form">
<template #customercode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'customercode'))">
<div class="w-[100%] flex">
<el-input v-model="form['customercode']" :placeholder="'请选择客户代码'" @click="opensearchTable('customercode', 'code')" />
</div>
</template>
<template #itemcode="form">
<template #itemcode="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'itemcode'))">
<div class="w-[100%] flex">
<el-input v-model="form['itemcode']" :placeholder="'请选择物料代码'" @click="opensearchTable('itemcode', 'code')" />
</div>
</template>
<template #asnNumber="form" v-if="props.searchTableParams?.find((item:any) => (item.formField == 'asnNumber'))">
<div class="w-[100%] flex">
<el-input v-model="form['asnNumber']" :placeholder="'请选择发货单号'" @click="opensearchTable('asnNumber', 'asnNumber')" />
</div>
</template>
</Form>
<div class="table" v-if="isBusiness">
<TableForm ref="tableFormRef"
@ -221,8 +226,6 @@ const searchTableSuccess = (formField,searchField, val) => {
/** 打开弹窗 */
const open = async (type: string, row?: any) => {
console.log(props.tableAllSchemas);
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@ -273,7 +276,13 @@ const submitForm = async () => {
if (props.isBusiness) {
const validateForm = await tableFormRef.value.validateForm()
if (!validateForm) return;
if (!validateForm) {
if (props.tableData.length == 0) {
message.warning('请填写明细信息!')
return
}
return
}
}
//
@ -314,7 +323,8 @@ const emit = defineEmits([
'handleDeleteTable',
'handleAddTable',
'inpuFocus',
'searchTableSuccess'
'searchTableSuccess',
'opensearchTable'
])
//
const formSelectChange = (field, val) => {

Loading…
Cancel
Save