Files
JY1.0/src/views/PurchasingCenter/PurchaseSituationSearch/index.vue
liushuai decf0bf58e 更新
2020-05-13 18:42:58 +08:00

867 lines
42 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--suppress ALL -->
<template>
<div class="app-container">
<el-card>
<el-row>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
<!-- <el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>-->
<!-- <el-option-->
<!-- v-for="item in groupNumber"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<el-input v-model="Name" placeholder="名称规格型号" size="small" clearable/>
<!-- <el-input v-model="spec" placeholder="规格" size="small" clearable/>-->
<!-- <el-input v-model="model" placeholder="型号" size="small" clearable/>-->
<el-date-picker
v-model="startTime"
size="small"
type="daterange"
align="center"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
style="width:250px;margin-left: 5px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 15px" @click="searchTable()">查询</el-button>
<!--<el-button-->
<!--plain-->
<!--@click="open2(1)">-->
<!--成功-->
<!--</el-button>-->
<el-tooltip :open-delay="1000" effect="dark" content="将全部采购件导出到表格" placement="top">
<el-button type="warning" size="small" icon="el-icon-download" plain style="margin-left: 15px" @click="exportExcel()">导出</el-button>
</el-tooltip>
</el-row>
</el-card>
<el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()">
<el-tab-pane label="标准件" name="标准件">
<el-table v-loading="loading0" :data="tableData0" size="mini" height="700px" border stripe @sort-change="sortChange0">
<el-table-column align="center" prop="询价状态编号" label="采购状态" width="110px" sortable="custom" fixed="left">
<template slot-scope="scope">
<!--<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>-->
<!--<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>-->
<!--<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>-->
<!--<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>-->
<span v-if="!scope.row.人员编号" type="primary" size="small">未分配</span>
<span v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</span>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" prop="机床图号" width="94px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" prop="组号" width="80px" sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" prop="物料名称" width="153px" show-overflow-tooltip sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" width="128px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" prop="物料规格" width="128px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商" prop="供货商" width="132px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.供货商 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="计划数" width="70px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="用库存数" width="100px">
<template slot-scope="scope">
{{ scope.row.使用库存数 ? scope.row.使用库存数 : '0' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数" width="70px">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数" width="70px">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="不良数" width="70px">
<template slot-scope="scope">
{{ scope.row.不合格数量 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="到货状态" width="90px">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="Number(scope.row.到货数量) >= Number(scope.row.采购数量)">已到货</span>-->
<!-- <span v-else>未到货</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="供应商" prop="供应商名称" min-width="150px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同编号" min-width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购日期" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.采购时间 ? scope.row.采购时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="分配日期" width="100px">
<template slot-scope="scope">
{{ scope.row.任务分配时间 ? scope.row.任务分配时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="下达时间" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.操作日期 ? scope.row.操作日期.split(' ')[0] : '-' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent0"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize0"
:total="total0"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
</el-tab-pane>
<el-tab-pane label="外购件" name="外购件">
<el-table v-loading="loading1" :data="tableData1" size="mini" height="700px" border stripe @sort-change="sortChange1">
<el-table-column align="center" label="采购状态" prop="询价状态编号" width="110px" sortable="custom" fixed="left">
<template slot-scope="scope">
<span v-if="!scope.row.人员编号" type="primary" size="small">未分配</span>
<span v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</span>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" prop="机床图号" width="94px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" prop="组号" width="80px" sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" prop="物料名称" width="153px" show-overflow-tooltip sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" width="128px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" prop="物料规格" width="128px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商" prop="供货商" width="132px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.供货商 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="计划数" width="70px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="用滞货数" width="80px">
<template slot-scope="scope">
{{ scope.row.使用滞货数量 ? scope.row.使用滞货数量 : 0 }}
</template>
</el-table-column>
<el-table-column align="center" label="用库存数" width="80px">
<template slot-scope="scope">
{{ scope.row.使用库存数 ? scope.row.使用库存数 : 0 }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数" width="70px">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数" width="70px">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="不良数" width="70px">
<template slot-scope="scope">
{{ scope.row.不合格数量 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="到货状态" width="90px">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="Number(scope.row.到货数量) >= Number(scope.row.采购数量)">已到货</span>-->
<!-- <span v-else-if="0 < Number(scope.row.到货数量) < Number(scope.row.采购数量)">部分到货</span>-->
<!-- <span v-else>未到货</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="供应商" prop="供应商名称" min-width="150px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同编号" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购日期" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.采购时间 ? scope.row.采购时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="分配日期" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.任务分配时间 ? scope.row.任务分配时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="下达时间" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.操作日期 ? scope.row.操作日期.split(' ')[0] : '-' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize1"
:total="total1"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-tab-pane>
<el-tab-pane label="基本件" name="基本件">
<el-table v-loading="loading2" :data="tableData2" size="mini" height="700px" border stripe @sort-change="sortChange2">
<el-table-column align="center" label="采购状态" prop="询价状态编号" width="110px" sortable="custom" fixed="left">
<template slot-scope="scope">
<span v-if="!scope.row.人员编号" type="primary" size="small">未分配</span>
<span v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</span>
<span v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</span>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" prop="机床图号" width="94px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" prop="组号" width="80px" sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" prop="物料名称" width="153px" show-overflow-tooltip sortable="custom" fixed="left">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="图号" width="100px" show-overflow-tooltip fixed="left">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" prop="规格" width="128px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料" width="119px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商" prop="供货商" width="132px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ scope.row.供货商 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="计划数" width="70px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数" width="70px">
<template slot-scope="scope">
{{ scope.row.数量 }}
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || '—' }}-->
</template>
</el-table-column>
<el-table-column align="center" label="到货数" width="70px">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="不良数" width="70px">
<template slot-scope="scope">
{{ scope.row.不合格数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="供应商" prop="供应商名称" min-width="100px" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购合同编号" width="110px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购日期" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.采购时间 ? scope.row.采购时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="分配日期" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.任务分配时间 ? scope.row.任务分配时间.split(' ')[0] : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="下达时间" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.操作日期 ? scope.row.操作日期.split(' ')[0] : '-' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize2"
:total="total2"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { initMachineProject, searchgroup, searchTable1, searchTable2, searchTable1Export, searchTable2Export } from '@/api/PurchasingCenter/PurchaseSituationSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购件采购查询
data() {
return {
loading0: false,
loading1: false,
loading2: false,
startTime: '',
Name: '',
spec: '',
model: '',
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
PartType: '标准件',
tableData0: [],
tableData1: [],
tableData2: [],
tableData3: [],
pageCurrent0: 1,
pageSize0: 50,
total0: 0,
pageCurrent1: 1,
pageSize1: 50,
total1: 0,
pageCurrent2: 1,
pageSize2: 50,
total2: 0
}
},
computed: {
...mapGetters([
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
// open2: function (mess) {
// this.$notify({
// title: '提示',
// message: '您有新的领料单需要备料确认,请及时处理,点击查看',
// onClick: this.message(mess).then((res) => {
//
// // this.message(mess)
// this.$router.push({path: '/PurchasingCenter/PurchaseTaskAllocate'})
// // this.$router.push({ path: '/Inventory/MaterialOut' })
// // setTimeout(this.noticeContractKG.close(), 1000)
// }),
// duration: 1000 * 60
// })
// },
// message (mess) {
// return mess
//
// // this.$router.push({path: '/PurchasingCenter/PurchaseTaskAllocate'})
// },
// 导出采购物料执行情况
exportDetail() {
let check1, check2, check3
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.startTime ? check3 = 1 : (check3 = 0, this.startTime = '')
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 1, check3, this.startTime[0], this.startTime[1]).then(res1 => { // 标准件
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 2, check3, this.startTime[0], this.startTime[1]).then(res2 => { // 外购件
searchTable2Export(check1, this.machineNumberValue, check2, this.groupNumberValue, check3, this.startTime[0], this.startTime[1]).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[14] = '未分配'
} else if (v[6] === '—') {
v[14] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[14] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[14] = '全部到货'
}
})
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[14] = '未分配'
} else if (v[6] === '—') {
v[14] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[14] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[14] = '全部到货'
}
})
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[15] = '未分配'
} else if (v[7] === '—') {
v[15] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[15] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[15] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '下达任务时间', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '下达任务时间', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '下达任务时间', '备注', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '采购物料执行情况',
autoWidth: true,
bookType: 'xlsx'
})
})
})
})
})
},
exportExcel() {
let check, check1, check2, check3
this.machineNumberValue ? check = 1 : check = 0
this.groupNumberValue ? check1 = 1 : check1 = 0
this.Name ? check2 = 1 : check2 = 0
this.startTime ? check3 = 1 : (check3 = 0, this.startTime = '')
var param = []
param[0] = ['机床流水号_check', check]
param[1] = ['机床流水号', this.machineNumberValue]
param[2] = ['组件流水号_check', check1]
param[3] = ['组件流水号', this.groupNumberValue]
param[4] = ['零件名称_check', check2]
param[5] = ['零件名称', this.Name]
param[6] = ['时间_check', check3]
if (check3 === 0) {
param[7] = ['开始时间', '']
param[8] = ['结束时间', '']
} else {
param[7] = ['开始时间', this.startTime[0]]
param[8] = ['结束时间', this.startTime[1]]
}
var Data = this.CreateData('2001', '报表_采购部采购件_查询数据', param)
this.exportExcel_NPOI(Data)
},
fetchData() {
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() {
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
}
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
sortChange0(column, prop, order) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '组号') {
this.partName = 1
} else if (column.prop === '物料名称') { this.partName = 2 } else if (column.prop === '物料规格') {
this.partName = 3
} else if (column.prop === '供货商') {
this.partName = 4
} else if (column.prop === '供应商名称') {
this.partName = 5
} else if (column.prop === '供货商') {
this.partName = 4
} else if (column.prop === '询价状态编号') {
this.partName = 6
} else {
this.partName = ''
}
console.log(this.ordername, 9990999)
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable0()
},
searchTable0() { // 查询标准件
this.tableData0 = []
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
this.startTime ? check6 = 1 : (check6 = 0, this.startTime = '')
this.loading0 = true
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent0, this.pageSize0, 1, check3, this.Name, check4, this.spec, check5, this.model, check6, this.startTime[0], this.startTime[1], this.order, this.partName).then(response => {
if (response.data.result !== 0) {
for (let i = 0; i < response.data.result.length; i++) {
this.tableData0.push({
人员编号: response.data.result[i].人员编号,
姓名: response.data.result[i].姓名,
询价状态编号: response.data.result[i].询价状态编号,
采购状态编号: response.data.result[i].采购状态编号,
机床图号: response.data.result[i].机床图号,
组号: response.data.result[i].组号,
物料名称: response.data.result[i].物料名称,
物料型号: response.data.result[i].物料型号,
物料规格: response.data.result[i].物料规格,
供货商: response.data.result[i].供货商,
零件数量: response.data.result[i].零件数量,
数量: response.data.result[i].数量,
离线采购数量: response.data.result[i].离线采购数量,
使用库存数: response.data.result[i].使用库存数,
已到货数量: response.data.result[i].已到货数量,
离线到货数量: response.data.result[i].离线到货数量,
供应商名称: response.data.result[i].供应商名称,
离线合同供应商名称: response.data.result[i].离线合同供应商名称,
采购合同编号: response.data.result[i].采购合同编号,
离线合同编号: response.data.result[i].离线合同编号,
备注: response.data.result[i].备注,
采购数量: Number(response.data.result[i].询价状态编号) === 1 && response.data.result[i].人员编号 !== '' ? '—' : response.data.result[i].数量 || response.data.result[i].离线采购数量 || '—',
到货数量: Number(response.data.result[i].询价状态编号) === 1 && response.data.result[i].人员编号 !== '' ? '—' : response.data.result[i].已到货数量 || response.data.result[i].离线到货数量 || '—',
不合格数量: response.data.result[i].不合格数量,
任务分配时间: response.data.result[i].任务分配时间,
操作日期: response.data.result[i].操作日期,
采购时间: response.data.result[i].采购时间
})
}
}
this.total0 = parseInt(response.data.output[0].ItemCount)
this.loading0 = false
}).catch(() => {
this.loading0 = false
})
},
sortChange1(column, prop, order) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '组号') {
this.partName = 1
} else if (column.prop === '物料名称') { this.partName = 2 } else if (column.prop === '物料规格') {
this.partName = 3
} else if (column.prop === '供货商') {
this.partName = 4
} else if (column.prop === '供应商名称') {
this.partName = 5
} else if (column.prop === '询价状态编号') {
this.partName = 6
} else {
this.partName = ''
}
console.log(this.ordername, 9990999)
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable1()
},
searchTable1() { // 查询外购件
this.tableData1 = []
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
this.startTime ? check6 = 1 : (check6 = 0, this.startTime = '')
this.loading1 = true
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent1, this.pageSize1, 2, check3, this.Name, check4, this.spec, check5, this.model, check6, this.startTime[0], this.startTime[1], this.order, this.partName).then(response => {
console.log(response.data.result.length, 222)
// this.total02 = parseInt(response.data.output[0].ItemCount)
this.total1 = parseInt(response.data.output[0].ItemCount)
if (response.data.result.length !== 0) {
for (let i = 0; i < response.data.result.length; i++) {
this.tableData1.push({
人员编号: response.data.result[i].人员编号,
姓名: response.data.result[i].姓名,
询价状态编号: response.data.result[i].询价状态编号,
采购状态编号: response.data.result[i].采购状态编号,
机床图号: response.data.result[i].机床图号,
组号: response.data.result[i].组号,
物料名称: response.data.result[i].物料名称,
物料型号: response.data.result[i].物料型号,
物料规格: response.data.result[i].物料规格,
供货商: response.data.result[i].供货商,
零件数量: response.data.result[i].零件数量,
数量: response.data.result[i].数量,
离线采购数量: response.data.result[i].离线采购数量,
已到货数量: response.data.result[i].已到货数量,
离线到货数量: response.data.result[i].离线到货数量,
供应商名称: response.data.result[i].供应商名称,
离线合同供应商名称: response.data.result[i].离线合同供应商名称,
采购合同编号: response.data.result[i].采购合同编号,
离线合同编号: response.data.result[i].离线合同编号,
备注: response.data.result[i].备注,
采购数量: Number(response.data.result[i].询价状态编号) === 1 && response.data.result[i].人员编号 !== '' ? '—' : response.data.result[i].数量 || response.data.result[i].离线采购数量 || '—',
到货数量: Number(response.data.result[i].询价状态编号) === 1 && response.data.result[i].人员编号 !== '' ? '—' : response.data.result[i].已到货数量 || response.data.result[i].离线到货数量 || '—',
不合格数量: response.data.result[i].不合格数量,
操作日期: response.data.result[i].操作日期,
采购时间: response.data.result[i].采购时间,
任务分配时间: response.data.result[i].任务分配时间
})
}
}
this.loading1 = false
}).catch(() => {
this.loading1 = false
})
},
sortChange2(column, prop, order) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '组号') {
this.partName = 1
} else if (column.prop === '物料名称') { this.partName = 2 } else if (column.prop === '物料规格') {
this.partName = 3
} else if (column.prop === '供货商') {
this.partName = 4
} else if (column.prop === '供应商名称') {
this.partName = 5
} else if (column.prop === '询价状态编号') {
this.partName = 6
} else {
this.partName = ''
}
console.log(this.ordername, 9990999)
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable2()
},
searchTable2() { // 查询基本件
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
this.loading2 = true
this.startTime ? check6 = 1 : (check6 = 0, this.startTime = '')
searchTable2(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent2, this.pageSize2, check3, this.Name, check4, this.spec, check5, this.model, check6, this.startTime[0], this.startTime[1], this.order, this.partName).then(response => {
this.tableData2 = response.data.result
this.total2 = parseInt(response.data.output[0].ItemCount)
this.loading2 = false
}).catch(() => {
this.loading2 = false
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 0px;
}
.el-select{
width:150px;
margin-right: 10px;
}
.el-input{
width:150px;
margin-right: 10px;
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>