Commit a843b253 by Jaxon

Merge branch 'feature/performance-overview' into 'SAAS+V5.8.2'

Feature/performance overview

See merge request !11
2 parents 733bf56f 9da4f405
# CodeGraph data files
# These are local to each machine and should not be committed
# Database
*.db
*.db-wal
*.db-shm
# Cache
cache/
# Logs
*.log
# Hook markers
.dirty
---
description: CodeGraph MCP usage guide — when to use which tool
alwaysApply: true
---
<!-- CODEGRAPH_START -->
## CodeGraph
This project has a CodeGraph MCP server (`codegraph_*` tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot.
### When to prefer codegraph over native search
Use codegraph for **structural** questions — what calls what, what would break, where is X defined, what is X's signature. Use native grep/read only for **literal text** queries (string contents, comments, log messages) or after you already have a specific file open.
| Question | Tool |
|---|---|
| "Where is X defined?" / "Find symbol named X" | `codegraph_search` |
| "What calls function Y?" | `codegraph_callers` |
| "What does Y call?" | `codegraph_callees` |
| "How does X reach/become Y? / trace the flow from X to Y" | `codegraph_trace` (one call = the whole path, incl. callback/React/JSX dynamic hops) |
| "What would break if I changed Z?" | `codegraph_impact` |
| "Show me Y's signature / source / docstring" | `codegraph_node` |
| "Give me focused context for a task/area" | `codegraph_context` |
| "See several related symbols' source at once" | `codegraph_explore` |
| "What files exist under path/" | `codegraph_files` |
| "Is the index healthy?" | `codegraph_status` |
### Rules of thumb
- **Answer directly — don't delegate exploration.** For "how does X work" / architecture questions, answer with 2-3 codegraph calls: `codegraph_context` first, then ONE `codegraph_explore` for the source of the symbols it surfaces. For a specific **flow** ("how does X reach Y") start with `codegraph_trace` from→to — one call returns the whole path with dynamic hops bridged — then ONE `codegraph_explore` for the bodies; don't rebuild the path with `codegraph_search` + `codegraph_callers`. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent — or running a grep + read loop — repeats work codegraph already did and costs more for the same answer.
- **Trust codegraph results.** They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
- **Don't grep first** when looking up a symbol by name. `codegraph_search` is faster and returns kind + location + signature in one call.
- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context — `codegraph_context` is one call.
- **Don't loop `codegraph_node` over many symbols** — one `codegraph_explore` call returns several symbols' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.
- **Index lag**: the file watcher debounces ~500ms behind writes; don't re-query immediately after editing a file in the same turn.
### If `.codegraph/` doesn't exist
The MCP server returns "not initialized." Ask the user: *"I notice this project doesn't have CodeGraph initialized. Want me to run `codegraph init -i` to build the index?"*
<!-- CODEGRAPH_END -->
...@@ -22,6 +22,6 @@ yarn-error.log* ...@@ -22,6 +22,6 @@ yarn-error.log*
*.sln *.sln
*.sw? *.sw?
.trae .trae
*.local.json
package-lock.json package-lock.json
yarn.lock yarn.lock
...@@ -6,7 +6,7 @@ module.exports = () => { ...@@ -6,7 +6,7 @@ module.exports = () => {
"autoprefixer": { "autoprefixer": {
overrideBrowserslist: ["Android 4.1", "iOS 7.1", "Chrome > 31", "ff > 31", "ie >= 8"], overrideBrowserslist: ["Android 4.1", "iOS 7.1", "Chrome > 31", "ff > 31", "ie >= 8"],
}, },
"postcss-px-to-viewport": { "postcss-px-to-viewport-8-plugin": {
viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750 viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除) unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw
......
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 项目概述
**supervise-wecom** - 基于 Vue 2.7 + Vant UI 的移动端 H5 项目,用于企业微信端的工作台应用。
## 开发命令
```bash
# 安装依赖
pnpm install
# 本地开发
pnpm run serve
# 打包测试环境
pnpm run stage
# 打包生产环境
pnpm run build
# 代码检查
pnpm run lint
```
## 技术栈
- **Vue 2.7** + Vue Router 3 + Vuex 3
- **Vant 2.x** - UI 组件库
- **pnpm** - 包管理器
- **Node.js 20.20.2** (通过 Volta 管理)
## 目录结构
```
src/
├── api/ # 接口封装 (request.js, ssoApi.js, 业务 API)
├── assets/ # 静态资源 (css, icons, images, spritesmith)
├── components/ # 公共组件 (自动注册)
├── config/ # 配置文件 (环境配置,vant 配置)
├── layouts/ # 布局组件
├── mixins/ # 混入
├── plugins/ # 插件
├── router/ # 路由配置
├── store/ # Vuex 状态管理 (modules/app.js)
├── utils/ # 工具函数 (tools.js, util.js, eventBus.js)
└── views/ # 页面组件
├── image/ # 图片相关页面
├── mine/ # 个人中心
├── performance/ # 业绩概览
└── teamWork/ # 团队协作
```
## 架构特点
### 1. 环境配置
通过 `--mode xxx` 区分环境,配置文件位于 `src/config/env.*.js`:
- `npm run serve` → development
- `npm run stage` → staging
- `npm run build` → production
动态配置从远程接口获取 (`src/config/index.js` 中的 `fetchConfig`)
### 2. API 封装
- `src/api/request.js` - 基础请求封装,统一的 POST 方法
- `src/api/ssoApi.js` - SSO 登录相关接口
- `glsx-common` 库的 `Http` 类 - 二次封装,支持 `window.$DJ_HTTP` 和 `window.$SCRM_HTTP`
### 3. 样式方案
- **Less** 用于 Vant 主题定制 (`src/assets/css/vant-theme.less`)
- **Sass** 用于全局样式,通过 `vue.config.js` 的 `prependData` 注入全局变量 `$cdn`
- 雪碧图自动生成:`webpack-spritesmith` 插件处理 `src/assets/spritesmith/` 目录
### 4. 组件注册
- `src/components/index.js` 自动注册 `components/` 下所有 `.vue` 文件为全局组件
### 5. 登录流程
- 企业微信 OAuth 登录,通过 URL 参数 `code` 换取用户信息
- 开发环境跳过登录,使用模拟账号 (`13012345678`)
- 登录状态存储在 `localStorage` (`ww_userInfo`)
### 6. 代码规范
- ESLint 9 + `@antfu/eslint-config` 配置
- Prettier 格式化 (`.prettierrc`)
- VSCode 保存时自动修复 ESLint 问题
## 重要配置
### 路由模式
Hash 模式,`publicPath` 在生产环境为 `'./'`
### 打包优化
- 生产环境移除 `console.log`
- `splitChunks` 拆分第三方依赖 (libs, vantUI)
- `webpack-bundle-analyzer` 打包分析
### 已配置别名
- `@` → `src/`
---
## CodeGraph 代码知识库
本项目已初始化 CodeGraph MCP 服务器,可用于快速代码探索和理解。
### 索引统计
- **文件数**: 56
- **符号节点**: 251
- **调用边**: 320
- **数据库大小**: 0.43 MB
### 节点类型分布
| 类型 | 数量 |
|------|------|
| component | 16 |
| constant | 51 |
| file | 55 |
| function | 45 |
| import | 82 |
| variable | 2 |
### 语言分布
- JavaScript: 39 文件
- Vue: 16 文件
- YAML: 1 文件
---
## 核心模块详解
### 1. 启动流程 (`src/main.js`)
```
启动顺序:
1. 引入 vConsole (移动端调试)
2. 加载动态配置 fetchConfig()
3. 初始化 Vant UI
4. 全局注册 Vue 原型方法 (api, bus, tools, local, to)
5. 挂载 Vue 实例到 #app
```
**动态配置来源**: `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=supervise-wecom-config`
配置项包括:`scrmRequest`, `djRequest`, `loginUrl`, `vconsole` 等
### 2. 路由架构
**三大业务模块**:
| 优先级 | 模块 | 路径 | 重定向 | 页面 |
|--------|------|------|--------|------|
| 1 | 团队协作 | `/teamWork` | `/teamWork/teamList` | 团队列表、督导日报、专项任务 |
| 2 | 业绩概览 | `/performance` | `/performance/index` | 督导业绩/门店业绩、督导 outlet |
| 3 | 我的任务 | `/mine` | `/mine/tasks` | 我的任务 |
**路由特点**:
- 使用 `RouteOutlet` 作为模块级布局组件
- `meta.showTabBar` 控制底部 TabBar 显示
- `meta.keepAlive` 控制组件缓存
- `meta.title` 自动设置页面标题
### 3. 状态管理 (Vuex)
**app.js 核心 state**:
- `showWindow`: 控制主窗口显示(登录完成后 true)
- `lastPath`: 记录最后访问的路由 name
**核心 actions**:
- `navigation`: 路由导航处理,触发登录检查
- `login`: 企业微信 OAuth 登录
- `registerHttp`: 注册 HTTP 实例 (`$SCRM_HTTP`, `$DJ_HTTP`)
- `setPageMeta`: 设置页面元信息(标题等)
### 4. 登录流程详解
```
开发环境 (非生产):
1. 检测非生产环境
2. 模拟用户信息 { phone: "13012345678" }
3. showWindow = true, 直接显示页面
生产环境:
1. 检查 URL 是否有 code 参数
2. 无 code → 跳转企业微信 OAuth 登录页
3. 有 code → 调用 ssoApi.login() 换取用户信息
4. 存储 userInfo 到 localStorage('ww_userInfo')
5. showWindow = true, 渲染页面
```
**企业微信参数**:
- `corpId`: 企业 ID
- `agentId`: 应用 ID
- `code`: OAuth 授权码
### 5. API 请求封装
**src/api/request.js**:
```javascript
post(method, data = {}, url = "supervisorUrl", options = {}, httpType = "djHttp")
```
**URL 配置**:
- `supervisorUrl`: `/rop-dj-supervisor-mini/router`
- `clueUrl`: `/rop-scrm-clue/router`
**HTTP 实例**:
- `window.$DJ_HTTP`: 督导业务 HTTP 实例
- `window.$SCRM_HTTP`: SCRM 业务 HTTP 实例
### 6. 公共组件
**全局自动注册组件** (`src/components/`):
| 组件 | 路径 | 功能 |
|------|------|------|
| DateSearch | `components/dateSearch/dateSearch.vue` | 日期范围选择 |
| SearchBar | `components/searchBar/index.vue` | 搜索输入框 |
| StaticInfo | `components/staticInfo/index.vue` | 静态数据展示卡片 |
| SvgIcon | `components/svgIcon/index.vue` | SVG 图标 |
| TabBar | `components/tabBar/index.vue` | 底部导航栏 |
**业务组件**:
- `BrandTabs`: 品牌分类 tabs (`performance/components/brandTabs/`)
- `StatisticsItem`: 统计项展示 (`performance/components/statisticsItem/`)
### 7. 工具函数
**src/utils/util.js** - 28 个工具函数,包括:
- localStorage 封装
- SessionId 管理
- Loading 控制
- 参数解析等
**src/utils/tools.js** - 9 个工具函数
**src/utils/eventBus.js** - 事件总线
### 8. Mixins
**reportTrackFunMixin**: 用于埋点数据上报
### 9. 环境区分
| 命令 | NODE_ENV | 说明 |
|------|----------|------|
| `pnpm serve` | development | 开发环境,跳过登录 |
| `pnpm stage` | staging | 测试环境 |
| `pnpm build` | production | 生产环境 |
### 10. 打包配置
**vue.config.js**:
- 生产环境 `publicPath: './'`
- `splitChunks` 拆分策略:
- `libs`: 第三方库
- `vantUI`: Vant 相关
- `webpack-bundle-analyzer`: 打包体积分析
- 生产环境移除 `console.log`
---
## CodeGraph 工具使用指南
在 Claude Code 中,优先使用 CodeGraph 工具进行代码探索:
| 需求 | 工具 |
|------|------|
| 查找符号定义 | `codegraph_search` |
| 谁调用了这个函数 | `codegraph_callers` |
| 这个函数调用了谁 | `codegraph_callees` |
| 追踪调用链路 | `codegraph_trace` |
| 修改会影响哪些地方 | `codegraph_impact` |
| 查看符号源码 | `codegraph_node` |
| 批量查看相关符号 | `codegraph_explore` |
| 获取任务/功能上下文 | `codegraph_context` |
| 浏览目录文件 | `codegraph_files` |
| 检查索引状态 | `codegraph_status` |
...@@ -17,6 +17,6 @@ if (IS_PROD) { ...@@ -17,6 +17,6 @@ if (IS_PROD) {
} }
module.exports = { module.exports = {
presets: [["@vue/cli-plugin-babel/preset", { useBuiltIns: "usage", corejs: 3 }]], presets: [["@vue/babel-preset-app", { useBuiltIns: "usage", corejs: 3 }]],
plugins, plugins,
}; };
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
"dependencies": { "dependencies": {
"core-js": "^3.6.4", "core-js": "^3.6.4",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"floating-vue": "1.0.0-beta.19",
"glsx-common": "^2.1.0", "glsx-common": "^2.1.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"lodash-es": "^4.18.1",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"storejs": "^1.1.0", "storejs": "^1.1.0",
"vant": "^2.12.21", "vant": "^2.12.21",
...@@ -27,24 +29,26 @@ ...@@ -27,24 +29,26 @@
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^6.7.3", "@antfu/eslint-config": "^6.7.3",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/babel-preset-app": "^5.0.8",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-service": "~4.5.0", "@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"autoprefixer": "^9.8.8", "autoprefixer": "^9.8.8",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0", "babel-plugin-import": "^1.13.0",
"babel-plugin-transform-remove-console": "^6.9.4", "babel-plugin-transform-remove-console": "^6.9.4",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"eslint-plugin-format": "^1.2.0", "eslint-plugin-format": "^1.2.0",
"less": "^4.6.4", "less": "^4.6.4",
"less-loader": "^7.3.0", "less-loader": "^11.1.4",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport-8-plugin": "^1.2.5",
"sass": "^1.99.0", "sass": "^1.99.0",
"sass-loader": "^8.0.2", "sass-loader": "^13.3.3",
"script-ext-html-webpack-plugin": "^2.1.4", "script-ext-html-webpack-plugin": "^2.1.4",
"svg-sprite-loader": "6.0.11", "svg-sprite-loader": "6.0.11",
"vue-loader": "^15.9.8", "vue-loader": "15.11.1",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^3.8.0" "webpack-bundle-analyzer": "^3.8.0"
}, },
......
This diff could not be displayed because it is too large.
...@@ -27,6 +27,7 @@ export default { ...@@ -27,6 +27,7 @@ export default {
data() { data() {
return { return {
showWindow: false, showWindow: false,
tabBarRef: null,
}; };
}, },
computed: { computed: {
...@@ -38,7 +39,6 @@ export default { ...@@ -38,7 +39,6 @@ export default {
watchFlag: { watchFlag: {
immediate: true, immediate: true,
handler(newval) { handler(newval) {
console.log(newval, "===");
this.showWindow = newval; this.showWindow = newval;
this.hideLoading(); this.hideLoading();
}, },
......
import { Http } from "glsx-common";
import { Notify } from "vant";
const mockBaseUrl = "http://192.168.1.146:4523/m1/8353571-8118735-default/router/";
const mockRequest = new Http({
});
export function mock(method, data = {}, url = "supervisorUrl", options = {}, httpType = "djHttp") {
return mockRequest({
url: `${mockBaseUrl}${method}/1.0.0`,
data,
...options,
});
}
import api from "@/api/request";
export function getRegionList(data) {
return api.post("dj.api.sup.sale.map.districts", data, "supervisorUrl");
}
@import "./normalize.scss"; @use "./normalize.scss";
@import "./sprite.scss"; @use "./sprite.scss";
html, html,
body #app { body #app {
color: #333333; color: #333333;
...@@ -11,7 +11,7 @@ body #app { ...@@ -11,7 +11,7 @@ body #app {
background-color: transparent; background-color: transparent;
// overflow: hidden; // overflow: hidden;
--themeColor: #3975c6; --themeColor: #2c66f7;
/* 兼容 IOS<11.2 先constant再env */ /* 兼容 IOS<11.2 先constant再env */
--constantSafeAreaInsetBottom: constant(safe-area-inset-bottom); --constantSafeAreaInsetBottom: constant(safe-area-inset-bottom);
/* 兼容 IOS>11.2 */ /* 兼容 IOS>11.2 */
......
@primary-color: var(--themeColor, #3975c6); @primary-color: var(--themeColor, #2C66F7;);
@tabs-default-color: @primary-color; @tabs-default-color: @primary-color;
// // Color Palette // // Color Palette
......
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.00027 11.9392L4.70044 8.63934L5.64325 7.69653L8.00027 10.0536L10.3573 7.69653L11.3001 8.63934L8.00027 11.9392ZM8.00027 8.29855L4.70044 4.99872L5.64325 4.05591L8.00027 6.41293L10.3573 4.05591L11.3001 4.99872L8.00027 8.29855Z" fill="black" fill-opacity="0.4"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M8.00009 9.99992L11.6667 6.33325H4.33337L8.00009 9.99992Z" fill="currentColor"/>
</svg>
<template>
<div class="tab-section"
:class="{ isSticky }"
:style="{ background: customBackground }">
<div class="tab-slider" :style="tabSliderStyle"></div>
<div v-for="item in normalizedList"
:key="item.value"
class="tab"
:class="{ active: item.value === currentValue }"
@click="handleSelect(item)">
{{ item.label }}
</div>
</div>
</template>
<script>
export default {
name: "DateTypeTabs",
props: {
value: {
type: [String, Number],
default: 0,
},
list: {
type: Array,
default() {
return [
{ label: "日", value: 0 },
{ label: "周", value: 1 },
{ label: "月", value: 2 },
];
},
},
isSticky: Boolean,
customBackground: {
type: String,
default: "",
},
},
computed: {
normalizedList() {
return (this.list || []).map((item, index) => {
const value = item?.value;
const label = item?.label;
return {
...item,
label,
value,
};
});
},
currentValue() {
return this.value;
},
tabSliderStyle() {
const tabCount = this.normalizedList.length || 1;
const activeIndex = this.normalizedList.findIndex(item => item.value === this.currentValue);
const currentIndex = activeIndex > -1 ? activeIndex : 0;
return {
width: `calc((100% - 4px) / ${tabCount})`,
transform: `translateX(${currentIndex * 100}%)`,
};
},
},
methods: {
handleSelect(item) {
if (item.value === this.currentValue)
return;
this.$emit("input", item.value);
this.$emit("change", item);
},
},
};
</script>
<style lang="scss" scoped>
.tab-section {
position: relative;
overflow: hidden;
box-sizing: border-box;
width: 139px;
display: flex;
align-items: center;
background: #ffffff;
border-radius: 28px;
font-size: 13px;
color: #999999;
padding: 2px;
flex-shrink: 0;
.tab-slider {
position: absolute;
top: 2px;
left: 2px;
height: 24px;
border-radius: 24px;
background: #2c66f71a;
transition: transform 0.25s ease;
}
&.isSticky {
background: #f7f8fa;
}
.tab {
position: relative;
z-index: 1;
flex: 1;
text-align: center;
line-height: 26px;
border-radius: 24px;
transition: color 0.25s ease;
flex-shrink: 0;
&.active {
color: #2c66f7;
font-weight: 500;
}
}
}
</style>
<template>
<div v-show="visible"
class="global-loading"
:style="{ backgroundColor: overlayColor }"
@touchmove.prevent>
<div class="global-loading__panel">
<van-loading vertical
:color="spinnerColor"
:size="size"
:type="type">
{{ text }}
</van-loading>
</div>
</div>
</template>
<script>
export default {
name: "GlobalLoading",
data() {
return {
visible: false,
text: "加载中...",
type: "spinner",
size: "24px",
spinnerColor: "#ffffff",
overlayColor: "rgba(0, 0, 0, 0.35)",
};
},
methods: {
open(options = {}) {
const config = typeof options === "string" ? { text: options } : options;
this.text = config.text || config.message || "加载中...";
this.type = config.type || "spinner";
this.size = config.size || "24px";
this.spinnerColor = config.color || "#ffffff";
this.overlayColor = config.overlayColor || "rgba(0, 0, 0, 0.35)";
this.visible = true;
},
close() {
this.visible = false;
},
},
};
</script>
<style lang="scss" scoped>
.global-loading {
position: fixed;
inset: 0;
z-index: 3000;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
box-sizing: border-box;
&__panel {
min-width: 96px;
max-width: min(60vw, 180px);
padding: 16px 18px;
border-radius: 12px;
background: rgba(0, 0, 0, 0.72);
backdrop-filter: blur(4px);
box-sizing: border-box;
::v-deep .van-loading {
align-items: center;
}
::v-deep .van-loading__text {
margin-top: 10px;
font-size: 14px;
line-height: 20px;
color: #ffffff;
text-align: center;
word-break: break-word;
}
}
}
</style>
import Vue from "vue";
import GlobalLoading from "./index.vue";
const LoadingConstructor = Vue.extend(GlobalLoading);
const DEFAULT_OPTIONS = {
delay: 250,
minDuration: 300,
};
let instance = null;
let pendingCount = 0;
let showTimer = null;
let hideTimer = null;
let latestOptions = { ...DEFAULT_OPTIONS };
let shownAt = 0;
function getInstance() {
if (instance)
return instance;
instance = new LoadingConstructor({
el: document.createElement("div"),
});
document.body.appendChild(instance.$el);
return instance;
}
function normalizeOptions(options = {}) {
const config = typeof options === "string" ? { text: options } : options;
return {
...DEFAULT_OPTIONS,
...config,
};
}
function clearShowTimer() {
if (!showTimer)
return;
clearTimeout(showTimer);
showTimer = null;
}
function clearHideTimer() {
if (!hideTimer)
return;
clearTimeout(hideTimer);
hideTimer = null;
}
function openLoading(options) {
const loadingInstance = getInstance();
loadingInstance.open(options);
shownAt = Date.now();
return loadingInstance;
}
export const loading = {
show(options = {}) {
pendingCount += 1;
const config = normalizeOptions(options);
latestOptions = config;
clearHideTimer();
const loadingInstance = getInstance();
if (loadingInstance.visible) {
loadingInstance.open(config);
return loadingInstance;
}
clearShowTimer();
if (config.delay <= 0)
return openLoading(config);
showTimer = setTimeout(() => {
showTimer = null;
if (pendingCount <= 0)
return;
openLoading(latestOptions);
}, config.delay);
return loadingInstance;
},
hide(force = false) {
if (force) {
pendingCount = 0;
} else {
pendingCount = Math.max(pendingCount - 1, 0);
}
if (pendingCount > 0)
return;
clearShowTimer();
if (!instance || !instance.visible)
return;
clearHideTimer();
const minDuration = Number(latestOptions.minDuration) || 0;
const visibleDuration = Date.now() - shownAt;
const remainingDuration = Math.max(minDuration - visibleDuration, 0);
if (remainingDuration === 0) {
instance.close();
return;
}
hideTimer = setTimeout(() => {
hideTimer = null;
if (pendingCount === 0 && instance)
instance.close();
}, remainingDuration);
},
clear() {
this.hide(true);
},
};
export default {
install(VueInstance) {
if (VueInstance.prototype.$loading)
return;
VueInstance.prototype.$loading = loading;
},
};
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
* @LastEditTime: 2021-06-25 18:09:28 * @LastEditTime: 2021-06-25 18:09:28
*/ */
import Vue from "vue"; import Vue from "vue";
import loadingPlugin from "./globalLoading/plugin";
Vue.use(loadingPlugin);
const componentsFiles = require.context(`./`, true, /.vue$/); const componentsFiles = require.context(`./`, true, /.vue$/);
componentsFiles.keys().forEach((path) => { componentsFiles.keys().forEach((path) => {
......
<template>
<van-action-sheet :close-on-click-action="false"
:value="visible"
@closed="handleClosed"
@input="updateVisible">
<div class="region-sheet">
<div class="region-sheet__search">
<van-search v-model.trim="keyword"
background="transparent"
shape="round"
:placeholder="searchPlaceholder"
:show-action="false" />
</div>
<div class="region-sheet__list">
<div v-for="item in filteredOptions"
:key="item.value"
class="region-sheet__item"
:class="{ active: item.value === tempValue }"
@click="handleSelect(item)">
<span class="region-sheet__label">{{ item.label }}</span>
<van-icon v-if="item.value === tempValue"
color="#2c66f7"
name="success" />
</div>
<div v-if="!filteredOptions.length" class="region-sheet__empty">
暂无地区数据
</div>
</div>
<div class="region-sheet__footer">
<van-button class="region-sheet__button"
block
plain
round
@click="handleCancel">
取消
</van-button>
<van-button class="region-sheet__button"
type="info"
block
round
@click="handleConfirm">
确定
</van-button>
</div>
</div>
</van-action-sheet>
</template>
<script>
export default {
name: "RegionPicker",
props: {
value: {
type: [String, Number],
default: "",
},
visible: {
type: Boolean,
default: false,
},
options: {
type: Array,
default() {
return [];
},
},
searchPlaceholder: {
type: String,
default: "搜索地区",
},
labelKey: {
type: String,
default: "name",
},
valueKey: {
type: String,
default: "code",
},
},
data() {
return {
keyword: "",
tempValue: this.value,
innerOptions: [],
hasLoaded: false,
};
},
computed: {
sourceOptions() {
return this.options.length ? this.options : this.innerOptions;
},
normalizedOptions() {
return (this.sourceOptions || []).map((item) => {
const label = item?.[this.labelKey];
const value = item?.[this.valueKey];
return {
...item,
label,
value,
};
}).filter(item => item.label !== undefined && item.value !== undefined);
},
filteredOptions() {
const keyword = this.keyword.trim().toLowerCase();
if (!keyword) {
return this.normalizedOptions;
}
return this.normalizedOptions.filter((item) => {
return String(item.label).toLowerCase().includes(keyword)
|| String(item.value).toLowerCase().includes(keyword);
});
},
},
watch: {
value: {
immediate: true,
handler(val) {
this.tempValue = val;
},
},
visible: {
immediate: true,
handler(val) {
if (val) {
this.initPanelState();
}
},
},
},
methods: {
async initPanelState() {
this.keyword = "";
this.tempValue = this.value;
await this.ensureRegionOptions();
},
async ensureRegionOptions() {
if (this.options.length || this.hasLoaded) {
return;
}
const result = await Promise.resolve(this.loadRegionOptions());
this.innerOptions = Array.isArray(result) ? result : [];
this.hasLoaded = true;
},
loadRegionOptions() {
// 地区数据获取留空,后续可在这里接接口或自行改成外部传参。
return [];
},
findOptionByValue(value) {
return this.normalizedOptions.find(item => item.value === value) || null;
},
handleSelect(item) {
this.tempValue = item.value;
this.$emit("select", item);
},
handleCancel() {
this.keyword = "";
this.tempValue = this.value;
this.$emit("update:visible", false);
this.$emit("cancel");
},
handleConfirm() {
const selectedOption = this.findOptionByValue(this.tempValue);
this.$emit("input", this.tempValue);
this.$emit("change", selectedOption);
this.$emit("confirm", selectedOption);
this.keyword = "";
this.$emit("update:visible", false);
},
handleClosed() {
this.$emit("closed");
},
updateVisible(val) {
if (!val) {
this.keyword = "";
this.tempValue = this.value;
}
this.$emit("update:visible", val);
},
},
};
</script>
<style lang="scss" scoped>
.region-sheet {
display: flex;
flex-direction: column;
height: 70vh;
background: #ffffff;
&__search {
padding: 12px 12px 0;
}
&__list {
flex: 1;
overflow-y: auto;
padding: 8px 12px 16px;
}
&__item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 12px;
font-size: 14px;
color: #333333;
background: #ffffff;
border-bottom: 1px solid #f2f3f5;
&.active {
color: #2c66f7;
}
}
&__label {
flex: 1;
padding-right: 12px;
word-break: break-all;
}
&__empty {
padding: 48px 0;
text-align: center;
font-size: 14px;
color: #999999;
}
&__footer {
display: flex;
column-gap: 12px;
padding: 12px;
border-top: 1px solid #f2f3f5;
}
&__button {
flex: 1;
}
}
</style>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{{ item.label }} {{ item.label }}
</div> </div>
<div class="value"> <div class="value">
{{ data[item.key] ?? '-' }} {{ data[item.key] }}
</div> </div>
</div> </div>
</div> </div>
......
<template> <template>
<svg <svg aria-hidden="true"
class="svg-icon" class="svg-icon"
:style="iconStyle" :style="iconStyle">
aria-hidden="true"
>
<use :xlink:href="iconName" /> <use :xlink:href="iconName" />
</svg> </svg>
</template> </template>
...@@ -22,7 +20,7 @@ export default { ...@@ -22,7 +20,7 @@ export default {
}, },
color: { color: {
type: String, type: String,
default: "currentColor", default: "#000",
}, },
}, },
computed: { computed: {
...@@ -35,6 +33,7 @@ export default { ...@@ -35,6 +33,7 @@ export default {
width: size, width: size,
height: size, height: size,
fill: this.color, fill: this.color,
color: this.color,
}; };
}, },
}, },
......
<template>
<FloatingTooltip ref="tooltip"
v-bind="tooltipProps"
v-on="mergedListeners"
@click.native.stop>
<slot />
<template #popper>
<slot name="content">
<span v-if="hasTooltipContent" class="tool-tips-content-label">{{ tooltipContent }}</span>
</slot>
</template>
</FloatingTooltip>
</template>
<script>
import { Tooltip as FloatingTooltip } from "floating-vue";
export default {
name: "BaseTooltip",
components: {
FloatingTooltip,
},
inheritAttrs: false,
props: {
content: {
type: [String, Number],
default: null,
},
options: {
type: [Object, String, Number],
default: null,
},
hideAfter: {
type: [Number, String],
default: 0,
},
},
data() {
return {
hideTimer: null,
};
},
computed: {
tooltipProps() {
const attrs = {
...this.$attrs,
};
delete attrs.content;
if (typeof this.options === "string" || typeof this.options === "number") {
return {
...attrs,
theme: attrs.theme || "white-tooltip",
};
}
return {
...(this.options || {}),
...attrs,
theme: (this.options || {}).theme || attrs.theme || "white-tooltip",
};
},
tooltipContent() {
if (this.content !== null && this.content !== undefined)
return this.content;
if (typeof this.options === "string" || typeof this.options === "number")
return this.options;
if (this.options && Object.prototype.hasOwnProperty.call(this.options, "content"))
return this.options.content;
return null;
},
hasTooltipContent() {
return this.tooltipContent !== null && this.tooltipContent !== undefined && this.tooltipContent !== "";
},
mergedListeners() {
return {
...this.$listeners,
"apply-show": this.handleApplyShow,
"apply-hide": this.handleApplyHide,
};
},
hideAfterMs() {
const value = Number(this.hideAfter);
return Number.isFinite(value) && value > 0 ? value : 0;
},
},
beforeDestroy() {
this.clearHideTimer();
},
methods: {
show(...args) {
return this.$refs.tooltip?.show(...args);
},
hide(...args) {
this.clearHideTimer();
return this.$refs.tooltip?.hide(...args);
},
dispose(...args) {
this.clearHideTimer();
return this.$refs.tooltip?.dispose(...args);
},
handleApplyShow(...args) {
this.emitListener("apply-show", args);
this.startAutoHide();
},
handleApplyHide(...args) {
this.clearHideTimer();
this.emitListener("apply-hide", args);
},
startAutoHide() {
this.clearHideTimer();
if (!this.hideAfterMs)
return;
this.hideTimer = setTimeout(() => {
this.hide();
}, this.hideAfterMs);
},
clearHideTimer() {
if (this.hideTimer) {
clearTimeout(this.hideTimer);
this.hideTimer = null;
}
},
emitListener(name, args) {
const listener = this.$listeners[name];
if (typeof listener === "function") {
listener(...args);
return;
}
if (Array.isArray(listener)) {
listener.forEach(fn => typeof fn === "function" && fn(...args));
}
},
},
};
</script>
<style lang="scss">
.v-popper--theme-white-tooltip .v-popper__inner {
background: #ffffff;
color: rgba(0, 0, 0, 0.88);
border-radius: 8px;
padding: 8px 12px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
border: 1px solid rgba(0, 0, 0, 0.06);
}
.v-popper--theme-white-tooltip .v-popper__arrow-outer {
border-color: #ffffff;
}
.tool-tips-content-label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: #000000e5;
}
</style>
import {
// * Components
// Dropdown,
// Menu,
// Tooltip,
// vClosePopper,
// * Directives
options,
VTooltip,
} from "floating-vue";
import "floating-vue/dist/style.css";
console.log(options);
// <button v-tooltip.bottom-start="'You have ' + count + ' new messages.'">
export function utils(app) {
app.directive("tooltip", VTooltip);
}
...@@ -5,6 +5,7 @@ import VConsole from "vconsole"; ...@@ -5,6 +5,7 @@ import VConsole from "vconsole";
// import 'regenerator-runtime/runtime' // import 'regenerator-runtime/runtime'
import Vue from "vue"; import Vue from "vue";
import { cfg, fetchConfig } from "@/config"; import { cfg, fetchConfig } from "@/config";
import { utils } from "@/config/utils.config.js";
import { vant } from "@/config/vant.config.js"; import { vant } from "@/config/vant.config.js";
import { ssoApi } from "./api/index.js"; import { ssoApi } from "./api/index.js";
import App from "./App.vue"; import App from "./App.vue";
...@@ -17,6 +18,7 @@ import "./utils/util"; ...@@ -17,6 +18,7 @@ import "./utils/util";
import "@/components"; import "@/components";
// import mixin from './mixins/index' // import mixin from './mixins/index'
vant(Vue); vant(Vue);
utils(Vue);
Vue.prototype.api = ssoApi; Vue.prototype.api = ssoApi;
Vue.prototype.bus = bus; Vue.prototype.bus = bus;
Vue.prototype.tools = tools; Vue.prototype.tools = tools;
......
import dayjs from "dayjs"; import dayjs from "dayjs";
import { Dialog, Toast } from "vant"; import { Dialog, Toast } from "vant";
import Vue from "vue"; import Vue from "vue";
import { loading } from "@/components/globalLoading/plugin";
/** /**
* 日期格式化 * 日期格式化
...@@ -42,20 +43,15 @@ function throttle(fn, gapTime) { ...@@ -42,20 +43,15 @@ function throttle(fn, gapTime) {
} }
/** 防止重复点击 */ /** 防止重复点击 */
function showLoading(title = "加载中...", callBack, custom) { function showLoading(title = "加载中...", callBack, custom) {
Toast({ loading.show({ text: title });
type: "loading",
message: title,
forbidClick: true,
duration: 0,
});
if (callBack && typeof callBack === "function") { if (callBack && typeof callBack === "function") {
if (!custom) if (!custom)
Toast.clear(); hideLoading();
callBack(); callBack();
} }
} }
function hideLoading() { function hideLoading() {
Toast.clear(); loading.hide(true);
} }
/** num:要转换的数值,fixed:精确几位小数 */ /** num:要转换的数值,fixed:精确几位小数 */
function decimal(num, fixed) { function decimal(num, fixed) {
......
import api from "@/api/request";
// rop-dj-supervisor-mini/router
// /router/dj.api.supervisor.management.supervisor.performance/1.0.0
export function getSupervisorPerformance(data = {}) {
return api.post("dj.api.supervisor.management.supervisor.performance", data, "supervisorUrl");
}
export function getStorePerformance(data = {}) {
return api.post("dj.api.supervisor.management.store.performance", data, "supervisorUrl");
}
// export function getStorePerformance(data = {}) {
// return api.post("dj.api.supervisor.management.store.performance", data, "supervisorUrl");
// }
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
sliderStyle() { sliderStyle() {
return { return {
width: this.sliderWidth + "px", width: this.sliderWidth + "px",
transform: "translate3d(" + this.sliderX + "px, 0, 0)", left: this.sliderX + "px",
}; };
}, },
}, },
...@@ -155,7 +155,7 @@ export default { ...@@ -155,7 +155,7 @@ export default {
} }
const targetKey = String(key); const targetKey = String(key);
for (const i = 0; i < normalizedList.length; i += 1) { for (let i = 0; i < normalizedList.length; i += 1) {
if (normalizedList[i].key === targetKey) { if (normalizedList[i].key === targetKey) {
return i; return i;
} }
...@@ -286,6 +286,7 @@ export default { ...@@ -286,6 +286,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
border-radius: 24px; border-radius: 24px;
overflow: hidden; overflow: hidden;
isolation: isolate;
} }
.tabs-bg { .tabs-bg {
...@@ -300,19 +301,19 @@ export default { ...@@ -300,19 +301,19 @@ export default {
top: 3px; top: 3px;
bottom: 3px; bottom: 3px;
left: 0; left: 0;
z-index: 1; z-index: 0;
border-radius: 24px; border-radius: 24px;
background-color: var(--primary-color, #1677ff); background-color: var(--themeColor, #3975c6);
transition: transition:
transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1), left 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
width 250ms cubic-bezier(0.2, 0.8, 0.2, 1); width 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
will-change: transform, width; will-change: left, width;
pointer-events: none; pointer-events: none;
} }
.tab-item { .tab-item {
position: relative; position: relative;
z-index: 2; z-index: 1;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
......
<template>
<div class="row-wrapper">
<div v-for="item in schema"
:key="item.name"
class="col-wrapper van-col-wrapper"
:style="item.colStyle">
<Tooltip :content="item.tips"
:hide-after="1500"
:options="{
triggers: ['click'],
placement: 'top',
autoHide: true,
disabled: !item.tips,
}">
<div class="item-wrapper"
:class="{ special: item.special }"
:style="item.style">
<div class="label">
<div class="text-hide" style="margin-right:2px">
{{ item.label }}
</div>
<SvgIcon v-if="item.tips"
class="icon"
color="#DCDDE1"
name="form-tips"
size="16px" />
</div>
<div class="value text-hide ">
{{ getValue(item.name) }}
</div>
</div>
</Tooltip>
</div>
</div>
<!-- <van-row gutter="4">
<van-col v-for="item in schema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
</van-col>
</van-row> -->
</template>
<script>
import { get } from "lodash-es";
import { Col, Divider, Icon, Row } from "vant";
import SvgIcon from "@/components/svgIcon/index.vue";
import Tooltip from "@/components/tooltip/index.vue";
export default {
name: "",
components: {
[Col.name]: Col,
[Row.name]: Row,
[Divider.name]: Divider,
[Icon.name]: Icon,
SvgIcon,
Tooltip,
},
props: {
schema: {
type: Array,
default: () => ([]),
},
data: {
type: Object,
default: () => ({}),
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
getValue(path) {
return get(this.data, path);
},
},
};
</script>
<style scoped lang="scss">
.row-wrapper {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.van-col-wrapper {
overflow: hidden;
flex-shrink: 0;
margin-right: 4px;
&:last-child {
margin-right: 0;
}
.item-wrapper {
background: #f8f8f8;
padding: 8px 12px;
overflow: hidden;
box-sizing: border-box;
.label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: rgba(0, 0, 0, 0.26);
display: flex;
align-items: center;
flex-wrap: nowrap;
flex-shrink: 0;
.icon {
flex-shrink: 0;
}
}
.value {
margin-top: 4px;
font-family: numberNor;
font-weight: 500;
font-size: 16px;
line-height: 20px;
color: var(--themeColor);
flex-shrink: 0;
}
}
}
</style>
<template>
<van-row gutter="4">
<van-col v-for="item in schema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper"
:class="{ special: item.special }"
:style="item.style">
<div class="value text-hide ">
{{ getValue(item.name) }}
</div>
<div class="label text-hide ">
{{ item.label }}
</div>
</div>
</van-col>
</van-row>
</template>
<script>
import { get } from "lodash-es";
import { Col, Divider, Icon, Row } from "vant";
export default {
name: "",
components: {
[Col.name]: Col,
[Row.name]: Row,
[Divider.name]: Divider,
[Icon.name]: Icon,
},
props: {
schema: {
type: Array,
default: () => ([]),
},
data: {
type: Object,
default: () => ({}),
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
getValue(path) {
return get(this.data, path);
},
},
};
</script>
<style scoped lang="scss">
.van-col-wrapper {
overflow: hidden;
.item-wrapper {
background: #fff;
padding: 6px 8px;
overflow: hidden;
box-sizing: border-box;
text-align: center;
.label {
font-weight: 400;
font-size: 12px;
line-height: 16px;
color: #00000042;
margin-top: 5px;
}
.value {
font-family: numberBold;
font-weight: 700;
font-style: Bold;
line-height: 20px;
font-size: 20px;
}
}
}
</style>
...@@ -8,14 +8,27 @@ ...@@ -8,14 +8,27 @@
<div class="title-wrapper"> <div class="title-wrapper">
<div class="title-label-wrapper text-hide"> <div class="title-label-wrapper text-hide">
<div class="main-label text-hide"> <div class="main-label text-hide">
張三 {{ title }}
</div> </div>
<div class="sub-label text-hide"> <slot name="sub-title" :data="data">
北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店 <div v-if="subTitle" class="sub-label text-hide">
{{ subTitle }}
</div> </div>
</slot>
</div> </div>
<div class="title-info-wrapper"> <div class="title-info-wrapper">
<slot name="title-info"> <slot name="title-info">
<div v-for="item in titleInfoSchema"
:key="item.key"
class="info-item-wrapper"
@click.stop>
<div class="value">
{{ getValue(item.name) }}
</div>
<div class="label">
{{ item.label }}
</div>
</div>
</slot> </slot>
<slot name="title-info-icon"> <slot name="title-info-icon">
<van-icon color="#000000E5" <van-icon color="#000000E5"
...@@ -24,75 +37,49 @@ ...@@ -24,75 +37,49 @@
</slot> </slot>
</div> </div>
</div> </div>
<van-row class="container" gutter="4"> <SpecialItem v-if="specialSchema.length"
<van-col v-for="item in defaultSchema" style="margin: 8px 0"
:key="item.name" :data="data"
class="van-col-wrapper" :schema="specialSchema">
:span="item.col"> </SpecialItem>
<div class="item-wrapper" :style="item.style"> <GridItem :data="data" :schema="defaultSchema"></GridItem>
<div class="label text-hide ">
{{ item.label }} <div class="container" gutter="4">
</div> <div v-show="showMoreToggle" span="24">
<div class="value text-hide ">
{{ item.name }}
</div>
</div>
</van-col>
<van-col v-if="showMoreToggle" span="24">
<div class="more-collapse" <div class="more-collapse"
:style="{ :style="{
height: expanded ? (`${moreHeight}px`) : '0px', height: expanded ? (`${moreHeight}px`) : '0px',
}"> }">
<div class="more-inner"> <div class="more-inner">
<van-row gutter="4"> <GridItem :data="data" :schema="moreSchema"></GridItem>
<van-col v-for="item in moreSchema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper" :style="item.style">
<div class="label text-hide ">
{{ item.label }}
</div>
<div class="value text-hide ">
{{ item.name }}
</div>
</div>
</van-col>
</van-row>
</div> </div>
</div> </div>
<!-- 用来记录高度 --> <!-- 用来记录高度 -->
<div class="more-measure"> <div class="more-measure">
<div ref="moreMeasureInner" class="more-inner"> <div ref="moreMeasureInner" class="more-inner">
<van-row gutter="4"> <GridItem :data="data" :schema="moreSchema"></GridItem>
<van-col v-for="item in moreSchema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper" :style="item.style">
<div class="label text-hide ">
{{ item.label }}
</div> </div>
<div class="value text-hide ">
{{ item.name }}
</div> </div>
</div> </div>
</van-col>
</van-row>
</div> </div>
</div>
</van-col>
</van-row>
<div v-if="showMoreToggle" <div v-if="showMoreToggle"
class="toggle-wrapper" class="toggle-wrapper"
:class="{ 'is-expanded': expanded }"
@click.stop="onToggleMore"> @click.stop="onToggleMore">
{{ expanded ? '收起2项售后成交指标' : '已隐藏2项售后成交指标' }} {{ expanded ? `收起${moreSchema.length}项售后成交指标` : `已隐藏${moreSchema.length}项售后成交指标` }}
<svg-icon class="toggle-icon"
name="show-more"
size="16px" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { get } from "lodash-es";
import { Col, Divider, Icon, Row } from "vant"; import { Col, Divider, Icon, Row } from "vant";
import Tooltip from "@/components/tooltip/index.vue";
import GridItem from "./gridItem.vue";
import SpecialItem from "./specialItem.vue";
export default { export default {
name: "", name: "",
...@@ -101,12 +88,26 @@ export default { ...@@ -101,12 +88,26 @@ export default {
[Row.name]: Row, [Row.name]: Row,
[Divider.name]: Divider, [Divider.name]: Divider,
[Icon.name]: Icon, [Icon.name]: Icon,
GridItem,
SpecialItem,
}, },
props: { props: {
title: {
type: String,
default: "",
},
subTitle: {
type: String,
default: "",
},
schema: { schema: {
type: Array, type: Array,
default: () => ([]), default: () => ([]),
}, },
data: {
type: Object,
default: () => ({}),
},
beTap: { beTap: {
type: Boolean, type: Boolean,
default: true, default: true,
...@@ -124,11 +125,17 @@ export default { ...@@ -124,11 +125,17 @@ export default {
}, },
computed: { computed: {
defaultSchema() { defaultSchema() {
return this.schema.filter(item => !item.isMore); return this.schema.filter(item => (!item.isMore && !item.titleInfo && !item.special));
}, },
moreSchema() { moreSchema() {
return this.schema.filter(item => item.isMore); return this.schema.filter(item => item.isMore);
}, },
titleInfoSchema() {
return this.schema.filter(item => item.titleInfo);
},
specialSchema() {
return this.schema.filter(item => (item.special));
},
showMoreToggle() { showMoreToggle() {
return this.hasMore && this.moreSchema.length > 0; return this.hasMore && this.moreSchema.length > 0;
}, },
...@@ -146,6 +153,9 @@ export default { ...@@ -146,6 +153,9 @@ export default {
this.updateMoreHeight(); this.updateMoreHeight();
}, },
methods: { methods: {
getValue(path) {
return get(this.data, path);
},
handleTapItem() { handleTapItem() {
this.$emit("tap"); this.$emit("tap");
}, },
...@@ -159,7 +169,7 @@ export default { ...@@ -159,7 +169,7 @@ export default {
updateMoreHeight() { updateMoreHeight() {
this.$nextTick(() => { this.$nextTick(() => {
const moreMeasureInner = this.$refs.moreMeasureInner; const moreMeasureInner = this.$refs.moreMeasureInner;
this.moreHeight = moreMeasureInner ? moreMeasureInner.clientHeight : 0; this.moreHeight = moreMeasureInner ? moreMeasureInner.clientHeight + 22 : 0;
}); });
}, },
}, },
...@@ -172,7 +182,6 @@ export default { ...@@ -172,7 +182,6 @@ export default {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.statistics-item-wrapper { .statistics-item-wrapper {
background-color: white; background-color: white;
padding: 8px; padding: 8px;
...@@ -182,9 +191,6 @@ export default { ...@@ -182,9 +191,6 @@ export default {
position: relative; position: relative;
transition: background 250ms cubic-bezier(0.2, 0.8, 0.2, 1); transition: background 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
padding-bottom: 14px; padding-bottom: 14px;
&.is-expand {
padding-bottom: 42px;
}
&.is-tap { &.is-tap {
&:active { &:active {
background: rgb(252, 252, 252); background: rgb(252, 252, 252);
...@@ -193,16 +199,17 @@ export default { ...@@ -193,16 +199,17 @@ export default {
> .title-wrapper { > .title-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 8px 16px; padding: 8px;
border-bottom: 1px solid #eeeef0; border-bottom: 1px solid #eeeef0;
overflow: hidden; overflow: hidden;
.title-label-wrapper { .title-label-wrapper {
flex-shrink: 0; flex-shrink: 0;
width: 45%; width: calc(50% - 16px);
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
color: rgba(0, 0, 0, 0.9); color: rgba(0, 0, 0, 0.9);
margin-right: 16px;
.sub-label { .sub-label {
font-weight: 400; font-weight: 400;
font-size: 10px; font-size: 10px;
...@@ -217,7 +224,23 @@ export default { ...@@ -217,7 +224,23 @@ export default {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
overflow: hidden; overflow: hidden;
margin-left: 16px; .info-item-wrapper {
text-align: center;
margin-right: 12px;
.value {
font-family: numberBold;
font-weight: 700;
font-size: 20px;
line-height: 20px;
color: var(--themeColor);
}
.label {
font-weight: 400;
font-size: 10px;
line-height: 16px;
color: #00000042;
}
}
.sub-label { .sub-label {
font-weight: 400; font-weight: 400;
...@@ -243,37 +266,18 @@ export default { ...@@ -243,37 +266,18 @@ export default {
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
border-radius: 8px; border-radius: 8px;
margin-top: 8px;
}
}
.van-col-wrapper {
overflow: hidden;
.item-wrapper {
background: #f8f8f8;
padding: 8px 12px;
overflow: hidden;
box-sizing: border-box;
.label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: rgba(0, 0, 0, 0.26);
}
.value {
margin-top: 4px; margin-top: 4px;
font-family: D-numberNor;
font-weight: 500;
font-size: 16px;
line-height: 20px;
color: var(--themeColor);
}
} }
} }
.toggle-wrapper { .toggle-wrapper {
background-image: linear-gradient(top, rgba(255, 255, 255, 0.2) 15%, rgba(255, 255, 255, 0.6) 30%, #ffffff 100%); background-image: linear-gradient(
to bottom,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.5) 15%,
rgba(255, 255, 255, 0.7) 30%,
#ffffff 100%
);
padding: 6px 0; padding: 6px 0;
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -283,6 +287,18 @@ export default { ...@@ -283,6 +287,18 @@ export default {
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
color: #00000066; color: #00000066;
display: flex;
align-items: center;
justify-content: center;
.toggle-icon {
transform: rotate(0);
transition: transform 300ms ease;
}
&.is-expanded {
.toggle-icon {
transform: rotate(-180deg);
}
}
} }
.more-collapse { .more-collapse {
......
export const supervisorSchemaList = [
{
name: "displayTotalOutput",
label: "总产值(万)",
colStyle: "flex: 1 0 calc((100% - 16px) / 3);margin-bottom:4px;margin-top:8px",
},
{
name: "displayDeliveryCount",
label: "交付数",
colStyle: "flex: 1 0 calc((100% - 16px) / 3);margin-bottom:4px;margin-top:8px",
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
colStyle: "flex: 1 0 calc((100%) / 3);margin-right:0;margin-bottom:4px;margin-top:8px",
},
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
colStyle: "flex: 0 auto;",
tips: "整车延保触客转化率",
},
{
name: "displayPeaceOfMindRate",
label: "安心包",
colStyle: "flex:1",
tips: "安心包触客转化率",
},
{
name: "displayBatteryWarrantyRate",
label: "电池",
colStyle: "flex:1",
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
colStyle: "flex:1",
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2);margin-bottom:4px ",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2); margin-right:0; margin-bottom:4px",
isMore: true,
},
{
name: "displayBatteryAfterSalesRate",
label: "电池售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2);margin-bottom:4px ",
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2); margin-right:0; margin-bottom:4px",
isMore: true,
},
];
export const supervisorCommonSchemaList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "staffCount",
label: "管理驻店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "totalStoreCount",
label: "辖区门店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "yellowStoreCount",
label: "需关注门店",
col: 6,
style: "color: #FF9D0A;",
special: true,
},
{
name: "redStoreCount",
label: "预警门店",
col: 6,
style: "color: #F24724;",
special: true,
},
{
name: "displayTouchConversionRate",
label: "触客成交率",
colStyle: "flex: 0 auto;",
},
{
name: "displayPeaceOfMindRate",
label: "延保",
colStyle: "flex:1",
tips: "延保触客转化率",
},
{
name: "displayEquityProductRate",
label: "权益商品",
colStyle: "flex:1",
tips: "权益商品触客转化率",
},
{
name: "displayEquityRate",
label: "权益",
colStyle: "flex:1",
tips: "权益触客转化率",
},
{
name: "displayWarrantyAfterSalesRate",
label: "延保售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "权益商品售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayEquityAfterSalesRate",
label: "权益售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
{
name: "displayEquityAvgUnitPrice",
label: "权益平均客单价(元)",
colStyle: "width:50%",
isMore: true,
},
];
<template>
<van-pull-refresh v-model="list.loading"
class="pull-refresh-wrapper"
@refresh="handleResetList">
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs v-model="list.query.statDimension"
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div>
<div class="search-wrapper">
<SearchInput v-model="list.query.searchKeyword"
placeholder="搜索门店名称"
@input="throttledFilterSearchKeyword" />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
<div>
门店列表
</div>
<div class="region" @click="handleShowRegionPicker">
<span>筛选门店区域</span>
<SvgIcon color="#A2A6B1"
name="triangle-down"
size="16" />
</div>
</div>
<div :key="list.query.statDimension" class="container-wrapper">
<StatisticsItem v-for="(item, index) in list.data"
:key="index"
class="statistics-item"
:data="item"
:schema="list.query.statDimension === '1' ? options.supervisorSchemaList : options.supervisorCommonSchemaList"
:title="item.merchantName"
@tap="handleTapItem">
<template #sub-title="{ data }">
<div class="sub-title-wrapper">
<div class="staff-label">
{{ getStaffLength(data) }}名驻店人员
</div>
</div>
</template>
</StatisticsItem>
</div>
</div>
</van-pull-refresh>
</template>
<script>
import dayjs from "dayjs";
import { cloneDeep, throttle } from "lodash-es";
import { getRegionList } from "@/api/region";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import SvgIcon from "@/components/svgIcon/index.vue";
import { getStorePerformance } from "@/views/performance/api";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import { brandTypeList, staticInfoList } from "@/views/performance/constant/performance";
import BrandTabs from "../brandTabs/index.vue";
import { supervisorCommonSchemaList, supervisorSchemaList } from "./index.data";
export default {
name: "StorePerformance",
components: {
SvgIcon,
BrandTabs,
DatePicker,
DateTypeTabs,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
throttledFilterSearchKeyword: null,
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
supervisorCommonSchemaList,
regionList: [],
dateType: {
// "date" | "week" | "year-month"
0: "date",
1: "week",
2: "year-month",
},
},
list: {
loading: false,
statistics: {},
originData: [],
data: [],
query: {
dateType: 0,
statDimension: "1",
searchKeyword: "",
region: "",
date: {
startDayjs: dayjs(),
},
},
},
};
},
created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
},
async mounted() {
await this.getRegionOptions();
await this.getData();
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
},
methods: {
async getRegionOptions() {
const data = await getRegionList({});
console.log(data);
},
handleShowRegionPicker() {
},
getStaffLength(row) {
return row?.length || 0;
},
getItemSubTitle(rows) {
return rows?.storeList?.map(i => i.merchantName).join("、");
},
getQuery() {
return {
...this.list.query,
startDate: this.list.query.date.startDate,
endDate: this.list.query.date.endDate,
date: undefined,
};
},
async getData() {
this.$loading.show();
try {
this.list.data = [];
this.list.originData = [];
await this.$nextTick();
const data = await getStorePerformance(this.getQuery());
this.$set(this.list, "statistics", data?.statistics || {});
this.list.originData = cloneDeep(data.storeList);
this.list.data = this.afterGetData(data.storeList);
} finally {
this.$loading.hide();
}
},
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword() {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
async handleResetList() {
this.list.loading = true;
await this.getData();
this.list.loading = false;
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.pull-refresh-wrapper {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
width: 100%;
display: flex;
align-items: center;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
display: flex;
justify-content: space-between;
> .region {
color: #00000066;
}
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
.sub-title-wrapper {
.staff-label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: #00000066;
}
}
}
}
</style>
export const supervisorSchemaList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "staffCount",
label: "管理驻店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "totalStoreCount",
label: "辖区门店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "yellowStoreCount",
label: "需关注门店",
col: 6,
style: "color: #FF9D0A;",
special: true,
},
{
name: "redStoreCount",
label: "预警门店",
col: 6,
style: "color: #F24724;",
special: true,
},
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
colStyle: "flex: 0 auto;",
tips: "整车延保触客转化率",
},
{
name: "displayPeaceOfMindRate",
label: "安心包",
colStyle: "flex:1",
tips: "安心包触客转化率",
},
{
name: "displayBatteryWarrantyRate",
label: "电池",
colStyle: "flex:1",
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
colStyle: "flex:1",
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayBatteryAfterSalesRate",
label: "电池售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
];
export const supervisorCommonSchemaList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "staffCount",
label: "管理驻店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "totalStoreCount",
label: "辖区门店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "yellowStoreCount",
label: "需关注门店",
col: 6,
style: "color: #FF9D0A;",
special: true,
},
{
name: "redStoreCount",
label: "预警门店",
col: 6,
style: "color: #F24724;",
special: true,
},
{
name: "displayTouchConversionRate",
label: "触客成交率",
colStyle: "flex: 0 auto;",
},
{
name: "displayPeaceOfMindRate",
label: "延保",
colStyle: "flex:1",
tips: "延保触客转化率",
},
{
name: "displayEquityProductRate",
label: "权益商品",
colStyle: "flex:1",
tips: "权益商品触客转化率",
},
{
name: "displayEquityRate",
label: "权益",
colStyle: "flex:1",
tips: "权益触客转化率",
},
{
name: "displayWarrantyAfterSalesRate",
label: "延保售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "权益商品售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayEquityAfterSalesRate",
label: "权益售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
{
name: "displayEquityAvgUnitPrice",
label: "权益平均客单价(元)",
colStyle: "width:50%",
isMore: true,
},
];
<template>
<van-pull-refresh v-model="list.loading"
class="pull-refresh-wrapper"
@refresh="handleResetList">
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs v-model="list.query.statDimension"
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<!-- <div class="static-wrapper">
<StaticInfo :data="list.statistics" :list="options.staticInfoList" />
</div> -->
<div class="search-wrapper">
<SearchInput v-model="list.query.searchKeyword" @input="throttledFilterSearchKeyword" />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导列表
</div>
<div :key="list.query.statDimension" class="container-wrapper">
<StatisticsItem v-for="(item, index) in list.data"
:key="index"
class="statistics-item"
:data="item"
:schema="list.query.statDimension === '1' ? options.supervisorSchemaList : options.supervisorCommonSchemaList"
:sub-title="getItemSubTitle(item)"
:title="item.supervisorName"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</template>
<script>
import dayjs from "dayjs";
import { cloneDeep, throttle } from "lodash-es";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import { getSupervisorPerformance } from "@/views/performance/api";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import { brandTypeList, staticInfoList } from "@/views/performance/constant/performance";
import BrandTabs from "../brandTabs/index.vue";
import { supervisorCommonSchemaList, supervisorSchemaList } from "./index.data";
export default {
name: "PerformanceOverview",
components: {
BrandTabs,
DatePicker,
DateTypeTabs,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
throttledFilterSearchKeyword: null,
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
supervisorCommonSchemaList,
dateType: {
// "date" | "week" | "year-month"
0: "date",
1: "week",
2: "year-month",
},
},
list: {
loading: false,
originData: [],
data: [],
query: {
dateType: 0,
statDimension: "1",
searchKeyword: "",
date: {
startDayjs: dayjs(),
},
},
},
};
},
created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
},
async mounted() {
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
},
methods: {
getItemSubTitle(rows) {
return rows?.storeList?.map(i => i.merchantName).join("、");
},
getQuery() {
return {
...this.list.query,
startDate: this.list.query.date.startDate,
endDate: this.list.query.date.endDate,
date: undefined,
};
},
async getData() {
console.log("??");
this.$loading.show();
try {
this.list.data = [];
this.list.originData = [];
await this.$nextTick();
const list = await getSupervisorPerformance(this.getQuery());
this.list.originData = cloneDeep(list);
this.list.data = this.afterGetData(list);
} finally {
this.$loading.hide();
}
},
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword(list) {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
async handleResetList() {
this.list.loading = true;
await this.getData();
this.list.loading = false;
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.pull-refresh-wrapper {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
width: 100%;
display: flex;
align-items: center;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
}
}
</style>
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "1",
label: "问界鸿蒙-延保权益",
style: {
backgroundColor: "#fff",
},
},
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "2",
label: "通用品牌-延保权益",
style: {
backgroundColor: "#fff",
},
},
];
export const staticInfoList = [
{
key: "greenStoreCount",
background: "linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)",
label: "达标门店数",
},
{
key: "yellowStoreCount",
background: "linear-gradient(90deg, #7552FF 0%, #977DFF 100%)",
label: "需关注门店数",
},
{
key: "redStoreCount",
background: "linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)",
label: "预警门店数",
},
];
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "0",
label: "问界鸿蒙-延保权益",
style: {
backgroundColor: "#fff",
},
},
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "1",
label: "通用品牌-延保权益",
style: {
backgroundColor: "#fff",
},
},
];
export const staticInfoList = [
{
key: "",
background: "linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)",
label: "达标门店数",
},
{
key: "",
background: "linear-gradient(90deg, #7552FF 0%, #977DFF 100%)",
label: "需关注门店数",
},
{
key: "",
background: "linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)",
label: "预警门店数",
},
];
export const supervisorSchemaList = [
{
name: "brandType",
label: "总产值",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "交付数",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "触客数",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "整车延保",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "安心包",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "电池",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "轮胎",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "整车延保售后成交/总成交",
col: 12,
isMore: true,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "安心包售后成交/总成交",
col: 12,
isMore: true,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "电池售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "brandType",
label: "轮胎售后成交/总成交",
col: 12,
isMore: true,
},
];
<template> <template>
<div class="page-container" :style="{ backgroundImage: `url(${pageBgUrl})` }"> <div class="page-container"
<van-pull-refresh v-model="list.loading" lazy-render
@refresh="handleResetList"> :style="{ backgroundImage: `url(${pageBgUrl})` }">
<van-tabs> <van-tabs animated>
<van-tab title="督导业绩" /> <van-tab title="督导业绩">
<van-tab title="门店业绩" /> <SupervisorTabItem />
</van-tabs> </van-tab>
<div class="filter-wrapper"> <van-tab title="门店业绩">
<div class="brand-filter"> <StoreTabItem />
<BrandTabs :list="options.brandTypeList" /> </van-tab>
</div>
<div class="date-filter">
<DateSearch show-date-type-filter
:is-sticky="false"
:tab-selected="3"
@search="search">
</DateSearch>
</div>
<div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div>
<div class="search-wrapper">
<SearchInput />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导列表
</div>
<div class="container-wrapper">
<StatisticsItem v-for="(item, index) in 10"
:key="index"
class="statistics-item"
:schema="options.supervisorSchemaList"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</van-tabs>
</div> </div>
</template> </template>
<script> <script>
import DateSearch from "@/components/dateSearch/dateSearch.vue"; import StoreTabItem from "../components/storeTabItem";
import SearchInput from "@/components/searchBar/index.vue"; import SupervisorTabItem from "../components/supervisorTabItem";
import StaticInfo from "@/components/staticInfo/index.vue";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import BrandTabs from "../components/brandTabs/index.vue";
import { brandTypeList, staticInfoList, supervisorSchemaList } from "./index.data";
export default { export default {
name: "PerformanceOverview", name: "PerformanceOverview",
components: { components: {
BrandTabs, SupervisorTabItem,
DateSearch, StoreTabItem,
StaticInfo,
SearchInput,
StatisticsItem,
}, },
data() { data() {
return { return {
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png", pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
},
list: {
loading: false,
data: [],
},
}; };
}, },
methods: { created() {
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
}, },
handleResetList() { async mounted() {
this.list.loading = true;
setTimeout(() => {
this.list.loading = false;
}, 3000);
}, },
search() {}, methods: {
}, },
}; };
</script> </script>
...@@ -100,14 +47,11 @@ export default { ...@@ -100,14 +47,11 @@ export default {
background-color: #f2f3f7; background-color: #f2f3f7;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
::v-deep .van-pull-refresh {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
::v-deep .van-tabs { ::v-deep .van-tabs {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
.van-tab { .van-tab {
flex: none; flex: none;
font-weight: 500; font-weight: 500;
...@@ -121,11 +65,19 @@ export default { ...@@ -121,11 +65,19 @@ export default {
&--active { &--active {
color: var(--themeColor); color: var(--themeColor);
} }
&__pane {
height: 100%;
overflow-y: hidden;
}
} }
&__wrap { &__wrap {
background-color: transparent; background-color: transparent;
padding: 0 12px; padding: 0 12px;
} }
&__content {
flex: 1;
overflow: hidden;
}
&__nav { &__nav {
background-color: transparent; background-color: transparent;
} }
...@@ -134,49 +86,5 @@ export default { ...@@ -134,49 +86,5 @@ export default {
width: 18px; width: 18px;
} }
} }
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
}
}
} }
</style> </style>
...@@ -44,7 +44,6 @@ import SearchInput from "@/components/searchBar/index.vue"; ...@@ -44,7 +44,6 @@ import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue"; import StaticInfo from "@/components/staticInfo/index.vue";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue"; import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import BrandTabs from "../../components/brandTabs/index.vue"; import BrandTabs from "../../components/brandTabs/index.vue";
import { brandTypeList, staticInfoList, supervisorSchemaList } from "../index.data";
export default { export default {
name: "PerformanceOverview", name: "PerformanceOverview",
...@@ -59,9 +58,9 @@ export default { ...@@ -59,9 +58,9 @@ export default {
return { return {
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png", pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: { options: {
brandTypeList, brandTypeList: [],
staticInfoList, staticInfoList: [],
supervisorSchemaList, supervisorSchemaList: [],
}, },
list: { list: {
loading: false, loading: false,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
const path = require("node:path"); const path = require("node:path");
const defaultSettings = require("./src/config/conf.js"); const defaultSettings = require("./src/config/conf.js");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const resolve = dir => path.join(__dirname, dir); const resolve = dir => path.join(__dirname, dir);
const iconsPath = resolve("src/assets/icons"); const iconsPath = resolve("src/assets/icons");
...@@ -37,18 +38,14 @@ module.exports = { ...@@ -37,18 +38,14 @@ module.exports = {
lintOnSave: false, lintOnSave: false,
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: { devServer: {
disableHostCheck: true, client: {
port: 9527, // 端口 dj-scrm-wx-work-lwk
// port: 9528, // 端口 dj-scrm-wx-work-main-lwk
open: false, // 启动后打开浏览器.
// public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-zhangls/#/',
overlay: { overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false, warnings: false,
errors: true, errors: true,
}, },
},
port: 9527, // 端口 dj-scrm-wx-work-lwk
allowedHosts: "all", // 允许所有 Host,解决 WebSocket Invalid Host 错误
// proxy: { // proxy: {
// //配置跨域 // //配置跨域
// '/api': { // '/api': {
...@@ -77,7 +74,7 @@ module.exports = { ...@@ -77,7 +74,7 @@ module.exports = {
scss: { scss: {
// 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀 // 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀
// 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders // 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders
prependData: ` additionalData: `
$cdn: "${defaultSettings.cdn}"; $cdn: "${defaultSettings.cdn}";
`, `,
}, },
...@@ -86,7 +83,9 @@ module.exports = { ...@@ -86,7 +83,9 @@ module.exports = {
configureWebpack: (config) => { configureWebpack: (config) => {
config.name = name; config.name = name;
config.resolve.modules = ["node_modules", "./src/assets/spritesmith"]; config.resolve.modules = ["node_modules", "./src/assets/spritesmith"];
const Plugins = [ const Plugins = [
new CaseSensitivePathsPlugin(),
new SpritesmithPlugin({ new SpritesmithPlugin({
// 引入图片文件夹 // 引入图片文件夹
src: { src: {
...@@ -160,13 +159,18 @@ module.exports = { ...@@ -160,13 +159,18 @@ module.exports = {
// .set('plugins', resolve('src/components')) // .set('plugins', resolve('src/components'))
// .set('utils', resolve('src/utils')) // .set('utils', resolve('src/utils'))
/** /**
* 设置保留空格 * 设置保留空格 - 删除 thread-loader 避免 Vue 2.7 兼容性问题
*/ */
config.module config.module
.rule("vue") .rule("vue")
.uses
.clear()
.end()
.use("vue-loader") .use("vue-loader")
.loader("vue-loader") .loader("vue-loader")
.tap((options) => { .tap((options) => {
options = options || {};
options.compilerOptions = options.compilerOptions || {};
options.compilerOptions.preserveWhitespace = true; options.compilerOptions.preserveWhitespace = true;
return options; return options;
}) })
...@@ -183,19 +187,9 @@ module.exports = { ...@@ -183,19 +187,9 @@ module.exports = {
} }
config config
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool("cheap-source-map")); .when(!IS_PROD, config => config.devtool("cheap-module-source-map"));
config.when(IS_PROD, (config) => { config.when(IS_PROD, (config) => {
config
.plugin("ScriptExtHtmlWebpackPlugin")
.after("html")
.use("script-ext-html-webpack-plugin", [
{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/,
},
])
.end();
config.optimization.splitChunks({ config.optimization.splitChunks({
chunks: "all", chunks: "all",
cacheGroups: { cacheGroups: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!