Commit a6765c90 by 张立顺

Merge branch 'SAAS+V5.8.2' into SAAS+V5.8.2_zls

2 parents f6be5deb 3778fa08
Showing 154 changed files with 2078 additions and 1063 deletions
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
## API规范
调用接口时:
* 优先复用现有 API
* 使用项目已有 axios 封装
* 保持统一错误处理
不要直接创建新的请求框架。
## 调试规范
发现问题时:
### 第一步
阅读相关代码:
* 页面
* API
* Vuex
* Router
先理解逻辑再修改。
---
### 第二步
定位问题原因。
不要通过不断试错碰运气修复问题。
---
### 第三步
如果连续两次修改仍未解决:
必须进入系统化分析模式:
1. 分析可能根因
2. 提出验证方案
3. 给出至少3种解决方案
4. 分析优缺点
5. 推荐最终方案
## 表单规范
新增业务表单优先使用:
```text
glsx-combi-form
```
适用场景:
* 新增页面
* 编辑页面
* 弹窗表单
仅在无法满足需求时使用:
```text
el-form
```
并说明原因。
# Git Commit Message 规范
生成 commit message 时必须遵循 **Conventional Commits 规范**。
* 使用中文输出 commit message
# Jest 单元测试实战指南
## 适用场景
本规范适用于 Vue 2 + Jest 项目的单元测试编写,特别是处理复杂依赖链的模块。
---
## 一、核心 Mock 模式(必须遵守)
### 1. 测试文件标准模板
```javascript
/**
* 测试文件头部 - 按顺序执行
*/
// 第 1 步:定义 mock 函数
const mockRequest = jest.fn();
const mockRequestMethods = { POST: 'POST', GET: 'GET' };
// 第 2 步:在导入被测试模块前,用 jest.mock() 提前 mock 所有依赖
jest.mock('@/api/request', () => mockRequest);
jest.mock('@/api/request.methods', () => mockRequestMethods);
// Mock API 模块(如需)
const mockXxxApi = jest.fn();
jest.mock('@/path/to/api', () => ({
xxxApi: mockXxxApi,
}));
// 第 3 步:mock 之后才用 require() 导入被测试模块
const { func1, func2 } = require('./xxx.js');
// 第 4 步:开始编写测试
describe('xxx 测试', () => {
beforeEach(() => {
jest.clearAllMocks(); // 每次测试前重置 mock
});
it('应该...', () => {
// Arrange
mockXxxApi.mockResolvedValue(expectedData);
// Act
const result = await func1();
// Assert
expect(result).toEqual(expectedData);
});
});
```
### 2. 为什么用 require() 而不是 import?
`jest.mock()` 是 hoisted 的,但 ES Module 的 `import` 也是 hoisted 的,这会导致依赖在 mock 之前就被加载。使用 `require()` 可以确保在 mock 之后才加载模块。
---
## 二、Jest 配置清单
### jest.config.js 必要配置
```javascript
module.exports = {
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
transform: {
'^.+\\.vue$': '@vue/vue2-jest',
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(lodash-es|nanoid|flex.css|dayjs)/)',
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'\\.css$': 'jest-transform-stub',
'^@/plugin/d2admin/(.*)$': '<rootDir>/jest.mocks/d2admin.js',
'^@/assets/svg-icons/index.js$': '<rootDir>/jest.mocks/svg-icons-index.js',
'^@/assets/svg-icons$': '<rootDir>/jest.mocks/svg-icons-index.js',
'^@/api/request$': '<rootDir>/jest.mocks/request.js',
'^@/main$': '<rootDir>/jest.mocks/main.js',
'^@/main.js$': '<rootDir>/jest.mocks/main.js',
},
testURL: 'http://localhost/',
testEnvironment: 'jsdom',
setupFiles: ['<rootDir>/jest.setup.js'],
};
```
### jest.setup.js 必要配置
```javascript
// 初始化 dayjs(避免 locale 插件加载失败)
const dayjs = require('dayjs');
dayjs.locale('en');
// mock require.context (Webpack 特有,Jest 不支持)
if (!global.require.context) {
global.require.context = (() => {
return { keys: () => [] };
});
}
```
---
## 三、常见依赖链问题
### 问题场景
当被测试模块有以下依赖链时:
```
table.data.js
→ api/index.js
→ @/api/request
→ @/main
→ @/plugin/d2admin
→ @/assets/svg-icons
```
### 解决方案
1. 在 `jest.config.js` 的 `moduleNameMapper` 中映射所有可能缺失的依赖
2. 在测试文件顶部用 `jest.mock()` 提前 mock 关键依赖
3. 使用 `require()` 在 mock 之后导入被测试模块
---
## 四、陷阱与解决方案
| 问题 | 错误信息 | 解决方案 |
|------|----------|----------|
| require.context 未定义 | `require.context is not a function` | 在 `jest.setup.js` 中全局 mock |
| dayjs locale 失败 | `_.locale is not a function` | 在 `jest.setup.js` 中初始化 dayjs |
| CSS 文件无法解析 | `SyntaxError: Unexpected token '{'` | `moduleNameMapper` 映射到 `jest-transform-stub` |
| 测试断言字符不匹配 | `"张三,李四" vs "张三,李四"` | 断言必须与源代码字符**完全一致**(注意中英文标点) |
| 函数参数类型错误 | 返回 `undefined` | 检查函数接收的是对象还是原始值 |
| 依赖链断裂 | `Cannot find module '@/xxx'` | 完整 mock 体系 + `moduleNameMapper` |
### 字符匹配特别注意
源代码使用英文逗号 `,`,测试断言不能用中文逗号 `,`:
```javascript
// 源代码
.join(',') // 英文逗号
// 错误
expect(result).toBe('张三,李四'); // 中文逗号
// 正确
expect(result).toBe('张三,李四'); // 英文逗号
```
---
## 五、Mock 文件模板
### jest.mocks/request.js
```javascript
// Mock @/api/request
module.exports = jest.fn();
```
### jest.mocks/main.js
```javascript
// Mock @/main
module.exports = {
baseConfig: {},
};
```
### jest.mocks/d2admin.js
```javascript
// Mock @/plugin/d2admin
module.exports = {};
```
### jest.mocks/svg-icons-index.js
```javascript
// Mock @/assets/svg-icons/index.js
module.exports = {};
```
---
## 六、测试文件结构
### 单元测试 (`*.spec.js`)
- 存放位置:与被测文件**同一目录**
- 测试原则:只关注单一组件/函数的隔离逻辑
- 使用 `jest.mock()` 隔离外部依赖
### 集成测试 (`*.integration.spec.js`)
- 存放位置:**Feature 根目录**
- 测试原则:测试多个模块之间的联动
- 验证常量、API、数据层之间的数据流一致性
---
## 七、测试命令
```bash
# 运行单个模块的测试
npm run test:unit -- 路径/到/模块
# 运行所有测试
npm run test:unit
# 监听模式(文件改动自动重跑)
npm run test:unit -- --watch
```
---
## 八、AAA 模式示例
```javascript
describe('getTableFormSchema', () => {
it('应该返回一个数组', async () => {
// Arrange - 准备数据
mockGetTaskCenterBizCategoryListApi.mockResolvedValue([]);
// Act - 执行操作
const schema = await getTableFormSchema();
// Assert - 断言结果
expect(Array.isArray(schema)).toBe(true);
});
});
```
---
## 九、内存泄露防护
```javascript
// 组件测试必须在 afterEach 中销毁实例
afterEach(() => {
wrapper.destroy();
jest.clearAllMocks();
});
```
---
## 十、异步处理
```javascript
// 事件触发后影响 DOM 的情况,必须等待 nextTick
await wrapper.vm.$nextTick();
await localVue.nextTick();
```
---
## 快速检查清单
创建新测试文件前检查:
- [ ] 已在测试文件顶部定义 mock 函数
- [ ] 已用 `jest.mock()` 提前 mock 所有依赖
- [ ] 已用 `require()` 导入被测试模块
- [ ] `jest.config.js` 已配置 `moduleNameMapper`
- [ ] `jest.setup.js` 已配置全局 mock
- [ ] 测试断言的字符与源代码完全一致
- [ ] `afterEach` 中调用了 `wrapper.destroy()`(组件测试)
- [ ] 异步操作使用了 `nextTick()`
# Language
默认使用 **简体中文** 输出,包括:
- Git commit message
- Pull Request 描述
- 代码解释
- 技术说明
只有在代码注释或特殊要求时才使用英文。
## AI协作规范
与用户沟通时:
* 使用中文
* 简洁清晰
* 面向业务结果
避免:
* 堆砌术语
* 长篇理论分析
* 无关架构讨论
解释问题时:
向“不懂代码但逻辑清晰的人”解释。
## 本地开发规范
常用命令:
```bash
npm run dev
npm run start
npm run lint
npm run test:unit
```
默认不要执行:
```bash
npm run build
```
仅在:
* 用户明确要求
* 排查构建问题
时执行。
## 路由规范
遵循现有:
```text
router/modules
```
结构。
权限控制与动态路由逻辑保持一致。
不要创建第二套路由体系。
## 状态管理
使用:
```text
Vuex Modules
```
保持与现有 store 结构一致。
不要新增 Pinia。
# dj-car-life-system 项目测试指南
## 测试命令
```bash
# 单元测试
npm run test:unit -- tests/unit/xxx.spec.js
# E2E 测试 (需先安装 Playwright)
npm install -D @playwright/test
npx playwright install
npx playwright test tests/e2e/xxx.spec.js
```
---
# 核心规范(必须严格遵守)
## 1. 测试分类与文件存放规范
请根据我的要求,将测试严格分类,并【在回复中明确指出该测试文件应该存放的路径】:
* 【单元测试 (Unit Test)】
- 命名格式:`*.spec.js`
- 存放位置:必须与被测文件在【同一级目录】(就近原则)。如果是组件,和 `.vue` 放在一起;如果是纯函数或 Vuex 逻辑,和原文件放在一起。
- 测试原则:只关注单一组件/函数的隔离逻辑。使用 `shallowMount` 挂载组件,隔离子组件。
* 【集成测试 (Integration Test)】
- 命名格式:`*.integration.spec.js`
- 存放位置:必须存放在该功能的【Feature 根目录下】(如 `src/features/shopping-cart/ShoppingCart.integration.spec.js`)。
- 测试原则:测试多个组件、子组件与当前 Feature 专属 Vuex Module 的联动。使用 `mount` 进行完整挂载,需要 mock 网络请求(如 msw 或 jest.mock)。
* 【E2E 测试 (End-to-End Test)】
- 命名格式:`*.e2e.js`
- 存放位置:必须独立于 src,统一存放在项目根目录的 【`/e2e`】 文件夹下。
- 测试原则:站在真实用户视角测试完整业务流,不涉及任何 Vue 内部实现细节。
## 2. Vue 2 测试代码编写守则
* 【内存泄露防护】:在单测和集成测试的 `afterEach` 钩子中,必须调用 `wrapper.destroy()` 销毁实例。
* 【异步处理】:遇到事件触发、数据改变后影响 DOM 的情况,必须使用 `await localVue.nextTick()` 或 `await wrapper.vm.$nextTick()`。
* 【Vuex 注入】:如果组件依赖 Vuex,必须使用 `createLocalVue()` 并注入对应的局部 store module,禁止直接污染全局 store。
* 【测试用例结构】:遵循 AAA 模式(Arrange 准备数据, Act 执行操作, Assert 断言结果)。描述性文字(`describe`, `it`)要清晰表达业务意图。
---
# 你的下一步输出
请根据我接下来提供给你的代码,输出以下内容:
1. 💡 这是一个 [单元测试 / 集成测试 / E2E 测试]。
2. 📂 推荐的文件存放路径是:`[具体路径/文件名]`
3. 📝 测试代码:[具体的测试代码]
### E2E 测试 (End-to-End Tests)
存放位置:放在项目根目录的 e2e/ 文件夹下。
原因:Vue 2 官方早期推荐的 vue-cli 工具链(如 Cypress 或 Nightwatch 插件)默认也会在根目录生成 tests/e2e。由于 E2E 模拟的是真实用户在浏览器里点来点去,它会经历“登录 -> 个人中心 -> 购物车 -> 结账”一整套完整业务,无法归属于任何一个单一的 feature 目录,所以必须独立出来。
## 已修改的配置文件
- `jest.config.js` - 添加了 transformIgnorePatterns
- `package.json` - 修复了 test:unit 脚本,添加了 test:unit:legacy
- `playwright.config.js` - 新增 E2E 测试配置
## UI规范
### UI框架
统一使用:
* Element UI
* D2Admin
新增页面需要保持:
* 间距一致
* 表单风格一致
* 表格风格一致
* 弹窗风格一致
不要引入新的大型UI框架。
File mode changed
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
---
## 项目概述
嘀加智享车生活后台管理系统 (SAAS+) - 基于 Vue 2 + Element UI + D2Admin 的企业级后台管理系统
## 技术栈
| 类别 | 技术 |
|------|------|
| 核心框架 | Vue 2.6.10 + Vue Router 3.0.5 + Vuex 3.0.1 |
| UI 组件 | Element UI 2.13.2 + D2Admin |
| 构建工具 | Vue CLI 5.0.8 + Webpack 5 |
| Node 版本 | 14.21.3 (volta 配置) |
## 开发命令
```bash
# 开发启动
npm run dev # 或 npm run start (兼容旧 OpenSSL)
# 单元测试
npm run test:unit -- tests/unit/xxx.spec.js
npm run test:unit:legacy -- tests/unit/xxx.spec.js # legacy 模式
# E2E 测试
npx playwright test tests/e2e/xxx.spec.js
# 构建
npm run build
npm run build:nomock # 无 Mock 构建
# 代码检查
npm run lint
```
## 常见问题解决
### OpenSSL 参数问题
```bash
# 错误:--openssl-legacy-provider is not allowed in NODE_OPTIONS
# 解决:直接运行或使用 npx
npx vue-cli-service test:unit
npm run test:unit # 已移除 openssl 参数
```
### ES 模块转换问题
```bash
# 错误:SyntaxError: Unexpected token 'export' (lodash-es/nanoid)
# 已在 jest.config.js 配置 transformIgnorePatterns
```
### 测试相关
- Mock API: `jest.mock("@/api/xxx", () => ({ xxxApi: jest.fn() }))`
- 组件测试使用 `shallowMount` + stub 自定义指令
- Mixin inject 问题:`provide: { formContext: null }`
## 代码结构
```
src/
├── api/ # API 接口层 (按业务模块划分)
├── views/ # 页面视图 (24 个业务模块)
├── components/ # 公共组件 (d2-* 系列)
├── router/modules/ # 路由模块 (权限 902-921)
├── store/modules/ # Vuex 模块 (d2admin + 业务模块)
├── plugin/d2admin/ # D2Admin 核心插件
├── common/ # 公共业务逻辑
└── libs/ # 工具库
```
## 业务模块
| 编号 | 模块 | 编号 | 模块 |
|------|------|------|------|
| 902 | 流量管理 | 912 | 驻店管理 |
| 903 | 产品管理 | 913 | 内容管理 |
| 904 | 订单管理 | 914 | 积分管理 |
| 905 | 财务管理 | 915 | 预警管理 |
| 906 | 系统设置 | 916 | 大模型 |
| 907 | 首页 | 917 | 发票管理 |
| 908 | 库存管理 | 918 | 话术管理 |
| 909 | 采购管理 | 919 | 服务中心 |
| 910 | 权益管理 | 920 | 二手车管理 |
| 911 | 车损管理 | 921 | 销售管理 |
## 架构特点
1. **动态路由** - 基于权限的路由和菜单生成
2. **统一 API 层** - 按业务模块划分,统一签名/鉴权机制
3. **D2Admin 封装** - d2-container/d2-table/d2-form 等组件
4. **多环境配置** - .env + .env.development + .env.nomock
## 环境地址
- 开发:http://192.168.3.233:8090/saas_plus/dj-car-life-system
- 测试:http://frontend.test.glsx.com.cn/dj-carlife-web/
- 生产:http://dj.glsx.com.cn/dj-carlife-web/
## 分支管理
主干:`master` / `develop`
# dj-car-life-system 项目测试指南
## 测试命令
```bash
# 单元测试
npm run test:unit -- tests/unit/xxx.spec.js
# E2E 测试 (需先安装 Playwright)
npm install -D @playwright/test
npx playwright install
npx playwright test tests/e2e/xxx.spec.js
```
---
## 常见问题与解决方案
### 问题 1: --openssl-legacy-provider is not allowed in NODE_OPTIONS
**错误信息:**
```
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
npm ERR! code ELIFECYCLE
```
**原因:** Node.js 18+ 不允许通过 NODE_OPTIONS 设置该参数,但项目 volta 配置使用 Node.js 14
**解决方案:**
```bash
# 方案 1: 直接运行(已更新 package.json)
npm run test:unit -- tests/unit/xxx.spec.js
# 方案 2: 使用 npx
npx vue-cli-service test:unit tests/unit/xxx.spec.js
# 方案 3: legacy 模式(某些旧依赖需要)
npm run test:unit:legacy -- tests/unit/xxx.spec.js
```
### 问题 2: Cannot find module 'babel-jest'
**解决方案:**
```bash
npm install --save-dev babel-jest@^27.5.1
```
### 问题 3: SyntaxError: Unexpected token 'export' (lodash-es/nanoid)
**原因:** ES 模块未被 Jest 转换
**解决方案:** 在 `jest.config.js` 添加:
```javascript
transformIgnorePatterns: [
'node_modules/(?!(lodash-es|nanoid)/)'
],
```
### 问题 4: Failed to resolve directive: loading
**解决方案:** 测试中 stub 指令
```javascript
directives: {
loading: { bind() {}, update() {} },
},
```
### 问题 5: mixin inject 导致无法挂载组件
**解决方案:** 测试中提供 provide
```javascript
provide: { formContext: null },
```
### 问题 6: Cannot read properties of undefined (reading 'detailList')
**原因:** 测试数据缺少必要字段
**解决方案:** 确保测试数据包含完整结构
```javascript
{
productType: 1,
productName: "测试商品",
detailList: [{ goodsAlias: "别名" }], // 必须包含
// ...其他字段
}
```
---
## 已修改的配置文件
- `jest.config.js` - 添加了 transformIgnorePatterns
- `package.json` - 修复了 test:unit 脚本,添加了 test:unit:legacy
- `playwright.config.js` - 新增 E2E 测试配置
## 测试文件位置
- `tests/unit/` - 单元测试
- `tests/e2e/` - E2E 测试
- `tests/README.md` - 详细测试文档
# CodeGraph data files
# These are local to each machine and should not be committed
# Database
*.db-wal
*.db-shm
# Cache
cache/
# Logs
*.log
# Hook markers
.dirty
This file is too large to display.
# dj-car-life-system — Cursor / AI 工作区规则
## 项目与本仓库技术栈(唯一事实)
- **项目名称**:`dj-car-life-system`
- **产品形态**:嘀加智享车生活 **Web 管理后台 SPA**,与**微信小程序工程、小程序原生 API 无关**。不要按小程序目录或分包去设计功能。
- **构建**:Vue CLI 5(`vue-cli-service`),Webpack 打包;本地常用 `npm run serve` / `npm run start`。
- **核心依赖**:Vue **2.6**,**Vue Router 3**,**Vuex 3**,**Element UI 2**,**axios**(及项目既有封装如 `glsk-toolkit` 等)。
- **工程语言**:主体为 **JavaScript**,与现有 `.vue`、`src/store`、`src/router` 保持一致。**不要默认**把整个项目改写为 Vue 3 / Pinia / `<script setup>` / 全仓库 TypeScript,除非仓库已明确迁移且用户提出要求。
- **UI 与框架**:沿用 **Element UI** 与 **`d2admin` 插件体系**(见 `src/plugin/d2admin`),新页面样式与全局布局应与现有后台一致。
- **非本仓库技术栈**:**Next.js / App Router / React** 等不适用;勿在方案中预设这些栈。
编写新代码时以 **Vue 2 单文件组件(SFC)**、**Options API**(`export default { … }`)为主,Vuex **模块化**、`store.modules`、路由模块化与 **`src/router`、`src/store`** 现有写法对齐。
Vue 能力与习惯用法参见 [Vue 2 文档](https://v2.cn.vuejs.org/)(中文版),勿以 Vue 3 独有 API(如 Composition API/`ref()` 作为必选规范)为主线。
# 角色与协作方式
你是精通 Vue 2 与中后台开发的工程师,以帮助业务侧完成本后台需求为目标;表达清晰易懂,但不要为了「炫技」而引入与仓库不一致的技术。
# Goal
在用户提出需求后,主动推进需求澄清、方案与实现,尽量减少无效往返。
在理解需求、编写代码和解决问题时,遵循下面**统一的一条流程**,避免多套重复条目。
---
## 第一步:熟悉上下文
- 先阅读项目根目录 **README.md** 与相关代码,理解目标、模块划分和既有实现。
- 若 README 缺失重要说明且用户需要,可补充;**不要**仅为满足规则而大面积改写 README(用户另有要求时除外)。
# 本规则由 AI进化论-花生 创建,版权所有,引用请注明出处
---
## 第二步:需求与实现
### 理解需求
- 站在业务与最终用户角度理解;若存在歧义,用产品化方式追问,补全验收条件。
- 在满足需求的前提下,优先**最简单、可维护**的实现,并与本仓库风格一致。
### 编写代码
- 使用 Vue 2 SFC,组件化拆分;路由与导航、权限与现有 `router` 逻辑一致。
- 使用 **Vuex 3** 管理跨页状态,按模块组织;与 `d2admin`、现有 `store/modules` 模式一致。
- 网络请求使用项目已有 **axios** 封装与工具,不引入与后台无关的「小程序式」请求假设。
- 样式与响应式:管理后台以桌面端为主,与现有 Element + 布局习惯一致;新增页面注意与全局主题、表格/表单规范统一。
- 注释与错误处理:对非显而易见处写清意图;关键请求与用户操作保留必要错误提示(与项目现有 `Message` 等用法一致)。
### 解决问题
- 先通读相关文件,定位原因后再改。
- 善用浏览器 DevTools 与 **Vue DevTools**(Vue 2)排查。
- **当一个 bug 经过两次调整仍未解决时,启动「系统二」思考模式**:
1. 系统性分析可能根因
2. 列出可验证的假设与验证步骤
3. 给出**三种**可行方案,并说明各自优缺点
4. 由用户或场景选择最终方案
---
## 第三步:收尾
- 简要回顾改动与风险点;若涉及可复用模式,可提示后续优化方向(非强制摊派任务)。
---
## 架构与习惯(本仓库内)
1. 未说明技术栈时,**默认即本仓库栈**(Vue 2 + Vue Router 3 + Vuex 3 + Element UI + Vue CLI),不要引入 Next.js / React / 小程序原生作为默认方案。
2. 尽量复用现有目录与抽象,避免重复造轮子;功能块宜按现有习惯拆到独立文件。
3. 尽量不让用户为单次需求安装与项目无关的新运行时或大规模换栈。
## 设计要求
1. 管理后台界面与现有 Element 风格、间距与信息层级保持一致;避免与整站 UI 突兀的「另起一套」。
2. 需要图标时,优先与项目现有 icon/svg 体系一致;必要时可用简洁 SVG。
## 对话风格
1. 先理解用户要达成的结果,必要时追问关键细节。
2. 需求不清时,用简短问题收敛范围。
3. 完成后可客观补充**可选**的后续优化点,不强制。
## 本项目(dj-car-life-system)本地开发约定
- 本地开发**不要自动执行 `npm run build`**(生产构建耗时长,且非日常调试必需)。
- 验证改动优先:本地 **`npm run serve`**(或 `npm run start` / `npm run dev`,见 `package.json`)/ 在 IDE 中看报错;仅当用户明确要求打包、或需排查构建问题时再运行 `npm run build`。
# DJ Car Life System - AI Agent Instructions
## Project Overview
嘀加智享车生活后台系统是一个大型Vue 2企业管理后台系统,涵盖车主生活管理、订单管理、财务清分、员工管理等多个业务领域。支持多个API网关和签名方案。
## Architecture Essentials
### Tech Stack
- **Frontend**: Vue 2.6 + Vue Router 3.0 + Vuex 3.0
- **UI Framework**: Element UI 2.13
- **Build**: Vue CLI 5 + Webpack 5 + Babel
- **HTTP**: Axios with custom signing layer
- **State Management**: Vuex with d2admin framework module
- **Node Version**: 14.21.3
### Project Structure
```
src/
├── api/ # API layer with custom request signing (~50+ service files)
├── views/ # 23+ feature modules (financeManage/, salesManagement/, etc.)
├── router/ # Dynamic route loading with permission checks
├── store/ # Vuex modules (d2admin, goodsInfoData, FinancialRules)
├── common/ # Shared utilities & configs (baseConfig.js, util.js, format.js)
├── components/ # Reusable UI components
├── plugin/ # Core plugins (d2admin framework, axios, error handling)
└── assets/ # Style, SVG icons, localization resources
```
## Critical Development Patterns
### 1. API Request Layer Architecture
The system uses a **custom ROP (Request-Over-Protocol) gateway pattern** with multiple API endpoints:
```javascript
// Each API file (api/account.js, api/orderManage.js, etc.) follows:
import request from './request'
const path = 'dj.api.smartcarlife.'
export function getListApi(data) {
data.method = `${path}orderDivision.page` // Service method name
return request(data, 'post')
}
```
**Key Points**:
- `data.method` determines which backend service is invoked (not the URL)
- `request()` in [src/api/request.js](src/api/request.js) handles:
- API routing via `baseConfig[apiName]` mappings (axios, axios2-10, axios_strategy)
- Request signing (SHA1/MD5) based on method prefix
- Session token injection from cookies
- Multiple API gateways: dj, scrm, merchants, reportExport, riskmanage, strategy
### 2. Multi-Gateway Routing
[src/api/request.js#L18-L66](src/api/request.js#L18-L66) contains the routing logic:
- `dj.api.smartcarlife.*` → axios (main gateway)
- `dj.api.script.*` → axios7 (script service)
- `risk.manage.api.*` → axios10 (risk management)
- `scrm.api.shopmall.*` → axios2 (SCRM shopping)
- Each maps to different `appkey/secret` in [src/common/baseConfig.js](src/common/baseConfig.js)
### 3. State Management
Vuex store structure ([src/store/modules/](src/store/modules/)):
- **d2admin**: Main framework state (page navigation, auth, search, themes)
- **goodsInfoData**: Product information shared across modules
- **FinancialRules**: Financial configuration rules
- **performanceFormStore**: Resident management performance data
Access pattern: `this.$store.dispatch('d2admin/page/currentSet', path)`
### 4. Router & Permission System
[src/router/index.js](src/router/index.js):
- Dynamic route loading from Vuex auth state
- Router guards intercept all navigation (`router.beforeEach`)
- NProgress bar shows loading state
- Permission source comes from `store.state.d2admin.auth.source`
### 5. View Module Organization
Features live in [src/views/](src/views/) folders with encapsulated patterns:
```
views/
├── financeManage/ # Financial clearing & reconciliation
├── salesManagement/ # Sales dashboards & analytics
├── orderManage/ # Order lifecycle management
├── residentManage/ # Resident info & performance tracking
├── goods/ # Product management & SKU
└── invoiceManage/ # Invoice generation & tracking
```
Each module can have local stores, components, and APIs.
## Build & Development Workflow
### Commands
```bash
npm run dev # Local development (with --openssl-legacy-provider flag)
npm run build # Production build
npm run build:nomock # Build without mock data
npm run lint # ESLint fix
npm run test:unit # Jest unit tests
npm run report # Build with webpack report
```
### Configuration
- **Base path**: `/dj-carlife-web/` (set in [vue.config.js](vue.config.js))
- **CDN**: https://img02.glsx.com.cn/dj-carlife-web for assets
- **Mock support**: Via [src/mock/d2-mock/](src/mock/d2-mock/) (mockjs-based)
- **Sentry integration**: Error tracking in production only
## Code Patterns & Conventions
### Export Functions from API Files
Always use named exports with `Api` suffix:
```javascript
export function getListApi(data) { ... } // List endpoints
export function getDetailApi(data) { ... } // Detail/fetch
export function updateXxxApi(data) { ... } // Create/update
export function deleteXxxApi(data) { ... } // Delete
export function exportXxxApi(data) { ... } // Export to Excel
```
### View Component Structure
```vue
<template>
<!-- Element UI components: el-table, el-dialog, el-form -->
</template>
<script>
import * as accountApi from '@/api/account'
export default {
data() { return { list: [], filters: {} } },
methods: {
async fetchList() {
const res = await accountApi.getListApi(this.filters)
this.list = res.data
}
}
}
</script>
```
### Common Utilities
- **[src/common/util.js](src/common/util.js)**: Util.msg() for dialogs, cookies management, date formatting
- **[src/common/format.js](src/common/format.js)**: Formatting helpers for display
- **[src/common/Export2Excel.js](src/common/Export2Excel.js)**: Excel export via xlsx
- **[src/common/constants.js](src/common/constant/)**: Shared enums and constants
## Testing & Quality
### Jest Configuration
[jest.config.js](jest.config.js) tests located in `/tests/unit/**/*.spec.js`
### ESLint
Modern ESLint 9 + antfu config ([eslint.config.js](eslint.config.js))
## Deployment Notes
- **Environments**: Production (dj.glsx.com.cn), Testing (frontend.test.glsx.com.cn)
- **Multiple release branches**: dev_v4.x.x branches per release cycle
- **Legacy Node flags**: Build requires `NODE_OPTIONS=--openssl-legacy-provider` (Node 14 compatibility)
## Key Files for New Features
1. **API integration**: Add new exports in [src/api/](src/api/) matching service method
2. **View component**: Create in appropriate [src/views/](src/views/) module folder
3. **Store data**: Add to Vuex if cross-module state needed
4. **Routes**: Register in [src/router/routes.js](src/router/routes.js) or dynamic loading
5. **Styles**: Use SCSS in [src/assets/style/](src/assets/style/), leverage flex.css utility classes
## Common Tasks
- **Add new API endpoint**: Create function in relevant api/*.js file, inject session/signature in request()
- **Create list page**: Use Element Table + pagination, implement async fetchList() method
- **Export to Excel**: Import Export2Excel from common/, pass table data
- **Add menu item**: Register in router + add permission checks in router.beforeEach
- **Cross-component communication**: Use Vuex store or pass via props/events
---
# Language
默认使用 **简体中文** 输出,包括:
- Git commit message
- Pull Request 描述
- 代码解释
- 技术说明
只有在代码注释或特殊要求时才使用英文。
---
# Git Commit Message 规范
生成 commit message 时必须遵循 **Conventional Commits 规范**。
## 基本格式
type: 简短描述
...@@ -26,3 +26,11 @@ yarn-error.log* ...@@ -26,3 +26,11 @@ yarn-error.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw* *.sw*
# AI Local
.cursor/
.claude/settings.local.json
.roo/
.copilot/
.windsurf/
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
"[markdown]": { "[markdown]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "dbaeumer.vscode-eslint"
}, },
"editor.autoIndent": "full", "editor.autoIndent": "full",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
// "source.organizeImports": "explicit", // "source.organizeImports": "explicit",
...@@ -92,7 +93,9 @@ ...@@ -92,7 +93,9 @@
"javascript.suggest.autoImports": true, // 确保这个是 true "javascript.suggest.autoImports": true, // 确保这个是 true
"vue.updateImportsOnFileMove.enabled": true, "vue.updateImportsOnFileMove.enabled": true,
"i18n-ally.sourceLanguage": "zh-chs", "i18n-ally.sourceLanguage": "zh-chs",
"[vue]": { "explorer.fileNesting.enabled": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.js": "$(capture).spec.js, $(capture).test.js"
} }
} }
# 项目协作规则 # AGENTS.md
## 沟通方式 # 项目AI规范
- 向用户汇报成果时,用简洁明了的中文说明做了什么、发生了什么。
- 避免使用术语、技术实现细节和代码行话;按“向不懂代码的聪明人解释”的方式表达。
- 汇报前尽量先检查工作,能运行或测试的先运行或测试。
## 表单规则 请优先阅读:
- 后台页面新增或重写业务表单时,优先使用 `glsx-combi-form` 组件。
- 弹窗表单也按 `glsx-combi-form` 的配置化写法组织字段、校验和自定义插槽。 - /.ai/rules/ 目录下的文件
- 只有在 `glsx-combi-form` 无法满足交互时,才单独使用原生 `el-form`,并说明原因。
## 项目概述
### 项目名称
dj-car-life-system(嘀加智享车生活后台管理系统)
### 项目类型
企业级 Web 管理后台 SPA。
注意:
* 不是微信小程序
* 不是 H5 活动页
* 不是 React / Next.js 项目
* 不要按小程序架构设计功能
---
## 技术栈
### 核心框架
* Vue 2.6
* Vue Router 3
* Vuex 3
* Element UI 2
* D2Admin
### 构建工具
* Vue CLI 5
* Webpack 5
### 网络请求
* axios
* 项目已有封装
### 语言
* JavaScript
除非用户明确要求,否则不要:
* 升级 Vue3
* 引入 Pinia
* 使用 Composition API
* 使用 script setup
* 大规模 TypeScript 改造
---
## 项目结构
```text
src/
├── api/
├── views/
├── components/
├── router/modules/
├── store/modules/
├── plugin/d2admin/
├── common/
└── libs/
```
新增功能时优先遵循现有目录结构。
不要创建重复能力的目录和工具。
---
## 编码原则
### 优先遵循现有代码风格
修改代码时:
* 先阅读相关模块
* 保持现有命名风格
* 保持现有文件组织方式
* 保持现有组件拆分方式
不要为了追求“最佳实践”而大规模重构。
---
### 实现原则
优先级:
```text
正确
↓
简单
↓
可维护
↓
性能优化
```
优先选择:
* 最简单方案
* 最小改动方案
* 与现有系统一致方案
---
### 组件开发
默认使用:
```js
export default {};
```
即:
* Vue2 Options API
* 单文件组件(SFC)
不要默认使用:
* Composition API
* script setup
---
## 错误处理
用户操作失败时:
* 给出明确提示
* 保持与项目现有 Message 风格一致
不要静默失败。
## 测试规范
修改完成后优先:
* 检查代码逻辑
* 检查运行结果
* 检查控制台报错
能够验证的内容先验证。
不要直接宣布完成。
## 输出要求
完成任务后优先说明:
1. 做了什么
2. 为什么这么做
3. 风险点是什么
然后再补充可选优化建议。
不要把优化建议当成必须任务。
# 嘀加智享车生活后台 http://192.168.3.233:8090/saas_plus/dj-car-life-system # 嘀加智享车生活后台 http://192.168.3.233:8090/saas_plus/dj-car-life-system
# 测试环境(http://frontend.test.glsx.com.cn/dj-carlife-web/#/login) glsadmin admin123 ## node 版本
14.21.3
# 生产环境(http://dj.glsx.com.cn/dj-carlife-web/#/login) liushiquan1 liushiq123
## 包管理工具
npm 6.14.8
## AI 相关
* 项目忽略所有AI相关文件. 不要提交如 CLAUDE.md 等文件.
* 项目提供统一目录, 个人使用什么 AI 自己配置读取.ai/下的文件
* 如果有补充,可以在.ai下对应目录补充.
* 如果你的AI工具不支持自定义目录, 请将 .ai 目录下的文件复制到你对应的目录下去, 以节省你的token
# 测试环境
## url
* http://frontend.test.glsx.com.cn/dj-carlife-web/#/login
## account
* glsadmin
## password
* admin123
# 生产环境
## url
* http://dj.glsx.com.cn/dj-carlife-web/#/login
## account
* liushiquan1
## password
* liushiq123
开发环境 glsadmin 123456 开发环境 glsadmin 123456
预发布账号: yfbyyb a123456 预发布账号: yfbyyb a123456
测试环境账号 15816539335 a123456(超管) 测试环境账号 15816539335 a123456(超管)
aa123456 aa123456 (园区店) aa123456 aa123456 (园区店)
bb123456 bb123456 (服务商) bb123456 bb123456 (服务商)
从 develop 分支号 dev_v4.4.0 本来用来开发审核以及报表功能版本, wangql_dev_v4.4.0 已开发部分对应需求,未往 dev_v4.4.0 版本合并,因此目前 dev_v4.4.0 分支无用
从 develop 拉分支号 dev_v4.5.1 用来开发转化加 V4.5.0 功能需求
从 dev_v4.5.0 拉分支号 dev_v4.5.2 用来新建菜单对应现在的虚拟对公账户功能,以前的菜单保留以防万一
从 develop 拉分支号 dev_v4.7.0 需求功能:零售商品的审核以及首页的数据报表
dev_v4.7.0 已上线并且已合并到 develop 与 mater 上
从 develop 拉分支号 dev_v4.7.1,dev_v4.7.0 上线后已将代码合并到 dev_v4.7.1(上线后需合并代码到 dev_v4.7.2 和 dev_v4.8.0)
从 develop 拉分支号 dev_v4.7.2,需求:广汇 ERP
从 dev_v4.7.1 已提测未上线版本中拉分支 dev_v4.8.0,需求:虚拟对公账户和订单补录 7 月中旬需求
dev_v4.8.0 下载二维码地址在上线需换 path,并且需要配置按钮权限,ERP 功能视情况是否与 7 月紧急版本一起上线,不然就上线时屏蔽
dev_v4.8.0 已上线,合并到 develop 以及 master 主干上
从 develop 上拉取分支 dev_4.12.0_0927 对应 9 月份紧急版本(审计)
4.11.0 版本上线后需往主干及分支 dev_4.12.0_0927 版本上合并代码
dev_4.12.0_0927 版本上线后已往主干 develop 以及 master 上合并
从 develop 上拉取分支 dev_4.12.1 对应 1010 紧急版本
dev_4.13.0 分支以上线并往 develop 以及 master 上合并
从 develop 上拉取分支 dev_4.14.0 对应 11 月 商品改版+场景配置 版本
提测由于部署问题,直接从 dev_4.14.0 拉取 dev_4.14.1 代码相同的分支做部署
12 月大版本下部分 从测试中的分支 dev_4.14.1 拉取 dev_4.14.2 分支去做 清分及对账优化 版本,待 dev_4.14.1 上线后将代码合并进开发中的 dev_4.14.2
dev_4.14.1 上线后已合并到主干上以及 dev_v4.14.2 上
紧急版本 dev_v4.14.1.2 上线后以合并到 develop 以及 master 主干上,版本代码已合并到提测版本 dev_v4.14.2 上
dev_v4.12.2 已上线并合并到主干上
从主干拉取分支 dev_v4.15.0 用于开发 saas+0113 版本功能开发
从主干拉取分支 dev_v4.16.0 用于开发 SAAS+V4.16.0-0227-2 月份需求
[![Build Status](https://www.travis-ci.org/d2-projects/d2-admin-start-kit.svg?branch=master)](https://www.travis-ci.org/d2-projects/d2-admin-start-kit)
[D2Admin](https://github.com/d2-projects/d2-admin) 简化版起始模板,删除所有完整版中的示例代码,保留所有核心功能。
[码云镜像](https://gitee.com/fairyever/d2-admin-start-kit)
\ No newline at end of file \ No newline at end of file
# 财务规则页:增量提交与两阶段校验
## 变更摘要
- **增量提交**:`merchantSettleDistributeRule.save` 的 `goodsTypeGroupRules` 仅包含「脏」Tab 的规则;每条增加 `type`(`ADD` / `UPDATE`)与 `tabPaneIndex`(前端 Tab 下标,便于联调)。会话内删除的已落库规则 id 放在 `deletedGroupDivisionRuleIds` 中一并提交。
- **请求体组装**:`getParams()` / `handlerConfirm` 会带上 `financialObj` 中的**全量** `goodsTypeGroupRules`;`submit` 在合并 `submitParams` 时先 `delete` 再写入增量数组,确保序列化后的 JSON **不会**再包含未改动 Tab 的全量规则数据。
- **脏 Tab**:`ruleCacheRevision !== confirmedRuleCacheRevision`(与既有 persist / bump 语义一致)。未改动的 Tab 不参与分类校验、不进入 `goodsTypeGroupRules`。
- **持久化对比**:`persistClassificationTabByPaneName` 对合并结果与缓存**先 `fillDjGoodsTypeGroupRelations` 再 `financialRulePayloadDeepEqual`**(键序无关 + `lodash/isEqualWith` 叶子宽松比较),避免切换 Tab 时 `getClassificationParams` 与接口在 `goodsTypeGroupRelations` 等字段形态不一致而误 bump;并减少 `merchantId`/比例等 number 与 string 差异导致的误校验。
- **仅切换品类 Tab、未改表单**:持久化时用 `financialRulePayloadDeepEqual`(键序无关)与缓存对比;与缓存实质相同则不 bump,仍视为未修改(不校验、不提交该 Tab)。说明文档勿放在 `src/views` 下,避免被 webpack 的 `require.context` 扫入导致编译报错。
- **两阶段校验**:先对「待校验 Tab」的缓存数据做纯数据校验(`utils/validateGoodsTypeGroupRulePayload.js`);**第一个失败即停止**,再切到该品类并调用子组件 `handleConfirm` 做 Element 标红。未失败时不对千级 Tab 逐页挂载 `el-form.validate`。
- **费用类目冲突**:`computeCalculateModeConflicts` 使用与 `editableTabs` 下标对齐的**全量合并视图**(`buildFullMergedGoodsTypeGroupRules`),避免仅用增量数组导致下标错位。
## 后端约定(需与接口文档对齐)
| 字段 | 说明 |
|------|------|
| `goodsTypeGroupRules[]` | 每项为规则对象,并含 `type`: `ADD` \| `UPDATE`;可选 `tabPaneIndex` |
| `deletedGroupDivisionRuleIds[]` | 本次删除的 `groupDivisionRuleId` 字符串列表 |
| 仅改基础信息、无分类变更 | `goodsTypeGroupRules` 可为 `[]`,仅传 `financialObj` 其它字段 |
## 风险与边界
- **纯数据校验与 el-form**:极端情况下若两者不一致,以先失败的为准;纯数据失败会触发 `handleConfirm` 标红。
- **保存回包**:`codeHandleConfirm` 中按 `groupDivisionRuleId` 优先匹配 Tab,否则回退为数组下标,兼容全量/增量回包。
- **删除 Tab**:已落库(非「本会话新增」或已有服务端 `groupDivisionRuleId`)的规则删除时写入 `pendingDeletedGroupDivisionRuleIds`。**本会话点「新增」再删掉的 Tab**(`sessionAdded: true`)只做前端 `goodsTypeGroupRules` / `editableTabs` 同步删除,**不向服务端传删除**。保存回写若带上 `groupDivisionRuleId` 会清除 `sessionAdded`,之后删除再按已落库处理。删除后重建 `editableTabs` 时须按旧下标保留 **`ruleCacheRevision` / `confirmedRuleCacheRevision`**(与 `sessionAdded` 同映射),避免误清零导致未改 Tab 被误判脏或已改 Tab 丢失脏标记。
## 相关文件
- `src/views/systemConfig/merchant/financialRules/index.vue`:`getGoodsTypeGroupRules`、`submit`、`checkCalculateType`、`codeHandleConfirm`、`removeTab`
- `src/views/systemConfig/merchant/financialRules/utils/goodsTypeGroupRuleOpType.js`
- `src/views/systemConfig/merchant/financialRules/utils/validateGoodsTypeGroupRulePayload.js`
/**
* 任务中心 E2E 测试
*
* 测试场景:
* 1. 导航到任务中心页面
* 2. 验证任务列表显示
* 3. 使用筛选条件搜索任务
* 4. 查看任务详情
* 5. 验证排序功能
*/
import { test, expect } from "@playwright/test";
test.describe("任务中心 (Task Center)", () => {
// 测试前钩子 - 登录并导航到任务中心
test.beforeEach(async ({ page }) => {
// 访问应用
await page.goto("/");
// 等待页面加载
await page.waitForLoadState("networkidle");
});
test("应该能够访问任务中心页面", async ({ page }) => {
// 导航到任务中心
await page.goto("/resident-manage/task-center");
// 等待页面加载
await page.waitForLoadState("networkidle");
// 验证页面标题或关键元素存在
await expect(page.locator(".table-title-wrapper .title")).toContainText("任务列表");
});
test("应该显示任务汇总统计", async ({ page }) => {
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 验证汇总统计元素存在
const summaryTags = page.locator(".table-sum-wrapper .el-tag");
await expect(summaryTags).toHaveCount(4);
// 验证各个统计项
await expect(summaryTags.nth(0)).toContainText("总任务数");
await expect(summaryTags.nth(1)).toContainText("未完成");
await expect(summaryTags.nth(2)).toContainText("已完成");
await expect(summaryTags.nth(3)).toContainText("已逾期");
});
test("应该能够使用筛选条件搜索", async ({ page }) => {
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 找到搜索表单
const searchForm = page.locator(".d2-search");
await expect(searchForm).toBeVisible();
// 输入任务编号
const taskNoInput = page.locator('input[placeholder*="任务编号"], input[name*="taskNo"]');
if (await taskNoInput.count() > 0) {
await taskNoInput.fill("T2026");
}
// 点击查询按钮
const searchButton = page.locator('button:has-text("查询")');
await expect(searchButton).toBeVisible();
await searchButton.click();
// 等待搜索结果
await page.waitForLoadState("networkidle");
});
test("应该能够重置搜索条件", async ({ page }) => {
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 找到重置按钮并点击
const resetButton = page.locator('button:has-text("重置")');
await expect(resetButton).toBeVisible();
await resetButton.click();
// 等待重置完成
await page.waitForLoadState("networkidle");
});
test("应该能够切换排序方式", async ({ page }) => {
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 找到排序下拉框
const sortDropdown = page.locator(".sort-wrapper .el-dropdown-link");
await expect(sortDropdown).toBeVisible();
// 点击打开下拉菜单
await sortDropdown.click();
// 验证下拉菜单选项
const sortOptions = page.locator(".el-dropdown-menu__item");
await expect(sortOptions).toHaveCount(2);
// 验证选项文本
await expect(sortOptions.nth(0)).toContainText("按创建时间");
await expect(sortOptions.nth(1)).toContainText("按截止时间");
// 选择按截止时间排序
await sortOptions.nth(1).click();
// 等待排序生效
await page.waitForLoadState("networkidle");
// 验证排序已更新
await expect(sortDropdown).toContainText("按截止时间");
});
test("应该能够查看任务详情", async ({ page }) => {
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 等待表格加载
const table = page.locator(".d2-table");
await expect(table).toBeVisible();
// 获取第一行任务
const firstRow = page.locator(".el-table__body tr").first();
await expect(firstRow).toBeVisible();
// 获取任务 ID(从 taskNo 列)
const taskNoCell = firstRow.locator("td").nth(1);
const taskNo = await taskNoCell.textContent();
// 点击查看详情按钮
const viewButton = firstRow.locator('button:has-text("查看"), .auth-button');
if (await viewButton.count() > 0) {
await viewButton.click();
// 等待导航到详情页
await page.waitForLoadState("networkidle");
// 验证已跳转到详情页
await expect(page).toHaveURL(/.*task-center\/detail.*taskId=/);
// 验证详情页标题显示任务编号
const detailTitle = page.locator(".title-wrapper .title");
await expect(detailTitle).toBeVisible();
}
});
test("详情页应该显示任务信息", async ({ page }) => {
// 直接访问详情页(使用模拟的 taskId)
await page.goto("/resident-manage/task-center/detail?taskId=TASK001");
await page.waitForLoadState("networkidle");
// 等待详情页加载
const descriptionWrapper = page.locator(".description-wrapper");
await expect(descriptionWrapper).toBeVisible();
// 验证返回按钮存在
const backButton = page.locator(".back-btn, button:has-text('Back'), .VenusBackButton");
if (await backButton.count() > 0) {
await expect(backButton.first()).toBeVisible();
}
});
test("详情页应该能够返回", async ({ page }) => {
await page.goto("/resident-manage/task-center/detail?taskId=TASK001");
await page.waitForLoadState("networkidle");
// 点击返回按钮
const backButton = page.locator(".back-btn, .VenusBackButton");
if (await backButton.count() > 0) {
await backButton.first().click();
// 验证返回列表页
await page.waitForLoadState("networkidle");
await expect(page).toHaveURL(/.*resident-manage\/task-center.*/);
}
});
test("移动端视口适配", async ({ page }) => {
// 使用移动端视口
await page.setViewportSize({ width: 375, height: 667 });
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
// 验证移动端页面正常显示
await expect(page.locator(".table-title-wrapper .title")).toBeVisible();
});
test("跨浏览器兼容性 - Firefox", async ({ browser }) => {
// Firefox 已在 playwright.config.js 中配置
// 此测试验证基本功能在 Firefox 中正常工作
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("/resident-manage/task-center");
await page.waitForLoadState("networkidle");
await expect(page.locator(".table-title-wrapper .title")).toContainText("任务列表");
await context.close();
});
});
...@@ -12,9 +12,8 @@ export default antfu({ ...@@ -12,9 +12,8 @@ export default antfu({
"dist", "dist",
// unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用 // unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用
"auto-import.d.ts", "auto-import.d.ts",
"e2e/",
"build/", "build/",
"tests/",
"node_modules/", "node_modules/",
// # node 覆盖率文件 // # node 覆盖率文件
"coverage/", "coverage/",
......
module.exports = { module.exports = {
moduleFileExtensions: [ moduleFileExtensions: [
'js', "js",
'jsx', "jsx",
'json', "json",
'vue' "vue",
], ],
transform: { transform: {
'^.+\\.vue$': '@vue/vue2-jest', "^.+\\.vue$": "@vue/vue2-jest",
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', ".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
'^.+\\.jsx?$': 'babel-jest' "^.+\\.jsx?$": "babel-jest",
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'node_modules/(?!(lodash-es|nanoid)/)' "node_modules/(?!(lodash-es|nanoid|flex.css|dayjs)/)",
], ],
moduleNameMapper: { moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1' "^@/(.*)$": "<rootDir>/src/$1",
"\\.css$": "jest-transform-stub",
"^@/plugin/d2admin/(.*)$": "<rootDir>/jest.mocks/d2admin.js",
"^@/assets/svg-icons/index.js$": "<rootDir>/jest.mocks/svg-icons-index.js",
"^@/assets/svg-icons$": "<rootDir>/jest.mocks/svg-icons-index.js",
"^@/assets/svg-icons/(.*)$": "<rootDir>/jest.mocks/svg-icons.js",
"^@/api/request$": "<rootDir>/jest.mocks/request.js",
"^@/main$": "<rootDir>/jest.mocks/main.js",
"^@/main.js$": "<rootDir>/jest.mocks/main.js",
}, },
snapshotSerializers: [ snapshotSerializers: [
'jest-serializer-vue' "jest-serializer-vue",
], ],
testMatch: [ testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' "**/*.spec.js",
"**/*.integration.spec.js",
], ],
testURL: 'http://localhost/' testURL: "http://localhost/",
} testEnvironment: "jsdom",
setupFiles: ["<rootDir>/jest.setup.js"],
};
// Mock d2admin 模块
module.exports = {
install: () => {},
};
// Mock main.js 模块
module.exports = {
baseConfig: {},
};
// Mock request 模块
module.exports = jest.fn((params, method, options) => {
return Promise.resolve({});
});
// Mock svg-icons 模块
module.exports = [];
// Mock svg-icons 模块
const requireAll = () => [];
module.exports = [];
// Jest 全局设置文件
// 设置 dayjs 默认语言
const dayjs = require('dayjs');
dayjs.locale('en');
// Mock require.context (webpack 特有,Jest 不支持)
// 需要在 setupFilesAfterEnv 中设置,这样在加载测试文件之前就生效
global.require = global.require || (() => {});
if (!global.require.context) {
global.require.context = (() => {
return {
keys: () => [],
};
});
}
This diff could not be displayed because it is too large.
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
"build": "vue-cli-service build --no-module", "build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock", "build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix", "lint": "vue-cli-service lint --fix",
"test:unit": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service test:unit", "report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report",
"test:financialRules": "vue-cli-service test:unit tests/unit/financialRules --no-coverage", "test:unit": "vue-cli-service test:unit"
"report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report"
}, },
"dependencies": { "dependencies": {
"@sentry/browser": "^7.12.1", "@sentry/browser": "^7.12.1",
...@@ -69,6 +68,7 @@ ...@@ -69,6 +68,7 @@
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12",
"@babel/plugin-proposal-optional-chaining": "7.13.12", "@babel/plugin-proposal-optional-chaining": "7.13.12",
"@kazupon/vue-i18n-loader": "^0.4.1", "@kazupon/vue-i18n-loader": "^0.4.1",
"@playwright/test": "^1.60.0",
"@sentry/webpack-plugin": "^1.18.9", "@sentry/webpack-plugin": "^1.18.9",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0", "@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/cli-plugin-babel": "~5.0.8", "@vue/cli-plugin-babel": "~5.0.8",
...@@ -78,10 +78,12 @@ ...@@ -78,10 +78,12 @@
"@vue/test-utils": "1.0.0-beta.29", "@vue/test-utils": "1.0.0-beta.29",
"@vue/vue2-jest": "^27.0.0-alpha.3", "@vue/vue2-jest": "^27.0.0-alpha.3",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.6.0", "babel-jest": "^27.5.1",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"eslint-plugin-format": "^1.2.0", "eslint-plugin-format": "^1.2.0",
"jest": "^27.1.0", "jest": "^27.1.0",
"jest-serializer-vue": "^3.1.0",
"jest-transform-stub": "^2.0.0",
"md5": "^2.3.0", "md5": "^2.3.0",
"postcss-preset-env": "^7.7.2", "postcss-preset-env": "^7.7.2",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* 2. 安装浏览器:npx playwright install * 2. 安装浏览器:npx playwright install
* 3. 运行测试:npx playwright test * 3. 运行测试:npx playwright test
* 4. 带 UI 运行:npx playwright test --ui * 4. 带 UI 运行:npx playwright test --ui
* 5. 运行特定测试:npx playwright test tests/e2e/profitMarginTable.spec.js * 5. 运行特定测试:npx playwright test e2e/xxx.e2e.js
* 6. 生成报告:npx playwright show-report * 6. 生成报告:npx playwright show-report
*/ */
...@@ -14,7 +14,7 @@ import { defineConfig, devices } from "@playwright/test"; ...@@ -14,7 +14,7 @@ import { defineConfig, devices } from "@playwright/test";
export default defineConfig({ export default defineConfig({
// 测试文件位置 // 测试文件位置
testDir: "./tests/e2e", testDir: "./e2e",
// 超时时间 // 超时时间
timeout: 30 * 1000, timeout: 30 * 1000,
......
...@@ -422,6 +422,15 @@ export function getStrategyStaffList(data = {}) { ...@@ -422,6 +422,15 @@ export function getStrategyStaffList(data = {}) {
data.method = "dj.api.strategy.staff.page"; data.method = "dj.api.strategy.staff.page";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
*
* 查询策略 驻店员工/区域运营/飞行督导列表 - 去重新接口
*/
export function getStrategyStaffListNew(data = {}) {
data.method = "dj.api.strategy.staff.page.distinct.phone";
return request(data, RequestMethods.POST);
}
/* /*
/** /**
* 策略中心-查询策略录音记录 * 策略中心-查询策略录音记录
......
...@@ -377,6 +377,12 @@ export function listShop4sByRef(data) { ...@@ -377,6 +377,12 @@ export function listShop4sByRef(data) {
return request(data, "post"); return request(data, "post");
} }
// 分页获取有关联关系的4s店列表(门店下拉等)
export function listShop4sByRefPage(data) {
data.method = `${path}scenemerchantref.listShop4sByRef.page`;
return request(data);
}
// 新增或更新商户二级流量方 // 新增或更新商户二级流量方
export function insertOrUpdateDiversionMerchantRef(data) { export function insertOrUpdateDiversionMerchantRef(data) {
data.method = `${path2}diversionMerchant.insertOrUpdateDiversionMerchantRef`; data.method = `${path2}diversionMerchant.insertOrUpdateDiversionMerchantRef`;
......
...@@ -143,7 +143,6 @@ ...@@ -143,7 +143,6 @@
</el-tag> </el-tag>
<span v-else>-</span> <span v-else>-</span>
</div> </div>
</template> </template>
<template v-else-if="sub.formatter"> <template v-else-if="sub.formatter">
<span v-if="sub.html" v-html="sub.formatter(scope.row)" /> <span v-if="sub.html" v-html="sub.formatter(scope.row)" />
...@@ -256,10 +255,7 @@ ...@@ -256,10 +255,7 @@
{{ getSchemaTagOptions(item, scope.row).label }} {{ getSchemaTagOptions(item, scope.row).label }}
</el-tag> </el-tag>
<span v-else>-</span> <span v-else>-</span>
</div> </div>
</template> </template>
<template v-else-if="item.formatter"> <template v-else-if="item.formatter">
<span v-if="item.html" v-html="item.formatter(scope.row)" /> <span v-if="item.html" v-html="item.formatter(scope.row)" />
......
<template> <template>
<el-row class="description-wrapper" <el-row align="top"
class="description-wrapper"
style="width:100%;overflow:hidden;flex-wrap: wrap" style="width:100%;overflow:hidden;flex-wrap: wrap"
type="flex" type="flex"
:gutter="gutter" :gutter="gutter">
align="top">
<template v-for="item in getSchema"> <template v-for="item in getSchema">
<el-col v-if="!isHideSchemaItem(item)" <el-col v-if="!isHideSchemaItem(item)"
:key="item._key" :key="item._key"
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
<template v-else> <template v-else>
<slot :name="item.slot || item.name "> <slot :name="item.slot || item.name ">
<div class="form-item" :style="item.itemStyle || {}"> <div class="form-item" :style="item.itemStyle || {}">
<span class="label text-hide" <div class="label text-hide"
:title="item.label" :style="{ width: item.labelWidth || '150px' }"
:style="{ width: item.labelWidth || '150px' }"> :title="item.label">
<slot :name="`${item.slot || item.name}-label`"> <slot :name="`${item.slot || item.name}-label`">
{{ item.label }}{{ item.hideColon ? "" : ":" }} {{ item.label }}{{ item.hideColon ? "" : ":" }}
</slot> </slot>
</span> </div>
<span class="value"> <div class="value">
<el-tooltip :disabled="!item.tooltip" <el-tooltip :disabled="!item.tooltip"
v-bind="item.tooltipProps"> v-bind="item.tooltipProps">
<template #content> <template #content>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</template> </template>
</div> </div>
</el-tooltip> </el-tooltip>
</span> </div>
</div> </div>
</slot> </slot>
</template> </template>
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
> .value { > .value {
flex-shrink: 0; flex-shrink: 0;
flex: 1; flex: 1;
flex-basis: 0;
overflow: hidden; overflow: hidden;
} }
} }
......
<template> <template>
<baseDialog class="effect-detail-dialog" <baseDialog class="effect-detail-dialog"
:config="config" :config="config"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
:is-show.sync="dialogShow"> :is-show.sync="dialogShow">
<div class="content"> <div class="content">
<div class="block"> <div class="block">
<div class="business-box"> <div class="business-box">
<img class="bg" <img class="bg"
src="@/assets/strategy/strategy-analyse-bg.png"> src="@/assets/strategy/strategy-analyse-bg.png">
<div class="left"> <div class="left">
<div class="business-title"> <div class="business-title">
当前周期 当前周期
</div> </div>
<template v-for="(item, index) in row"> <template v-for="(item, index) in row">
<div :key="index" <div :key="index"
class="business-item"> class="business-item">
<div class="label"> <div class="label">
{{ item.categoryExtension }}
{{ item.categoryExtension == '全部' ? item.metricName : (item.categoryExtension + item.metricName) }}
</div> </div>
<div class="value flex"> <div class="value flex">
<template v-if="item.currentValue >= 0">
<template v-if="item.currentValue != null && item.currentValue >= 0">
{{ item.currentValue }}<template v-if="item.unit"> {{ item.currentValue }}<template v-if="item.unit">
{{ item.unit }} {{ item.unit }}
</template> </template>
</template> </template>
<template v-else> <template v-else>
- -
</template> </template>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
<div class="right"> <div class="right">
<div class="business-title"> <div class="business-title">
下一周期 下一周期
</div> </div>
<template v-for="(item, index) in row"> <template v-for="(item, index) in row">
<div :key="index" <div :key="index"
class="business-item"> class="business-item">
<div class="label"> <div class="label">
{{ item.categoryExtension }}
{{ item.categoryExtension == '全部' ? item.metricName : (item.categoryExtension + item.metricName) }}
</div> </div>
<div class="value flex"> <div class="value flex">
<template v-if="item.nextValue >= 0">
<template v-if="item.nextValue != null && item.nextValue >= 0">
{{ item.nextValue }}<template v-if="item.unit"> {{ item.nextValue }}<template v-if="item.unit">
{{ item.unit }} {{ item.unit }}
</template> </template>
<img class="arrow" <img class="arrow"
:src="getIconSrc(formatIsRatio(item.nextValue - item.currentValue))" /> :src="getIconSrc(formatIsRatio(item.nextValue - item.currentValue))" />
</template> </template>
<template v-else> <template v-else>
- -
</template> </template>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</baseDialog> </baseDialog>
</template> </template>
<script> <script>
const decline = require("@/assets/strategy/decline.png"); const decline = require("@/assets/strategy/decline.png");
const just01 = require("@/assets/strategy/just01.png"); const just01 = require("@/assets/strategy/just01.png");
const rise = require("@/assets/strategy/rise.png"); const rise = require("@/assets/strategy/rise.png");
export default { export default {
name: "EffectDetailDialog", name: "EffectDetailDialog",
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
row: { row: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
searchParams: { searchParams: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
}, },
data() { data() {
return { return {
config: { config: {
isShowFooter: false, isShowFooter: false,
cancel_name: "关闭", cancel_name: "关闭",
hideConfirmBtn: true, hideConfirmBtn: true,
}, },
dialogConfig: { dialogConfig: {
config: { config: {
title: "效果分析", title: "效果分析",
width: "720px", width: "720px",
}, },
}, },
}; };
}, },
computed: { computed: {
dialogShow: { dialogShow: {
get() { get() {
return this.visible; return this.visible;
}, },
set() { set() {
this.close(); this.close();
}, },
}, },
}, },
methods: { methods: {
close() { close() {
this.$emit("update:visible", false); this.$emit("update:visible", false);
}, },
getIconSrc(name) { getIconSrc(name) {
return { return {
rise, rise,
decline, decline,
just01, just01,
}[name] ?? ""; }[name] ?? "";
}, },
formatIsRatio(delta) { formatIsRatio(delta) {
return delta < 0 ? "decline" : delta === 0 ? "just01" : "rise"; return delta < 0 ? "decline" : delta == 0 ? "just01" : "rise";
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.arrow { .arrow {
width: 16px; width: 16px;
height: 16px; height: 16px;
transform: translateY(1px); transform: translateY(1px);
} }
...@@ -149,50 +258,73 @@ export default { ...@@ -149,50 +258,73 @@ export default {
&-icon { &-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 4px; margin-right: 4px;
} }
.business-box { .business-box {
height: 289px; height: 289px;
border-radius: 4px; border-radius: 4px;
position: relative; position: relative;
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;
.bg { .bg {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.left, .left,
.right { .right {
width: 59%; width: 59%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 14px; gap: 14px;
position: relative; position: relative;
z-index: 2; z-index: 2;
.business-title { .business-title {
padding-top: 16px; padding-top: 16px;
color: #1d1d1d; color: #1d1d1d;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
} }
.business-item { .business-item {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 13px; font-size: 13px;
.label { .label {
width: 104px; min-width: 104px;
color: #888888; color: #888888;
margin-right: 10px;
} }
.value { .value {
...@@ -203,18 +335,23 @@ export default { ...@@ -203,18 +335,23 @@ export default {
.left { .left {
box-sizing: border-box; box-sizing: border-box;
padding-left: 15%; padding-left: 15%;
} }
.right { .right {
border-radius: 4px; border-radius: 4px;
background: #ffffffcc; background: #ffffffcc;
padding-left: 24px; padding-left: 24px;
.business-item { .business-item {
.value { .value {
color: #2a58ad; color: #2a58ad;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
运营人员: 运营人员:
<el-select size="mini" <el-select size="mini"
style="width: 120px;" style="width: 120px;"
filterable
:value="operatorFilter" :value="operatorFilter"
@change="handleOperatorChange"> @change="handleOperatorChange">
<el-option v-for="operator in operatorList" <el-option v-for="operator in operatorList"
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
</template> </template>
<script> <script>
import { merchantStaffByRoleList } from "@api/index"; import { findMerchantStaffList, merchantStaffByRoleList } from "@api/index";
import * as echarts from "echarts"; import * as echarts from "echarts";
import noDataImg from "@/assets/strategy/emepty-strategy.png"; import noDataImg from "@/assets/strategy/emepty-strategy.png";
...@@ -64,19 +65,29 @@ const STRATEGY_TYPE_CONFIG = { ...@@ -64,19 +65,29 @@ const STRATEGY_TYPE_CONFIG = {
0: { name: "学习", color: "#409EFF" }, 0: { name: "学习", color: "#409EFF" },
1: { name: "优秀案例分享", color: "#36CBCB" }, 1: { name: "优秀案例分享", color: "#36CBCB" },
2: { name: "带教", color: "#67C23A" }, 2: { name: "带教", color: "#67C23A" },
3: { name: "任务下发", color: "#FFD666" }, 3: { name: "通知", color: "#FFD666" },
4: { name: "销售精英到店提拉", color: "#B3E19D" }, 4: { name: "销售精英到店提拉", color: "#B3E19D" },
5: { name: "强力促销", color: "#E6A23C" }, 5: { name: "强力促销", color: "#E6A23C" },
6: { name: "最终盘点与低客单产品购入", color: "#9254DE" }, 6: { name: "最终盘点与低客单产品购入", color: "#9254DE" },
}; };
const FALLBACK_COLORS = ["#409EFF", "#36CBCB", "#67C23A", "#FFD666", "#B3E19D", "#E6A23C", "#9254DE", "#F56C6C"];
/** /**
* 获取策略类型配置 * 获取策略类型配置(本地映射优先,接口 strategyTypeName 兜底)
* @param {number} strategyType - 策略类型编号 * @param {number} strategyType - 策略类型编号
* @param {string} [strategyTypeName] - 接口返回的类型名称
* @returns {{name: string, color: string}} * @returns {{name: string, color: string}}
*/ */
function getStrategyTypeConfig(strategyType) { function getStrategyTypeConfig(strategyType, strategyTypeName) {
return STRATEGY_TYPE_CONFIG[strategyType]; const config = STRATEGY_TYPE_CONFIG[strategyType];
if (config) {
return config;
}
return {
name: strategyTypeName || `类型${strategyType}`,
color: FALLBACK_COLORS[Math.abs(strategyType) % FALLBACK_COLORS.length],
};
} }
/** /**
...@@ -96,8 +107,8 @@ function transformStrategyData(apiData) { ...@@ -96,8 +107,8 @@ function transformStrategyData(apiData) {
// 转换数据格式 // 转换数据格式
return validData return validData
.map((item) => { .map((item) => {
const { strategyType, strategyCount = 0, percent } = item; const { strategyType, strategyTypeName, strategyCount = 0, percent } = item;
const config = getStrategyTypeConfig(strategyType); const config = getStrategyTypeConfig(strategyType, strategyTypeName);
const calculatedPercent = percent ?? (total > 0 ? Math.round((strategyCount / total) * 100) : 0); const calculatedPercent = percent ?? (total > 0 ? Math.round((strategyCount / total) * 100) : 0);
return { return {
...@@ -194,7 +205,8 @@ export default { ...@@ -194,7 +205,8 @@ export default {
* 获取线上运营列表 * 获取线上运营列表
*/ */
getOnlineOpsList() { getOnlineOpsList() {
merchantStaffByRoleList({ roleName: "线上运营" }).then((res) => { // merchantStaffByRoleList({ roleName: "线上运营" }).then((res) => {
findMerchantStaffList({ merchantId: "-1" }).then((res) => {
if (res) { if (res) {
// 将返回的数据转换为选择器需要的格式 // 将返回的数据转换为选择器需要的格式
this.operatorList = res.map(item => ({ this.operatorList = res.map(item => ({
...@@ -340,7 +352,7 @@ $bg-white: #fff; ...@@ -340,7 +352,7 @@ $bg-white: #fff;
/* 图表容器样式 */ /* 图表容器样式 */
.chart-container { .chart-container {
display: flex; display: flex;
align-items: center; align-items: flex-start;
justify-content: flex-end; justify-content: flex-end;
} }
...@@ -353,6 +365,23 @@ $bg-white: #fff; ...@@ -353,6 +365,23 @@ $bg-white: #fff;
.custom-legend { .custom-legend {
font-size: 13px; font-size: 13px;
margin-left: 20%; margin-left: 20%;
max-height: 200px;
overflow-y: auto;
padding-right: 4px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background: #dcdfe6;
border-radius: 2px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
.legend-item { .legend-item {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<!-- 2. KPI 核心指标 --> <!-- 2. KPI 核心指标 -->
<div class="top-content"> <div class="top-content">
<div class="kpi-row"> <div class="kpi-row">
<el-row :gutter="24" style="flex-wrap: nowrap;"> <el-row style="flex-wrap: nowrap;" :gutter="24">
<el-col v-for="(item, index) in kpiList" <el-col v-for="(item, index) in kpiList"
:key="index" :key="index"
:span="12"> :span="12">
...@@ -65,19 +65,19 @@ ...@@ -65,19 +65,19 @@
<div class="tool-left"> <div class="tool-left">
<!-- 盯防类型 --> <!-- 盯防类型 -->
<SelectCustom label="盯防类型" <SelectCustom label="盯防类型"
trigger-icon-type="image"
:options="watchTypeOptions" :options="watchTypeOptions"
:trigger-icon="require('@/assets/strategy/icon-strategy-type.png')" :trigger-icon="require('@/assets/strategy/icon-strategy-type.png')"
trigger-icon-type="image"
:value="currentWatchType" :value="currentWatchType"
@change="selectWatchType" /> @change="selectWatchType" />
</div> </div>
</d2-table-header> </d2-table-header>
<d2-table ref="table" <d2-table ref="table"
no-data-text="暂无数据"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:has-page="false" :has-page="false"
:no-data-img="noDataImg" :no-data-img="noDataImg"
no-data-text="暂无数据"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams"> :table-params="tableParams">
<!-- 主营品牌 --> <!-- 主营品牌 -->
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<template #metrics="scope"> <template #metrics="scope">
<span class="effect-cell" <span class="effect-cell"
@click="handleEffectDetail(scope.scope)"> @click="handleEffectDetail(scope.scope)">
{{ scope.scope.metrics.length }} <span style="color: #333333;">项提升</span> {{ countImprovedMetrics(scope.scope.metrics) }} <span style="color: #333333;">项提升</span>
</span> </span>
</template> </template>
</d2-table> </d2-table>
...@@ -284,7 +284,7 @@ export default { ...@@ -284,7 +284,7 @@ export default {
searchFormSearch: {}, searchFormSearch: {},
getListApi: null, // 在 mounted 中初始化 getListApi: null, // 在 mounted 中初始化
effectDetailVisible: false, effectDetailVisible: false,
effectDetailRow: {}, effectDetailRow: [],
// 策略类型分布运营人员筛选防抖定时器 // 策略类型分布运营人员筛选防抖定时器
_strategyTypeOperatorTimer: null, _strategyTypeOperatorTimer: null,
tableParams: { tableParams: {
...@@ -468,6 +468,16 @@ export default { ...@@ -468,6 +468,16 @@ export default {
* 包装 API 方法,将数组响应转换为 d2-table 期望的对象格式 * 包装 API 方法,将数组响应转换为 d2-table 期望的对象格式
*/ */
async wrapStrategyEffectList(params) { async wrapStrategyEffectList(params) {
const periodType = params.periodType ?? this.timeRangeType?.value;
// 周、自定义周期不请求效果分析列表
if (periodType === 1 || periodType === 4) {
return {
data: [],
total: 0,
pageNum: params.pageNum || 1,
pageSize: params.pageSize || 1000,
};
}
try { try {
// const data = await getStrategyEffectList(params); // const data = await getStrategyEffectList(params);
params.cycleType = params.periodType == 1 ? 2 : params.periodType == 2 ? 3 : params.periodType; params.cycleType = params.periodType == 1 ? 2 : params.periodType == 2 ? 3 : params.periodType;
...@@ -703,6 +713,7 @@ export default { ...@@ -703,6 +713,7 @@ export default {
uuid: this.strategyTypeOperatorFilter, uuid: this.strategyTypeOperatorFilter,
}; };
const res = await getStrategyTypeDist(params); const res = await getStrategyTypeDist(params);
console.log("getStrategyTypeDist", res);
this.strategyTypeData = res || []; this.strategyTypeData = res || [];
} catch (error) { } catch (error) {
console.error("获取策略类型分布失败:", error); console.error("获取策略类型分布失败:", error);
...@@ -733,15 +744,24 @@ export default { ...@@ -733,15 +744,24 @@ export default {
this.loading.onlineOperData = false; this.loading.onlineOperData = false;
} }
}, },
countImprovedMetrics(metrics) {
if (!Array.isArray(metrics)) {
return 0;
}
return metrics.filter(m => m.improved === true).length;
},
handleEffectDetail(row) { handleEffectDetail(row) {
this.effectDetailRow = row.metrics; const metrics = row.metrics;
this.effectDetailRow = Array.isArray(metrics) ? metrics : [];
this.effectDetailVisible = true; this.effectDetailVisible = true;
}, },
handleViewDetail(e) { handleViewDetail(e) {
console.log("handleViewDetail", e);
// 构建查询参数 // 构建查询参数
const query = { const query = {
merchantNo: e.merchantId4s, merchantNo: e.merchantNo,
storeName: e.merchantName4s, storeName: e.storeName,
businessType: this.currentTab.value,
}; };
// 添加时间范围类型 // 添加时间范围类型
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
<!-- 隐藏的日期选择器 --> <!-- 隐藏的日期选择器 -->
<el-date-picker ref="datePicker" <el-date-picker ref="datePicker"
v-model="datePickerValue" v-model="datePickerValue"
type="daterange" class="hidden-date-picker"
end-placeholder="结束日期"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" type="daterange"
:picker-options="pickerOptions" :picker-options="pickerOptions"
class="hidden-date-picker"
@change="handleDatePickerChange" @change="handleDatePickerChange"
@pick="handleDatePick"> @pick="handleDatePick">
</el-date-picker> </el-date-picker>
...@@ -134,12 +134,12 @@ const DateUtils = { ...@@ -134,12 +134,12 @@ const DateUtils = {
// 日期范围策略配置 // 日期范围策略配置
const DateRangeStrategies = { const DateRangeStrategies = {
周: { 周: {
// 初始化:当前周(当前周的周一到今天) // 初始化:当前周(当前周的周一到周日)
init(now) { init(now) {
const currentWeekMonday = DateUtils.getCurrentWeekMonday(now); const currentWeekMonday = DateUtils.getCurrentWeekMonday(now);
return { return {
startDate: currentWeekMonday, startDate: currentWeekMonday,
endDate: DateUtils.resetToEndOfDay(now), endDate: DateUtils.getWeekSunday(currentWeekMonday),
}; };
}, },
...@@ -155,8 +155,8 @@ const DateRangeStrategies = { ...@@ -155,8 +155,8 @@ const DateRangeStrategies = {
let newEndDate; let newEndDate;
if (newStart.getTime() === currentWeekMonday.getTime()) { if (newStart.getTime() === currentWeekMonday.getTime()) {
// 当前周:结束时间为今天 // 当前周:结束时间为该周的周日
newEndDate = DateUtils.resetToEndOfDay(now); newEndDate = DateUtils.getWeekSunday(currentWeekMonday);
} else if (newSunday > now) { } else if (newSunday > now) {
// 未来周:不应该执行(由canSwitchNext控制) // 未来周:不应该执行(由canSwitchNext控制)
return null; return null;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
<span class="label">区域:</span> <span class="label">区域:</span>
<el-select v-model="formData.provinceId" <el-select v-model="formData.provinceId"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in provinceOptions" <el-option v-for="item in provinceOptions"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
...@@ -25,24 +25,24 @@ ...@@ -25,24 +25,24 @@
<span class="label">品牌:</span> <span class="label">品牌:</span>
<el-cascader v-model="formData.brand" <el-cascader v-model="formData.brand"
class="filter-select filter-select-brand" class="filter-select filter-select-brand"
placeholder="全部"
size="small"
clearable clearable
collapse-tags collapse-tags
filterable filterable
:options="brandOptions" :options="brandOptions"
placeholder="全部"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false" :show-all-levels="false">
size="small">
</el-cascader> </el-cascader>
</div> </div>
<div class="filter-group"> <div class="filter-group">
<span class="label">区域运营:</span> <span class="label">区域运营:</span>
<el-select v-model="formData.regionOps" <el-select v-model="formData.regionOps"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in regionOpsOptions" <el-option v-for="item in regionOpsOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -54,10 +54,10 @@ ...@@ -54,10 +54,10 @@
<span class="label">线上运营:</span> <span class="label">线上运营:</span>
<el-select v-model="formData.onlineOps" <el-select v-model="formData.onlineOps"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in onlineOpsOptions" <el-option v-for="item in onlineOpsOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -69,10 +69,10 @@ ...@@ -69,10 +69,10 @@
<span class="label">区域督导:</span> <span class="label">区域督导:</span>
<el-select v-model="formData.supervisorOps" <el-select v-model="formData.supervisorOps"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in supervisorOpsOptions" <el-option v-for="item in supervisorOpsOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
region: "", region: "",
provinceId: null, provinceId: null,
brand: [], brand: [],
regionOps: "all", regionOps: "",
onlineOps: null, onlineOps: null,
supervisorOps: null, supervisorOps: null,
}), }),
...@@ -165,8 +165,8 @@ export default { ...@@ -165,8 +165,8 @@ export default {
}, },
methods: { methods: {
getDefaultOnlineOps() { getDefaultOnlineOps() {
const { roleName, uuid } = this.$store.state.d2admin.user.info?.detail || {}; const { uuid } = this.$store.state.d2admin.user.info?.detail || {};
return roleName === "线上运营" ? uuid : ""; return this.onlineOpsOptions.find(item => item.value == uuid) ? uuid : "";
}, },
getInitialFormData() { getInitialFormData() {
return { return {
...@@ -175,16 +175,27 @@ export default { ...@@ -175,16 +175,27 @@ export default {
brand: [], brand: [],
regionOps: "", regionOps: "",
onlineOps: this.getDefaultOnlineOps(), onlineOps: this.getDefaultOnlineOps(),
supervisorOps: null,
}; };
}, },
syncFormFromFilters() { syncFormFromFilters() {
const { region = "", provinceId = "", brand = [], regionOps = "", onlineOps = "" } = this.filters || {}; const {
region = "",
provinceId = "",
brand = [],
regionOps = "",
onlineOps = "",
supervisorOps,
flightSupervisionId,
} = this.filters || {};
const supervisorValue = supervisorOps ?? flightSupervisionId;
this.formData = { this.formData = {
region, region,
provinceId: provinceId || "", provinceId: provinceId || "",
brand: Array.isArray(brand) ? brand.map(item => (Array.isArray(item) ? [...item] : item)) : [], brand: Array.isArray(brand) ? brand.map(item => (Array.isArray(item) ? [...item] : item)) : [],
regionOps: regionOps || "", regionOps: regionOps || "",
onlineOps: onlineOps || this.getDefaultOnlineOps(), onlineOps: onlineOps || this.getDefaultOnlineOps(),
supervisorOps: supervisorValue || "",
}; };
}, },
submit() { submit() {
......
...@@ -22,19 +22,20 @@ ...@@ -22,19 +22,20 @@
<span class="label">门店名称:</span> <span class="label">门店名称:</span>
<el-input v-model="localFilters.storeName" <el-input v-model="localFilters.storeName"
class="filter-select" class="filter-select"
clearable maxlength="50"
placeholder="请输入" placeholder="请输入"
size="small"> size="small"
clearable>
</el-input> </el-input>
</div> </div>
<div class="filter-group"> <div class="filter-group">
<span class="label">项目组:</span> <span class="label">项目组:</span>
<el-select v-model="localFilters.groupId" <el-select v-model="localFilters.groupId"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in groupOptions" <el-option v-for="item in groupOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -59,10 +60,10 @@ ...@@ -59,10 +60,10 @@
<span class="label">区域:</span> <span class="label">区域:</span>
<el-select v-model="localFilters.provinceId" <el-select v-model="localFilters.provinceId"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in provinceOptions" <el-option v-for="item in provinceOptions"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
...@@ -74,24 +75,24 @@ ...@@ -74,24 +75,24 @@
<span class="label">品牌:</span> <span class="label">品牌:</span>
<el-cascader v-model="localFilters.brand" <el-cascader v-model="localFilters.brand"
class="filter-select-brand" class="filter-select-brand"
placeholder="全部"
size="small"
clearable clearable
collapse-tags collapse-tags
filterable filterable
:options="brandOptions" :options="brandOptions"
placeholder="全部"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false" :show-all-levels="false">
size="small">
</el-cascader> </el-cascader>
</div> </div>
<div v-if="false" class="filter-group"> <div v-if="false" class="filter-group">
<span class="label">区域运营:</span> <span class="label">区域运营:</span>
<el-select v-model="localFilters.regionOps" <el-select v-model="localFilters.regionOps"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in regionOpsOptions" <el-option v-for="item in regionOpsOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -103,10 +104,10 @@ ...@@ -103,10 +104,10 @@
<span class="label">线上运营:</span> <span class="label">线上运营:</span>
<el-select v-model="localFilters.onlineOps" <el-select v-model="localFilters.onlineOps"
class="filter-select" class="filter-select"
clearable
filterable
placeholder="全部" placeholder="全部"
size="small"> size="small"
clearable
filterable>
<el-option v-for="item in onlineOpsOptions" <el-option v-for="item in onlineOpsOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -347,7 +348,7 @@ export default { ...@@ -347,7 +348,7 @@ export default {
brand: Array.isArray(dialogFilters.brand) brand: Array.isArray(dialogFilters.brand)
? dialogFilters.brand.map(item => (Array.isArray(item) ? [...item] : item)) ? dialogFilters.brand.map(item => (Array.isArray(item) ? [...item] : item))
: [], : [],
regionOps: dialogFilters.regionOps ?? "all", regionOps: dialogFilters.regionOps ?? null,
onlineOps: dialogFilters.onlineOps ?? null, onlineOps: dialogFilters.onlineOps ?? null,
supervisorOps: dialogFilters.supervisorOps ?? null, supervisorOps: dialogFilters.supervisorOps ?? null,
}; };
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<div class="monitor-card" :class="{ 'is-checked': cardData.checked }"> <div class="monitor-card" :class="{ 'is-checked': cardData.checked }">
<div class="card-head"> <div class="card-head">
<!-- {{ cardData }} --> <!-- {{ cardData }} -->
<el-tooltip :disabled="!cardData.storeName" <el-tooltip effect="dark"
effect="dark"
placement="bottom" placement="bottom"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!cardData.storeName">
<template #content> <template #content>
<div style="width:236px;line-height:1.6;word-break:break-all;"> <div style="width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.storeName }} {{ cardData.storeName }}
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
<div class="card-body" @click="handleViewDetail"> <div class="card-body" @click="handleViewDetail">
<div class="row-item"> <div class="row-item">
<span class="label">主营品牌:</span> <span class="label">主营品牌:</span>
<el-tooltip :disabled="!cardData.mainBrands" <el-tooltip effect="dark"
effect="dark"
placement="top" placement="top"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!cardData.mainBrands">
<template #content> <template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;"> <div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ cardData.mainBrandsStr }} {{ cardData.mainBrandsStr }}
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
</div> </div>
<div class="row-item"> <div class="row-item">
<span class="label">线上运营:</span> <span class="label">线上运营:</span>
<el-tooltip :disabled="!onlineOperatorText" <el-tooltip effect="dark"
effect="dark"
placement="top" placement="top"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!onlineOperatorText">
<template #content> <template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;"> <div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ onlineOperatorText }} {{ onlineOperatorText }}
...@@ -52,10 +52,10 @@ ...@@ -52,10 +52,10 @@
</div> </div>
<div class="row-item"> <div class="row-item">
<span class="label">区域运营:</span> <span class="label">区域运营:</span>
<el-tooltip :disabled="!areaOperatorText" <el-tooltip effect="dark"
effect="dark"
placement="top" placement="top"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!areaOperatorText">
<template #content> <template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;"> <div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ areaOperatorText }} {{ areaOperatorText }}
...@@ -66,10 +66,10 @@ ...@@ -66,10 +66,10 @@
</div> </div>
<div class="row-item"> <div class="row-item">
<span class="label">区域督导:</span> <span class="label">区域督导:</span>
<el-tooltip :disabled="!flightSupervisionText" <el-tooltip effect="dark"
effect="dark"
placement="top" placement="top"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!flightSupervisionText">
<template #content> <template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;"> <div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ flightSupervisionText }} {{ flightSupervisionText }}
...@@ -80,18 +80,18 @@ ...@@ -80,18 +80,18 @@
</div> </div>
<!-- 预警标签组 --> <!-- 预警标签组 -->
<div v-if="cardData.warningRecords && cardData.warningRecords.length > 0" class="alert-group"> <div class="alert-group">
<div v-for="(item, index) in cardData.warningRecords" <div v-for="(item, index) in cardData.warningRecords || []"
:key="index" :key="index"
class="alert-tag" class="alert-tag"
:class="[item.warningType == 4 || item.warningType == 2 ? 'red' : 'orange']"> :class="[item.warningType == 4 || item.warningType == 2 ? 'red' : 'orange']">
<img alt="" <img alt=""
class="icon-img" class="icon-img"
:src="getAlertIcon(item)"> :src="getAlertIcon(item)">
<el-tooltip :disabled="!warningOverflowMap[index]" <el-tooltip effect="dark"
effect="dark"
placement="top" placement="top"
popper-class="dark-tooltip"> popper-class="dark-tooltip"
:disabled="!warningOverflowMap[index]">
<template #content> <template #content>
<div style="max-width:236px;line-height:1.6;word-break:break-all;"> <div style="max-width:236px;line-height:1.6;word-break:break-all;">
{{ getWarningDisplayText(item) }} {{ getWarningDisplayText(item) }}
...@@ -324,6 +324,8 @@ $text-orange: #ff7d00; ...@@ -324,6 +324,8 @@ $text-orange: #ff7d00;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
flex-shrink: 0; flex-shrink: 0;
height: 72px;
overflow: hidden;
} }
.alert-tag { .alert-tag {
......
...@@ -20,20 +20,20 @@ ...@@ -20,20 +20,20 @@
<div class="tool-left"> <div class="tool-left">
<!-- 盯防类型 --> <!-- 盯防类型 -->
<SelectCustom label="盯防类型" <SelectCustom label="盯防类型"
trigger-icon-type="image"
:options="watchTypeOptions" :options="watchTypeOptions"
:trigger-icon="require('@/assets/strategy/icon-strategy-type.png')" :trigger-icon="require('@/assets/strategy/icon-strategy-type.png')"
trigger-icon-type="image"
:value="currentWatchType" :value="currentWatchType"
@change="selectWatchType" /> @change="selectWatchType" />
<span class="v-divider">|</span> <span class="v-divider">|</span>
<!-- 指标类型 --> <!-- 指标类型 -->
<SelectCustom :disabled="isIndicatorTypeDisabled" <SelectCustom label="指标类型"
label="指标类型" trigger-icon-type="image"
:disabled="isIndicatorTypeDisabled"
:options="indicatorTypeOptions" :options="indicatorTypeOptions"
:trigger-icon="require('@/assets/strategy/icon-strategy-type06.png')" :trigger-icon="require('@/assets/strategy/icon-strategy-type06.png')"
trigger-icon-type="image"
:value="currentIndicatorType" :value="currentIndicatorType"
@change="selectIndicatorType" /> @change="selectIndicatorType" />
...@@ -65,9 +65,9 @@ ...@@ -65,9 +65,9 @@
<!-- 3. 卡片内容区 --> <!-- 3. 卡片内容区 -->
<div class="content-area"> <div class="content-area">
<el-row v-if="cardList.length > 0" <el-row v-if="cardList.length > 0"
:gutter="16"
justify="start" justify="start"
type="flex"> type="flex"
:gutter="16">
<el-col v-for="(item, index) in cardList" <el-col v-for="(item, index) in cardList"
:key="index" :key="index"
class="col-item" class="col-item"
...@@ -108,6 +108,7 @@ import HeaderCustom from "./compoments/headerCustom.vue"; ...@@ -108,6 +108,7 @@ import HeaderCustom from "./compoments/headerCustom.vue";
import MonitorCard from "./compoments/monitorCard.vue"; import MonitorCard from "./compoments/monitorCard.vue";
import SelectCustom from "./compoments/selectCustom.vue"; import SelectCustom from "./compoments/selectCustom.vue";
import AddStrategy from "./storeSignboard/components/AddStrategy/index.vue"; import AddStrategy from "./storeSignboard/components/AddStrategy/index.vue";
import { getWarningSummaryCleanParams, saveWarningSummaryParams } from "./utils/warningSummaryParams";
// 盯防类型图标配置(配置化管理,易于扩展) // 盯防类型图标配置(配置化管理,易于扩展)
const WATCH_TYPE_ICON_CONFIG = { const WATCH_TYPE_ICON_CONFIG = {
2: { 2: {
...@@ -273,8 +274,28 @@ export default { ...@@ -273,8 +274,28 @@ export default {
storeName: card.storeName, storeName: card.storeName,
})); }));
}, },
// 与 getMonitorListData 中 cleanParams 保持一致,供门店看板等场景复用
warningSummaryCleanParams() {
return getWarningSummaryCleanParams({
filters: this.filters,
timeRangeType: this.timeRangeType,
dateRange: this.dateRange,
currentTab: this.currentTab,
currentWatchType: this.currentWatchType,
currentIndicatorType: this.currentIndicatorType,
});
},
}, },
watch: { watch: {
"warningSummaryCleanParams": {
handler(params) {
saveWarningSummaryParams(params);
},
deep: true,
immediate: true,
},
// 监听盯防类型变化,自动重置指标类型为"全部" // 监听盯防类型变化,自动重置指标类型为"全部"
"currentWatchType.value": function (newValue, oldValue) { "currentWatchType.value": function (newValue, oldValue) {
if (newValue !== oldValue) { if (newValue !== oldValue) {
...@@ -347,6 +368,7 @@ export default { ...@@ -347,6 +368,7 @@ export default {
twoBrandIds, twoBrandIds,
regionOps, regionOps,
onlineOps, onlineOps,
supervisorOps,
} = this.filters; } = this.filters;
const params = { const params = {
storeName, storeName,
...@@ -357,14 +379,19 @@ export default { ...@@ -357,14 +379,19 @@ export default {
twoBrandIds: twoBrandIds || [], twoBrandIds: twoBrandIds || [],
regionalOperatorId: regionOps, regionalOperatorId: regionOps,
onlineOperatorId: onlineOps, onlineOperatorId: onlineOps,
periodType: this.timeRangeType.value, flightSupervisionId: supervisorOps,
// periodType: this.timeRangeType.value,
cycleType: {
1: 2,
2: 3,
4: 4,
}[this.timeRangeType.value],
businessType: this.currentTab.value, businessType: this.currentTab.value,
startDate: this.dateRange.startDate, startDate: this.dateRange.startDate,
monitorType: this.currentWatchType.value, warningType: this.currentWatchType.value,
metricTypeId: this.currentIndicatorType.value, metricTypeId: this.currentIndicatorType.value,
endDate: this.dateRange.endDate, endDate: this.dateRange.endDate,
}; };
console.log("查询条件A:", params);
// 过滤掉空值字段 // 过滤掉空值字段
const cleanParams = Object.fromEntries( const cleanParams = Object.fromEntries(
Object.entries(params).filter(([_, v]) => v != null && v !== "" && !(Array.isArray(v) && v.length === 0)), Object.entries(params).filter(([_, v]) => v != null && v !== "" && !(Array.isArray(v) && v.length === 0)),
...@@ -560,7 +587,7 @@ export default { ...@@ -560,7 +587,7 @@ export default {
// 在列表前面添加"全部"选项 // 在列表前面添加"全部"选项
if (this.baseData.regionOpsList.length && this.baseData.regionOpsList[0].label !== "全部") { if (this.baseData.regionOpsList.length && this.baseData.regionOpsList[0].label !== "全部") {
this.baseData.regionOpsList.unshift({ this.baseData.regionOpsList.unshift({
value: "all", value: null,
label: "全部", label: "全部",
}); });
} }
...@@ -589,7 +616,6 @@ export default { ...@@ -589,7 +616,6 @@ export default {
// 获取督导列表 // 获取督导列表
getSupervisorOpsList() { getSupervisorOpsList() {
merchantStaffByRoleList({ roleName: "飞行督导" }).then((res) => { merchantStaffByRoleList({ roleName: "飞行督导" }).then((res) => {
console.log("督导列表:", res);
if (res && res.length) { if (res && res.length) {
// 将返回的数据转换为选择器需要的格式 // 将返回的数据转换为选择器需要的格式
this.baseData.supervisorOpsList = res.map(item => ({ this.baseData.supervisorOpsList = res.map(item => ({
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
<div class="search-box flex"> <div class="search-box flex">
<el-input v-model="searchForm.staffName" <el-input v-model="searchForm.staffName"
class="search-input" class="search-input"
clearable
placeholder="搜索员工名称" placeholder="搜索员工名称"
size="small"> size="small"
clearable>
</el-input> </el-input>
<el-date-picker v-model="searchForm.receptionDate" <el-date-picker v-model="searchForm.receptionDate"
class="search-input" class="search-input"
...@@ -24,6 +24,16 @@ ...@@ -24,6 +24,16 @@
size="small" size="small"
type="date"> type="date">
</el-date-picker> </el-date-picker>
<el-select v-model="searchForm.orderFinishFlag"
class="search-input"
placeholder="订单成交标记"
size="small">
<el-option v-for="item in orderFinishFlagOptions"
:key="String(item.value)"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button size="small" <el-button size="small"
type="primary" type="primary"
@click="handleSearch"> @click="handleSearch">
...@@ -36,10 +46,10 @@ ...@@ -36,10 +46,10 @@
</div> </div>
<div class="table"> <div class="table">
<d2-table ref="multipleTable" <d2-table ref="multipleTable"
layout="total, prev, pager, next"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:has-num="false" :has-num="false"
layout="total, prev, pager, next"
:pager-count="5" :pager-count="5"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
...@@ -96,7 +106,7 @@ export default { ...@@ -96,7 +106,7 @@ export default {
dialogConfig: { dialogConfig: {
config: { config: {
title: "选择录音", title: "选择录音",
width: "1092px", width: "1192px",
}, },
}, },
targetId: "id", targetId: "id",
...@@ -107,9 +117,15 @@ export default { ...@@ -107,9 +117,15 @@ export default {
}; };
}, },
getListApi: getRecordAllPageListByCondition, getListApi: getRecordAllPageListByCondition,
orderFinishFlagOptions: [
{ label: "全部", value: null },
{ label: "战败", value: 0 },
{ label: "成功", value: 1 },
],
searchForm: { searchForm: {
staffName: "", staffName: "",
receptionDate: "", receptionDate: "",
orderFinishFlag: null,
businessType: 1, businessType: 1,
}, },
searchFormSearch: {}, searchFormSearch: {},
...@@ -155,8 +171,10 @@ export default { ...@@ -155,8 +171,10 @@ export default {
}, },
{ {
label: "成交状态", label: "成交状态",
prop: "defencePoint", prop: "orderFinishFlag",
minWidth: 90, formatter(row) {
return row.orderFinishFlag ? "成功" : "战败";
},
}, },
], ],
}, },
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
<div class="search-box flex"> <div class="search-box flex">
<el-input v-model="searchForm.staffName" <el-input v-model="searchForm.staffName"
class="search-input" class="search-input"
clearable
placeholder="搜索员工名称" placeholder="搜索员工名称"
size="small"> size="small"
clearable>
</el-input> </el-input>
<el-button size="small" <el-button size="small"
type="primary" type="primary"
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
</div> </div>
<div class="table"> <div class="table">
<d2-table ref="multipleTable" <d2-table ref="multipleTable"
layout="total, prev, pager, next"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:has-num="false" :has-num="false"
layout="total, prev, pager, next"
:pager-count="5" :pager-count="5"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
...@@ -78,12 +78,19 @@ ...@@ -78,12 +78,19 @@
<script> <script>
import { import {
getStrategyStaffList, getStrategyStaffList,
getStrategyStaffListNew,
} from "@api/earlyWarningManager"; } from "@api/earlyWarningManager";
import multipleMixin from "./multipleMixin"; import multipleMixin from "./multipleMixin";
export default { export default {
name: "MultipleStaff", name: "MultipleStaff",
mixins: [multipleMixin], mixins: [multipleMixin],
props: {
strategyType: {
type: [Number, String],
default: null,
},
},
data() { data() {
return { return {
dialogConfig: { dialogConfig: {
...@@ -92,14 +99,25 @@ export default { ...@@ -92,14 +99,25 @@ export default {
width: "1092px", width: "1092px",
}, },
}, },
targetId: "staffUuid",
getListApi: getStrategyStaffList,
searchForm: { searchForm: {
staffName: "", staffName: "",
}, },
tableParams: { };
},
computed: {
isPhoneMode() {
return this.strategyType == 0 || this.strategyType == 1;
},
targetId() {
return this.isPhoneMode ? "phoneNumber" : "staffUuid";
},
getListApi() {
return this.isPhoneMode ? getStrategyStaffListNew : getStrategyStaffList;
},
tableParams() {
return {
listName: "list", listName: "list",
mutiSelectUniqueKey: "staffUuid", mutiSelectUniqueKey: this.targetId,
mutiSelectName: "contentIndex", mutiSelectName: "contentIndex",
tableColumns: [ tableColumns: [
{ {
...@@ -124,23 +142,23 @@ export default { ...@@ -124,23 +142,23 @@ export default {
}, },
}, },
], ],
},
}; };
}, },
},
mounted() { mounted() {
}, },
methods: { methods: {
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
let { positionTypeList, merchantList, paramsInfo, delMerchantList } = this; let { positionTypeList, merchantList, paramsInfo, delMerchantList, biz } = this;
let { staffName } = this.searchForm; let { staffName } = this.searchForm;
let merchantIdList = []; let merchantIdList = [];
if (merchantList.length) if (merchantList.length)
merchantIdList = merchantList.map(item => item.merchantId); merchantIdList = merchantList.map(item => item.merchantId);
else merchantIdList = paramsInfo.merchantIds; else merchantIdList = paramsInfo?.merchantIds || [];
let params = { let params = {
positionTypeList, positionTypeList,
sceneType: paramsInfo.bizs == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改)) sceneType: biz == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改))
staffName, staffName,
merchantIdList, merchantIdList,
}; };
......
const STRATEGYTYPEOPTIONS = [ const STRATEGYTYPEOPTIONS = [
{ label: "学习", value: 0 }, { label: "学习", value: 0 },
{ label: "优秀案例分享", value: 1 }, { label: "优秀案例分享", value: 1 },
{ label: "带教", value: 2 }, // { label: "带教", value: 2 },
{ label: "任务下发", value: 3 }, { label: "通知", value: 3 },
{ label: "销售精英到店提拉", value: 4 }, { label: "销售精英到店提拉", value: 4 },
{ label: "强力促销", value: 5 }, { label: "强力促销", value: 5 },
{ label: "最终盘点与低客单产品购入", value: 6 }, { label: "最终盘点与低客单产品购入", value: 6 },
......
...@@ -67,19 +67,19 @@ ...@@ -67,19 +67,19 @@
<el-date-picker v-model="formData[item.key]" <el-date-picker v-model="formData[item.key]"
class="date-range" class="date-range"
end-placeholder="结束时间" end-placeholder="结束时间"
:picker-options="datePickerOptions[item.pickerOptions]"
range-separator="至" range-separator="至"
start-placeholder="开始时间" start-placeholder="开始时间"
type="daterange"> type="daterange"
:picker-options="datePickerOptions[item.pickerOptions]">
</el-date-picker> </el-date-picker>
</template> </template>
<template v-else-if="item.type == 'textarea'"> <template v-else-if="item.type == 'textarea'">
<el-input v-model="formData[item.key]" <el-input v-model="formData[item.key]"
:autosize="{ minRows: 6 }"
class="textarea-box" class="textarea-box"
type="textarea"
:autosize="{ minRows: 6 }"
:maxlength="item.maxlength" :maxlength="item.maxlength"
:placeholder="`请输入${item.label}`" :placeholder="`请输入${item.label}`">
type="textarea">
</el-input> </el-input>
</template> </template>
<template v-else-if="item.type == 'richText'"> <template v-else-if="item.type == 'richText'">
...@@ -110,9 +110,9 @@ ...@@ -110,9 +110,9 @@
<el-date-picker v-if="item.showDateTimePicker(formData)" <el-date-picker v-if="item.showDateTimePicker(formData)"
v-model="formData[item.timeKey]" v-model="formData[item.timeKey]"
class="date-time-picker" class="date-time-picker"
:picker-options="datePickerOptions[item.pickerOptions]"
placeholder="请选择执行时间" placeholder="请选择执行时间"
type="datetime"> type="datetime"
:picker-options="datePickerOptions[item.pickerOptions]">
</el-date-picker> </el-date-picker>
</template> </template>
</el-form-item> </el-form-item>
...@@ -126,9 +126,9 @@ ...@@ -126,9 +126,9 @@
@click="close"> @click="close">
取消 取消
</el-button> </el-button>
<el-button :loading="loading" <el-button type="primary"
:loading="loading"
:size="size" :size="size"
type="primary"
@click="confirm"> @click="confirm">
确定 确定
</el-button> </el-button>
...@@ -136,12 +136,14 @@ ...@@ -136,12 +136,14 @@
</div> </div>
<MultipleStaff ref="staffTagRef" <MultipleStaff ref="staffTagRef"
:choose-data="formData.staffList" :choose-data="formData.staffList"
:strategy-type="strategyType"
:visible="staffTagVisible" :visible="staffTagVisible"
@choose="formatMultipleList($event, 'staffList')" @choose="formatMultipleList($event, 'staffList')"
@dialogClose="staffTagVisible = false"> @dialogClose="staffTagVisible = false">
</MultipleStaff> </MultipleStaff>
<MultipleStaff ref="staffTagRef" <MultipleStaff ref="staffTagRef"
:choose-data="formData.staffList_1" :choose-data="formData.staffList_1"
:strategy-type="strategyType"
:visible="staffTag1Visible" :visible="staffTag1Visible"
@choose="formatMultipleList($event, 'staffList_1')" @choose="formatMultipleList($event, 'staffList_1')"
@dialogClose="staffTag1Visible = false"> @dialogClose="staffTag1Visible = false">
...@@ -198,7 +200,7 @@ export default { ...@@ -198,7 +200,7 @@ export default {
return { return {
GET_POSITION_TYPE_LIST: () => this.positionTypeList, GET_POSITION_TYPE_LIST: () => this.positionTypeList,
GET_MERCHANT_LIST: () => this.merchantList, GET_MERCHANT_LIST: () => this.merchantList,
GET_BIZ: () => this.biz, GET_BIZ: () => this.currentBiz,
DEL_PARAMS_MERCHANT_LIST: () => this.delMerchantList, DEL_PARAMS_MERCHANT_LIST: () => this.delMerchantList,
}; };
}, },
...@@ -290,6 +292,10 @@ export default { ...@@ -290,6 +292,10 @@ export default {
merchantName() { merchantName() {
return this.GET_MERCHANT_NAME && this.GET_MERCHANT_NAME(); return this.GET_MERCHANT_NAME && this.GET_MERCHANT_NAME();
}, },
// 门店看板从 inject 的 paramsInfo.bizs 取;策略中心批量下发走 biz prop
currentBiz() {
return this.paramsInfo?.bizs ?? this.biz;
},
formRules() { formRules() {
const { strategyType } = this; const { strategyType } = this;
...@@ -431,7 +437,7 @@ export default { ...@@ -431,7 +437,7 @@ export default {
confirm() { confirm() {
try { try {
this.loading = true; this.loading = true;
let { paramsInfo, merchantName, formData, strategyType, merchantList, biz } = this; let { paramsInfo, merchantName, formData, strategyType, merchantList, currentBiz: biz } = this;
let { title, subTitle, content, staffList, staffList_1, courseList, recordingList, handlerType, description, pushType, dateRange, pushTime } = formData; let { title, subTitle, content, staffList, staffList_1, courseList, recordingList, handlerType, description, pushType, dateRange, pushTime } = formData;
this.$refs.addRef.validate(async (valid) => { this.$refs.addRef.validate(async (valid) => {
if (valid) { if (valid) {
...@@ -502,7 +508,6 @@ export default { ...@@ -502,7 +508,6 @@ export default {
}; };
}); });
} }
console.log(params);
const data = await batchCreateStrategy(params); const data = await batchCreateStrategy(params);
this.loading = false; this.loading = false;
if (data) { if (data) {
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<el-form ref="form" <el-form ref="form"
class="form" class="form"
label-width="110px" label-width="110px"
size="small"
:model="formData" :model="formData"
:rules="rules" :rules="rules">
size="small">
<el-form-item label="任务类型:" prop="taskType"> <el-form-item label="任务类型:" prop="taskType">
<el-select v-model="formData.taskType" <el-select v-model="formData.taskType"
placeholder="请选择任务类型" placeholder="请选择任务类型"
...@@ -70,8 +70,8 @@ ...@@ -70,8 +70,8 @@
<el-input v-model="formData.description" <el-input v-model="formData.description"
maxlength="200" maxlength="200"
placeholder="请输入任务说明" placeholder="请输入任务说明"
:rows="6" type="textarea"
type="textarea"> :rows="6">
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -82,9 +82,9 @@ ...@@ -82,9 +82,9 @@
@click="close"> @click="close">
取消 取消
</el-button> </el-button>
<el-button :loading="loading" <el-button size="small"
size="small"
type="primary" type="primary"
:loading="loading"
@click="confirm"> @click="confirm">
确定 确定
</el-button> </el-button>
...@@ -299,7 +299,6 @@ export default { ...@@ -299,7 +299,6 @@ export default {
if (allStaffs.length) { if (allStaffs.length) {
params.staffList = allStaffs; params.staffList = allStaffs;
} }
console.log(params);
const data = await batchCreateStrategy(params); const data = await batchCreateStrategy(params);
this.loading = false; this.loading = false;
if (data) { if (data) {
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<el-form ref="form" <el-form ref="form"
class="form" class="form"
label-width="110px" label-width="110px"
size="small"
:model="formData" :model="formData"
:rules="rules" :rules="rules">
size="small">
<el-form-item label="需带教人员:" prop="staffList"> <el-form-item label="需带教人员:" prop="staffList">
<el-button size="small" @click="openStaffDialog"> <el-button size="small" @click="openStaffDialog">
选择人员 选择人员
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
<el-input v-model="formData.description" <el-input v-model="formData.description"
maxlength="200" maxlength="200"
placeholder="请输入申请说明" placeholder="请输入申请说明"
:rows="6" type="textarea"
type="textarea"> :rows="6">
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
@click="close"> @click="close">
取消 取消
</el-button> </el-button>
<el-button :loading="loading" <el-button size="small"
size="small"
type="primary" type="primary"
:loading="loading"
@click="confirm"> @click="confirm">
确定 确定
</el-button> </el-button>
...@@ -197,7 +197,6 @@ export default { ...@@ -197,7 +197,6 @@ export default {
}; };
}); });
} }
console.log(params);
const data = await batchCreateStrategy(params); const data = await batchCreateStrategy(params);
this.loading = false; this.loading = false;
if (data) { if (data) {
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
</div> </div>
天 天
<el-button class="stop" <el-button class="stop"
plain
size="small" size="small"
type="primary" type="primary"
plain
@click="openStopBusinessDialog"> @click="openStopBusinessDialog">
停止展业 停止展业
</el-button> </el-button>
......
<template> <template>
<div :class="['warning-item flex',`bg-${item.type || 1}`]"> <div class="warning-item flex" :class="[`bg-${item.type || 1}`]">
<img <img class="warning-icon"
:src="icon" :src="icon">
class="warning-icon" <div class="warning-text text-hide">
> {{ item.text }}
<div class="warning-text text-hide">{{ item.text }}</div> </div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
const type_1 = require('@/assets/strategy/icon-strategy-type01.png'), const type_1 = require("@/assets/strategy/icon-strategy-type01.png");
type_2 = require('@/assets/strategy/icon-strategy-type02.png'), const type_2 = require("@/assets/strategy/icon-strategy-type01.png");
type_3 = require('@/assets/strategy/icon-strategy-type03.png'), const type_3 = require("@/assets/strategy/icon-strategy-type02.png");
type_4 = require('@/assets/strategy/icon-strategy-type04.png'), const type_6 = require("@/assets/strategy/icon-strategy-type06.png");
type_5 = require('@/assets/strategy/icon-strategy-type05.png'), const type_4 = require("@/assets/strategy/icon-strategy-type07.png");
type_6 = require('@/assets/strategy/icon-strategy-type06.png') const type_5 = require("@/assets/strategy/icon-strategy-type08.png");
export default { export default {
name: 'EarlyWarningTips', name: "EarlyWarningTips",
props: { props: {
item: { item: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
} },
},
data() {
return {
};
}, },
computed: { computed: {
icon () { icon() {
return { return {
1: type_1, 1: type_1,
2: type_2, 2: type_2,
3: type_3, 3: type_3,
4: type_4, 4: type_4,
5: type_5, 5: type_5,
6: type_6 6: type_6,
}[this.item.type] || '' }[this.item.type] || "";
}
}, },
data () {
return {
}
}, },
mounted () { mounted() {
}, },
methods: { methods: {
} },
} };
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
...@@ -76,6 +76,18 @@ export default { ...@@ -76,6 +76,18 @@ export default {
background: #f2472414; background: #f2472414;
} }
.bg-2 { .bg-2 {
background: #f2472414;
}
.bg-3 {
background: #ff9d0a14; background: #ff9d0a14;
} }
.bg-4 {
background: #f2472414;
}
.bg-5 {
background: #ff9d0a14;
}
.bg-6 {
background: #2c66f714;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
</template> </template>
</template> </template>
</div> </div>
<div class="sub-value" :class="[{ show: i.subKey && viewData[i.subKey] != null }]"> <div class="sub-value"
:class="[{ show: shouldShowBottomTarget(i) }]">
兜底目标{{ viewData[i.subKey] }}% 兜底目标{{ viewData[i.subKey] }}%
</div> </div>
</div> </div>
...@@ -68,6 +69,10 @@ const overviewList = [ ...@@ -68,6 +69,10 @@ const overviewList = [
subKey: "vehicleWarrantyConversionBottomTarget", subKey: "vehicleWarrantyConversionBottomTarget",
unit: "%", unit: "%",
}, },
{
label: "生态系数",
key: "vehicleWarrantyEcoCoefficient",
},
], ],
}, },
{ {
...@@ -89,6 +94,10 @@ const overviewList = [ ...@@ -89,6 +94,10 @@ const overviewList = [
subKey: "safetyPackageConversionBottomTarget", subKey: "safetyPackageConversionBottomTarget",
unit: "%", unit: "%",
}, },
{
label: "生态系数",
key: "safetyPackageEcoCoefficient",
},
], ],
}, },
{ {
...@@ -110,6 +119,10 @@ const overviewList = [ ...@@ -110,6 +119,10 @@ const overviewList = [
subKey: "batteryWarrantyConversionBottomTarget", subKey: "batteryWarrantyConversionBottomTarget",
unit: "%", unit: "%",
}, },
{
label: "生态系数",
key: "batteryWarrantyEcoCoefficient",
},
], ],
}, },
{ {
...@@ -131,6 +144,10 @@ const overviewList = [ ...@@ -131,6 +144,10 @@ const overviewList = [
subKey: "tireWarrantyConversionBottomTarget", subKey: "tireWarrantyConversionBottomTarget",
unit: "%", unit: "%",
}, },
{
label: "生态系数",
key: "tireWarrantyEcoCoefficient",
},
], ],
}, },
]; ];
...@@ -263,6 +280,11 @@ export default { ...@@ -263,6 +280,11 @@ export default {
type: [Number, String], type: [Number, String],
default: 1, default: 1,
}, },
// 是否为主机厂数据来源 Tab(activeDataSource === 2)
isOemDataSource: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -282,23 +304,27 @@ export default { ...@@ -282,23 +304,27 @@ export default {
overviewList() { overviewList() {
const { isHarmony, businessType } = this; const { isHarmony, businessType } = this;
const biz = Number(businessType); const biz = Number(businessType);
if (this.isStaff) { if (this.isStaff && isHarmony && biz === 2) {
return this.deepClone(overviewList); const list = this.deepClone(overviewList02);
list.forEach((section) => {
section.list = section.list.filter(item => item.label !== "生态系数");
});
return list;
} }
if (isHarmony && biz === 1) { if (isHarmony && biz === 1) {
const list = this.deepClone(overviewList); const list = this.deepClone(overviewList);
list.forEach((e, index) => { // list.forEach((e, index) => {
e.list.push({ // e.list.push({
label: "生态系数", // label: "生态系数",
key: { // key: {
0: "vehicleWarrantyEcoCoefficient", // 0: "vehicleWarrantyEcoCoefficient",
1: "safetyPackageEcoCoefficient", // 1: "safetyPackageEcoCoefficient",
2: "batteryWarrantyEcoCoefficient", // 2: "batteryWarrantyEcoCoefficient",
3: "tireWarrantyEcoCoefficient", // 3: "tireWarrantyEcoCoefficient",
}[index], // }[index],
hide: true, // hide: true,
}); // });
}); // });
return list; return list;
} }
...@@ -309,9 +335,25 @@ export default { ...@@ -309,9 +335,25 @@ export default {
return []; return [];
}, },
}, },
mounted() { watch: {
viewData: {
handler(val) {
// console.log("[OverViewList] viewData:", val);
},
deep: true,
immediate: true,
},
}, },
methods: { methods: {
shouldShowBottomTarget(item) {
if (!item.subKey || this.viewData[item.subKey] == null) {
return false;
}
if (this.isOemDataSource && item.label === "渗透率") {
return false;
}
return true;
},
handleTargetConfig(index) { handleTargetConfig(index) {
this.historyTargetIndex = index; this.historyTargetIndex = index;
this.historyTargetVisible = true; this.historyTargetVisible = true;
......
<template> <template>
<div class="recruitment"> <div class="recruitment">
<div class="recruitment-title">招聘概况</div> <div class="recruitment-title">
招聘概况
</div>
<div class="recruitment-content"> <div class="recruitment-content">
<div class="recruitment-card" v-for="(item, index) in recruitmentOptions" :key="index"> <div v-for="(item, index) in recruitmentOptions"
<div class="card-label">{{ item.label }}</div> :key="index"
class="recruitment-card">
<div class="card-label">
{{ item.label }}
</div>
<div class="card-value"> <div class="card-value">
{{ recruitmentData[item.key] || 0 }}<span class="card-unit">人</span> {{ recruitmentData[item.key] || 0 }}<span class="card-unit">人</span>
</div> </div>
...@@ -13,46 +19,46 @@ ...@@ -13,46 +19,46 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import data from '@/views/stockManage/returnManage/constant/data';
import { import {
getRecruitmentDemandOverview getRecruitmentDemandOverview,
} from '@/api/earlyWarningManager' } from "@/api/earlyWarningManager";
import data from "@/views/stockManage/returnManage/constant/data";
export default { export default {
name: 'Recruitment', name: "Recruitment",
inject: ['GET_PARAMS_INFO'], inject: ["GET_PARAMS_INFO"],
data () { data() {
return { return {
recruitmentData: {}, recruitmentData: {},
recruitmentOptions: [ recruitmentOptions: [
{ label: '需求总数', key: 'allOfDemand' }, { label: "需求总数", key: "allOfDemand" },
{ label: '在招数量', key: 'recruitingCount' }, { label: "在招数量", key: "recruitingCount" },
{ label: '入职人数', key: 'allOfOnboarding' }, { label: "入职人数", key: "allOfOnboarding" },
{ label: '离职人数', key: 'resignedCount' } { label: "离职人数", key: "resignedCount" },
] ],
} };
}, },
computed: { computed: {
paramsInfo () { paramsInfo() {
return this.GET_PARAMS_INFO() return this.GET_PARAMS_INFO();
}, },
}, },
mounted () { mounted() {
}, },
methods: { methods: {
init () { init() {
this.getRecruitmentData() this.getRecruitmentData();
}, },
async getRecruitmentData () { async getRecruitmentData() {
let { merchantIds, bizs } = this.paramsInfo let { merchantIds, bizs } = this.paramsInfo;
const data = await getRecruitmentDemandOverview({ const data = await getRecruitmentDemandOverview({
biz: bizs, biz: bizs,
merchantId: merchantIds[0] merchantId: merchantIds[0],
}) });
console.log(data, 'Recruitment/index.vue(查询门店招聘数据)') this.recruitmentData = data || {};
this.recruitmentData = data || {} },
} },
} };
}
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
...@@ -93,7 +99,7 @@ export default { ...@@ -93,7 +99,7 @@ export default {
} }
.card-value { .card-value {
color: #2A58AD; color: #2a58ad;
font-size: 30px; font-size: 30px;
font-weight: 600; font-weight: 600;
text-align: center; text-align: center;
......
...@@ -194,9 +194,16 @@ ...@@ -194,9 +194,16 @@
class="staff-overview-item right"> class="staff-overview-item right">
<div class="content"> <div class="content">
<OverViewList :business-type="paramsInfo.bizs" <OverViewList :business-type="paramsInfo.bizs"
:is-harmony="isHarmony"
:is-staff="true" :is-staff="true"
:view-data="viewData"> :view-data="viewData">
</OverViewList> </OverViewList>
<div v-show="!isHarmony" class="empty-box">
<img alt="暂无数据" src="@/assets/strategy/emepty-strategy.png">
<div class="empty-text">
暂无数据
</div>
</div>
</div> </div>
<template v-for="(item, index) in rightWarningInfoList"> <template v-for="(item, index) in rightWarningInfoList">
<EarlyWarningTips :key="index" <EarlyWarningTips :key="index"
...@@ -215,6 +222,7 @@ ...@@ -215,6 +222,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { import {
disableStrategyStaff, disableStrategyStaff,
getStrategyBusinessAnalysisStoreSpecialBrand,
getStrategyGoodsSummaryWithWarnZJ, getStrategyGoodsSummaryWithWarnZJ,
getStrategyMerchantAnalysisEmployeeSummary, getStrategyMerchantAnalysisEmployeeSummary,
getStrategyMerchantAnalysisGoodsSummaryWithWarn, getStrategyMerchantAnalysisGoodsSummaryWithWarn,
...@@ -345,6 +353,7 @@ export default { ...@@ -345,6 +353,7 @@ export default {
], ],
viewData: {}, viewData: {},
summaryInfo: {}, summaryInfo: {},
isHarmony: false,
staffTimeLoading: true, staffTimeLoading: true,
staffInfoLoading: true, staffInfoLoading: true,
staffLeftLoading: true, staffLeftLoading: true,
...@@ -361,10 +370,15 @@ export default { ...@@ -361,10 +370,15 @@ export default {
methods: { methods: {
init() { init() {
this.currentIndex = -1; this.currentIndex = -1;
this.getStrategyBusinessAnalysisStoreSpecialBrand();
this.getStrategyStaffListAnalysis(); this.getStrategyStaffListAnalysis();
}, },
async getStrategyBusinessAnalysisStoreSpecialBrand() {
const params = this.paramsInfo;
const data = await getStrategyBusinessAnalysisStoreSpecialBrand(params);
this.isHarmony = data;
},
disabledStaff(item) { disabledStaff(item) {
console.log(item);
this.$confirm("对员工进行禁用操作后,对应的账户无法再使用;历史已产生的业务数据不受影响。", "提示", { this.$confirm("对员工进行禁用操作后,对应的账户无法再使用;历史已产生的业务数据不受影响。", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
...@@ -423,7 +437,7 @@ export default { ...@@ -423,7 +437,7 @@ export default {
this.getStrategyStaffSummaryDuration(item); this.getStrategyStaffSummaryDuration(item);
this.getStrategyMerchantAnalysisEmployeeSummary(item); this.getStrategyMerchantAnalysisEmployeeSummary(item);
this.getStrategyMerchantAnalysisGoodsSummaryWithWarn(item); this.getStrategyMerchantAnalysisGoodsSummaryWithWarn(item);
this.getStrategyGoodsSummaryWithWarnZJInfo(item); // this.getStrategyGoodsSummaryWithWarnZJInfo(item);
}, },
async getStrategyMerchantAnalysisGoodsSummaryWithWarn(item) { async getStrategyMerchantAnalysisGoodsSummaryWithWarn(item) {
try { try {
...@@ -433,28 +447,28 @@ export default { ...@@ -433,28 +447,28 @@ export default {
...params, ...params,
staffUuids: [item.staffId], staffUuids: [item.staffId],
}); });
console.log(summaryGoodsData, "getStrategyMerchantAnalysisGoodsSummaryWithWarn(查询驻店员工商品概况)");
this.viewData = summaryGoodsData || {}; this.viewData = summaryGoodsData || {};
this.staffRightLoading = false; this.staffRightLoading = false;
} catch (error) { } catch (error) {
this.staffRightLoading = false; this.staffRightLoading = false;
} }
}, },
async getStrategyGoodsSummaryWithWarnZJInfo(item) { // async getStrategyGoodsSummaryWithWarnZJInfo(item) {
try { // try {
this.staffRightLoading = true; // this.staffRightLoading = true;
const params = this.paramsInfo; // const params = this.paramsInfo;
const summaryGoodsData = await getStrategyGoodsSummaryWithWarnZJ({ // const summaryGoodsData = await getStrategyGoodsSummaryWithWarnZJ({
...params, // ...params,
staffUuids: [item.staffId], // staffUuids: [item.staffId],
}); // });
console.log(summaryGoodsData, "getStrategyGoodsSummaryWithWarnZJ"); // console.log(summaryGoodsData, "getStrategyGoodsSummaryWithWarnZJ");
// this.viewData = summaryGoodsData || {}; // // this.viewData = summaryGoodsData || {};
// this.staffRightLoading = false; // // this.staffRightLoading = false;
} catch (error) { // } catch (error) {
// this.staffRightLoading = false; // // this.staffRightLoading = false;
} // }
}, // },
async getStrategyMerchantAnalysisEmployeeSummary(item) { async getStrategyMerchantAnalysisEmployeeSummary(item) {
try { try {
this.staffLeftLoading = true; this.staffLeftLoading = true;
...@@ -464,7 +478,6 @@ export default { ...@@ -464,7 +478,6 @@ export default {
staffUuids: [item.staffId], staffUuids: [item.staffId],
staffPhone: item.staffPhone, staffPhone: item.staffPhone,
}); });
console.log(data, "getStrategyStaffListAnalysis(查询驻店员工概况)");
this.summaryInfo = data; this.summaryInfo = data;
this.staffLeftLoading = false; this.staffLeftLoading = false;
} catch (error) { } catch (error) {
...@@ -495,12 +508,12 @@ export default { ...@@ -495,12 +508,12 @@ export default {
if ((index + 1) % 2 == 0) { if ((index + 1) % 2 == 0) {
rightWarningInfoList.push({ rightWarningInfoList.push({
type: e.warningText.startsWith("兜底预警") ? 1 : 2, type: e.warningText.startsWith("兜底预警") ? 1 : 2,
text: e.warningText, text: `${e.warningTypeName}: ${e.warningText}`,
}); });
} else { } else {
leftWarningInfoList.push({ leftWarningInfoList.push({
type: e.warningText.startsWith("兜底预警") ? 1 : 2, type: e.warningText.startsWith("兜底预警") ? 1 : 2,
text: e.warningText, text: `${e.warningTypeName}: ${e.warningText}`,
}); });
} }
}); });
...@@ -732,9 +745,9 @@ export default { ...@@ -732,9 +745,9 @@ export default {
.summary-box { .summary-box {
position: relative; position: relative;
height: calc(100% - 91px); height: calc(100% - 91px);
margin-top: 8px; margin-top: 18%;
box-sizing: border-box; box-sizing: border-box;
padding: 12px 35px 12px 13px; padding: 12px 10px 12px 13px;
z-index: 9; z-index: 9;
.help { .help {
position: absolute; position: absolute;
...@@ -755,7 +768,7 @@ export default { ...@@ -755,7 +768,7 @@ export default {
} }
.fixed-summary02 { .fixed-summary02 {
position: absolute; position: absolute;
bottom: 12%; bottom: 30%;
left: 50%; left: 50%;
transform: translateX(-54%); transform: translateX(-54%);
min-width: 95px; min-width: 95px;
...@@ -841,6 +854,33 @@ export default { ...@@ -841,6 +854,33 @@ export default {
width: calc(100% - 436px); width: calc(100% - 436px);
.content { .content {
border-color: #e5e5e5; border-color: #e5e5e5;
.empty-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
box-sizing: border-box;
font-size: 12px;
color: #909399;
text-align: center;
pointer-events: none;
img {
width: 86px;
height: 86px;
display: block;
}
.empty-text {
margin-top: 8px;
line-height: 17px;
}
}
} }
} }
} }
......
<template> <template>
<baseDialog <baseDialog class="detail-content-warn"
:is-show.sync="dialogShow" :btn-loding="btnLoding"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
class="detail-content-warn" :is-show.sync="dialogShow"
@handleClick="submit" @handleClick="submit">
:btnLoding="btnLoding" <el-form v-loading="loading"
>
<el-form
v-loading="loading"
class="form" class="form"
label-width="120px" label-width="120px"
size="small" size="small">
> <el-form-item label="门店名称:"
<el-form-item required>
label="门店名称:" <el-select v-model="currentMerchantId"
required
>
<el-select
v-model="currentMerchantId"
class="select" class="select"
filterable filterable>
> <el-option v-for="item in merchantList"
<el-option :key="item.merchantNo"
v-for="item in merchantList" :label="item.storeName"
:key="item.merchantId" :value="item.merchantNo">
:label="item.merchantName" </el-option>
:value="item.merchantId"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -34,77 +25,102 @@ ...@@ -34,77 +25,102 @@
</template> </template>
<script> <script>
import { listShop4sByRef } from "@api/merchant" import { getWarningSummaryList } from "@/api/earlyWarningManager";
import {
cleanWarningSummaryParams,
getWarningSummaryParamsFromRoute,
loadWarningSummaryParams,
} from "../../../utils/warningSummaryParams";
export default { export default {
name: "ChangeMerchantDialog", name: "ChangeMerchantDialog",
inject: {
GET_PARAMS_INFO: { default: () => () => ({}) },
},
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
},
merchantId: [String, Number],
},
data() {
return {
dialogConfig: {
config: {
title: "切换门店",
width: "640px",
}, },
merchantId: [String, Number] },
merchantList: [],
currentMerchantId: "",
loading: false,
btnLoding: false,
};
}, },
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
},
set(val) {
this.close();
}, },
set (val) {
this.close()
}
}, },
}, },
watch: { watch: {
visible: { visible: {
handler (val) { handler(val) {
if (val) { if (val) {
this.currentMerchantId = this.merchantId this.currentMerchantId = String(this.merchantId);
this.getMerchantList() // console.log(typeof (this.currentMerchantId));
this.getMerchantList();
} }
}, },
immediate: true, immediate: true,
deep: true deep: true,
} },
}, },
mounted () { mounted() {
}, },
data () { methods: {
return { close() {
dialogConfig: { this.btnLoding = false;
config: { this.$emit("dialogClose");
title: "切换门店",
width: "640px"
}
}, },
merchantList: [], getWarningSummaryRequestParams() {
currentMerchantId: '', const stored = loadWarningSummaryParams() || getWarningSummaryParamsFromRoute(this.$route.query);
loading: false, const { bizs, cycleType, startTime, endTime } = this.GET_PARAMS_INFO() || {};
btnLoding: false return cleanWarningSummaryParams({
...stored,
...(bizs != null && { businessType: bizs }),
...(cycleType != null && { cycleType }),
...(startTime && { startDate: startTime }),
...(endTime && { endDate: endTime }),
});
},
async getMerchantList() {
this.loading = true;
try {
const data = await getWarningSummaryList(this.getWarningSummaryRequestParams());
this.merchantList = data;
} finally {
this.loading = false;
} }
}, },
methods: { async submit() {
close () { this.btnLoding = true;
this.btnLoding = false if (this.currentMerchantId != this.merchantId) {
this.$emit('dialogClose') this.$emit("changeMerchant", {
},
async getMerchantList () {
this.loading = true
const data = await listShop4sByRef({})
this.loading = false
this.merchantList = data
},
async submit () {
this.btnLoding = true
if (this.currentMerchantId != this.merchantId) this.$emit('changeMerchant', {
merchantId: this.currentMerchantId, merchantId: this.currentMerchantId,
merchantName: this.merchantList.find(item => item.merchantId == this.currentMerchantId).merchantName merchantName: this.merchantList.find(item => item.merchantNo == this.currentMerchantId).storeName,
}) });
this.close()
} }
} this.close();
} },
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -15,8 +15,14 @@ ...@@ -15,8 +15,14 @@
:src="`${IMG_URL}merchant-icon.webp`"> :src="`${IMG_URL}merchant-icon.webp`">
</div> </div>
<div class="info "> <div class="info ">
<div class="name text-hide"> <div class="name flex">
<p class="merchant-name text-hide">
{{ merchantDetailInfo.merchantName || '-' }} {{ merchantDetailInfo.merchantName || '-' }}
</p>
<span class="back-btn"
@click="handleBack">
返回
</span>
</div> </div>
<div class="control flex"> <div class="control flex">
<div class="scene flex"> <div class="scene flex">
...@@ -119,7 +125,7 @@ export default { ...@@ -119,7 +125,7 @@ export default {
}, },
{ {
label: "区域督导", label: "区域督导",
key: "flightSupervisionext", key: "flightSupervisionText",
tooltip: true, tooltip: true,
}, },
{ {
...@@ -204,11 +210,50 @@ export default { ...@@ -204,11 +210,50 @@ export default {
changeMerchant(e) { changeMerchant(e) {
this.$emit("changeMerchant", e); this.$emit("changeMerchant", e);
}, },
formatDateValue(date) {
if (!date)
return null;
if (typeof date === "string")
return date;
const d = new Date(date);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, "0");
const day = String(d.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
},
setDate(rangeType, dateRange) { setDate(rangeType, dateRange) {
if (rangeType) if (rangeType)
this.timeRangeType = this.timeRangeOptions.find(item => item.value == rangeType); this.timeRangeType = this.timeRangeOptions.find(item => item.value == rangeType);
if (dateRange) if (dateRange)
this.dateRange = dateRange; this.dateRange = { ...dateRange };
// 等待 CalendarCustom 因切换周期类型触发的 watcher 执行完毕后再同步
this.$nextTick(() => {
const calendar = this.$refs.calendarCustom;
if (calendar?.debouncedNotifyDateRangeChange?.cancel) {
calendar.debouncedNotifyDateRangeChange.cancel();
}
if (dateRange?.startDate && dateRange?.endDate && calendar) {
calendar.internalDateRange = {
startDate: new Date(dateRange.startDate),
endDate: new Date(dateRange.endDate),
};
}
const range = dateRange?.startDate && dateRange?.endDate
? this.dateRange
: calendar?.internalDateRange;
if (!range?.startDate || !range?.endDate)
return;
const { value } = this.timeRangeType;
this.$emit("dateChange", {
startTime: this.formatDateValue(range.startDate),
endTime: this.formatDateValue(range.endDate),
cycleType: value || 2,
fromRouteSync: true,
});
});
},
handleBack() {
this.$router.go(-1);
}, },
}, },
}; };
...@@ -258,6 +303,25 @@ export default { ...@@ -258,6 +303,25 @@ export default {
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
margin-bottom: 8px; margin-bottom: 8px;
max-width: 100%;
.merchant-name {
margin: 0;
flex: 0 1 auto;
min-width: 0;
}
.back-btn {
flex-shrink: 0;
margin-left: 8px;
padding: 4px 12px;
font-size: 13px;
font-weight: 400;
line-height: 1;
cursor: pointer;
border-radius: 4px;
border: 1px solid #e5e5e5;
background: #fff;
user-select: none;
}
} }
} }
} }
......
...@@ -185,9 +185,9 @@ ...@@ -185,9 +185,9 @@
</template> </template>
</div> </div>
<d2-table ref="leftTable" <d2-table ref="leftTable"
layout="total, prev, pager, next"
:before-search-fn="leftBeforeSearchFn" :before-search-fn="leftBeforeSearchFn"
:get-list-api="secondGetListApi" :get-list-api="secondGetListApi"
layout="total, prev, pager, next"
:pager-count="5" :pager-count="5"
:search-form="leftFormSearch" :search-form="leftFormSearch"
:table-params="secondTableParams"> :table-params="secondTableParams">
...@@ -234,9 +234,9 @@ ...@@ -234,9 +234,9 @@
</template> </template>
</div> </div>
<d2-table ref="rightTable" <d2-table ref="rightTable"
layout="total, prev, pager, next"
:before-search-fn="rightBeforeSearchFn" :before-search-fn="rightBeforeSearchFn"
:get-list-api="secondGetListApi" :get-list-api="secondGetListApi"
layout="total, prev, pager, next"
:pager-count="5" :pager-count="5"
:search-form="rightFormSearch" :search-form="rightFormSearch"
:table-params="secondTableParams"> :table-params="secondTableParams">
...@@ -366,8 +366,9 @@ export default { ...@@ -366,8 +366,9 @@ export default {
{ {
label: "成交状态", label: "成交状态",
minWidth: 80, minWidth: 80,
formatter: (cell) => { prop: "orderFinishFlag",
return cell.defencePoint != null ? `${cell.defencePoint}分` : "-"; formatter(row) {
return row.orderFinishFlag ? "成功" : "战败";
}, },
}, },
], ],
......
import dayjs from "dayjs" import dayjs from "dayjs";
const STRATEGYTYPEOPTIONS = { const STRATEGYTYPEOPTIONS = {
0: '学习', 0: "学习",
1: '优秀案例分享', 1: "优秀案例分享",
2: '带教', 2: "带教",
3: '任务下发', 3: "通知",
4: '销售精英到店提拉', 4: "销售精英到店提拉",
5: '强力促销', 5: "强力促销",
6: '最终盘点与低客单产品购入', 6: "最终盘点与低客单产品购入",
7: '留言' 7: "留言",
} };
const DATE_RANGE = { const DATE_RANGE = {
label: '执行周期', label: "执行周期",
format: (val) => { format: (val) => {
let { let {
startDate, startDate,
endDate endDate,
} = val } = val;
return `${dayjs(startDate).format('YYYY-MM-DD')}至 ${dayjs(endDate).format('YYYY-MM-DD')}` return `${dayjs(startDate).format("YYYY-MM-DD")}至 ${dayjs(endDate).format("YYYY-MM-DD")}`;
} },
} };
const TITLE = { const TITLE = {
label: '标题', label: "标题",
key: 'title', key: "title",
} };
const CREATED = { const CREATED = {
label: '操作人', label: "操作人",
key: 'createdBy', key: "createdBy",
} };
const CREATED_DATE = { const CREATED_DATE = {
label: '操作时间', label: "操作时间",
format: (val) => { format: (val) => {
return dayjs(val.createdDate).format('YYYY-MM-DD HH:mm:ss') return dayjs(val.createdDate).format("YYYY-MM-DD HH:mm:ss");
} },
} };
const STRATEGY_FORM_01 = [ const STRATEGY_FORM_01 = [
TITLE, TITLE,
DATE_RANGE, DATE_RANGE,
CREATED, CREATED,
CREATED_DATE CREATED_DATE,
] ];
const STRATEGY_FORM_2456 = [ const STRATEGY_FORM_2456 = [
CREATED, CREATED,
DATE_RANGE, DATE_RANGE,
{ {
label: '执行人', label: "执行人",
format: (val) => { format: (val) => {
let { let {
executePersons executePersons,
} = val } = val;
return executePersons?.map(item => item.username).join('/') return executePersons?.map(item => item.username).join("/");
}, },
hide: (val) => { hide: (val) => {
let { let {
strategyType strategyType,
} = val } = val;
return [5, 6].includes(strategyType) return [5, 6].includes(strategyType);
} },
}, },
CREATED_DATE CREATED_DATE,
] ];
const STRATEGY_FORM_3 = [ const STRATEGY_FORM_3 = [
CREATED, CREATED,
TITLE, TITLE,
CREATED_DATE, CREATED_DATE,
{ {
label: '副标题', label: "副标题",
key: 'subTitle', key: "subTitle",
class: 'bespread', class: "bespread",
}, },
{ {
label: '执行时间', label: "执行时间",
key: 'startDate', key: "startDate",
}, },
] ];
const STRATEGY_FORM_7 = [ const STRATEGY_FORM_7 = [
CREATED, CREATED,
CREATED_DATE, CREATED_DATE,
{ {
label: '处理人', label: "处理人",
format: (val) => { format: (val) => {
let { let {
executePersons executePersons,
} = val } = val;
return executePersons?.map(item => item.username).join('/') || '-' return executePersons?.map(item => item.username).join("/") || "-";
}, },
}, },
] ];
export { export {
STRATEGYTYPEOPTIONS,
STRATEGY_FORM_01, STRATEGY_FORM_01,
STRATEGY_FORM_2456,
STRATEGY_FORM_3, STRATEGY_FORM_3,
STRATEGY_FORM_7 STRATEGY_FORM_7,
} STRATEGY_FORM_2456,
STRATEGYTYPEOPTIONS,
};
...@@ -27,11 +27,17 @@ ...@@ -27,11 +27,17 @@
placement="top"> placement="top">
<template #content> <template #content>
<div class="tooltip-content-max"> <div class="tooltip-content-max">
<template v-if="i.format">
<div> {{ i.format(item) }}</div>
</template>
<template v-else>
<div v-html="item[i.key]"></div>
</template>
<div v-html="item[i.key]"></div> <div v-html="item[i.key]"></div>
</div> </div>
</template> </template>
<span class="two-line-ellipsis" <span :class="[i.format ? 'one-line-ellipsis' : 'two-line-ellipsis']"
v-html="item[i.key]"> v-html=" item[i.key] ? item[i.key] : i.format(item)">
</span> </span>
</el-tooltip> </el-tooltip>
</template> </template>
...@@ -50,7 +56,7 @@ ...@@ -50,7 +56,7 @@
</template> </template>
<div class="btn-list flex"> <div class="btn-list flex">
<!-- 状态=未下发 --> <!-- 状态=未下发 -->
<template v-if="item.pushFlag == 0"> <template v-if="item.pushFlag == 0 || item.pushFlag == 2 || item.pushFlag == 3">
<el-button class="btn-default _btn" <el-button class="btn-default _btn"
:size="size" :size="size"
@click="deleteStrategy(item)"> @click="deleteStrategy(item)">
...@@ -58,9 +64,9 @@ ...@@ -58,9 +64,9 @@
</el-button> </el-button>
</template> </template>
<el-button class="btn-primary _btn" <el-button class="btn-primary _btn"
type="primary"
plain plain
:size="size" :size="size"
type="primary"
@click="$emit('toDetail', item)"> @click="$emit('toDetail', item)">
查看详情 查看详情
</el-button> </el-button>
...@@ -125,6 +131,8 @@ export default { ...@@ -125,6 +131,8 @@ export default {
9: STRATEGY_9, 9: STRATEGY_9,
}[strategyType] || []; }[strategyType] || [];
console.log(list, "list");
return [ return [
...list, ...list,
{ {
...@@ -293,6 +301,17 @@ export default { ...@@ -293,6 +301,17 @@ export default {
white-space: normal; white-space: normal;
width: fit-content; width: fit-content;
} }
.one-line-ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1; /* 限制显示行数为 1 */
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
line-height: 1.5;
white-space: normal; /* 配合 -webkit-box 使用时需要保留 */
width: fit-content;
}
.content { .content {
margin-top: 8px; margin-top: 8px;
display: flex; display: flex;
...@@ -301,7 +320,8 @@ export default { ...@@ -301,7 +320,8 @@ export default {
line-height: 20px; line-height: 20px;
.label { .label {
color: #666666; color: #666666;
max-width: 70px; max-width: 80px;
white-space: nowrap;
} }
.value-box { .value-box {
width: calc(100% - 70px); width: calc(100% - 70px);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-04-01 09:57:49 * @Date: 2026-04-01 09:57:49
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-06-02 17:54:09 * @LastEditTime: 2026-06-10 10:14:26
* @FilePath: \dj-car-life-system\src\views\earlyWarningManager\strategyCentre\storeSignboard\components\StrategyList\contant.js * @FilePath: \dj-car-life-system\src\views\earlyWarningManager\strategyCentre\storeSignboard\components\StrategyList\contant.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -12,7 +12,7 @@ const STRATEGYTYPEOPTIONS = { ...@@ -12,7 +12,7 @@ const STRATEGYTYPEOPTIONS = {
0: "学习", 0: "学习",
1: "优秀案例分享", 1: "优秀案例分享",
2: "带教", 2: "带教",
3: "任务下发", 3: "通知",
4: "销售精英到店提拉", 4: "销售精英到店提拉",
5: "强力促销", 5: "强力促销",
6: "最终盘点与低客单产品购入", 6: "最终盘点与低客单产品购入",
...@@ -35,8 +35,9 @@ function STAFF_FORMAT(label) { ...@@ -35,8 +35,9 @@ function STAFF_FORMAT(label) {
label, label,
format: (val) => { format: (val) => {
let { staffList } = val; let { staffList } = val;
return staffList.filter(item => !item.userPosition).map(item => item.userName).join("/") || "-"; return staffList.map(item => item.userName).join("/") || "-";
}, },
tooltip: true,
}; };
} }
const STRATEGY_01 = [ const STRATEGY_01 = [
...@@ -89,12 +90,19 @@ const STRATEGY_8 = [ ...@@ -89,12 +90,19 @@ const STRATEGY_8 = [
STAFF_FORMAT("需带教人员"), STAFF_FORMAT("需带教人员"),
]; ];
const STRATEGY_9 = [ const STRATEGY_9 = [
STAFF_FORMAT("问题人员"), // STAFF_FORMAT("问题人员"),
{
label: "问题人员",
format: (val) => {
let { staffList } = val;
return staffList.filter(item => item.userPosition != 8 && item.userPosition != 9).map(item => item.userName).join("/") || "-";
},
},
{ {
label: "执行人员", label: "执行人员",
format: (val) => { format: (val) => {
let { staffList } = val; let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-"; return staffList.filter(item => item.userPosition == 8 || item.userPosition == 9).map(item => item.userName).join("/") || "-";
}, },
}, },
]; ];
...@@ -104,7 +112,7 @@ const STRATEGY_10_11_12 = [ ...@@ -104,7 +112,7 @@ const STRATEGY_10_11_12 = [
label: "执行人员", label: "执行人员",
format: (val) => { format: (val) => {
let { staffList } = val; let { staffList } = val;
return staffList.filter(item => item.userPosition != 0).map(item => item.userName).join("/") || "-"; return staffList.filter(item => item.userPosition == 8 || item.userPosition == 9).map(item => item.userName).join("/") || "-";
}, },
}, },
]; ];
......
...@@ -44,13 +44,22 @@ ...@@ -44,13 +44,22 @@
没有更多了 没有更多了
</div> </div>
</el-scrollbar> </el-scrollbar>
<AddTeaching :visibleSync.sync="addTeachingVisible" @refresh="init"></AddTeaching> <AddTeaching :biz="paramsInfo.bizs"
<AddTask :visibleSync.sync="addTaskVisible" @refresh="init"></AddTask> :visibleSync.sync="addTeachingVisible"
@refresh="init">
</AddTeaching>
<AddTask :biz="paramsInfo.bizs"
:visibleSync.sync="addTaskVisible"
@refresh="init">
</AddTask>
<StrategyDetail :dialogVisible.sync="strategyDetailVisible" <StrategyDetail :dialogVisible.sync="strategyDetailVisible"
:item="currentItem" :item="currentItem"
@openReceptionDialog="$emit('openReceptionDialog', $event)"> @openReceptionDialog="$emit('openReceptionDialog', $event)">
</StrategyDetail> </StrategyDetail>
<AddStrategy :dialogVisible.sync="addStrategyVisible" @refresh="init"></AddStrategy> <AddStrategy :biz="paramsInfo.bizs"
:dialogVisible.sync="addStrategyVisible"
@refresh="init">
</AddStrategy>
<TeachingDetail :item="currentItem" <TeachingDetail :item="currentItem"
:visibleSync.sync="teachingDetailVisible"> :visibleSync.sync="teachingDetailVisible">
</TeachingDetail> </TeachingDetail>
...@@ -119,7 +128,7 @@ export default { ...@@ -119,7 +128,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
const scrollbar = this.$refs.scrollbar; const scrollbar = this.$refs.scrollbar;
if (scrollbar && scrollbar.wrap) { if (scrollbar && scrollbar.wrap) {
console.log("绑定滚动事件"); // console.log("绑定滚动事件");
scrollbar.wrap.addEventListener("scroll", this.handleScroll); scrollbar.wrap.addEventListener("scroll", this.handleScroll);
} else { } else {
console.log("scrollbar 或 wrap 不存在:", { scrollbar, wrap: scrollbar?.wrap }); console.log("scrollbar 或 wrap 不存在:", { scrollbar, wrap: scrollbar?.wrap });
......
...@@ -79,10 +79,11 @@ ...@@ -79,10 +79,11 @@
<div class="summary-item flex fixed-summary"> <div class="summary-item flex fixed-summary">
<div class="label flex"> <div class="label flex">
渗透率<div class="num"> 渗透率<div class="num">
{{ formatMom(summaryInfo.penetrationRate) }} {{ formatMom(penetrationRate) }}
</div> </div>
</div> </div>
<div class="sub-value flex"> <div v-if="activeDataSource !== 2"
class="sub-value flex">
<template v-if="paramsInfo.cycleType != 4"> <template v-if="paramsInfo.cycleType != 4">
环比{{ formatMom(summaryInfo.penetrationRateMom) }} 环比{{ formatMom(summaryInfo.penetrationRateMom) }}
<template v-if="formatIsRatio(summaryInfo.penetrationRateMom)"> <template v-if="formatIsRatio(summaryInfo.penetrationRateMom)">
...@@ -100,10 +101,10 @@ ...@@ -100,10 +101,10 @@
</div> </div>
<div class="sub-value flex"> <div class="sub-value flex">
<template> <template>
环比{{ formatMom(summaryInfo.contactConversionRateMon) }} 环比{{ formatMom(summaryInfo.contactConversionRateMom) }}
<template v-if="formatIsRatio(summaryInfo.contactConversionRateMon)"> <template v-if="formatIsRatio(summaryInfo.contactConversionRateMom)">
<img class="arrow" <img class="arrow"
:src="getIconSrc(formatIsRatio(summaryInfo.contactConversionRateMon))" /> :src="getIconSrc(formatIsRatio(summaryInfo.contactConversionRateMom))" />
</template> </template>
</template> </template>
</div> </div>
...@@ -148,11 +149,18 @@ ...@@ -148,11 +149,18 @@
<div class="summary-overview-item right"> <div class="summary-overview-item right">
<div v-loading="summaryRightLoading" <div v-loading="summaryRightLoading"
class="content"> class="content">
<OverViewList :business-type="paramsInfo.bizs" <OverViewList has-e-hi
has-e-hi :business-type="paramsInfo.bizs"
:is-harmony="isHarmony" :is-harmony="isHarmony"
:is-oem-data-source="activeDataSource === 2"
:view-data="viewData"> :view-data="viewData">
</OverViewList> </OverViewList>
<div v-show="!isHarmony" class="empty-box">
<img alt="暂无数据" src="@/assets/strategy/emepty-strategy.png">
<div class="empty-text">
暂无数据
</div>
</div>
</div> </div>
<template v-for="(item, index) in rightWarningInfoList"> <template v-for="(item, index) in rightWarningInfoList">
<EarlyWarningTips :key="index" <EarlyWarningTips :key="index"
...@@ -322,6 +330,16 @@ export default { ...@@ -322,6 +330,16 @@ export default {
{ label: `主机厂数据${this.oemDataDateText}`, value: 2 }, { label: `主机厂数据${this.oemDataDateText}`, value: 2 },
]; ];
}, },
// 渗透率 = 总成交数 / 新车交付数;分母为 0 或无效时返回 null,避免 Infinity
penetrationRate() {
const { totalDealCount, newCarDeliveryCount } = this.summaryInfo || {};
const denominator = Number(newCarDeliveryCount);
const numerator = Number(totalDealCount);
if (!denominator || Number.isNaN(denominator) || Number.isNaN(numerator)) {
return null;
}
return ((numerator / denominator) * 100).toFixed(2);
},
}, },
watch: { watch: {
// 主机厂 Tab 隐藏时(切换为非月周期或无主机厂数据),自动回退到日报数据 // 主机厂 Tab 隐藏时(切换为非月周期或无主机厂数据),自动回退到日报数据
...@@ -344,6 +362,8 @@ export default { ...@@ -344,6 +362,8 @@ export default {
this.leftWarningInfoList = []; this.leftWarningInfoList = [];
this.rightWarningInfoList = []; this.rightWarningInfoList = [];
if (value === 2) { if (value === 2) {
this.getStrategyStoreDetailSummaryZJInfo();
this.getStrategyGoodsSummaryWithWarnZJInfo();
// this.getStrategyStoreDetailSummaryZJInfo(); // this.getStrategyStoreDetailSummaryZJInfo();
this.summaryInfo = this.summaryInfoZJ; this.summaryInfo = this.summaryInfoZJ;
this.viewData = this.viewZJData; this.viewData = this.viewZJData;
...@@ -378,7 +398,6 @@ export default { ...@@ -378,7 +398,6 @@ export default {
this.hasOemData = isMonthCycle && !!(data?.hasOemData ?? data?.existOemData ?? data?.oemDataExistFlag); this.hasOemData = isMonthCycle && !!(data?.hasOemData ?? data?.existOemData ?? data?.oemDataExistFlag);
this.summaryInfo = data || {}; this.summaryInfo = data || {};
this.summaryLeftLoading = false; this.summaryLeftLoading = false;
console.log(data, "SummaryOverview/index.vue(查询门店经营概况)");
} catch (error) { } catch (error) {
this.summaryLeftLoading = false; this.summaryLeftLoading = false;
} }
...@@ -390,7 +409,6 @@ export default { ...@@ -390,7 +409,6 @@ export default {
const summaryGoodsData = await getStrategyMerchantAnalysisGoodsSummaryWithWarn(params); const summaryGoodsData = await getStrategyMerchantAnalysisGoodsSummaryWithWarn(params);
this.viewData = summaryGoodsData || {}; this.viewData = summaryGoodsData || {};
this.summaryRightLoading = false; this.summaryRightLoading = false;
console.log(summaryGoodsData, "SummaryOverview/index.vue(查询门店商品销售情况)");
} catch (error) { } catch (error) {
this.summaryRightLoading = false; this.summaryRightLoading = false;
} }
...@@ -403,13 +421,13 @@ export default { ...@@ -403,13 +421,13 @@ export default {
data.forEach((e, index) => { data.forEach((e, index) => {
if ((index + 1) % 2 == 0) { if ((index + 1) % 2 == 0) {
rightWarningInfoList.push({ rightWarningInfoList.push({
type: e.startsWith("兜底预警") ? 1 : 2, type: e.warningType,
text: e, text: `${e.warningTypeName}: ${e.warningText}`,
}); });
} else { } else {
leftWarningInfoList.push({ leftWarningInfoList.push({
type: e.startsWith("兜底预警") ? 1 : 2, type: e.warningType,
text: e, text: `${e.warningTypeName}: ${e.warningText}`,
}); });
} }
}); });
...@@ -430,9 +448,9 @@ export default { ...@@ -430,9 +448,9 @@ export default {
this.summaryInfoZJ = data || {}; this.summaryInfoZJ = data || {};
this.startDay = data.periodStartDate; this.startDay = data.periodStartDate;
this.endDay = data.periodEndDate; this.endDay = data.periodEndDate;
this.showZJ = data.contactRate > 0; this.showZJ
= data?.newCarDeliveryCount != null && data.newCarDeliveryCount !== "";
this.summaryLeftLoading = false; this.summaryLeftLoading = false;
console.log(data, "SummaryOverview/index.vue(查询门店经营概况-主机厂)");
} catch (error) { } catch (error) {
this.summaryLeftLoading = false; this.summaryLeftLoading = false;
} }
...@@ -444,7 +462,6 @@ export default { ...@@ -444,7 +462,6 @@ export default {
const summaryGoodsData = await getStrategyGoodsSummaryWithWarnZJ(params); const summaryGoodsData = await getStrategyGoodsSummaryWithWarnZJ(params);
this.viewZJData = summaryGoodsData || {}; this.viewZJData = summaryGoodsData || {};
this.summaryRightLoading = false; this.summaryRightLoading = false;
console.log(summaryGoodsData, "SummaryOverview/index.vue(查询门店商品销售情况)");
} catch (error) { } catch (error) {
this.summaryRightLoading = false; this.summaryRightLoading = false;
} }
...@@ -583,7 +600,7 @@ export default { ...@@ -583,7 +600,7 @@ export default {
height: calc(100% - 91px); height: calc(100% - 91px);
margin-top: 8px; margin-top: 8px;
box-sizing: border-box; box-sizing: border-box;
padding: 12px 35px 12px 13px; padding: 12px 22px 12px 26px;
z-index: 9; z-index: 9;
.help { .help {
position: absolute; position: absolute;
...@@ -611,7 +628,6 @@ export default { ...@@ -611,7 +628,6 @@ export default {
font-size: 13px; font-size: 13px;
.label { .label {
color: #666666; color: #666666;
.num { .num {
display: block; display: block;
color: #2a58ad; color: #2a58ad;
...@@ -662,10 +678,11 @@ export default { ...@@ -662,10 +678,11 @@ export default {
justify-content: space-between; justify-content: space-between;
height: 68px; height: 68px;
.summary-item { .summary-item {
width: 112px; width: 118px;
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.label { .label {
color: #666666; color: #666666;
font-size: 13px; font-size: 13px;
...@@ -713,6 +730,33 @@ export default { ...@@ -713,6 +730,33 @@ export default {
width: calc(100% - 436px); width: calc(100% - 436px);
.content { .content {
border-color: #e5e5e5; border-color: #e5e5e5;
.empty-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
box-sizing: border-box;
font-size: 12px;
color: #909399;
text-align: center;
pointer-events: none;
img {
width: 86px;
height: 86px;
display: block;
}
.empty-text {
margin-top: 8px;
line-height: 17px;
}
}
} }
} }
} }
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
<el-image v-for="(img, imgIdx) in item.value" <el-image v-for="(img, imgIdx) in item.value"
:key="imgIdx" :key="imgIdx"
fit="cover" fit="cover"
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;"
:preview-src-list="item.value" :preview-src-list="item.value"
:src="img" :src="img">
style="width: 80px; height: 80px; margin-right: 10px; border-radius: 4px;">
</el-image> </el-image>
</div> </div>
<div v-else> <div v-else>
...@@ -109,7 +109,6 @@ export default { ...@@ -109,7 +109,6 @@ export default {
if (!this.item.id) if (!this.item.id)
return; return;
try { try {
this.item.id = 133;
const res = await queryStrategyStudyDetailById({ id: this.item.id }); const res = await queryStrategyStudyDetailById({ id: this.item.id });
if (res) { if (res) {
this.formatDetailData(res); this.formatDetailData(res);
......
...@@ -76,6 +76,8 @@ export default { ...@@ -76,6 +76,8 @@ export default {
isQualityVisible: false, isQualityVisible: false,
qualityDetailList: [], qualityDetailList: [],
currentNum: 0, currentNum: 0,
// 路由带入日期时,忽略日历组件挂载阶段的默认日期通知
pendingRouteDateSync: false,
paramsInfo: { paramsInfo: {
bizs: this.resolveBizs(), bizs: this.resolveBizs(),
sceneType: this.resolveBizs() == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改)) sceneType: this.resolveBizs() == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改))
...@@ -125,13 +127,14 @@ export default { ...@@ -125,13 +127,14 @@ export default {
// 获取路由参数 merchantNo // 获取路由参数 merchantNo
const { merchantNo, storeName, businessType } = this.$route.query; const { merchantNo, storeName, businessType } = this.$route.query;
if (merchantNo || storeName) { if (merchantNo || storeName) {
console.log("接收到的 merchantNo:", merchantNo);
// 可以根据 merchantNo 更新 merchantInfo 或进行其他操作 // 可以根据 merchantNo 更新 merchantInfo 或进行其他操作
this.paramsInfo.merchantIds = [merchantNo || ""]; this.paramsInfo.merchantIds = [merchantNo || ""];
this.merchantName = storeName || ""; this.merchantName = storeName || "";
this.paramsInfo.bizs = this.resolveBizs(businessType); this.paramsInfo.bizs = this.resolveBizs(businessType);
let { timeRangeType, startDate, endDate } = this.$route.query; const { timeRangeType, startDate, endDate } = this.$route.query;
if (timeRangeType || startDate || endDate) { const hasRouteDate = timeRangeType || startDate || endDate;
if (hasRouteDate) {
this.pendingRouteDateSync = true;
if (timeRangeType) { if (timeRangeType) {
this.paramsInfo.cycleType = { this.paramsInfo.cycleType = {
1: 2, 1: 2,
...@@ -139,14 +142,12 @@ export default { ...@@ -139,14 +142,12 @@ export default {
4: 4, 4: 4,
}[timeRangeType] || 2; }[timeRangeType] || 2;
} }
if (startDate) this.$nextTick(() => {
this.paramsInfo.startTime = startDate;
if (endDate)
this.paramsInfo.endTime = endDate;
this.storeSignboardInfoRef.setDate(this.paramsInfo.cycleType, { this.storeSignboardInfoRef.setDate(this.paramsInfo.cycleType, {
startDate, startDate,
endDate, endDate,
}); });
});
} }
this.$nextTick(() => this.init()); this.$nextTick(() => this.init());
} }
...@@ -200,9 +201,13 @@ export default { ...@@ -200,9 +201,13 @@ export default {
this.isNewQualityVisible = false; this.isNewQualityVisible = false;
}, },
dateChange(e) { dateChange(e) {
if (this.pendingRouteDateSync && !e.fromRouteSync)
return;
this.pendingRouteDateSync = false;
const { fromRouteSync, ...dateParams } = e;
this.paramsInfo = { this.paramsInfo = {
...this.paramsInfo, ...this.paramsInfo,
...e, ...dateParams,
}; };
this.requireInterface(); this.requireInterface();
}, },
......
const STORAGE_KEY = "strategyCentre_warningSummaryParams";
const CYCLE_TYPE_MAP = { 1: 2, 2: 3, 4: 4 };
/** 与策略中心 getMonitorListData 中 params 构建逻辑一致 */
export function buildWarningSummaryParams({
filters = {},
timeRangeType = {},
dateRange = {},
currentTab = {},
currentWatchType = {},
currentIndicatorType = {},
}) {
const {
storeName,
isStrategySent,
groupId,
provinceId,
firstbrandIds,
twoBrandIds,
regionOps,
onlineOps,
supervisorOps,
} = filters;
return {
storeName,
isStrategySent: isStrategySent === "" ? undefined : isStrategySent,
groupId,
regionId: provinceId,
firstbrandIds: firstbrandIds || [],
twoBrandIds: twoBrandIds || [],
regionalOperatorId: regionOps,
onlineOperatorId: onlineOps,
flightSupervisionId: supervisorOps,
cycleType: CYCLE_TYPE_MAP[timeRangeType.value],
businessType: currentTab.value,
startDate: dateRange.startDate,
monitorType: currentWatchType.value,
metricTypeId: currentIndicatorType.value,
endDate: dateRange.endDate,
};
}
export function cleanWarningSummaryParams(params) {
return Object.fromEntries(
Object.entries(params).filter(([_, v]) => v != null && v !== "" && !(Array.isArray(v) && v.length === 0)),
);
}
export function getWarningSummaryCleanParams(state) {
return cleanWarningSummaryParams(buildWarningSummaryParams(state));
}
export function saveWarningSummaryParams(params) {
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(params));
}
export function loadWarningSummaryParams() {
try {
const raw = sessionStorage.getItem(STORAGE_KEY);
return raw ? JSON.parse(raw) : null;
} catch {
return null;
}
}
/** 门店看板路由参数兜底(无策略中心缓存时) */
export function getWarningSummaryParamsFromRoute(query = {}) {
const { businessType, startDate, endDate, timeRangeType, periodType } = query;
const period = timeRangeType ?? periodType;
return cleanWarningSummaryParams({
businessType: businessType != null ? Number(businessType) : undefined,
startDate,
endDate,
cycleType: CYCLE_TYPE_MAP[period],
});
}
<!-- 导入明细&回单主页面 --> <!-- 导入明细&回单主页面 -->
<template> <template>
<div class="importDetail"> <div class="importDetail">
<div class="header" <div slot="header"
slot="header"> class="header">
<div> <div>
<import-one ref="importOne" <ImportOne v-if="activeName === 'one'"
v-if="activeName === 'one'" ref="importOne"
@oneStepComplete="oneStepComplete" /> @oneStepComplete="oneStepComplete" />
<import-two v-if="activeName === 'two'" <ImportTwo v-if="activeName === 'two'"
:task-info="taskInfo" :task-info="taskInfo"
@twoStepComplete="twoStepComplete" @goBackOneStep="goBackOneStep"
@goBackOneStep="goBackOneStep" /> @twoStepComplete="twoStepComplete" />
<import-three v-if="activeName === 'three'" <ImportThree v-if="activeName === 'three'"
:result-info="resultInfo" :result-info="resultInfo"
@importAgain="importAgain" @goBackListPage="goBackListPage"
@goBackListPage="goBackListPage" /> @importAgain="importAgain" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import importOne from './components/importOne' import { mapActions } from "vuex";
import importTwo from './components/importTwo' import importOne from "./components/importOne";
import importThree from './components/importThree' import importThree from "./components/importThree";
import { mapActions } from 'vuex' import importTwo from "./components/importTwo";
export default { export default {
name: 'StaffIndex', name: "StaffIndex",
components: {
ImportOne: importOne,
ImportTwo: importTwo,
ImportThree: importThree,
},
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
activeName: 'one', activeName: "one",
taskInfo: null, taskInfo: null,
resultInfo: null resultInfo: null,
} };
},
components: {
importOne,
importTwo,
importThree
}, },
mounted() { mounted() {
if (this.$route.query.step) { if (this.$route.query.step) {
console.log('step', this.$route.query.step) console.log("step", this.$route.query.step);
this.activeName = this.$route.query.step this.activeName = this.$route.query.step;
this.taskInfo = this.$route.query.taskInfo this.taskInfo = this.$route.query.taskInfo;
} }
}, },
methods: { methods: {
...mapActions({ ...mapActions({
get: 'd2admin/base/get', get: "d2admin/base/get",
close: 'd2admin/page/close' close: "d2admin/page/close",
}), }),
oneStepComplete(data) { oneStepComplete(data) {
console.log('data', data) console.log("data", data);
this.activeName = 'two' this.activeName = "two";
}, },
goBackOneStep() { goBackOneStep() {
this.activeName = 'one' this.activeName = "one";
}, },
twoStepComplete(data) { twoStepComplete(data) {
this.resultInfo = data this.resultInfo = data;
this.activeName = 'three' this.activeName = "three";
}, },
importAgain() { importAgain() {
this.activeName = 'one' this.activeName = "one";
}, },
goBackListPage() { goBackListPage() {
this.close({ tagName: "/importDetailControl" }) this.close({ tagName: "/importDetailControl" });
this.$router.push({ this.$router.push({
name: "theAssetData" name: "theAssetData",
}) });
} },
}
}
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.importDetail { .importDetail {
padding: 0 20px; padding: 0 20px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!