123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <template>
- <div>
- <ex-table
- v-loading="loading"
- :table="table"
- :data="tableData"
- :columns="table19"
- :page="pageInfo"
- :size="size"
- @page-curr-change="handlePageChange"
- @page-size-change="handleSizeChange"
- @screen-reset="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- @screen-submit="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- @selection="selection_change"
- >
- <template #table-header="{}">
- <div style="width: 100%">
- <el-row style="padding: 0 0 0 80px">
-
- <el-col :span="6" style="width: 463px;">
- <periodDatePickerActive
- :start="parmValue.start_date"
- :end="parmValue.end_date"
- :placeholder="'产品下线'"
- :width="'205px'"
- :size="searchSize"
- @timeReturned="time"
- />
- </el-col>
- <el-col :span="4" style="width: 66px; float: right">
- <el-button type="primary" style="margin-left:30px;" @click="download" :size="searchSize" class="fr">
- 导出
- </el-button>
- </el-col>
- <el-col :span="3" style="width: 66px; float: right">
- <el-button
- :size="searchSize"
- type="primary"
- style="float: right; margin-left: 5px"
- @click="searchList"
- >
- 刷新
- </el-button>
- </el-col>
-
- </el-row>
- <el-row style="padding: 10px 0 0 0" gutter="10">
- <el-col :span="6" style="width: 240px">
- <el-input
- clearable
- placeholder="采购维护人"
- v-model="parmValue.creater"
- maxlength="40"
- :size="searchSize"
- @blur="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- >
- </el-input>
- </el-col>
- <el-col :span="6" style="width: 240px">
- <el-input
- clearable
- placeholder="供应商名称"
- v-model="parmValue.supplier_name"
- maxlength="40"
- :size="searchSize"
- @blur="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- >
- </el-input>
- </el-col>
- <el-col :span="4" style="width: 66px; float: right">
- <el-button
- type="warning"
- class="fr"
- :size="searchSize"
- @click="restSearch"
- >
- 重置
- </el-button>
- </el-col>
- </el-row>
- </div>
- </template>
-
- </ex-table>
- </div>
-
- </template>
- <script>
- import mixinPage from "@/mixins/elPaginationHandle";
- import resToken from "@/mixins/resToken";
- import urlConfig from "@/apis/url-config";
- import asyncRequest from "@/apis/service/reportQuery/saleReport";
- import periodDatePickerActive from "../period-date-picker/main.vue";
- import { table19} from "./columns";
- import { mapGetters } from "vuex";
- export default {
- name: "purchaseOrder",
- mixins: [mixinPage, resToken],
- components: {
- periodDatePickerActive
- },
- computed: {
- ...mapGetters(["tablebtnSize", "searchSize", "size"]),
-
- },
- data() {
- return {
-
- changeList: [],
-
- fileUrl: urlConfig.baseURL,
-
- loading: false,
-
- parmValue: {
- supplier_name:"",
- creater:"",
- start_date: "",
- end_date: "",
- page: 1,
- size: 15,
-
- },
-
- tableData: [],
-
- table: {
- stripe: true,
- border: true,
- _defaultHeader_: ["setcol"],
- },
-
- pageInfo: {
- size: 15,
- curr: 1,
- total: 0,
- },
-
- table19: table19,
- };
- },
- mounted() {
- this.searchList();
- },
- methods: {
-
- async searchList() {
- if (
- (this.parmValue.start_date !== "" && this.parmValue.end_date === "") ||
- (this.parmValue.start_date === "" && this.parmValue.end_date !== "")
- ) {
- this.$message.warning("时间区间不完整!");
- return;
- }
-
- this.loading = true;
-
- const res = await asyncRequest.reportgoodofflinelist(this.parmValue);
- if (res && res.code === 0 && res.data) {
- this.tableData = res.data.list;
- this.pageInfo.total = Number(res.data.count);
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.tableData = [];
- this.pageInfo.total = 0;
- }
- this.loading = false;
- },
-
-
- restSearch() {
- this.parmValue = {
- supplier_name:"",
- creater:"",
- start_date: "",
- end_date: "",
- page: 1,
- size: 15,
- };
-
- this.pageInfo = {
- size: 15,
- curr: 1,
- total: 0,
- };
- this.searchList();
- },
-
-
- async time(e) {
- this.parmValue.start_date = e.startTime || "";
- this.parmValue.end_date = e.endTime || "";
- if (
- (this.parmValue.start_date !== "" && this.parmValue.end_date === "") ||
- (this.parmValue.start_date === "" && this.parmValue.end_date !== "")
- ) {
- this.$message.warning("时间区间不完整!");
- return;
- }
- this.pageInfo.curr = 1;
- this.parmValue.page = 1;
- await this.searchList();
- },
-
- selection_change(e) {
- const { list } = e;
-
- this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
- },
-
- async download() {
-
-
-
-
- let start_date = new Date(this.parmValue.start_date).valueOf();
- let end_date = new Date(this.parmValue.end_date).valueOf();
- let flag = end_date - start_date > 30 * 24 * 60 * 60 * 1000;
- if(this.parmValue.start_date != "" && this.parmValue.end_date != ""){
- if(flag){
- this.$message.warning("导出文件的时间区间不能超过30天")
- return;
- }
- }else{
- this.$message.warning("请选择导出文件的时间区间")
- return;
- }
- let model = JSON.parse(JSON.stringify(this.parmValue))
-
- if (!this.loading) {
- this.loading = true;
- let httpType = `aplication/zip`;
- axios({
- method: "post",
- url: this.fileUrl + "admin/reportgoodofflineexport",
- responseType: "blob",
- data: model,
- headers: {
-
-
- Accept: httpType,
- },
- })
- .then((res) => {
-
-
-
- if (res && res.status == 200 && res.data) {
- let url = window.URL.createObjectURL(
- new Blob([res.data], {
-
- type: httpType
- })
- );
- let link = document.createElement("a");
- link.style.display = "none";
- link.href = url;
- let excelName = "产品下线报表.zip";
- link.setAttribute("download", excelName);
- document.body.appendChild(link);
- link.click();
- link.remove();
- window.URL.revokeObjectURL(url);
- this.$message.success(`导出成功!`);
- setTimeout(() => {
- this.loading = false;
- }, 500);
- } else {
- this.$message.error(res.data.message);
- setTimeout(() => {
- this.loading = false;
- }, 500);
- }
- })
- .catch((error) => {
- console.log(error);
- this.loading = false;
- });
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .purchaseOrder {
- // text-align: right;
- }
- </style>
-
|