Merge branch 'dev' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into dwb

This commit is contained in:
duan
2024-08-17 16:06:06 +08:00
6 changed files with 315 additions and 230 deletions

View File

@@ -13,7 +13,8 @@
<el-radio-button label="custom">自定义</el-radio-button>
</el-radio-group>
<el-date-picker v-model="query.createdAt" type="daterange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']" value-format="yyyyMMdd">
end-placeholder="结束日期" :clearable="false" :default-time="['00:00:00', '23:59:59']"
value-format="yyyyMMdd">
</el-date-picker>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
@@ -49,9 +50,10 @@
</div>
</template>
</el-table-column>
<el-table-column label="">
<el-table-column label="" width='120px'>
<template v-slot="scope">
<el-button type="primary" @click="clicksee(scope.row)">查看</el-button>
<el-button type="text" @click="clicksee(scope.row)">查看</el-button>
<el-button type="text" @click="clickexport(scope.row)">导出</el-button>
</template>
</el-table-column>
</el-table>
@@ -62,9 +64,9 @@
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<el-dialog title="商品销量" :visible.sync="dialogshow">
<el-table :data="tableDatainfo.data" style="width: 100%">
<el-table-column prop="productName" label="商品名称"/>
<el-table-column prop="num" label="数量"/>
<el-table :data="tableDatainfo.data" style="width: 100%;height: 500px;overflow: auto;">
<el-table-column prop="productName" label="商品名称" />
<el-table-column prop="num" label="数量" />
<el-table-column prop="amount" label="金额" />
</el-table>
</el-dialog>
@@ -73,6 +75,7 @@
<script>
import { tbHandoverGet } from '@/api/homes/record.js'
import XLSX from 'xlsx';
import dayjs from "dayjs";
export default {
data() {
@@ -239,8 +242,23 @@ export default {
// 查看
clicksee(e) {
this.dialogshow = true
console.log(JSON.parse(e.productInfos))
// console.log(JSON.parse(e.productInfos))
this.tableDatainfo.data = JSON.parse(e.productInfos)
},
clickexport(e) {
const arr = JSON.parse(e.productInfos)
let data = [
['商品名称', '数量', '金额'],
]
arr.forEach(element => {
data.push([element.productName, element.num, element.amount])
});
const ws = XLSX.utils.aoa_to_sheet(data);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, 'data.xlsx');
}
}
};