diff --git a/src/api/wms/stdcostprice/index.ts b/src/api/wms/stdcostprice/index.ts index b7e3be15a..3ec273f8e 100644 --- a/src/api/wms/stdcostprice/index.ts +++ b/src/api/wms/stdcostprice/index.ts @@ -56,3 +56,9 @@ export const exportStdcostprice = async (params) => { export const importTemplate = () => { return request.download({ url: '/wms/stdcostprice/get-import-template' }) } + + +// 查询标准成本价格单列表 +export const queryStdcostpriceByItemCode = async (data: StdcostpriceVO) => { + return await request.post({ url: `/wms/stdcostprice/queryStdcostpriceByItemCode`, data }) +} \ No newline at end of file diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 70695a55e..2566aaf6c 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -242,7 +242,7 @@ const props = defineProps({ required: false, default: null }, - // 窗体底部按钮:保存,关闭 + // 窗体底部按钮 显示or隐藏:保存,关闭 isShowFooterButtton: { type: Boolean, required: false, @@ -253,6 +253,12 @@ const props = defineProps({ type: Boolean, required: false, default: true + }, + // 底部按钮集合 + footButttondata: { + type: Array, + required: false, + default: null } }) @@ -412,11 +418,18 @@ if (props.isShowFooterButtton) { defaultButtons.formCloseBtn(null) // 关闭 ] } +if (props.footButttondata) { + Butttondata = props.footButttondata +} /** 按钮事件 */ const buttonBaseClick = (val) => { - // 保存 - if (val == 'save') { + // 扩展 按钮事件回调 + if (props.footButttondata) { + emit('footButtonClick',val) + } + // 保存 + else if (val == 'save') { submitForm() } // 关闭 @@ -505,7 +518,8 @@ const emit = defineEmits([ 'onChange', 'onBlur', 'inputNumberChange', - 'formFormDateChange' + 'formFormDateChange', + 'footButtonClick' ]) //普通下拉改变事件 const formSelectChange = (field, val, row) => { diff --git a/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue b/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue index d7687ae8a..03c3535ba 100644 --- a/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue +++ b/src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue @@ -53,6 +53,7 @@ @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess" + @inputNumberChange="inputNumberChange" @submitForm="submitForm" @buttonOperationClick="buttonOperationClick" /> @@ -70,32 +71,28 @@ :apiDelete="ProductscrapRequestDetailApi.deleteProductscrapRequestDetail" :Echo="Echo" @searchTableSuccessDetail="searchTableSuccessDetail" + @detailBasicFormOnChange="qtyOnChange" :buttondataTable="buttondataTable" @tableFormButton="tableFormButton" :detailValidate="detailValidate" /> - - - - - - + + { console.log("tableListBom",tableListBom.value) console.log("lsBomSave",lsBomSave.value) if (lsBomSave.value) { + tableData.value.forEach((item, index) => { if(tableListBom.value[0].rowId == index) { item.childList = tableListBom.value @@ -192,11 +198,11 @@ const buttonBaseClickBom = (val) => { return } } - bomModelVisible.value = false + detailBomRef.value.dialogVisible = false } // 关闭 else if (val == 'close') { - bomModelVisible.value = false + detailBomRef.value.dialogVisible = false } } // 新增 tableform 按钮 @@ -205,24 +211,35 @@ const buttonOperationClick = async (row, label, index)=> { message.warning('请选择物料代码!') return } + if(row.qty <= 0){ + message.warning('数量需要大于0!') + return + } detatableDataBom.params.itemCode = row.itemCode detatableDataBom.params.bomVersion = row.bomVersion - DialogTitle.value = '物料代码:【' + row.itemCode + '】 Bom 信息' detailQty.value = row.qty bomModelVisible.value = true await getDetailListBom() - + console.log(row.fromLocationCode); detatableDataBom.tableList.forEach(item => { - // ProdcutscrapBomDismantle.allSchemas.tableFormColumns.forEach((bomItem) => { - // if (bomItem.field == 'batch') { - // let condition = { - // 'key':'locationCode', - // 'value': row.fromLocationCode, - // 'isMainValue':'false' - // } - // bomItem.searchCondition.push(condition) - // } - // }) + ProdcutscrapBomScrap.allSchemas.tableFormColumns.map((bomItem) => { + if (bomItem.field == 'batch') { + let condition = [{ + key:'location_code', + action: '==', + value: row.fromLocationCode, + isSearch: true, + isMainValue:false + },{ + key:'item_code', + action: '==', + value:item.itemCode, + isSearch: true, + isMainValue: false + }] + bomItem.tableForm.searchCondition = condition + } + }) item.rowId = index if(tableData.value[index].childList.length > 0) { tableData.value[index].childList.forEach(itemChild => { @@ -234,13 +251,26 @@ const buttonOperationClick = async (row, label, index)=> { item.qty = item.bomQty * row.qty } }) + detailBomRef.value.open('create', row, null,'viewDetail')//查看明细数据 +} + +// 查询页面返回 +const searchTableBomSuccess = (formField, searchField, val, formRef, type, row ) => { + nextTick(() => { + if (type == 'tableForm') { + // 明细查询页赋值 + if (formField == 'batch') { + row['batch'] = val[0]['batch'] + row['packingNumber'] = val[0]['packingNumber'] + } + } + }) } // 查看 Bom 按钮回调事件 const tableFormButton = async (val , row) => { if (val == 'bom') { // 查看 bom bomModelVisible.value = true - DialogTitle.value = '物料代码【' + row.itemCode + '】——Bom信息' detatableDataBom.params = { itemCode: row.itemCode, bomVersion: row.bomVersion, @@ -249,6 +279,7 @@ const tableFormButton = async (val , row) => { rowId.value = row.id detailQty.value = row.qty await getDetailListBom() + detailBomRef.value.open('create', row, null,'viewDetail')//查看明细数据 } } @@ -273,6 +304,12 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => row['itemCode'] = val[0]['itemCode'] row['bomVersion'] = '' row['childList'] = [] + let param = {'itemCode':val[0]['itemCode'] as string} + StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { + console.log(res) + row['uom'] = res.uom + row['singlePrice'] = res.price + }) }else if(formField == 'bomVersion'){ row['bomVersion'] = val[0]['version'] } @@ -300,6 +337,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { setV['itemCode'] = val[0]['itemCode'] setV['bomVersion'] = '' setV['childList'] = [] + // + let param = {'itemCode':val[0]['itemCode'] as string} + StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { + console.log(res) + }) + }else if(formField == 'bomVersion'){ setV['bomVersion'] = val[0]['version'] } @@ -650,6 +693,18 @@ const detailValidate = (data) => { } } +const inputNumberChange = (field, index, row, val) => { + if(field == 'qty' || field == 'singlePrice'){ + row.amount = row.qty * row.singlePrice + } +} + +const qtyOnChange = (field,val) =>{ + if(field == 'qty' || field == 'singlePrice'){ + detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice + } +} + /** 导入 */ const importFormRef = ref() const handleImport = () => { diff --git a/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts b/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts index e29ece33e..03fc0334f 100644 --- a/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts +++ b/src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts @@ -810,6 +810,50 @@ export const ProductscrapRequestDetail = useCrudSchemas(reactive([ precision: 6 } }, + { + label: '单价', + field: 'singlePrice', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + disabled: true, + min: 0, + precision: 6 + }, + }, + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 6 + } + }, + { + label: '金额', + field: 'amount', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + disabled:true, + min: 0, + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + disabled:true, + min: 0, + precision: 6, + }, + }, { label: '项目代码', field: 'projectCode', @@ -954,7 +998,6 @@ export const ProductscrapRequestDetail = useCrudSchemas(reactive([ }] }, form: { - // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择Bom版本', // 输入框占位文本 @@ -1017,7 +1060,7 @@ export const ProductscrapRequestDetailRules = reactive({ /** * @returns {Array} bom 拆解 */ -export const ProdcutscrapBomDismantle = useCrudSchemas(reactive([ +export const ProdcutscrapBomScrap = useCrudSchemas(reactive([ { label: '行标记', field: 'rowId', @@ -1183,3 +1226,8 @@ export const ProdcutscrapBomDismantle = useCrudSchemas(reactive([ } } ])) + +//表单校验 +export const ProdcutscrapBomScrapRules = reactive({ + +})