Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
caoqianming 2022-02-24 10:22:30 +08:00
commit 3e05707da5
6 changed files with 676 additions and 330 deletions

View File

@ -28,6 +28,15 @@ export function deleteCustomer(id, data) {
data data
}) })
} }
export function getCustomer(id) {
return request({
url: `/sam/customer/${id}/`,
method: 'get',
})
}
//合同 //合同
export function getContractList(query) { export function getContractList(query) {
return request({ return request({
@ -170,4 +179,27 @@ export function saleAudit(id) {
}) })
} }
//返回装箱文件
export function gePack(id) {
return request({
url: `/sam/sale_product/${id}/pack/`,
method: 'get'
})
}
//打包装箱文件确认
export function subPack(id, data) {
return request({
url: `/sam/sale_product/${id}/pack/`,
method: 'POST',
data
})
}
///未装箱备注
export function notPackremark(id, data) {
return request({
url: `/sam/sale_product/${id}/remark/`,
method: 'POST',
data
})
}

View File

@ -6,13 +6,20 @@ const state = {
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop', device: 'desktop',
size: Cookies.get('size') || 'medium' size: Cookies.get('size') || 'medium',
} recordFormType:{
10:'生产记录表',
20:'工序检查表',
30:'入厂检验表',
40:'成品检验表',
50:'首件检查表',
},
};
const mutations = { const mutations = {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
state.sidebar.opened = !state.sidebar.opened state.sidebar.opened = !state.sidebar.opened;
state.sidebar.withoutAnimation = false state.sidebar.withoutAnimation = false;
if (state.sidebar.opened) { if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1) Cookies.set('sidebarStatus', 1)
} else { } else {
@ -20,18 +27,18 @@ const mutations = {
} }
}, },
CLOSE_SIDEBAR: (state, withoutAnimation) => { CLOSE_SIDEBAR: (state, withoutAnimation) => {
Cookies.set('sidebarStatus', 0) Cookies.set('sidebarStatus', 0);
state.sidebar.opened = false state.sidebar.opened = false;
state.sidebar.withoutAnimation = withoutAnimation state.sidebar.withoutAnimation = withoutAnimation
}, },
TOGGLE_DEVICE: (state, device) => { TOGGLE_DEVICE: (state, device) => {
state.device = device state.device = device
}, },
SET_SIZE: (state, size) => { SET_SIZE: (state, size) => {
state.size = size state.size = size;
Cookies.set('size', size) Cookies.set('size', size)
} }
} };
const actions = { const actions = {
toggleSideBar({ commit }) { toggleSideBar({ commit }) {
@ -46,7 +53,7 @@ const actions = {
setSize({ commit }, size) { setSize({ commit }, size) {
commit('SET_SIZE', size) commit('SET_SIZE', size)
} }
} };
export default { export default {
namespaced: true, namespaced: true,

View File

@ -69,6 +69,12 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link
v-if="scope.row.type==2"
type="primary"
@click="handlePack(scope)"
>装箱</el-link
>
<el-link <el-link
v-if="checkPermission(['warehouse_update'])" v-if="checkPermission(['warehouse_update'])"
type="primary" type="primary"
@ -494,6 +500,11 @@ export default {
console.error(err); console.error(err);
}); });
}, },
//装箱
handlePack(scope)
{
this.$router.push({name: "salesdetail", params: { id: scope.row.sale }, })
}
}, },
}; };
</script> </script>

View File

