Browse Source

预测版本增加导出功能

wangxy
wangxy 2 years ago
parent
commit
4baf5a762e
1 changed files with 238 additions and 130 deletions
  1. +238
    -130
      src/views/plan/workbench/predictVersion/index.vue

+ 238
- 130
src/views/plan/workbench/predictVersion/index.vue View File

@ -2,11 +2,20 @@
<div ref="tableRef" class="table-height-wrap predict-version-wrapper"> <div ref="tableRef" class="table-height-wrap predict-version-wrapper">
<SearchTemplate> <SearchTemplate>
<el-form :inline="true" class="clearfix search-content"> <el-form :inline="true" class="clearfix search-content">
<el-form-item label="版本号">
<el-input v-model.trim="queryParams.versionId"
placeholder="请输入查询内容"
clearable
style="width: 240px" />
<el-form-item label="版本号" style="margin-bottom: 0">
<el-select
style="width: 300px"
v-model="queryParams.versionId"
filterable
placeholder="请选择"
>
<el-option
v-for="item in getSpecifiedVersion"
:key="item['AP_CustDemandVerHead-VersionId']"
:label="item['AP_CustDemandVerHead-VersionId']"
:value="item['AP_CustDemandVerHead-VersionId']"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户"> <el-form-item label="客户">
<el-select <el-select
@ -19,10 +28,12 @@
:loading="customerLoading" :loading="customerLoading"
@visible-change="setCustomerList" @visible-change="setCustomerList"
> >
<el-option v-for="item in customerArray"
:key="item['Customer-CustomerId']"
:label="item['Customer-Name1']"
:value="item['Customer-CustomerId']" />
<el-option
v-for="item in customerArray"
:key="item['Customer-CustomerId']"
:label="item['Customer-Name1']"
:value="item['Customer-CustomerId']"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物料"> <el-form-item label="物料">
@ -32,63 +43,128 @@
filterable filterable
:loading="artIdLoading" :loading="artIdLoading"
@visible-change="setArtList" @visible-change="setArtList"
placeholder="请选择">
<el-option v-for="item in artList"
:key="item['Article-ArtId']"
:label="item['Article-ArtId'] + '-' + item['Article-Descr1']"
:value="item['Article-ArtId']" />
placeholder="请选择"
>
<el-option
v-for="item in artList"
:key="item['Article-ArtId']"
:label="item['Article-ArtId'] + '-' + item['Article-Descr1']"
:value="item['Article-ArtId']"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button icon="el-icon-search"
size="mini"
:disabled="!queryParams.versionId"
class="search-button-style"
@click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh"
size="mini"
class="reset-button-style"
@click="resetQuery">重置</el-button>
<el-button
icon="el-icon-search"
size="mini"
:disabled="!queryParams.versionId"
class="search-button-style"
@click="handleQuery"
>搜索</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
class="reset-button-style"
@click="resetQuery"
>重置</el-button
>
<el-button
icon="el-icon-download"
class="add-button-style"
@click="handleExport"
style="margin-left: 24px"
>导出</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</SearchTemplate> </SearchTemplate>
<ContentContainer> <ContentContainer>
<el-table <el-table
v-if="tableHeight" v-if="tableHeight"
:height="tableHeight"
:height="tableHeight"
:data="tableData1" :data="tableData1"
v-loading="loading" v-loading="loading"
size="mini" size="mini"
@header-dragend="(newWidth, oldWidth, column)=>saveRowWidth(column, newWidth)"
@header-dragend="
(newWidth, oldWidth, column) => saveRowWidth(column, newWidth)
"
border border
> >
<el-table-column :label="getColumnName('AP_CustArtlst-ArtId')" align="center">
<el-table-column
show-overflow-tooltip
:label="getColumnName('AP_CustArtlst-ArtId')"
align="center"
>
<template #default="scope">
{{ scope.row["AP_CustArtlst-ArtId"] }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
:label="getColumnName('AP_CustArtlst-Descr1')"
align="center"
>
<template #default="scope">
{{ scope.row["AP_CustArtlst-Descr1"] }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
:label="getColumnName('Customer-CustomerId')"
align="center"
>
<template #default="scope">
{{ scope.row["Customer-CustomerId"] }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
:label="getColumnName('AP_CustArtlst-CustArtId')"
align="center"
>
<template #default="scope"> <template #default="scope">
{{scope.row['AP_CustArtlst-ArtId']}}
{{ scope.row["AP_CustArtlst-CustArtId"] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="getColumnName('AP_CustArtlst-Descr1')" align="center">
<el-table-column
show-overflow-tooltip
:label="getColumnName('Customer-FcustId')"
align="center"
>
<template #default="scope"> <template #default="scope">
{{scope.row['AP_CustArtlst-Descr1']}}
{{ scope.row["Customer-FcustId"] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="getColumnName('Customer-CustomerId')" align="center">
<el-table-column
show-overflow-tooltip
:label="getColumnName('Customer-Name1')"
align="center"
>
<template #default="scope"> <template #default="scope">
{{scope.row['Customer-CustomerId']}}
{{ scope.row["Customer-Name1"] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="getColumnName('Customer-FcustId')" align="center">
<el-table-column
show-overflow-tooltip
:label="getColumnName('AP_CustArtlst-LastUser')"
align="center"
>
<template #default="scope"> <template #default="scope">
{{scope.row['Customer-FcustId']}}
{{ scope.row["AP_CustArtlst-LastUser"] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="getColumnName('Customer-Name1')" align="center">
<el-table-column
show-overflow-tooltip
:label="getColumnName('User-Name')"
align="center"
>
<template #default="scope"> <template #default="scope">
{{scope.row['Customer-Name1']}}
{{ scope.row["User-Name"] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
v-for="(item) in headers"
<el-table-column
v-for="item in headers"
:key="item" :key="item"
:width="getRowWidth(item)" :width="getRowWidth(item)"
:label="getColumnName(item)" :label="getColumnName(item)"
@ -100,110 +176,142 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination
<Pagination
v-show="pagination.total > 0" v-show="pagination.total > 0"
v-model:pagination="pagination" v-model:pagination="pagination"
@change="getTableList" />
@change="getTableList"
/>
</ContentContainer> </ContentContainer>
</div> </div>
</template> </template>
<script> <script>
import { ListMixin } from "@/mixins/ListMixin";
import { get } from "@/server/api.js";
import { getArtIdList } from "@/server/productionPlanning/emergencyOrder";
export default {
mixins: [ListMixin],
data() {
return {
artList: [],
customerArray: [],
queryTableDataUrl: "/admin/ap/custdemandverhead/selectdetail",
headers: [], //
tableHeight: 0,
artIdLoading: false,
customerLoading: false,
tableData1: []
};
},
methods: {
//
getTableList() {
this.loading = true;
for (let key in this.queryParams) {
if(this.queryParams[key] == ''){
this.queryParams[key]=undefined
}
import { ListMixin } from "@/mixins/ListMixin";
import { get } from "@/server/api.js";
import { getArtIdList } from "@/server/productionPlanning/emergencyOrder";
export default {
mixins: [ListMixin],
data() {
return {
artList: [],
customerArray: [],
queryTableDataUrl: "/admin/ap/custdemandverhead/selectdetail",
headers: [], //
tableHeight: 0,
artIdLoading: false,
customerLoading: false,
tableData1: [],
getSpecifiedVersion: [],
};
},
methods: {
//
getTableList() {
this.loading = true;
for (let key in this.queryParams) {
if (this.queryParams[key] == '') {
this.queryParams[key] = undefined
} }
get(this.queryTableDataUrl, {
...this.pagination,
...this.queryParams,
"customerId": this.queryParams.customerId ? this.queryParams.customerId.join(",") : undefined
})
.then(({ code, data: { count = 0, records: { Data=[], Head=[]} } }) => {
if (code === 200) {
this.headers = Head || []
this.tableData1 = (Data || []).map(el => {
return {
...el.Info,
...el.Item
}
})
this.pagination.total = count
this.loading = false
} else {
this.loading = false
}
})
.catch(() => {
}
get(this.queryTableDataUrl, {
...this.pagination,
...this.queryParams,
"customerId": this.queryParams.customerId ? this.queryParams.customerId.join(",") : undefined
})
.then(({ code, data: { count = 0, records: { Data = [], Head = [] } } }) => {
if (code === 200) {
this.headers = Head || []
this.tableData1 = (Data || []).map(el => {
return {
...el.Info,
...el.Item
}
})
this.pagination.total = count
this.loading = false this.loading = false
});
},
//
setArtList() {
this.artIdLoading = true
getArtIdList().then(({ data = [] }) => {
this.artIdLoading = false
this.artList = data;
}).catch( () => {
this.artIdLoading = false
})
},
//
setCustomerList() {
this.customerLoading = true
get('/admin/base/customer/customerlst').then(({ data = [] }) => {
this.customerLoading = false
this.customerArray = data
}).catch( () => {
this.customerLoading = false
} else {
this.loading = false
}
}) })
},
//
handleQuery() {
this.pagination.pageNumber = 1;
this.getTableList();
},
//
resetQuery() {
this.queryParams.customerId = [];
this.queryParams.versionId = '';
this.queryParams.artId = '';
this.handleQuery();
},
.catch(() => {
this.loading = false
});
},
//
setArtList() {
this.artIdLoading = true
getArtIdList().then(({ data = [] }) => {
this.artIdLoading = false
this.artList = data;
}).catch(() => {
this.artIdLoading = false
})
},
//
setCustomerList() {
this.customerLoading = true
get('/admin/base/customer/customerlst').then(({ data = [] }) => {
this.customerLoading = false
this.customerArray = data
}).catch(() => {
this.customerLoading = false
})
},
//
handleQuery() {
this.pagination.pageNumber = 1;
this.getTableList();
},
//
resetQuery() {
this.queryParams.customerId = [];
this.queryParams.versionId = '';
this.queryParams.artId = '';
this.handleQuery();
},
//
getVersionOfCustom() {
get(`/admin/ap/custdemandverhead/selectuinquelist`).then(({ code, data }) => {
if (code === 200) {
this.getSpecifiedVersion = data
}
})
}, },
mounted() {
this.$nextTick(() => {
this.tableHeight = this.calculationTableHeight(
this.$refs.tableRef,
120
);
//
handleExport() {
for (let key in this.queryParams) {
if (this.queryParams[key] == '') {
this.queryParams[key] = undefined
}
}
get(`/admin/ap/custdemandverhead/selectdetailExcel`, {
...this.queryParams,
"customerId": this.queryParams.customerId ? this.queryParams.customerId.join(",") : undefined
}).then(res => {
let link = document.createElement('a');
link.style.display = 'none';
link.href = (process.env.VUE_APP_BASE_URL || "http://101.201.121.115:9003/") + res.data;
link.setAttribute('download', '预测版本.xlsx');
document.body.appendChild(link);
link.click();
}) })
}
};
},
},
created() {
this.getVersionOfCustom()
},
mounted() {
this.$nextTick(() => {
this.tableHeight = this.calculationTableHeight(
this.$refs.tableRef,
120
);
})
}
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.predict-version-wrapper {
height: 100%;
overflow: hidden;
}
.predict-version-wrapper {
height: 100%;
overflow: hidden;
}
</style> </style>

Loading…
Cancel
Save