Skip to content

Commit c0db4df

Browse files
committed
✨ ERP:增加 ERP 可出库订单列表
1 parent e535384 commit c0db4df

File tree

3 files changed

+249
-2
lines changed

3 files changed

+249
-2
lines changed
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
<!-- 可出库的订单列表 -->
2+
<template>
3+
<Dialog
4+
title="选择销售订单(仅展示可出库)"
5+
v-model="dialogVisible"
6+
:appendToBody="true"
7+
:scroll="true"
8+
width="1080"
9+
>
10+
<ContentWrap>
11+
<!-- 搜索工作栏 -->
12+
<el-form
13+
class="-mb-15px"
14+
:model="queryParams"
15+
ref="queryFormRef"
16+
:inline="true"
17+
label-width="68px"
18+
>
19+
<el-form-item label="订单单号" prop="no">
20+
<el-input
21+
v-model="queryParams.no"
22+
placeholder="请输入订单单号"
23+
clearable
24+
@keyup.enter="handleQuery"
25+
class="!w-160px"
26+
/>
27+
</el-form-item>
28+
<el-form-item label="产品" prop="productId">
29+
<el-select
30+
v-model="queryParams.productId"
31+
clearable
32+
filterable
33+
placeholder="请选择产品"
34+
class="!w-160px"
35+
>
36+
<el-option
37+
v-for="item in productList"
38+
:key="item.id"
39+
:label="item.name"
40+
:value="item.id"
41+
/>
42+
</el-select>
43+
</el-form-item>
44+
<el-form-item label="订单时间" prop="orderTime">
45+
<el-date-picker
46+
v-model="queryParams.orderTime"
47+
value-format="YYYY-MM-DD HH:mm:ss"
48+
type="daterange"
49+
start-placeholder="开始日期"
50+
end-placeholder="结束日期"
51+
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
52+
class="!w-160px"
53+
/>
54+
</el-form-item>
55+
<el-form-item>
56+
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
57+
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
58+
</el-form-item>
59+
</el-form>
60+
</ContentWrap>
61+
62+
<ContentWrap>
63+
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
64+
<el-table-column align="center" width="65">
65+
<template #default="scope">
66+
<el-radio
67+
:label="scope.row.id"
68+
v-model="currentRowValue"
69+
@change="handleCurrentChange(scope.row)"
70+
>
71+
&nbsp;
72+
</el-radio>
73+
</template>
74+
</el-table-column>
75+
<el-table-column min-width="180" label="订单单号" align="center" prop="no" />
76+
<el-table-column label="客户" align="center" prop="customerName" />
77+
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
78+
<el-table-column
79+
label="订单时间"
80+
align="center"
81+
prop="orderTime"
82+
:formatter="dateFormatter2"
83+
width="120px"
84+
/>
85+
<el-table-column label="创建人" align="center" prop="creatorName" />
86+
<el-table-column
87+
label="总数量"
88+
align="center"
89+
prop="totalCount"
90+
:formatter="erpCountTableColumnFormatter"
91+
/>
92+
<el-table-column
93+
label="出库数量"
94+
align="center"
95+
prop="inCount"
96+
:formatter="erpCountTableColumnFormatter"
97+
/>
98+
<el-table-column
99+
label="金额合计"
100+
align="center"
101+
prop="totalProductPrice"
102+
:formatter="erpPriceTableColumnFormatter"
103+
/>
104+
<el-table-column
105+
label="含税金额"
106+
align="center"
107+
prop="totalPrice"
108+
:formatter="erpPriceTableColumnFormatter"
109+
/>
110+
</el-table>
111+
<!-- 分页 -->
112+
<Pagination
113+
v-model:limit="queryParams.pageSize"
114+
v-model:page="queryParams.pageNo"
115+
:total="total"
116+
@pagination="getList"
117+
/>
118+
</ContentWrap>
119+
<template #footer>
120+
<el-button :disabled="!currentRow" type="primary" @click="submitForm">确 定</el-button>
121+
<el-button @click="dialogVisible = false">取 消</el-button>
122+
</template>
123+
</Dialog>
124+
</template>
125+
126+
<script lang="ts" setup>
127+
import { ElTable } from 'element-plus'
128+
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
129+
import { dateFormatter2 } from '@/utils/formatTime'
130+
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
131+
import { ProductApi, ProductVO } from '@/api/erp/product/product'
132+
133+
defineOptions({ name: 'ErpSaleOrderOutEnableList' })
134+
135+
const list = ref<SaleOrderVO[]>([]) // 列表的数据
136+
const total = ref(0) // 列表的总页数
137+
const loading = ref(false) // 列表的加载中
138+
const dialogVisible = ref(false) // 弹窗的是否展示
139+
const queryParams = reactive({
140+
pageNo: 1,
141+
pageSize: 10,
142+
no: undefined,
143+
productId: undefined,
144+
orderTime: [],
145+
outEnable: true
146+
})
147+
const queryFormRef = ref() // 搜索的表单
148+
const productList = ref<ProductVO[]>([]) // 产品列表
149+
150+
/** 选中行 */
151+
const currentRowValue = ref(undefined) // 选中行的 value
152+
const currentRow = ref(undefined) // 选中行
153+
const handleCurrentChange = (row) => {
154+
currentRow.value = row
155+
}
156+
157+
/** 打开弹窗 */
158+
const open = async () => {
159+
dialogVisible.value = true
160+
await nextTick() // 等待,避免 queryFormRef 为空
161+
// 加载可出库的订单列表
162+
await resetQuery()
163+
// 加载产品列表
164+
productList.value = await ProductApi.getProductSimpleList()
165+
}
166+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
167+
168+
/** 提交选择 */
169+
const emits = defineEmits<{
170+
(e: 'success', value: SaleOrderVO): void
171+
}>()
172+
const submitForm = () => {
173+
try {
174+
emits('success', currentRow.value)
175+
} finally {
176+
// 关闭弹窗
177+
dialogVisible.value = false
178+
}
179+
}
180+
181+
/** 加载列表 */
182+
const getList = async () => {
183+
loading.value = true
184+
try {
185+
const data = await SaleOrderApi.getSaleOrderPage(queryParams)
186+
list.value = data.list
187+
total.value = data.total
188+
} finally {
189+
loading.value = false
190+
}
191+
}
192+
193+
/** 重置按钮操作 */
194+
const resetQuery = () => {
195+
queryFormRef.value.resetFields()
196+
handleQuery()
197+
}
198+
199+
/** 搜索按钮操作 */
200+
const handleQuery = () => {
201+
queryParams.pageNo = 1
202+
currentRowValue.value = undefined
203+
currentRow.value = undefined
204+
getList()
205+
}
206+
</script>

