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
})
}
export function getCustomer(id) {
return request({
url: `/sam/customer/${id}/`,
method: 'get',
})
}
//合同
export function getContractList(query) {
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
},
device: 'desktop',
size: Cookies.get('size') || 'medium'
}
size: Cookies.get('size') || 'medium',
recordFormType:{
10:'生产记录表',
20:'工序检查表',
30:'入厂检验表',
40:'成品检验表',
50:'首件检查表',
},
};
const mutations = {
TOGGLE_SIDEBAR: state => {
state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false
state.sidebar.opened = !state.sidebar.opened;
state.sidebar.withoutAnimation = false;
if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1)
} else {
@ -20,18 +27,18 @@ const mutations = {
}
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
Cookies.set('sidebarStatus', 0)
state.sidebar.opened = false
Cookies.set('sidebarStatus', 0);
state.sidebar.opened = false;
state.sidebar.withoutAnimation = withoutAnimation
},
TOGGLE_DEVICE: (state, device) => {
state.device = device
},
SET_SIZE: (state, size) => {
state.size = size
state.size = size;
Cookies.set('size', size)
}
}
};
const actions = {
toggleSideBar({ commit }) {
@ -46,7 +53,7 @@ const actions = {
setSize({ commit }, size) {
commit('SET_SIZE', size)
}
}
};
export default {
namespaced: true,

View File

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

View File

@ -32,6 +32,9 @@
scope.row.not_work_remark
}}</template>
</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="部门">
<template v-if="scope.row.dept_" slot-scope="scope">{{
@ -135,9 +138,9 @@
<el-col :span="12">
<el-calendar v-model="value">
<template slot="dateCell" slot-scope="{ date, data }">
<p>
<p >
{{ data.day.split("-").slice(1).join("-") }}<br />
{{ dealMyDate(data.day) }}
{{ dealMyDate(data.day) }}
</p>
</template>
</el-calendar>
@ -219,7 +222,7 @@ export default {
checkPermission,
//今日到岗
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) => {
if (response.data) {
this.userList = response.data;

View File

@ -2,85 +2,114 @@
<div class="app-container">
<el-card>
<div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增销售记录</el-button
>
<el-input
v-model="listQuery.search"
placeholder="客户名称"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增销售发货</el-button
>
<el-input
v-model="listQuery.search"
placeholder="客户名称"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
</el-card>
<el-card >
<el-card>
<el-table
:data="saleList.results"
border
border
fit
stripe
highlight-current-row
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 label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{ scope.row.product_.name }}</template>
<el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.name
}}</template>
</el-table-column>
<el-table-column label="产品型号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{ scope.row.product_.specification }}</template>
<el-table-column label="产品型号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.product">{{
scope.row.product_.specification
}}</template>
</el-table-column>
<el-table-column label="客户名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.customer">{{ scope.row.customer_.name }}</template>
<el-table-column label="客户名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.customer">{{
scope.row.customer_.name
}}</template>
</el-table-column>
<el-table-column label="订单编号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order">{{ scope.row.order_.number }}</template>
</el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order_">{{ scope.row.order_.contract_.name }}</template>
<el-table-column label="订单编号" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.order">{{
scope.row.order_.number
}}</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 label="合同名称" show-overflow-tooltip>
<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="预计发货时间">
<template slot-scope="scope">{{ scope.row.edelivery_date }}</template>
</el-table-column>
<el-table-column label="预计发货数量">
<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-link
<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">
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
type="primary"
@click="handleDetail(scope)"
>详情</el-link
>
<el-link
v-if="scope.row.is_audited==false"
type="primary"
<el-link
v-if="scope.row.is_audited == false"
type="primary"
@click="handleAudit(scope)"
>审核</el-link
>
<el-link
v-if="scope.row.is_audited==false"
v-if="scope.row.is_audited == false"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
@ -100,98 +129,151 @@
:visible.sync="dialogVisible"
:close-on-click-modal="false"
width="60%"
:title="dialogType === 'edit' ? '编辑销售信息' : '新增销售信息'"
:title="dialogType === 'edit' ? '编辑销售发货' : '新增销售发货'"
>
<el-form
ref="Form"
:model="sale"
label-width="80px"
label-width="100px"
label-position="right"
>
<el-form-item label="关联订单" prop="name">
<el-select style="width: 100%" v-model="sale.order" @change="selectorder" placeholder="请选择">
<el-option
v-for="item in orderoptions"
:key="item.id"
:label="item.number"
:value="item.id">
</el-option>
<el-select
style="width: 100%"
v-model="sale.order"
@change="selectorder"
placeholder="请选择"
>
<el-option
v-for="item in orderoptions"
:key="item.id"
:label="item.number"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关联客户" prop="customer">
<el-select style="width: 100%" v-model="sale.customer" placeholder="请选择">
<el-option
v-for="item in customeroptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
<el-form-item label="关联客户" prop="customer">
<el-select
style="width: 100%"
v-model="sale.customer"
@change="selectcustomer"
placeholder="请选择"
>
<el-option
v-for="item in customeroptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所需产品" prop="product">
<el-select style="width: 100%" v-model="sale.product" @change="selectproduct" placeholder="请选择">
<el-option
v-for="item in materialoptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</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-select
style="width: 100%"
v-model="sale.product"
@change="selectproduct"
placeholder="请选择"
>
<el-option
v-for="item in materialoptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择产品" prop="iproducts">
<el-table
:data="iproductoptions"
border
fit
stripe
highlight-current-row
ref="multipleTable"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
</el-form-item>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="是否已军检">
<template slot-scope="scope">
<el-form-item label="选择产品" prop="iproducts">
<el-table
:data="iproductoptions"
border
fit
stripe
highlight-current-row
ref="multipleTable"
height="200"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template>
<el-table-column label="成品批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="成品名称">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
</el-table-column>
</el-table>
</el-form-item>
<el-table-column label="所在仓库">
<template slot-scope="scope">{{
scope.row.warehouse_.name
}}</template>
</el-table-column>
<el-table-column label="是否已军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template
>
</el-table-column>
</el-table>
</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>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
@ -200,132 +282,177 @@
</div>
</template>
<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 { getMaterialList } from "@/api/mtm";
import { getiproductList,} from "@/api/inm";
import { getiproductList } from "@/api/inm";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteSale = {
order:null,
customer:null,
product:null
order: null,
customer: null,
contract:"",
product: null,
edelivery_date: "",
trans_mode: null,
receiver: "",
receiver_phone: "",
receiver_address: "",
remark: "",
};
export default {
components: { Pagination },
data() {
return {
sale: defaulteSale,
saleList: {
saleList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
iproducts:[],
orderoptions:[],
customeroptions:[],
materialoptions:[],
iproductoptions:[],
iproducts: [],
orderoptions: [],
customeroptions: [],
materialoptions: [],
iproductoptions: [],
dialogVisible: false,
dialogType: "new",
options: [
{
value: 10,
label: "铁路快运",
},
{
value: 20,
label: "铁路慢运",
},
{
value: 30,
label: "铁路整车",
},
{
value: 40,
label: "汽车运输",
},
{
value: 50,
label: "空运",
},
],
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getCustomerLists();
// this.getproductList();
this.getOrderLists();
this.getMaterialList();
this.getCustomerLists();
// this.getproductList();
this.getOrderLists();
this.getMaterialList();
},
methods: {
checkPermission,
//关联订单
getOrderLists() {
getOrderList({page:0}).then((response) => {
getOrderList({ page: 0 }).then((response) => {
if (response.data) {
this.orderoptions = response.data;
}
});
},
//选择订单变化
selectorder(selval)
{
selectorder(selval) {
getOrder(selval).then((response) => {
if (response.data) {
this.sale.customer = response.data.customer;
this.sale.product = response.data.product;
getiproductList({page:0,to_order:response.data.id}).then((response) => {
this.sale.product = response.data.product;
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) {
this.iproductoptions = response.data;
}
});
}
});
},
selectcustomer(selval)
{
getCustomer(selval).then((response) => {
if (response.data) {
this.iproductoptions=response.data;
this.sale.receiver = response.data.contact;
this.sale.receiver_phone = response.data.contact_phone;
this.sale.receiver_address = response.data.address;
}
});
}
});
},
getList() {
getSaleList(this.listQuery).then((response) => {
if (response.data) {
this.saleList = response.data;
}
});
},
//关联客户
getCustomerLists() {
getCustomerList({page:0,}).then((response) => {
this.customeroptions = response.data;
//关联客户
getCustomerLists() {
getCustomerList({ page: 0 }).then((response) => {
this.customeroptions = response.data;
});
},
//选择产品
getMaterialList()
{
getMaterialList({type:1,page:0}).then((response) => {
getMaterialList() {
getMaterialList({ type: 1, page: 0 }).then((response) => {
if (response.data) {
this.materialoptions = response.data;
}
});
},
//成品
// getproductList() {
// getiproductList({page:0,material__type:1}).then((response) => {
// if (response.data) {
// this.iproductoptions=response.data;
// }
// });
// },
//根据选择的产品弹出对应库里的产品
selectproduct(){
getiproductList({page:0,material__type:1,material:this.sale.product}).then((response) => {
if (response.data) {
this.iproductoptions=response.data;
}
});
},
},
//成品
// getproductList() {
// getiproductList({page:0,material__type:1}).then((response) => {
// if (response.data) {
// this.iproductoptions=response.data;
// }
// });
// },
//根据选择的产品弹出对应库里的产品
selectproduct() {
getiproductList({
page: 0,
material__type: 1,
material: this.sale.product,
}).then((response) => {
if (response.data) {
this.iproductoptions = response.data;
}
});
},
handleFilter() {
this.listQuery.page = 1;
@ -335,20 +462,20 @@ selectproduct(){
this.listQuery = {
page: 1,
page_size: 20,
}
};
this.getList();
},
handleCreate() {
this.sale = Object.assign({}, defaulteSale);
this.dialogType = "new";
this.dialogVisible = true;
this.iproducts=[];
this.iproducts = [];
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.iproductoptions=[];
this.iproductoptions = [];
});
},
handleEdit(scope) {
this.sale = Object.assign({}, scope.row); // copy obj
console.log(this.sale);
@ -373,7 +500,7 @@ selectproduct(){
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
@ -387,21 +514,15 @@ selectproduct(){
}
});
} else {
this.$refs.multipleTable.selection.forEach((item) => {
this.iproducts.push(
item.id
);
});
this.$refs.multipleTable.selection.forEach((item) => {
this.iproducts.push(item.id);
});
this.sale.iproducts=this.iproducts;
this.sale.iproducts = this.iproducts;
createSale(this.sale).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.dialogVisible = false;
this.$message.success("成功");
}
});
@ -413,32 +534,27 @@ selectproduct(){
},
//销售详情
handleDetail(scope){
this.$router.push({name: "salesdetail", params: { id: scope.row.id }, })
handleDetail(scope) {
this.$router.push({ name: "salesdetail", params: { id: scope.row.id } });
},
//审核
handleAudit(scope){
saleAudit(scope.row.id).then((res) => {
handleAudit(scope) {
saleAudit(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("审核成功成功");
this.getList();
}
this.$message.success("审核成功成功");
this.getList();
}
});
}
},
},
};
</script>
<style scoped>
.trdiv >>> .el-transfer-panel{
width:350px;
.trdiv >>> .el-transfer-panel {
width: 350px;
}
.trdiv >>> .el-transfer__buttons{
width:110px
.trdiv >>> .el-transfer__buttons {
width: 110px;
}
</style>

View File

@ -1,131 +1,257 @@
<template>
<div class="app-container">
<el-card style="margin-top: 2px">
<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.product"> {{salesdetail.product_.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.order"> {{salesdetail.order_.contract_.name}}</el-descriptions-item>
</el-descriptions>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>关联产品信息</span>
</div>
<el-table
ref="singleTable"
:data="saleproduct"
highlight-current-row
style="width: 100%">
<el-table-column type="index" width="50" />
<el-table-column label="产品编号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope" >{{ scope.row.iproduct_.material_.name }}</template>
</el-table-column>
<el-table-column label="批次" >
<template slot-scope="scope" >{{ scope.row.iproduct_.batch }}</template>
</el-table-column>
<el-table-column label="仓库">
<template slot-scope="scope">{{ scope.row.iproduct_.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="是否已军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template>
</el-table-column>
<el-table-column label="军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else>合格</el-tag></template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
<el-descriptions-item label="客户名称" v-if="salesdetail.customer">
{{ salesdetail.customer_.name }}</el-descriptions-item
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
<el-descriptions-item label="产品名称" v-if="salesdetail.product">
{{ salesdetail.product_.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.order">
{{ salesdetail.order_.contract_.name }}</el-descriptions-item
>
</el-descriptions>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>关联产品信息</span>
</div>
<el-table
ref="singleTable"
:data="saleproduct"
highlight-current-row
style="width: 100%"
>
<el-table-column type="index" width="50" />
<el-table-column label="产品编号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope">{{
scope.row.iproduct_.material_.name
}}</template>
</el-table-column>
<el-table-column label="批次">
<template slot-scope="scope">{{
scope.row.iproduct_.batch
}}</template>
</el-table-column>
<el-table-column label="仓库">
<template slot-scope="scope">{{
scope.row.iproduct_.warehouse_.name
}}</template>
</el-table-column>
<el-table-column label="是否已军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-card>
</el-table-column>
<el-table-column label="军检">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else>合格</el-tag></template
>
</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">
<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
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<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>
</div>
</template>
<script>
import {getSale,getSaleproductList,deleteSaleproduct} from "@/api/sam";
import {
getSale,
getSaleproductList,
deleteSaleproduct,
gePack,
subPack,
notPackremark,
} from "@/api/sam";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultepackData = {
packnum: ""
}
export default {
components: { Pagination },
data() {
return {
salesdetail:"",
saleproduct:"",
salesdetail: "",
saleproduct: "",
packlist: [],
dialogVisible: false,
dialogVisibles:false,
packData:defaultepackData,
notpackData:{remark:""},
detail: [],
saleproductId: null,
saleProductid:null,
dialogType: "new",
};
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.id = this.$route.params.id;
this.getList();
this.getSaleproductLists();
},
methods: {
checkPermission,
//详情
getList() {
getSale(this.id).then((response) => {
if (response.data) {
this.salesdetail = response.data;
}
});
},
getSaleproductLists()
{
getSaleproductList({sale:this.id,page:0}).then((response) => {
getSaleproductLists() {
getSaleproductList({ sale: this.id, page: 0 }).then((response) => {
if (response.data) {
this.saleproduct = response.data;
}
});
},
handleDelete(scope) {
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
@ -140,7 +266,58 @@ export default {
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>