This commit is contained in:
liulujia@meswork.com
2020-02-11 10:14:59 +08:00
10 changed files with 119 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ import state from '@/store'
// 查询表格数据 // 查询表格数据
export function searchtable(check1, ManufacturerAbbreviation, check2, starttime, endTime, pageCurrent, pageSize) { export function searchtable(check1, ManufacturerAbbreviation, check2, starttime, endTime, pageCurrent, pageSize) {
console.log(state.state.tagsView)
return request({ return request({
url: '', url: '',
method: 'post', method: 'post',

View File

@@ -4,7 +4,7 @@ import { type } from './tool' // type判断传入值的类型比typeof更详
export default { export default {
install(Vue) { install(Vue) {
Vue.prototype.exportExcel_NPOI = function(param) { Vue.prototype.exportExcel_NPOI = function(param) {
console.log(ExcelDownLoad, param, 1111111111) console.log(param, 1)
download(`${ExcelDownLoad}?param=${param}`) download(`${ExcelDownLoad}?param=${param}`)
} }
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) { Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
@@ -272,10 +272,11 @@ export default {
} }
function download(url) { function download(url) {
getBlob(url, function(blob, filename) { getBlob(url, function(blob, filename) {
console.log(blob, filename, 2)
saveAs(blob, filename) saveAs(blob, filename)
}) })
} }
// function decodeUtf8(bytes) { var encoded = ''; for (var i = 0; i < bytes.length; i++) { encoded += '%' + bytes[i].toString(16) } return decodeURIComponent(encoded) }
function getBlob(url, cb) { function getBlob(url, cb) {
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
xhr.open('GET', url, true) xhr.open('GET', url, true)
@@ -283,14 +284,14 @@ function getBlob(url, cb) {
xhr.onload = function() { xhr.onload = function() {
if (xhr.status === 200) { if (xhr.status === 200) {
const name = xhr.getResponseHeader('content-disposition').split('=')[1] const name = xhr.getResponseHeader('content-disposition').split('=')[1]
var filename1 = decodeURIComponent(name) var filename = decodeURIComponent(name)
cb(xhr.response, filename1) cb(xhr.response, filename)
} }
} }
xhr.send() xhr.send()
} }
function saveAs(blob, filename = '下载文件.xls') { function saveAs(blob, filename) {
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename) navigator.msSaveBlob(blob, filename)
} else { } else {

View File

@@ -17,7 +17,7 @@ export const download = `http://123.56.95.229:8010/submit/downloadFile.ashx` //
export const uploadPerson = `http://123.56.95.229:8010/submit/uploadPerson.ashx` export const uploadPerson = `http://123.56.95.229:8010/submit/uploadPerson.ashx`
export const uploadOP = `http://123.56.95.229:8010/submit/uploadOP.ashx` export const uploadOP = `http://123.56.95.229:8010/submit/uploadOP.ashx`
export const url = `http://123.56.95.229:8010/submit/MESCommonBase.ashx` // 采购件入库、离线件入库 export const url = `http://123.56.95.229:8010/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/downloadFile.ashx' // 导出excel export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/MESDownloadExcel.ashx' // 导出excel
export const ExcelWaiGou = 'http://192.168.0.106:8045/submit/excel.ashx' // 导出excel export const ExcelWaiGou = 'http://192.168.0.106:8045/submit/excel.ashx' // 导出excel
// 技术中心程序发布时要更改下面所有的IP到0段 // 技术中心程序发布时要更改下面所有的IP到0段
export const ServerIP = `http://123.56.95.229:8010/webpage/file/` export const ServerIP = `http://123.56.95.229:8010/webpage/file/`

View File

@@ -23,6 +23,7 @@
<!--<el-input v-model="model" placeholder="图号或型号" style="width:150px;margin-left: 10px" clearable size="small" />--> <!--<el-input v-model="model" placeholder="图号或型号" style="width:150px;margin-left: 10px" clearable size="small" />-->
<!--<el-input v-model="spec" placeholder="规格" clearable size="small" style="width:150px;margin: 0px 10px" />--> <!--<el-input v-model="spec" placeholder="规格" clearable size="small" style="width:150px;margin: 0px 10px" />-->
<el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 10px" plain @click="searchRecord()">查询</el-button> <el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 10px" plain @click="searchRecord()">查询</el-button>
<el-button type="success" plain size="small" @click="exportExcel()">导出</el-button>
</el-row> </el-row>
<el-row v-show="false" style="margin-bottom:10px"> <el-row v-show="false" style="margin-bottom:10px">
<el-date-picker <el-date-picker
@@ -112,6 +113,36 @@ export default {
this.searchRecord() this.searchRecord()
}, },
methods: { methods: {
// EXCEL 导出
// 姜福壮
exportExcel() {
let check1, check2, check3, check4, check5, check6, check7
this.projectValue ? check1 = 1 : check1 = 0
this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
this.name ? check4 = 1 : check4 = 0
this.spec ? check5 = 1 : check5 = 0
this.model ? check6 = 1 : check6 = 0
this.inTime ? check7 = 1 : (check7 = 0, this.inTime = '')
var param = []
param[0] = ['项目流水号_check', check1]
param[1] = ['项目流水号', this.projectValue]
param[2] = ['机床流水号_check', check2]
param[3] = ['机床流水号', this.machineValue]
param[4] = ['组件流水号_check', check3]
param[5] = ['组件流水号', this.groupValue]
param[6] = ['名称_check', check4]
param[7] = ['名称', this.name]
param[8] = ['规格_check', check5]
param[9] = ['规格', this.spec]
param[10] = ['图号或型号_check', check6]
param[11] = ['图号或型号', this.model]
param[12] = ['入库时间_check', check7]
param[13] = ['入库开始时间', this.inTime[0]]
param[14] = ['入库结束时间', this.inTime[1]]
var Data = this.CreateData('00', '报表_采购部仓库_入库记录_查询', param)
this.exportExcel_NPOI(Data)
},
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++) {

View File

@@ -23,6 +23,7 @@
<!--<el-input v-model="model" placeholder="图号或型号" clearable size="small" style="width:150px;margin-left: 10px" />--> <!--<el-input v-model="model" placeholder="图号或型号" clearable size="small" style="width:150px;margin-left: 10px" />-->
<!--<el-input v-model="spec" placeholder="规格" clearable size="small" style="width:150px;margin: 0px 10px" />--> <!--<el-input v-model="spec" placeholder="规格" clearable size="small" style="width:150px;margin: 0px 10px" />-->
<el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 10px" plain @click="pageCurrent1=1;pageSize1=100;searchRecord()">查询</el-button> <el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 10px" plain @click="pageCurrent1=1;pageSize1=100;searchRecord()">查询</el-button>
<el-button type="success" plain size="small" @click="exportExcel()">导出</el-button>
</el-row> </el-row>
<el-row v-show="false" style="margin-bottom:10px"> <el-row v-show="false" style="margin-bottom:10px">
<el-date-picker <el-date-picker
@@ -114,6 +115,36 @@ export default {
this.searchRecord() this.searchRecord()
}, },
methods: { methods: {
// EXCEL 导出
// 姜福壮
exportExcel() {
let check1, check2, check3, check4, check5, check6, check7
this.projectValue ? check1 = 1 : check1 = 0
this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
this.name ? check4 = 1 : check4 = 0
this.spec ? check5 = 1 : check5 = 0
this.model ? check6 = 1 : check6 = 0
this.inTime ? check7 = 1 : (check7 = 0, this.inTime = '')
var param = []
param[0] = ['项目流水号_check', check1]
param[1] = ['项目流水号', this.projectValue]
param[2] = ['机床流水号_check', check2]
param[3] = ['机床流水号', this.machineValue]
param[4] = ['组件流水号_check', check3]
param[5] = ['组件流水号', this.groupValue]
param[6] = ['名称_check', check4]
param[7] = ['名称', this.name]
param[8] = ['规格_check', check5]
param[9] = ['规格', this.spec]
param[10] = ['图号或型号_check', check6]
param[11] = ['图号或型号', this.model]
param[12] = ['入库时间_check', check7]
param[13] = ['入库开始时间', this.inTime[0]]
param[14] = ['入库结束时间', this.inTime[1]]
var Data = this.CreateData('00', '报表_采购部仓库_出库记录_查询', param)
this.exportExcel_NPOI(Data)
},
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++) {

View File

@@ -7,6 +7,7 @@
<!-- <el-input v-model="materialSpec" placeholder="物料规格" size="small" style="margin-bottom: 10px; width: 120px;" clearable/>--> <!-- <el-input v-model="materialSpec" placeholder="物料规格" size="small" style="margin-bottom: 10px; width: 120px;" clearable/>-->
<!-- <el-input v-model="materialModel" placeholder="物料型号" size="small" style="margin-bottom: 10px; width: 120px;" clearable/>--> <!-- <el-input v-model="materialModel" placeholder="物料型号" size="small" style="margin-bottom: 10px; width: 120px;" clearable/>-->
<el-button type="primary" icon="el-icon-search" size="small" plain style="margin-left: 10px" @click="pageCurrent=1;pageSize=30;searchMaterial()">查询</el-button> <el-button type="primary" icon="el-icon-search" size="small" plain style="margin-left: 10px" @click="pageCurrent=1;pageSize=30;searchMaterial()">查询</el-button>
<el-button type="success" plain size="small" @click="exportExcel()">导出</el-button>
<!-- <el-button type="primary" icon="el-icon-edit" size="small" @click="addMaterial()">新增</el-button>--> <!-- <el-button type="primary" icon="el-icon-edit" size="small" @click="addMaterial()">新增</el-button>-->
</el-row> </el-row>
</div> </div>
@@ -190,6 +191,23 @@ export default {
this.searchMaterial() this.searchMaterial()
}, },
methods: { methods: {
// EXCEL 导出
// 姜福壮
exportExcel() {
let check1, check2, check3
this.materialName ? check1 = 1 : check1 = 0
this.materialSpec ? check2 = 1 : check2 = 0
this.materialModel ? check3 = 1 : check3 = 0
var param = []
param[0] = ['物料名称_check', check1]
param[1] = ['物料名称', this.materialName]
param[2] = ['物料规格_check', check2]
param[3] = ['物料规格', this.materialSpec]
param[4] = ['物料型号_check', check3]
param[5] = ['物料型号', this.materialModel]
var Data = this.CreateData('00', '报表_采购部仓库_库存_查询', param)
this.exportExcel_NPOI(Data)
},
// 初始化数据 // 初始化数据
initData() { initData() {
const param = { const param = {

View File

@@ -287,10 +287,10 @@
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col style="width: 900px;margin-left: 10px"> <el-col style="width: 920px;margin-left: 10px">
<el-card> <el-card>
<el-table :data="tableData6" border size="mini" style="width: 100%" height="300px"> <el-table :data="tableData6" border size="mini" style="width: 100%" height="300px">
<el-table-column label="序号" type="index" align="center" width="45px"/> <el-table-column label="序号" type="index" align="center" width="50px"/>
<el-table-column label="零件名称" show-overflow-tooltip align="center" width="90px"> <el-table-column label="零件名称" show-overflow-tooltip align="center" width="90px">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.物料名称 }} {{ scope.row.物料名称 }}

View File

@@ -45,6 +45,7 @@
<el-button class="button111" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="ADD()">新增</el-button> <el-button class="button111" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="ADD()">新增</el-button>
<!--<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px;background: #fdf6ec;border-color: #ff9759;color: #ff9759;" @click="ADD()">新增</el-button>--> <!--<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px;background: #fdf6ec;border-color: #ff9759;color: #ff9759;" @click="ADD()">新增</el-button>-->
</el-tooltip> </el-tooltip>
<el-button type="success" plain size="small" @click="exportExcel()">导出</el-button>
</div> </div>
</el-card> </el-card>
<el-row> <el-row>
@@ -231,6 +232,7 @@ export default {
startTime: '', startTime: '',
endTime: '', endTime: '',
date: null, date: null,
time_check: 0,
PageCurrent: 1, PageCurrent: 1,
PageSize: 10, PageSize: 10,
total: null, total: null,
@@ -279,6 +281,28 @@ export default {
// this.fetchTableData1() // this.fetchTableData1()
}, },
methods: { methods: {
// EXCEL 导出
// 姜福壮
exportExcel() {
if (this.contractNumber === '' || this.contractNumber === null) { this.contractNumber_check = 0 } else { this.contractNumber_check = 1 }
if (this.date !== null) {
this.time_check = 1
this.startTime = this.datetoYYMMDD(this.date[0])
this.endTime = this.datetoYYMMDD(this.date[1])
} else {
this.time_check = 0
this.startTime = ''
this.endTime = ''
}
var param = []
param[0] = ['项目流水号_check', this.contractNumber_check]
param[1] = ['项目流水号', this.contractNumber]
param[2] = ['日期_check', this.time_check]
param[3] = ['开始日期', this.startTime]
param[4] = ['结束日期', this.endTime]
var Data = this.CreateData('00', '报表_自家项目报表_查询', param)
this.exportExcel_NPOI(Data)
},
init() { init() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'entryName') this.getSelect(initProject, ['项目名称', '项目流水号'], 'entryName')
}, },

View File

@@ -56,7 +56,6 @@
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
size="mini" size="mini"
border border
stripe
style="width: 100%" style="width: 100%"
height="500px" height="500px"
highlight-current-row highlight-current-row

View File

@@ -28,17 +28,17 @@
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries1" show-summary border style="width: 100%;max-height: 700px;" height="700px"> <el-table v-loading="" :data="tableData2" :summary-method="getSummaries1" show-summary border style="width: 100%;max-height: 700px;" height="700px">
<el-table-column label="零件名称" align="center" width="150"> <el-table-column label="零件名称" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.物料名称 ? scope.row.物料名称 : scope.row.件名称 }} {{ scope.row.件名称 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="图号或型号" align="center" width="150"> <el-table-column label="图号或型号" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.物料型号 ? scope.row.物料型号 : scope.row. }} {{ scope.row.图号或型 }}
</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">
{{ scope.row.材料 ? scope.row.材料 : scope.row.物料规格 }} {{ scope.row.材料规格 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" align="center" width="100"> <el-table-column label="数量" align="center" width="100">
@@ -62,7 +62,7 @@
</template> </template>
<script> <script>
import { initProject, searchProjectTotal1, searchProjectTotal2 } from '@/api/WorkshopProcurement/ProjectTotalSearch' import { initProject, searchProjectTotal2 } from '@/api/WorkshopProcurement/ProjectTotalSearch'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
@@ -99,16 +99,8 @@ export default {
}, },
searchTable1() { searchTable1() {
if (this.projectValue) { if (this.projectValue) {
searchProjectTotal1(this.projectValue).then(response => {
this.tableData = response.data
})
searchProjectTotal2(this.projectValue).then(response => { searchProjectTotal2(this.projectValue).then(response => {
this.tableData2 = response.data this.tableData2 = response.data
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].物料型号 === null || response.data[i].物料型号 === '') {
response.data[i].物料型号 = response.data[i].零件图号
}
}
}) })
} else { } else {
this.$message.error('请选择项目') this.$message.error('请选择项目')
@@ -164,3 +156,4 @@ export default {
width:300px width:300px
} }
</style> </style>