This commit is contained in:
zhangdingyu
2019-09-30 17:23:33 +08:00
parent f78dfa9952
commit f86a745aad
2 changed files with 532 additions and 53 deletions

View File

@@ -1,27 +1,99 @@
import request from '@/utils/request'
// 查询原材料库存
export function searchRawMaterial(num, pageCurrent, pageSize) {
// 查询采购单
export function searchPurchaseOrder(pageCurrent, pageSize, check1, num, check2, name) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_原材料库存管理_查询',
param: '原材料名称=' + num,
name: '备料管理_采购计划_查询数据_到货',
param: `采购单号_check=${check1}&采购单号=${num}&供应商名称_check=${check2}&供应商名称=${name}`,
Pagination: pageCurrent + '&' + pageSize
}
})
}
// 保存重量和备注
export function saveWeight(num1, num2, num3, num4) {
// 查询采购计划明细
export function searchMateriel(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '备料管理_采购计划明细_查询数据_未选入',
param: `采购计划流水号=${num}`
}
})
}
// 查询到货单
export function searchArriveOrder(pageCurrent, pageSize) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '备料管理_到货单查询',
Pagination: pageCurrent + '&' + pageSize
}
})
}
// 新增到货单
export function addPurchaseOrder(num1, num2, num3, num4, num5) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '备料管理_采购计划明细_保存重量和备注',
param: `采购计划明细流水号=${num1}&重量=${num2}&备注=${num3}&单价=${num4}`
name: '备料管理_新增到货单',
param: `材料=${num1}&单位=${num2}&数量=${num3}&金额=${num4}&备注=${num5}`
}
})
}
// 编辑采购单
export function editPurchaseOrder(num1, num2, num3, num4, num5, num6) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '备料管理_编辑到货单',
param: `材料=${num1}&单位=${num2}&数量=${num3}&金额=${num4}&备注=${num5}&到货单流水号=${num6}`
}
})
}
// 删除采购单
export function deletePurchaseOrder(PurchaseOrderNameValue) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '备料管理_删除到货单',
param: `到货单流水号=${PurchaseOrderNameValue}`
}
})
}
// 查询采购计划明细
export function searchTable5(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '备料管理_到货单明细查询',
param: `到货单流水号=${num}`
}
})
}
// 选入
export function addMateriel(num1, num2, num3) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '备料管理_到货单明细_选入',
param: `到货单流水号=${num1}&工艺计划流水号组=${num2}&采购计划明细流水号组=${num3}`
}
})
}

View File

