批量入库,批量出库

This commit is contained in:
ljx 2024-08-01 15:02:39 +08:00
parent 201b4f0687
commit 8008af6a9f
3 changed files with 560 additions and 124 deletions

View File

@ -24,6 +24,10 @@
<template #buttons> <template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()" v-if="options.disabledDelete !== true">批量删除 <a-button type="primary" icon="delete" @click="pageDelete()" v-if="options.disabledDelete !== true">批量删除
</a-button> </a-button>
<a-button style="margin-left: 5px;" type="primary" icon="plus" @click="pageShowAddMore" v-if="options.needAddMore == true">批量入库
</a-button>
<a-button style="margin-left: 5px;" type="primary" icon="minus" @click="pageShowRemoveMore" v-if="options.needAddMore == true">批量出库
</a-button>
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint" <a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint"
@click="pagePrint()">打印 @click="pagePrint()">打印
</a-button> </a-button>
@ -662,6 +666,12 @@ export default {
rowClassName({ row }) { rowClassName({ row }) {
return row.row_class_name || ''; return row.row_class_name || '';
}, },
pageShowAddMore(){
this.$emit("pageShowAddMore")
},
pageShowRemoveMore(){
this.$emit("pageShowRemoveMore")
}
}, },
// //
watch: {} watch: {}

View File

