fix: 调整

This commit is contained in:
liubai 2022-03-27 18:36:30 +08:00
parent 750f7a2f91
commit 3ae36420fa
10 changed files with 208 additions and 23 deletions

View file

@ -55,3 +55,8 @@ export function purchasePaymentRecord(params) {
export function purchaseReturnPaymentRecord(params) {
return request({ url: `/purchase_return_collection_detials/`, method: 'get', params })
}
// 批次报表
export function batchsReportList(params) {
return request({ url: `/batchs/`, method: 'get', params })
}

View file

@ -5,6 +5,7 @@ export default [
{ key: '/report/purchase_report', name: '采购报表' },
{ key: '/report/stock_report', name: '库存报表' },
{ key: '/report/income_expense_statistics', name: '收支统计' },
{ key: '/report/batch_report', name: '批次报表' },
]
},
{

View file

@ -24,5 +24,10 @@ export default {
meta: { title: '收支统计', permission: 'income_expense_statistics' },
component: () => import('@/views/report/incomeExpenseStatistics/index'),
},
{
path: 'batch_report',
meta: { title: '批次报表', permission: 'batch_report' },
component: () => import('@/views/report/batchReport/index'),
},
],
}

View file

@ -438,7 +438,7 @@ export default {
spec: item.goods_spec,
unit: item.unit_name,
purchase_quantity: 1,
purchase_price: 0,
purchase_price: item.purchase_price,
total_quantity: item.total_quantity,
});
},

View file

@ -11,7 +11,7 @@
</a-col>
<a-col :span="6" style="width: 320px;">
<a-form-model-item prop="purchase_order" label="采购单据">
<a-select v-model="form.purchase_order" style="width: 100%">
<a-select v-model="form.purchase_order" @change="changeRelatedOrder" style="width: 100%">
<a-select-option v-for="item in purchaseOrdersItems" :key="item.id" :value="item.id">
{{ item.number }}
</a-select-option>
@ -396,6 +396,15 @@ export default {
this.accountsItems = data.results;
});
},
changeRelatedOrder(value, option) {
let selected = this.purchaseOrdersItems.filter(item => item.id == value)[0];
this.form.supplier = selected.supplier;
this.form.warehouse = selected.warehouse;
this.form.handler = selected.handler;
selected.purchase_goods_items.map(item => {
this.onSelectMaterial({...item, ...{ goods_spec: item.goods_spec || '', total_quantity: item.total_amount }})
})
},
handelAddAcount() {
this.purchase_return_account_items.push({
id: this.purchase_return_account_items.length + 1,
@ -426,7 +435,7 @@ export default {
this.materialsSelectModalVisible = true;
},
onSelectMaterial(item) {
let index = this.materialItems.findIndex((_item) => _item.id == item.id);
let index = this.materialItems.findIndex((_item) => _item.goods == item.goods);
if (index != -1) {
this.$message.warn("产品已存在");
return;
@ -439,7 +448,7 @@ export default {
spec: item.goods_spec,
unit: item.unit_name,
return_quantity: 1,
return_price: 0,
return_price: item.purchase_price,
total_quantity: item.total_quantity,
});
},
@ -491,11 +500,21 @@ export default {
// }),
purchase_return_account_items,
purchase_return_goods_items: this.materialItems.map((item) => {
if (this.form.purchase_order) {
return {
purchase_goods: item.id,
goods: item.goods,
return_quantity: item.return_quantity,
return_price: item.return_price,
};
} else {
return {
goods: item.goods,
return_quantity: item.return_quantity,
return_price: item.return_price,
};
}
}),
};
console.log(formData);

View file

@ -0,0 +1,136 @@
<template>
<div>
<a-card title="客户">
<a-row gutter="16">
<a-col :span="24" :md="6" :xl="4" style="max-width: 256px; margin-bottom: 12px;">
<a-input-search v-model="searchForm.search" placeholder="商品编号/名称" allowClear @search="search" />
</a-col>
<a-col :span="24" :md="8" :xl="6" style="max-width: 256px; margin-bottom: 12px;">
<a-select v-model="searchForm.warehouse" placeholder="仓库" allowClear style="width: 100%;" @change="search">
<a-select-option v-for="item in warehouseItems" :key="item.id" :value="item.id">{{item.name}}
</a-select-option>
</a-select>
</a-col>
<a-col :span="24" :md="8" :xl="6" style="max-width: 256px; margin-bottom: 12px;">
<a-select v-model="searchForm.has_stock" placeholder="库存状态" allowClear style="width: 100%;" @change="search">
<a-select-option :value="true">有库存</a-select-option>
<a-select-option :value="false">无库存</a-select-option>
</a-select>
</a-col>
</a-row>
<a-row style="margin-top: 12px;">
<a-table
size="small"
:columns="columns"
:dataSource="items"
rowKey="id"
:loading="loading"
:pagination="pagination"
@change="tableChange"
>
<div slot="is_active" slot-scope="value">
<a-tag :color="value ? 'green' : 'red'">{{ value ? "激活" : "冻结" }}</a-tag>
</div>
</a-table>
</a-row>
</a-card>
</div>
</template>
<script>
import { warehousesOption } from '@/api/option'
import { batchsReportList, } from '@/api/report'
export default {
name: "Warehouse",
components: {
},
data() {
return {
columns: [
{
title: "序号",
dataIndex: "index",
key: "index",
width: 60,
customRender: (value, item, index) => {
return index + 1;
},
},
{
title: "编号",
dataIndex: "number",
},
{
title: "批次数量",
dataIndex: "total_quantity",
},
{
title: "批次剩余数量",
dataIndex: "remain_quantity",
},
{
title: "商品编号",
dataIndex: "goods_number",
},
{
title: "商品名称",
dataIndex: "goods_name",
sorter: true,
},
{
title: "仓库",
dataIndex: "warehouse_name",
},
{
title: "仓库编号",
dataIndex: "warehouse_number",
},
{
title: "库存状态",
dataIndex: "has_stock",
customRender: (value, item, index) => {
return item.has_stock ? '有' : '无'
},
},
],
searchForm: { search: "", page: 1, page_size: 15 },
pagination: { current: 1, total: 0, pageSize: 15 },
loading: false,
items: [],
};
},
computed: {},
methods: {
initialize() {
this.list();
},
list() {
this.loading = true;
batchsReportList(this.searchForm)
.then((data) => {
this.pagination.total = data.count;
this.items = data.results;
})
.finally(() => {
this.loading = false;
});
},
search() {
this.searchForm.page = 1;
this.pagination.current = 1;
this.list();
},
tableChange(pagination, filters, sorter) {
this.searchForm.page = pagination.current;
this.pagination.current = pagination.current;
this.searchForm.ordering = `${sorter.order == "descend" ? "-" : ""}${sorter.field}`;
this.list();
},
},
mounted() {
this.initialize();
},
};
</script>

View file

@ -23,7 +23,12 @@
</a-row>
<a-row style="margin-top: 12px;">
<a-table size="small" :columns="columns" :dataSource="items" rowKey="id" :loading="loading" :pagination="pagination"
<a-table size="small"
rowKey="id"
:columns="columns"
:dataSource="items"
:loading="loading"
:pagination="pagination"
@change="tableChange">
</a-table>
</a-row>
@ -122,6 +127,7 @@
});
},
tableChange(pagination, filters, sorter) {
console.log(pagination)
this.searchForm.page = pagination.current;
this.pagination.current = pagination.current;
this.searchForm.ordering = `${sorter.order == 'descend' ? '-' : ''}${sorter.field}`;

View file

@ -431,7 +431,7 @@ export default {
spec: item.goods_spec,
unit: item.unit_name,
sales_quantity: 1,
sales_price: 1,
sales_price: item.retail_price,
totalAmount: 1,
});

