刘璐珈

This commit is contained in:
Vergil
2020-03-09 17:18:31 +08:00
parent 8d4607b5ca
commit c2d4e64c35
21 changed files with 998 additions and 350 deletions

View File

@@ -153,6 +153,7 @@ export function export_json_to_excel({
autoWidth = true,
bookType= 'xlsx'
} = {}) {
console.log(header,111)
/* original data */
filename = filename || 'excel-list'
data = [...data]
@@ -218,3 +219,105 @@ export function export_json_to_excel({
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}
export function export_json_to_excel2({
multiHeader = [],
header,
data,
sheetname,
filename,
merges = [],
autoWidth = true,
bookType = 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
for (var i = 0; i < header.length; i++) {
data[i].unshift(header[i])
}
// data.unshift(header)
for (let i = multiHeader.length - 1; i > -1; i--) {
data.unshift(multiHeader[i])
}
var ws_name = sheetname
var wb = new Workbook(),
ws = []
for (var j = 0; j < header.length; j++) {
ws.push(sheet_from_array_of_arrays(data[j]))
}
if (merges.length > 0) {
if (!ws['!merges']) ws['!merges'] = []
merges.forEach(item => {
ws['!merges'].push(XLSX.utils.decode_range(item))
})
}
// console.log("width", autoWidth)
if (autoWidth) {
/* 设置worksheet每列的最大宽度*/
var colWidth = []
for (var k = 0; k < header.length; k++) {
colWidth.push(
data[k].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
}
}
})
)
)
}
/* 以第一行为初始值*/
const result = []
for (var k = 0; k < colWidth.length; k++) {
result[k] = colWidth[k][0]
for (let i = 1; i < colWidth[k].length; i++) {
for (let j = 0; j < colWidth[k][i].length; j++) {
if (result[k][j]['wch'] < colWidth[k][i][j]['wch']) {
result[k][j]['wch'] = colWidth[k][i][j]['wch']
}
}
}
}
// 分别给sheet表设置宽度
for (var l = 0; l < result.length; l++) {
ws[l]['!cols'] = result[l]
}
}
/* add worksheet to workbook */
for (var k = 0; k < header.length; k++) {
wb.SheetNames.push(ws_name[k])
wb.Sheets[ws_name[k]] = ws[k]
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
})
saveAs(
new Blob([s2ab(wbout)], {
type: 'application/octet-stream'
}),
`${filename}.${bookType}`
)
}

View File