@ -17,14 +17,81 @@
<div class="table-container"> <div class="table-container">
<table class="table-layout"> <table class="table-layout">
<tbody> <tbody>
<tr class="table-row-0">
<th class="table-cell">
{{ formOptions.data.out_time === 0?'入库':'出库' }}人员姓名
</th>
<td class="table-cell" colspan="1">
{{formOptions.data.out_time === 0? formOptions.data.in_user_name:formOptions.data.out_user_name }}
</td>
<th class="table-cell">
业务员
</th>
<td class="table-cell" colspan="1">
{{formOptions.data.salesman_name}}
</td>
<th class="table-cell">
单据日期
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.bill_date | formatDate }}
</td>
<th class="table-cell">
验货时间
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.check_time | formatTime }}
</td>
</tr>
<tr class="table-row-0">
<th class="table-cell">
发货单号
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.delivery_no }}
</td>
<th class="table-cell">
联系人
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.contact }}
</td>
<th class="table-cell">
联系电话
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.phone }}
</td>
</tr>
<tr class="table-row-0" v-if="formOptions.data.out_time != 0">
<th class="table-cell">
客户姓名
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.customer_name }}
</td>
<th class="table-cell">
客户联系电话
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.customer_phone }}
</td>
<th class="table-cell">
客户联系地址
</th>
<td class="table-cell" colspan="5">
{{ formOptions.data.customer_address }}
</td>
</tr>
<tr v-for="(item,index) in formOptions.data.product_stock_log_detailv2_detal" :key="'item'+index">
<td colspan="12" >
<tr class="table-row-1"> <tr class="table-row-1">
<th class="table-cell"> <th class="table-cell">
料品 料品
</th> </th>
<td class="table-cell" colspan="11"> <td class="table-cell" colspan="11">
{{ item.product_detail.name }}
{{ product_detail.name }} {{ item.product_detail.code }}
{{ product_detail.code }}
</td> </td>
</tr> </tr>
<tr class="table-row-2"> <tr class="table-row-2">
@ -32,42 +99,42 @@
单价 单价
</th> </th>
<td class="table-cell" colspan="3"> <td class="table-cell" colspan="3">
{{ formOptions.data.price|formatMoney }} {{ item.price|formatMoney }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
总价 总价
</th> </th>
<td class="table-cell" colspan="6"> <td class="table-cell" colspan="3">
{{ formOptions.data.total_price|formatMoney }} {{ item.total_price|formatMoney }}
</td> </td>
</tr> </tr>
<tr class="table-row-2" v-if="formOptions.data.out_time === 0"> <tr class="table-row-2" v-if="formOptions.data.out_time === 0">
<th class="table-cell"> <th class="table-cell">
采购成本 采购成本
</th> </th>
<td class="table-cell"> <td class="table-cell" colspan="1">
{{ formOptions.data.purchase_cost|formatMoney }} {{ item.purchase_cost|formatMoney }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
加工成本 加工成本
</th> </th>
<td class="table-cell"> <td class="table-cell" colspan="1">
{{ formOptions.data.processing_cost|formatMoney }} {{ item.processing_cost|formatMoney }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
单件成本 单件成本
</th> </th>
<td class="table-cell"> <td class="table-cell" colspan="1">
{{ {{
(formOptions.data.purchase_cost + formOptions.data.processing_cost)|formatMoney (item.purchase_cost + item.processing_cost)|formatMoney
}} }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
总成本 总成本
</th> </th>
<td class="table-cell"> <td class="table-cell" colspan="1">
{{ {{
(formOptions.data.purchase_cost + formOptions.data.processing_cost) * formOptions.data.in_stock|formatMoney (item.purchase_cost + item.processing_cost) * item.in_stock|formatMoney
}} }}
</td> </td>
</tr> </tr>
@ -75,82 +142,59 @@
<th class="table-cell"> <th class="table-cell">
入库数量 入库数量
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.in_stock }} {{ formOptions.data.product_detail.unit }} {{ item.in_stock }} {{ item.unit }}
</td> </td>
<th class="table-cell">
单据日期
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.bill_date | formatDate }}
</td>
<th class="table-cell">
入库人员姓名
</th>
<td class="table-cell" colspan="4">
{{ formOptions.data.in_user_name }}
</td>
</tr>
<tr class="table-row-3" v-if="formOptions.data.out_time === 0">
<th class="table-cell"> <th class="table-cell">
剩余库存数量 剩余库存数量
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.stock }} {{ item.stock }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
入库类型 入库类型
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.in_type }} {{ formOptions.data.in_type }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
入库时间 入库时间
</th> </th>
<td class="table-cell" colspan="4"> <td class="table-cell" colspan="1">
{{ formOptions.data.in_time | formatDate }} {{ formOptions.data.in_time | formatTime }}
</td> </td>
</tr> </tr>
<tr class="table-row-3" v-if="formOptions.data.in_time === 0"> <tr class="table-row-3" v-if="formOptions.data.in_time === 0">
<th class="table-cell"> <th class="table-cell">
出库数量 出库数量
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.out_stock }} {{ item.out_stock }}
</td> </td>
<th class="table-cell">
单据日期
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.bill_date | formatDate }}
</td>
<th class="table-cell">
出库人员姓名
</th>
<td class="table-cell" colspan="4">
{{ formOptions.data.out_user_name }}
</td>
</tr>
<tr class="table-row-3" v-if="formOptions.data.in_time === 0">
<th class="table-cell"> <th class="table-cell">
剩余库存数量 剩余库存数量
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.stock }} {{ item.pos_stock }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
出库类型 出库类型
</th> </th>
<td class="table-cell" colspan="2"> <td class="table-cell" colspan="1">
{{ formOptions.data.out_type }} {{ formOptions.data.out_type }}
</td> </td>
<th class="table-cell"> <th class="table-cell">
出库时间 出库时间
</th> </th>
<td class="table-cell" colspan="4"> <td class="table-cell" colspan="1">
{{ formOptions.data.out_time | formatTime }} {{ formOptions.data.out_time | formatTime }}
</td> </td>
</tr> </tr>
</td>
</tr>
<!-- <tr class="table-row-3">--> <!-- <tr class="table-row-3">-->
<!-- <th class="table-cell">--> <!-- <th class="table-cell">-->
<!-- 业务类型--> <!-- 业务类型-->
@ -171,53 +215,6 @@
<!-- {{formOptions.data.salesman_name}}--> <!-- {{formOptions.data.salesman_name}}-->
<!-- </td>--> <!-- </td>-->
<!-- </tr>--> <!-- </tr>-->
<tr class="table-row-3">
<th class="table-cell">
客户姓名
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.customer_name }}
</td>
<th class="table-cell">
客户联系电话
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.customer_phone }}
</td>
<th class="table-cell">
客户联系地址
</th>
<td class="table-cell" colspan="5">
{{ formOptions.data.customer_address }}
</td>
</tr>
<tr class="table-row-4">
<th class="table-cell">
验货时间
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.check_time | formatTime }}
</td>
<th class="table-cell">
发货单号
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.delivery_no }}
</td>
<th class="table-cell">
联系人
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.contact }}
</td>
<th class="table-cell">
联系电话
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.phone }}
</td>
</tr>
<tr class="table-row-1" style="height: 200px;"> <tr class="table-row-1" style="height: 200px;">
<th class="table-cell"> <th class="table-cell">
备注 备注
@ -353,6 +350,8 @@ export default {
ProductStockLogOutList: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/out/list`, // ProductStockLogOutList: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/out/list`, //
ProductStockLogInList: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/in/list`, // ProductStockLogInList: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/in/list`, //
ProductStockLogDetail: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/detail`, // ProductStockLogDetail: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/detail`, //
ProductStockLogDetail2: `${BASE_URL.BASE_URL}/MesStock/v2/product/stock/log/detail`, //
ProductStockLogCreate: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/create`, // ProductStockLogCreate: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/create`, //
ProductStockLogUpdate: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/update`, // ProductStockLogUpdate: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/update`, //
ProductStockLogDelete: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/detele`, // ProductStockLogDelete: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/log/detele`, //
@ -458,7 +457,7 @@ export default {
}; };
pageData.actions.get = pageData.actions.ProductStockLogDetail; pageData.actions.get = pageData.actions.ProductStockLogDetail2;
pageData.actions.create = pageData.actions.ProductStockLogCreate; pageData.actions.create = pageData.actions.ProductStockLogCreate;
pageData.actions.update = pageData.actions.ProductStockLogUpdate; pageData.actions.update = pageData.actions.ProductStockLogUpdate;
// //
@ -485,17 +484,17 @@ export default {
} }
}).then(a => { }).then(a => {
let detailDataFieldName = this.detailDataFieldName; // let detailDataFieldName = this.detailDataFieldName;
console.log("a.data", a.data)
this.formOptions.data = a.data[detailDataFieldName]; this.formOptions.data = a.data;
if (this.formOptions.data.out_time === 0) { if (this.formOptions.data.out_time === 0) {
this.title = "入库信息" this.title = "入库信息"
} else { } else {
this.title = "出库信息" this.title = "出库信息"
} }
this.product_detail = this.formOptions.data.product_detail // this.product_detail = this.formOptions.data.product_stock_log_detailv2_detal[0].product_detail
this.$forceUpdate() this.$forceUpdate()
}).catch((a) => { }).catch((a) => {
@ -609,20 +608,30 @@ export default {
let {width} = this.curPaper let {width} = this.curPaper
this.formOptions.data.table = this.formOptions.data.product_stock_log_detailv2_detal.map(item => {
this.formOptions.data.table = [ return {
{ "code": item.product_detail.code,
"name": item.product_detail.name,
"code": this.formOptions.data.product_detail.code, "spec": item.product_detail.spec,
"name": this.formOptions.data.product_detail.name, "unit": item.product_detail.unit,
"spec": this.formOptions.data.product_detail.spec, "out_stock": item.out_stock,
"unit": this.formOptions.data.product_detail.unit, "price": this.formatNumber(item.price),
"out_stock": this.formOptions.data.out_stock, "total_price": this.formatNumber(item.total_price),
"price": this.formatNumber(this.formOptions.data.price),
"total_price": this.formatNumber(this.formOptions.data.total_price),
"remark": this.formOptions.data.remark, "remark": this.formOptions.data.remark,
} }
] })
// this.formOptions.data.table = [
// {
// "code": this.formOptions.data.product_stock_log_detailv2_detal[0].product_detail.code,
// "name": this.formOptions.data.product_stock_log_detailv2_detal[0].product_detail.name,
// "spec": this.formOptions.data.product_stock_log_detailv2_detal[0].product_detail.spec,
// "unit": this.formOptions.data.product_stock_log_detailv2_detal[0].product_detail.unit,
// "out_stock": this.formOptions.data.product_stock_log_detailv2_detal.out_stock,
// "price": this.formatNumber(this.formOptions.data.product_stock_log_detailv2_detal[0].price),
// "total_price": this.formatNumber(this.formOptions.data.product_stock_log_detailv2_detal[0].total_price),
// "remark": this.formOptions.data.remark,
// }
// ]
this.formOptions.data.companyTitle = this.company.company_info.name + "送货单" this.formOptions.data.companyTitle = this.company.company_info.name + "送货单"
console.log("this.formOptions.data", this.formOptions.data) console.log("this.formOptions.data", this.formOptions.data)
// this.$refs.preView.show(hiprintTemplate, this.formOptions.data, width) // this.$refs.preView.show(hiprintTemplate, this.formOptions.data, width)

View File

@ -1,8 +1,7 @@
<template> <template>
<div> <div>
<basic-page-list :desc="desc" :options="pageOptions" ref="List"> <basic-page-list :desc="desc" :options="pageOptions" ref="List" @pageShowAddMore="showAddmore = true" @pageShowRemoveMore="showRemovemore = true">
<template v-slot:column1="{ row }"> <template v-slot:column1="{ row }">
<a-button class="in" type="primary" @click="stockIn(row.id,row.stock_id)">入库</a-button> <a-button class="in" type="primary" @click="stockIn(row.id,row.stock_id)">入库</a-button>
@ -15,8 +14,60 @@
<span v-else></span> <span v-else></span>
</template> </template>
</basic-page-list> </basic-page-list>
<vxe-modal v-model="showAddmore" width="70%" height="80%" :position="{top: '100'}" title="批量入库" :showFooter="true">
<template #default>
<a-divider orientation="left">基础信息</a-divider>
<vxe-form
:data="addFromData"
:items="addFromItems"
titleColon
>
<template #add>
<vxe-button status="primary" content="添加" @click="addMore"></vxe-button>
</template>
</vxe-form>
<div v-for="(item,index) in addFromData.product_stock_log_inv2_detail" :key="'more'+index" @click="changeActiveIndex(index)">
<a-divider orientation="left">入库信息{{ index+1 }} <vxe-button @click="deleteNow(index)" size="small" status="danger" content="删除"></vxe-button></a-divider>
<vxe-form
:data="addFromData.product_stock_log_inv2_detail[index]"
:items="addFromItems2"
titleColon>
</vxe-form>
</div>
</template>
<template #footer>
<vxe-button status="primary" @click="addMoreOk" content="提交"></vxe-button>
<vxe-button status="danger" @click="showAddmore = false" content="取消"></vxe-button>
</template>
</vxe-modal>
<vxe-modal v-model="showRemovemore" width="70%" height="80%" :position="{top: '100'}" title="批量出库" :showFooter="true">
<template #default>
<a-divider orientation="left">基础信息</a-divider>
<vxe-form
:data="removeFromData"
:items="removeFromItems"
titleColon
>
<template #add>
<vxe-button status="primary" content="添加" @click="removeMore"></vxe-button>
</template>
</vxe-form>
<div v-for="(item,index) in removeFromData.product_stock_log_outv2_detail" :key="'more'+index" @click="changeActiveIndex2(index)">
<a-divider orientation="left">出库信息{{ index+1 }} <vxe-button @click="deleteNow2(index)" size="small" status="danger" content="删除"></vxe-button></a-divider>
<vxe-form
:data="removeFromData.product_stock_log_outv2_detail[index]"
:items="removeFromItems2"
titleColon>
</vxe-form>
</div>
</template>
<template #footer>
<vxe-button status="primary" @click="removeMoreOk" content="提交"></vxe-button>
<vxe-button status="danger" @click="showRemovemore = false" content="取消"></vxe-button>
</template>
</vxe-modal>
</div> </div>
</template> </template>
@ -32,6 +83,297 @@ export default {
pageOptions: {}, pageOptions: {},
warehouse_search: [], warehouse_search: [],
warehouse_id: null, warehouse_id: null,
showAddmore:false,
showRemovemore:false,
addFromData: {
in_user_id: null,
salesman_uid: null,
product_stock_log_inv2_detail:[],
},
nowActiveIndex:0,
addFromItems: [
{
title: '入库人', span: 6,
field: 'in_user_name',
dataRule: {
fromField: "id",
saveField: "in_user_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
this.addFromData.in_user_id = data.id;
}
}
}
}
},
{
title: '业务员', span: 6,
field: 'salesman_name',
dataRule: {
fromField: "id",
saveField: "salesman_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data.id)
this.addFromData.salesman_uid = data.id;
}
}
}
}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 6, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'bill_date', dataRule: { type: 'timestamp' }, title: '单据日期', span: 6, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'business_no', title: '发货单号', span: 6, itemRender: { name: 'input', props: { placeholder: '请输入发货单号' } } },
{ field: 'contact', title: '联系人', span: 6, itemRender: { name: 'input', props: { placeholder: '请输入联系人' } } },
{ field: 'phone', title: '联系电话', span: 6, itemRender: { name: 'input', props: { placeholder: '请输入联系电话' } } },
{ field: 'remark', title: '备注', span: 6, itemRender: { name: 'input', props: { placeholder: '请输入备注' } } },
{ span: 6, slots:{default:'add'} }
],
addFromItems2: [
{
title: '仓库', span: 6,
field: 'warehouse_name',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector',
props: {
searchFieldNames: ["warehouse_title", "code"],
params: {
dataType: "string",
valueField: "id",
textField: "warehouse_title",
columns: [
{field: 'warehouse_title', title: '名称'},
{field: 'code', title: '编码'}
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({data}) => {
this.addFromData.product_stock_log_inv2_detail[this.nowActiveIndex].warehouse_id = data.id;
this.addFromItems2[1].itemRender.props.params.actionParams.search_rules[0] = {
column: "warehouse_id",
mode: "=",
value: data.id.toString()
}
console.log(this.addFromItems2[1].title,this.addFromItems2[1].itemRender.props.params.actionParams)
// this.pageOptions.searchFormItems[2].itemRender.props.params = JSON.parse(JSON.stringify(this.pageOptions.searchFormItems[2].itemRender.props.params));
this.$forceUpdate(); //
}
}
}
}
},
{
title: '仓位', span: 6,
field: 'stock_pos_id',
dataRule: {
fromField: "id",
saveField: "id" // fromFieldsaveField
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "id",
listdataFieldName: 'MesStockPosition',
isClickToLoad: true,
columns:[
{field: 'id', title: 'ID'}, //
{field: 'product_detail.name', title: '名称'}, //
{field: 'stock', title: '库存数量'} //
],
actionParams: {
search_rules: []
},
dataUrl: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/list`,
onDataChanged: ({ data }) => {
// this.addFromData.product_stock_log_inv2_detail[this.nowActiveIndex].stock_pos_id = data.id;
this.addFromData.product_stock_log_inv2_detail[this.nowActiveIndex].product_name = data.product_detail.name;
this.addFromData.product_stock_log_inv2_detail[this.nowActiveIndex].product_id = data.product_detail.id;
this.addFromData.product_stock_log_inv2_detail[this.nowActiveIndex].price = data.product_detail.price;
},
}
},
},
},
// { field: 'pos_stock', title: '', span: 6 },
{ field: 'product_name', title: '料品', span: 6},
{ field: 'price', title: '单价', span: 6},
{ field: 'stock', title: '入库数量', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
// { field: 'total_price', title: '', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
{ field: 'purchase_cost', title: '采购成本', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
{ field: 'processing_cost', title: '加工成本', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
],
removeFromData: {
out_user_id: null,
salesman_uid: null,
product_stock_log_outv2_detail:[],
},
removeFromItems: [
{
title: '出库人', span: 6,
field: 'out_user_name',
// dataRule: {
// fromField: "id",
// saveField: "out_user_id"
// },
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data.id)
this.removeFromData.out_user_id = data.id;
}
}
}
}
},
{
title: '业务员', span: 6,
field: 'salesman_name',
// dataRule: {
// fromField: "id",
// saveField: "salesman_uid"
// },
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
this.removeFromData.salesman_uid = data.id;
}
}
}
}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 6, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'bill_date', dataRule: { type: 'timestamp' }, title: '单据日期', span: 6, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'out_type', title: '出库类型', span: 6, itemRender: { name: '$input',props: { placeholder: '请输入出库类型' } } },
{ field: 'customer_name', title: '客户姓名', span: 6, itemRender: { name: '$input',props: { placeholder: '请输入客户姓名' } } },
{ field: 'customer_phone', title: '客户电话', span: 6, itemRender: { name: '$input',props: { placeholder: '请输入客户电话' } } },
{ field: 'customer_address', title: '客户地址', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入客户地址' }} },
{ field: 'business_no', title: '发货单号', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入发货单号' } } },
{ field: 'contact', title: '联系人', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入联系人' } } },
{ field: 'phone', title: '联系电话', span: 6, itemRender: { name: '$input', props: { placeholder: '请输入联系电话' } } },
{ field: 'remark', title: '备注', span: 6, itemRender: { name: 'input', props: { placeholder: '请输入备注' } } },
{ span: 6, slots:{default:'add'} }
],
removeFromItems2: [
{
title: '仓库', span: 6,
field: 'warehouse_name',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector',
props: {
searchFieldNames: ["warehouse_title", "code"],
params: {
dataType: "string",
valueField: "id",
textField: "warehouse_title",
columns: [
{field: 'warehouse_title', title: '名称'},
{field: 'code', title: '编码'}
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({data}) => {
this.removeFromData.product_stock_log_outv2_detail[this.nowActiveIndex2].warehouse_id = data.id;
this.removeFromItems2[1].itemRender.props.params.actionParams.search_rules[0] = {
column: "warehouse_id",
mode: "=",
value: data.id.toString()
}
this.$forceUpdate(); //
}
}
}
}
},
{
title: '仓位', span: 6,
field: 'stock_pos_id',
dataRule: {
fromField: "id",
saveField: "id" // fromFieldsaveField
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "id",
listdataFieldName: 'MesStockPosition',
isClickToLoad: true,
columns:[
{field: 'id', title: 'ID'}, //
{field: 'product_detail.name', title: '名称'}, //
{field: 'stock', title: '库存数量'} //
],
actionParams: {
search_rules: []
},
dataUrl: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/list`,
onDataChanged: ({ data }) => {
this.removeFromData.product_stock_log_outv2_detail[this.nowActiveIndex2].product_name = data.product_detail.name;
this.removeFromData.product_stock_log_outv2_detail[this.nowActiveIndex2].product_id = data.product_detail.id;
this.removeFromData.product_stock_log_outv2_detail[this.nowActiveIndex2].price = data.product_detail.price;
// this.removeFromData.product_stock_log_outv2_detail[this.nowActiveIndex2].pos_stock = data.stock;
},
}
},
},
},
{ field: 'product_name', title: '料品', span: 6},
{ field: 'price', title: '单价', span: 6},
// { field: 'pos_stock', title: '', span: 6 },
{ field: 'stock', title: '出库数量', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
// { field: 'purchase_cost', title: '', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
// { field: 'processing_cost', title: '', span: 6, itemRender: { name: '$input', props: {type: 'number'} } },
],
nowActiveIndex2:0,
}; };
}, },
// //
@ -53,7 +395,7 @@ export default {
optionsInit() { optionsInit() {
// //
var pageData = { // var pageData = { //
needAddMore:true, //
keyName: 'id', // keyName: 'id', //
listFieldName: 'MesStockPosition', listFieldName: 'MesStockPosition',
addPageUrl: "/MesStock/MesStockPositionAdd", addPageUrl: "/MesStock/MesStockPositionAdd",
@ -267,6 +609,81 @@ export default {
}, },
//
changeActiveIndex(index){
this.nowActiveIndex = index;
},
//
changeActiveIndex2(index){
this.nowActiveIndex2 = index;
},
addMore(){
this.addFromData.product_stock_log_inv2_detail.push({});
},
deleteNow(index){
this.addFromData.product_stock_log_inv2_detail.splice(index,1);
},
removeMore(){
this.removeFromData.product_stock_log_outv2_detail.push({});
},
deleteNow2(index){
this.removeFromData.product_stock_log_outv2_detail.splice(index,1);
},
//
addMoreOk(){
//
let postdata = Object.assign({}, this.addFromData);
this.$mk.formatFormData({data: postdata, rules: this.addFromItems});
postdata.product_stock_log_inv2_detail.forEach(item => {
item.stock = Number(item.stock);
item.processing_cost = Number(item.processing_cost);
item.purchase_cost = Number(item.purchase_cost);
item.price = Number(item.price);
item.total_price = Number(item.total_price);
})
this.$mk.post({
url:`${BASE_URL.BASE_URL}/MesStock/v2/product/stock/in`,
data:postdata,
useBigInt: true
}).then(res=>{
if(res.code === 200){
this.$message.success('批量入库成功');
this.addFromData = {
product_stock_log_inv2_detail: []
};
this.showAddmore = false;
}
})
},
//
removeMoreOk(){
//
let postdata = Object.assign({}, this.removeFromData);
this.$mk.formatFormData({data: postdata, rules: this.removeFromItems});
postdata.product_stock_log_outv2_detail.forEach(item => {
item.stock = Number(item.stock);
// item.processing_cost = Number(item.processing_cost);
// item.purchase_cost = Number(item.purchase_cost);
item.price = Number(item.price);
// item.pos_stock = Number(item.pos_stock);
item.total_price = Number(item.total_price);
})
// this.postdata.out_user_id = this.removeFromData.out_user_id;
// this.postdata.salesman_uid = this.removeFromData.salesman_uid;
this.$mk.post({
url:`${BASE_URL.BASE_URL}/MesStock/v2/product/stock/out`,
data:postdata,
useBigInt: true
}).then(res=>{
if(res.code === 200){
this.$message.success('批量出库成功');
this.removeFromData = {
product_stock_log_outv2_detail: []
};
this.showRemovemore = false;
}
})
}
}, },
watch: {}, watch: {},
}; };