This commit is contained in:
liushuai
2019-06-14 13:26:08 +08:00
10 changed files with 428 additions and 30 deletions

View File

@@ -36,14 +36,14 @@ export function searchGroup(num) {
}) })
} }
// 查询记录 // 查询记录
export function searchRecord(check1, project, check2, machine, check3, group, check4, name, check5, spec, check6, model, pageCurrent, pageSize) { export function searchRecord(check1, project, check2, machine, check3, group, check4, name, check5, spec, check6, model, check7, time1, time2, pageCurrent, pageSize) {
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',
data: { data: {
type: '1', type: '1',
name: `库存管理_出库记录_查询数据`, name: `库存管理_出库记录_查询数据`,
param: `项目流水号_check=${check1}&项目流水号=${project}&机床流水号_check=${check2}&机床流水号=${machine}&组件流水号_check=${check3}&组件流水号=${group}&名称_check=${check4}&名称=${name}&规格_check=${check5}&规格=${spec}&图号或型号_check=${check6}&图号或型号=${model}`, param: `项目流水号_check=${check1}&项目流水号=${project}&机床流水号_check=${check2}&机床流水号=${machine}&组件流水号_check=${check3}&组件流水号=${group}&名称_check=${check4}&名称=${name}&规格_check=${check5}&规格=${spec}&图号或型号_check=${check6}&图号或型号=${model}&出库时间_check=${check7}&出库开始时间=${time1}&出库结束时间=${time2}`,
Pagination: pageCurrent + '&' + pageSize Pagination: pageCurrent + '&' + pageSize
} }
}) })

View File