@@ -1,58 +1,465 @@
<template>
<div>
<el-card>
<el-col style="margin-left: 0px">
<span>零件图:</span>
<el-input v-model="partDrawingNumber" placeholder="零件图号" size="small" clearable style="margin: 3px 0"/>
<el-tooltip :open-delay="1200" effect="dark" content="查询备料零件" placement="top">
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<div>
<span>采购单:</span>
<el-input v-model="purchasingOrder" placeholder="采购单号" size="small" style="margin: 3px 0" clearable/>
<span style="margin-left: 10px">供应商:</span>
<el-input v-model="supplierName0" placeholder="供应商" size="small" clearable/>
<el-tooltip :open-delay="1200" effect="dark" content="查询采购单" placement="top">
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent2=1;pageSize2=10;total2=0;searchTable2()">查询</el-button>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="向选择的采购单里添加采购零件" placement="top">
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel">选入物料</el-button>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="将零件打回重新分配备料计划" placement="top">
<el-button type="danger" size="small" icon="el-icon-download" style="margin-left: 10px" @click="back">打回</el-button>
</el-tooltip>
<el-table v-loading="loading1" :data="tableData1" border stripe highlight-current-row style="width: 100%;margin-top:3px;" height="330" size="mini" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column label="零件图号" min-width="100" align="center">
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel">选入原材料</el-button>
</div>
<el-table v-loading="" :data="tableData2" border stripe style="max-height: 460px;" height="230px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table-column label="采购单号" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.零件图 }}
{{ scope.row.采购单 }}
</template>
</el-table-column>
<el-table-column label="零件名称" min-width="100" align="center">
<el-table-column label="采购单名称" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
{{ scope.row.采购单名称 }}
</template>
</el-table-column>
<el-table-column label="数量" width="140" align="center">
<el-table-column label="供应商" align="center" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.批次数量 }}
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center">
<el-table-column label="采购员" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.材料 }}
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="下单日期" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.下单日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="计划完成日期" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.计划完成日期.split(' ')[0] }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-size="pageSize1"
:total="total1"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-col>
<el-table v-loading="" :data="tableData3" border highlight-current-row stripe style="margin: 3px 0" height="200px" size="mini" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="物料编码" align="center" width="200">
<template slot-scope="scope">
{{ scope.row.物料零件编码 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" >
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="成品尺寸(长、宽、高)" align="center">
<template slot-scope="scope">
{{ scope.row.成品尺寸 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" >
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注1 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<div>
<span>采购单号:</span>
<el-input v-model="purchasingOrder" placeholder="采购单号" size="small" style="margin: 3px 0" clearable/>
<span style="margin-left: 10px">供应商:</span>
<el-input v-model="supplierName0" placeholder="供应商" size="small" clearable/>
<el-tooltip :open-delay="1200" effect="dark" content="查询采购单" placement="top">
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent4=1;pageSize4=10;total4=0;searchTable4()">查询</el-button>
</el-tooltip>
<el-button type="primary" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addPurchaseOrder">新增到货单</el-button>
</div>
<el-table v-loading="" :data="tableData4" border stripe style="max-height: 460px;" height="230px" size="mini" highlight-current-row @row-click="searchTable5">
<el-table-column label="材料" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="单位" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="金额" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.金额 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="创建日期" align="center" width="150">
<template slot-scope="scope">
{{ scope.row.日期 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" fixed="right">
<template slot-scope="scope">
<el-tooltip effect="dark" content="编辑" placement="top">
<div style="display: inline-block">
<el-button type="text" size="mini" icon="el-icon-edit-outline" @click="editPurchaseOrder(scope.row)"/>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<div style="display: inline-block">
<el-button type="text" size="mini" style="margin-left: 20px" icon="el-icon-delete" @click="deletePurchaseOrder(scope.row)"/>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent4"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize4"
:total="total4"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange4"
@current-change="handleCurrentChange4"/>
</div>
<el-table v-loading="" :data="tableData5" border highlight-current-row stripe style="margin: 3px 0" height="200px" size="mini">
<el-table-column label="物料编码" align="center" width="200">
<template slot-scope="scope">
{{ scope.row.物料编码 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" >
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="成品尺寸(长、宽、高)" align="center">
<template slot-scope="scope">
{{ scope.row.成品尺寸 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" >
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注1 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogVisible" center style="min-height: 300px" width="750px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="材料" prop="材料">
<el-input v-model="form.材料" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="单位">
<el-input v-model="form.单位" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数量" prop="数量">
<el-input v-model="form.数量" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="金额" prop="金额">
<el-input v-model="form.金额" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="备注" prop="备注">
<el-input v-model="form.备注" size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
v-show="title==='创建到货单'"
type="primary"
size="small"
icon="el-icon-check"
@click="submitAddPurchaseOrder">确定</el-button>
<el-button
v-show="title==='编辑到货单'"
type="primary"
size="small"
icon="el-icon-check"
@click="submitEditPurchaseOrder">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchPurchaseOrder, searchMateriel, addMateriel, searchArriveOrder, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, searchTable5 } from '@/api/WorkshopProcurement/NewArrivalList.js'
import { mapGetters } from 'vuex'
export default {
data() {
return {
purchasingOrder: '',
supplierName0: '',
arrest: [],
tableData2: [],
total2: 0,
pageCurrent2: 1,
pageSize2: 10,
tableData3: [],
采购计划流水号: '',
tableData4: [],
total4: 0,
pageCurrent4: 1,
pageSize4: 10,
tableData5: [],
到货单流水号: '',
form: {
材料: '',
单位: '',
数量: '',
金额: '',
备注: ''
},
dialogVisible: false,
title: '',
rules: { // 采购表单验证规则
材料: [{ required: true, message: '请填写材料' }],
单位: [{ required: true, message: '请填写单位' }],
数量: [{ required: true, message: '请填写数量' }],
金额: [{ required: true, message: '请填写金额' }],
备注: [{ required: true, message: '请填写备注' }]
},
工艺计划流水号组: [],
采购计划明细流水号组: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.searchTable2()
this.searchTable4()
},
methods: {
searchTable2() { // 查询采购单列表
this.purchasingOrder ? this.check3 = 1 : this.check3 = 0
this.supplierName0 ? this.check4 = 1 : this.check4 = 0
searchPurchaseOrder(this.pageCurrent2, this.pageSize2, this.check3, this.purchasingOrder, this.check4, this.supplierName0).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) { // 采购单列表分页
this.pageSize2 = val
this.searchTable2()
},
handleCurrentChange2(val) { // 采购单列表分页
this.pageCurrent2 = val
this.searchTable2()
},
searchTable3(row) { // 查询采购计划明细
this.采购计划流水号 = row.采购计划流水号
searchMateriel(this.采购计划流水号).then(response => {
this.tableData3 = response.data
})
},
// 查询到货单
searchTable4() {
searchArriveOrder(this.pageCurrent4, this.pageSize4).then(response => {
this.tableData4 = response.data.rows
this.total4 = response.data.total
})
},
handleSizeChange4(val) { // 采购单列表分页
this.pageSize2 = val
this.searchTable2()
},
handleCurrentChange4(val) { // 采购单列表分页
this.pageCurrent2 = val
this.searchTable2()
},
// 创建采购单
addPurchaseOrder() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = '创建到货单'
this.form.材料 = ''
this.form.单位 = ''
this.form.数量 = ''
this.form.金额 = ''
this.form.备注 = ''
this.dialogVisible = true
},
// 新增
submitAddPurchaseOrder() {
this.$refs['form'].validate((valid) => {
if (valid) {
addPurchaseOrder(this.form.材料, this.form.单位, this.form.数量, this.form.金额, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('新建到货单成功')
this.pageCurrent4 = 1
this.pageSize4 = 10
this.searchTable4()
this.dialogVisible = false
} else { this.$message.error('新建到货单失败') }
})
} else {
return false
}
})
},
// 编辑
editPurchaseOrder(row) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = '编辑到货单'
this.form.材料 = row.材料
this.form.单位 = row.单位
this.form.数量 = row.数量
this.form.金额 = row.金额
this.form.备注 = row.备注
this.dialogVisible = true
},
submitEditPurchaseOrder() {
this.$refs['form'].validate((valid) => {
if (valid) {
editPurchaseOrder(this.form.材料, this.form.单位, this.form.数量, this.form.金额, this.form.备注, this.到货单流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改到货单成功')
this.searchTable4()
this.dialogVisible = false
} else { this.$message.error('修改到货单失败') }
})
} else {
return false
}
})
},
deletePurchaseOrder(row) { // 删除采购单
this.$confirm('确定删除该合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePurchaseOrder(row.到货单流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable4()
} else { this.$message.error('数据占用,删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
searchTable5(row) {
this.到货单流水号 = row.到货单流水号
searchTable5(this.到货单流水号).then(response => {
this.tableData5 = response.data
})
},
handleSelectionChange(val) {
this.arrest = val
},
// 选入
addMateriel() {
if (!this.到货单流水号) {
this.$message.warning('请选择到货单')
} else if (this.arrest.length === 0) {
this.$message.warning('请勾选原材料')
} else {
this.工艺计划流水号组 = []
this.采购计划明细流水号组 = []
this.arrest.map(v => {
this.工艺计划流水号组.push(v.工艺计划流水号)
this.采购计划明细流水号组.push(v.采购计划明细流水号)
})
addMateriel(this.到货单流水号, this.工艺计划流水号组, this.采购计划明细流水号组).then(response => {
if (response.data[0].result === '1') {
this.$message.success('选入成功')
searchMateriel(this.采购计划流水号).then(response => {
this.tableData3 = response.data
})
searchTable5(this.到货单流水号).then(response => {
this.tableData5 = response.data
})
} else { this.$message.error('选入失败') }
})
}
}
}
}
</script>
<style scoped>