View file

@ -11,7 +11,7 @@
</a-col>
<a-col :span="6" style="width: 320px;">
<a-form-model-item prop="sales_order" label="销售单据">
<a-select v-model="form.sales_order" style="width: 100%">
<a-select v-model="form.sales_order" @change="changeRelatedOrder" style="width: 100%">
<a-select-option v-for="item in saleOrdersItems" :key="item.id" :value="item.id">
{{ item.number }}
</a-select-option>
@ -411,6 +411,15 @@
this.accountsItems = data.results;
});
},
changeRelatedOrder(value, option) {
let selected = this.saleOrdersItems.filter(item => item.id == value)[0];
this.form.client = selected.client;
this.form.warehouse = selected.warehouse;
this.form.handler = selected.handler;
selected.sales_goods_items.map(item => {
this.onSelectMaterial({...item, ...{ goods_spec: item.goods_spec || '', retail_price: item.sales_price }})
})
},
handelAddAcount() {
this.sales_return_account_items.push({
id: this.sales_return_account_items.length + 1,
@ -438,7 +447,7 @@
this.materialsSelectModalVisible = true;
},
onSelectMaterial(item) {
let index = this.materialItems.findIndex(_item => _item.id == item.id);
let index = this.materialItems.findIndex(_item => _item.goods == item.goods);
if (index != -1) {
this.$message.warn('产品已存在');
return
@ -451,7 +460,7 @@
spec: item.goods_spec,
unit: item.unit_name,
return_quantity: 1,
return_price: 1,
return_price: item.retail_price,
totalAmount: 1
});
},
@ -503,11 +512,20 @@
// }),
sales_return_account_items,
sales_return_goods_items: this.materialItems.map(item => {
if (this.form.sales_order) {
return {
sales_goods: item.id,
goods: item.goods,
return_quantity: item.return_quantity,
return_price: item.return_price,
}
} else {
return {
goods: item.goods,
return_quantity: item.return_quantity,
return_price: item.return_price,
}
}
})
};
saleReturnOrderCreate(formData).then(data => {

View file

@ -67,11 +67,6 @@
title: '处理日期',
dataIndex: 'handle_time',
},
{
title: '处理日期',
dataIndex: 'create_time',
width: 170
},
{
title: '备注',
dataIndex: 'remark'