✨ ERP:增加 ERP 可出库订单列表
This commit is contained in:
parent
e535384f45
commit
c0db4df880
206
src/views/erp/sale/order/components/SaleOrderOutEnableList.vue
Normal file
206
src/views/erp/sale/order/components/SaleOrderOutEnableList.vue
Normal file
@ -0,0 +1,206 @@
|
||||
<!-- 可出库的订单列表 -->
|
||||
<template>
|
||||
<Dialog
|
||||
title="选择销售订单(仅展示可出库)"
|
||||
v-model="dialogVisible"
|
||||
:appendToBody="true"
|
||||
:scroll="true"
|
||||
width="1080"
|
||||
>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="订单单号" prop="no">
|
||||
<el-input
|
||||
v-model="queryParams.no"
|
||||
placeholder="请输入订单单号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-160px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品" prop="productId">
|
||||
<el-select
|
||||
v-model="queryParams.productId"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择产品"
|
||||
class="!w-160px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in productList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单时间" prop="orderTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.orderTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-160px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||
<el-table-column align="center" width="65">
|
||||
<template #default="scope">
|
||||
<el-radio
|
||||
:label="scope.row.id"
|
||||
v-model="currentRowValue"
|
||||
@change="handleCurrentChange(scope.row)"
|
||||
>
|
||||
|
||||
</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="180" label="订单单号" align="center" prop="no" />
|
||||
<el-table-column label="客户" align="center" prop="customerName" />
|
||||
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
|
||||
<el-table-column
|
||||
label="订单时间"
|
||||
align="center"
|
||||
prop="orderTime"
|
||||
:formatter="dateFormatter2"
|
||||
width="120px"
|
||||
/>
|
||||
<el-table-column label="创建人" align="center" prop="creatorName" />
|
||||
<el-table-column
|
||||
label="总数量"
|
||||
align="center"
|
||||
prop="totalCount"
|
||||
:formatter="erpCountTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column
|
||||
label="出库数量"
|
||||
align="center"
|
||||
prop="inCount"
|
||||
:formatter="erpCountTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column
|
||||
label="金额合计"
|
||||
align="center"
|
||||
prop="totalProductPrice"
|
||||
:formatter="erpPriceTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column
|
||||
label="含税金额"
|
||||
align="center"
|
||||
prop="totalPrice"
|
||||
:formatter="erpPriceTableColumnFormatter"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
<template #footer>
|
||||
<el-button :disabled="!currentRow" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElTable } from 'element-plus'
|
||||
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
|
||||
import { dateFormatter2 } from '@/utils/formatTime'
|
||||
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
|
||||
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
||||
|
||||
defineOptions({ name: 'ErpSaleOrderOutEnableList' })
|
||||
|
||||
const list = ref<SaleOrderVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
no: undefined,
|
||||
productId: undefined,
|
||||
orderTime: [],
|
||||
outEnable: true
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const productList = ref<ProductVO[]>([]) // 产品列表
|
||||
|
||||
/** 选中行 */
|
||||
const currentRowValue = ref(undefined) // 选中行的 value
|
||||
const currentRow = ref(undefined) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async () => {
|
||||
dialogVisible.value = true
|
||||
await nextTick() // 等待,避免 queryFormRef 为空
|
||||
// 加载可出库的订单列表
|
||||
await resetQuery()
|
||||
// 加载产品列表
|
||||
productList.value = await ProductApi.getProductSimpleList()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交选择 */
|
||||
const emits = defineEmits<{
|
||||
(e: 'success', value: SaleOrderVO): void
|
||||
}>()
|
||||
const submitForm = () => {
|
||||
try {
|
||||
emits('success', currentRow.value)
|
||||
} finally {
|
||||
// 关闭弹窗
|
||||
dialogVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 加载列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await SaleOrderApi.getSaleOrderPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
currentRowValue.value = undefined
|
||||
currentRow.value = undefined
|
||||
getList()
|
||||
}
|
||||
</script>
|
@ -180,7 +180,7 @@
|
||||
:formatter="erpCountTableColumnFormatter"
|
||||
/>
|
||||
<el-table-column
|
||||
label="入库数量"
|
||||
label="出库数量"
|
||||
align="center"
|
||||
prop="inCount"
|
||||
:formatter="erpCountTableColumnFormatter"
|
||||
|
@ -43,7 +43,18 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联订单" prop="orderNo">
|
||||
<el-input v-model="formData.orderNo" readonly>
|
||||
<template #append>
|
||||
<el-button @click="openSaleOrderOutEnableList">
|
||||
<Icon icon="ep:search" /> 选择
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
@ -133,6 +144,9 @@
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<!-- 可出库的订单列表 -->
|
||||
<SaleOrderOutEnableList ref="saleOrderOutEnableListRef" @success="handleSaleOrderChange" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { SaleOutApi, SaleOutVO } from '@/api/erp/sale/out'
|
||||
@ -140,6 +154,8 @@ import SaleOutItemForm from './components/SaleOutItemForm.vue'
|
||||
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'
|
||||
|
||||
/** ERP 销售出库表单 */
|
||||
defineOptions({ name: 'SaleOutForm' })
|
||||
@ -162,6 +178,7 @@ const formData = ref({
|
||||
discountPrice: 0,
|
||||
totalPrice: 0,
|
||||
depositPrice: 0,
|
||||
orderNo: undefined,
|
||||
items: [],
|
||||
no: undefined // 出库单号,后端返回
|
||||
})
|
||||
@ -217,9 +234,33 @@ const open = async (type: string, id?: number) => {
|
||||
if (defaultAccount) {
|
||||
formData.value.accountId = defaultAccount.id
|
||||
}
|
||||
|
||||
// TODO 芋艿:单独搞
|
||||
// saleOrderOutEnableListRef.value.open()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 打开【可出库的订单列表】弹窗 */
|
||||
const saleOrderOutEnableListRef = ref() // 可出库的订单列表 Ref
|
||||
const openSaleOrderOutEnableList = () => {
|
||||
saleOrderOutEnableListRef.value.open()
|
||||
}
|
||||
|
||||
const handleSaleOrderChange = (order: SaleOrderVO) => {
|
||||
debugger
|
||||
formData.value.orderNo = order.no
|
||||
// formData.value.customerId = order.customerId
|
||||
// formData.value.accountId = order.accountId
|
||||
// formData.value.items = order.items.map((item) => {
|
||||
// return {
|
||||
// productId: item.productId,
|
||||
// count: item.count,
|
||||
// productPrice: item.productPrice,
|
||||
// taxPercent: item.taxPercent
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user