fix item need and purchase order

main
chenshuichuan 2 years ago
parent 70ed143d1c
commit fd1bfb88c2

@ -260,13 +260,13 @@ const handleAdd = () => {
productId: undefined, productId: undefined,
productUnitName: undefined, // productUnitName: undefined, //
productBarCode: undefined, // productBarCode: undefined, //
productPrice: undefined, productPrice: 0,
stockCount: undefined, stockCount: undefined,
count: 1, count: 1,
totalProductPrice: undefined, totalProductPrice: 0,
taxPercent: undefined, taxPercent: 0,
taxPrice: undefined, taxPrice: 0,
totalPrice: undefined, totalPrice: 0,
remark: undefined remark: undefined
} }
formData.value.push(row) formData.value.push(row)

@ -131,10 +131,10 @@
<el-option label="全部付款" value="2" /> <el-option label="全部付款" value="2" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="审核状态" prop="status"> <el-form-item label="采购审核" prop="status">
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
placeholder="请选择审核状态" placeholder="请选择采购审核"
clearable clearable
class="!w-240px" class="!w-240px"
> >
@ -235,7 +235,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="审核状态" align="center" fixed="right" width="90" prop="status"> <el-table-column label="采购审核" align="center" fixed="right" width="90" prop="status">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" />
</template> </template>

@ -141,6 +141,7 @@ import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils' import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { AccountApi, AccountVO } from '@/api/erp/finance/account' import { AccountApi, AccountVO } from '@/api/erp/finance/account'
import {ItemRequisitionAndStockVO} from "@/api/mes/task";
/** ERP 销售订单表单 */ /** ERP 销售订单表单 */
defineOptions({ name: 'PurchaseOrderForm' }) defineOptions({ name: 'PurchaseOrderForm' })
@ -167,7 +168,6 @@ const formData = ref({
no: undefined // no: undefined //
}) })
const formRules = reactive({ const formRules = reactive({
supplierId: [{ required: true, message: '供应商不能为空', trigger: 'blur' }],
orderTime: [{ required: true, message: '订单时间不能为空', trigger: 'blur' }] orderTime: [{ required: true, message: '订单时间不能为空', trigger: 'blur' }]
}) })
const disabled = computed(() => formType.value === 'detail') const disabled = computed(() => formType.value === 'detail')
@ -197,7 +197,7 @@ watch(
) )
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number, itemList?: ItemRequisitionAndStockVO[]) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
@ -221,6 +221,11 @@ const open = async (type: string, id?: number) => {
if (defaultAccount) { if (defaultAccount) {
formData.value.accountId = defaultAccount.id formData.value.accountId = defaultAccount.id
} }
//
if(itemList){
itemFormRef.value.handleItemListAdd(itemList)
}
} }
defineExpose({ open }) // open defineExpose({ open }) // open

