Browse Source

创建Q1订单,输入物料代码时,自动带出金额,金额取自选定零件的标准成本,根据数量*标准成本动态更新金额

linshi20240813
parent
commit
e31b2a9a24
  1. 29
      src/views/qms/inspectionQ1/index.vue

29
src/views/qms/inspectionQ1/index.vue

@ -55,6 +55,7 @@
:apiCreate="Q1Api.createQ1" :apiCreate="Q1Api.createQ1"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" :isBusiness="false"
@onChange="onChange"
/> />
<!-- 详情 --> <!-- 详情 -->
@ -77,6 +78,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import * as StdcostpriceApi from '@/api/wms/stdcostprice'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
@ -92,20 +94,45 @@ routeName.value = route.name
const tableColumns = ref(Q1.allSchemas.tableColumns) const tableColumns = ref(Q1.allSchemas.tableColumns)
// //
const priceObj = ref()
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(async () => {
const setV = {} const setV = {}
if (formField == 'customerCode') { if (formField == 'customerCode') {
setV['itemCode'] = '' setV['itemCode'] = ''
} }
if (formField == 'itemCode') { if (formField == 'itemCode') {
setV['uom'] = val[0]['customerUom'] setV['uom'] = val[0]['customerUom']
console.log(333,val[0].code)
const params = {
by: "ASC",
filters: [{column: "itemCode", action: "==", value: val[0].itemCode}],
pageNo: 1,
pageSize: 500,
sort: ""
}
params.isSearch = true
StdcostpriceApi.getStdcostpricePage(params).then((res) => {
if (res.list?.length > 0) {
priceObj.value = res.list[0]
formRef.setValues({
claimAmount: (parseFloat(formRef.formModel.qty) * parseFloat(priceObj.value.price)).toFixed(6)
})
}
})
} }
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
const onChange =(field,e)=>{
if (field == 'qty') {
basicFormRef.value.formRef.formModel.claimAmount = (parseFloat( basicFormRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6)
}
}
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val

Loading…
Cancel
Save