@@ -72,3 +72,25 @@ export function savePrice(price, num1, num2) {
} }
}) })
} }
// 实时保存单价
export function saveContractHeader(...params) {
return request({
url: '',
method: 'post',
data: {
type: '4',
name: `update 采购管理_询价单 set 交货日期 = '${params[0]}' , 开票信息 = '${params[1]}' , 支付日期 = '${params[2]}' , 支付方式 = '${params[3]}' , 其他说明 = '${params[4]}' where 询价单流水号 = ${params[5]}`
}
})
}
// 获取合同头
export function searchContractHeader(...params) {
return request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 采购管理_询价单 where 询价单流水号 = ${params[0]}`
}
})
}

View File

@@ -49,3 +49,27 @@ export function searchTable2(...params) {
} }
}) })
} }
// 查询表1标准件和外购件无分页
export function searchTable1Export(...params) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_采购部采购_查询物料_分配后_加供应商',
param: `机床流水号_check=${params[0]}&机床流水号=${params[1]}&组件流水号_check=${params[2]}&组件流水号=${params[3]}&零件类型=${params[4]}`
}
})
}
// 查询表1基本件无分页
export function searchTable2Export(...params) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_采购部采购_查询物料_基本件_分配后_加供应商',
param: `机床流水号_check=${params[0]}&机床流水号=${params[1]}&组件流水号_check=${params[2]}&组件流水号=${params[3]}`
}
})
}

View File

@@ -31,6 +31,9 @@
background-color: rgb(98, 157, 209); background-color: rgb(98, 157, 209);
color: white; color: white;
} }
.el-tree-node__content>.el-tree-node__expand-icon{
display: none;
}
.el-table td, .is-leaf{ .el-table td, .is-leaf{
background-color: rgb(213, 230, 347); background-color: rgb(213, 230, 347);
color: black; color: black;

View File

@@ -342,11 +342,6 @@ export default {
}, },
// 打开表单 // 打开表单
parOut(row) { parOut(row) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.MachineValue = ''
this.form.GroupNumValue = ''
this.dialogFormVisible = true this.dialogFormVisible = true
this.locateNumber = row.货位流水号 this.locateNumber = row.货位流水号
this.materialNumber = row.物料流水号 this.materialNumber = row.物料流水号

View File

@@ -32,6 +32,17 @@
<el-input v-model="spec" clearable size="small" style="width:150px" /> <el-input v-model="spec" clearable size="small" style="width:150px" />
<span>图号或型号:</span> <span>图号或型号:</span>
<el-input v-model="model" clearable size="small" style="width:150px" /> <el-input v-model="model" clearable size="small" style="width:150px" />
<span>出库时间:</span>
<el-date-picker
v-model="outTime"
type="daterange"
size="small"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="~"
style="width:250px"
start-placeholder=""
end-placeholder=""/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;searchRecord()">查询</el-button> <el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;searchRecord()">查询</el-button>
</div> </div>
<el-table :data="tableData" border size="mini" style="width: 100%;" height="600"> <el-table :data="tableData" border size="mini" style="width: 100%;" height="600">
@@ -99,7 +110,8 @@ export default {
tableData: [], tableData: [],
pageSize1: 10, pageSize1: 10,
pageCurrent1: 1, pageCurrent1: 1,
total1: 0 total1: 0,
outTime: '' // 出库时间
} }
}, },
mounted() { mounted() {
@@ -134,14 +146,15 @@ export default {
}) })
}, },
searchRecord() { searchRecord() {
let check1, check2, check3, check4, check5, check6 let check1, check2, check3, check4, check5, check6, check7
this.projectValue ? check1 = 1 : check1 = 0 this.projectValue ? check1 = 1 : check1 = 0
this.machineValue ? check2 = 1 : check2 = 0 this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0 this.groupValue ? check3 = 1 : check3 = 0
this.name ? check4 = 1 : check4 = 0 this.name ? check4 = 1 : check4 = 0
this.spec ? check5 = 1 : check5 = 0 this.spec ? check5 = 1 : check5 = 0
this.model ? check6 = 1 : check6 = 0 this.model ? check6 = 1 : check6 = 0
searchRecord(check1, this.projectValue, check2, this.machineValue, check3, this.groupValue, check4, this.name, check5, this.spec, check6, this.model, this.pageCurrent1, this.pageSize1).then(res => { this.outTime ? check7 = 1 : check7 = 0
searchRecord(check1, this.projectValue, check2, this.machineValue, check3, this.groupValue, check4, this.name, check5, this.spec, check6, this.model, check7, this.outTime[0] || '', this.outTime[1] || '', this.pageCurrent1, this.pageSize1).then(res => {
this.tableData = res.data.rows this.tableData = res.data.rows
this.total1 = res.data.total this.total1 = res.data.total
}) })

View File

@@ -92,6 +92,11 @@
{{ scope.row.机床图号 }} {{ scope.row.机床图号 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="机床设计者" align="center" min-width="90">
<template slot-scope="scope">
{{ scope.row.机床设计者 || '—' }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="80"> <el-table-column label="组号" align="center" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.组号 }} {{ scope.row.组号 }}
@@ -243,11 +248,11 @@
size="mini" size="mini"
@selection-change="handleSelectionChange2"> @selection-change="handleSelectionChange2">
<el-table-column :selectable="selectable" align="center" width="35" type="selection"/> <el-table-column :selectable="selectable" align="center" width="35" type="selection"/>
<el-table-column label="操作" align="center" width="100" fixed="left"> <!--<el-table-column label="操作" align="center" width="100" fixed="left">-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
<el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1" type="primary" size="mini" @click="partChange(scope.row)">零件变更</el-button> <!--<el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1" type="primary" size="mini" @click="partChange(scope.row)">零件变更</el-button>-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
<el-table-column label="零件状态" align="center" width="100"> <el-table-column label="零件状态" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.询价状态编号)===1" type="warning" size="small">未询价</el-tag> <el-tag v-if="parseInt(scope.row.询价状态编号)===1" type="warning" size="small">未询价</el-tag>
@@ -270,6 +275,11 @@
{{ scope.row.机床图号 }} {{ scope.row.机床图号 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="机床设计者" align="center" min-width="90">
<template slot-scope="scope">
{{ scope.row.机床设计者 || '—' }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="80"> <el-table-column label="组号" align="center" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.组号 }} {{ scope.row.组号 }}
@@ -1094,7 +1104,6 @@ export default {
}, },
submitUseInventory() { submitUseInventory() {
submitUseInventory(this.backlogMaterialNum, this.useNumber, this.backlogGroupPartNum, this.id).then(response => { submitUseInventory(this.backlogMaterialNum, this.useNumber, this.backlogGroupPartNum, this.id).then(response => {
console.log(response.data)
if (response.data[0].result === '1') { if (response.data[0].result === '1') {
this.searchTable11() this.searchTable11()
this.dialogVisible4 = false this.dialogVisible4 = false
@@ -1103,7 +1112,6 @@ export default {
}) })
}, },
useInventory(row) { // 使用滞货 useInventory(row) { // 使用滞货
console.log(row)
this.useNumber = 0 this.useNumber = 0
row.滞货数量 < row.待询价数量 ? this.maxUseNumber = Number(row.滞货数量) : this.maxUseNumber = Number(row.待询价数量) row.滞货数量 < row.待询价数量 ? this.maxUseNumber = Number(row.滞货数量) : this.maxUseNumber = Number(row.待询价数量)
this.backlogMaterialNum = row.物料流水号 this.backlogMaterialNum = row.物料流水号
@@ -1610,7 +1618,6 @@ export default {
this.inquirySheetFlowNum = row.询价单流水号 this.inquirySheetFlowNum = row.询价单流水号
this.orderExport = row.询价单编号 this.orderExport = row.询价单编号
searchSheetDetail(row.询价单流水号).then(response => { searchSheetDetail(row.询价单流水号).then(response => {
console.log(response.data)
this.tableData3 = response.data this.tableData3 = response.data
}) })
}, },

View File

@@ -50,31 +50,31 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="交货日期:"> <el-form-item label="交货日期:">
<el-input v-model="deliveryDate" size="small" type="textarea" rows="1"/> <el-input v-model="deliveryDate" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="开票信息:"> <el-form-item label="开票信息:">
<el-input v-model="invoiceInfo" size="small" type="textarea" rows="1"/> <el-input v-model="invoiceInfo" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="支付日期:"> <el-form-item label="支付日期:">
<el-input v-model="payDate" size="small" type="textarea" rows="1"/> <el-input v-model="payDate" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="支付方式:"> <el-form-item label="支付方式:">
<el-input v-model="payMethod" size="small" type="textarea" rows="1"/> <el-input v-model="payMethod" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="其他说明:"> <el-form-item label="其他说明:">
<el-input v-model="otherInfo" size="small" type="textarea" rows="1"/> <el-input v-model="otherInfo" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -185,7 +185,7 @@
<script> <script>
import Tinymce from '@/components/Tinymce' import Tinymce from '@/components/Tinymce'
import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo, savePrice } from '@/api/PurchasingCenter/CreatePurchaseContract' import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo, savePrice, saveContractHeader, searchContractHeader } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { convertCurrency } from '@/vendor/int2Chinese' import { convertCurrency } from '@/vendor/int2Chinese'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { sleep, groupBy } from '@/utils/tool' import { sleep, groupBy } from '@/utils/tool'
@@ -256,6 +256,18 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
// 合同头实时保存
contractHeaderChange() {
if (this.contractNumValue) {
saveContractHeader(this.deliveryDate || '', this.invoiceInfo || '', this.payDate || '', this.payMethod || '', this.otherInfo || '', this.contractNumValue).then(res => {
if (res.data[0].result === '1') {
console.log('合同头实时保存成功')
} else {
console.log('合同头实时保存失败')
}
})
}
},
// 价格实时保存 // 价格实时保存
priceChange(price, num1, num2, row) { priceChange(price, num1, num2, row) {
this.tableData1.map(v => { this.tableData1.map(v => {
@@ -354,6 +366,13 @@ export default {
}) })
}, },
contractChange() { // 选择合同select contractChange() { // 选择合同select
searchContractHeader(this.contractNumValue).then(response => {
this.deliveryDate = response.data[0].交货日期
this.invoiceInfo = response.data[0].开票信息
this.payDate = response.data[0].支付日期
this.payMethod = response.data[0].支付方式
this.otherInfo = response.data[0].其他说明
})
for (let i = 0; i < this.contractNums.length; i++) { for (let i = 0; i < this.contractNums.length; i++) {
if (this.contractNums[i].value === this.contractNumValue) { if (this.contractNums[i].value === this.contractNumValue) {
this.supplierName = this.contractNums[i].supplierName this.supplierName = this.contractNums[i].supplierName
@@ -380,8 +399,8 @@ export default {
询价单流水号: response.data[i].询价单流水号, 询价单流水号: response.data[i].询价单流水号,
物料流水号: response.data[i].物料流水号, 物料流水号: response.data[i].物料流水号,
询价单明细流水号: response.data[i].询价单明细流水号, 询价单明细流水号: response.data[i].询价单明细流水号,
机床图号: response.data[i].机床图号, 机床图号: response.data[i].机床图号 || response.data[i].基本件机床图号,
组号: response.data[i].组号, 组号: response.data[i].组号 || response.data[i].基本件组号,
组件零件流水号: response.data[i].组件零件流水号, 组件零件流水号: response.data[i].组件零件流水号,
组件零件基本件流水号: response.data[i].组件零件基本件流水号, 组件零件基本件流水号: response.data[i].组件零件基本件流水号,
交货期: response.data[i].组件零件流水号 ? response.data[i].标准件和外购件交货期 : response.data[i].基本件交货期, 交货期: response.data[i].组件零件流水号 ? response.data[i].标准件和外购件交货期 : response.data[i].基本件交货期,
@@ -473,15 +492,15 @@ export default {
<tr> <tr>
<td style="width: 20%;" rowspan="3">交货地点:</td> <td style="width: 20%;" rowspan="3">交货地点:</td>
<td style="width: 20%;">地址:</td> <td style="width: 20%;">地址:</td>
<td style="width: 30%;" colspan="2"></td> <td style="width: 30%;" colspan="2">盐城市亭湖区新兴镇开放大道666号</td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%;">联系人:</td> <td style="width: 20%;">联系人:</td>
<td style="width: 30%;" colspan="2"></td> <td style="width: 30%;" colspan="2">${this.name}</td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%;">联系电话:</td> <td style="width: 20%;">联系电话:</td>
<td style="width: 30%;" colspan="2"></td> <td style="width: 30%;" colspan="2">${this.phone2}</td>
</tr> </tr>
<tr> <tr>
<td style="width: 20%;">交货日期:</td> <td style="width: 20%;">交货日期:</td>

View File

@@ -0,0 +1,224 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -21,6 +21,7 @@
:value="item.value"/> :value="item.value"/>
</el-select> </el-select>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button> <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>
<el-button type="warning" size="small" icon="el-icon-download" style="margin-left: 15px" @click="exportDetail()">导出</el-button>
</el-card> </el-card>
<el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()"> <el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()">
@@ -268,7 +269,7 @@
</template> </template>
<script> <script>
import { initMachineProject, searchgroup, searchTable1, searchTable2 } from '@/api/PurchasingCenter/PurchaseSituationSearch' import { initMachineProject, searchgroup, searchTable1, searchTable2, searchTable1Export, searchTable2Export } from '@/api/PurchasingCenter/PurchaseSituationSearch'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: '', // 采购件采购查询 name: '', // 采购件采购查询
@@ -305,6 +306,96 @@ export default {
this.searchTable() this.searchTable()
}, },
methods: { methods: {
// 导出采购物料执行情况
exportDetail() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 1).then(res1 => { // 标准件
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 2).then(res2 => { // 外购件
searchTable2Export(check1, this.machineNumberValue, check2, this.groupNumberValue).then(res3 => { // 基本件
import('./Export2Excel').then(excel => {
const dataGroup = []
const filterVal1 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名'] // tableData0里的属性名
const filterVal2 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名'] // tableData1里的属性名
const filterVal3 = ['机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '零件数量', '数量', '已到货数量', '供应商名称', '采购合同编号', '姓名'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data1.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[11] = '未分配'
} else if (v[6] === '—') {
v[11] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[11] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[11] = '全部到货'
}
})
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data2.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[11] = '未分配'
} else if (v[6] === '—') {
v[11] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[11] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[11] = '全部到货'
}
})
dataGroup.push(data2)
const data3 = res3.data.map(v => filterVal3.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data3.map(v => {
v.push('') // 物料状态
if (v[11] === '—') {
v[12] = '未分配'
} else if (v[7] === '—') {
v[12] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[12] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[12] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '采购物料执行情况',
autoWidth: true,
bookType: 'xlsx'
})
})
})
})
})
},
fetchData() { fetchData() {
initMachineProject().then(response => { initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) { for (let i = 0; i < response.data.length; i++) {