@@ -1,14 +1,14 @@
<template>
<div class="app-container">
<el-card>
<div ref="height1" style="width:100%">
<div ref="height1" style="width:100%;height: 300px; overflow:auto;">
<el-divider content-position="right">
<el-button type="text" @click="searchUnInquiryPartNumber">刷新</el-button> | 待询价零件数
</el-divider>
<el-row>
<el-col v-for="(machine,index) in machines1" :key="index" style="width: 200px">
<el-card shadow="hover" class="sudoku_item" style="height:80px;width: 90%" @click.native="clickCard1(machine.项目流水号, machine.机床流水号)">
<el-badge :value="machine.未询价零件数">
<el-card shadow="hover" class="sudoku_item" style="height:50px;width: 90%" @click.native="clickCard1(machine.项目流水号, machine.机床流水号)">
<el-badge :value="machine.未询价零件数" style="margin-top: 17px">
<div style="width: 100px;height:50px;margin:0" class="sudoku_item">
{{ machine.机床图号 }}
</div>
@@ -55,20 +55,6 @@
:label="item.label"
:value="item.value"/>
</el-select>
<!--<el-select v-model="groupValue" placeholder="组号" style="width:100px" size="small" clearable filterable>-->
<!--<el-option-->
<!--v-for="item in group"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
<!--<el-input v-model="materialSpec" placeholder="物料规格" size="small" style="width:120px" clearable/>-->
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 10px" @click="searchTable11()">查询</el-button>
<el-button type="warning" size="small" icon="el-icon-download" plain style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
<el-tooltip :open-delay="1000" effect="dark" content="开启物料变更" placement="top">
<el-switch v-model="switchValue" active-color="#13ce66" inactive-color="#ff4949" style="margin-left: 30px"/>
</el-tooltip>
<el-date-picker
v-model="startTime"
size="small"
@@ -80,6 +66,20 @@
style="width:250px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<!--<el-select v-model="groupValue" placeholder="组号" style="width:100px" size="small" clearable filterable>-->
<!--<el-option-->
<!--v-for="item in group"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
<!--<el-input v-model="materialSpec" placeholder="物料规格" size="small" style="width:120px" clearable/>-->
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 10px" @click="searchTable11()">查询</el-button>
<el-button type="search" size="small" icon="el-icon-download" style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
<el-tooltip :open-delay="1000" effect="dark" content="开启物料变更" placement="top">
<el-switch v-model="switchValue" active-color="#13ce66" inactive-color="#ff4949" style="margin-left: 30px"/>
</el-tooltip>
<el-popover v-model="visible1" placement="top" width="140">
<div style="text-align: right; margin: 0">
<el-select v-model="PersonValue" style="width:100px" placeholder="人员" size="small" filterable clearable>
@@ -116,9 +116,10 @@
style="width: 100%;max-height: 500px;"
height="500px"
size="mini"
@sort-change="sortChange"
@selection-change="handleSelectionChange1"
@select="handleSelection">
<el-table-column :selectable="selectable" align="center" width="50" type="selection"/>
<el-table-column :selectable="selectable" align="center" width="43" type="selection"/>
<el-table-column v-if="switchValue" label="操作" align="center" width="100" fixed="left">
<template slot-scope="scope">
<el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1" type="primary" size="mini" @click="materialChange(scope.row)">物料变更</el-button>
@@ -132,70 +133,74 @@
<!--<span v-if="purchased(scope.row)">已采购</span>-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供货商" align="center" min-width="100" prop="供货商" show-overflow-tooltip>
<!--供货商排序-->
<el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供应商" align="center" min-width="100" prop="供货商" sortable="custom" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column :filters="remarkFilters" :filter-method="filterHandler0" label="备注" align="center" min-width="100" prop="备注" show-overflow-tooltip>
<el-table-column :filters="remarkFilters" :filter-method="filterHandler0" label="备注" align="center" min-width="100" prop="备注" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" width="130" prop="机床图号" show-overflow-tooltip>
<!--机床图号排序-->
<el-table-column label="机床图号" align="center" width="120" prop="机床图号" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="50">
<el-table-column label="组号" align="center" width="50">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="名称" align="center" width="180" prop="名称">
<!--物料名称排序-->
<el-table-column label="名称" align="center" width="120" prop="物料名称" sortable="custom">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" width="250" prop="物料规格" show-overflow-tooltip>
<el-table-column label="规格" align="center" width="160" prop="物料规格" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" min-width="130" prop="物料型号">
<!--物料排序-->
<el-table-column label="图号或型号" align="center" width="130" prop="物料型号" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="分配数" align="center" min-width="60">
<el-table-column label="分配数" align="center" min-width="70">
<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" width="80">
<template slot-scope="scope">
{{ Number(scope.row.零件类型) === 1 ? scope.row.待询价数量 = Number(scope.row.零件数量) - Number(scope.row.使用库存数) : scope.row.待询价数量 = Number(scope.row.零件数量) - Number(scope.row.使用滞货数量) }}
</template>
</el-table-column>
<el-table-column label="库存(BZ)" align="center" min-width="70" prop="库存">
<el-table-column label="库存(BZ)" align="center" width="80" prop="库存">
<template slot-scope="scope">
{{ scope.row.库存 }}
</template>
</el-table-column>
<el-table-column label="使用库存数量" align="center" min-width="105" prop="使用库存数">
<el-table-column label="使用库存数量" align="center" width="145" prop="使用库存数">
<template slot-scope="scope">
<template v-if="scope.row.库存 === '0'">
</template>
<el-input-number v-else v-model="scope.row.使用库存数" :min="0" :max="Number(scope.row.零件数量) > (Number(scope.row.货位存量) - Number(scope.row.占用数量)) ? (Number(scope.row.货位存量) - Number(scope.row.占用数量) + Number(scope.row.使用库存数)) : Number(scope.row.零件数量)" :disabled="(Number(scope.row.货位存量) - Number(scope.row.占用数量)) === 0 || parseInt(scope.row.采购状态编号)===3" size="mini" style="width: 90px" @change="changeNumber(scope.row)"/>
<el-input-number v-else v-model="scope.row.使用库存数" :min="0" :max="Number(scope.row.零件数量) > (Number(scope.row.货位存量) - Number(scope.row.占用数量)) ? (Number(scope.row.货位存量) - Number(scope.row.占用数量) + Number(scope.row.使用库存数)) : Number(scope.row.零件数量)" :disabled="(Number(scope.row.货位存量) - Number(scope.row.占用数量)) === 0 || parseInt(scope.row.采购状态编号)===3" size="mini" style="width: 130px" @change="changeNumber(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="已用滞货" align="center" min-width="70">
<el-table-column label="已用滞货" align="center" width="80">
<template slot-scope="scope">
{{ Number(scope.row.使用滞货数量) }}
</template>
</el-table-column>
<el-table-column label="使用滞货" align="center" min-width="70">
<el-table-column label="使用滞货" align="center" width="80">
<template slot-scope="scope">
<!--<el-tooltip class="item" effect="dark" content="使用滞货" placement="top-start">-->
<template v-if="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1||Number(scope.row.滞货数量)===0">
@@ -208,7 +213,7 @@
<!--</el-tooltip>-->
</template>
</el-table-column>
<el-table-column label="可用滞货" align="center" min-width="80">
<el-table-column label="可用滞货" align="center" width="80">
<template slot-scope="scope">
{{ Number(scope.row.滞货数量) }}
</template>
@@ -218,7 +223,7 @@
{{ scope.row.任务分配时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="设计者" align="center" min-width="60">
<el-table-column label="设计者" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.组件设计者 || scope.row.机床设计者 || '—' }}
</template>
@@ -249,9 +254,8 @@
<div style="display: inline-block; float: left">
<el-tooltip :open-delay="1000" effect="dark" content="为选择的询价单添加物料" placement="top">
<el-button
type="warning"
type="distribution"
size="small"
plain
style="margin: 0px 20px; display: inline-block;"
@click="addInquirySheet">选入物料</el-button>
</el-tooltip>
@@ -276,16 +280,6 @@
:label="item.label"
:value="item.value"/>
</el-select>
<!--<el-select v-model="groupValue" placeholder="组号" size="small" style="width: 100px" clearable filterable>-->
<!--<el-option-->
<!--v-for="item in group"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 10px" @click="searchTable12()">查询</el-button>
<el-button type="warning" size="small" icon="el-icon-download" plain style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
<el-date-picker
v-model="endTime"
size="small"
@@ -297,6 +291,17 @@
style="width:250px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<!--<el-select v-model="groupValue" placeholder="组号" size="small" style="width: 100px" clearable filterable>-->
<!--<el-option-->
<!--v-for="item in group"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 10px" @click="searchTable12()">查询</el-button>
<el-button type="search" size="small" icon="el-icon-download" plain style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
<el-button type="primary" size="small" plain style="float: right" @click="visible2 = false;tiaozheng2()">调整采购任务</el-button>
<el-select v-model="PersonValue" style="width:100px;float: right" placeholder="人员" size="small" filterable clearable>
<el-option
@@ -323,7 +328,7 @@
</el-row>
<el-row style="margin-bottom: 10px">
<el-table
v-loading="loading"
v-loading="loading2"
:data="tableData12"
:row-class-name="tableRowClassName2"
border
@@ -331,6 +336,7 @@
height="500px"
size="mini"
@selection-change="handleSelectionChange2"
@sort-change="sortChange"
@select="handleSelection1">
<el-table-column :selectable="selectable" align="center" width="50" type="selection"/>
<!--<el-table-column label="操作" align="center" width="100" fixed="left">-->
@@ -346,7 +352,7 @@
<!--<el-tag v-if="purchased(scope.row)" type="info" size="small">已采购</el-tag>-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供商" align="center" min-width="100" prop="供货商">
<el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供商" align="center" min-width="100" prop="供货商" sortable="custom">
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
@@ -356,12 +362,12 @@
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="图号" align="center" min-width="130">
<el-table-column label="图号" align="center" min-width="130" prop="零件图号">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="名称" align="center" min-width="60">
<el-table-column label="名称" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
@@ -376,7 +382,7 @@
<!-- {{ scope.row.项目名称 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="机床图号" align="center" min-width="130">
<el-table-column label="机床图号" align="center" min-width="130" prop="机床图号" sortable="custom">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
@@ -414,16 +420,18 @@
<!--</el-table-column>-->
</el-table>
</el-row>
<div class="block">
<div class="block" style="display: inline-block;">
<el-pagination
:current-page="pageCurrent12"
:page-sizes="[10, 50, 100, 150]"
:page-size="pageSize12"
:total="total12"
style="display:inline-block;width:50px"
layout="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange12"
@current-change="handleCurrentChange12"/>
</div>
<div style="display: inline-block; float: left">
<el-tooltip :open-delay="1000" effect="dark" content="为选择的询价单添加物料" placement="top">
<el-button
type="warning"
@@ -622,23 +630,28 @@
<el-row>
<el-input v-model="inquirySheetNum" placeholder="询价单号或供应商" size="small" clearable @keyup.enter.native="pageCurrent2=1;pageSize2=10000;total2=0;searchTable2()"/>
<el-button
type="primary"
type="search"
size="mini"
icon="el-icon-search"
plain
style="margin:0px 10px"
@click="pageCurrent2=1;pageSize2=10000;total2=0;searchTable2()">查询</el-button>
@click="pageCurrent2=1;pageSize2=10;total2=0;searchTable2()">查询</el-button>
<el-button
type="warning"
type="distribution"
icon="el-icon-circle-plus-outline"
size="mini"
plain
style="margin-left: 10px"
@click="createInquirySheet">创建</el-button>
<el-button type="warning" size="mini" plain icon="el-icon-edit" style="margin-left: 10px" @click="editInquirySheet()">编辑</el-button>
<el-button type="danger" size="mini" plain icon="el-icon-delete" style="margin-left: 10px" @click="deleteInquirySheet()">删除</el-button>
<el-button :disabled="tableData3.length===0" type="primary" size="small" plain style="float: right" @click="printInquirySheet()">打印</el-button>
<el-button :disabled="tableData3.length===0" type="warning" size="small" plain style="margin-left:10px;float: right" @click="exportInquirySheet()">导出</el-button>
@click="createInquirySheet">询价单</el-button>
<el-button type="distribution" size="mini" icon="el-icon-edit" style="margin-left: 10px" @click="editInquirySheet()">编辑</el-button>
<!--<el-button-->
<!--:disabled="!(parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='')"-->
<!--type="repulse"-->
<!--plain-->
<!--size="mini"-->
<!--icon="el-icon-back"-->
<!--@click="deleteInquirySheet">撤回</el-button>-->
<el-button type="repulse" size="mini" icon="el-icon-delete" style="margin-left: 10px" @click="deleteInquirySheet()">删除</el-button>
<el-button :disabled="tableData3.length===0" type="search" size="mini" style="float: right" icon="el-icon-printer" @click="printInquirySheet()">打印</el-button>
<el-button :disabled="tableData3.length===0" type="search" size="mini" style="margin-left:10px;float: right" icon="el-icon-download" @click="exportInquirySheet()">导出</el-button>
</el-row>
</el-card>
<el-row>
@@ -737,7 +750,7 @@
{{ scope.row.组件零件流水号 ? scope.row.物料规格 : scope.row.规格 }}
</template>
</el-table-column>
<el-table-column label="待询数" align="center" width="60">
<el-table-column label="待询数" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.技术下达数量 }}
</template>
@@ -795,8 +808,8 @@
<tr>
<td style="border: none;" colspan="2">询价单编号:</td>
<td id="inquirySheetNum" style="border: none;" colspan="4"/>
<td style="border: none;" colspan="2">供应商名称:</td>
<td id="supplier" style="border: none;" colspan="6"/>
<td style="border: none;" colspan="3">供应商名称:</td>
<td id="supplier" style="border: none;margin-left: -20px " colspan="5"/>
</tr>
<tr id="tablehead">
<td width="8.3%">序号</td>
@@ -954,16 +967,18 @@
<!--</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible2=false">取消</el-button>
<el-button size="small" icon="el-icon-circle-close" @click="dialogVisible2=false">取消</el-button>
<el-button
v-show="title2==='创建询价单'"
type="primary"
type="distribution"
size="small"
icon="el-icon-circle-check"
@click="submitCreateInquirySheet1">确定</el-button>
<el-button
v-show="title2==='编辑询价单'"
type="primary"
type="distribution"
size="small"
icon="el-icon-circle-check"
@click="submitEditInquirySheet">确定</el-button>
</div>
</el-dialog>
@@ -1101,6 +1116,7 @@
import { tiaozheng2, tiaozheng1, getPerson, getBillNum, searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet,
createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange, saveOrder,
submitUseInventory, initProject, searchMachine, searchGroup, searchBaseInfo, editBaseInfo, getExport1, getExport2, searchMerge, changeNum } from '@/api/PurchasingCenter/CreateInquirySheet'
import { json2excel } from '@/utils/setMethods.js'
import { mapGetters } from 'vuex'
import { exportExcelMethod } from './exportExcel'
import $ from 'jquery'
@@ -1113,6 +1129,7 @@ export default {
startTime: '',
endTime: '',
loading: false,
loading2: false,
标准件和外购件流水号: [],
基本件流水号: [],
visible: false,
@@ -1200,7 +1217,7 @@ export default {
tableData12: [], // 基本件列表
total12: 0,
pageCurrent12: 1,
pageSize12: 1000,
pageSize12: 10,
tableData13: [], // 外购件列表
total13: 0,
pageCurrent13: 1,
@@ -1284,7 +1301,10 @@ export default {
machines2: [],
numbers: [],
numbers1: [],
row1: ''
row1: '',
ordername: '',
order: '',
printsupliername: ''
}
},
computed: {
@@ -1313,7 +1333,7 @@ export default {
this.fetchData()
this.projectChange()
// this.searchTable11() // 查表1
this.searchTable2() // 查表2
// this.searchTable2() // 查表2
this.searchUnInquiryPartNumber()
this.searchUnBuyPartNumber()
this.initDirection()
@@ -1324,6 +1344,30 @@ export default {
}, 500)
},
methods: {
// 2020 03 04 刘路加表头排序
// 1 供货商 2 机床图号 3 物料名称 4 物料型号
sortChange(column, prop, order) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '供货商') {
this.ordername = 1
} else if (column.prop === '机床图号') {
this.ordername = 2
} else if (column.prop === '物料名称') {
this.ordername = 3
} else if (column.prop === '物料型号') {
this.ordername = 4
} else {
this.ordername = ''
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable11()
this.searchTable12()
// this.getTableData()
},
// timeSearch() {
// timeSearch().then(response => {
// this.startTime = [response.data[0].外购件开始时间, response.data[0].外购件结束时间]
@@ -1600,25 +1644,64 @@ export default {
v.供货商 = v.供货商 ? v.供货商 : ''
v.备注 = v.备注 ? v.备注 : ''
})
import('./Export2Excel').then(excel => {
const dataGroup = []
const filterVal1 = ['任务分配时间', '项目名称', '机床图号', '组号', '物料名称', '物料型号', '物料规格', '待询价数量', '备注', '供货商'] // tableData1里的属性名
const filterVal2 = ['任务分配时间', '项目名称', '机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '待询价数量', '备注', '供货商'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => v[j]))
dataGroup.push(data2)
const headerGroup = [['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商'], ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '材料', '待询价数量', '备注', '供货商']]
const sheetGroup = ['外购件(未询价)', '基本件(未询价)']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '未询价采购件明细',
autoWidth: true,
bookType: 'xlsx'
})
})
var excelDatas = []
const dataGroup = []
const filterVal1 = ['任务分配时间', '项目名称', '机床图号', '组号', '物料名称', '物料型号', '物料规格', '待询价数量', '备注', '供货商'] // tableData1里的属性名
const filterVal2 = ['任务分配时间', '项目名称', '机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '待询价数量', '备注', '供货商'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => v[j]))
dataGroup.push(data2)
// const data3 = this.formatJson(filterVal1, data1)
// dataGroup.push(data3)
// const data4 = this.formatJson(filterVal1, data2)
// dataGroup.push(data4)
// console.log(dataGroup, 4444)
const headerGroup = [['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商'], ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '材料', '待询价数量', '备注', '供货商']]
// const headerGroup = ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商']
const sheetGroup = ['外购件(未询价)', '基本件(未询价)']
console.log(dataGroup)
excelDatas.push({
tHeader: headerGroup[0],
filterVal: filterVal1,
tableDatas: res1.data,
sheetName: sheetGroup[0]
},
{
tHeader: headerGroup[1],
filterVal: filterVal2,
tableDatas: res2.data,
sheetName: sheetGroup[1]
})
console.log(excelDatas)
json2excel(excelDatas, '未询价采购件明细', true, 'xlsx')
// import('./Export2Excel').then(excel => {
// const dataGroup = []
// const filterVal1 = ['任务分配时间', '项目名称', '机床图号', '组号', '物料名称', '物料型号', '物料规格', '待询价数量', '备注', '供货商'] // tableData1里的属性名
// const filterVal2 = ['任务分配时间', '项目名称', '机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '待询价数量', '备注', '供货商'] // tableData2里的属性名
// const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
// dataGroup.push(data1)
// const data2 = res2.data.map(v => filterVal2.map(j => v[j]))
// dataGroup.push(data2)
// // const data3 = this.formatJson(filterVal1, data1)
// // dataGroup.push(data3)
// // const data4 = this.formatJson(filterVal1, data2)
// // dataGroup.push(data4)
// // console.log(dataGroup, 4444)
// const headerGroup = [['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商'], ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '材料', '待询价数量', '备注', '供货商']]
// // const headerGroup = ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商']
//
// const sheetGroup = ['外购件(未询价)', '基本件(未询价)']
// console.log(headerGroup, dataGroup, sheetGroup)
// excel.export_json_to_excel2({
// header: headerGroup,
// data: dataGroup,
// sheetname: sheetGroup,
// filename: '未询价采购件明细',
// autoWidth: true,
// bookType: 'xlsx'
// })
// })
})
})
},
@@ -1766,14 +1849,17 @@ export default {
this.groupValue ? check6 = 1 : check6 = 0
this.startTime ? check7 = 1 : (check7 = 0, this.startTime = '')
this.supplierName ? check8 = 1 : check8 = 0
searchMaterial(this.pageCurrent11, this.pageSize11, 3, check1, this.materialName, check2, this.materialSpec, check3, this.materialModel, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.startTime[0], this.startTime[1], check8, this.supplierName).then(response => {
this.tableData11 = response.data.rows
this.total11 = response.data.total
console.log(this.ordername)
searchMaterial(this.pageCurrent11, this.pageSize11, 3, check1, this.materialName, check2, this.materialSpec, check3, this.materialModel, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.startTime[0], this.startTime[1], check8, this.supplierName, this.ordername, this.order).then(response => {
// this.tableData11 = response.data
console.log(response.data)
this.tableData11 = response.data.result
this.total11 = parseInt(response.data.output[0].ItemCount)
const remark = []
const supplier = []
this.remarkFilters = []
this.supplierFilters = []
response.data.rows.map(v => {
response.data.result.map(v => {
if (v.备注 === null) { v.备注 = '' }
if (v.供货商 === null) { v.供货商 = '' }
if (!remark.includes(v.备注)) {
@@ -1786,6 +1872,8 @@ export default {
}
})
this.loading = false
}).catch(() => {
this.loading = false
})
},
handleSizeChange11(val) { // 标准件和外购件列表分页
@@ -1798,7 +1886,7 @@ export default {
this.searchTable11()
},
searchTable12() { // 查询基本件列表
this.loading = true
this.loading2 = true
let check1, check2, check3, check4, check5, check6, check7, check8
this.partNum ? check1 = 1 : check1 = 0
this.partName ? check2 = 1 : check2 = 0
@@ -1808,14 +1896,14 @@ export default {
this.groupValue ? check6 = 1 : check6 = 0
this.endTime ? check7 = 1 : (check7 = 0, this.endTime = '')
this.supplierName ? check8 = 1 : check8 = 0
searchPart(this.pageCurrent12, this.pageSize12, 3, check1, this.partNum, check2, this.partName, check3, this.partSpec, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.endTime[0], this.endTime[1], check8, this.supplierName).then(response => {
this.tableData12 = response.data.rows
this.total12 = response.data.total
searchPart(this.pageCurrent12, this.pageSize12, 3, check1, this.partNum, check2, this.partName, check3, this.partSpec, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.endTime[0], this.endTime[1], check8, this.supplierName, this.ordername, this.order).then(response => {
this.tableData12 = response.data.result
this.total12 = parseInt(response.data.output[0].ItemCount)
const remark = []
const supplier = []
this.remarkFilters = []
this.supplierFilters = []
response.data.rows.map(v => {
response.data.result.map(v => {
if (!remark.includes(v.备注)) {
remark.push(v.备注)
supplier.push(v.供货商)
@@ -1823,7 +1911,9 @@ export default {
this.supplierFilters.push({ text: v.供货商, value: v.供货商 })
}
})
this.loading = false
this.loading2 = false
}).catch(() => {
this.loading2 = false
})
},
handleSizeChange12(val) { // 基本件列表分页
@@ -1952,7 +2042,7 @@ export default {
this.$message.error('请选择询价单')
} else {
console.log(this.row1, 2)
this.$confirm('确定删除该询价单?', '提示', {
this.$confirm('删除询价单,将释放该询价单下所有采购任务?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@@ -2061,7 +2151,7 @@ export default {
document.getElementsByClassName('tableData')[j].children[7].innerHTML = res.data[j].备注
}
document.getElementById('inquirySheetNum').innerHTML = this.orderExport
document.getElementById('supplier').innerHTML = ''
document.getElementById('supplier').innerHTML = this.printsupliername
}
}).then(() => {
const htmlNode = $('#inquirySheet').html()
@@ -2119,7 +2209,7 @@ export default {
document.getElementsByClassName('tableData')[j].children[7].innerHTML = res.data[j].备注
}
document.getElementById('inquirySheetNum').innerHTML = this.orderExport
document.getElementById('supplier').innerHTML = ''
document.getElementById('supplier').innerHTML = this.printsupliername
exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet')
}
})
@@ -2293,6 +2383,8 @@ export default {
},
searchTable3(row) { // 查询该询价单中的物料和零件
this.row1 = row
console.log(row.供应商名称)
this.printsupliername = row.供应商名称
this.tableData3 = []
this.inquirySheetFlowNum = row.询价单流水号
this.orderExport = row.询价单编号