@ -57,7 +57,7 @@
<el-input-number <el-input-number
v-model="row.count" v-model="row.count"
controls-position="right" controls-position="right"
:min="0.001" :min="1.000"
:precision="3" :precision="3"
class="!w-100%" class="!w-100%"
/> />
@ -70,7 +70,7 @@
<el-input-number <el-input-number
v-model="row.productPrice" v-model="row.productPrice"
controls-position="right" controls-position="right"
:min="0.01" :min="0.00"
:precision="2" :precision="2"
class="!w-100%" class="!w-100%"
/> />
@ -144,6 +144,7 @@ import {
erpPriceMultiply, erpPriceMultiply,
getSumValue getSumValue
} from '@/utils' } from '@/utils'
import {ItemRequisitionAndStockVO} from "@/api/mes/task";
const props = defineProps<{ const props = defineProps<{
items: undefined items: undefined
@ -176,6 +177,9 @@ watch(
} }
// //
val.forEach((item) => { val.forEach((item) => {
if(item.productPrice == null) item.productPrice = 0.0
if(item.taxPercent == null) item.taxPercent = 0.0
item.totalProductPrice = erpPriceMultiply(item.productPrice, item.count) item.totalProductPrice = erpPriceMultiply(item.productPrice, item.count)
item.taxPrice = erpPriceMultiply(item.totalProductPrice, item.taxPercent / 100.0) item.taxPrice = erpPriceMultiply(item.totalProductPrice, item.taxPercent / 100.0)
if (item.totalProductPrice != null) { if (item.totalProductPrice != null) {
@ -216,13 +220,13 @@ const handleAdd = () => {
productId: undefined, productId: undefined,
productUnitName: undefined, // productUnitName: undefined, //
productBarCode: undefined, // productBarCode: undefined, //
productPrice: undefined, productPrice: 0,
stockCount: undefined, stockCount: undefined,
count: 1, count: 1,
totalProductPrice: undefined, totalProductPrice: 0,
taxPercent: undefined, taxPercent: 0,
taxPrice: undefined, taxPrice: 0,
totalPrice: undefined, totalPrice: 0,
remark: undefined remark: undefined
} }
formData.value.push(row) formData.value.push(row)
@ -258,14 +262,45 @@ const setStockCount = async (row: any) => {
const validate = () => { const validate = () => {
return formRef.value.validate() return formRef.value.validate()
} }
defineExpose({ validate })
/** 物料申购会调用 */
const handleItemListAdd = async (itemList: ItemRequisitionAndStockVO[]) => {
for (let i = 0; i < itemList.length; i++) {
const row = {
id: undefined,
productId: itemList[i].itemId,
productUnitName: undefined, //
productBarCode: undefined, //
productPrice: 0.0,
stockCount: undefined,
count: itemList[i].number,
totalProductPrice: 0.0,
taxPercent: 0.0,
taxPrice: 0.0,
totalPrice: 0,
remark: undefined
}
formData.value.push(row)
}
/** 处理产品变更 */
if(!productList.value || productList.value.length==0)
productList.value = await ProductApi.getOrderSimpleList()
for (let i = 0; i < formData.value.length; i++) {
onChangeProduct(formData.value[i].productId, formData.value[i])
}
}
defineExpose({ validate, handleItemListAdd })
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {
if(!productList.value || productList.value.length==0)
productList.value = await ProductApi.getOrderSimpleList() productList.value = await ProductApi.getOrderSimpleList()
// //
if (formData.value.length === 0) { if (formData.value.length === 0) {
handleAdd() handleAdd()
} }
}) })
</script> </script>

@ -103,6 +103,15 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="产品" name="2" />
<el-tab-pane label="原料" name="1" />
<el-tab-pane label="关键件" name="5" />
<el-tab-pane label="工具" name="3" />
<el-tab-pane label="耗材" name="4" />
<el-tab-pane label="其他" name="0" />
</el-tabs>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="产品名称" align="center" prop="productName" /> <el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="产品分类" align="center" prop="categoryName" /> <el-table-column label="产品分类" align="center" prop="categoryName" />
@ -167,6 +176,7 @@ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
productId: undefined, productId: undefined,
categoryId: undefined,
warehouseId: undefined, warehouseId: undefined,
bizType: undefined, bizType: undefined,
bizNo: undefined, bizNo: undefined,
@ -246,4 +256,10 @@ onMounted(async () => {
productList.value = await ProductApi.getProductSimpleList() productList.value = await ProductApi.getProductSimpleList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
}) })
/** tab 切换 */
const handleTabClick = (tab: TabsPaneContext) => {
queryParams.categoryId = tab.paneName
handleQuery()
}
</script> </script>

@ -26,22 +26,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="分类" prop="categoryId">
<el-select
v-model="queryParams.categoryId"
clearable
filterable
placeholder="请选择产品"
class="!w-240px"
>
<el-option
v-for="item in categoryList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId"> <el-form-item label="仓库" prop="warehouseId">
<el-select <el-select
v-model="queryParams.warehouseId" v-model="queryParams.warehouseId"
@ -84,6 +69,15 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="产品" name="2" />
<el-tab-pane label="原料" name="1" />
<el-tab-pane label="关键件" name="5" />
<el-tab-pane label="工具" name="3" />
<el-tab-pane label="耗材" name="4" />
<el-tab-pane label="其他" name="0" />
</el-tabs>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="产品" align="center" prop="productName" /> <el-table-column label="产品" align="center" prop="productName" />
<el-table-column label="分类" align="center" prop="categoryName" /> <el-table-column label="分类" align="center" prop="categoryName" />
@ -202,4 +196,10 @@ onMounted(async () => {
warehouseList.value = await WarehouseApi.getWarehouseSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
categoryList.value = await ProductCategoryApi.getProductCategorySimpleList() categoryList.value = await ProductCategoryApi.getProductCategorySimpleList()
}) })
/** tab 切换 */
const handleTabClick = (tab: TabsPaneContext) => {
queryParams.categoryId = tab.paneName
handleQuery()
}
</script> </script>

@ -9,15 +9,18 @@
<el-table-column label="车间仓库存" align="center" prop="stockWorkshopNumber" /> <el-table-column label="车间仓库存" align="center" prop="stockWorkshopNumber" />
</el-table> </el-table>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="loading"> </el-button> <el-button @click="openForm" type="primary" :disabled="loading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</template> </template>
</Dialog> </Dialog>
<!-- 表单弹窗添加/修改 -->
<PurchaseOrderForm ref="formRef" @success="jumpToPurchase"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {TaskApi} from "@/api/mes/task"; import {TaskApi} from "@/api/mes/task";
import PurchaseOrderForm from "@/views/erp/purchase/order/PurchaseOrderForm.vue";
const props = defineProps<{ const props = defineProps<{
orderId?: number orderId?: number
@ -29,7 +32,7 @@ const props = defineProps<{
const loading = ref(false) // const loading = ref(false) //
const list = ref([]) // const list = ref([]) //
const { push } = useRouter()
/**表单 */ /**表单 */
defineOptions({ name: 'ItemNeedIndex' }) defineOptions({ name: 'ItemNeedIndex' })
@ -44,7 +47,6 @@ const open = async (type: string, title: string, id: number, number?:number) =>
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '物料需求:'+title dialogTitle.value = '物料需求:'+title
loading.value = true loading.value = true
console.log(type, title, id)
try { try {
if (type === 'order') { if (type === 'order') {
list.value = await TaskApi.getOderItemNeedList(id) list.value = await TaskApi.getOderItemNeedList(id)
@ -69,5 +71,15 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = () => {
formRef.value.open('create',null , list.value)
}
/**
* 申购成功则转跳采购页面**/
const jumpToPurchase = () =>{
push('/erp/purchase/order')
} }
</script> </script>

@ -31,12 +31,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="时间" prop="planDate"> <el-form-item label="日期" prop="planDate">
<el-date-picker <el-date-picker
v-model="formData.planDate" v-model="formData.planDate"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
type="dates" type="dates"
:default-time="[new Date('1 00:00:00')]" placeholder="请选择排产日期"
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>

Loading…
Cancel
Save