diff --git a/src/api/wms/purchaseclaimRequestMain/index.ts b/src/api/wms/purchaseclaimRequestMain/index.ts index 129e31f81..1d206c0b8 100644 --- a/src/api/wms/purchaseclaimRequestMain/index.ts +++ b/src/api/wms/purchaseclaimRequestMain/index.ts @@ -23,9 +23,14 @@ export interface PurchaseclaimRequestMainVO { // 查询采购索赔申请主列表 export const getPurchaseclaimRequestMainPage = async (params) => { - return await request.get({ url: `/wms/purchaseclaim-request-main/page`, params }) + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return request.post({ url: '/wms/purchaseclaim-request-main/senior', data }) + } else { + return await request.get({ url: `/wms/purchaseclaim-request-main/page`, params }) + } } - // 查询采购索赔申请主详情 export const getPurchaseclaimRequestMain = async (id: number) => { return await request.get({ url: `/wms/purchaseclaim-request-main/get?id=` + id }) diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index d2c794292..431c5a420 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -200,12 +200,12 @@ const props = defineProps({ required: true, default: null }, - // 主表id - masterId: { - type: String, - required: false, - default: null - }, + // // 主表参数 + // masterParmas: { + // type: Object, + // required: false, + // default: null + // }, }) const { t } = useI18n() // 国际化 @@ -219,6 +219,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formRef = ref() // 表单 Ref const formSchema = ref(props.formAllSchemas?.formSchema) + /** 弹层操作 */ // formField form表单中的字段 // searchField 查询列表中的字段 @@ -238,14 +239,22 @@ const searchTableSuccess = (formField,searchField, val, type, row) => { } /** 打开弹窗 */ -const open = async (type: string, row?: any) => { +const open = async (type: string, row?: any, masterParmas?: any) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type resetForm() // 修改时,设置数据 - if (row) { - console.log(row); + // 如果是从主表的详情页面进图添加子表,需要添加masterId,number参数 + if(masterParmas){ + if(!row){ + row = { + masterId: masterParmas.masterId, + number: masterParmas.number + } + } + } + if (row.id || row.masterId) { formLoading.value = true try { nextTick(() => { @@ -312,9 +321,10 @@ const submitForm = async () => { try { // const data = unref(formRef)?.formModel as ItempackagingApi.ItempackagingVO const data = unref(formRef)?.formModel - if(props.masterId){ - data.masterId = props.masterId - } + // if(props.masterParmas.masterId){ + // data.masterId = props.masterParmas.masterId + // data.number = props.masterParmas.number + // } if (formType.value === 'create') { await props.apiCreate(data) message.success(t('common.createSuccess')) diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index f2328035d..b3428cbec 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -56,7 +56,6 @@ :isBusiness="false" :apiUpdate="apiUpdate" :apiCreate="apiCreate" - :masterId="masterId" @searchTableSuccess="searchTableSuccess" /> @@ -72,6 +71,7 @@ import * as FileApi from '@/api/wms/file' import * as defaultButtons from '@/utils/disposition/defaultButtons' import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import TableHead from '@/components/TableHead/src/TableHead.vue' +import { number } from 'vue-types' defineOptions({ name: 'Detail' }) @@ -144,8 +144,13 @@ const props = defineProps({ required: false, default: null }, + // 回显字段 + Echo: { + type: Array, + required: false, + default: null + }, }) -console.log(props.detailAllSchemas); const isShowDrawer = ref(false) const detailLoading = ref(false) const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) @@ -177,7 +182,7 @@ const remarksData = reactive({ const changeRecordData = reactive({ changeRecordList: [] }) -const detailData = ref("")//详情数据 +const detailData = ref({})//详情数据 // 获取附件列表篇 const getFileList = async () => { detailLoading.value = true @@ -207,7 +212,10 @@ const change = (item, index) => { } -const masterId=ref('')//主表id +const masterParmas=ref({ + masterId:'',//主表id + number: '',//主表单据号 +})//主表所需的参数 /** 打开弹窗 */ const titleNameRef = ref() const titleValueRef = ref() @@ -221,9 +229,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: // 加载明细列表 if(!props.isBasic) { // 设置主表id - masterId.value = row.id + masterParmas.value.masterId = row.id + masterParmas.value.number = row.number tableObject.params = { - masterId: row.id + masterId: row.id, } getList() } @@ -310,7 +319,7 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const formRef = ref() const openForm = async (type: string, row?: number) => { - formRef.value.open(type, row) + formRef.value.open(type, row, masterParmas.value) } // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { @@ -319,22 +328,10 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => } else { const setV = {} setV[formField] = val[0][searchField] - setV['ppNumber'] = val[0]['ppNumber'] - setV['poLine'] = val[0]['poLine'] - setV['batch'] = val[0]['batch'] - setV['altBatch'] = val[0]['altBatch'] - setV['reason'] = val[0]['reason'] - setV['singlePrice'] = val[0]['singlePrice'] - setV['amount'] = val[0]['amount'] - setV['number'] = val[0]['number'] - setV['itemCode'] = val[0]['itemCode'] - setV['itemName'] = val[0]['itemName'] - setV['itemDesc1'] = val[0]['itemDesc1'] - setV['itemDesc2'] = val[0]['itemDesc2'] - setV['projectCode'] = val[0]['projectCode'] - setV['qty'] = val[0]['qty'] - setV['uom'] = val[0]['uom'] - setV['remark'] = val[0]['remark'] + console.log(formField); + props.Echo.forEach((item)=>{ + setV[item] = val[0][item] + }) formRef.setValues(setV) } }) diff --git a/src/utils/disposition/tableColumns.ts b/src/utils/disposition/tableColumns.ts index 8c5b77255..dbcbea95a 100644 --- a/src/utils/disposition/tableColumns.ts +++ b/src/utils/disposition/tableColumns.ts @@ -10844,6 +10844,15 @@ export const PurchaseclaimRequestDetail = useCrudSchemas(reactive( table: { width: 150 }, + form:{ + componentProps:{ + disabled:true, + } + }, + isTableForm:false, + // tableForm:{ + // disabled:true, + // } }, { label: '物品代码', @@ -10851,6 +10860,7 @@ export const PurchaseclaimRequestDetail = useCrudSchemas(reactive( table: { width: 150 }, + }, { label: '物品名称', diff --git a/src/views/wms/purchaseclaimRequestMain/index.vue b/src/views/wms/purchaseclaimRequestMain/index.vue index 6a4805321..66eac248c 100644 --- a/src/views/wms/purchaseclaimRequestMain/index.vue +++ b/src/views/wms/purchaseclaimRequestMain/index.vue @@ -12,6 +12,7 @@ @button-base-click="buttonBaseClick" :routeName="routeName" @updataTableColumns="updataTableColumns" + @searchFormClick="searchFormClick" /> @@ -63,6 +64,7 @@ :apiUpdate="PurchaseclaimRequestDetailApi.updatePurchaseclaimRequestDetail" :apiPage="PurchaseclaimRequestDetailApi.getPurchaseclaimRequestDetailPage" :apiDelete="PurchaseclaimRequestDetailApi.deletePurchaseclaimRequestDetail" + :Echo="Echo" /> @@ -133,6 +135,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => } }) } +// 子表新增的时候选择表格之后需要会显得字段 +const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] const exportLoading = ref(false) // 导出的加载中 @@ -147,8 +151,8 @@ const HeadButttondata = [ defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchaseclaim-request-main:create' }), // 新增 defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchaseclaim-request-main:import' }), // 导入 defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchaseclaim-request-main:export' }), // 导出 - // defaultButtons.defaultFilterBtn(), // 筛选 defaultButtons.defaultFreshBtn(null), // 刷新 + defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 // { // label: '自定义扩展按钮', @@ -315,6 +319,14 @@ const importTemplateData = reactive({ const importSuccess = () => { getList() } +// 筛选提交 +const searchFormClick = (searchData) => { + tableObject.params = { + isSearch: true, + filters: searchData.filters + } + getList() // 刷新当前列表 +} /** 初始化 **/ onMounted(async () => {