@ -32,6 +32,9 @@
scope.row.not_work_remark scope.row.not_work_remark
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="打卡时间">
<template slot-scope="scope">{{ scope.row.last_check_time }}</template>
</el-table-column>
<el-table-column align="header-center" label="部门"> <el-table-column align="header-center" label="部门">
<template v-if="scope.row.dept_" slot-scope="scope">{{ <template v-if="scope.row.dept_" slot-scope="scope">{{
@ -135,7 +138,7 @@
<el-col :span="12"> <el-col :span="12">
<el-calendar v-model="value"> <el-calendar v-model="value">
<template slot="dateCell" slot-scope="{ date, data }"> <template slot="dateCell" slot-scope="{ date, data }">
<p> <p >
{{ data.day.split("-").slice(1).join("-") }}<br /> {{ data.day.split("-").slice(1).join("-") }}<br />
{{ dealMyDate(data.day) }} {{ dealMyDate(data.day) }}
</p> </p>
@ -219,7 +222,7 @@ export default {
checkPermission, checkPermission,
//今日到岗 //今日到岗
getList() { getList() {
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark"; this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark,last_check_time";
getEmployeeList(this.listQuery).then((response) => { getEmployeeList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.userList = response.data; this.userList = response.data;

View File

@ -3,7 +3,7 @@
<el-card> <el-card>
<div> <div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" <el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增销售记录</el-button >新增销售发货</el-button
> >
<el-input <el-input
v-model="listQuery.search" v-model="listQuery.search"
@ -27,43 +27,72 @@
>重置</el-button >重置</el-button
> >
</div> </div>
</el-card> </el-card>
<el-card > <el-card>
<el-table <el-table
:data="saleList.results" :data="saleList.results"
border border
fit fit
stripe stripe
highlight-current-row highlight-current-row
height="100" height="100"
v-el-height-adaptive-table="{bottomOffset: 42}" v-el-height-adaptive-table="{ bottomOffset: 42 }"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="产品名称" show-overflow-tooltip> <el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{ scope.row.product_.name }}</template> <template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" show-overflow-tooltip> <el-table-column label="产品型号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{ scope.row.product_.specification }}</template> <template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.specification
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="客户名称" show-overflow-tooltip> <el-table-column label="客户名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.customer">{{ scope.row.customer_.name }}</template> <template slot-scope="scope" v-if="scope.row.customer">{{
scope.row.customer_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="订单编号" show-overflow-tooltip> <el-table-column label="订单编号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order">{{ scope.row.order_.number }}</template> <template slot-scope="scope" v-if="scope.row.order">{{
scope.row.order_.number
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip> <el-table-column label="合同名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order_">{{ scope.row.order_.contract_.name }}</template> <template slot-scope="scope" v-if="scope.row.order_">{{
scope.row.order_.contract_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="是否审核" > <el-table-column label="预计发货时间">
<template slot-scope="scope" > <el-tag v-if="scope.row.is_audited == false"></el-tag> <template slot-scope="scope">{{ scope.row.edelivery_date }}</template>
<el-tag v-else></el-tag></template>
</el-table-column> </el-table-column>
<el-table-column label="预计发货数量">
<el-table-column> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="实际发货数量">
<template slot-scope="scope">{{ scope.row.count_real }}</template>
</el-table-column>
<el-table-column label="是否审核">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_audited == false"></el-tag>
<el-tag v-else></el-tag></template
>
</el-table-column>
<el-table-column label="收货人">
<template slot-scope="scope">{{ scope.row.receiver }}</template>
</el-table-column>
<el-table-column label="收货人电话">
<template slot-scope="scope">{{ scope.row.receiver_phone }}</template>
</el-table-column>
<el-table-column label="收货人地址" show-overflow-tooltip>
<template slot-scope="scope">{{
scope.row.receiver_address
}}</template>
</el-table-column>
<el-table-column label="操作" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['warehouse_delete'])" v-if="checkPermission(['warehouse_delete'])"
@ -73,14 +102,14 @@
> >
<el-link <el-link
v-if="scope.row.is_audited==false" v-if="scope.row.is_audited == false"
type="primary" type="primary"
@click="handleAudit(scope)" @click="handleAudit(scope)"
>审核</el-link >审核</el-link
> >
<el-link <el-link
v-if="scope.row.is_audited==false" v-if="scope.row.is_audited == false"
type="danger" type="danger"
@click="handleDelete(scope)" @click="handleDelete(scope)"
>删除</el-link >删除</el-link
@ -100,65 +129,78 @@
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
width="60%" width="60%"
:title="dialogType === 'edit' ? '编辑销售信息' : '新增销售信息'" :title="dialogType === 'edit' ? '编辑销售发货' : '新增销售发货'"
> >
<el-form <el-form
ref="Form" ref="Form"
:model="sale" :model="sale"
label-width="80px" label-width="100px"
label-position="right" label-position="right"
> >
<el-form-item label="关联订单" prop="name"> <el-form-item label="关联订单" prop="name">
<el-select style="width: 100%" v-model="sale.order" @change="selectorder" placeholder="请选择"> <el-select
style="width: 100%"
v-model="sale.order"
@change="selectorder"
placeholder="请选择"
>
<el-option <el-option
v-for="item in orderoptions" v-for="item in orderoptions"
:key="item.id" :key="item.id"
:label="item.number" :label="item.number"
:value="item.id"> :value="item.id"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联客户" prop="customer"> <el-form-item label="关联客户" prop="customer">
<el-select style="width: 100%" v-model="sale.customer" placeholder="请选择"> <el-select
style="width: 100%"
v-model="sale.customer"
@change="selectcustomer"
placeholder="请选择"
>
<el-option <el-option
v-for="item in customeroptions" v-for="item in customeroptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联合同" prop="contract">
<el-input v-model="sale.contract" placeholder="关联合同" />
</el-form-item>
<el-form-item label="所需产品" prop="product"> <el-form-item label="所需产品" prop="product">
<el-select style="width: 100%" v-model="sale.product" @change="selectproduct" placeholder="请选择"> <el-select
style="width: 100%"
v-model="sale.product"
@change="selectproduct"
placeholder="请选择"
>
<el-option <el-option
v-for="item in materialoptions" v-for="item in materialoptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="选择产品" prop="iproducts"> <el-form-item label="选择产品" prop="iproducts">
<el-table <el-table
:data="iproductoptions" :data="iproductoptions"
border border
fit fit
stripe stripe
highlight-current-row highlight-current-row
ref="multipleTable" ref="multipleTable"
height="200"
> >
<el-table-column <el-table-column type="selection" width="55"> </el-table-column>
type="selection"
width="55">
</el-table-column>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="成品编号"> <el-table-column label="成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
@ -168,30 +210,70 @@
<template slot-scope="scope">{{ scope.row.batch }}</template> <template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column> </el-table-column>
<el-table-column label="成品名称"> <el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{
scope.row.material_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在仓库"> <el-table-column label="所在仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template> <template slot-scope="scope">{{
scope.row.warehouse_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="是否已军检"> <el-table-column label="是否已军检">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag> <el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template> <el-tag v-else>已军检</el-tag></template
>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
<el-form-item label="预计发货时间" prop="edelivery_date">
<el-date-picker
v-model="sale.edelivery_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item label="运输方式" prop="trans_mode">
<el-select
style="width: 100%"
v-model="sale.trans_mode"
placeholder="请选择"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="收货人" prop="receiver">
<el-input v-model="sale.receiver" placeholder="收货人" />
</el-form-item>
<el-form-item label="联系电话" prop="receiver_phone">
<el-input
v-model="sale.receiver_phone"
placeholder="收货人联系电话"
/>
</el-form-item>
<el-form-item label="收货地址" prop="receiver_address">
<el-input v-model="sale.receiver_address" placeholder="收货地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="sale.remark" placeholder="备注" />
</el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button> <el-button type="primary" @click="confirm('Form')">确认</el-button>
@ -200,16 +282,33 @@
</div> </div>
</template> </template>
<script> <script>
import { createSale,getOrderList,getCustomerList,getSaleList,getOrder,deleteSale,getSale,saleAudit} from "@/api/sam"; import {
createSale,
getOrderList,
getCustomerList,
getSaleList,
getOrder,
deleteSale,
getSale,
saleAudit,
getCustomer
} from "@/api/sam";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getMaterialList } from "@/api/mtm"; import { getMaterialList } from "@/api/mtm";
import { getiproductList,} from "@/api/inm"; import { getiproductList } from "@/api/inm";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteSale = { const defaulteSale = {
order:null, order: null,
customer:null, customer: null,
product:null contract:"",
product: null,
edelivery_date: "",
trans_mode: null,
receiver: "",
receiver_phone: "",
receiver_address: "",
remark: "",
}; };
export default { export default {
components: { Pagination }, components: { Pagination },
@ -223,14 +322,35 @@ export default {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
iproducts:[], iproducts: [],
orderoptions:[], orderoptions: [],
customeroptions:[], customeroptions: [],
materialoptions:[], materialoptions: [],
iproductoptions:[], iproductoptions: [],
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
options: [
{
value: 10,
label: "铁路快运",
},
{
value: 20,
label: "铁路慢运",
},
{
value: 30,
label: "铁路整车",
},
{
value: 40,
label: "汽车运输",
},
{
value: 50,
label: "空运",
},
],
}; };
}, },
computed: {}, computed: {},
@ -246,66 +366,71 @@ export default {
checkPermission, checkPermission,
//关联订单 //关联订单
getOrderLists() { getOrderLists() {
getOrderList({ page: 0 }).then((response) => {
getOrderList({page:0}).then((response) => {
if (response.data) { if (response.data) {
this.orderoptions = response.data; this.orderoptions = response.data;
} }
}); });
}, },
//选择订单变化 //选择订单变化
selectorder(selval) selectorder(selval) {
{
getOrder(selval).then((response) => { getOrder(selval).then((response) => {
if (response.data) { if (response.data) {
this.sale.customer = response.data.customer; this.sale.customer = response.data.customer;
this.sale.product = response.data.product; this.sale.product = response.data.product;
getiproductList({page:0,to_order:response.data.id}).then((response) => { this.sale.contract = response.data.contract_.name;
this.sale.receiver = response.data.customer_.contact;
this.sale.receiver_phone = response.data.customer_.contact_phone;
this.sale.receiver_address = response.data.customer_.address;
getiproductList({
page: 0,
to_order: response.data.id,
state: 10,
}).then((response) => {
if (response.data) { if (response.data) {
this.iproductoptions=response.data; this.iproductoptions = response.data;
} }
}); });
}
});
},
selectcustomer(selval)
{
getCustomer(selval).then((response) => {
if (response.data) {
this.sale.receiver = response.data.contact;
this.sale.receiver_phone = response.data.contact_phone;
this.sale.receiver_address = response.data.address;
} }
}); });
}, },
getList() { getList() {
getSaleList(this.listQuery).then((response) => { getSaleList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.saleList = response.data; this.saleList = response.data;
} }
}); });
}, },
//关联客户 //关联客户
getCustomerLists() { getCustomerLists() {
getCustomerList({ page: 0 }).then((response) => {
getCustomerList({page:0,}).then((response) => {
this.customeroptions = response.data; this.customeroptions = response.data;
}); });
}, },
//选择产品 //选择产品
getMaterialList() getMaterialList() {
{ getMaterialList({ type: 1, page: 0 }).then((response) => {
getMaterialList({type:1,page:0}).then((response) => {
if (response.data) { if (response.data) {
this.materialoptions = response.data; this.materialoptions = response.data;
} }
}); });
}, },
//成品 //成品
// getproductList() { // getproductList() {
@ -316,16 +441,18 @@ export default {
// }); // });
// }, // },
//根据选择的产品弹出对应库里的产品 //根据选择的产品弹出对应库里的产品
selectproduct(){ selectproduct() {
getiproductList({page:0,material__type:1,material:this.sale.product}).then((response) => { getiproductList({
page: 0,
material__type: 1,
material: this.sale.product,
}).then((response) => {
if (response.data) { if (response.data) {
this.iproductoptions=response.data; this.iproductoptions = response.data;
} }
}); });
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1; this.listQuery.page = 1;
@ -335,17 +462,17 @@ selectproduct(){
this.listQuery = { this.listQuery = {
page: 1, page: 1,
page_size: 20, page_size: 20,
} };
this.getList(); this.getList();
}, },
handleCreate() { handleCreate() {
this.sale = Object.assign({}, defaulteSale); this.sale = Object.assign({}, defaulteSale);
this.dialogType = "new"; this.dialogType = "new";
this.dialogVisible = true; this.dialogVisible = true;
this.iproducts=[]; this.iproducts = [];
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].resetFields(); this.$refs["Form"].resetFields();
this.iproductoptions=[]; this.iproductoptions = [];
}); });
}, },
@ -387,17 +514,11 @@ selectproduct(){
} }
}); });
} else { } else {
this.$refs.multipleTable.selection.forEach((item) => { this.$refs.multipleTable.selection.forEach((item) => {
this.iproducts.push( this.iproducts.push(item.id);
item.id
);
}); });
this.sale.iproducts = this.iproducts;
this.sale.iproducts=this.iproducts;
createSale(this.sale).then((res) => { createSale(this.sale).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getList();
@ -413,32 +534,27 @@ selectproduct(){
}, },
//销售详情 //销售详情
handleDetail(scope){ handleDetail(scope) {
this.$router.push({ name: "salesdetail", params: { id: scope.row.id } });
this.$router.push({name: "salesdetail", params: { id: scope.row.id }, })
}, },
//审核 //审核
handleAudit(scope){ handleAudit(scope) {
saleAudit(scope.row.id).then((res) => { saleAudit(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.$message.success("审核成功成功"); this.$message.success("审核成功成功");
this.getList(); this.getList();
} }
}); });
} },
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.trdiv >>> .el-transfer-panel{ .trdiv >>> .el-transfer-panel {
width:350px; width: 350px;
} }
.trdiv >>> .el-transfer__buttons{ .trdiv >>> .el-transfer__buttons {
width:110px width: 110px;
} }
</style> </style>

