项目计划零件工艺制定

This commit is contained in:
zhangdingyu
2019-02-27 11:01:00 +08:00
parent 542917d55e
commit 43e223a2b5
4 changed files with 222 additions and 127 deletions

View File

@@ -2,55 +2,140 @@
<div>
<el-card>
<el-row>
<span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<span>项目名称:</span>
<el-select v-model="projectValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床名称:</span>
<el-select v-model="toolNumValue" clearable filterable size="small" style="margin-bottom:10px;width: 220px" placeholder="机床名称">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>客户名称:</span>
<el-select v-model="CustomerNameValue" clearable filterable size="small" style="margin-bottom:10px;width: 220px" placeholder="客户名称">
<el-option
v-for="item in CustomerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-row>
<el-row>
<span>签订日期:</span>
<el-date-picker v-model="time_SignStart" size="small" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/>~
<el-date-picker v-model="time_SignFinish" size="small" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/>
<span>交货期:</span>
<el-date-picker v-model="time_deliveryStart" size="small" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/>~
<el-date-picker v-model="time_deliveryFinish" size="small" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
<el-checkbox v-model="all" size="mini">查询全部</el-checkbox>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="exportTable('BL')">导出备料单</el-button>
<el-button type="primary" size="small" icon="el-icon-success" style="margin-left:10px" @click="edit()">导出完成</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column
type="selection"
width="55"
align="center"/>
<el-table-column label="打印状态" width="100" align="center">
<el-table-column min-width="300px" label="项目编号" align="center" width="240px">
<template slot-scope="scope">
<el-tag v-if="scope.row.备料打印!=='0'" type="success" size="small">已导出</el-tag>
<el-tag v-else type="warning" size="small">未导出</el-tag>
<template v-if="scope.row.edit">
<el-input v-model="scope.row.项目编号" class="edit-input" size="small"/>
</template>
<span v-else>{{ scope.row.项目编号 }}</span>
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="220px">
<!--<el-table-column label="项目编号" align="center" width="220px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.项目编号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column label="项目名称" align="center" width="240px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="零件图号" align="center" width="240px">
<el-table-column label="机床图号" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="100px">
<el-table-column label="签订日期" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
{{ scope.row.合同签订日期 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" width="100px">
<el-table-column label="交货期" align="center">
<template slot-scope="scope">
{{ scope.row.原材料规格 }}
{{ 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.工艺要求 }}
{{ 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="操作" width="300px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" icon="el-icon-circle-check-outline" @click="confirmEdit(scope.row)">保存</el-button>
<el-button v-else type="primary" size="small" icon="el-icon-edit" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
</template>
</el-table-column>
</el-table>
@@ -67,55 +152,25 @@
</div>
</el-card>
<div v-show="false" id="BL">
<table border cellspacing="0px" style="table-layout: fixed; width: 600px;">
<colgroup>
<col style="width: 120px">
<col style="width: 180px">
<col style="width: 110px">
<col style="width: 110px">
<col style="width: 110px">
<col style="width: 450px">
</colgroup>
<tr>
<th colspan="2" height="60px">GAOJING</th>
<th colspan="4" height="60px"><span style="font-weight:bold">备料单</span></th>
</tr>
<tr>
<td align="center">零件名称</td>
<td align="center">零件图号</td>
<td align="center">材料</td>
<td align="center">原材料规格</td>
<td align="center">批次数量</td>
<td align="center">备料</td>
</tr>
<tr v-for="(list, index) in tableData2" :key="index">
<td align="center">{{ list.零件名称 }}</td>
<td align="center">{{ list.零件图号 }}</td>
<td align="center">{{ list.材料 }}</td>
<td align="center">{{ list.原材料规格 }}</td>
<td align="center">{{ list.批次数量 }}</td>
<td>{{ list.工艺要求 }}</td>
</tr>
</table>
</div>
</div>
</template>
<script>
import { searchtable, searchtable2, edit } from '@/api/ManufacturingCenter/CreatePreparationBill'
import { exportExcelMethod } from './exportExcel'
import $ from 'jquery'
import { getProject, getCustomerName, getToolNum, searchtable } from '@/api/ManufacturingCenter/ProjectPlanningManagement'
export default {
data() {
return {
a: 0,
tableData2: [],
partName: '',
all: false,
time_SignStart: '', // 签订开始
time_SignFinish: '', // 签订结束
time_deliveryStart: '', // 交货开始
time_deliveryFinish: '', // 交货结束
projectValue: '',
project: [], // 项目名称
CustomerNameValue: '',
CustomerName: [], // 客户名称
toolNumValue: '',
toolNum: [], // 机床
loading: false,
Data: [],
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
@@ -123,86 +178,83 @@ export default {
}
},
created() {
this.fetchData()
this.getCustomerName()
this.searchTable()
},
methods: {
exportTable() {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
const htmlNode = $('#BL').html()
const body = $('body')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.children().not('script').show()
printNode.remove()
}
cancelEdit(row) {
row.title = row.originalTitle
row.edit = false
this.$message({
message: 'The title has been restored to the original value',
type: 'warning'
})
},
confirmEdit(row) {
row.edit = false
row.originalTitle = row.title
this.$message({
message: 'The title has been edited',
type: 'success'
})
},
fetchData() {
this.projectValue = ''
this.project = []
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
getCustomerName() {
this.CustomerNameValue = ''
this.CustomerName = []
getCustomerName().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.CustomerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
getToolNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.Data = []
if (this.partName !== '' && this.partName !== null) {
this.partNamecheck = true
} else {
this.partNamecheck = false
}
searchtable(this.partNamecheck, this.partName, !this.all, 0, this.pageCurrent, this.pageSize).then(response => {
if (this.projectValue !== '' && this.projectValue !== null) { this.projectValuecheck = 1 } else { this.projectValuecheck = 0 }
if (this.CustomerNameValue !== '' && this.CustomerNameValue !== null) { this.CustomerNameValuecheck = 1 } else { this.CustomerNameValuecheck = 0 }
if (this.toolNumValue !== '' && this.toolNumValue !== null) { this.toolNumValuecheck = 1 } else { this.toolNumValuecheck = 0 }
if (this.time_SignStart !== '' && this.time_SignStart !== null && this.time_SignFinish !== '' && this.time_SignFinish) { this.time_Signcheck = 1 } else { this.time_Signcheck = 0 }
if (this.time_deliveryStart !== '' && this.time_deliveryStart !== null && this.time_deliveryFinish !== '' && this.time_deliveryFinish) { this.time_deliverycheck = 1 } else { this.time_deliverycheck = 0 }
searchtable(this.projectValuecheck, this.projectValue, this.CustomerNameValuecheck, this.CustomerNameValue, this.toolNumValuecheck, this.toolNumValue, this.time_Signcheck, this.time_deliveryStart, this.time_deliveryFinish, this.time_deliverycheck, this.time_deliveryStart, this.time_deliveryFinish, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
this.Data = response.data.rows
this.tableData = response.data.rows
this.total = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data.length; i++) {
searchtable2(this.Data[i].工艺计划流水号).then(response => {
this.tableData.push({
工艺计划流水号: this.Data[i].工艺计划流水号,
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料打印: this.Data[i].备料打印,
工艺要求: response.data[0].工艺要求,
材料: this.Data[i].材料,
原材料规格: this.Data[i].原材料规格,
批次数量: this.Data[i].批次数量
})
})
this.loading = false
}
this.loading = false
})
},
handleSelectionChange(val) {
this.tableData2 = []
this.tableData2 = val
},
edit() {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
this.a = 0
for (let i = 0; i < this.tableData2.length; i++) {
edit(this.tableData2[i].工艺计划流水号).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.tableData2.length) {
this.pageSize = 10
this.pageCurrent = 1
this.searchTable()
}
})
}
}
},
downLoad(tableid) {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
exportExcelMethod(tableid, '123', 'asd')
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1