src/views/erp/sale/order/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
:formatter="erpCountTableColumnFormatter"
181181
/>
182182
<el-table-column
183-
label="入库数量"
183+
label="出库数量"
184184
align="center"
185185
prop="inCount"
186186
:formatter="erpCountTableColumnFormatter"

src/views/erp/sale/out/SaleOutForm.vue

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,18 @@
4343
</el-select>
4444
</el-form-item>
4545
</el-col>
46-
<el-col :span="16">
46+
<el-col :span="8">
47+
<el-form-item label="关联订单" prop="orderNo">
48+
<el-input v-model="formData.orderNo" readonly>
49+
<template #append>
50+
<el-button @click="openSaleOrderOutEnableList">
51+
<Icon icon="ep:search" /> 选择
52+
</el-button>
53+
</template>
54+
</el-input>
55+
</el-form-item>
56+
</el-col>
57+
<el-col :span="8">
4758
<el-form-item label="备注" prop="remark">
4859
<el-input
4960
type="textarea"
@@ -133,13 +144,18 @@
133144
<el-button @click="dialogVisible = false">取 消</el-button>
134145
</template>
135146
</Dialog>
147+
148+
<!-- 可出库的订单列表 -->
149+
<SaleOrderOutEnableList ref="saleOrderOutEnableListRef" @success="handleSaleOrderChange" />
136150
</template>
137151
<script setup lang="ts">
138152
import { SaleOutApi, SaleOutVO } from '@/api/erp/sale/out'
139153
import SaleOutItemForm from './components/SaleOutItemForm.vue'
140154
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
141155
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
142156
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
157+
import SaleOrderOutEnableList from '@/views/erp/sale/order/components/SaleOrderOutEnableList.vue'
158+
import { SaleOrderVO } from '@/api/erp/sale/order'
143159
144160
/** ERP 销售出库表单 */
145161
defineOptions({ name: 'SaleOutForm' })
@@ -162,6 +178,7 @@ const formData = ref({
162178
discountPrice: 0,
163179
totalPrice: 0,
164180
depositPrice: 0,
181+
orderNo: undefined,
165182
items: [],
166183
no: undefined // 出库单号,后端返回
167184
})
@@ -217,9 +234,33 @@ const open = async (type: string, id?: number) => {
217234
if (defaultAccount) {
218235
formData.value.accountId = defaultAccount.id
219236
}
237+
238+
// TODO 芋艿:单独搞
239+
// saleOrderOutEnableListRef.value.open()
220240
}
221241
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
222242
243+
/** 打开【可出库的订单列表】弹窗 */
244+
const saleOrderOutEnableListRef = ref() // 可出库的订单列表 Ref
245+
const openSaleOrderOutEnableList = () => {
246+
saleOrderOutEnableListRef.value.open()
247+
}
248+
249+
const handleSaleOrderChange = (order: SaleOrderVO) => {
250+
debugger
251+
formData.value.orderNo = order.no
252+
// formData.value.customerId = order.customerId
253+
// formData.value.accountId = order.accountId
254+
// formData.value.items = order.items.map((item) => {
255+
// return {
256+
// productId: item.productId,
257+
// count: item.count,
258+
// productPrice: item.productPrice,
259+
// taxPercent: item.taxPercent
260+
// }
261+
// })
262+
}
263+
223264
/** 提交表单 */
224265
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
225266
const submitForm = async () => {

0 commit comments

Comments
 (0)