Commit 06758090 authored by shangtx's avatar shangtx

feat(工时列表): 添加导出功能

parent 8d2b166b
......@@ -28,3 +28,16 @@ export function getAuxiliaryInfo(month) {
method: 'get'
});
}
/*
* 导出工时表
*/
export function exportExcel(parameter) {
return axios({
responseType: 'blob',
headers: {'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},
url: `${baseUrl.taskEstimate}/export`,
method: 'post',
data: parameter,
})
}
\ No newline at end of file
......@@ -71,6 +71,9 @@
</span>
<div class="cust-table-operator">
<a-button-group>
<a-button type="primary" @click="exportExcel" ghost>
导出
</a-button>
<a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-button-group>
......@@ -98,7 +101,7 @@
</template>
<script>
import { getPage, getAuxiliaryInfo } from "@/api/task/task";
import { getPage, getAuxiliaryInfo, exportExcel } from "@/api/task/task";
import { getSelectableProjects } from "@/api/project/project";
import { humpToLine, setOrder } from "@/util/util";
import moment from "moment";
......@@ -291,6 +294,14 @@ export default {
// 重新计算当月天数
this.dayOfTheMonth = date.daysInMonth();
},
exportExcel() {
exportExcel(this.query).then((response) => {
let fileDownload = require("js-file-download");
fileDownload(response.data, `${this.query.month}${
this.query.projectId? this.projectOptions.filter(p => p.value == this.query.projectId)[0].title : ''}工时明细.xlsx`);
this.loading = false;
});
},
},
mounted() {
getSelectableProjects().then(({ data }) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment