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 @@
</div>
<d2-table
ref="recordTable"
:get-list-api="getListApi"
:table-data="tableData"
:search-form="searchFormSearch"
:table-params="tableParams"
......@@ -50,32 +51,28 @@
<script>
import { Util, deepClone } from "@/common/util"
import { permeabilityDetail } from "@/api/permeation.js"
import { mapActions, mapState } from "vuex"
import { dfBalanceMonthStatListStatYear } from "@api/balanceStatistics"
import { rangePickerOptions_year_2023 } from "@/common/format"
import dayjs from "dayjs"
export default {
name: "DetailDialog",
components: {},
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
pickerOption: rangePickerOptions_year_2023,
getListApi: permeabilityDetail,
countObj: {},
searchForm: {
statYear: "",
merchantId: ""
},
searchForm: {},
searchFormSearch: {},
searchSelectObj: {},
showFormData: [
{
label: "员工姓名",
name: "putStatus",
name: "staffName",
type: "input"
},
{
label: "填报日期",
name: "putStatus",
name: "createdDate",
type: "datePicker"
}
],
......@@ -89,15 +86,15 @@ export default {
tableColumns: [
{
label: "员工名称",
prop: "statMonth"
prop: "staffName"
},
{
label: "填报交付数",
prop: "statMonth"
prop: "deliveryCount"
},
{
label: "填报时间",
prop: "statMonth"
prop: "createdDate"
}
]
},
......@@ -110,46 +107,62 @@ export default {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => {}
merchantId: {
type: String,
default: ""
}
},
computed: {},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList
})
},
mounted() {
const nowDate = new Date()
this.searchForm.statYear = nowDate.getFullYear().toString()
if (this.recordInfo) {
// this.searchForm.merchantId = this.recordInfo.merchantId
}
// this.getList()
this.searchForm.merchantId = this.merchantId
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close"
}),
...mapActions("d2admin/user", ["actionSetDownloadList"]),
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm)
this.searchFormSearch = this.getParams()
resolve()
})
},
chooseYear() {
this.getList()
getParams() {
this.searchFormSearch = deepClone(this.searchForm)
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
},
getList() {
var params = deepClone(this.searchForm)
dfBalanceMonthStatListStatYear(params).then((res) => {
this.tableData = res
})
handleExport() {
var params = this.getParams()
params.method =
"dj.api.smartcarlife.permeability.report.detail.exportAsync"
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() {
this.$emit("dialogClose")
}
......
......@@ -11,7 +11,7 @@
:form-data="showFormData"
/>
<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 size="small" @click="handleReset"> 重置 </el-button>
......@@ -21,8 +21,8 @@
<div class="date-container">
<el-radio-group v-model="totalType" type="info" size="mini">
<el-radio-button label="today"> 今日 </el-radio-button>
<el-radio-button label="thisWeek"> 本周 </el-radio-button>
<el-radio-button label="thisMonth"> 本月 </el-radio-button>
<el-radio-button label="Week"> 本周 </el-radio-button>
<el-radio-button label="Month"> 本月 </el-radio-button>
</el-radio-group>
<el-date-picker
size="mini"
......@@ -31,22 +31,30 @@
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd"
/>
<el-button
size="small"
class="default-blue-btn"
type="primary"
@click="handleExport"
>导出</el-button
>
</div>
<d2-table
:hasNum="false"
:array-span-method="arraySpanMethod"
ref="recordTable"
:get-list-api="getListApi"
:search-form="searchFormSearch"
: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="newCar" slot-scope="scope">
<span @click="showDialog(scope.scope)">{{ scope.scope.id }}</span>
<span @click="showDialog(scope.scope)">{{
scope.scope.deliveryCount || "--"
}}</span>
</div>
<auth-button
......@@ -60,7 +68,7 @@
<!-- 查看 -->
<car-dialog
:detail-visible="detailVisible"
:record-info="recordInfo"
:merchantId="merchantId"
v-if="detailVisible"
@dialogClose="dialogClose"
/>
......@@ -69,10 +77,14 @@
<script>
import { Util, deepClone } from "@/common/util"
import { mapActions, mapState } from "vuex"
import dayjs from "dayjs"
import {
purchaseOrderDeliveryPage,
purchaseOrderDeliveryWithdraw
} from "@/api/purchaseShopping.js"
permeabilityList,
brandList,
permeabilityExport,
listShop4sByRef
} from "@/api/permeation.js"
import carDialog from "./components/carDialog"
const isSelect = [
{ label: "是", value: 1 },
......@@ -84,58 +96,53 @@ export default {
},
data() {
return {
searchForm: {
deliveryNumber: "",
deliveryCompany: "",
deliveryDate: "",
orderCode: this.$route.params.orderCode || "",
merchantName: "",
putStatus: ""
},
totalType: "",
searchForm: {},
merchantId: "",
tableTotal: 0,
totalType: "today",
dateValue: "",
searchFormSearch: {},
showFormData: [
{
label: "门店",
name: "putStatus",
name: "merchantNameList",
type: "select",
multiple: true,
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "isSelect"
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "merchantName"
},
{
label: "商户号",
name: "putStatus",
name: "merchantIdList",
type: "select",
multiple: true,
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "isSelect"
optionId: "merchantId",
optionLabel: "merchantId",
optionsName: "merchantId"
},
{
label: "主营品牌",
name: "putStatus",
name: "brandIdList",
type: "select",
multiple: true,
optionList: [],
optionId: "value",
optionId: "id",
optionLabel: "label",
optionsName: "isSelect"
optionsName: "brandIdList"
},
{
label: "是否选择出单账号",
name: "putStatus",
name: "staffType",
type: "select",
optionList: isSelect,
optionId: "value",
optionLabel: "label"
}
],
getListApi: purchaseOrderDeliveryPage,
tableData: [],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
......@@ -143,117 +150,233 @@ export default {
tableColumns: [
{
label: "门店名称",
prop: "deliveryNumber",
prop: "merchantName",
width: "200px"
},
{
label: "商户号",
prop: "deliveryCompany",
prop: "merchantId",
width: "150px"
},
{
label: "日期",
prop: "deliveryDate",
width: "150px",
formatter: (cellValue) => {
return cellValue.deliveryDate
? Util.dateFormate(
cellValue.deliveryDate,
"YYYY-MM-DD HH:mm:ss"
)
: ""
}
prop: "dateRange",
width: "150px"
},
{
label: "员工姓名",
prop: "orderCode",
width: "100px",
addHtml: "empName"
prop: "staffName",
width: "100px"
},
{
label: "新车交付数",
prop: "merchantName",
prop: "deliveryCount",
width: "100px",
addHtml: "newCar"
},
{
label: "新车到店流量(会员权益/延保)",
prop: "merchantName"
prop: "equityToShopCount",
formatter: (cellValue) => {
return cellValue.equityToShopCount
? cellValue.equityToShopCount
: "-"
}
},
{
label: "售后到店流量(会员权益/延保)",
prop: "merchantName"
prop: "afterSaleEquityToShopCount",
formatter: (cellValue) => {
return cellValue.afterSaleEquityToShopCount
? cellValue.afterSaleEquityToShopCount
: "-"
}
},
{
label: "成交量(会员权益)",
prop: "merchantName"
prop: "equityCount",
formatter: (cellValue) => {
return cellValue.equityCount ? cellValue.equityCount : "-"
}
},
{
label: "成交量(延保)",
prop: "merchantName",
width: "150px"
prop: "warrantyInsuranceCount",
width: "150px",
formatter: (cellValue) => {
return cellValue.warrantyInsuranceCount
? cellValue.warrantyInsuranceCount
: "-"
}
},
{
label: "转化率(会员权益/延保)",
prop: "merchantName",
width: "150px"
prop: "upgradeRate",
width: "150px",
formatter: (cellValue) => {
return cellValue.upgradeRate ? cellValue.upgradeRate : "-"
}
}
]
},
baseData: {
isSelect
},
page: {
pageNum: 1,
pageSize: 10
},
detailVisible: false,
recordInfo: null
}
},
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: {
...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() {
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) {
this.recordInfo = row
this.merchantId = row.merchantId
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 }) {
if ([0, 1, 2].includes(columnIndex)) {
if (rowIndex % 5 === 0) {
return {
rowspan: 5,
colspan: 1
// 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
let mergeLength = 3 //需要进行横纵合并的列
if (columnIndex < mergeLength) {
let finArray = [1, 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 {
return {
rowspan: 0,
colspan: 0
}
finArray[0] = 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() {
return new Promise((resolve) => {
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
}
this.searchFormSearch = this.getPramms()
resolve()
})
},
// getOptionsList() {
// this.showFormData.forEach((item, index) => {
// if (item.type === "select") {
......@@ -279,27 +402,25 @@ export default {
// },
handleSearch() {
this.$refs.recordTable.refreshTable()
this.getList()
},
handleReset() {
this.searchForm = {
deliveryNumber: "",
deliveryCompany: "",
deliveryDate: "",
orderCode: "",
merchantName: "",
putStatus: ""
}
this.$refs.recordTable.refreshTable()
this.searchForm = {}
this.getList()
},
handleExport() {
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 = [
...this.dowloadList,
{
name: "发货单",
name: "dowloadList",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime()
......@@ -353,6 +474,10 @@ export default {
}
.date-container {
margin-bottom: 10px;
display: flex;
.default-blue-btn {
margin-left: auto;
}
::v-deep {
.el-date-editor {
margin-left: 10px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!