提交统计查询

This commit is contained in:
2025-04-28 10:43:28 +08:00
parent 95ee4bcebf
commit 13bd58a932
2 changed files with 91 additions and 42 deletions

View File

@@ -21,9 +21,7 @@
label-width="20px" label-width="20px"
style="width: 80px !important" style="width: 80px !important"
> >
<el-button @click="getAssociatedGoodsList(dataForm)" size="mini" <el-button @click="search()" size="mini">查询</el-button>
>查询</el-button
>
<!-- <el-button @click="handleCommonShopReset()" size="mini" <!-- <el-button @click="handleCommonShopReset()" size="mini"
>重置</el-button >重置</el-button
> --> > -->
@@ -87,7 +85,7 @@
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="current" :current-page="current"
:page-sizes="[50, 100, 200]" :page-sizes="pageSizes ? pageSizes : [50, 100, 200]"
:page-size="limit" :page-size="limit"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total" :total="total"
@@ -139,7 +137,8 @@
</div> </div>
</template> </template>
<script>import axios from 'axios' <script>
import axios from "axios";
// import chooseBook from './chooseBook.vue' // import chooseBook from './chooseBook.vue'
// import AddOrUpdate from './shopproduct-add-or-update' // import AddOrUpdate from './shopproduct-add-or-update'
export default { export default {
@@ -156,7 +155,8 @@ export default {
"isShowPagination", "isShowPagination",
"axiosType", "axiosType",
"otherInfo", "otherInfo",
"CustomEdit" "CustomEdit",
"pageSizes"
], ],
data() { data() {
return { return {
@@ -212,25 +212,77 @@ export default {
// await this.getGoodsTypeList(); // await this.getGoodsTypeList();
}, },
methods: { async mounted() {
async handleExport() { this.current = 1;
var filename = "downloaded_file.xlsx"; this.limit = 50;
this.multipleSelection = [];
if (this.otherInfo.statisticsQuery) {
await this.statisticsQuery();
} else {
await this.getAssociatedGoodsList({ ...this.dataForm });
}
// await this.getGoodsTypeList();
},
methods: {
search() {
this.current = 1;
this.limit = 50;
this.getAssociatedGoodsList(this.dataForm);
},
getNowTimestamp() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0");
const day = String(now.getDate()).padStart(2, "0");
const hour = String(now.getHours()).padStart(2, "0");
const minute = String(now.getMinutes()).padStart(2, "0");
const second = String(now.getSeconds()).padStart(2, "0");
return `${year}${month}${day}${hour}${minute}${second}`;
},
async handleExport() {
var filename = `湖分统计下载文件_${this.getNowTimestamp()}.xlsx`;
this.$message({
message: "湖分统计查询中,查询成功后文件会自动下载,请耐心等待...",
type: "info",
duration: 6000,
showClose: true
});
try { try {
this.$http({ this.$http({
url: this.$http.adornUrl(/master/userContribution/exportContributionStatQuery), url: this.$http.adornUrl(
"/master/userContribution/exportContributionStatQuery"
),
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
current: this.current, current: "1",
limit: this.limit limit: "99999"
},{ }),
responseType: "blob" // ⚡⚡⚡一定要加上
}).then(res => {
this.$message({
message: "湖分统计文件下载中,下载完成后文件会自动下载,请耐心等待...",
type: "info",
duration: 6000,
showClose: true
});
const blob = new Blob([res.data], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
});
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
link.click();
responseType: "blob" // 关键点:告诉 axios 返回的是二进制文件 window.URL.revokeObjectURL(link.href); // 释放内存
}) this.$message({
}).then(res=>{ message: "湖分统计文件下载完成,请注意查看!",
console.log('res at line 230:', res) type: "success",
duration: 3000,
}) showClose: true
});
});
// const res = await axios.post( // const res = await axios.post(
// window.SITE_CONFIG.baseUrl+"/master/userContribution/exportContributionStatQuery", // window.SITE_CONFIG.baseUrl+"/master/userContribution/exportContributionStatQuery",
// { // {
@@ -242,16 +294,9 @@ export default {
// responseType: "blob" // 关键点:告诉 axios 返回的是二进制文件 // responseType: "blob" // 关键点:告诉 axios 返回的是二进制文件
// } // }
// ); // );
const blob = new Blob([res.data]);
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
link.click();
window.URL.revokeObjectURL(link.href); // 释放内存
} catch (err) { } catch (err) {
console.error("文件下载失败", err); this.$message.error("文件下载失败!");
// console.error("文件下载失败:", err);
} }
}, },
async handleSizeChange(val) { async handleSizeChange(val) {
@@ -402,6 +447,10 @@ export default {
}); });
}, },
clear() { clear() {
this.limit = 50;
this.current = 1;
this.dataForm = {};
this.$forceUpdate();
// this.$refs.table.clearSelection(); // this.$refs.table.clearSelection();
// this.multipleSelection = []; // this.multipleSelection = [];
}, },

View File

@@ -91,6 +91,7 @@
type: currentNode.data ? currentNode.data.dictType : '', type: currentNode.data ? currentNode.data.dictType : '',
labelId: addForm.id labelId: addForm.id
}" }"
:pageSizes="[50, 100, 200, 300, 500, 1000]"
axiosType="raw" axiosType="raw"
getAssociatedGoodsListKey="id" getAssociatedGoodsListKey="id"
:isNoPaging="true" :isNoPaging="true"
@@ -326,7 +327,10 @@
v-if="currentNode && currentNode.data.isLast == 1" v-if="currentNode && currentNode.data.isLast == 1"
></div> --> ></div> -->
</div> </div>
<div class="submitButton submitButtonBox"> <div
class="submitButton submitButtonBox"
v-if="!currentNode.data.disabled"
>
<el-button <el-button
type="primary" type="primary"
@click="dataFormSubmit('addForm')" @click="dataFormSubmit('addForm')"
@@ -644,14 +648,13 @@ export default {
await this.getDataList(); await this.getDataList();
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.commonTree.setCurrentNodeShow("all"); this.$refs.commonTree.setCurrentNodeShow("all");
setTimeout(() => {
this.$refs.commonShop.getDataList();
}, 3000);
}); });
}, },
async created() { async created() {
this.isEdit = false; this.isEdit = false;
await this.getDataList(); await this.getDataList();
},
async mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.commonTree.setCurrentNodeShow("all"); this.$refs.commonTree.setCurrentNodeShow("all");
}); });
@@ -690,8 +693,11 @@ export default {
}); });
}, },
handleStatisticsQuery() { handleStatisticsQuery() {
this.statisticsQuery = true; this.statisticsQuery = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.commonShop.current=1;
this.$refs.commonShop.limit=50;
this.$refs.commonShop.statisticsQuery(); this.$refs.commonShop.statisticsQuery();
}); });
}, },
@@ -1062,17 +1068,11 @@ export default {
this.isFresh = true; this.isFresh = true;
}, },
handleClickNodes(node, data, type) { handleClickNodes(node, data, type) {
console.log("node at line 878:", node, data, type);
this.isEdit = false; this.isEdit = false;
this.addForm = {}; this.addForm = {};
// console.log(this.$refs.tree.handleClickNodes(), "当前选中节点");
console.log(node, data, "当前选中节点");
this.currentNode = node ? node : {}; this.currentNode = node ? node : {};
this.isFresh = false; this.isFresh = false;
this.isFresh = true; this.isFresh = true;
var form = {}; var form = {};
switch (type) { switch (type) {
case "add": case "add":