备料系统
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span>零件图号:</span>
|
||||
<el-select v-model="inventoryStateValue" placeholder="零件图号" size="small" clearable>
|
||||
<el-select v-model="partDrawingNumberValue" placeholder="零件图号" size="small" clearable>
|
||||
<el-option
|
||||
v-for="item in inventoryState"
|
||||
v-for="item in partDrawingNumber"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
@@ -29,32 +29,32 @@
|
||||
<el-table-column type="selection" align="center" width="55"/>
|
||||
<el-table-column label="零件图号" min-width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
{{ scope.row.零件图号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零件名称" min-width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料型号 }}
|
||||
{{ scope.row.零件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" min-width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料规格 }}
|
||||
{{ scope.row.批次数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="材料" min-width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.供货商 }}
|
||||
{{ scope.row.材料 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="90" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.当前库存量 }}
|
||||
{{ scope.row.原材料规格 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备料" min-width="90" align="center">
|
||||
<el-table-column label="重量" min-width="90" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.当前库存量 }}
|
||||
{{ scope.row.重量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -75,7 +75,7 @@
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<span>采购单号:</span>
|
||||
<el-input v-model="offlineContract" placeholder="离线合同号" size="small" clearable/>
|
||||
<el-input v-model="purchasingOrder" placeholder="采购单号" size="small" clearable/>
|
||||
<span>供应商:</span>
|
||||
<el-input v-model="supplierName0" placeholder="供应商" size="small" clearable/>
|
||||
<el-button
|
||||
@@ -89,7 +89,7 @@
|
||||
size="small"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px"
|
||||
@click="addOfflineContract">创建采购单</el-button>
|
||||
@click="addPurchaseOrder">创建采购单</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@@ -101,24 +101,24 @@
|
||||
size="small"
|
||||
icon="el-icon-download"
|
||||
style="margin-left: 10px"
|
||||
@click="addMateriel">保存</el-button>
|
||||
@click="saveMateriel">保存</el-button>
|
||||
</div>
|
||||
<el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="230px" size="mini" highlight-current-row @row-click="searchTable3">
|
||||
<el-table-column label="单号状态" align="center" width="100" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===1" type="warning" size="small">编辑中</el-tag>
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===2&&Number(scope.row.总采购数量)!==Number(scope.row.总到货数量)" type="primary" size="small">已采购</el-tag>
|
||||
<el-tag v-if="Number(scope.row.总采购数量)===Number(scope.row.总到货数量)&&Number(scope.row.总采购数量)!==0" type="success" size="small">全部到货</el-tag>
|
||||
<el-tag v-if="Number(scope.row.采购计划状态)===0" type="warning" size="small">编辑中</el-tag>
|
||||
<el-tag v-if="Number(scope.row.采购计划状态)===1" type="primary" size="small">已保存</el-tag>
|
||||
<el-tag v-if="Number(scope.row.采购计划状态)===2" type="success" size="small">已导出</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="采购单名称" align="center" min-width="170">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.离线合同名称 }}
|
||||
{{ scope.row.采购单名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="供应商" align="center" min-width="250">
|
||||
@@ -128,23 +128,23 @@
|
||||
</el-table-column>
|
||||
<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] }}
|
||||
{{ scope.row.下单日期.split(' ')[0] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划完成时间" align="center" width="100">
|
||||
<el-table-column label="计划完成日期" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.规定到货时间.split(' ')[0] }}
|
||||
{{ scope.row.计划完成日期.split(' ')[0] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="primary" size="mini" icon="el-icon-edit" @click="editOfflineContract(scope.row)"/>
|
||||
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="danger" size="mini" icon="el-icon-delete" @click="deleteOfflineContract(scope.row)"/>
|
||||
<el-button :disabled="parseInt(scope.row.采购计划状态)===2" type="primary" size="mini" icon="el-icon-edit" @click="editPurchaseOrder(scope.row)"/>
|
||||
<el-button :disabled="parseInt(scope.row.采购计划状态)===2" type="danger" size="mini" icon="el-icon-delete" @click="deletePurchaseOrder(scope.row)"/>
|
||||
<el-button type="warning" size="mini" icon="el-icon-download" @click="exportExcel(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -160,40 +160,40 @@
|
||||
@size-change="handleSizeChange2"
|
||||
@current-change="handleCurrentChange2"/>
|
||||
</div>
|
||||
<el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 300px;" height="300px" size="mini" show-summary>
|
||||
<el-table v-loading="" :data="tableData3" border style="max-height: 300px;" height="300px" size="mini">
|
||||
<el-table-column label="零件图号" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.离线合同编号 }}
|
||||
{{ scope.row.零件图号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零件名称" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
{{ scope.row.零件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="材料" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料规格 }}
|
||||
{{ scope.row.材料 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" align="center" min-width="200">
|
||||
<el-table-column label="单位" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料型号 }}
|
||||
<el-input v-model="scope.row.单位" :disabled="disable" size="mini" style="width:70px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.数量" :disabled="disable" size="mini" style="width:70px"/>
|
||||
{{ scope.row.批次数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成品尺寸" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.参考价格 }}
|
||||
{{ scope.row.重量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" min-width="100" prop="单价">
|
||||
<el-table-column label="备注" align="center" min-width="100" prop="备注">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.单价" :disabled="disable" size="mini" style="width:70px"/>
|
||||
<el-input v-model="scope.row.备注1" :disabled="disable" size="mini" style="width:150px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" min-width="100">
|
||||
@@ -319,13 +319,13 @@
|
||||
<el-form ref="form2" :model="form2" :rules="rules2" label-position="right" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="离线合同编号" prop="离线合同编号">
|
||||
<el-input v-model="form2.离线合同编号" size="small"/>
|
||||
<el-form-item label="采购单名称" prop="采购单名称">
|
||||
<el-input v-model="form2.采购单名称" size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="离线合同名称" prop="离线合同名称">
|
||||
<el-input v-model="form2.离线合同名称" size="small"/>
|
||||
<el-form-item label="采购员" prop="采购员">
|
||||
<el-input v-model="name" readonly size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -338,9 +338,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规定到货时间" prop="规定到货时间">
|
||||
<el-form-item label="计划完成日期" prop="计划完成日期">
|
||||
<el-date-picker
|
||||
v-model="form2.规定到货时间"
|
||||
v-model="form2.计划完成日期"
|
||||
size="small"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
@@ -349,117 +349,98 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="离线合同备注" prop="离线合同备注">
|
||||
<el-input v-model="form2.离线合同备注" size="small" type="textarea" style="width: 550px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button
|
||||
v-show="title2==='创建离线合同'"
|
||||
v-show="title2==='创建采购单'"
|
||||
type="primary"
|
||||
size="small"
|
||||
icon="el-icon-check"
|
||||
@click="submitAddOfflineContract">确定</el-button>
|
||||
@click="submitAddPurchaseOrder">确定</el-button>
|
||||
<el-button
|
||||
v-show="title2==='编辑离线合同'"
|
||||
v-show="title2==='编辑采购单'"
|
||||
type="primary"
|
||||
size="small"
|
||||
icon="el-icon-check"
|
||||
@click="submitEditOfflineContract">确定</el-button>
|
||||
@click="submitEditPurchaseOrder">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<div id="offlineContract" style="width: 800px;margin: 0 auto;display: none">
|
||||
<table class="offlineContract" cellspacing="0px" align="center" border="1 solid black" width="100%">
|
||||
<tr>
|
||||
<th colspan="14"><h1>离线合同</h1></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" rowspan="2" style="text-align:center;font-size: 30px;font-weight: bold">GAOJING</td>
|
||||
<td width="80px">合同名称</td>
|
||||
<td id="contractName" colspan="3" style="text-align: left;"/>
|
||||
<td width="80px">供应商</td>
|
||||
<td id="supplier" colspan="4" style="text-align: left;"/>
|
||||
<td id="qrCode" colspan="2" rowspan="2">二维码粘贴处</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="80px">合同编号</td>
|
||||
<td id="contractNum" colspan="3" style="text-align: left;"/>
|
||||
<td width="80px">采购员</td>
|
||||
<td id="buyer" colspan="4" style="text-align: left;"/>
|
||||
</tr>
|
||||
<tr id="tablehead">
|
||||
<td>序号</td>
|
||||
<td colspan="2">名称</td>
|
||||
<td colspan="2">规格</td>
|
||||
<td colspan="2">型号</td>
|
||||
<td colspan="2">数量</td>
|
||||
<td colspan="2">单价</td>
|
||||
<td colspan="2">合计</td>
|
||||
<td>备注</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总计</td>
|
||||
<td colspan="10"/>
|
||||
<td id="total" colspan="2" style="text-align: left;"/>
|
||||
<td/>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<el-card style="width: 1100px;margin: 20px auto">
|
||||
<div id="cjn" style="width: 1000px;margin: 0 auto">
|
||||
<table cellspacing="0px" align="center" border="1 solid black" width="100%">
|
||||
<tr>
|
||||
<th colspan="14"><h3>江苏高精机电装备有限公司</h3></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="14"><h4>锻件采购计划表</h4></th>
|
||||
</tr>
|
||||
<tr style="height: 40px">
|
||||
<td colspan="2" style="text-align: center;width: 15%">下单单位</td>
|
||||
<td colspan="5" style="text-align: center;width: 35%">{{ 下单单位 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 15%">单号</td>
|
||||
<td colspan="5" style="text-align: center;width: 35%">{{ 单号 }}</td>
|
||||
</tr>
|
||||
<tr style="height: 40px">
|
||||
<td colspan="2" style="text-align: center;width: 15%">下单日期</td>
|
||||
<td colspan="5" style="text-align: center;width: 35%">{{ 下单日期 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 15%">计划完成日期</td>
|
||||
<td colspan="5" style="text-align: center;width: 35%">{{ 计划完成日期 }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0px" align="center" border="1 solid black" width="100%" style="margin-top: 20px">
|
||||
<tr id="tablehead" style="height: 35px">
|
||||
<td style="text-align: center;width: 7%">序号</td>
|
||||
<td colspan="2" style="text-align: center;width: 20%">图号</td>
|
||||
<td colspan="2" style="text-align: center;width: 10%">名称</td>
|
||||
<td colspan="2" style="text-align: center;width: 10%">材料</td>
|
||||
<td colspan="2" style="text-align: center;width: 8%">单位</td>
|
||||
<td colspan="2" style="text-align: center;width: 8%">数量</td>
|
||||
<td colspan="2" style="text-align: center;width: 20%">成品尺寸</td>
|
||||
<td style="text-align: center;width: 17%">备注</td>
|
||||
</tr>
|
||||
<tr v-for="(list, index) in tableData3" :key="index" style="height: 35px">
|
||||
<td style="text-align: center;width: 7%">{{ index + 1 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 20%">{{ list.零件图号 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 10%">{{ list.零件名称 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 10%">{{ list.材料 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 8%">{{ list.单位 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 8%">{{ list.批次数量 }}</td>
|
||||
<td colspan="2" style="text-align: center;width: 20%">{{ list.成品尺寸 }}</td>
|
||||
<td style="text-align: center;width: 17%">{{ list.备注1 }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import { searchInventoryNum, searchOfflineContract, searchOfflineContract2, searchSupplier, addOfflineContract, editOfflineContract, deleteOfflineContract, searchMateriel,
|
||||
addMateriel, deleteMateriel, doneOfflineContact, setSafeValue } from '@/api/WorkshopProcurement/OfflineContract1'
|
||||
<script>import { initPartDrawing, searchPurchasedMaterials, searchPurchaseOrder, searchSupplier, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, searchMateriel,
|
||||
addMateriel, deleteMateriel, saveMateriel } from '@/api/WorkshopProcurement/CreatingPurchasingMaterials'
|
||||
import QRCode from 'qrcode'
|
||||
import $ from 'jquery'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: '', // 离线合同
|
||||
name: '', // 采购计划
|
||||
data() {
|
||||
return {
|
||||
partDrawingNumberValue: '',
|
||||
partDrawingNumber: [],
|
||||
Buyer: '',
|
||||
showMaterialTable: true,
|
||||
loading1: false,
|
||||
title2: '',
|
||||
purchaseStateValue: 2, // 采购状态 全部
|
||||
purchaseState: [
|
||||
{
|
||||
label: '未采购',
|
||||
value: 1
|
||||
}, {
|
||||
label: '全部',
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
check1: 0,
|
||||
check2: 0,
|
||||
check3: 0,
|
||||
check4: 0,
|
||||
materialName: '',
|
||||
inventoryStateValue: '', // 库存状态
|
||||
inventoryState: [
|
||||
{
|
||||
label: '充足',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: '不足',
|
||||
value: 1
|
||||
}
|
||||
],
|
||||
tableData1: [],
|
||||
pageCurrent1: 1,
|
||||
pageSize1: 10,
|
||||
total1: 0,
|
||||
offlineContractNum: '', // 离线合同流水号
|
||||
offlineContract: '', // 离线合同号
|
||||
purchasingOrder: '', // 采购单号
|
||||
purchasingOrderNumber: '', // 采购计划流水号
|
||||
supplierName0: '', // 供应商名称(外面的)
|
||||
supplierName: '', // 供应商名称
|
||||
payTime: [], // 付款时间节点
|
||||
tableData2: [],
|
||||
total2: 0,
|
||||
pageCurrent2: 1,
|
||||
@@ -492,34 +473,31 @@ export default {
|
||||
fax: '', // 传真
|
||||
tableData01: [],
|
||||
dialogVisible2: false,
|
||||
下单单位: '',
|
||||
下单日期: '',
|
||||
单号: '',
|
||||
计划完成日期: '',
|
||||
form2: {
|
||||
离线合同流水号: '',
|
||||
离线合同编号: '',
|
||||
离线合同名称: '',
|
||||
采购计划流水号: '',
|
||||
采购单名称: '',
|
||||
供应商流水号: '',
|
||||
供应商名称: '',
|
||||
规定到货时间: '',
|
||||
离线合同备注: '付款方式:;付款时间:;到货时间:;开票信息:;其他说明:;'
|
||||
计划完成日期: ''
|
||||
},
|
||||
rules2: { // 离线合同表单验证规则
|
||||
离线合同编号: [{ required: true, message: '请填写离线合同编号' }],
|
||||
离线合同名称: [{ required: true, message: '请填写离线合同名称' }],
|
||||
rules2: { // 采购表单验证规则
|
||||
采购单名称: [{ required: true, message: '请填写采购单名称' }],
|
||||
供应商名称: [{ required: true, message: '请选择供应商' }],
|
||||
规定到货时间: [{ required: true, message: '请选择规定到货时间' }],
|
||||
运费: [{ required: true, message: '请填写运费' }],
|
||||
付款方式: [{ required: true, message: '请选择付款方式' }]
|
||||
计划完成日期: [{ required: true, message: '请选择计划完成日期' }]
|
||||
},
|
||||
tableData3: [],
|
||||
materielGroup: [], // 物料流水号组
|
||||
partGroup: [], // 离线合同明细流水号组
|
||||
numGroup: [], // 数量组
|
||||
priceGroup: [], // 单价组
|
||||
totalPrice: 0, // 合同总额
|
||||
materielGroup: [], // 工艺计划流水号组
|
||||
partGroup: [], // 采购计划明细流水号组
|
||||
unit: [], // 单位组
|
||||
Remarks: [], // 备注组
|
||||
tableData4: [], // 合同模板
|
||||
stipulateArrivalTime: '', // 规定到货时间
|
||||
离线合同状态: '',
|
||||
采购计划状态: '',
|
||||
paramRow: '', // 参数row
|
||||
disable: true // 其他的禁用
|
||||
disable: false // 其他的禁用
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -550,18 +528,21 @@ export default {
|
||||
img.src = url
|
||||
})
|
||||
},
|
||||
fetchData() {},
|
||||
searchTable1() { // 查询物料库物料
|
||||
fetchData() {
|
||||
initPartDrawing(0, this.partDrawingNumberValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.partDrawingNumber.push({
|
||||
label: response.data[i].零件图号,
|
||||
value: response.data[i].零件图号
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
searchTable1() { // 查询外购备料
|
||||
this.loading1 = true
|
||||
this.materialName ? this.check1 = 1 : this.check1 = 0
|
||||
this.inventoryStateValue ? this.check2 = 1 : this.check2 = 0
|
||||
searchInventoryNum(this.pageCurrent1, this.pageSize1, this.check1, this.materialName, this.check2, this.inventoryStateValue, this.purchaseStateValue).then(response => {
|
||||
this.partDrawingNumberValue ? this.check1 = 1 : this.check1 = 0
|
||||
searchPurchasedMaterials(this.pageCurrent1, this.pageSize1, this.check1, this.partDrawingNumberValue).then(response => {
|
||||
this.tableData1 = response.data.rows
|
||||
this.tableData1.map(v => {
|
||||
this.$set(v, 'changeSafeValue', false)
|
||||
v.原安全库存量 = v.安全库存量
|
||||
return v
|
||||
})
|
||||
this.total1 = response.data.total
|
||||
this.loading1 = false
|
||||
})
|
||||
@@ -578,75 +559,45 @@ export default {
|
||||
handleSelectionChange(val) {
|
||||
this.materielGroup = []
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
this.materielGroup.push(val[i].物料流水号)
|
||||
this.materielGroup.push(val[i].工艺计划流水号)
|
||||
}
|
||||
},
|
||||
cancelEdit(row) { // 取消设置
|
||||
row.安全库存量 = row.原安全库存量
|
||||
row.changeSafeValue = false
|
||||
this.$message('取消修改')
|
||||
},
|
||||
confirmEdit(row) { // 确认设置
|
||||
Number(row.安全库存量) ? row.安全库存量 = Number(row.安全库存量) : row.安全库存量 = 0
|
||||
setSafeValue(row.物料流水号, parseInt(row.安全库存量)).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
row.changeSafeValue = false
|
||||
this.$message.success('设置成功')
|
||||
this.searchTable1()
|
||||
} else {
|
||||
this.$message.error('设置失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
searchTable2() { // 查询离线合同列表
|
||||
this.offlineContract ? this.check3 = 1 : this.check3 = 0
|
||||
searchTable2() { // 查询采购单列表
|
||||
this.purchasingOrder ? this.check3 = 1 : this.check3 = 0
|
||||
this.supplierName0 ? this.check4 = 1 : this.check4 = 0
|
||||
searchOfflineContract(this.pageCurrent2, this.pageSize2, this.check3, this.offlineContract, this.check4, this.supplierName0).then(response => {
|
||||
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) { // 离线合同列表分页
|
||||
handleSizeChange2(val) { // 采购单列表分页
|
||||
this.pageSize2 = val
|
||||
this.searchTable2()
|
||||
},
|
||||
handleCurrentChange2(val) { // 离线合同列表分页
|
||||
handleCurrentChange2(val) { // 采购单列表分页
|
||||
this.pageCurrent2 = val
|
||||
this.searchTable2()
|
||||
},
|
||||
addOfflineContract() { // 创建离线合同
|
||||
addPurchaseOrder() { // 创建采购单
|
||||
if (this.$refs['form2'] !== undefined) {
|
||||
this.$refs['form2'].resetFields()
|
||||
}
|
||||
this.title2 = '创建离线合同'
|
||||
this.form2.离线合同编号 = ''
|
||||
this.title2 = '创建采购单'
|
||||
this.form2.离线合同名称 = ''
|
||||
this.form2.供应商流水号 = ''
|
||||
this.form2.供应商名称 = ''
|
||||
this.form2.规定到货时间 = ''
|
||||
this.form2.离线合同备注 = '付款方式:;付款时间:;到货时间:;开票信息:;其他说明:;'
|
||||
this.form2.计划完成日期 = ''
|
||||
this.dialogVisible2 = true
|
||||
},
|
||||
submitAddOfflineContract() { // 新建离线合同
|
||||
submitAddPurchaseOrder() { // 新建采购单
|
||||
this.$refs['form2'].validate((valid) => {
|
||||
if (valid) {
|
||||
const numGroup1 = [] // 空数组,放现有的询价单号
|
||||
searchOfflineContract2().then(response => { // 先查询判断是否存在
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
numGroup1.push(response.data[i].离线合同编号)
|
||||
}
|
||||
}).then(() => {
|
||||
if (numGroup1.indexOf(this.form2.离线合同编号) !== -1) {
|
||||
this.$message.error('该离线合同编号已存在')
|
||||
} else {
|
||||
addOfflineContract(this.form2.离线合同编号, this.form2.离线合同名称, this.form2.供应商流水号, this.id, this.form2.规定到货时间, this.form2.离线合同备注).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('新建离线合同成功')
|
||||
this.searchTable2()
|
||||
this.dialogVisible2 = false
|
||||
} else { this.$message.error('新建离线合同失败') }
|
||||
})
|
||||
}
|
||||
addPurchaseOrder(this.form2.采购单名称, this.form2.供应商流水号, this.id, this.form2.计划完成日期).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('新建采购单成功')
|
||||
this.searchTable2()
|
||||
this.dialogVisible2 = false
|
||||
} else { this.$message.error('新建采购单失败') }
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!')
|
||||
@@ -654,42 +605,28 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
editOfflineContract(row) {
|
||||
editPurchaseOrder(row) {
|
||||
if (this.$refs['form2'] !== undefined) {
|
||||
this.$refs['form2'].resetFields()
|
||||
}
|
||||
this.title2 = '编辑离线合同'
|
||||
this.form2.离线合同流水号 = row.离线合同流水号
|
||||
this.form2.离线合同编号 = row.离线合同编号
|
||||
this.form2.离线合同名称 = row.离线合同名称
|
||||
this.form2.供应商流水号 = row.供应商流水号
|
||||
this.title2 = '编辑采购单'
|
||||
this.form2.采购计划流水号 = row.采购计划流水号
|
||||
this.form2.采购单名称 = row.采购单名称
|
||||
this.form2.供应商流水号 = row.供应商
|
||||
this.form2.供应商名称 = row.供应商名称
|
||||
this.form2.规定到货时间 = row.规定到货时间
|
||||
this.form2.离线合同备注 = row.离线合同备注
|
||||
this.form2.计划完成日期 = row.计划完成日期
|
||||
this.dialogVisible2 = true
|
||||
},
|
||||
submitEditOfflineContract() {
|
||||
submitEditPurchaseOrder() {
|
||||
this.$refs['form2'].validate((valid) => {
|
||||
if (valid) {
|
||||
const numGroup1 = [] // 空数组,放现有的离线合同号
|
||||
const numGroup2 = [] // 空数组,放现有的离线合同流水号
|
||||
searchOfflineContract2().then(response => { // 先查询判断是否存在
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
numGroup1.push(response.data[i].离线合同编号)
|
||||
numGroup2.push(response.data[i].离线合同流水号)
|
||||
}
|
||||
}).then(() => {
|
||||
if (numGroup1.indexOf(this.form2.离线合同编号) !== -1 && numGroup1.indexOf(this.form2.离线合同编号) !== numGroup2.indexOf(parseInt(this.form2.离线合同流水号))) {
|
||||
this.$message.error('该离线合同编号已存在')
|
||||
} else {
|
||||
editOfflineContract(this.form2.离线合同流水号, this.form2.离线合同编号, this.form2.离线合同名称, this.form2.供应商流水号, this.id, this.form2.规定到货时间, this.form2.离线合同备注).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('修改离线合同成功')
|
||||
this.searchTable2()
|
||||
this.dialogVisible2 = false
|
||||
} else { this.$message.error('修改离线合同失败') }
|
||||
})
|
||||
}
|
||||
console.log(this.form2.采购计划流水号, this.form2.采购单名称, this.form2.供应商流水号, this.form2.计划完成日期)
|
||||
editPurchaseOrder(this.form2.采购计划流水号, this.form2.采购单名称, this.form2.供应商流水号, this.form2.计划完成日期).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('修改采购单成功')
|
||||
this.searchTable2()
|
||||
this.dialogVisible2 = false
|
||||
} else { this.$message.error('修改采购单失败') }
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!')
|
||||
@@ -697,18 +634,18 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteOfflineContract(row) { // 删除离线合同
|
||||
deletePurchaseOrder(row) { // 删除采购单
|
||||
this.$confirm('确定删除该合同?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteOfflineContract(row.离线合同流水号).then(response => {
|
||||
deletePurchaseOrder(row.采购计划流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('删除成功')
|
||||
this.searchTable2()
|
||||
this.disable = true
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
searchMateriel(this.purchasingOrderNumber).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('数据占用,删除失败') }
|
||||
@@ -772,68 +709,76 @@ export default {
|
||||
submitSelectSupplier() { // 确定选择供应商
|
||||
this.dialogVisible1 = false
|
||||
},
|
||||
searchTable3(row) { // 查询离线合同明细
|
||||
this.stipulateArrivalTime = row.规定到货时间.split(' ')[0]
|
||||
this.offlineContractNum = row.离线合同流水号
|
||||
this.离线合同状态 = row.离线合同状态
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
searchTable3(row) { // 查询采购计划明细
|
||||
this.purchasingOrderNumber = row.采购计划流水号
|
||||
this.采购计划状态 = row.采购计划状态
|
||||
this.下单单位 = row.供应商名称
|
||||
this.单号 = row.采购单号
|
||||
this.计划完成日期 = row.计划完成日期.split(' ')[0]
|
||||
this.下单日期 = row.下单日期.split(' ')[0]
|
||||
searchMateriel(this.purchasingOrderNumber).then(response => {
|
||||
console.log(response.data)
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
Number(row.离线合同状态) !== 1 ? this.disable = true : this.disable = false // 是否为编辑模式
|
||||
},
|
||||
getSummaries(param) { // 合计
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总价'
|
||||
} else if (index === 7) {
|
||||
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
sums[index] += ' 元'
|
||||
} else {
|
||||
sums[index] = 'N/A'
|
||||
}
|
||||
}
|
||||
})
|
||||
return sums
|
||||
},
|
||||
addMateriel() { // 将物料选入离线合同
|
||||
if (!this.offlineContractNum) {
|
||||
this.$message.warning('请选择离线合同')
|
||||
} else if (Number(this.离线合同状态) !== 1) {
|
||||
this.$message.warning('请选择可编辑的离线合同')
|
||||
addMateriel() { // 将材料选入请购单
|
||||
if (!this.purchasingOrderNumber) {
|
||||
this.$message.warning('请选择采购单')
|
||||
} else if (this.materielGroup.length === 0) {
|
||||
this.$message.warning('请勾选物料')
|
||||
} else {
|
||||
addMateriel(this.offlineContractNum, this.materielGroup).then(response => {
|
||||
addMateriel(this.purchasingOrderNumber, this.materielGroup).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('选入成功')
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
this.searchTable1()
|
||||
searchMateriel(this.purchasingOrderNumber).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('选入失败') }
|
||||
})
|
||||
}
|
||||
},
|
||||
saveMateriel() { // 保存数据
|
||||
this.partGroup = []
|
||||
this.unit = []
|
||||
this.Remarks = []
|
||||
if (!this.purchasingOrderNumber) {
|
||||
this.$message.warning('请选择采购单')
|
||||
} else {
|
||||
for (let i = 0; i < this.tableData3.length; i++) {
|
||||
this.partGroup.push(this.tableData3[i].采购计划明细流水号)
|
||||
if (this.tableData3[i].单位 === '' || this.tableData3[i].单位 === null) {
|
||||
this.tableData3[i].单位 = '无'
|
||||
}
|
||||
this.unit.push(this.tableData3[i].单位)
|
||||
if (this.tableData3[i].备注1 === '' || this.tableData3[i].备注1 === null) {
|
||||
this.tableData3[i].备注1 = '无'
|
||||
}
|
||||
this.Remarks.push(this.tableData3[i].备注1)
|
||||
}
|
||||
saveMateriel(this.purchasingOrderNumber, this.partGroup, this.unit, this.Remarks).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('保存成功')
|
||||
this.searchTable2()
|
||||
searchMateriel(this.purchasingOrderNumber).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('保存失败') }
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteMateriel(row) { // 移除物料
|
||||
this.$confirm('确定移除该物料?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteMateriel(row.离线合同明细流水号).then(response => {
|
||||
console.log(row)
|
||||
deleteMateriel(row.采购计划明细流水号, row.工艺计划流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('移除成功')
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
this.searchTable1()
|
||||
searchMateriel(this.purchasingOrderNumber).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('移除失败') }
|
||||
@@ -845,83 +790,14 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
doneOfflineContact() { // 生成离线合同
|
||||
this.$confirm('确定生成合同?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.totalPrice = 0
|
||||
this.partGroup = []
|
||||
this.numGroup = []
|
||||
this.priceGroup = []
|
||||
for (let i = 0; i < this.tableData3.length; i++) {
|
||||
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
|
||||
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
|
||||
this.numGroup.push(this.tableData3[i].数量)
|
||||
this.priceGroup.push(this.tableData3[i].单价)
|
||||
}
|
||||
doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('离线合同生成成功')
|
||||
this.searchTable2()
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
this.tableData3 = response.data
|
||||
this.disable = true // 是否为编辑模式
|
||||
})
|
||||
} else { this.$message.error('离线合同生成失败') }
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
},
|
||||
exportExcel(row) {
|
||||
exportExcel() {
|
||||
this.$confirm('确定导出该合同?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const children = document.getElementsByClassName('tableData')
|
||||
const parent = document.getElementsByClassName('offlineContract')[0]
|
||||
if (children.length !== 0) {
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
parent.removeChild(children[i])
|
||||
}
|
||||
}
|
||||
const tr = []
|
||||
let length = 0
|
||||
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length
|
||||
for (let i = 0; i < length; i++) {
|
||||
tr[i] = document.createElement('tr')
|
||||
tr[i].setAttribute('class', 'tableData')
|
||||
tr[i].innerHTML = `<td style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td style="height: 40px"/>`
|
||||
document.getElementById('tablehead').after(tr[i])
|
||||
}
|
||||
let total = 0
|
||||
for (let j = 0; j < this.tableData3.length; j++) {
|
||||
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
|
||||
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.tableData3[j].物料名称
|
||||
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料规格
|
||||
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料型号
|
||||
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量
|
||||
document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.tableData3[j].单价
|
||||
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].数量 * this.tableData3[j].单价
|
||||
document.getElementsByClassName('tableData')[j].children[7].innerHTML = ''
|
||||
total += this.tableData3[j].数量 * this.tableData3[j].单价
|
||||
}
|
||||
document.getElementById('contractNum').innerHTML = row.离线合同编号
|
||||
document.getElementById('contractName').innerHTML = row.离线合同名称
|
||||
document.getElementById('supplier').innerHTML = row.供应商名称
|
||||
document.getElementById('buyer').innerHTML = row.采购员
|
||||
document.getElementById('total').innerHTML = total
|
||||
$('#qrCode').html(`<img id="img" style="display: block;margin: 0 auto">`)
|
||||
this.useqrcode(row.离线合同流水号) // 显示二维码
|
||||
}).then(() => {
|
||||
const htmlNode = $('#offlineContract').html()
|
||||
const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;')
|
||||
const htmlNode = $('#cjn').html()
|
||||
const body = $('body')
|
||||
body.children().hide()
|
||||
const printNode = $(htmlNode)
|
||||
body.append(printNode)
|
||||
|
||||
Reference in New Issue
Block a user