View File

@ -1,66 +1,91 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<el-descriptions title="基本信息" direction="vertical" :column="8" border> <el-descriptions title="基本信息" direction="vertical" :column="8" border>
<el-descriptions-item label="客户名称" v-if="salesdetail.customer"> {{salesdetail.customer_.name}}</el-descriptions-item> <el-descriptions-item label="客户名称" v-if="salesdetail.customer">
<el-descriptions-item label="产品名称" v-if="salesdetail.product"> {{salesdetail.product_.name}}</el-descriptions-item> {{ salesdetail.customer_.name }}</el-descriptions-item
<el-descriptions-item label="产品型号" :span="2" v-if="salesdetail.product"> {{salesdetail.product_.specification}}</el-descriptions-item> >
<el-descriptions-item label="订单编号" v-if="salesdetail.order"> {{salesdetail.order_.number}} </el-descriptions-item> <el-descriptions-item label="产品名称" v-if="salesdetail.product">
<el-descriptions-item label="合同名称" v-if="salesdetail.order"> {{salesdetail.order_.contract_.name}}</el-descriptions-item> {{ salesdetail.product_.name }}</el-descriptions-item
</el-descriptions> >
<el-card class="box-card"> <el-descriptions-item
label="产品型号"
:span="2"
v-if="salesdetail.product"
>
{{ salesdetail.product_.specification }}</el-descriptions-item
>
<el-descriptions-item label="订单编号" v-if="salesdetail.order">
{{ salesdetail.order_.number }}
</el-descriptions-item>
<el-descriptions-item label="合同名称" v-if="salesdetail.order">
{{ salesdetail.order_.contract_.name }}</el-descriptions-item
>
</el-descriptions>
<el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>关联产品信息</span> <span>关联产品信息</span>
</div> </div>
<el-table <el-table
ref="singleTable" ref="singleTable"
:data="saleproduct" :data="saleproduct"
highlight-current-row highlight-current-row
style="width: 100%"> style="width: 100%"
>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="产品编号" show-overflow-tooltip> <el-table-column label="产品编号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" show-overflow-tooltip> <el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" >{{ scope.row.iproduct_.material_.name }}</template> <template slot-scope="scope">{{
scope.row.iproduct_.material_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="批次" > <el-table-column label="批次">
<template slot-scope="scope" >{{ scope.row.iproduct_.batch }}</template> <template slot-scope="scope">{{
scope.row.iproduct_.batch
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="仓库"> <el-table-column label="仓库">
<template slot-scope="scope">{{ scope.row.iproduct_.warehouse_.name }}</template> <template slot-scope="scope">{{
scope.row.iproduct_.warehouse_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="是否已军检"> <el-table-column label="是否已军检">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag> <el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template> <el-tag v-else>已军检</el-tag></template
>
</el-table-column> </el-table-column>
<el-table-column label="军检"> <el-table-column label="军检">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag> <el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else>合格</el-tag></template> <el-tag v-else>合格</el-tag></template
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
> >
</el-table-column>
<el-table-column label="装箱单号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.packnum }}</template>
</el-table-column>
<el-table-column label="未装箱说明" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
@click="handlePack(scope)"
>装箱</el-link
>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
@click="handleNotPack(scope)"
>备注</el-link
>
<el-link <el-link
v-if="checkPermission(['warehouse_delete'])" v-if="checkPermission(['warehouse_delete'])"
type="danger" type="danger"
@ -69,60 +94,161 @@
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
width="60%"
:title="dialogType === 'edit' ? '编辑装箱单' : '新增装箱单'"
>
<el-form
ref="Form"
:model="packData"
label-width="100px"
label-position="right"
>
<el-form-item label="装箱单号" prop="packnum">
<el-input v-model="packData.packnum" placeholder="装箱单号" />
</el-form-item>
<el-form-item label="装箱文件确认" prop="iproducts">
<el-table
:data="packlist"
border
fit
stripe
highlight-current-row
ref="multipleTable"
height="300"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" label="序号" />
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="单位">
<template slot-scope="scope">{{ scope.row.unit }}</template>
</el-table-column>
<el-table-column label="数量">
<template slot-scope="scope">
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.count"
:min="0"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column label="库存数量">
<template slot-scope="scope" v-if="scope.row.material_">{{
scope.row.material_.count
}}</template>
</el-table-column>
<el-table-column label="安全库存数量">
<template slot-scope="scope" v-if="scope.row.material_">{{
scope.row.material_.count_safe
}}</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false"
>取消</el-button
>
<el-button type="primary" @click="submitPack">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogVisibles"
:close-on-click-modal="false"
width="60%"
title="未装箱备注"
>
<el-form
ref="Form"
:model="notpackData"
label-width="100px"
label-position="right"
>
<el-form-item label="备注" prop="remark">
<el-input v-model="notpackData.remark" placeholder="未装箱备注" />
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false"
>取消</el-button
>
<el-button type="primary" @click="submitnotPack">确认</el-button>
</div>
</el-dialog>
</el-card>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import {getSale,getSaleproductList,deleteSaleproduct} from "@/api/sam"; import {
getSale,
getSaleproductList,
deleteSaleproduct,
gePack,
subPack,
notPackremark,
} from "@/api/sam";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultepackData = {
packnum: ""
}
export default { export default {
components: { Pagination }, components: { Pagination },
data() { data() {
return { return {
salesdetail: "",
salesdetail:"", saleproduct: "",
saleproduct:"", packlist: [],
dialogVisible: false,
dialogVisibles:false,
packData:defaultepackData,
notpackData:{remark:""},
detail: [],
saleproductId: null,
saleProductid:null,
dialogType: "new",
}; };
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.id = this.$route.params.id; this.id = this.$route.params.id;
this.getList(); this.getList();
this.getSaleproductLists(); this.getSaleproductLists();
}, },
methods: { methods: {
checkPermission, checkPermission,
//详情 //详情
getList() { getList() {
getSale(this.id).then((response) => { getSale(this.id).then((response) => {
if (response.data) { if (response.data) {
this.salesdetail = response.data; this.salesdetail = response.data;
} }
}); });
}, },
getSaleproductLists() getSaleproductLists() {
{ getSaleproductList({ sale: this.id, page: 0 }).then((response) => {
getSaleproductList({sale:this.id,page:0}).then((response) => {
if (response.data) { if (response.data) {
this.saleproduct = response.data; this.saleproduct = response.data;
} }
}); });
}, },
handleDelete(scope) { handleDelete(scope) {
@ -140,7 +266,58 @@ export default {
console.error(err); console.error(err);
}); });
}, },
//装箱操作
handlePack(scope) {
this.packData = Object.assign({}, scope.row);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
gePack(scope.row.id).then((response) => {
if (response.data) {
this.packlist = response.data.detail;
}
});
this.saleproductId = scope.row.id;
},
submitPack() {
this.$refs.multipleTable.selection.forEach((item) => {
this.detail.push({
id: item.id,
count: item.count,
});
});
console.log( this.detail);
this.packData.detail = this.detail;
subPack(this.saleproductId, this.packData).then((res) => {
if (res.code >= 200) {
this.getSaleproductLists();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
//未装箱备注
handleNotPack(scope)
{
this.dialogVisibles=true;
this.saleProductid=scope.row.id;
}
,
submitnotPack()
{
notPackremark(this.saleProductid, this.notpackData).then((res) => {
if (res.code >= 200) {
this.getSaleproductLists();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
}, },
}; };
</script> </script>