fix(ts): 补全 ERP 订单 VO 并收敛 items 类型
- PurchaseOrderVO/SaleOrderVO 补齐详情/表单实际字段,新增 PurchaseOrderItemVO/SaleOrderItemVO - 修正采购 VO 错字段:customerId→supplierId、outCount→inCount - 采购/销售订单及入库/出库/退货表单 items 从 never[] 收敛到对应 item VO - 订单选择弹窗选中行明确类型,提交用 !(对应按钮未选禁用约束) - 财务付款/收款补 item 金额类型;价格计算对空值做 ?? 0 Co-Authored-By: Codex <codex@openai.com> ts:check 85 → 26,ERP 错误清零,无新增类型错误master
parent
361f4d8d15
commit
983ac71559
|
|
@ -11,6 +11,11 @@ export interface FinancePaymentVO {
|
|||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 付款单项 VO
|
||||
export interface FinancePaymentItemVO {
|
||||
paymentPrice: number // 本次付款金额,单位:元
|
||||
}
|
||||
|
||||
// ERP 付款单 API
|
||||
export const FinancePaymentApi = {
|
||||
// 查询付款单分页
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ export interface FinanceReceiptVO {
|
|||
remark: string // 备注
|
||||
}
|
||||
|
||||
// ERP 收款单项 VO
|
||||
export interface FinanceReceiptItemVO {
|
||||
receiptPrice: number // 本次收款金额,单位:元
|
||||
}
|
||||
|
||||
// ERP 收款单 API
|
||||
export const FinanceReceiptApi = {
|
||||
// 查询收款单分页
|
||||
|
|
|
|||
|
|
@ -2,16 +2,45 @@ import request from '@/config/axios'
|
|||
|
||||
// ERP 采购订单 VO
|
||||
export interface PurchaseOrderVO {
|
||||
id: number // 订单工单编号
|
||||
no: string // 采购订单号
|
||||
customerId: number // 客户编号
|
||||
orderTime: Date // 订单时间
|
||||
totalCount: number // 合计数量
|
||||
id?: number // 订单工单编号
|
||||
no?: string // 采购订单号
|
||||
supplierId?: number // 供应商编号
|
||||
accountId?: number // 结算账户编号
|
||||
orderTime?: Date // 订单时间
|
||||
totalCount?: number // 合计数量
|
||||
totalProductPrice?: number // 合计产品金额,单位:元
|
||||
discountPercent?: number // 优惠率
|
||||
discountPrice?: number // 优惠金额,单位:元
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
outCount: number // 采购出库数量
|
||||
returnCount: number // 采购退货数量
|
||||
depositPrice?: number // 订金金额,单位:元
|
||||
status?: number // 状态
|
||||
remark?: string // 备注
|
||||
fileUrl: string // 附件地址
|
||||
inCount?: number // 采购入库数量
|
||||
returnCount?: number // 采购退货数量
|
||||
items: PurchaseOrderItemVO[] // 订单项
|
||||
}
|
||||
|
||||
// ERP 采购订单项 VO
|
||||
export interface PurchaseOrderItemVO {
|
||||
id?: number
|
||||
orderItemId?: number
|
||||
productId?: number
|
||||
productName?: string
|
||||
productUnitName?: string
|
||||
productBarCode?: string
|
||||
productPrice?: number
|
||||
stockCount?: number
|
||||
count: number
|
||||
totalCount?: number
|
||||
inCount?: number
|
||||
returnCount?: number
|
||||
totalProductPrice?: number
|
||||
taxPercent?: number
|
||||
taxPrice?: number
|
||||
totalPrice: number
|
||||
remark?: string
|
||||
warehouseId?: number
|
||||
}
|
||||
|
||||
// ERP 采购订单 API
|
||||
|
|
|
|||
|
|
@ -2,16 +2,46 @@ import request from '@/config/axios'
|
|||
|
||||
// ERP 销售订单 VO
|
||||
export interface SaleOrderVO {
|
||||
id: number // 订单工单编号
|
||||
no: string // 销售订单号
|
||||
customerId: number // 客户编号
|
||||
orderTime: Date // 订单时间
|
||||
totalCount: number // 合计数量
|
||||
id?: number // 订单工单编号
|
||||
no?: string // 销售订单号
|
||||
customerId?: number // 客户编号
|
||||
accountId?: number // 结算账户编号
|
||||
saleUserId?: number // 销售人员编号
|
||||
orderTime?: Date // 订单时间
|
||||
totalCount?: number // 合计数量
|
||||
totalProductPrice?: number // 合计产品金额,单位:元
|
||||
discountPercent?: number // 优惠率
|
||||
discountPrice?: number // 优惠金额,单位:元
|
||||
totalPrice: number // 合计金额,单位:元
|
||||
status: number // 状态
|
||||
remark: string // 备注
|
||||
outCount: number // 销售出库数量
|
||||
returnCount: number // 销售退货数量
|
||||
depositPrice?: number // 订金金额,单位:元
|
||||
status?: number // 状态
|
||||
remark?: string // 备注
|
||||
fileUrl: string // 附件地址
|
||||
outCount?: number // 销售出库数量
|
||||
returnCount?: number // 销售退货数量
|
||||
items: SaleOrderItemVO[] // 订单项
|
||||
}
|
||||
|
||||
// ERP 销售订单项 VO
|
||||
export interface SaleOrderItemVO {
|
||||
id?: number
|
||||
orderItemId?: number
|
||||
productId?: number
|
||||
productName?: string
|
||||
productUnitName?: string
|
||||
productBarCode?: string
|
||||
productPrice?: number
|
||||
stockCount?: number
|
||||
count: number
|
||||
totalCount?: number
|
||||
outCount?: number
|
||||
returnCount?: number
|
||||
totalProductPrice?: number
|
||||
taxPercent?: number
|
||||
taxPrice?: number
|
||||
totalPrice: number
|
||||
remark?: string
|
||||
warehouseId?: number
|
||||
}
|
||||
|
||||
// ERP 销售订单 API
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ const resetForm = () => {
|
|||
no: undefined,
|
||||
remark: undefined,
|
||||
status: undefined,
|
||||
sort: undefined
|
||||
sort: undefined,
|
||||
defaultStatus: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,11 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { FinancePaymentApi, FinancePaymentVO } from '@/api/erp/finance/payment'
|
||||
import {
|
||||
FinancePaymentApi,
|
||||
FinancePaymentItemVO,
|
||||
FinancePaymentVO
|
||||
} from '@/api/erp/finance/payment'
|
||||
import FinancePaymentItemForm from './components/FinancePaymentItemForm.vue'
|
||||
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
|
||||
import { erpPriceInputFormatter } from '@/utils'
|
||||
|
|
@ -173,7 +177,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
discountPrice: 0,
|
||||
paymentPrice: 0,
|
||||
items: [],
|
||||
items: [] as FinancePaymentItemVO[],
|
||||
no: undefined as string | undefined // 订单单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -270,7 +274,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
discountPrice: 0,
|
||||
paymentPrice: 0,
|
||||
items: [],
|
||||
items: [] as FinancePaymentItemVO[],
|
||||
no: undefined as string | undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -145,7 +145,11 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { FinanceReceiptApi, FinanceReceiptVO } from '@/api/erp/finance/receipt'
|
||||
import {
|
||||
FinanceReceiptApi,
|
||||
FinanceReceiptItemVO,
|
||||
FinanceReceiptVO
|
||||
} from '@/api/erp/finance/receipt'
|
||||
import FinanceReceiptItemForm from './components/FinanceReceiptItemForm.vue'
|
||||
import { erpPriceInputFormatter } from '@/utils'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
|
@ -173,7 +177,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
discountPrice: 0,
|
||||
receiptPrice: 0,
|
||||
items: [],
|
||||
items: [] as FinanceReceiptItemVO[],
|
||||
no: undefined as string | undefined // 订单单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -270,7 +274,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
discountPrice: 0,
|
||||
receiptPrice: 0,
|
||||
items: [],
|
||||
items: [] as FinanceReceiptItemVO[],
|
||||
no: undefined as string | undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ import PurchaseInItemForm from './components/PurchaseInItemForm.vue'
|
|||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import PurchaseOrderInEnableList from '@/views/erp/purchase/order/components/PurchaseOrderInEnableList.vue'
|
||||
import { PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import { PurchaseOrderItemVO, PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined as string | undefined,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined as string | undefined // 入库单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -221,7 +221,9 @@ watch(
|
|||
// 计算
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice + val.otherPrice
|
||||
},
|
||||
|
|
@ -268,13 +270,13 @@ const handlePurchaseOrderChange = (order: PurchaseOrderVO) => {
|
|||
formData.value.orderNo = order.no
|
||||
formData.value.supplierId = order.supplierId
|
||||
formData.value.accountId = order.accountId
|
||||
formData.value.discountPercent = order.discountPercent
|
||||
formData.value.discountPercent = order.discountPercent ?? 0
|
||||
formData.value.remark = order.remark
|
||||
formData.value.fileUrl = order.fileUrl
|
||||
formData.value.fileUrl = order.fileUrl ?? ''
|
||||
// 将订单项设置到入库单项
|
||||
order.items.forEach((item) => {
|
||||
item.totalCount = item.count
|
||||
item.count = item.totalCount - item.inCount
|
||||
item.count = item.totalCount - (item.inCount ?? 0)
|
||||
item.orderItemId = item.id
|
||||
item.id = undefined
|
||||
})
|
||||
|
|
@ -321,7 +323,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { PurchaseOrderApi, PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import { PurchaseOrderApi, PurchaseOrderItemVO, PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import PurchaseOrderItemForm from './components/PurchaseOrderItemForm.vue'
|
||||
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
|
|
@ -152,7 +152,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
|||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情
|
||||
const formData = ref({
|
||||
const formData = ref<PurchaseOrderVO>({
|
||||
id: undefined as number | undefined,
|
||||
supplierId: undefined as number | undefined,
|
||||
accountId: undefined as number | undefined,
|
||||
|
|
@ -163,7 +163,7 @@ const formData = ref({
|
|||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
depositPrice: 0,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined as string | undefined // 订单单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -189,7 +189,9 @@ watch(
|
|||
}
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice
|
||||
},
|
||||
|
|
@ -262,7 +264,7 @@ const resetForm = () => {
|
|||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
depositPrice: 0,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ const queryFormRef = ref() // 搜索的表单
|
|||
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 选中行 */
|
||||
const currentRowValue = ref(undefined) // 选中行的 value
|
||||
const currentRow = ref(undefined) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
const currentRowValue = ref<number>() // 选中行的 value
|
||||
const currentRow = ref<PurchaseOrderVO>() // 选中行
|
||||
const handleCurrentChange = (row: PurchaseOrderVO) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ const emits = defineEmits<{
|
|||
}>()
|
||||
const submitForm = () => {
|
||||
try {
|
||||
emits('success', currentRow.value)
|
||||
emits('success', currentRow.value!)
|
||||
} finally {
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ const queryFormRef = ref() // 搜索的表单
|
|||
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 选中行 */
|
||||
const currentRowValue = ref(undefined) // 选中行的 value
|
||||
const currentRow = ref(undefined) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
const currentRowValue = ref<number>() // 选中行的 value
|
||||
const currentRow = ref<PurchaseOrderVO>() // 选中行
|
||||
const handleCurrentChange = (row: PurchaseOrderVO) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ const emits = defineEmits<{
|
|||
}>()
|
||||
const submitForm = () => {
|
||||
try {
|
||||
emits('success', currentRow.value)
|
||||
emits('success', currentRow.value!)
|
||||
} finally {
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="handleDelete(selectionList.map((item) => item.id))"
|
||||
@click="handleDelete(selectionList.map((item) => item.id!))"
|
||||
v-hasPermi="['erp:purchase-order:delete']"
|
||||
:disabled="selectionList.length === 0"
|
||||
>
|
||||
|
|
@ -356,7 +356,7 @@ const handleDelete = async (ids: number[]) => {
|
|||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
|
||||
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id!))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
|
|||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import PurchaseOrderReturnEnableList from '@/views/erp/purchase/order/components/PurchaseOrderReturnEnableList.vue'
|
||||
import { PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import { PurchaseOrderItemVO, PurchaseOrderVO } from '@/api/erp/purchase/order'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
/** ERP 采购退货表单 */
|
||||
|
|
@ -198,7 +198,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined as string | undefined,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined as string | undefined // 退货单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -225,7 +225,9 @@ watch(
|
|||
// 计算
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice + val.otherPrice
|
||||
},
|
||||
|
|
@ -272,12 +274,12 @@ const handlePurchaseOrderChange = (order: PurchaseOrderVO) => {
|
|||
formData.value.orderNo = order.no
|
||||
formData.value.supplierId = order.supplierId
|
||||
formData.value.accountId = order.accountId
|
||||
formData.value.discountPercent = order.discountPercent
|
||||
formData.value.discountPercent = order.discountPercent ?? 0
|
||||
formData.value.remark = order.remark
|
||||
formData.value.fileUrl = order.fileUrl
|
||||
formData.value.fileUrl = order.fileUrl ?? ''
|
||||
// 将订单项设置到退货单项
|
||||
order.items.forEach((item) => {
|
||||
item.count = item.inCount - item.returnCount
|
||||
item.count = (item.inCount ?? 0) - (item.returnCount ?? 0)
|
||||
item.orderItemId = item.id
|
||||
item.id = undefined
|
||||
})
|
||||
|
|
@ -324,7 +326,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined,
|
||||
items: [],
|
||||
items: [] as PurchaseOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ const queryParams = reactive({
|
|||
supplierId: undefined,
|
||||
productId: undefined,
|
||||
warehouseId: undefined,
|
||||
inTime: [],
|
||||
returnTime: [],
|
||||
orderNo: undefined,
|
||||
accountId: undefined,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import { SaleOrderApi, SaleOrderItemVO, SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import SaleOrderItemForm from './components/SaleOrderItemForm.vue'
|
||||
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
|
||||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||
|
|
@ -170,7 +170,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
|||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情
|
||||
const formData = ref({
|
||||
const formData = ref<SaleOrderVO>({
|
||||
id: undefined as number | undefined,
|
||||
customerId: undefined as number | undefined,
|
||||
accountId: undefined as number | undefined,
|
||||
|
|
@ -182,7 +182,7 @@ const formData = ref({
|
|||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
depositPrice: 0,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined as string | undefined // 订单单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -208,7 +208,9 @@ watch(
|
|||
}
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice
|
||||
},
|
||||
|
|
@ -282,7 +284,7 @@ const resetForm = () => {
|
|||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
depositPrice: 0,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ const queryFormRef = ref() // 搜索的表单
|
|||
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 选中行 */
|
||||
const currentRowValue = ref(undefined) // 选中行的 value
|
||||
const currentRow = ref(undefined) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
const currentRowValue = ref<number>() // 选中行的 value
|
||||
const currentRow = ref<SaleOrderVO>() // 选中行
|
||||
const handleCurrentChange = (row: SaleOrderVO) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ const emits = defineEmits<{
|
|||
}>()
|
||||
const submitForm = () => {
|
||||
try {
|
||||
emits('success', currentRow.value)
|
||||
emits('success', currentRow.value!)
|
||||
} finally {
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ const queryFormRef = ref() // 搜索的表单
|
|||
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 选中行 */
|
||||
const currentRowValue = ref(undefined) // 选中行的 value
|
||||
const currentRow = ref(undefined) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
const currentRowValue = ref<number>() // 选中行的 value
|
||||
const currentRow = ref<SaleOrderVO>() // 选中行
|
||||
const handleCurrentChange = (row: SaleOrderVO) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ const emits = defineEmits<{
|
|||
}>()
|
||||
const submitForm = () => {
|
||||
try {
|
||||
emits('success', currentRow.value)
|
||||
emits('success', currentRow.value!)
|
||||
} finally {
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="handleDelete(selectionList.map((item) => item.id))"
|
||||
@click="handleDelete(selectionList.map((item) => item.id!))"
|
||||
v-hasPermi="['erp:sale-order:delete']"
|
||||
:disabled="selectionList.length === 0"
|
||||
>
|
||||
|
|
@ -356,7 +356,7 @@ const handleDelete = async (ids: number[]) => {
|
|||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
|
||||
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id!))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
|
|||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import SaleOrderOutEnableList from '@/views/erp/sale/order/components/SaleOrderOutEnableList.vue'
|
||||
import { SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import { SaleOrderItemVO, SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
/** ERP 销售出库表单 */
|
||||
|
|
@ -210,7 +210,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined as string | undefined,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined as string | undefined // 出库单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -237,7 +237,9 @@ watch(
|
|||
// 计算
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.discountPrice = discountPrice
|
||||
formData.value.totalPrice = totalPrice - discountPrice + val.otherPrice
|
||||
},
|
||||
|
|
@ -285,13 +287,13 @@ const handleSaleOrderChange = (order: SaleOrderVO) => {
|
|||
formData.value.customerId = order.customerId
|
||||
formData.value.accountId = order.accountId
|
||||
formData.value.saleUserId = order.saleUserId
|
||||
formData.value.discountPercent = order.discountPercent
|
||||
formData.value.discountPercent = order.discountPercent ?? 0
|
||||
formData.value.remark = order.remark
|
||||
formData.value.fileUrl = order.fileUrl
|
||||
formData.value.fileUrl = order.fileUrl ?? ''
|
||||
// 将订单项设置到出库单项
|
||||
order.items.forEach((item) => {
|
||||
item.totalCount = item.count
|
||||
item.count = item.totalCount - item.outCount
|
||||
item.count = item.totalCount - (item.outCount ?? 0)
|
||||
item.orderItemId = item.id
|
||||
item.id = undefined
|
||||
})
|
||||
|
|
@ -339,7 +341,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
|
|||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||
import SaleOrderReturnEnableList from '@/views/erp/sale/order/components/SaleOrderReturnEnableList.vue'
|
||||
import { SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import { SaleOrderItemVO, SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
/** ERP 销售退货表单 */
|
||||
|
|
@ -210,7 +210,7 @@ const formData = ref({
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined as string | undefined,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined as string | undefined // 退货单号,后端返回
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -237,7 +237,9 @@ watch(
|
|||
// 计算
|
||||
const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||
val.discountPercent != null
|
||||
? (erpPriceMultiply(totalPrice, val.discountPercent / 100.0) ?? 0)
|
||||
: 0
|
||||
formData.value.totalPrice = totalPrice - discountPrice + val.otherPrice
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
@ -284,12 +286,12 @@ const handleSaleOrderChange = (order: SaleOrderVO) => {
|
|||
formData.value.customerId = order.customerId
|
||||
formData.value.accountId = order.accountId
|
||||
formData.value.saleUserId = order.saleUserId
|
||||
formData.value.discountPercent = order.discountPercent
|
||||
formData.value.discountPercent = order.discountPercent ?? 0
|
||||
formData.value.remark = order.remark
|
||||
formData.value.fileUrl = order.fileUrl
|
||||
formData.value.fileUrl = order.fileUrl ?? ''
|
||||
// 将订单项设置到退货单项
|
||||
order.items.forEach((item) => {
|
||||
item.count = item.outCount - item.returnCount
|
||||
item.count = (item.outCount ?? 0) - (item.returnCount ?? 0)
|
||||
item.orderItemId = item.id
|
||||
item.id = undefined
|
||||
})
|
||||
|
|
@ -337,7 +339,7 @@ const resetForm = () => {
|
|||
totalPrice: 0,
|
||||
otherPrice: 0,
|
||||
orderNo: undefined,
|
||||
items: [],
|
||||
items: [] as SaleOrderItemVO[],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ const queryParams = reactive({
|
|||
customerId: undefined,
|
||||
productId: undefined,
|
||||
warehouseId: undefined,
|
||||
outTime: [],
|
||||
returnTime: [],
|
||||
orderNo: undefined,
|
||||
accountId: undefined,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ const formData = ref({
|
|||
checkTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: '',
|
||||
items: []
|
||||
items: [],
|
||||
no: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
checkTime: [{ required: true, message: '盘点时间不能为空', trigger: 'blur' }]
|
||||
|
|
@ -140,8 +141,9 @@ const resetForm = () => {
|
|||
customerId: undefined,
|
||||
checkTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
items: []
|
||||
fileUrl: '',
|
||||
items: [],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ const formData = ref({
|
|||
inTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: '',
|
||||
items: []
|
||||
items: [],
|
||||
no: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
inTime: [{ required: true, message: '入库时间不能为空', trigger: 'blur' }]
|
||||
|
|
@ -162,8 +163,9 @@ const resetForm = () => {
|
|||
supplierId: undefined,
|
||||
inTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
items: []
|
||||
fileUrl: '',
|
||||
items: [],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ const queryParams = reactive({
|
|||
no: undefined,
|
||||
productId: undefined,
|
||||
supplierId: undefined,
|
||||
warehouseId: undefined,
|
||||
inTime: [],
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ const formData = ref({
|
|||
moveTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: '',
|
||||
items: []
|
||||
items: [],
|
||||
no: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
moveTime: [{ required: true, message: '调度时间不能为空', trigger: 'blur' }]
|
||||
|
|
@ -140,8 +141,9 @@ const resetForm = () => {
|
|||
customerId: undefined,
|
||||
moveTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
items: []
|
||||
fileUrl: '',
|
||||
items: [],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ const formData = ref({
|
|||
outTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: '',
|
||||
items: []
|
||||
items: [],
|
||||
no: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
outTime: [{ required: true, message: '出库时间不能为空', trigger: 'blur' }]
|
||||
|
|
@ -162,8 +163,9 @@ const resetForm = () => {
|
|||
customerId: undefined,
|
||||
outTime: undefined,
|
||||
remark: undefined,
|
||||
fileUrl: undefined,
|
||||
items: []
|
||||
fileUrl: '',
|
||||
items: [],
|
||||
no: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue