Commit 0a884eef by 前端

Merge branch 'SAAS+V5.8.0' into 'develop'

上线合并

See merge request !638
2 parents b17e2d18 1c67e389
Showing 390 changed files with 1308 additions and 176 deletions
# 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` - 详细测试文档
{
"permissions": {
"allow": [
"Bash(mkdir:*)",
"Bash(npm run test:unit:*)",
"Bash(node:*)",
"Bash(npm --version)",
"Bash(npx vue-cli-service test:unit:*)",
"Bash(npm install:*)",
"Bash(vue-cli-service test:unit:*)",
"Bash(npm run test:unit:legacy:*)",
"Bash(set NODE_OPTIONS=--openssl-legacy-provider --max-old-space-size=4096)",
"Bash(volta install:*)",
"Bash(where:*)",
"Bash(volta list:*)",
"Bash(rm:*)"
]
}
}
# 所有环境默认 # 所有环境默认
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config
# 页面 title 前缀 # 页面 title 前缀
VUE_APP_TITLE=D+ VUE_APP_TITLE=D+
......
...@@ -3,3 +3,5 @@ ...@@ -3,3 +3,5 @@
# 网络请求开发地址 # 网络请求开发地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS # VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config
module.exports = { module.exports = {
plugins: { plugins: {
// tailwindcss: {}, // tailwindcss: {},
autoprefixer: {} autoprefixer: {},
// "postcss-px-to-viewport": { // "postcss-px-to-viewport": {
// unitToConvert: "rem", // 要转化的单位 // unitToConvert: "rem", // 要转化的单位
// viewportWidth: 25, // UI设计稿的宽度 // viewportWidth: 25, // UI设计稿的宽度
...@@ -16,5 +16,5 @@ module.exports = { ...@@ -16,5 +16,5 @@ module.exports = {
// exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配 // exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配
// landscape: false // 是否处理横屏情况 // landscape: false // 是否处理横屏情况
// } // }
} },
} };
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
"explorer.compactFolders": false, "explorer.compactFolders": false,
"scm.compactFolders": false, "scm.compactFolders": false,
"problems.decorations.enabled": false, "problems.decorations.enabled": false,
"eslint.format.enable": true,
"vetur.validation.template": false, "vetur.validation.template": false,
"vetur.validation.script": false, "vetur.validation.script": false,
"vetur.validation.style": true, "vetur.validation.style": true,
...@@ -24,9 +23,12 @@ ...@@ -24,9 +23,12 @@
// "source.organizeImports": "explicit", // "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
"[vue]": {}, "editor.pasteAs.preferences": [
"[javascript]": {}, "text.updateImports.jsts",
"[javascriptreact]": {}, "text"
"i18n-ally.sourceLanguage": "zh-chs", ],
"javascript.suggest.autoImports": true "javascript.preferences.importModuleSpecifier": "non-relative", // 优先使用 @/ 别名路径
"javascript.suggest.autoImports": true, // 确保这个是 true
"vue.updateImportsOnFileMove.enabled": true,
"i18n-ally.sourceLanguage": "zh-chs"
} }
# 财务规则页:增量提交与两阶段校验
## 变更摘要
- **增量提交**:`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`
...@@ -29,6 +29,9 @@ export default antfu({ ...@@ -29,6 +29,9 @@ export default antfu({
"array-bracket-spacing": ["error", "always"], "array-bracket-spacing": ["error", "always"],
}, },
rules: { rules: {
"vue/no-deprecated-destroyed-lifecycle": "off",
"vue/no-deprecated-model-definition": "off",
"jsdoc/check-types": "off",
"no-useless-catch": "off", "no-useless-catch": "off",
"vue/no-unused-refs": "warn", "vue/no-unused-refs": "warn",
"unused-imports/no-unused-imports": "warn", "unused-imports/no-unused-imports": "warn",
......
...@@ -10,6 +10,9 @@ module.exports = { ...@@ -10,6 +10,9 @@ module.exports = {
'.+\\.(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: [
'node_modules/(?!(lodash-es|nanoid)/)'
],
moduleNameMapper: { moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1' '^@/(.*)$': '<rootDir>/src/$1'
}, },
......
...@@ -32,14 +32,13 @@ ...@@ -32,14 +32,13 @@
"skipLibCheck": true "skipLibCheck": true
}, },
"include": [ "include": [
"src/**/*" "src/**/*",
"src/**/*.js",
"src/**/*.vue"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"dist", "dist",
".git" ".git"
] ]
// 对齐 Webpack 的 extensions 优先级
// "extensions": [".vue", ".js", ".ts", ".json"]
} }
\ No newline at end of file \ No newline at end of file
/**
* Playwright E2E 测试配置
*
* 使用方法:
* 1. 安装 Playwright: npm install -D @playwright/test
* 2. 安装浏览器:npx playwright install
* 3. 运行测试:npx playwright test
* 4. 带 UI 运行:npx playwright test --ui
* 5. 运行特定测试:npx playwright test tests/e2e/profitMarginTable.spec.js
* 6. 生成报告:npx playwright show-report
*/
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
// 测试文件位置
testDir: "./tests/e2e",
// 超时时间
timeout: 30 * 1000,
// 每个测试的期望时间
expect: {
timeout: 5000,
},
// 失败重试次数
retries: 1,
// 并行执行配置
workers: 4,
// 是否失败即停止
failOnFlakyTests: false,
// 报告配置
reporter: [
["list"],
["html", { outputFolder: "playwright-report", open: "never" }],
],
// 共享配置
use: {
// 基础 URL
baseURL: process.env.BASE_URL || "http://localhost:8080",
// 截图配置
screenshot: "only-on-failure",
// 录屏配置
video: "retain-on-failure",
// 追踪配置
trace: "retain-on-failure",
// 浏览器上下文选项
actionTimeout: 10000,
navigationTimeout: 30000,
},
// 浏览器配置
projects: [
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
viewport: { width: 1920, height: 1080 },
},
},
{
name: "firefox",
use: {
...devices["Desktop Firefox"],
viewport: { width: 1920, height: 1080 },
},
},
{
name: "webkit",
use: {
...devices["Desktop Safari"],
viewport: { width: 1920, height: 1080 },
},
},
// 移动端测试
{
name: "Mobile Chrome",
use: {
...devices["Pixel 5"],
},
},
{
name: "Mobile Safari",
use: {
...devices["iPhone 12"],
},
},
],
// Web 服务器配置 (可选,用于自动启动开发服务器)
// webServer: {
// command: "npm run dev",
// port: 8080,
// timeout: 120 * 1000,
// reuseExistingServer: true,
// },
});
import request from "./request" import request from "./request";
const path = "dj.api." const path = "dj.api.";
const path2 = "dj.smartcarlife.api." const path2 = "dj.smartcarlife.api.";
export function getList(data) { export function getList(data) {
data.method = `${path}basegoods.page` data.method = `${path}basegoods.page`;
return request(data) return request(data);
} }
// 分页查找园区店 // 分页查找园区店
export function commodityAddSeviceMerchant(data) { export function commodityAddSeviceMerchant(data) {
// data.method = `${path}servicemerchantref.page` // data.method = `${path}servicemerchantref.page`
data.method = `${path}servicemerchantref.pageRef` data.method = `${path}servicemerchantref.pageRef`;
return request(data) return request(data);
} }
// 根据基础商品Id查询商品 // 根据基础商品Id查询商品
export function getGoodsInfoById(data) { export function getGoodsInfoById(data) {
data.method = `${path}basegoods.get.byId` data.method = `${path}basegoods.get.byId`;
return request(data) return request(data);
} }
// 根据基础商品id获取分配门店列表 - 查看门店 // 根据基础商品id获取分配门店列表 - 查看门店
export function getMerchantList(data) { export function getMerchantList(data) {
data.method = "dj.basegoodsmerchantref.list.byBaseGoodsId" data.method = "dj.basegoodsmerchantref.list.byBaseGoodsId";
return request(data) return request(data);
} }
// 查询产品列表 // 查询产品列表
export function getGoodsList(data) { export function getGoodsList(data) {
data.method = `${path}goodsinfo.list` data.method = `${path}goodsinfo.list`;
return request(data) return request(data);
} }
// 新增商品 // 新增商品
export function baseGoodsAdd(data) { export function baseGoodsAdd(data) {
data.method = `${path}basegoods.add` data.method = `${path}basegoods.add`;
return request(data, "post") return request(data, "post");
} }
// 修改商品 // 修改商品
export function baseGoodsUpdate(data) { export function baseGoodsUpdate(data) {
data.method = `${path}basegoods.update` data.method = `${path}basegoods.update`;
return request(data, "post") return request(data, "post");
} }
// 下架商品 // 下架商品
export function baseGoodsUpOrDown(data) { export function baseGoodsUpOrDown(data) {
// data.method = `${path2}basegoods.changeShelfStatus` // data.method = `${path2}basegoods.changeShelfStatus`
data.method = `${path2}basegoods.shelfStatus.update` data.method = `${path2}basegoods.shelfStatus.update`;
return request(data, "post") return request(data, "post");
} }
// 删除商品 // 删除商品
export function baseGoodsDelete(data) { export function baseGoodsDelete(data) {
data.method = `${path2}basegoods.delete` data.method = `${path2}basegoods.delete`;
return request(data, "post", [], { useResponseMessage: true }) return request(data, "post", [], { useResponseMessage: true });
} }
// 导出 // 导出
export function exportBaseList(data) { export function exportBaseList(data) {
data.method = `${path}basegoods.export` data.method = `${path}basegoods.export`;
return request(data, "post") return request(data, "post");
} }
// 下架子商品 // 下架子商品
export function baseGoodsUpOrDownForChild(data) { export function baseGoodsUpOrDownForChild(data) {
data.method = `${path2}upgradedGoods.shelfStatus.update` data.method = `${path2}upgradedGoods.shelfStatus.update`;
return request(data, "post") return request(data, "post");
} }
// 提交商品审核结果 // 提交商品审核结果
export function submitReviewResult(data) { export function submitReviewResult(data) {
data.method = `${path2}upgradedGoods.submitReviewResult` data.method = `${path2}upgradedGoods.submitReviewResult`;
return request(data, "post") return request(data, "post");
} }
// 新增编辑商品 // 新增编辑商品
export function addOrEditBaseGoods(data) { export function addOrEditBaseGoods(data) {
data.method = `${path}basegoods.insertOrUpdate` data.method = `${path}basegoods.insertOrUpdate`;
return request(data, "post") return request(data, "post");
} }
// 获取商品列表 // 获取商品列表
export function getBaseGoodsList(data) { export function getBaseGoodsList(data) {
data.method = `${path}basegoods.page` data.method = `${path}basegoods.page`;
return request(data, "post") return request(data, "post");
} }
// 获取按规格分配 门店维度数据转为规格维度展示 // 获取按规格分配 门店维度数据转为规格维度展示
export function getSpecDataByMerchent(data) { export function getSpecDataByMerchent(data) {
data.method = `dj.basegoodsmerchantref.specification.getByBaseGoodsId` data.method = `dj.basegoodsmerchantref.specification.getByBaseGoodsId`;
return request(data, "post") return request(data, "post");
} }
// 按规格分配保存 // 按规格分配保存
export function saveAssignBySpec(data) { export function saveAssignBySpec(data) {
data.method = "dj.basegoodsmerchantref.specification.insertOrUpdate" data.method = "dj.basegoodsmerchantref.specification.insertOrUpdate";
return request(data, "post") return request(data, "post");
} }
// 分配门店 统一分配保存 // 分配门店 统一分配保存
export function saveAssignByMerchant(data) { export function saveAssignByMerchant(data) {
data.method = "dj.basegoodsmerchantref.stores.insertOrUpdate" data.method = "dj.basegoodsmerchantref.stores.insertOrUpdate";
return request(data, "post") return request(data, "post");
} }
// 获取场景关联门店/园区店列表 // 获取场景关联门店/园区店列表
export function getMerchantListByScene(data) { export function getMerchantListByScene(data) {
data.method = `${path}servicemerchantref.listShopWithScene` data.method = `${path}servicemerchantref.listShopWithScene`;
return request(data, "post") return request(data, "post");
} }
// 获取场景-类目-素材三级数据列表 // 获取场景-类目-素材三级数据列表
export function getThiredMaterialList(data) { export function getThiredMaterialList(data) {
data.method = `${path}goods.type.querySceneCategoryGoods` data.method = `${path}goods.type.querySceneCategoryGoods`;
return request(data, "post") return request(data, "post");
} }
// 保存商品 // 保存商品
export function saveTempGoods(data) { export function saveTempGoods(data) {
data.method = `${path}basegoods.saveTemp` data.method = `${path}basegoods.saveTemp`;
return request(data, "post") return request(data, "post");
} }
// 查询升级商品别名列表 // 查询升级商品别名列表
export function getUpgradeGoodsAliasList(data) { export function getUpgradeGoodsAliasList(data) {
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.listByMerchantGoodsRef` data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.listByMerchantGoodsRef`;
return request(data) return request(data);
} }
// 升级商品别名保存 // 升级商品别名保存
export function saveUpgradeGoodsAlias(data) { export function saveUpgradeGoodsAlias(data) {
data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.save` data.method = `${path}smartcarlife.merchantUpgradeGoodsAlias.save`;
return request(data) return request(data);
} }
// 获取车品牌列表 // 获取车品牌列表
export function getCarBrandList(data) { export function getCarBrandList(data) {
data.method = `dj.api.car.getCarBrandList` data.method = `dj.api.car.getCarBrandList`;
return request(data) return request(data);
}
// 分页查询 商户列表-带关联关系
export function getMerchantListApi(data) {
data.method = "dj.api.scenemerchantref.findAllMerchantPage";
return request(data, "post");
} }
import request from './request'
/** 施工单分页查询 */
export const CONSTRUCTION_INFO_PAGE = 'dj.api.smarcarlife.construction.info.page'
/** 施工单导出(异步任务),与下载中心配合时在 exportParam 内带 method 字段 */
export const CONSTRUCTION_INFO_EXPORT = 'dj.api.smarcarlife.construction.info.export'
/** 施工单-技师列表(筛选用) */
export const CONSTRUCTION_TECHNICIAN_LIST = 'dj.api.smarcarlife.construction.technician.list'
/** 施工单-门店列表(筛选用) */
export const CONSTRUCTION_MERCHANT_LIST = 'dj.api.smarcarlife.construction.merchant.list'
/** 施工单-驻店/转化人员列表(筛选用) */
export const CONSTRUCTION_SELLER_LIST = 'dj.api.smarcarlife.construction.seller.list'
export function constructionInfoPage(data) {
return request({ ...data, method: CONSTRUCTION_INFO_PAGE }, 'post')
}
/**
* 技师列表,返回 technicianUuid / technicianName / staffPhone 等
* @param {Object} [data] 无文档时与分页类接口一致,可按需传 currentPage、pageSize
*/
export function constructionTechnicianList(data) {
return request({ ...data, method: CONSTRUCTION_TECHNICIAN_LIST }, 'post')
}
/**
* 门店列表,返回 merchantId、merchantName
* @param {Object} [data] 无文档时与分页类接口一致
*/
export function constructionMerchantList(data) {
return request({ ...data, method: CONSTRUCTION_MERCHANT_LIST }, 'post')
}
/**
* 驻店/转化人员列表,返回 sellerUserId、sellerName
* @param {Object} [data] 无文档时与分页类接口一致
*/
export function constructionSellerList(data) {
return request({ ...data, method: CONSTRUCTION_SELLER_LIST }, 'post')
}
import request from "./request" import request from "./request"
import RequestMethods from "./request.methods" import RequestMethods from "./request.methods"
import { getScenesByParams } from "./senseManage"
const path = "dj.api.smartcarlife.feeCategory." const path = "dj.api.smartcarlife.feeCategory."
/** 费用类目-基础场景下拉(启用场景),兼容多种列表字段包裹 */
export function getFeeCategorySceneOptions() {
return getScenesByParams({
pageNum: 1,
pageSize: 10000,
status: 1
}).then((res) => {
const list = Array.isArray(res)
? res
: (res && (res.list || res.records || res.data)) || []
return Array.isArray(list) ? list : []
})
}
// 分页查询费用类目 // 分页查询费用类目
export function selectFeeCategoryList(data) { export function selectFeeCategoryList(data) {
// data.method = `${path}selectFeeCategoryList` // data.method = `${path}selectFeeCategoryList`
......
...@@ -50,19 +50,14 @@ export function getAllGroupByCategory(data) { ...@@ -50,19 +50,14 @@ export function getAllGroupByCategory(data) {
return request(data); return request(data);
} }
// 获取所有上架商品 // 升级品下拉:merchantGoodsInfo.rule.selectList,扁平 list(upgradeGoodsId / goodsShowName / packageName / merchantGoodsCode)
export function getAllGoodsList(data) { export function getAllGoodsList(data) {
data.method = `${path}productManager.search`; data.method = `${path}merchantGoodsInfo.rule.selectList`;
return request(data, "post"); return request(data, "post");
} }
// 获取所有上架商品 替换新接口
// export function getAllGoodsListPage(data) {
// data.method = `${path}merchantGoodsInfo.upgradeGoods.page`
// return request(data, "post")
// }
export function getAllGoodsListPage(data) { export function getAllGoodsListPage(data) {
data.method = `${path}productManager.search`; data.method = `${path}merchantGoodsInfo.rule.selectList`;
return request(data, "post"); return request(data, "post", [], { skipGlobalLoading: true });
} }
// 批量下架 // 批量下架
...@@ -87,7 +82,7 @@ export function checkGroundingLog(data) { ...@@ -87,7 +82,7 @@ export function checkGroundingLog(data) {
// 分页查询套餐管理记录 // 分页查询套餐管理记录
export function merchantPackageGoodsInfoPage(data) { export function merchantPackageGoodsInfoPage(data) {
data.method = `${path}merchantPackageGoodsInfo.page`; data.method = `${path}merchantPackageGoodsInfo.page`;
return request(data, "post"); return request(data, "post", [], { skipGlobalLoading: true });
} }
// return request(data, 'post') // return request(data, 'post')
// } // }
...@@ -186,3 +181,9 @@ export function savePaymentChannelConfig(data) { ...@@ -186,3 +181,9 @@ export function savePaymentChannelConfig(data) {
data.method = `${path}paymentChannelConfig.save`; data.method = `${path}paymentChannelConfig.save`;
return request(data, "post"); return request(data, "post");
} }
// 根据已选产品实时查询运营成本
export function getOperationCost(data) {
data.method = 'dj.api.smartcarlife.merchantGoodsInfo.operationCost.calculate'
return request(data, "post")
}
...@@ -12,13 +12,16 @@ import RequestMethods from "./request.methods"; ...@@ -12,13 +12,16 @@ import RequestMethods from "./request.methods";
const path = "dj.api."; const path = "dj.api.";
const path2 = "dj.api.smartcarlife."; const path2 = "dj.api.smartcarlife.";
export function getList(data) { /** 商户管理/关联 - 分页列表 */
// data.method = `${path2}merchantSettleAccountRule.page.byMerchant` export function pageServiceMerchantRef(data) {
// data.method = `${path}servicemerchantref.shop.page` data.method = "dj.api.servicemerchantref.newpageServiceMerchantRef";
data.method = `${path}servicemerchantref.pageServiceMerchantRef`;
return request(data); return request(data);
} }
export function getList(data) {
return pageServiceMerchantRef(data);
}
// 删除4s门店 // 删除4s门店
export function deleteMerchant(data) { export function deleteMerchant(data) {
data.method = `${path}servicemerchantref.delete.byId`; data.method = `${path}servicemerchantref.delete.byId`;
...@@ -270,7 +273,7 @@ export function merchantSettleDistributeRuleTestRule(data) { ...@@ -270,7 +273,7 @@ export function merchantSettleDistributeRuleTestRule(data) {
// 根据4s店获取服务商列表 // 根据4s店获取服务商列表
export function scenemerchantrefQueryServiceRefByShop(data) { export function scenemerchantrefQueryServiceRefByShop(data) {
data.method = `${path}scenemerchantref.queryServiceRefByShop`; data.method = `${path}scenemerchantref.queryServiceRefByShop.new`;
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
...@@ -319,6 +322,18 @@ export function deleteShopRef(data) { ...@@ -319,6 +322,18 @@ export function deleteShopRef(data) {
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/** 禁用商户场景关联(财务/对账规则重置,列表仍展示为禁用) */
export function disableMerchantSceneRef(data) {
data.method = `${path}scenemerchantref.disableShopRef`;
return request(data, RequestMethods.POST);
}
/** 启用商户场景关联 */
export function enableMerchantSceneRef(data) {
data.method = `${path}scenemerchantref.enableShopRef`;
return request(data, RequestMethods.POST);
}
// 根据4S店商户号查询二级流量方 // 根据4S店商户号查询二级流量方
export function getDiversionMerchantRef(data) { export function getDiversionMerchantRef(data) {
data.method = `${path2}diversionMerchant.getDiversionMerchantRef`; data.method = `${path2}diversionMerchant.getDiversionMerchantRef`;
...@@ -365,16 +380,16 @@ export function getContractAffiliationDataList(data) { ...@@ -365,16 +380,16 @@ export function getContractAffiliationDataList(data) {
return request(data, "post"); return request(data, "post");
} }
// 获取商户关系历史记录 // 获取商户关系历史记录(场景商户关系)
export function getMerchantRelationRecordApi(data) { export function getMerchantRelationRecordApi(data) {
data.method = `${path2}shopMerchant.queryMerchantRefDetailHistory`; data.method = `${path}scenemerchantref.queryMerchantHistory`;
return request(data, "post"); return request(data, RequestMethods.POST);
} }
// 新增/编辑商户上架 // 新增/编辑商户上架(Open 网关参数形态)
export function merchantOnShelf(data) { export function merchantOnShelf(data) {
data.method = `${path2}shopMerchant.addOrUpdateSceneMerchantRefNew`; data.method = `${path2}shopMerchant.addOrUpdateSceneMerchantRefNewOpen`;
return request(data, "post"); return request(data, RequestMethods.POST);
} }
// 获取商户关联关系详情 // 获取商户关联关系详情
...@@ -383,6 +398,12 @@ export function getMerchantRelationDetailApi(data) { ...@@ -383,6 +398,12 @@ export function getMerchantRelationDetailApi(data) {
return request(data, "post"); return request(data, "post");
} }
/** 商户上架编辑页详情(merchantId + baseSceneCode)→ scenemerchantref */
export function queryMerchantDetail(data) {
data.method = `${path}scenemerchantref.queryMerchantDetail`;
return request(data, RequestMethods.POST);
}
// 获取4s店和服务商门店数据 // 获取4s店和服务商门店数据
export function get4sAndServiceMerchantListApi(data) { export function get4sAndServiceMerchantListApi(data) {
data.method = `${path}merchant.merchantAndService.page`; data.method = `${path}merchant.merchantAndService.page`;
...@@ -408,9 +429,16 @@ export function paymentChannelList(data = {}) { ...@@ -408,9 +429,16 @@ export function paymentChannelList(data = {}) {
* 获取对账配置所有品类列表 * 获取对账配置所有品类列表
*/ */
export function getReconciliationGoodsTypeListApi(data = {}) { export function getReconciliationGoodsTypeListApi(data = {}) {
data.method = "dj.api.create.business.approve.listReconciliationGoodsTypeGroup"; data.method =
"dj.api.create.business.approve.listReconciliationGoodsTypeGroup";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
* 获取轻改门店列表数据
*/
export function getMerchantList(data) {
data.method = "dj.api.servicemerchantref.pageServiceMerchantRef";
return request(data, RequestMethods.POST);
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import axios from "axios"; import axios from "axios";
// Mock 基础配置 // Mock 基础配置
const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7475619-7210332-default/"; const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7490654-7226095-default/";
/** /**
* 创建 Mock Axios 实例 * 创建 Mock Axios 实例
*/ */
......
...@@ -23,6 +23,14 @@ export function getOrderCount(data) { ...@@ -23,6 +23,14 @@ export function getOrderCount(data) {
return request(data) return request(data)
} }
/** 存在订单数据的场景列表;bizTypeCode 1-轻改 2-权益;businessType 可选 1-会员权益 2-延保 */
export function sceneListWithOrder(data = {}) {
return request({
method: "dj.smartcarlife.api.scene.list.with.order",
...data,
})
}
// 待补录订单统计(交易记录条数,已补录数,待补录数) // 待补录订单统计(交易记录条数,已补录数,待补录数)
export function waitinputorderCount(data) { export function waitinputorderCount(data) {
data.method = `${path2}waitinputorder.count` data.method = `${path2}waitinputorder.count`
......
...@@ -109,3 +109,69 @@ export function upgradeGoodsDelete(data) { ...@@ -109,3 +109,69 @@ export function upgradeGoodsDelete(data) {
data.method = "dj.smartcarlife.api.upgradegoods.delete"; data.method = "dj.smartcarlife.api.upgradegoods.delete";
return request(data, "post", [], { useResponseMessage: true }); return request(data, "post", [], { useResponseMessage: true });
} }
// 获取产品清单列表
export function getProductCatalogList(data) {
data.method = "dj.api.smartcarlife.productTemplate.page";
return request(data);
}
// 新增/编辑产品(产品清单)
export function addOrUpdateProductCatalog(data) {
data.method = "dj.api.smartcarlife.productTemplate.addOrUpdate";
return request(data, 'post');
}
// 删除产品(产品清单)
export function deleteProductCatalog(data) {
data.method = "dj.api.smartcarlife.productTemplate.delete";
return request(data);
}
// 批量新增SPU/SKU导入
export function importBatchAddSPUOrSKU(data) {
data.method = "dj.api.smartcarlife.productManager.spu.sku.batch.add.import"
return request(data, "post", ["file"])
}
// 批量新增SKU导入
export function importBatchAddSKU(data) {
data.method = "dj.api.smartcarlife.productManager.sku.batch.add.import"
return request(data, "post", ["file"])
}
// 批量修改SKU导入
export function importBatchEditSKU(data) {
data.method = "dj.api.smartcarlife.productManager.sku.batch.update.import"
return request(data, "post", ["file"])
}
// 获取供应商数据
export function getGoodsProviderList(data) {
data.method = "dj.api.smartcarlife.goodsProvider.page"
return request(data)
}
// 新增供应商
export function addGoodsProvider(data) {
data.method = "dj.api.smartcarlife.goodsProvider.insert"
return request(data)
}
// 编辑供应商
export function editGoodsProvider(data) {
data.method = "dj.api.smartcarlife.goodsProvider.update"
return request(data)
}
// 获取省市两级数据
export function getAreaDataList(data) {
data.method = "dj.api.smartcarlife.map.districts.provinceCity";
return request(data);
}
// 获取业务场景数据
export function getBaseSceneCodeList(data) {
data.method = "dj.api.smartcarlife.scene.getScenesByParams";
return request(data);
}
...@@ -13,7 +13,12 @@ import axios from "@/plugin/axios/index_code"; ...@@ -13,7 +13,12 @@ import axios from "@/plugin/axios/index_code";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import sign from "./sign"; import sign from "./sign";
function request(params = {}, method = RequestMethods.GET, noSignAttr = [], options = {}) { function request(
params = {},
method = RequestMethods.GET,
noSignAttr = [],
options = {}
) {
// 兼容线上dj和scrm appkey和secret不一样的情况 // 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = ""; let apiName = "";
if (params.method.includes("dj.api.smartcarlife")) { if (params.method.includes("dj.api.smartcarlife")) {
...@@ -33,6 +38,15 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -33,6 +38,15 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
} else if (params.method.includes("dj.pad.api")) { } else if (params.method.includes("dj.pad.api")) {
// rop-dj-pad 等方法名含 dj.pad,split(".api") 会得到 dj.pad 无 mapping;签名与 appKey 沿用 dj // rop-dj-pad 等方法名含 dj.pad,split(".api") 会得到 dj.pad 无 mapping;签名与 appKey 沿用 dj
apiName = "dj"; apiName = "dj";
} else if (params.method.includes("dj.api.oaapproval")) {
apiName = "oaapproval";
} else if (
params.method.includes(
"merchants.api.open.createMerchantWithPermissions"
)
) {
/** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */
apiName = "oaapproval";
} else { } else {
// console.log(params.method.split(".api")) // console.log(params.method.split(".api"))
apiName = params.method.split(".api")[0]; apiName = params.method.split(".api")[0];
...@@ -46,18 +60,19 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -46,18 +60,19 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
} }
const mappingName = { const mappingName = {
"dj.smartcarlife": "axios", "dj.smartcarlife": "axios",
"dj": "axios", dj: "axios",
"scrm": "axios2", scrm: "axios2",
"merchants": "axios3", merchants: "axios3",
"reportExport": "axios4", reportExport: "axios4",
"glsx.accounts.biz.common.pictureUpload": "common", "glsx.accounts.biz.common.pictureUpload": "common",
"clue": "axios5", clue: "axios5",
"dj.businessSchool": "axios6", "dj.businessSchool": "axios6",
"script": "axios7", script: "axios7",
"staff": "axios9", staff: "axios9",
"riskmanage": "axios10", riskmanage: "axios10",
"strategy": "axios_strategy", strategy: "axios_strategy",
"supervisor": "axios_supervisor", supervisor: "axios_supervisor",
oaapproval: "axios_oaapproval",
}; };
const baseApiName = mappingName[apiName]; const baseApiName = mappingName[apiName];
// console.log(baseApiName, "baseApiName") // console.log(baseApiName, "baseApiName")
...@@ -86,20 +101,21 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -86,20 +101,21 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
*/ */
const signWay = { const signWay = {
"dj.smartcarlife": "sha1", "dj.smartcarlife": "sha1",
"dj": "sha1", dj: "sha1",
"scrm": "sha1", scrm: "sha1",
"glsx": "md5", glsx: "md5",
"glsx.accounts.biz.common.pictureUpload": "md5", "glsx.accounts.biz.common.pictureUpload": "md5",
"clue": "sha1", clue: "sha1",
"script": "sha1", script: "sha1",
"staff": "sha1", staff: "sha1",
"riskmanage": "sha1", riskmanage: "sha1",
oaapproval: "sha1",
}; };
// console.log(signWay[apiName], "baseApiName") // console.log(signWay[apiName], "baseApiName")
const secret = baseConfig[baseApiName].secret; const secret = baseConfig[baseApiName].secret;
const CancelToken = axiosPackage.CancelToken; const CancelToken = axiosPackage.CancelToken;
let reqData let reqData =
= method === RequestMethods.POST method === RequestMethods.POST
? { ? {
baseURL: "/", baseURL: "/",
data: sign(params, noSignAttr, secret, signWay[apiName]), data: sign(params, noSignAttr, secret, signWay[apiName]),
...@@ -126,8 +142,7 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -126,8 +142,7 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
method, method,
...reqData, ...reqData,
}; };
if (options.returnAll) if (options.returnAll) axiosParams.headers = { "return-all": true };
axiosParams.headers = { "return-all": true };
return axios(axiosParams); return axios(axiosParams);
/** /**
......
...@@ -358,7 +358,8 @@ export function getTemplateList(data = {}) { ...@@ -358,7 +358,8 @@ export function getTemplateList(data = {}) {
// 督导 // 督导
export function getStaffList(data) { export function getStaffList(data) {
data.method = "dj.api.smartcarlife.digital.management.template.staff.ref.list"; data.method =
"dj.api.smartcarlife.digital.management.template.staff.ref.list";
return request(data, "post"); return request(data, "post");
} }
...@@ -394,15 +395,15 @@ export function getSummaryStaff(data) { ...@@ -394,15 +395,15 @@ export function getSummaryStaff(data) {
// 更新模版绑定员工 // 更新模版绑定员工
export function updateStaff(data) { export function updateStaff(data) {
data.method data.method =
= "dj.api.smartcarlife.digital.management.template.staff.ref.update"; "dj.api.smartcarlife.digital.management.template.staff.ref.update";
return request(data, "post"); return request(data, "post");
} }
// 导出未提交明细列表 // 导出未提交明细列表
export function exportSummary(data) { export function exportSummary(data) {
data.method data.method =
= "dj.api.smartcarlife.digital.management.record.staff.summary.export"; "dj.api.smartcarlife.digital.management.record.staff.summary.export";
return request(data, "post"); return request(data, "post");
} }
...@@ -410,7 +411,8 @@ export function exportSummary(data) { ...@@ -410,7 +411,8 @@ export function exportSummary(data) {
export function getAllStaff(data) { export function getAllStaff(data) {
// data.method = 'dj.api.smartcarlife.staff.specificBusinessRolePerson.areaSupervision.pageConfigured' // data.method = 'dj.api.smartcarlife.staff.specificBusinessRolePerson.areaSupervision.pageConfigured'
// data.method = 'dj.api.smartcarlife.staff.specificBusinessRolePerson.areaSupervision.listConfigured' // data.method = 'dj.api.smartcarlife.staff.specificBusinessRolePerson.areaSupervision.listConfigured'
data.method = "dj.api.smartcarlife.digital.management.supervision.staff.list"; data.method =
"dj.api.smartcarlife.digital.management.supervision.staff.list";
return request(data, "post"); return request(data, "post");
} }
...@@ -575,8 +577,8 @@ export function getPerformanceSalaryConfigAPI(data) { ...@@ -575,8 +577,8 @@ export function getPerformanceSalaryConfigAPI(data) {
} }
// 批量新增或修改绩效工资扣减规则 // 批量新增或修改绩效工资扣减规则
export function updatePerformanceSalaryConfigAPI(data) { export function updatePerformanceSalaryConfigAPI(data) {
data.method data.method =
= "dj.api.smartcarlife.performanceSalaryConfig.batchInsertOrUpdate"; "dj.api.smartcarlife.performanceSalaryConfig.batchInsertOrUpdate";
return request(data, "post"); return request(data, "post");
} }
...@@ -669,8 +671,8 @@ export function staffBaseInfoPageList(data = {}) { ...@@ -669,8 +671,8 @@ export function staffBaseInfoPageList(data = {}) {
// 北森员工信息批量修改 // 北森员工信息批量修改
export function updateBatchSalary(data) { export function updateBatchSalary(data) {
data.method data.method =
= "dj.api.smartcarlife.staffBaseInfo.salaryEffectiveRule.updateBatch"; "dj.api.smartcarlife.staffBaseInfo.salaryEffectiveRule.updateBatch";
return request(data, "post"); return request(data, "post");
} }
...@@ -691,7 +693,7 @@ export function getCommissionListApi(data = {}) { ...@@ -691,7 +693,7 @@ export function getCommissionListApi(data = {}) {
} }
// 获取督导管理列表数据 // 获取督导管理列表数据
export function getSupervisorListApi(data = {}) { export function getSupervisorListApi(data = {}) {
data.method = "dj.api.supervisor.manage.page" data.method = "dj.api.supervisor.manage.page";
return request(data, "post"); return request(data, "post");
} }
// 获取督导管理汇总数据 // 获取督导管理汇总数据
...@@ -706,8 +708,8 @@ export function getWeeklyRangesApi(data = {}) { ...@@ -706,8 +708,8 @@ export function getWeeklyRangesApi(data = {}) {
} }
// 获取督导详情数据 // 获取督导详情数据
export function getSupervisorDetailApi(data = {}) { export function getSupervisorDetailApi(data = {}) {
data.method = "dj.api.supervisor.manage.detail.staff.page" data.method = "dj.api.supervisor.manage.detail.staff.page";
return request(data, "post") return request(data, "post");
} }
// 获取督导详情汇总数据 // 获取督导详情汇总数据
export function getSupervisorDetailSummaryApi(data = {}) { export function getSupervisorDetailSummaryApi(data = {}) {
...@@ -787,3 +789,42 @@ export function listExcellentCaseCategories(data = {}) { ...@@ -787,3 +789,42 @@ export function listExcellentCaseCategories(data = {}) {
return request(data, "post"); return request(data, "post");
} }
//适配业务
export function getStaffSceneLabelList(data = {}) {
data.method = "dj.api.smartcarlife.scene.getScenesByParams";
return request(data, "post");
}
export function findAllMerchantPageApi(data = {}) {
data.method = "dj.api.scenemerchantref.findAllMerchantPage";
return request(data, "post");
}
export function findAllSceneByMerchantIdApi(data = {}) {
data.method = "dj.api.scenemerchantref.findAllSceneByMerchantId";
return request(data, "post");
}
export function assignStoreApi(data = {}) {
data.method = "dj.api.smartcarlife.staffBaseInfo.account.merchant.assign";
return request(data, "post");
}
//北森岗位
export function beiSenJobPostPageApi(data = {}) {
data.method = "dj.api.smartcarlife.staffBaseInfo.beiSenJobPost.page";
return request(data, "post");
}
// 北森账号列表
export function beiSenEmployeePageApi(data = {}) {
data.method = "dj.api.smartcarlife.staffBaseInfo.beiSenEmployee.page";
return request(data, "post");
}
// 手动同步指定北森账号信息
export function beiSenEmployeeSingleSyncApi(data = {}) {
data.method = "dj.api.smartcarlife.staffBaseInfo.single.beiSen.sync";
return request(data, "post");
}
//账号信息-禁用账号
export function beiSenEmployeeDisableApi(data = {}) {
data.method = "dj.api.smartcarlife.staffBaseInfo.account.disable";
return request(data, "post");
}
import request from "./request" /*
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-01-12 14:51:21
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-04-27 17:26:28
* @FilePath: \dj-car-life-system\src\api\salesManagement.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import request from "./request";
// 分页查询潜客数据 // 分页查询潜客数据
export function potentialCustomersPage(data) { export function potentialCustomersPage(data) {
data.method = 'dj.api.smartcarlife.sale.potentialCustomers.page' data.method = "dj.api.smartcarlife.sale.potentialCustomers.page";
return request(data, "post") return request(data, "post");
} }
// 潜客详情数据 // 潜客详情数据
export function potentialCustomersDetail(data) { export function potentialCustomersDetail(data) {
data.method = 'dj.api.smartcarlife.sale.potentialCustomers.detail' data.method = "dj.api.smartcarlife.sale.potentialCustomers.detail";
return request(data, "post") return request(data, "post");
}
// 潜客核验详情(含 merchantInfo)
export function potentialCustomersVerificationDetail(data) {
data.method =
"dj.api.smartcarlife.sale.potentialCustomers.verificationDetail";
return request(data, "post");
} }
// 首次绑定/重新绑定4S店 // 首次绑定/重新绑定4S店
export function bind4SStore(data) { export function bind4SStore(data) {
data.method = 'dj.api.smartcarlife.sale.potentialCustomers.bind' data.method = "dj.api.smartcarlife.sale.potentialCustomers.bind";
return request(data, "post") return request(data, "post");
}
// 潜客信息核验提交(dj.api.smartcarlife.sale.potentialCustomers.submitVerification)
export function potentialCustomersInfoVerify(data) {
data.method =
"dj.api.smartcarlife.sale.potentialCustomers.submitVerification";
return request(data, "post");
}
// 潜客新建商户 — 校验商户名称是否与账户中心重复
export function potentialCustomersCheckMerchantName(data) {
data.method =
"dj.api.smartcarlife.sale.potentialCustomers.checkMerchantName";
// data.method = "dj.api.smartcarlife.sale.potentialCustomers.infoVerify";
return request(data, "post");
} }
// 分页查询大区 // 分页查询大区
export function regionPage(data) { export function regionPage(data) {
data.method = 'dj.api.smartcarlife.sale.region.page' data.method = "dj.api.smartcarlife.sale.region.page";
return request(data, "post") return request(data, "post");
} }
// 获取大区人员 // 获取大区人员
export function regionUserList(data) { export function regionUserList(data) {
data.method = 'dj.api.smartcarlife.sale.region.userList' data.method = "dj.api.smartcarlife.sale.region.userList";
return request(data, "post") return request(data, "post");
} }
// 更新大区人员 // 更新大区人员
export function updateRegionUser(data) { export function updateRegionUser(data) {
data.method = 'dj.api.smartcarlife.sale.region.updateRegionUser' data.method = "dj.api.smartcarlife.sale.region.updateRegionUser";
return request(data, "post") return request(data, "post");
} }
// 区域运营模块接口 // 区域运营模块接口
// 区域运营管理人员列表 // 区域运营管理人员列表
export function organizationUserList(data) { export function organizationUserList(data) {
data.method = 'dj.api.script.province.organization.list' data.method = "dj.api.script.province.organization.list";
return request(data, "post") return request(data, "post");
} }
// 区域运营管理编辑 // 区域运营管理编辑
export function organizationUserUpdate(data) { export function organizationUserUpdate(data) {
data.method = 'dj.api.script.province.organization.upd' data.method = "dj.api.script.province.organization.upd";
return request(data, "post") return request(data, "post");
}
// 关店管理列表/rop-dj-smartcarlife/router/dj.api.smartcarlife.sale.closeStore.page
export function closeStorePage(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.page";
return request(data, "post");
}
//是否关店
export function closeStoreConfirm(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.confirm";
return request(data, "post");
}
// 关店详情
export function closeStoreDetail(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.detail";
return request(data, "post");
}
// 关店操作记录
export function closeStoreOperateLogList(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.operateLog.list";
return request(data, "post");
}
/**
* 分页查询门店上架审批单
*/
export function storeApprovePageQuery(data) {
data.method = "dj.api.oaapproval.store.approve.pageQuery";
return request(data, "post");
}
/**
*创建门店上架审批单(草稿)
*/
export function storeApproveCreateDraft(data) {
data.method = "dj.api.oaapproval.store.approve.createDraft";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/**
*查询门店上架审批单详情
*/
export function storeApproveQueryDetail(data) {
data.method = "dj.api.oaapproval.store.approve.queryDetail";
return request(data, "post");
}
/**
* 编辑门店上架审批单
*/
export function storeApproveEditDraft(data) {
data.method = "dj.api.oaapproval.store.approve.editDraft";
return request(data, "post", [], {
returnAll: true,
});
}
/**
*
* 重新发起审批单
*/
export function storeApproveReSubmit(data) {
data.method = "dj.api.oaapproval.store.approve.reSubmit";
return request(data, "post");
}
/**
* 查询销售范围类型列表
*/
export function queryProductTypes(data = {}) {
data.method = "dj.api.oaapproval.store.approve.queryProductTypes";
return request(data, "post");
}
/**
* 查询销售品类列表
*/
export function queryProductCategories(data = {}) {
data.method = "dj.api.oaapproval.store.approve.queryProductCategories";
return request(data, "post");
}
/**
* 查询签约主体
*/
export function qyMerchantPageList(data = {}) {
data.method = "dj.smartcarlife.api.qyMerchant.pageList";
return request(data, "post");
} }
import request from "./request";
const path = "dj.api.smartcarlife.";
// 分页查询业务场景列表
export function getList(data) {
data.method = `${path}scene.pageQuery`;
return request(data, "post");
}
// 启用业务场景
export function enableScene(data) {
data.method = `${path}scene.enable`;
return request(data, "post");
}
// 禁用业务场景
export function disableScene(data) {
data.method = `${path}scene.disable`;
return request(data, "post");
}
// 获取公共业务场景列表
export function getScenesByParams(data) {
data.method = `${path}scene.getScenesByParams`;
return request(data, "get");
}
// 获取场景标签
export function getSceneTags(data) {
data.method = `${path}scene.getTags`;
return request(data, "post");
}
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,13 @@ import request from "./request" ...@@ -2,6 +2,13 @@ import request from "./request"
const path = "dj.smartcarlife.api." const path = "dj.smartcarlife.api."
/** 开放平台新建商户(含权限);走 request 层 oaapproval 路由→axios_oaapproval;园区店 merchantType=6、服务商 merchantType=7;提交固定 source=DJ */
export function createMerchantWithPermissions(data) {
data.method = "merchants.api.open.createMerchantWithPermissions"
data.source = "DJ"
return request(data, "post")
}
// 分页查询园区店服务商列表 // 分页查询园区店服务商列表
export function getList(data) { export function getList(data) {
// data.method = `${path}partnerMerchant.serviceRef.page` // data.method = `${path}partnerMerchant.serviceRef.page`
......
...@@ -101,6 +101,18 @@ export function findMerchantListByPage(data) { ...@@ -101,6 +101,18 @@ export function findMerchantListByPage(data) {
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/** 上级商户分页(开放平台 oaapproval 网关)— 客户信息核验等 */
export function findMerchantListByPageOpen(data) {
data.method = `dj.api.oaapproval.open.findMerchantListByPage`;
return request(data, RequestMethods.POST);
}
/** 账户中心校验商户名称是否已存在(method 与请求体以后端文档为准联调) */
export function checkMerchantNameExists(data) {
data.method = `merchants.api.open.merchantName.exists`;
return request(data, RequestMethods.POST);
}
// 嘀加上架 - 保存 // 嘀加上架 - 保存
export function operationConfirm(data) { export function operationConfirm(data) {
data.method = `dj.api.create.business.approve.operationConfirm`; data.method = `dj.api.create.business.approve.operationConfirm`;
......
...@@ -238,6 +238,14 @@ $prefix: d2; ...@@ -238,6 +238,14 @@ $prefix: d2;
word-break: break-all; word-break: break-all;
} }
.ellipsis-clamp-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
.blue { .blue {
color: #0947c6; color: #0947c6;
} }
...@@ -339,7 +347,7 @@ $prefix: d2; ...@@ -339,7 +347,7 @@ $prefix: d2;
border: 1px solid #e4e7ed !important; border: 1px solid #e4e7ed !important;
color: #666; color: #666;
width: fit-content; width: fit-content;
.tooltip-content-max{ .tooltip-content-max {
max-height: 50vh; max-height: 50vh;
overflow-y: auto; overflow-y: auto;
} }
...@@ -354,7 +362,7 @@ $prefix: d2; ...@@ -354,7 +362,7 @@ $prefix: d2;
height: auto; height: auto;
padding: 8px 10px; padding: 8px 10px;
width: fit-content; width: fit-content;
.tooltip-content-max{ .tooltip-content-max {
max-height: 50vh; max-height: 50vh;
overflow-y: auto; overflow-y: auto;
} }
......
...@@ -16,7 +16,7 @@ export const BaseData = { ...@@ -16,7 +16,7 @@ export const BaseData = {
positionTypeList: "positionTypeList", // 太阳膜商品部位 positionTypeList: "positionTypeList", // 太阳膜商品部位
extendedPosiTypeList: "extendedPosiTypeList", // 延保类商品部位 extendedPosiTypeList: "extendedPosiTypeList", // 延保类商品部位
}; };
/** 计价单位选项 1-把、2-本、3-对、4-个、5-根、6-盒、7-件、8-卷、9-块、10-辆、11-米、12-克、13-升、14-双、15-台、16-套、17-条、18-桶、19-位、20-页、21-张 */ /** 计价单位选项 1-把、2-本、3-对、4-个、5-根、6-盒、7-件、8-卷、9-块、10-辆、11-米、12-克、13-升、14-双、15-台、16-套、17-条、18-桶、19-位、20-页、21-张、22-车 */
export const priceUnitTypeList = [ export const priceUnitTypeList = [
{ value: 1, label: "把" }, { value: 1, label: "把" },
{ value: 2, label: "本" }, { value: 2, label: "本" },
...@@ -39,6 +39,7 @@ export const priceUnitTypeList = [ ...@@ -39,6 +39,7 @@ export const priceUnitTypeList = [
{ value: 19, label: "位" }, { value: 19, label: "位" },
{ value: 20, label: "页" }, { value: 20, label: "页" },
{ value: 21, label: "张" }, { value: 21, label: "张" },
{ value: 22, label: "车" },
]; ];
/** /**
...@@ -418,7 +419,7 @@ export function limitPrice( ...@@ -418,7 +419,7 @@ export function limitPrice(
pointDigit, pointDigit,
minValue, minValue,
maxValue, maxValue,
regRule, regRule
) { ) {
let reg = { let reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line priceReg: /^\d[\d\.]*$/, // eslint-disable-line
...@@ -483,9 +484,7 @@ export const afterTodayOptions = { ...@@ -483,9 +484,7 @@ export const afterTodayOptions = {
date < new Date(new Date().toLocaleDateString()) || date < new Date(new Date().toLocaleDateString()) ||
date > date >
new Date( new Date(
new Date().setDate( new Date().setDate(new Date().getDate() + (appointDays - 1))
new Date().getDate() + (appointDays - 1),
),
) )
) { ) {
return true; return true;
...@@ -546,7 +545,11 @@ export const sceneList = { ...@@ -546,7 +545,11 @@ export const sceneList = {
4: "积分商城", 4: "积分商城",
7: "二手车", 7: "二手车",
}; };
// 新场景
export const newSceneList = {
0: "权益类",
1: "轻改类",
};
// 导流方下拉选项对应 // 导流方下拉选项对应
export const attrToVal = [ export const attrToVal = [
{ {
...@@ -1512,10 +1515,13 @@ export const punishFlagOpt = [ ...@@ -1512,10 +1515,13 @@ export const punishFlagOpt = [
{ confId: "1", confValue: "是" }, { confId: "1", confValue: "是" },
]; ];
// 服务中心-长课程配置 处罚状态 // 服务中心-长课程配置 处罚状态
// 惩罚状态 1-未触发 2-处罚中 3-已结束 4-已解除
export const punishStatusOpt = [ export const punishStatusOpt = [
{ confId: 1, confValue: "未触发" }, { confId: 1, confValue: "未触发" },
{ confId: 2, confValue: "处罚中" }, { confId: 2, confValue: "处罚中" },
{ confId: 3, confValue: "已结束" }, { confId: 3, confValue: "已结束" },
{ confId: 4, confValue: "已解除" },
]; ];
// 服务中心-长课程配置 归属业务 // 服务中心-长课程配置 归属业务
export const course_businessOpt = [ export const course_businessOpt = [
...@@ -1534,9 +1540,10 @@ export const effectiveTypeOpt = [ ...@@ -1534,9 +1540,10 @@ export const effectiveTypeOpt = [
]; ];
// 服务中心-长课程配置 处罚方式 // 服务中心-长课程配置 处罚方式
export const punishTypeOpt = [ export const punishTypeOpt = [
{ confId: 0, confValue: "不处罚" }, { confId: 0, confValue: "无处罚" },
{ confId: 1, confValue: "限制录单" }, { confId: 1, confValue: "限制录单" },
]; ];
// 服务中心-长课程配置 任务状态 // 服务中心-长课程配置 任务状态
export const course_taskStatusOpt = [ export const course_taskStatusOpt = [
{ confId: 1, confValue: "进行中" }, { confId: 1, confValue: "进行中" },
...@@ -1917,6 +1924,7 @@ export const djOrderTypeMap = { ...@@ -1917,6 +1924,7 @@ export const djOrderTypeMap = {
3: "买赠策略", 3: "买赠策略",
4: "冲量活动", 4: "冲量活动",
1: "正常订单", 1: "正常订单",
6: "内部结算",
}; };
export const auditStatusMap = { export const auditStatusMap = {
...@@ -1959,6 +1967,10 @@ export const djOrderTypeList = [ ...@@ -1959,6 +1967,10 @@ export const djOrderTypeList = [
confId: "1", confId: "1",
confLabel: "正常订单", confLabel: "正常订单",
}, },
{
confId: "6",
confLabel: "内部结算",
},
]; ];
export const goodsAuditStatusList = [ export const goodsAuditStatusList = [
......
import GLMapSdk from "@/common/glsk-mapapi-sdk";
let singleton = null;
function attachReady(sdk) {
if (typeof sdk.ready === "function") return;
sdk.ready = function mapApiReady(timeoutMs = 30000) {
const inst = this;
const deadline = Date.now() + timeoutMs;
return new Promise((resolve, reject) => {
function tick() {
if (inst.GLMap) {
resolve(inst);
return;
}
if (Date.now() >= deadline) {
reject(new Error("Map SDK load timeout"));
return;
}
setTimeout(tick, 50);
}
tick();
});
};
}
function getOrCreateSdk() {
if (!singleton) {
singleton = new GLMapSdk();
attachReady(singleton);
}
return singleton;
}
/**
* 注册 Vue.prototype.$mapapi:首次访问再实例化 GLMapSdk,并补全 glsk-mapapi-sdk 未提供的 ready()(轮询 GLMap)。
*/
export function installVueMapApi(Vue) {
Object.defineProperty(Vue.prototype, "$mapapi", {
get() {
return getOrCreateSdk();
},
configurable: true,
});
}
/**
* scene_type(前端的 scene 字段)→ baseSceneCode,与商户列表入参一致。
* 优先使用接口同步后的映射(见 syncStaffSceneLabelList);未加载前由 LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE 推导。
*/
/**
* base_scene_code → scene_type(与 dj_car_life_scene 全量一一对应,含同 scene_type 多码;兜底唯一数据源)
*/
export const LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE = Object.freeze({
100101: 1,
100102: 2,
100103: 3,
110101: 0,
110102: 0,
110201: 0,
110202: 0,
120101: 7,
});
/** 由 LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE 分组:同 scene_type 多码时默认取数值最小的 base_scene_code */
function buildLegacySceneTypeDerived() {
const buckets = {};
for (const [codeStr, st] of Object.entries(LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE)) {
const code = Number(codeStr);
if (Number.isNaN(code)) continue;
if (!buckets[st]) buckets[st] = [];
buckets[st].push(code);
}
const defaultByType = {};
const allByType = {};
for (const st of Object.keys(buckets)) {
const sorted = Object.freeze(
[...buckets[st]].sort((a, b) => a - b),
);
const sn = Number(st);
defaultByType[sn] = sorted[0];
allByType[sn] = sorted;
}
return {
defaultByType: Object.freeze(defaultByType),
allByType: Object.freeze(allByType),
};
}
const _legacySceneTypeDerived = buildLegacySceneTypeDerived();
/** @type {Readonly<Record<number, number>>} */
const LEGACY_SCENE_TYPE_TO_DEFAULT_BASE_SCENE_CODE = _legacySceneTypeDerived.defaultByType;
/**
* scene_type → 该类型下全部 base_scene_code(由 LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE 推导,升序)
*/
export const LEGACY_SCENE_TYPE_TO_ALL_BASE_SCENE_CODES =
_legacySceneTypeDerived.allByType;
/** @type {Map<number, number>} sceneType → baseSceneCode(数字),仅 status===1 的接口数据 */
let dynamicSceneTypeToBaseSceneCode = new Map();
/** @type {Map<string, number>} 规范化 baseSceneCode 字符串 → sceneType,与 syncStaffSceneLabelList 同步 */
let dynamicBaseSceneCodeToSceneType = new Map();
/**
* @param {unknown} payload - 接口原始载荷(数组或常见分页包裹)
* @returns {object[]}
*/
export function normalizeStaffSceneLabelPayload(payload) {
if (Array.isArray(payload)) return payload;
if (payload && typeof payload === "object") {
if (Array.isArray(payload.list)) return payload.list;
if (Array.isArray(payload.records)) return payload.records;
if (Array.isArray(payload.data)) return payload.data;
}
return [];
}
/**
* 根据员工场景标签列表重建映射;仅纳入启用(status===1)项。
* 同一 sceneType 多条时后者覆盖前者,与列表顺序一致。
* @param {unknown} payload
*/
export function syncStaffSceneLabelList(payload) {
const list = normalizeStaffSceneLabelPayload(payload);
const enabled = list.filter((item) => item && item.status === 1);
const typeToCode = new Map();
const codeToType = new Map();
for (const item of enabled) {
const st = Number(item.sceneType);
if (Number.isNaN(st)) continue;
const raw = item.baseSceneCode;
if (raw == null || raw === "") continue;
const codeNum = Number(raw);
if (Number.isNaN(codeNum)) continue;
typeToCode.set(st, codeNum);
codeToType.set(String(codeNum), st);
}
dynamicSceneTypeToBaseSceneCode = typeToCode;
dynamicBaseSceneCodeToSceneType = codeToType;
}
/**
* @param {unknown} baseSceneCode
* @returns {number} 匹配不到时为 NaN
*/
export function getSceneTypeByBaseSceneCode(baseSceneCode) {
if (baseSceneCode == null || baseSceneCode === "") return NaN;
const n = Number(baseSceneCode);
const strKey = Number.isNaN(n) ? String(baseSceneCode).trim() : String(n);
if (!strKey) return NaN;
if (dynamicBaseSceneCodeToSceneType.has(strKey)) {
return dynamicBaseSceneCodeToSceneType.get(strKey);
}
const legacyKey = Number.isNaN(n) ? strKey : n;
const hit =
LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE[legacyKey] ??
LEGACY_BASE_SCENE_CODE_TO_SCENE_TYPE[strKey];
return hit !== undefined ? hit : NaN;
}
/**
* @param {unknown} scene
* @returns {number}
*/
export function getBaseSceneCodeBySceneType(scene) {
const n = scene != null && scene !== "" ? Number(scene) : NaN;
if (Number.isNaN(n)) return 110101;
if (dynamicSceneTypeToBaseSceneCode.has(n)) {
return dynamicSceneTypeToBaseSceneCode.get(n);
}
if (
Object.prototype.hasOwnProperty.call(
LEGACY_SCENE_TYPE_TO_DEFAULT_BASE_SCENE_CODE,
n,
)
) {
return LEGACY_SCENE_TYPE_TO_DEFAULT_BASE_SCENE_CODE[n];
}
return 110101;
}
/**
* @param {object} routerLike
* @param {unknown} routerLike.baseSceneCode
* @param {unknown} routerLike.scene
* @returns {number}
*/
export function resolveBaseSceneCodeFromRouter(routerLike) {
if (routerLike == null) return getBaseSceneCodeBySceneType(undefined);
const raw = routerLike.baseSceneCode;
if (raw != null && raw !== "") {
const n = Number(raw);
if (!Number.isNaN(n)) return n;
}
return getBaseSceneCodeBySceneType(routerLike.scene);
}
<!-- 弹窗 --> <!-- 弹窗 -->
<template> <template>
<div> <div>
<el-dialog <el-dialog :title="title" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose"
:title="title" :close-on-click-modal="false" :width="width" :append-to-body="appendToBody" :fullscreen="fullscreen">
:visible.sync="isVisible"
:show-close="showClose"
:before-close="handleClose"
:close-on-click-modal="false"
:width="width"
:append-to-body="appendToBody"
:fullscreen="fullscreen"
>
<span slot="title"> <span slot="title">
{{ title }} {{ title }}
<span class="dialog-sub-title"> <span class="dialog-sub-title">
...@@ -22,12 +14,8 @@ ...@@ -22,12 +14,8 @@
<slot name="btn-start" /> <slot name="btn-start" />
<el-button v-if="!noCancel" @click="handleClose"> 取消 </el-button> <el-button v-if="!noCancel" @click="handleClose"> 取消 </el-button>
<slot name="btn-middle" /> <slot name="btn-middle" />
<el-button <el-button type="primary" v-if="isShowFooter" @click="handleConfirm"
type="primary" :loading="$store.state.d2admin.loading.value">
v-if="isShowFooter"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value"
>
{{ btnOkLabel }} {{ btnOkLabel }}
</el-button> </el-button>
<slot name="btn-end" /> <slot name="btn-end" />
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
:multiple="item.multiple" :multiple="item.multiple"
:multiple-limit="item.multipleLimit || 0" :multiple-limit="item.multipleLimit || 0"
:no-data-text="item.noDataText || '无数据'" :no-data-text="item.noDataText || '无数据'"
:placeholder="`请选择${item.label}`" :placeholder="item.placeholder || `请选择${item.label}`"
:popper-append-to-body="selectPopperAppendToBody" :popper-append-to-body="selectPopperAppendToBody"
:style="{ width: item.width || '100%' }" :style="{ width: item.width || '100%' }"
@change="selectAddAttr($event, item)"> @change="selectAddAttr($event, item)">
...@@ -135,6 +135,16 @@ ...@@ -135,6 +135,16 @@
:label="subItem[item.optionLabel]" :label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" /> :value="subItem[item.optionId]" />
</el-select> </el-select>
<el-radio-group v-else-if="item.type === 'radio'"
v-model="searchForm[item.name]"
:style="{ width: item.width || '100%' }"
@change="item.changeAttr && item.changeAttr($event, item)">
<el-radio v-for="(subItem, subIndex) in item.optionList"
:key="subIndex"
:label="subItem[item.optionId]">
{{ subItem[item.optionLabel] }}
</el-radio>
</el-radio-group>
<el-date-picker v-else-if="item.type === 'datePicker'" <el-date-picker v-else-if="item.type === 'datePicker'"
v-model="searchForm[item.name]" v-model="searchForm[item.name]"
:clearable="item.isClear || false" :clearable="item.isClear || false"
...@@ -164,6 +174,7 @@ ...@@ -164,6 +174,7 @@
</template> </template>
<script> <script>
import { isFunction } from "lodash-es";
import { import {
rangePickerOptions, rangePickerOptions,
rangePickerOptions_30day2, rangePickerOptions_30day2,
...@@ -250,6 +261,9 @@ export default { ...@@ -250,6 +261,9 @@ export default {
if (item.inputType && value.length > item.maxlength) { if (item.inputType && value.length > item.maxlength) {
this.searchForm[item.name] = value.slice(0, item.maxlength); this.searchForm[item.name] = value.slice(0, item.maxlength);
} }
if (item.input && isFunction(item.input)) {
item.input({ value, schema: item, formModel: this.searchForm });
}
}, },
}, },
}; };
...@@ -302,7 +316,7 @@ export default { ...@@ -302,7 +316,7 @@ export default {
background-color: #fff; background-color: #fff;
} }
.el-input__inner { .d2-search .el-input__inner {
line-height: 1px !important; line-height: 1px !important;
} }
</style> </style>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<template> <template>
<el-row class="table-header"> <el-row class="table-header">
<el-col :span="leftSpan" :class="titleClassName"> <el-col :span="leftSpan" :class="titleClassName">
<span v-text="title" class="table-header-title" /> <span class="table-header-title" v-text="title" />
<slot name="left" /> <slot name="left" />
</el-col> </el-col>
<el-col :span="24 - leftSpan"> <el-col :span="24 - leftSpan">
...@@ -25,24 +25,27 @@ export default { ...@@ -25,24 +25,27 @@ export default {
title: { title: {
type: String, type: String,
required: false, required: false,
default: "" default: "",
}, },
titleClassName: { titleClassName: {
type: String, type: String,
default: "" default: "",
}, },
leftSpan: { leftSpan: {
type: Number, type: Number,
required: false, required: false,
default: 12 default: 12,
} },
} },
} };
</script> </script>
<style> <style lang="scss">
.table-header { .table-header {
font-size: 14px; font-size: 14px;
> .el-col {
align-items: center;
}
} }
.table-header-title { .table-header-title {
color: #111111; color: #111111;
......
...@@ -108,8 +108,7 @@ ...@@ -108,8 +108,7 @@
margin-left: 5px; margin-left: 5px;
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;"
"
@click="handleHeaderBatch(sub)" /> @click="handleHeaderBatch(sub)" />
</template> </template>
<template #default="scope"> <template #default="scope">
...@@ -296,7 +295,7 @@ ...@@ -296,7 +295,7 @@
</template> </template>
<el-table-column v-if="tableParams.tableOption" <el-table-column v-if="tableParams.tableOption"
:align="tableParams.tableOption.align || 'center'" :align="tableParams.tableOption.align || 'center'"
fixed="right" :fixed="tableParams.tableOption.fixed || 'right'"
label="操作" label="操作"
:width="tableParams.tableOption.width || 'auto'"> :width="tableParams.tableOption.width || 'auto'">
<template #default="scope"> <template #default="scope">
......
<template>
<el-row class="description-wrapper"
style="width:100%;overflow:hidden;flex-wrap: wrap"
type="flex"
align="top">
<template v-for="item in getSchema">
<el-col v-if="!isHideSchemaItem(item)"
:key="item._key"
:span="item.col || 12">
<slot :name="item.slot || item.name ">
<div class="form-item" :style="item.itemStyle || {}">
<span class="label" :style="{ width: item.labelWidth || '150px' }">
<slot :name="`${item.slot || item.name}-label`">
{{ item.label }}{{ item.hideColon ? "" : ":" }}
</slot>
</span>
<span class="value">
<el-tooltip :disabled="!item.tooltip"
v-bind="item.tooltipProps">
<template #content>
<template v-if="item.tooltipProps.render">
<RenderProxy :render="item.tooltipProps.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</template>
</template>
<div :class="item.parentProps.className" :style="{ width: item.valueWidth || '100%', ...item.parentProps.style }">
<template v-if="item.render">
<RenderProxy :render="item.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
<slot :name="`${item.slot || item.name}-value`">
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</slot>
</template>
</div>
</el-tooltip>
</span>
</div>
</slot>
</el-col>
</template>
</el-row>
</template>
<script>
import { defaults, get, isFunction } from "lodash-es";
import { nanoid } from "nanoid";
import RenderProxy from "@/components/renderProxy/index.vue";
import { isZeroOrNumber } from "@/libs/number.js";
export default {
name: "Descriptions",
components: {
RenderProxy,
},
props: {
// hideColon 是否隐藏colon , 默认false
// name : - 唯一key , 数据的键值
// label : 文案
// col : 占24分之几
// valueWidth : 值的宽度,默认为100%
// labelWidth : 标签宽度,默认为150px
// slot : 整体的插槽名,优先级高于name
// itemStyle: 每一项的样式
// tooltip: boolean 是否用tooltip 展示data数据
// tooltipProps: el-tooltip 的传参
// render ?:(h,{ data,schemaItem,schema } )=>{} 自定义渲染
// isHide 是否隐藏 (data)=>boolean || boolean
// parentProps:{
// className:'text-hide' // 默认
// },
schema: {
type: Array,
default: () => ([]),
},
data: {
type: Object,
default: () => ({}),
},
},
computed: {
getSchema() {
return this.schema.map(item => ({
...item,
parentProps: defaults(item.parentProps || {}, { className: "text-hide" }),
tooltipProps: defaults(item.tooltipProps || {}, { defaultClassName: "text-hide" }),
_key: nanoid(),
}));
},
},
methods: {
isZeroOrNumber,
getValue(key) {
return get(this.data, key);
},
isHideSchemaItem(schemaItem) {
if (isFunction(schemaItem.isHide)) {
return schemaItem.isHide({ formModel: this.data });
}
return schemaItem.isHide;
},
},
render(h, ctx) {
return ctx.props.render(h, ctx.props.row);
},
};
</script>
<style scoped lang="scss">
.description-wrapper {
font-size: 14px;
.form-item {
display: flex;
flex-direction: row;
line-height: 32px;
margin-bottom: 20px;
> .label {
text-align: right;
color: #666666;
font-size: 14px;
flex-shrink: 0;
}
> .value {
flex-shrink: 0;
flex: 1;
overflow: hidden;
}
}
}
</style>
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!