860 lines
34 KiB
Vue
860 lines
34 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-card>
|
|
<el-col :span="9">
|
|
<span>原材料名称:</span>
|
|
<el-input v-model="RawMaterialName" placeholder="原材料名称" size="mini" clearable style="width: 120px"/>
|
|
<el-button type="success" icon="el-icon-search" size="mini" style="margin-left: 10px" @click="pageCurrent=1;searchRawMaterial()">查询</el-button>
|
|
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel2">选入原材料</el-button>
|
|
<el-table :data="tableData" border style="width: 100%;height: 460px;margin-top: 15px;" height="330" size="mini" @selection-change="handleSelectionChange2">
|
|
<el-table-column type="selection" align="center" width="55"/>
|
|
<el-table-column label="原材料名称" min-width="100" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.原材料名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="block" style="margin-top: 10px;margin-bottom: 10px;">
|
|
<el-pagination
|
|
:current-page="pageCurrent"
|
|
:page-size="pageSize"
|
|
:total="total"
|
|
style="display:inline-block;width:50%"
|
|
layout="total, prev, pager, next"
|
|
@size-change="handleSizeChange1"
|
|
@current-change="handleCurrentChange1"/>
|
|
</div>
|
|
</el-col>
|
|
<el-col :span="14" style="margin-left: 20px">
|
|
<span>零件图号:</span>
|
|
<el-input v-model="partDrawingNumber" placeholder="零件图号" size="mini" clearable style="width: 120px"/>
|
|
<el-button type="success" size="mini" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
|
|
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel">选入物料</el-button>
|
|
<el-table v-loading="loading1" :data="tableData1" border style="width: 100%;height: 460px;margin-top: 15px;" 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">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.零件图号 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="零件名称" min-width="100" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.零件名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="数量" width="80" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.批次数量 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="材料" width="80" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.材料 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="block" style="margin-top: 10px;margin-bottom: 10px;">
|
|
<el-pagination
|
|
:current-page="pageCurrent1"
|
|
:page-size="pageSize1"
|
|
:total="total1"
|
|
style="display:inline-block;width:50%"
|
|
layout="total, prev, pager, next"
|
|
@size-change="handleSizeChange1"
|
|
@current-change="handleCurrentChange1"/>
|
|
</div>
|
|
</el-col>
|
|
</el-card>
|
|
|
|
<el-card>
|
|
<div slot="header">
|
|
<span>采购单号:</span>
|
|
<el-input v-model="purchasingOrder" placeholder="采购单号" size="small" clearable/>
|
|
<span>供应商:</span>
|
|
<el-input v-model="supplierName0" placeholder="供应商" size="small" clearable/>
|
|
<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-button type="primary" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addPurchaseOrder">创建采购单</el-button>
|
|
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @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.采购计划状态)===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.采购单号 }}
|
|
</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">
|
|
<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" 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-column label="操作" align="center" width="200" fixed="right">
|
|
<template slot-scope="scope">
|
|
<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>
|
|
</el-table>
|
|
<div class="block" style="margin: 10px 0;">
|
|
<el-pagination
|
|
:current-page="pageCurrent2"
|
|
:page-sizes="[10, 20, 30, 40]"
|
|
:page-size="pageSize2"
|
|
:total="total2"
|
|
style="display:inline-block;width:50%"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@size-change="handleSizeChange2"
|
|
@current-change="handleCurrentChange2"/>
|
|
</div>
|
|
<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.物料零件编码 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="原材料名称" align="center" min-width="150">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.原材料名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="零件名称" align="center" min-width="150">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.零件名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="材料" align="center" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.材料 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="数量" align="center" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.批次数量 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="求购重量" align="center" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.重量 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="备注" align="center" min-width="100" prop="备注">
|
|
<template slot-scope="scope">
|
|
<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">
|
|
<template slot-scope="scope">
|
|
<el-button :disabled="disable" type="danger" size="mini" icon="el-icon-delete" @click="deleteMateriel(scope.row)">移出</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
|
|
<el-dialog :visible.sync="dialogVisible1" title="供应商选择" center style="min-height: 300px">
|
|
<el-form ref="form1" :model="form1" label-position="left" label-width="90px" class="searchForm">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商名称">
|
|
<el-input v-model="supplierName" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="企业性质">
|
|
<el-input v-model="enterpriseNature" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="货期">
|
|
<el-input v-model="goodTime" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="注册资本">
|
|
<el-input v-model="registeredCapital" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="税号">
|
|
<el-input v-model="taxNum" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="电子邮箱">
|
|
<el-input v-model="EMail" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="地址">
|
|
<el-input v-model="address" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="账号">
|
|
<el-input v-model="account" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="开户行">
|
|
<el-input v-model="openingBank" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="电话号码">
|
|
<el-input v-model="phone" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="传真">
|
|
<el-input v-model="fax" size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-button
|
|
type="success"
|
|
size="small"
|
|
icon="el-icon-search"
|
|
@click="searchSupplier">查询</el-button>
|
|
<el-button
|
|
type="primary"
|
|
size="small"
|
|
icon="el-icon-check"
|
|
@click="submitSelectSupplier">确定</el-button>
|
|
<el-button
|
|
type="danger"
|
|
size="small"
|
|
icon="el-icon-delete"
|
|
@click="emptySupplierDetail">清空</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
<el-table :data="tableData01" size="mini" style="width: 97%;max-height: 300px;margin-top:15px" height="200px" border @row-click="showSupplierDetail">
|
|
<el-table-column align="center" label="供应商名称" min-width="250">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.供应商名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="企业性质" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.企业性质 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="创立日期" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.创立日期 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="注册资本" min-width="100">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.注册资本 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-form>
|
|
</el-dialog>
|
|
|
|
<el-dialog :title="title2" :visible.sync="dialogVisible2" center style="min-height: 300px" width="750px">
|
|
<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>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="采购员" prop="采购员">
|
|
<el-input v-model="name" readonly size="small"/>
|
|
</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" readonly>
|
|
<el-button slot="append" icon="el-icon-search" @click="dialogVisible1=true"/>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="计划完成日期" prop="计划完成日期">
|
|
<el-date-picker
|
|
v-model="form2.计划完成日期"
|
|
size="small"
|
|
type="date"
|
|
format="yyyy-MM-dd"
|
|
value-format="yyyy-MM-dd"
|
|
placeholder="选择日期"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button
|
|
v-show="title2==='创建采购单'"
|
|
type="primary"
|
|
size="small"
|
|
icon="el-icon-check"
|
|
@click="submitAddPurchaseOrder">确定</el-button>
|
|
<el-button
|
|
v-show="title2==='编辑采购单'"
|
|
type="primary"
|
|
size="small"
|
|
icon="el-icon-check"
|
|
@click="submitEditPurchaseOrder">确定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<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 { initPartDrawing, searchPurchasedMaterials, searchPurchaseOrder, searchSupplier, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, searchMateriel,
|
|
addMateriel, deleteMateriel, saveMateriel, searchRawMaterial, addMateriel2 } from '@/api/WorkshopProcurement/CreatingPurchasingMaterials'
|
|
import QRCode from 'qrcode'
|
|
import $ from 'jquery'
|
|
import { mapGetters } from 'vuex'
|
|
export default {
|
|
name: '', // 采购计划
|
|
data() {
|
|
return {
|
|
RawMaterialGroup: [],
|
|
RawMaterialName: '',
|
|
tableData: [],
|
|
pageCurrent: 1,
|
|
pageSize: 10,
|
|
total: null,
|
|
partDrawingNumber: '',
|
|
Buyer: '',
|
|
loading1: false,
|
|
title2: '',
|
|
check1: 0,
|
|
check2: 0,
|
|
check3: 0,
|
|
check4: 0,
|
|
tableData1: [],
|
|
pageCurrent1: 1,
|
|
pageSize1: 10,
|
|
total1: 0,
|
|
purchasingOrder: '', // 采购单号
|
|
purchasingOrderNumber: '', // 采购计划流水号
|
|
supplierName0: '', // 供应商名称(外面的)
|
|
supplierName: '', // 供应商名称
|
|
tableData2: [],
|
|
total2: 0,
|
|
pageCurrent2: 1,
|
|
pageSize2: 10,
|
|
dialogVisible1: false,
|
|
form1: {},
|
|
supplierCheck1: 0,
|
|
supplierCheck2: 0,
|
|
supplierCheck3: 0,
|
|
supplierCheck4: 0,
|
|
supplierCheck5: 0,
|
|
supplierCheck6: 0,
|
|
supplierCheck7: 0,
|
|
supplierCheck8: 0,
|
|
supplierCheck9: 0,
|
|
supplierCheck10: 0,
|
|
supplierCheck11: 0,
|
|
supplierCheck12: 0,
|
|
supplierValue: '', // 供应商流水号
|
|
goodTime: '', // 货期
|
|
enterpriseNature: '', // 企业性质
|
|
createDate: '', // 创立日期
|
|
registeredCapital: '', // 注册资本
|
|
taxNum: '', // 税号
|
|
EMail: '', // 电子邮箱
|
|
address: '', // 地址
|
|
account: '', // 账号
|
|
openingBank: '', // 开户行
|
|
phone: '', // 电话号码
|
|
fax: '', // 传真
|
|
tableData01: [],
|
|
dialogVisible2: false,
|
|
下单单位: '',
|
|
下单日期: '',
|
|
单号: '',
|
|
计划完成日期: '',
|
|
form2: {
|
|
采购计划流水号: '',
|
|
采购单名称: '',
|
|
供应商流水号: '',
|
|
供应商名称: '',
|
|
计划完成日期: ''
|
|
},
|
|
rules2: { // 采购表单验证规则
|
|
采购单名称: [{ required: true, message: '请填写采购单名称' }],
|
|
供应商名称: [{ required: true, message: '请选择供应商' }],
|
|
计划完成日期: [{ required: true, message: '请选择计划完成日期' }]
|
|
},
|
|
tableData3: [],
|
|
materielGroup: [], // 工艺计划流水号组
|
|
partGroup: [], // 采购计划明细流水号组
|
|
unit: [], // 单位组
|
|
Remarks: [], // 备注组
|
|
tableData4: [], // 合同模板
|
|
采购计划状态: '',
|
|
paramRow: '', // 参数row
|
|
disable: false // 其他的禁用
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters([
|
|
'sidebar',
|
|
'avatar',
|
|
'name',
|
|
'id' // 人员编号
|
|
])
|
|
},
|
|
created() {
|
|
this.searchRawMaterial()
|
|
this.searchTable1()
|
|
this.searchTable2()
|
|
},
|
|
methods: {
|
|
// 获取原材料
|
|
searchRawMaterial() {
|
|
searchRawMaterial(this.RawMaterialName, this.pageCurrent, this.pageSize).then(response => {
|
|
this.tableData = response.data.rows
|
|
this.total = parseInt(response.data.total)
|
|
})
|
|
},
|
|
addMateriel2() { // 将材料选入请购单
|
|
if (!this.purchasingOrderNumber) {
|
|
this.$message.warning('请选择采购单')
|
|
} else if (this.RawMaterialGroup.length === 0) {
|
|
this.$message.warning('请勾选原材料')
|
|
} else {
|
|
addMateriel2(this.purchasingOrderNumber, this.RawMaterialGroup).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('选入成功')
|
|
this.searchTable1()
|
|
this.searchRawMaterial()
|
|
searchMateriel(this.purchasingOrderNumber).then(response => {
|
|
this.tableData3 = response.data
|
|
})
|
|
} else { this.$message.error('选入失败') }
|
|
})
|
|
}
|
|
},
|
|
handleSelectionChange2(val) {
|
|
this.RawMaterialGroup = []
|
|
for (let i = 0; i < val.length; i++) {
|
|
this.RawMaterialGroup.push(val[i].原材料流水号)
|
|
}
|
|
},
|
|
// ///////////////////////////////////////////////////////////////////////////////////////0529新加↑
|
|
useqrcode(contractNum) {
|
|
const opts = {
|
|
errorCorrectionLevel: 'H',
|
|
type: 'image/jpeg',
|
|
rendererOpts: {
|
|
quality: 0.3
|
|
}
|
|
}
|
|
QRCode.toDataURL(contractNum, opts, function(err, url) {
|
|
if (err) throw err
|
|
const img = document.getElementById('img')
|
|
img.src = url
|
|
})
|
|
},
|
|
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.partDrawingNumber ? this.check1 = 1 : this.check1 = 0
|
|
searchPurchasedMaterials(this.pageCurrent1, this.pageSize1, this.check1, this.partDrawingNumber).then(response => {
|
|
this.tableData1 = response.data.rows
|
|
this.total1 = response.data.total
|
|
this.loading1 = false
|
|
})
|
|
},
|
|
handleSizeChange1(val) {
|
|
this.pageSize1 = val
|
|
this.pageCurrent1 = 1
|
|
this.searchTable1()
|
|
},
|
|
handleCurrentChange1(val) {
|
|
this.pageCurrent1 = val
|
|
this.searchTable1()
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.materielGroup = []
|
|
for (let i = 0; i < val.length; i++) {
|
|
this.materielGroup.push(val[i].工艺计划流水号)
|
|
}
|
|
},
|
|
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()
|
|
},
|
|
addPurchaseOrder() { // 创建采购单
|
|
if (this.$refs['form2'] !== undefined) {
|
|
this.$refs['form2'].resetFields()
|
|
}
|
|
this.title2 = '创建采购单'
|
|
this.form2.离线合同名称 = ''
|
|
this.form2.供应商流水号 = ''
|
|
this.form2.供应商名称 = ''
|
|
this.form2.计划完成日期 = ''
|
|
this.dialogVisible2 = true
|
|
},
|
|
submitAddPurchaseOrder() { // 新建采购单
|
|
this.$refs['form2'].validate((valid) => {
|
|
if (valid) {
|
|
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 {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
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.form2.计划完成日期 = row.计划完成日期
|
|
this.dialogVisible2 = true
|
|
},
|
|
submitEditPurchaseOrder() {
|
|
this.$refs['form2'].validate((valid) => {
|
|
if (valid) {
|
|
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 {
|
|
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.searchTable2()
|
|
this.disable = true
|
|
searchMateriel(this.purchasingOrderNumber).then(response => {
|
|
this.tableData3 = response.data
|
|
})
|
|
} else { this.$message.error('数据占用,删除失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
})
|
|
})
|
|
},
|
|
searchSupplier() { // 查询创立日期和注册资本大于符合条件的数据
|
|
this.supplierName ? this.supplierCheck1 = 1 : (this.supplierCheck1 = 0, this.supplierName = '')
|
|
this.enterpriseNature ? this.supplierCheck2 = 1 : (this.supplierCheck2 = 0, this.enterpriseNature = '')
|
|
this.createDate ? this.supplierCheck3 = 1 : (this.supplierCheck3 = 0, this.createDate = '')
|
|
this.registeredCapital ? this.supplierCheck4 = 1 : (this.supplierCheck4 = 0, this.registeredCapital = '')
|
|
this.taxNum ? this.supplierCheck5 = 1 : (this.supplierCheck5 = 0, this.taxNum = '')
|
|
this.EMail ? this.supplierCheck6 = 1 : (this.supplierCheck6 = 0, this.EMail = '')
|
|
this.address ? this.supplierCheck7 = 1 : (this.supplierCheck7 = 0, this.address = '')
|
|
this.account ? this.supplierCheck8 = 1 : (this.supplierCheck8 = 0, this.account = '')
|
|
this.openingBank ? this.supplierCheck9 = 1 : (this.supplierCheck9 = 0, this.openingBank = '')
|
|
this.phone ? this.supplierCheck10 = 1 : (this.supplierCheck10 = 0, this.phone = '')
|
|
this.fax ? this.supplierCheck11 = 1 : (this.supplierCheck11 = 0, this.fax = '')
|
|
this.goodTime ? this.supplierCheck12 = 1 : (this.supplierCheck12 = 0, this.goodTime = '')
|
|
searchSupplier(this.supplierCheck1, this.supplierName, this.supplierCheck2, this.enterpriseNature, this.supplierCheck3, this.createDate, this.supplierCheck4, this.registeredCapital, this.supplierCheck5, this.taxNum, this.supplierCheck6, this.EMail, this.supplierCheck7, this.address, this.supplierCheck8, this.account, this.supplierCheck9, this.openingBank, this.supplierCheck10, this.phone, this.supplierCheck11, this.fax, this.supplierCheck12, this.goodTime).then(response => {
|
|
this.tableData01 = response.data
|
|
})
|
|
},
|
|
showSupplierDetail(row) {
|
|
this.form2.供应商流水号 = row.供应商流水号
|
|
this.form2.供应商名称 = row.供应商名称
|
|
this.supplierValue = row.供应商流水号
|
|
this.supplierName = row.供应商名称
|
|
this.enterpriseNature = row.企业性质
|
|
this.createDate = row.创立日期
|
|
this.registeredCapital = row.注册资本
|
|
this.taxNum = row.税号
|
|
this.EMail = row.电子信箱
|
|
this.address = row.地址
|
|
this.account = row.帐号
|
|
this.openingBank = row.开户行
|
|
this.phone = row.电话号码
|
|
this.fax = row.传真
|
|
this.goodTime = row.货期
|
|
},
|
|
emptySupplierDetail() {
|
|
this.supplierValue = ''
|
|
this.supplierName = ''
|
|
this.enterpriseNature = ''
|
|
this.createDate = ''
|
|
this.registeredCapital = ''
|
|
this.taxNum = ''
|
|
this.EMail = ''
|
|
this.address = ''
|
|
this.account = ''
|
|
this.openingBank = ''
|
|
this.phone = ''
|
|
this.fax = ''
|
|
this.goodTime = ''
|
|
},
|
|
submitSelectSupplier() { // 确定选择供应商
|
|
this.dialogVisible1 = false
|
|
},
|
|
searchTable3(row) { // 查询采购计划明细
|
|
this.purchasingOrderNumber = row.采购计划流水号
|
|
this.采购计划状态 = row.采购计划状态
|
|
this.下单单位 = row.供应商名称
|
|
this.单号 = row.采购单号
|
|
this.计划完成日期 = row.计划完成日期.split(' ')[0]
|
|
this.下单日期 = row.下单日期.split(' ')[0]
|
|
searchMateriel(this.purchasingOrderNumber).then(response => {
|
|
this.tableData3 = response.data
|
|
})
|
|
},
|
|
addMateriel() { // 将材料选入请购单
|
|
if (!this.purchasingOrderNumber) {
|
|
this.$message.warning('请选择采购单')
|
|
} else if (this.materielGroup.length === 0) {
|
|
this.$message.warning('请勾选物料')
|
|
} else {
|
|
addMateriel(this.purchasingOrderNumber, this.materielGroup).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('选入成功')
|
|
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.采购计划明细流水号, row.工艺计划流水号).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('移除成功')
|
|
this.searchTable1()
|
|
searchMateriel(this.purchasingOrderNumber).then(response => {
|
|
this.tableData3 = response.data
|
|
})
|
|
} else { this.$message.error('移除失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消移除'
|
|
})
|
|
})
|
|
},
|
|
exportExcel() {
|
|
this.$confirm('确定导出该合同?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const htmlNode = $('#cjn').html()
|
|
const body = $('body')
|
|
body.children().hide()
|
|
const printNode = $(htmlNode)
|
|
body.append(printNode)
|
|
window.print()
|
|
body.removeAttr('style')
|
|
body.children().not('script').show()
|
|
body.children().not('#app').hide()
|
|
printNode.remove()
|
|
}).catch(res => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消操作'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.offlineContract td{
|
|
height: 40px;
|
|
text-align: center;
|
|
}
|
|
.el-card{
|
|
margin-bottom: 15px;
|
|
}
|
|
.el-date-editor{
|
|
width:150px;
|
|
}
|
|
.el-select{
|
|
width:200px
|
|
}
|
|
.el-input{
|
|
width:200px
|
|
}
|
|
span{
|
|
margin: 10px 0 10px 10px;
|
|
}
|
|
.el-tag{
|
|
margin: 0
|
|
}
|
|
.searchForm .el-form-item{
|
|
margin-bottom: 5px;
|
|
}
|
|
.edit-input {
|
|
padding-right: 100px;
|
|
}
|
|
.cancel-btn {
|
|
position: absolute;
|
|
right: 15px;
|
|
top: 5px;
|
|
}
|
|
</style>
|