|
|
@@ -11,15 +11,15 @@
|
|
|
</div>
|
|
|
</slot>
|
|
|
</Toptitle>
|
|
|
+ <div style="height:82%;over-flow:auto">
|
|
|
<div class="warehouseList_top">
|
|
|
<Form :label-width="100">
|
|
|
<FormItem label="物料名称:">
|
|
|
- <Select v-model="searchData.warehouse_id"
|
|
|
+ <Select @on-change='selectMaterial'
|
|
|
clearable
|
|
|
- multiple
|
|
|
filterable
|
|
|
style="width:200px">
|
|
|
- <Option v-for="item in warehouseList"
|
|
|
+ <Option v-for="item in materialNameList"
|
|
|
:key="item.id"
|
|
|
:value="item.id"
|
|
|
:label="item.title">
|
|
|
@@ -28,12 +28,12 @@
|
|
|
</FormItem>
|
|
|
|
|
|
<FormItem label="规格型号:">
|
|
|
- <Select v-model="searchData.material_id"
|
|
|
+ <Select v-model="searchData.material_detail_id"
|
|
|
clearable
|
|
|
- multiple
|
|
|
+ :disabled='material_size'
|
|
|
filterable
|
|
|
style="width:200px">
|
|
|
- <Option v-for="item in materialNameList"
|
|
|
+ <Option v-for="item in materialSizeList"
|
|
|
:key="item.id"
|
|
|
:value="item.id"
|
|
|
:label="item.title">
|
|
|
@@ -44,8 +44,8 @@
|
|
|
<span>原材料仓</span>
|
|
|
</FormItem>
|
|
|
<FormItem label='仓库名称'>
|
|
|
- <Select>
|
|
|
- <Option/>
|
|
|
+ <Select v-model="searchData.warehouse_id" filterable multiple>
|
|
|
+ <Option v-for="item in warehouseList" :key="item.id" :value="item.id" :label="item.title"/>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
<FormItem label="选择时间">
|
|
|
@@ -76,13 +76,13 @@
|
|
|
</Table> -->
|
|
|
<vxe-table border
|
|
|
resizable
|
|
|
- max-height="500"
|
|
|
+ max-height="550"
|
|
|
align="center"
|
|
|
:merge-cells="mergeCells"
|
|
|
:data="tableData">
|
|
|
<vxe-table-column field="crt_time"
|
|
|
title="单据日期"
|
|
|
- min-width="110">
|
|
|
+ min-width="122">
|
|
|
<template #default="{ row }">
|
|
|
{{ (row.crt_time*1)? func.replaceDate(row.crt_time+'') :row.crt_time}}
|
|
|
</template>
|
|
|
@@ -92,23 +92,23 @@
|
|
|
title="单据号"></vxe-table-column>
|
|
|
<vxe-table-column field="warehouse_title"
|
|
|
title="仓库"
|
|
|
- min-width="60"></vxe-table-column>
|
|
|
+ min-width="65"></vxe-table-column>
|
|
|
<vxe-table-column field="type"
|
|
|
title="单据类型"
|
|
|
min-width="80">
|
|
|
<template #default="{ row }">
|
|
|
- {{(row.type==1?'入库单':'出库单')}}
|
|
|
+ {{(row.type==1||row.type==3?'入库单':'出库单')}}
|
|
|
</template>
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column field="in_num"
|
|
|
- min-width="100"
|
|
|
+ min-width="90"
|
|
|
title="入库数量"></vxe-table-column>
|
|
|
<vxe-table-column field="in_price"
|
|
|
- min-width="100"
|
|
|
+ min-width="105"
|
|
|
title="入库单价">
|
|
|
- <template #default="{ row }">
|
|
|
+ <!-- <template #default="{ row }">
|
|
|
{{(row.in_total_price&&row.in_total_price!=0)&&(row.in_num!=0?1 * row.in_total_price / row.in_num:0)}}
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column field="in_total_price"
|
|
|
min-width="100"
|
|
|
@@ -117,14 +117,14 @@
|
|
|
min-width="100"
|
|
|
title="出库数量"></vxe-table-column>
|
|
|
<vxe-table-column field="out_price"
|
|
|
- min-width="100"
|
|
|
+ min-width="105"
|
|
|
title="出库单价">
|
|
|
- <template #default="{ row }">
|
|
|
+ <!-- <template #default="{ row }">
|
|
|
{{(row.out_total_price&&row.out_total_price!=0)&&(row.out_num!=0?1 * row.out_total_price / row.out_num:0)}}
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column field="out_total_price"
|
|
|
- min-width="100"
|
|
|
+ min-width="105"
|
|
|
title="出库金额"></vxe-table-column>
|
|
|
<vxe-table-column field="before_num"
|
|
|
min-width="100"
|
|
|
@@ -132,24 +132,26 @@
|
|
|
<vxe-table-column field="before_price"
|
|
|
min-width="100"
|
|
|
title="结存单价">
|
|
|
- <template #default="{ row }">
|
|
|
+ <!-- <template #default="{ row }">
|
|
|
{{ row.before_num != 0 ? 1 * row.before_total_price / row.before_num : 0 }}
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
</vxe-table-column>
|
|
|
<vxe-table-column field="before_total_price"
|
|
|
min-width="100"
|
|
|
title="结存金额"></vxe-table-column>
|
|
|
<vxe-table-column field=""
|
|
|
- min-width="100"
|
|
|
+ width="100"
|
|
|
title="操作">
|
|
|
<template #default="{ row }">
|
|
|
<a style="margin:0 5px"
|
|
|
v-show="row.crt_time*1"
|
|
|
- @click="handleSet(row,1)">详情</a>
|
|
|
+ @click="handleSet(row)">详情</a>
|
|
|
</template>
|
|
|
</vxe-table-column>
|
|
|
|
|
|
</vxe-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="pageSlotStyle">
|
|
|
<Page :page-size-opts="[10, 20, 30, 40,100,1000]"
|
|
|
@on-page-size-change='changeSize'
|
|
|
@@ -160,7 +162,7 @@
|
|
|
show-sizer
|
|
|
:page-size='page_size' />
|
|
|
</div>
|
|
|
- </div>
|
|
|
+
|
|
|
<Modal v-model="processModal"
|
|
|
title="编辑"
|
|
|
@on-ok="handleProcess"
|
|
|
@@ -214,56 +216,57 @@ export default {
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
+ material_size:true,
|
|
|
+ materialSizeList:[],
|
|
|
searchData: {
|
|
|
+ material_detail_id:null,
|
|
|
warehouse_id: null,
|
|
|
- material_type_id: null,
|
|
|
- material_id: null,
|
|
|
date: null,
|
|
|
start_time: null,
|
|
|
end_time: null,
|
|
|
},
|
|
|
- tableColums: [
|
|
|
- {
|
|
|
- title: '单据日期', align: 'center', key: 'crt_time', minWidth: 150,
|
|
|
- render: (h, params) => {
|
|
|
- return h('span', {}, this.func.replaceDate(params.row.crt_time))
|
|
|
- }
|
|
|
- },
|
|
|
- { title: '单据号', align: 'center', key: 'order_no', minWidth: 120 },
|
|
|
- { title: '仓库', align: 'center', key: 'warehouse_title', minWidth: 100 },
|
|
|
- { title: '单据类型', align: 'center', key: 'type', minWidth: 100 },
|
|
|
- { title: '入库数量', align: 'center', key: 'in_num', minWidth: 100, },
|
|
|
- {
|
|
|
- title: '入库单价', align: 'center', key: '', minWidth: 100,
|
|
|
- render: (h, params) => {
|
|
|
- const { row } = params
|
|
|
- let text = row.in_num != 0 ? 1 * row.in_total_price / row.in_num : 0
|
|
|
- return h('span', {}, text)
|
|
|
- }
|
|
|
- },
|
|
|
- { title: '入库金额', align: 'center', key: 'in_total_price', minWidth: 100 },
|
|
|
- { title: '出库数量', align: 'center', key: 'out_num', minWidth: 100, },
|
|
|
- {
|
|
|
- title: '出库单价', align: 'center', key: '', minWidth: 100,
|
|
|
- render: (h, params) => {
|
|
|
- const { row } = params
|
|
|
- let text = row.out_num != 0 ? 1 * row.out_total_price / row.out_num : 0
|
|
|
- return h('span', {}, text)
|
|
|
- }
|
|
|
- },
|
|
|
- { title: '出库金额', align: 'center', key: 'out_total_price', minWidth: 100 },
|
|
|
- { title: '结存数量', align: 'center', key: 'before_num', minWidth: 100, },
|
|
|
- {
|
|
|
- title: '结存单价', align: 'center', key: '', minWidth: 100,
|
|
|
- render: (h, params) => {
|
|
|
- const { row } = params
|
|
|
- let text = row.before_num != 0 ? 1 * row.before_total_price / row.before_num : 0
|
|
|
- return h('span', {}, text)
|
|
|
- }
|
|
|
- },
|
|
|
- { title: '结存金额', align: 'center', key: 'before_total_price', minWidth: 100 },
|
|
|
- { title: '操作', align: 'center', key: 'set', slot: 'set', fixed: 'right', minWidth: 100 },
|
|
|
- ],
|
|
|
+ // tableColums: [
|
|
|
+ // {
|
|
|
+ // title: '单据日期', align: 'center', key: 'crt_time', minWidth: 150,
|
|
|
+ // render: (h, params) => {
|
|
|
+ // return h('span', {}, this.func.replaceDate(params.row.crt_time))
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // { title: '单据号', align: 'center', key: 'order_no', minWidth: 120 },
|
|
|
+ // { title: '仓库', align: 'center', key: 'warehouse_title', minWidth: 100 },
|
|
|
+ // { title: '单据类型', align: 'center', key: 'type', minWidth: 100 },
|
|
|
+ // { title: '入库数量', align: 'center', key: 'in_num', minWidth: 100, },
|
|
|
+ // {
|
|
|
+ // title: '入库单价', align: 'center', key: '', minWidth: 100,
|
|
|
+ // render: (h, params) => {
|
|
|
+ // const { row } = params
|
|
|
+ // let text = row.in_num != 0 ? 1 * row.in_total_price / row.in_num : 0
|
|
|
+ // return h('span', {}, text)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // { title: '入库金额', align: 'center', key: 'in_total_price', minWidth: 100 },
|
|
|
+ // { title: '出库数量', align: 'center', key: 'out_num', minWidth: 100, },
|
|
|
+ // {
|
|
|
+ // title: '出库单价', align: 'center', key: '', minWidth: 100,
|
|
|
+ // render: (h, params) => {
|
|
|
+ // const { row } = params
|
|
|
+ // let text = row.out_num != 0 ? 1 * row.out_total_price / row.out_num : 0
|
|
|
+ // return h('span', {}, text)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // { title: '出库金额', align: 'center', key: 'out_total_price', minWidth: 100 },
|
|
|
+ // { title: '结存数量', align: 'center', key: 'before_num', minWidth: 100, },
|
|
|
+ // {
|
|
|
+ // title: '结存单价', align: 'center', key: '', minWidth: 100,
|
|
|
+ // render: (h, params) => {
|
|
|
+ // const { row } = params
|
|
|
+ // let text = row.before_num != 0 ? 1 * row.before_total_price / row.before_num : 0
|
|
|
+ // return h('span', {}, text)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // { title: '结存金额', align: 'center', key: 'before_total_price', minWidth: 100 },
|
|
|
+ // { title: '操作', align: 'center', key: 'set', slot: 'set', fixed: 'right', minWidth: 100 },
|
|
|
+ // ],
|
|
|
tableData: [],
|
|
|
page_index: 1,
|
|
|
page_size: 10,
|
|
|
@@ -286,16 +289,44 @@ export default {
|
|
|
this.page_index = 1
|
|
|
this.proxyObj.page_index = this.page_index;
|
|
|
this.proxyObj.page_size = this.page_size;
|
|
|
- this.getData(this.proxyObj)
|
|
|
+ // this.getData(this.proxyObj)
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if (to.path == "/cms/PurchasingManage/InstockOrder/detail"||to.path == "/cms/PurchasingManage/redFontInstockOrder/detail"||to.path == "/cms/PurchasingManage/OutstockOrder/detail"||to.path == "/cms/PurchasingManage/redFontOutstockOrder/detail") {
|
|
|
+ console.log(11212)
|
|
|
+ this.$route.meta.keepAlive = true;
|
|
|
+ } else {
|
|
|
+ this.$route.meta.keepAlive = false;
|
|
|
+ }
|
|
|
+ next();
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
created () {
|
|
|
// 获取仓库列表 warehouse_id
|
|
|
- this.axios('/api/warehouse').then(res => { this.warehouseList = res.data })
|
|
|
+ this.axios('/api/warehouse').then(res => {
|
|
|
+ this.warehouseList = res.data.filter(v=>{
|
|
|
+ return v.type_id ==1
|
|
|
+ })
|
|
|
+ })
|
|
|
// 获取物料名称列表
|
|
|
this.axios('/api/material').then(res => { this.materialNameList = res.data.data })
|
|
|
},
|
|
|
methods: {
|
|
|
+ selectMaterial(e){
|
|
|
+ if(e){
|
|
|
+ this.axios.get('/api/material',{params:{id:e}}).then(res=>{
|
|
|
+ this.materialSizeList = res.data[0].detail;
|
|
|
+ this.materialSizeList.forEach(v=>{
|
|
|
+ v.title = `${v.long?v.long:0}*${v.width?v.width:0}*${v.high?v.high:0}`
|
|
|
+ })
|
|
|
+ this.material_size = false;
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.searchData.material_detail_id = '';
|
|
|
+ this.material_size = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
handleProcess () {
|
|
|
this.axios({
|
|
|
method: 'post',
|
|
|
@@ -309,32 +340,39 @@ export default {
|
|
|
}).catch((err) => { });
|
|
|
},
|
|
|
handleSearchData () {
|
|
|
+ if(!this.searchData.material_detail_id){
|
|
|
+ return this.$Message.warning('请先选择物料名称和规格!')
|
|
|
+ }
|
|
|
+ if(!this.searchData.date[0]&&!this.searchData.date[1]){
|
|
|
+ return this.$Message.warning('请选择时间!')
|
|
|
+ }
|
|
|
let obj = {
|
|
|
warehouse_id: this.searchData.warehouse_id ? this.searchData.warehouse_id.join(',') : null,
|
|
|
- material_type_id: this.searchData.material_type_id ? this.searchData.material_type_id.join(',') : null,
|
|
|
- material_id: this.searchData.material_id ? this.searchData.material_id.join(',') : null,
|
|
|
- start_time: this.searchData.date[0] ? this.func.replaceDateNoHMS(this.searchData.date[0]) : null,
|
|
|
- end_time: this.searchData.date[0] ? this.func.replaceDateNoHMS(this.searchData.date[1]) : null,
|
|
|
+ material_detail_id: this.searchData.material_detail_id ? this.searchData.material_detail_id : null,
|
|
|
+ start_time: this.searchData.date[0] ? Date.parse(this.searchData.date[0]).toString().slice(0,10) : 0,
|
|
|
+ end_time: this.searchData.date[1] ? Date.parse(this.searchData.date[1]).toString().slice(0,10) : 0,
|
|
|
page_index: this.page_index,
|
|
|
page_size: this.page_size,
|
|
|
}
|
|
|
+ this.proxyObj = obj;
|
|
|
this.getData(obj)
|
|
|
},
|
|
|
handleSelectionChange (selection) { this.submitData = selection },
|
|
|
//审核、弃审 2编辑
|
|
|
- handleSet (row, type) {
|
|
|
- switch (type) {
|
|
|
- case 1:
|
|
|
- // 1入库 2出库
|
|
|
- this.$router.push({
|
|
|
- path: '/cms/Warehouse/Warehouse/stockingTableEdit',
|
|
|
- query: {
|
|
|
- type: row.type,
|
|
|
- order_no: row.order_no
|
|
|
- }
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
+ handleSet (row) {
|
|
|
+ // 1入库2红字入库3出库4红字出库
|
|
|
+ if(row.type == 1){
|
|
|
+ this.$router.push({path:'/cms/PurchasingManage/InstockOrder/detail',query:{order_in_no:row.order_no}})
|
|
|
+ }
|
|
|
+ if(row.type == 2){
|
|
|
+ this.$router.push({path:'/cms/PurchasingManage/redFontInstockOrder/detail',query:{order_red_no:row.order_no}})
|
|
|
+ }
|
|
|
+ if(row.type == 3){
|
|
|
+ this.$router.push({path:'/cms/PurchasingManage/OutstockOrder/detail',query:{order_out_no:row.order_no}})
|
|
|
+ }
|
|
|
+ if(row.type == 4){
|
|
|
+ this.$router.push({path:'/cms/PurchasingManage/redFontOutstockOrder/detail',query:{order_red_no:row.order_no}})
|
|
|
+ }
|
|
|
},
|
|
|
init (row) {
|
|
|
this.page_index = 1
|
|
|
@@ -346,36 +384,68 @@ export default {
|
|
|
getData (row) {
|
|
|
this.loading = true;
|
|
|
this.axios('/api/warehouse_stock_detail', { params: row }).then(res => {
|
|
|
+ if(res.code == 200){
|
|
|
+ this.tableData = [];
|
|
|
+ this.mergeCells = [];
|
|
|
this.loading = false;
|
|
|
- res.data.list.forEach(element => {
|
|
|
- // 期初
|
|
|
- this.tableData.push({
|
|
|
- crt_time: '期初',
|
|
|
- before_num: element.before.before_num,
|
|
|
- before_total_price: element.before.before_total_price,
|
|
|
- before_price: element.before_num != 0 ? 1 * element.before.before_total_price / element.before.before_num : 0,
|
|
|
- })
|
|
|
- this.tableData = this.tableData.concat(element.list)
|
|
|
+ // 期初
|
|
|
+ res.data.data.forEach(element => {
|
|
|
+ element.before_num = element.remain_num;
|
|
|
+ element.before_total_price = (element.remain_price*1).toFixed(2);
|
|
|
+ element.before_price = ((element.remain_price*1)/(element.remain_num*1)).toFixed(2);
|
|
|
+ if(element.type==1||element.type==3){
|
|
|
+ element.in_num = element.num;
|
|
|
+ element.in_price = (element.price*1).toFixed(2);
|
|
|
+ element.in_total_price = (element.num*1*element.price).toFixed(2);
|
|
|
+ }
|
|
|
+ if(element.type == 2||element.type == 4){
|
|
|
+ element.out_num = element.num;
|
|
|
+ element.out_price = (element.price).toFixed(2);
|
|
|
+ element.out_total_price = (element.num*1*element.price).toFixed(2);
|
|
|
+ }
|
|
|
+ if(element.type==-1){
|
|
|
+ let obj = JSON.parse(JSON.stringify(element));
|
|
|
+ element.in_num = obj.in_num;
|
|
|
+ element.in_price = obj.in_price.toFixed(2);
|
|
|
+ element.in_total_price = (obj.in_num*1*obj.in_price).toFixed(2);
|
|
|
+ element.out_num = obj.out_num;
|
|
|
+ element.out_price = obj.out_price.toFixed(2);
|
|
|
+ element.out_total_price = (obj.out_num*1*obj.out_price).toFixed(2);
|
|
|
+ element.before_num = '';
|
|
|
+ element.before_total_price = '';
|
|
|
+ element.before_price = '';
|
|
|
+ }
|
|
|
+ this.tableData = this.tableData.concat(element)
|
|
|
// 合计
|
|
|
+
|
|
|
+ });
|
|
|
this.tableData.push({
|
|
|
- crt_time: '本月合计',
|
|
|
- before_num: element.total.before_num,
|
|
|
- before_total_price: element.total.before_total_price,
|
|
|
- before_price: element.before_num != 0 ? 1 * element.total.before_total_price / element.total.before_num : 0,
|
|
|
- in_num: element.total.in_num,
|
|
|
- in_total_price: element.total.in_total_price,
|
|
|
- in_price: element.in_num != 0 ? 1 * element.total.in_total_price / element.total.in_num : 0,
|
|
|
- out_num: element.total.out_num,
|
|
|
- out_total_price: element.total.out_total_price,
|
|
|
- out_price: element.in_total_price != 0 ? 1 * element.total.out_total_price / element.total.out_num : 0,
|
|
|
+ crt_time: '合计',
|
|
|
+ type:-1,
|
|
|
+ in_num: res.data.total_data.in_num,
|
|
|
+ in_total_price: res.data.total_data.in_total_price.toFixed(2),
|
|
|
+ out_num:res.data.total_data.out_num,
|
|
|
+ out_total_price: res.data.total_data.out_total_price.toFixed(2),
|
|
|
+ })
|
|
|
+ this.tableData.unshift({
|
|
|
+ crt_time: '期初',
|
|
|
+ type:-1,
|
|
|
+ before_num: res.data.total_data.before_num,
|
|
|
+ before_total_price: res.data.total_data.before_total_price.toFixed(2),
|
|
|
+ before_price: res.data.total_data.before_num != 0 ? ((1 * res.data.total_data.before_total_price) / (res.data.total_data.before_num*1)).toFixed(2) : 0,
|
|
|
})
|
|
|
- });
|
|
|
this.tableData.forEach((element, index) => {
|
|
|
// 表内容合并
|
|
|
- !(element.crt_time * 1) && this.mergeCells.push({ row: index, col: 0, rowspan: 0, colspan: 4 })
|
|
|
+ if(element.type==-1){
|
|
|
+ this.mergeCells.push({ row: index, col: 0, rowspan: 0, colspan: 4 });
|
|
|
+ !(element.crt_time) && (element.crt_time = '本月合计');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
this.total = res.data.total;
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
changePage (e) {
|
|
|
this.page_index = e;
|
|
|
@@ -454,4 +524,7 @@ export default {
|
|
|
/deep/.ivu-table-fixed-body {
|
|
|
padding-bottom: 20px;
|
|
|
}
|
|
|
+/deep/.vxe-body--row td{
|
|
|
+ height: 50px!important;
|
|
|
+}
|
|
|
</style>
|