This commit is contained in:
zhangdingyu
2019-09-18 12:24:50 +08:00
parent 93eb6ec5c5
commit faab73c1fa
58 changed files with 0 additions and 4278 deletions

View File

@@ -29,10 +29,6 @@
</el-select>
<el-button icon="el-icon-search" type="success" size="small" @click="pageCurrentWB = 1;pageSizeWB = 10;pageCurrent = 1;pageSize = 10;getTableData()">查询</el-button>
<<<<<<< HEAD
=======
<el-button :loading="downloadLoading" type="success" icon="el-icon-download" size="small" style="margin-left: 15px" @click="handleDownload()">导出EXCEL</el-button>
>>>>>>> 4a39ba8190d04cdcdea962794e7d7df3408bfd2d
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
@@ -263,19 +259,10 @@
import { projectSelect, machineSelect, groupSelect, basicPartsData, deleteBasicParts, purchasePartsData, deletePurchaseData, getFileData } from '@/api/TechnologyCenter/QueryParts'
import { mapGetters } from 'vuex'
import { ServerIP } from '@/utils/request'
<<<<<<< HEAD
=======
import request from '@/utils/request'
>>>>>>> 4a39ba8190d04cdcdea962794e7d7df3408bfd2d
export default {
name: 'Index',
data() {
return {
<<<<<<< HEAD
=======
downloadLoading: false,
>>>>>>> 4a39ba8190d04cdcdea962794e7d7df3408bfd2d
projectValue: '',
project: [],
machineValue: '',
@@ -355,86 +342,6 @@ export default {
this.fetchData()
},
methods: {
<<<<<<< HEAD
=======
async handleDownload() {
this.downloadLoading = true
await request({
url: '',
method: 'post',
data: {
type: '3',
name: `declare @项目流水号 int =${this.projectValue}
create table #临时表1
(
id int IDENTITY (1,1) not null,
物料名称 nvarchar(50),
物料规格 nvarchar(50),
物料型号 nvarchar(50),
primary key (id)
);
create table #临时表2
(
id int IDENTITY (1,1) not null,
物料名称 nvarchar(50),
物料规格 nvarchar(50),
物料型号 nvarchar(50),
总数量 int,
primary key (id)
);
insert into #临时表1 select distinct 物料名称,物料规格,物料型号 from dbo.零件查询_物料规格型号_统计查询_视图
where 项目流水号=@项目流水号
declare @id int =1
declare @id2 int
declare @物料名称 nvarchar(50)
declare @物料规格 nvarchar(50)
declare @物料型号 nvarchar(50)
declare @总数量 int
while (@id<=(select COUNT (id) from #临时表1 ))
begin
select @物料名称=物料名称,@物料规格=物料规格,@物料型号=物料型号 from #临时表1
where id=@id
insert into #临时表2 (物料名称,物料规格,物料型号) values (@物料名称,@物料规格,@物料型号)
set @id2 = @@IDENTITY
select @总数量 = COUNT(物料流水号) from 零件查询_物料规格型号_统计查询_视图
where 物料名称=@物料名称 and 物料规格=@物料规格 and 物料型号=@物料型号 and 项目流水号=@项目流水号
update #临时表2 set 总数量 = @总数量
where id=@id2
set @id = @id + 1
end
select * from #临时表2
drop table #临时表1
drop table #临时表2`
}
}).then(res => {
if (res.data.length === 0) {
this.$message.error('暂无数据')
this.downloadLoading = false
} else {
import('./Export2Excel').then(excel => {
const tHeader = ['物料名称', '物料型号', '物料规格', '总数量']
const filterVal = ['物料名称', '物料型号', '物料规格', '总数量']
const list = res.data
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: 'EXCEL',
autoWidth: true,
bookType: 'xlsx'
})
this.downloadLoading = false
})
}
})
},
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
return v[j]
}))
},
// ///////////////////////////////////////////////////↑0910zdy
>>>>>>> 4a39ba8190d04cdcdea962794e7d7df3408bfd2d
// 在什么情况下需要查询上传的附件调用this.getFileData()即可根据
getFileData(machineValue) {
this.hadFile = []