This commit is contained in:
2025-04-27 09:16:42 +08:00
parent 3a40d2d3ee
commit 95ee4bcebf
13 changed files with 964 additions and 752 deletions

View File

@@ -5,31 +5,6 @@
`width: 100%; height: 100%; margin-top: ${!isNoSearch ? '-50px' : '0'}`
"
>
<!-- <el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
style="float: right"
>
<el-form-item>
<el-input
v-model="dataForm.key"
placeholder="商品名称"
clearable
size="small"
></el-input>
</el-form-item>
<el-form-item>
<el-button
@click="
pageIndex = 1;
getDataList(bookMarketId);
"
size="small"
>查询</el-button
>
</el-form-item>
</el-form> -->
<div class="search_form">
<div class="addFormBox shopFormBox">
<el-form ref="addForm" label-width="80px" :model="dataForm">
@@ -57,16 +32,16 @@
</div>
</div>
<div class="shop_box">
<div class="shop_box" v-loading="dataListLoading">
<!-- @selection-change="handleSelectionChange" -->
<el-table
v-if="!dataListLoading"
ref="table"
:height="`${isShowPagination?'calc(100% - 50px)':'100%'}`"
:height="`${isShowPagination ? 'calc(100% - 50px)' : '100%'}`"
:data="associatedGoodsList"
:row-key="getRowKeys"
border
size="mini"
v-loading="dataListLoading"
style="width: 100%"
>
<slot name="tableItem"></slot>
@@ -81,7 +56,8 @@
</el-table-column> -->
<!-- -->
<el-table-column v-if="!disableOperate"
<el-table-column
v-if="!disableOperate"
header-align="center"
align="center"
label="操作"
@@ -105,8 +81,9 @@
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top: 10px;"
v-if="isShowPagination"
<el-pagination
style="margin-top: 10px;"
v-if="isShowPagination && !dataListLoading"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="current"
@@ -162,7 +139,7 @@
</div>
</template>
<script>
<script>import axios from 'axios'
// import chooseBook from './chooseBook.vue'
// import AddOrUpdate from './shopproduct-add-or-update'
export default {
@@ -227,35 +204,94 @@ export default {
},
async activated() {
this.multipleSelection = [];
await this.getAssociatedGoodsList({ ...this.dataForm });
if (this.otherInfo.statisticsQuery) {
await this.statisticsQuery();
} else {
await this.getAssociatedGoodsList({ ...this.dataForm });
}
// await this.getGoodsTypeList();
},
methods: {
handleSizeChange(val) {
async handleExport() {
var filename = "downloaded_file.xlsx";
try {
this.$http({
url: this.$http.adornUrl(/master/userContribution/exportContributionStatQuery),
method: "post",
data: this.$http.adornData({
current: this.current,
limit: this.limit
},{
responseType: "blob" // 关键点:告诉 axios 返回的是二进制文件
})
}).then(res=>{
console.log('res at line 230:', res)
})
// const res = await axios.post(
// window.SITE_CONFIG.baseUrl+"/master/userContribution/exportContributionStatQuery",
// {
// current: this.current,
// limit: this.limit
// },
// {
// 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) {
console.error("文件下载失败:", err);
}
},
async handleSizeChange(val) {
this.limit = val;
this.getAssociatedGoodsList({ ...this.dataForm });
if (this.otherInfo.statisticsQuery) {
await this.statisticsQuery();
} else {
await this.getAssociatedGoodsList({ ...this.dataForm });
}
console.log(`每页 ${val}`);
},
handleCurrentChange(val) {
async handleCurrentChange(val) {
this.current = val;
this.getAssociatedGoodsList({ ...this.dataForm });
if (this.otherInfo.statisticsQuery) {
await this.statisticsQuery();
} else {
await this.getAssociatedGoodsList({ ...this.dataForm });
}
console.log(`当前页: ${val}`);
},
editHandleClose() {
this.editForm = {};
this.editVisible = false;
},
submitEdit() {
async submitEdit() {
this.$http({
url: this.$http.adornUrl(`${this.urlList.editCourse}`),
method: "post",
data: this.$http.adornData(this.editForm)
}).then(data => {
}).then(async data => {
this.$message.success("操作成功!");
this.editHandleClose();
this.getAssociatedGoodsList();
if (this.otherInfo.statisticsQuery) {
await this.statisticsQuery();
} else {
await this.getAssociatedGoodsList();
}
});
},
editCourse(row) {
console.log("row", row);
if (this.CustomEdit) {
@@ -369,8 +405,11 @@ export default {
// this.$refs.table.clearSelection();
// this.multipleSelection = [];
},
// 获取关联数据列表
async getAssociatedGoodsList() {
this.$emit("changeStatisticsQuery");
this.disableOperate = false;
console.log("🚀 ~ getAssociatedGoodsList ~ form:11111", form);
var form = { ...this.defaultForm, ...this.dataForm };
@@ -394,7 +433,7 @@ export default {
this.associatedGoodsList = [
...data[this.otherInfo.resultValueName].records
];
this.total = data.certificateList.total;
this.total = data[this.otherInfo.resultValueName].total;
console.log("this.total at line 392:", this.total);
this.$forceUpdate();
} else {
@@ -475,6 +514,47 @@ export default {
});
}
},
async statisticsQuery() {
this.disableOperate = true;
var form = { ...this.defaultForm, ...this.dataForm };
this.dataListLoading = true;
this.$http
.request({
url: this.$http.adornUrl(
`/master/userContribution/contributionStatQuery`
),
method: "POST",
data: {
current: this.current,
limit: this.limit,
tel: form.tel,
startTime: form.startTime ? form.startTime : ""
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(async ({ data }) => {
if (data && data.code === 0) {
if (this.otherInfo.resultValueName) {
this.associatedGoodsList = [
...data[this.otherInfo.resultValueName].records
];
this.total = data[this.otherInfo.resultValueName].total;
this.$forceUpdate();
} else {
this.associatedGoodsList = [...data.result.records];
this.total = data[result].total;
}
this.dataListLoading = false;
}
});
},
// 每页数
sizeChangeHandle(val) {
// this.changePageCoreRecordData();

View File

@@ -45,6 +45,7 @@
default-expand-all
:filter-node-method="filterNode"
ref="tree"
@node-click="handleNodeClick"
:expand-on-click-node="false"
>
@@ -75,7 +76,7 @@
type="text"
size="mini"
@click.stop="handleClickNodes(node, data, 'addChildren')"
v-if="data.isLast != 1"
v-if="data.isLast != 1&&!disableAddChild"
>
添加下级
</el-button>
@@ -88,7 +89,7 @@
</el-button> -->
<!-- v-if="node.childNodes.length == 0" -->
<el-button
<el-button v-if="!data.disabled"
type="text"
size="mini"
@click.stop="remove(data)"
@@ -114,7 +115,8 @@ export default {
"productId",
"sourceType",
"axiosType",
"axiosResultKey"
"axiosResultKey",
"disableAddChild",
],
data() {
return {