Commit a403acd2 by 前端

渗透报表

1 parent 3a7180a1
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-03-14 13:42:35
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-03-15 09:56:24
* @FilePath: \dj-car-life-system\src\api\permeation.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import request from "./request"
//获取所有主营品牌列表
export function brandList(data) {
data.method = "dj.api.smartcarlife.common.car.brand.list"
return request(data)
}
// 查询4s店列表
export function listShop4sByRef(data) {
data.method = "dj.api.scenemerchantref.listShop4sByRef"
return request(data)
}
//渗透率报表(分页)
export function permeabilityList(data) {
data.method = "dj.api.smarcarlife.permeability.report.page"
return request(data)
}
//渗透率报表导出
export function permeabilityExport(data) {
data.method = "dj.api.smartcarlife.permeability.report.exportAsync"
return request(data)
}
//渗透率报表填报明细列表(分页)
export function permeabilityDetail(data) {
data.method = "dj.api.smarcarlife.permeability.report.detail.page"
return request(data)
}
//渗透率报表详情导出
export function permeabilityDetailExport(data) {
data.method = "dj.api.smartcarlife.permeability.report.detail.exportAsync"
return request(data)
}
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
</div> </div>
<d2-table <d2-table
ref="recordTable" ref="recordTable"
:get-list-api="getListApi"
:table-data="tableData" :table-data="tableData"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
...@@ -50,32 +51,28 @@ ...@@ -50,32 +51,28 @@
<script> <script>
import { Util, deepClone } from "@/common/util" import { Util, deepClone } from "@/common/util"
import { permeabilityDetail } from "@/api/permeation.js"
import { mapActions, mapState } from "vuex" import { mapActions, mapState } from "vuex"
import { dfBalanceMonthStatListStatYear } from "@api/balanceStatistics" import dayjs from "dayjs"
import { rangePickerOptions_year_2023 } from "@/common/format"
export default { export default {
name: "DetailDialog", name: "DetailDialog",
components: {}, components: {},
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, getListApi: permeabilityDetail,
pickerOption: rangePickerOptions_year_2023,
countObj: {}, countObj: {},
searchForm: { searchForm: {},
statYear: "",
merchantId: ""
},
searchFormSearch: {}, searchFormSearch: {},
searchSelectObj: {}, searchSelectObj: {},
showFormData: [ showFormData: [
{ {
label: "员工姓名", label: "员工姓名",
name: "putStatus", name: "staffName",
type: "input" type: "input"
}, },
{ {
label: "填报日期", label: "填报日期",
name: "putStatus", name: "createdDate",
type: "datePicker" type: "datePicker"
} }
], ],
...@@ -89,15 +86,15 @@ export default { ...@@ -89,15 +86,15 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: "员工名称", label: "员工名称",
prop: "statMonth" prop: "staffName"
}, },
{ {
label: "填报交付数", label: "填报交付数",
prop: "statMonth" prop: "deliveryCount"
}, },
{ {
label: "填报时间", label: "填报时间",
prop: "statMonth" prop: "createdDate"
} }
] ]
}, },
...@@ -110,46 +107,62 @@ export default { ...@@ -110,46 +107,62 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
recordInfo: { merchantId: {
type: Object, type: String,
default: () => {} default: ""
} }
}, },
computed: {}, computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList
})
},
mounted() { mounted() {
const nowDate = new Date() this.searchForm.merchantId = this.merchantId
this.searchForm.statYear = nowDate.getFullYear().toString()
if (this.recordInfo) {
// this.searchForm.merchantId = this.recordInfo.merchantId
}
// this.getList()
}, },
methods: { methods: {
...mapActions({ ...mapActions("d2admin/user", ["actionSetDownloadList"]),
get: "d2admin/base/get",
close: "d2admin/page/close"
}),
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm) this.searchFormSearch = this.getParams()
resolve() resolve()
}) })
}, },
getParams() {
chooseYear() { this.searchFormSearch = deepClone(this.searchForm)
this.getList() if (this.searchFormSearch.createdDate) {
this.searchFormSearch.reportStartDate = dayjs(
this.searchFormSearch.createdDate[0]
).format("YYYY-MM-DD")
this.searchFormSearch.reportEndDate = dayjs(
this.searchFormSearch.createdDate[1]
).format("YYYY-MM-DD")
}
return this.searchFormSearch
}, },
handleExport() {
getList() { var params = this.getParams()
var params = deepClone(this.searchForm) params.method =
dfBalanceMonthStatListStatYear(params).then((res) => { "dj.api.smartcarlife.permeability.report.detail.exportAsync"
this.tableData = res const list = [
}) ...this.dowloadList,
{
name: "dowloadList",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime()
}
]
this.actionSetDownloadList({ list, type: "dowloadList" })
},
handleReset() {
this.searchForm = {
merchantId: this.merchantId
}
this.$refs.recordTable.refreshTable()
}, },
handleClose() { handleClose() {
this.$emit("dialogClose") this.$emit("dialogClose")
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
:form-data="showFormData" :form-data="showFormData"
/> />
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary"> <el-button size="small" type="primary" @click="handleSearch">
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button> <el-button size="small" @click="handleReset"> 重置 </el-button>
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
<div class="date-container"> <div class="date-container">
<el-radio-group v-model="totalType" type="info" size="mini"> <el-radio-group v-model="totalType" type="info" size="mini">
<el-radio-button label="today"> 今日 </el-radio-button> <el-radio-button label="today"> 今日 </el-radio-button>
<el-radio-button label="thisWeek"> 本周 </el-radio-button> <el-radio-button label="Week"> 本周 </el-radio-button>
<el-radio-button label="thisMonth"> 本月 </el-radio-button> <el-radio-button label="Month"> 本月 </el-radio-button>
</el-radio-group> </el-radio-group>
<el-date-picker <el-date-picker
size="mini" size="mini"
...@@ -31,22 +31,30 @@ ...@@ -31,22 +31,30 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
/> />
<el-button
size="small"
class="default-blue-btn"
type="primary"
@click="handleExport"
>导出</el-button
>
</div> </div>
<d2-table <d2-table
:hasNum="false" :hasNum="false"
:array-span-method="arraySpanMethod" :array-span-method="arraySpanMethod"
ref="recordTable"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:before-search-fn="beforeSearchFn" ref="table"
@refreshTable="handleSearch"
:table-data="tableData"
:table-total="tableTotal"
> >
<div slot="empName" slot-scope="scope">{{ scope.scope.id }}</div> <div slot="empName" slot-scope="scope">{{ scope.scope.id }}</div>
<div slot="newCar" slot-scope="scope"> <div slot="newCar" slot-scope="scope">
<span @click="showDialog(scope.scope)">{{ scope.scope.id }}</span> <span @click="showDialog(scope.scope)">{{
scope.scope.deliveryCount || "--"
}}</span>
</div> </div>
<auth-button <auth-button
...@@ -60,7 +68,7 @@ ...@@ -60,7 +68,7 @@
<!-- 查看 --> <!-- 查看 -->
<car-dialog <car-dialog
:detail-visible="detailVisible" :detail-visible="detailVisible"
:record-info="recordInfo" :merchantId="merchantId"
v-if="detailVisible" v-if="detailVisible"
@dialogClose="dialogClose" @dialogClose="dialogClose"
/> />
...@@ -69,10 +77,14 @@ ...@@ -69,10 +77,14 @@
<script> <script>
import { Util, deepClone } from "@/common/util" import { Util, deepClone } from "@/common/util"
import { mapActions, mapState } from "vuex"
import dayjs from "dayjs"
import { import {
purchaseOrderDeliveryPage, permeabilityList,
purchaseOrderDeliveryWithdraw brandList,
} from "@/api/purchaseShopping.js" permeabilityExport,
listShop4sByRef
} from "@/api/permeation.js"
import carDialog from "./components/carDialog" import carDialog from "./components/carDialog"
const isSelect = [ const isSelect = [
{ label: "是", value: 1 }, { label: "是", value: 1 },
...@@ -84,58 +96,53 @@ export default { ...@@ -84,58 +96,53 @@ export default {
}, },
data() { data() {
return { return {
searchForm: { searchForm: {},
deliveryNumber: "", merchantId: "",
deliveryCompany: "", tableTotal: 0,
deliveryDate: "", totalType: "today",
orderCode: this.$route.params.orderCode || "",
merchantName: "",
putStatus: ""
},
totalType: "",
dateValue: "", dateValue: "",
searchFormSearch: {}, searchFormSearch: {},
showFormData: [ showFormData: [
{ {
label: "门店", label: "门店",
name: "putStatus", name: "merchantNameList",
type: "select", type: "select",
multiple: true, multiple: true,
optionList: [], optionList: [],
optionId: "confId", optionId: "merchantId",
optionLabel: "confName", optionLabel: "merchantName",
optionsName: "isSelect" optionsName: "merchantName"
}, },
{ {
label: "商户号", label: "商户号",
name: "putStatus", name: "merchantIdList",
type: "select", type: "select",
multiple: true, multiple: true,
optionList: [], optionList: [],
optionId: "confId", optionId: "merchantId",
optionLabel: "confName", optionLabel: "merchantId",
optionsName: "isSelect" optionsName: "merchantId"
}, },
{ {
label: "主营品牌", label: "主营品牌",
name: "putStatus", name: "brandIdList",
type: "select", type: "select",
multiple: true, multiple: true,
optionList: [], optionList: [],
optionId: "value", optionId: "id",
optionLabel: "label", optionLabel: "label",
optionsName: "isSelect" optionsName: "brandIdList"
}, },
{ {
label: "是否选择出单账号", label: "是否选择出单账号",
name: "putStatus", name: "staffType",
type: "select", type: "select",
optionList: isSelect, optionList: isSelect,
optionId: "value", optionId: "value",
optionLabel: "label" optionLabel: "label"
} }
], ],
getListApi: purchaseOrderDeliveryPage, tableData: [],
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list", listName: "list",
...@@ -143,117 +150,233 @@ export default { ...@@ -143,117 +150,233 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: "门店名称", label: "门店名称",
prop: "deliveryNumber", prop: "merchantName",
width: "200px" width: "200px"
}, },
{ {
label: "商户号", label: "商户号",
prop: "deliveryCompany", prop: "merchantId",
width: "150px" width: "150px"
}, },
{ {
label: "日期", label: "日期",
prop: "deliveryDate", prop: "dateRange",
width: "150px", width: "150px"
formatter: (cellValue) => {
return cellValue.deliveryDate
? Util.dateFormate(
cellValue.deliveryDate,
"YYYY-MM-DD HH:mm:ss"
)
: ""
}
}, },
{ {
label: "员工姓名", label: "员工姓名",
prop: "orderCode", prop: "staffName",
width: "100px", width: "100px"
addHtml: "empName"
}, },
{ {
label: "新车交付数", label: "新车交付数",
prop: "merchantName", prop: "deliveryCount",
width: "100px", width: "100px",
addHtml: "newCar" addHtml: "newCar"
}, },
{ {
label: "新车到店流量(会员权益/延保)", label: "新车到店流量(会员权益/延保)",
prop: "merchantName" prop: "equityToShopCount",
formatter: (cellValue) => {
return cellValue.equityToShopCount
? cellValue.equityToShopCount
: "-"
}
}, },
{ {
label: "售后到店流量(会员权益/延保)", label: "售后到店流量(会员权益/延保)",
prop: "merchantName" prop: "afterSaleEquityToShopCount",
formatter: (cellValue) => {
return cellValue.afterSaleEquityToShopCount
? cellValue.afterSaleEquityToShopCount
: "-"
}
}, },
{ {
label: "成交量(会员权益)", label: "成交量(会员权益)",
prop: "merchantName" prop: "equityCount",
formatter: (cellValue) => {
return cellValue.equityCount ? cellValue.equityCount : "-"
}
}, },
{ {
label: "成交量(延保)", label: "成交量(延保)",
prop: "merchantName", prop: "warrantyInsuranceCount",
width: "150px" width: "150px",
formatter: (cellValue) => {
return cellValue.warrantyInsuranceCount
? cellValue.warrantyInsuranceCount
: "-"
}
}, },
{ {
label: "转化率(会员权益/延保)", label: "转化率(会员权益/延保)",
prop: "merchantName", prop: "upgradeRate",
width: "150px" width: "150px",
formatter: (cellValue) => {
return cellValue.upgradeRate ? cellValue.upgradeRate : "-"
}
} }
] ]
}, },
baseData: { baseData: {
isSelect isSelect
}, },
page: {
pageNum: 1,
pageSize: 10
},
detailVisible: false, detailVisible: false,
recordInfo: null recordInfo: null
} }
}, },
mounted() { mounted() {
this.getBaseData() // this.getBaseData()
this.getList()
this.getBrandList()
this.getShop4sByRef()
},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList
})
},
watch: {
totalType(val) {
if (!val) return
console.log(val)
this.dateValue = ""
this.handleSearch()
},
dateValue(val) {
if (!val) return
this.totalType = ""
this.handleSearch()
}
}, },
methods: { methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]),
getList() {
this.$nextTick(() => {
let params = this.getPramms(),
page = this.$refs.table ? this.$refs.table.page : this.page
params = {
...page,
...params
}
permeabilityList(params).then((res) => {
this.tableData = []
const list = res.list
list.forEach((i) => {
i.staffList.forEach((j) => {
this.tableData.push({ ...i, ...j, count: i.staffList.length })
})
})
console.log(this.tableData)
this.tableTotal = res.total
})
})
},
async getBaseData() { async getBaseData() {
this.getOptionsList() this.getOptionsList()
}, },
getShop4sByRef() {
listShop4sByRef({ sceneList: [0, 1] }).then((res) => {
this.addOptions("merchantId", res)
this.addOptions("merchantName", res)
})
},
addOptions(name, optionList) {
const findData = this.showFormData.find(
(item) => item.optionsName == name
)
if (findData) findData.optionList = optionList
},
getBrandList() {
brandList({}).then((res) => {
this.addOptions("brandIdList", res)
})
},
showDialog(row) { showDialog(row) {
this.recordInfo = row this.merchantId = row.merchantId
this.detailVisible = true this.detailVisible = true
}, },
//合并表格列 //合并表格列
// arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// if ([0, 1, 2].includes(columnIndex)) {
// if (rowIndex % row.count === 0) {
// return [row.count, 1]
// } else {
// return [0, 0]
// }
// }
// },
arraySpanMethod({ row, column, rowIndex, columnIndex }) { arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if ([0, 1, 2].includes(columnIndex)) { // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
if (rowIndex % 5 === 0) { let mergeLength = 3 //需要进行横纵合并的列
return { if (columnIndex < mergeLength) {
rowspan: 5, let finArray = [1, 1]
colspan: 1 // 处理行数据
// console.log(cgname);
if (
rowIndex === 0 ||
row.merchantId !== this.tableData[rowIndex - 1].merchantId
) {
let rowspan = 1
//计算需要进行合并操作的行
for (let i = 0; i < this.tableData.length - 1; i++) {
// 只合并连续的
if (
this.tableData[i].merchantId === row.merchantId &&
this.tableData[i + 1].merchantId === row.merchantId
) {
rowspan++
}
} }
finArray[0] = rowspan
} else { } else {
return { finArray[0] = 0
rowspan: 0,
colspan: 0
}
} }
return finArray
}
},
getPramms() {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.deliveryDate) {
this.searchFormSearch.deliveryDateStart = Util.dateFormate(
this.searchFormSearch.deliveryDate[0],
"YYYY-MM-DD 00:00:00"
)
this.searchFormSearch.deliveryDateEnd = Util.dateFormate(
this.searchFormSearch.deliveryDate[1],
"YYYY-MM-DD 23:59:59"
)
delete this.searchFormSearch.deliveryDate
}
if (this.totalType) {
this.searchFormSearch.startDate = dayjs()
.startOf(this.totalType)
.format("YYYY-MM-DD")
this.searchFormSearch.endDate = dayjs()
.endOf(this.totalType)
.format("YYYY-MM-DD")
} }
if (this.dateValue) {
this.searchFormSearch.startDate = dayjs(this.dateValue[0])
.startOf(this.totalType)
.format("YYYY-MM-DD")
this.searchFormSearch.endDate = dayjs(this.dateValue[1])
.endOf(this.totalType)
.format("YYYY-MM-DD")
}
return this.searchFormSearch
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm) this.searchFormSearch = this.getPramms()
if (this.searchFormSearch.deliveryDate) {
this.searchFormSearch.deliveryDateStart = Util.dateFormate(
this.searchFormSearch.deliveryDate[0],
"YYYY-MM-DD 00:00:00"
)
this.searchFormSearch.deliveryDateEnd = Util.dateFormate(
this.searchFormSearch.deliveryDate[1],
"YYYY-MM-DD 23:59:59"
)
delete this.searchFormSearch.deliveryDate
}
resolve() resolve()
}) })
}, },
// getOptionsList() { // getOptionsList() {
// this.showFormData.forEach((item, index) => { // this.showFormData.forEach((item, index) => {
// if (item.type === "select") { // if (item.type === "select") {
...@@ -279,27 +402,25 @@ export default { ...@@ -279,27 +402,25 @@ export default {
// }, // },
handleSearch() { handleSearch() {
this.$refs.recordTable.refreshTable() this.getList()
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {}
deliveryNumber: "", this.getList()
deliveryCompany: "",
deliveryDate: "",
orderCode: "",
merchantName: "",
putStatus: ""
}
this.$refs.recordTable.refreshTable()
}, },
handleExport() { handleExport() {
var params = this.searchFormSearch var params = this.searchFormSearch
params.method = "dj.api.smarcarlife.purchaseOrder.delivery.export.async" for (let k in params) {
if (params[k].length == 0) {
delete params[k]
}
}
params.method = "dj.api.smartcarlife.permeability.report.exportAsync"
const list = [ const list = [
...this.dowloadList, ...this.dowloadList,
{ {
name: "发货单", name: "dowloadList",
exportParam: JSON.stringify(params), exportParam: JSON.stringify(params),
status: "waiting", status: "waiting",
timeid: new Date().getTime() timeid: new Date().getTime()
...@@ -353,6 +474,10 @@ export default { ...@@ -353,6 +474,10 @@ export default {
} }
.date-container { .date-container {
margin-bottom: 10px; margin-bottom: 10px;
display: flex;
.default-blue-btn {
margin-left: auto;
}
::v-deep { ::v-deep {
.el-date-editor { .el-date-editor {
margin-left: 10px; margin-left: 10px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!