This commit is contained in:
liushuai
2020-03-12 22:20:08 +08:00
parent 296df85e78
commit 1a3012d5a6
17 changed files with 406 additions and 420 deletions

View File

@@ -3,7 +3,7 @@
<el-card>
<div style="margin-top: 7px; margin-bottom: 7px">
<el-input v-model="supplierNameValue" size="small" placeholder="外协厂家零件图号表单号项目名称" style="width: 220px" clearable/>
<el-date-picker v-model="timer" type="daterange" value-format="yyyy-MM-dd" size="small" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"/>
<el-date-picker v-model="timer" type="daterange" value-format="yyyy-MM-dd" size="small" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 240px"/>
<el-select v-model="MaterialsValue" placeholder="外协状态" filterable size="small" style="width: 120px" clearable>
<el-option
v-for="item in Materials"
@@ -12,11 +12,11 @@
:value="item.value"/>
</el-select>
<el-button icon="el-icon-search" type="primary" size="small" plain @click="pageCurrent = 1;pageSize = 50;getTableData()">查询</el-button>
<el-button type="primary" class="el-icon-download" size="small" style="margin: 10px 0 0 10px" plain @click="exportExcel">导出</el-button>
<el-button type="success" class="el-icon-download" size="small" style="margin: 10px 0 0 10px" plain @click="exportExcel">导出</el-button>
</div>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" border stripe size="mini" height="700" style="width: 1210px">
<el-table v-loading="loading" :data="tableData" border stripe size="mini" height="650" style="width: 1350px">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="外协状态" align="center" width="90px">
<template slot-scope="scope">
@@ -49,19 +49,29 @@
{{ scope.row.外协工序 }}
</template>
</el-table-column>
<el-table-column label="外协工时(分)" align="center" width="110">
<template slot-scope="scope">
{{ scope.row.外协工时 }}
</template>
</el-table-column>
<el-table-column label="工时费用(元)" align="center" width="110">
<template slot-scope="scope">
{{ scope.row.加工价格_成交 }}
</template>
</el-table-column>
<el-table-column label="外协厂家" align="center" width="160px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="外协单号" align="center" width="200">
<el-table-column label="外协单号" align="center" width="180">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="外协日期" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.任务下达日期.substr(0,10) }}
{{ scope.row.任务下达日期.split(' ')[0] }}
</template>
</el-table-column>
</el-table>
@@ -76,7 +86,7 @@
@current-change="handleCurrentChanges"/>
</div>
</el-card>
<el-card>
<el-card v-show="false">
<div id="myChart1" :style="{width: '100%', height: '400px', margin: 'auto'}"/>
</el-card>
</div>
@@ -85,7 +95,6 @@
<script>
import { searchTable, getprocedure, search1 } from '@/api/Outsourcing/OutsourcingPartsQuery'
import echarts from 'echarts'
export default {
data() {
return {
@@ -103,6 +112,7 @@ export default {
}],
tableData: [],
procedure: [],
procedureTime: [],
pageCurrent: 1,
pageSize: 50,
tableData1: []
@@ -119,7 +129,6 @@ export default {
}))
},
exportExcel() {
this.tableData1 = []
let check, check1, check2
this.supplierNameValue ? check = 1 : check = 0
if (this.MaterialsValue !== '' && this.MaterialsValue !== null) {
@@ -135,49 +144,21 @@ export default {
} else {
check2 = 1
}
searchTable(check, this.supplierNameValue, check1, this.MaterialsValue, check2, this.timer[0], this.timer[1], 100000000, this.pageCurrent).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData1.push({
到货状态: response.data.rows[i].到货状态 === '0' ? '未到' : '已到',
项目名称: response.data.rows[i].项目名称,
零件图号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
批次数量: response.data.rows[i].批次数量,
外协厂家名称: response.data.rows[i].外协厂家名称,
表单号: response.data.rows[i].表单号,
工艺计划流水号: response.data.rows[i].工艺计划流水号,
单件是否外协: response.data.rows[i].单件是否外协,
任务下达日期: response.data.rows[i].任务下达日期 ? response.data.rows[i].任务下达日期.split(' ')[0] : '',
外协工序: ''
})
}
for (let i = 0; i < this.tableData1.length; i++) {
getprocedure(this.tableData1[i].工艺计划流水号, this.tableData1[i].单件是否外协).then(response => {
this.procedure[i] = ''
for (let j = 0; j < response.data.length; j++) {
this.procedure[i] = this.procedure[i] + ' ' + response.data[j].工艺名称简称
}
this.tableData1[i].外协工序 = this.procedure[i]
})
}
}).then(() => {
setTimeout(this.exportExcel1, 500)
})
},
exportExcel1() {
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['外协状态', '项目名称', '零件图号', '零件名称', '数量', '外协工序', '外协厂家', '外协单号', '外协日期']
const filterVal = ['到货状态', '项目名称', '零件图号', '零件名称', '批次数量', '外协工序', '外协厂家名称', '表单号', '任务下达日期']
const list = this.tableData1
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '外协零件表',
autoWidth: true,
bookType: 'xlsx'
})
})
var param = []
param[0] = ['外协厂家_check', check]
param[1] = ['外协厂家', this.supplierNameValue]
param[2] = ['外协状态_check', check1]
param[3] = ['外协状态', this.MaterialsValue]
param[4] = ['时间_check', check2]
if (check2 === 0) {
param[5] = ['开始时间', '']
param[6] = ['结束时间', '']
} else {
param[5] = ['开始时间', this.timer[0]]
param[6] = ['结束时间', this.timer[1]]
}
var Data = this.CreateData('2001', '报表_车间生产管理_外协零件_查询数据_新', param)
this.exportExcel_NPOI(Data)
},
getTableData() {
this.tableData = []
@@ -198,22 +179,7 @@ export default {
check2 = 1
}
searchTable(check, this.supplierNameValue, check1, this.MaterialsValue, check2, this.timer[0], this.timer[1], this.pageSize, this.pageCurrent).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
到货状态: response.data.rows[i].到货状态,
项目名称: response.data.rows[i].项目名称,
零件图号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
批次数量: response.data.rows[i].批次数量,
外协厂家名称: response.data.rows[i].外协厂家名称,
表单号: response.data.rows[i].表单号,
工艺计划流水号: response.data.rows[i].工艺计划流水号,
单件是否外协: response.data.rows[i].单件是否外协,
任务下达日期: response.data.rows[i].任务下达日期,
外协工序: ''
})
}
this.getProcedure(this.tableData)
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
@@ -222,10 +188,13 @@ export default {
for (let i = 0; i < row.length; i++) {
getprocedure(row[i].工艺计划流水号, row[i].单件是否外协).then(response => {
this.procedure[i] = ''
this.procedureTime[i] = 0
for (let j = 0; j < response.data.length; j++) {
this.procedure[i] = this.procedure[i] + ' ' + response.data[j].工艺名称简称
this.procedureTime[i] = parseInt(this.procedureTime[i]) + parseInt(response.data[j].单件定额工时) * row[i].批次数量 + parseInt(response.data[j].准结定额工时)
}
this.tableData[i].外协工序 = this.procedure[i]
this.tableData[i].外协工时 = this.procedureTime[i]
})
}
},