Commit b5e9cd6a by 前端

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

上线合并

See merge request !594
2 parents e1236345 2d8cf19a
Showing 195 changed files with 3319 additions and 589 deletions
# 忽略目录
build/
tests/
node_modules/
# node 覆盖率文件
coverage/
# 忽略文件
**/*-min.js
**/*.min.js
**/*.vue
# 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: 简短描述
...@@ -6,6 +6,7 @@ node_modules ...@@ -6,6 +6,7 @@ node_modules
/copyDirTarget /copyDirTarget
.cursorrules .cursorrules
.cursor .cursor
.trae
# Log files # Log files
npm-debug.log* npm-debug.log*
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
], ],
"cSpell.words": [ "cSpell.words": [
"vuex", "vuex",
"Cascader" "Cascader",
"glsx"
], ],
"workbench.tree.indent": 24, "workbench.tree.indent": 24,
"eslint.enable": true, "eslint.enable": true,
...@@ -17,25 +18,19 @@ ...@@ -17,25 +18,19 @@
"vetur.validation.style": true, "vetur.validation.style": true,
"vetur.ignoreProjectWarning": false, "vetur.ignoreProjectWarning": false,
"vetur.experimental.templateInterpolationService": false, "vetur.experimental.templateInterpolationService": false,
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.autoIndent": "full", "editor.autoIndent": "full",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
// "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
} },
"[vue]": {
}, },
"[javascript]": { "[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}, },
"[javascriptreact]": { "[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}, },
"i18n-ally.sourceLanguage": "zh-chs" "i18n-ally.sourceLanguage": "zh-chs",
"javascript.suggest.autoImports": true
} }
...@@ -12,6 +12,15 @@ export default antfu({ ...@@ -12,6 +12,15 @@ export default antfu({
"dist", "dist",
// unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用 // unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用
"auto-import.d.ts", "auto-import.d.ts",
"build/",
"tests/",
"node_modules/",
// # node 覆盖率文件
"coverage/",
"**/*-min.js",
"**/*.min.js",
], ],
stylistic: { stylistic: {
"indent": "tab", // 4个空格 "indent": "tab", // 4个空格
...@@ -20,6 +29,12 @@ export default antfu({ ...@@ -20,6 +29,12 @@ export default antfu({
"array-bracket-spacing": ["error", "always"], "array-bracket-spacing": ["error", "always"],
}, },
rules: { rules: {
"no-useless-catch": "off",
"vue/no-unused-refs": "warn",
"unused-imports/no-unused-imports": "warn",
"no-unused-vars": "warn",
"style/eol-last": "off",
"no-prototype-builtins": "warn",
"prefer-template": "off", "prefer-template": "off",
"no-useless-return": "off", "no-useless-return": "off",
"vue/no-deprecated-delete-set": "off", "vue/no-deprecated-delete-set": "off",
...@@ -31,6 +46,8 @@ export default antfu({ ...@@ -31,6 +46,8 @@ export default antfu({
"vue/no-deprecated-v-bind-sync": "off", "vue/no-deprecated-v-bind-sync": "off",
"vue/no-lone-template": "off", "vue/no-lone-template": "off",
"vue/no-mutating-props": "off", "vue/no-mutating-props": "off",
"vue/no-deprecated-filter": "off",
"vue/no-v-for-template-key-on-child": "off",
// 强制:Vue 多行 HTML 元素的内容前后必须换行 // 强制:Vue 多行 HTML 元素的内容前后必须换行
"vue/multiline-html-element-content-newline": [ "vue/multiline-html-element-content-newline": [
"error", "error",
...@@ -88,7 +105,7 @@ export default antfu({ ...@@ -88,7 +105,7 @@ export default antfu({
"EVENTS", // @click @focus "EVENTS", // @click @focus
"CONTENT", // v-text v-html "CONTENT", // v-text v-html
], ],
alphabetical: true, // 是否在同组内再按字母排序(建议 false,官方默认顺序更好) alphabetical: false, // 是否在同组内再按字母排序(建议 false,官方默认顺序更好)
}], }],
// 强制:Vue SFC 中块的顺序(template -> script -> style) // 强制:Vue SFC 中块的顺序(template -> script -> style)
"vue/block-order": [ "vue/block-order": [
......
...@@ -6,7 +6,7 @@ module.exports = { ...@@ -6,7 +6,7 @@ module.exports = {
'vue' 'vue'
], ],
transform: { transform: {
'^.+\\.vue$': 'vue-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'
}, },
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
"baseUrl": ".", "baseUrl": ".",
"module": "ESNext", "module": "ESNext",
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", // 按 Node 规则解析模块
"moduleResolution": "node",
"paths": { "paths": {
"@/*": [ "@/*": [
"src/*" "src/*"
...@@ -38,4 +39,7 @@ ...@@ -38,4 +39,7 @@
"dist", "dist",
".git" ".git"
] ]
// 对齐 Webpack 的 extensions 优先级
// "extensions": [".vue", ".js", ".ts", ".json"]
} }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"default-passive-events": "^2.0.0", "default-passive-events": "^2.0.0",
"echarts": "^5.3.2", "echarts": "^5.3.2",
"element-ui": "2.13.2", "element-ui": "2.13.2",
"emoji-regex": "^10.6.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"flex.css": "^1.1.7", "flex.css": "^1.1.7",
"fuse.js": "^3.4.4", "fuse.js": "^3.4.4",
...@@ -44,8 +45,10 @@ ...@@ -44,8 +45,10 @@
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"lodash": "^4.17.23",
"lodash-es": "^4.17.22", "lodash-es": "^4.17.22",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
"nanoid": "^5.1.6",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"number-precision": "^1.6.0", "number-precision": "^1.6.0",
"print-js": "^1.6.0", "print-js": "^1.6.0",
...@@ -73,6 +76,7 @@ ...@@ -73,6 +76,7 @@
"@antfu/eslint-config": "^6.7.3", "@antfu/eslint-config": "^6.7.3",
"@babel/core": "^7.12.16", "@babel/core": "^7.12.16",
"@kazupon/vue-i18n-loader": "^0.4.1", "@kazupon/vue-i18n-loader": "^0.4.1",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/cli-plugin-babel": "~5.0.8", "@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-unit-jest": "~5.0.8", "@vue/cli-plugin-unit-jest": "~5.0.8",
"@vue/cli-service": "~5.0.8", "@vue/cli-service": "~5.0.8",
......
This diff could not be displayed because it is too large.
/**
* 离线估算财务规则保存接口 JSON 体积与 JSON.stringify 耗时。
* 用法:node scripts/benchmark-financial-submit-payload.js
* 可按需修改 RULE_COUNT / USE_HEAVY_RULE 贴近生产。
*
* 参考(Node 一次跑数,轻量规则约 12 条分账行/ tab):1000 tab ≈ 4.2MB UTF-8,stringify 约数十 ms 级;
* 浏览器主线程略慢,且真实类目/ nested children 更大时需以 USE_HEAVY_RULE=true 再测。
*/
const RULE_COUNT = 1000
const USE_HEAVY_RULE = process.argv.includes("--heavy")
const sampleRuleLight = {
expenseCategoryRules: [
{
expenseCategoryCalculateType: 1,
expenseCategoryValue: 2,
expenseCategoryId: 1,
expenseCategoryName: "流量费",
formType: 1,
calculateMode: 1,
nodeType: 1,
targetType: 1,
children: []
}
],
shop4sDeductChargeFlag: "Y",
partnerDeductChargeFlag: "Y",
virtualAccountCostFlag: "Y",
recoveryCostFlag: "Y",
groupDivisionRuleId: 38108,
djCostFlag: "Y",
thirdPartyCostFlag: "Y",
goodsCostFlag: "Y",
goodsSource: 1,
goodsCostConvertRate: 100,
virtualAccountCostConvertRate: 100,
recoveryCostConvertRate: 100,
djCostConvertRate: 100,
thirdPartyCostConvertRate: 100,
groupType: 2,
goodsTypes: [],
merchantDistributionRules: Array.from({ length: 12 }, (_, i) => ({
applicationObjectType: i % 3 || 1,
id: i,
expenseCategoryId: i,
applicationObjectName: `项${i}`,
merchantId: "-1",
merchantName: "示例",
targetMerchantType: 1
})),
owningMerchantDistributionRules: Array.from({ length: 12 }, (_, i) => ({
applicationObjectType: i % 3 || 1,
id: i,
expenseCategoryId: i,
applicationObjectName: `项${i}`,
merchantId: "-1",
merchantName: "示例",
targetMerchantType: 1
}))
}
/** 更接近接口示例:多条 expenseCategory + children + 两套分账表各 ~12 行 */
const sampleRuleHeavy = {
expenseCategoryRules: [
{
expenseCategoryCalculateType: 1,
expenseCategoryValue: 2,
expenseCategoryId: 1,
expenseCategoryName: "流量费",
formType: 1,
calculateMode: 1,
nodeType: 1,
targetType: 1,
targetMerchant: {},
children: []
},
{
expenseCategoryCalculateType: 2,
expenseCategoryValue: 2,
expenseCategoryId: 302,
expenseCategoryName: "资源费",
formType: 1,
calculateMode: 1,
nodeType: 1,
targetType: 1,
children: []
},
{
expenseCategoryCalculateType: 1,
expenseCategoryValue: 2,
expenseCategoryId: 1151,
expenseCategoryName: "自定义类目2",
formType: 2,
calculateMode: 1,
nodeType: 2,
targetType: 2,
targetMerchant: {},
children: [
{
expenseCategoryCalculateType: 3,
expenseCategoryValue: 222,
expenseCategoryId: 1152,
expenseCategoryName: "自定义1",
calculateMode: 1,
nodeType: 3,
categoryToSort: 1,
targetType: 2,
targetMerchant: {}
},
{
expenseCategoryCalculateType: "",
expenseCategoryValue: "",
expenseCategoryId: 1153,
expenseCategoryName: "自定义2",
calculateMode: 1,
nodeType: 4,
categoryToSort: 2,
targetType: 2,
targetMerchant: {}
}
]
}
],
shop4sDeductChargeFlag: "Y",
partnerDeductChargeFlag: "Y",
virtualAccountCostFlag: "Y",
recoveryCostFlag: "Y",
groupDivisionRuleId: 38108,
djCostFlag: "Y",
thirdPartyCostFlag: "Y",
goodsCostFlag: "Y",
goodsSource: 1,
goodsCostConvertRate: 100,
virtualAccountCostConvertRate: 100,
recoveryCostConvertRate: 100,
djCostConvertRate: 100,
thirdPartyCostConvertRate: 100,
groupType: 2,
goodsTypes: [{ goodsType: 4, goodsTypeName: "示例品类", categoryType: 1 }],
goodsTypeGroupRelations: [{ goodsType: 4, goodsTypeName: "示例品类", categoryType: 1 }],
merchantDistributionRules: sampleRuleLight.merchantDistributionRules,
owningMerchantDistributionRules: sampleRuleLight.owningMerchantDistributionRules
}
const sampleRule = USE_HEAVY_RULE ? sampleRuleHeavy : sampleRuleLight
const payload = {
merchantId: 44218596,
realityPlatformMerchantId: "-1",
settleRuleId: 6058,
divisionRuleId: 6016,
goodsTypeGroupRules: Array.from({ length: RULE_COUNT }, (_, i) => ({
...sampleRule,
groupDivisionRuleId: 38100 + i,
groupType: i === 0 ? 1 : 2
})),
divisionRuleAutos: [],
autoFlag: "N",
settleTimeType: 1,
sceneType: 1
}
const t0 = Date.now()
const json = JSON.stringify(payload)
const ms = Date.now() - t0
const utf8Bytes = Buffer.byteLength(json, "utf8")
// eslint-disable-next-line no-console
console.log(JSON.stringify({
ruleCount: RULE_COUNT,
heavy: USE_HEAVY_RULE,
stringifyMs: ms,
jsonChars: json.length,
utf8Bytes,
utf8MB: (utf8Bytes / (1024 * 1024)).toFixed(2)
}, null, 2))
...@@ -650,3 +650,12 @@ export function getStrategyMerchantAnalysisIndexHistory (data = {}) { ...@@ -650,3 +650,12 @@ export function getStrategyMerchantAnalysisIndexHistory (data = {}) {
data.method = "dj.api.strategy.merchant.analysis.index.history" data.method = "dj.api.strategy.merchant.analysis.index.history"
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
/**
* 招聘概况
*/
export function getRecruitmentDemandOverview (data = {}) {
data.method = "dj.staff.api.recruitment.demand.merchant.overview"
return request(data, RequestMethods.POST)
}
import request from "./request" import request from "./request";
const path = "dj.api.inviteRecord." const path = "dj.api.inviteRecord.";
const pathInviteRecord = "dj.api.smartcarlife.inviteRecord." const pathInviteRecord = "dj.api.smartcarlife.inviteRecord.";
const pathDj = "dj.api.smartcarlife." const pathDj = "dj.api.smartcarlife.";
// 待预约、已预约总数查询 // 待预约、已预约总数查询
export function getTotalCount (data) { export function getTotalCount(data) {
data.method = `${path}count` data.method = `${path}count`;
return request(data) return request(data);
} }
// 待预约、已预约总数查询 // 待预约、已预约总数查询
export function getList (data) { export function getList(data) {
data.method = `${path}search` data.method = `${path}search`;
return request(data) return request(data);
} }
// 预约记录列表查询 // 预约记录列表查询
export function queryInviteRecord (data) { export function queryInviteRecord(data) {
data.method = `${pathInviteRecord}query` data.method = `${pathInviteRecord}query`;
return request(data) return request(data);
} }
// 预约记录总数查询 // 预约记录总数查询
export function inviteRecordCount (data) { export function inviteRecordCount(data) {
data.method = `${pathInviteRecord}count` data.method = `${pathInviteRecord}count`;
return request(data) return request(data);
} }
// 门店下拉列表查询 // 门店下拉列表查询
export function getInviteMerchant (data) { export function getInviteMerchant(data) {
data.method = `${pathInviteRecord}merchant.page` data.method = `${pathInviteRecord}merchant.page`;
return request(data) return request(data);
} }
// 查询1.1场景登录权限下园区店信息 // 查询1.1场景登录权限下园区店信息
export function yqMerchantPage (data) { export function yqMerchantPage(data) {
data.method = `dj.api.sceneMerchantRef.shopMerchant.LoginPermissionYqMerchant.page` data.method = `dj.api.sceneMerchantRef.shopMerchant.LoginPermissionYqMerchant.page`;
return request(data) return request(data);
} }
// 工位设置查询 // 工位设置查询
export function inviteStationSetGet (data) { export function inviteStationSetGet(data) {
data.method = `${pathDj}inviteStationSet.get` data.method = `${pathDj}inviteStationSet.get`;
return request(data) return request(data);
} }
// 获取指定商户指定日期范围的邀约统计 // 获取指定商户指定日期范围的邀约统计
export function inviteStatMerchantList (data) { export function inviteStatMerchantList(data) {
data.method = `dj.api.smartcarlife.inviteStat.merchant.list` data.method = `dj.api.smartcarlife.inviteStat.merchant.list`;
return request(data) return request(data);
} }
// 工位设置修改 // 工位设置修改
export function inviteStationSetUpdate (data) { export function inviteStationSetUpdate(data) {
data.method = `${pathDj}inviteStationSet.update` data.method = `${pathDj}inviteStationSet.update`;
return request(data) return request(data);
} }
// 修改备注 // 修改备注
export function followRecordUpdate (data) { export function followRecordUpdate(data) {
data.method = `${pathInviteRecord}followRecord.update` data.method = `${pathInviteRecord}followRecord.update`;
return request(data) return request(data);
} }
// 修改预约时间 // 修改预约时间
export function dateUpdate (data) { export function dateUpdate(data) {
data.method = `${pathInviteRecord}invite.dateUpdate` data.method = `${pathInviteRecord}invite.dateUpdate`;
return request(data) return request(data);
} }
// 取消预约 // 取消预约
export function cancelInvite (data) { export function cancelInvite(data) {
data.method = `${pathInviteRecord}cancelInvite` data.method = `${pathInviteRecord}cancelInvite`;
return request(data) return request(data);
} }
/** /**
* 跟进记录 * 跟进记录
*/ */
export function followRecordListUpdate (data) { export function followRecordListUpdate(data) {
data.method = 'dj.api.smartcarlife.invite.followRecord.update' data.method = "dj.api.smartcarlife.invite.followRecord.update";
return request(data, "post", [], "", 'boutique') return request(data, "post", [], "", "boutique");
} }
...@@ -6,10 +6,8 @@ ...@@ -6,10 +6,8 @@
*/ */
import axios from "axios"; import axios from "axios";
// Mock 基础配置 // Mock 基础配置
const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7746299-7491170-default"; const MOCK_BASE_URL = "http://127.0.0.1:4523/m1/7475619-7210332-default/";
/** /**
* 创建 Mock Axios 实例 * 创建 Mock Axios 实例
*/ */
...@@ -65,12 +63,12 @@ function mockRequest(params = {}, httpMethod = "post") { ...@@ -65,12 +63,12 @@ function mockRequest(params = {}, httpMethod = "post") {
// 根据HTTP方法处理参数 // 根据HTTP方法处理参数
if (httpMethod.toLowerCase() === "post" || httpMethod.toLowerCase() === "put") { if (httpMethod.toLowerCase() === "post" || httpMethod.toLowerCase() === "put") {
config.data = data; config.data = params;
} else { } else {
// GET请求,将参数作为query string // GET请求,将参数作为query string
config.params = { config.params = {
"ropRequestContext.key": data["ropRequestContext.key"] || "", "ropRequestContext.key": data["ropRequestContext.key"] || "",
...data, ...params,
}; };
} }
...@@ -131,7 +129,7 @@ mockAxios.interceptors.request.use( ...@@ -131,7 +129,7 @@ mockAxios.interceptors.request.use(
mockAxios.interceptors.response.use( mockAxios.interceptors.response.use(
(response) => { (response) => {
console.log("Mock Response:", response.data); console.log("Mock Response:", response.data);
return response.data; return response.data.data;
}, },
(error) => { (error) => {
console.error("Mock Error:", error); console.error("Mock Error:", error);
......
...@@ -36,3 +36,21 @@ export function delPackageById(data) { ...@@ -36,3 +36,21 @@ export function delPackageById(data) {
data.method = `${path}merchantPackageGoodsInfo.deleteById` data.method = `${path}merchantPackageGoodsInfo.deleteById`
return request(data) return request(data)
} }
// 根据套餐ID列表查询套餐下商品信息
export function getGoodsByPackageIdList(data) {
data.method = `${path}merchantPackageGoodsInfo.getGoodsByPackageIdList`
return request(data, "post")
}
// 根据套餐ID列表查询套餐关联商户列表
export function queryRelatedMerchantByPackageIdList(data) {
data.method = `${path}merchantPackageGoodsInfo.queryRelatedMerchantByPackageIdList`
return request(data, "post")
}
// 批量修改套餐库存管控模式
export function batchEditInventoryTypeByPackageId(data) {
data.method = `${path}merchantPackageGoodsInfo.batchEditInventoryTypeByPackageId`
return request(data, "post")
}
/*
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-03-30 17:36:59
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-04-01 16:58:21
* @FilePath: \dj-car-life-system\src\api\recruitment.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// 招聘管理 // 招聘管理
import request from "./request" import request from "./request";
// 招聘需求分页查询 // 招聘需求分页查询
export function getRecruitmentList(data) { export function getRecruitmentList(data) {
data.method = `dj.staff.api.recruitment.demand.page` data.method = `dj.staff.api.recruitment.demand.page`;
return request(data) return request(data);
} }
// 新增招聘需求 // 新增招聘需求
export function addRecruitment(data) { export function addRecruitment(data) {
data.method = `dj.staff.api.recruitment.demand.add` data.method = `dj.staff.api.recruitment.demand.add`;
return request(data) return request(data);
} }
// 招聘需求详情 // 招聘需求详情
export function getRecruitmentDetail(data) { export function getRecruitmentDetail(data) {
data.method = `dj.staff.api.recruitment.demand.detail` data.method = `dj.staff.api.recruitment.demand.detail`;
return request(data) return request(data);
} }
// 处理招聘需求 // 处理招聘需求
export function handleRecruitment(data) { export function handleRecruitment(data) {
data.method = `dj.staff.api.recruitment.demand.process` data.method = `dj.staff.api.recruitment.demand.process`;
return request(data) return request(data);
} }
// 招聘需求状态更新(确认、驳回、完成) // 招聘需求状态更新(确认、驳回、完成)
export function updateRecruitmentStatus(data) { export function updateRecruitmentStatus(data) {
data.method = `dj.staff.api.recruitment.demand.status.update` data.method = `dj.staff.api.recruitment.demand.status.update`;
return request(data) return request(data);
} }
// 招聘需求汇总 // 招聘需求汇总
export function getRecruitmentSummary(data = {}) { export function getRecruitmentSummary(data = {}) {
data.method = `dj.staff.api.recruitment.demand.summary` data.method = `dj.staff.api.recruitment.demand.summary`;
return request(data) return request(data);
} }
// 门店(d+系统中的全部门店+园区店商户)列表查询 // 门店(d+系统中的全部门店+园区店商户)列表查询
export function getDemandMerchant(data) { export function getDemandMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.merchant.page` data.method = `dj.staff.api.recruitment.demand.merchant.page`;
return request(data) return request(data);
} }
// 新增字典项 // 新增字典项
export function addDict(data) { export function addDict(data) {
data.method = `dj.staff.api.dict.add` data.method = `dj.staff.api.dict.add`;
return request(data) return request(data);
} }
// 删除字典项 // 删除字典项
export function deleteDict(data) { export function deleteDict(data) {
data.method = `dj.staff.api.dict.delete` data.method = `dj.staff.api.dict.delete`;
return request(data) return request(data);
} }
// 分页查询字典项列表 // 分页查询字典项列表
export function getDictList(data) { export function getDictList(data) {
data.pageSize = 99999 data.pageSize = 99999;
data.currentPage = 1 data.currentPage = 1;
data.method = `dj.staff.api.dict.page` data.method = `dj.staff.api.dict.page`;
return request(data) return request(data);
} }
// 修改字典项 // 修改字典项
export function updateDict(data) { export function updateDict(data) {
data.method = `dj.staff.api.dict.update` data.method = `dj.staff.api.dict.update`;
return request(data) return request(data);
}
// 批量变更招聘需求
export function batchUpdateRecruitment(data) {
data.method = `dj.staff.api.recruitment.demand.batch.update`;
return request(data);
}
// 关联招聘需求
export function associateRecruitmentDemand(data) {
data.method = `dj.staff.api.recruitment.demand.relate`;
return request(data);
}
// 招聘需求批量变更
export function batchChangeRecruitment(data) {
data.method = `dj.staff.api.recruitment.demand.batch.change`;
return request(data);
}
// 单店信息督导和员工查询
export function findMerchantStaffList(data) {
// data.method = `${path2}workbench.findMerchantStaffList`
data.method = `dj.api.smartcarlife.workbench.findMerchantStaffFilterList`;
return request(data);
}
// 招聘需求关联系统门店
export function linkMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.link.merchant`;
return request(data);
} }
\ No newline at end of file \ No newline at end of file
...@@ -30,6 +30,9 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -30,6 +30,9 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
apiName = "strategy"; apiName = "strategy";
} else if (params.method.includes("dj.api.supervisor")) { } else if (params.method.includes("dj.api.supervisor")) {
apiName = "supervisor"; apiName = "supervisor";
} else if (params.method.includes("dj.pad.api")) {
// rop-dj-pad 等方法名含 dj.pad,split(".api") 会得到 dj.pad 无 mapping;签名与 appKey 沿用 dj
apiName = "dj";
} 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];
......
/** 二手车 */ /** 二手车 */
import { baseConfig } from "@/main";
import { gscPost } from "./gscRequest"; import { gscPost } from "./gscRequest";
import request from "./request"; import request from "./request";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
function scrmCarlifeRopUrl() {
const b = baseConfig || {};
if (b.axios2CarlifeRouter) return b.axios2CarlifeRouter;
const ax2 = b.axios2 && b.axios2.baseURL;
if (ax2 && /shopmall/i.test(ax2))
return ax2.replace(/rop-scrm-shopmall/gi, "rop-scrm-carlife");
return "https://scrm.glsx.com.cn/rop-scrm-carlife/router";
}
function djPadRopUrl() {
const b = baseConfig || {};
if (b.djPadRouter) return b.djPadRouter;
const ax = b.axios && b.axios.baseURL;
if (ax && /rop-dj-smartcarlife/i.test(ax))
return ax.replace(/rop-dj-smartcarlife/gi, "rop-dj-pad");
return "https://dj.glsx.com.cn/rop-dj-pad/router";
}
/**
* Pad 网关 — 车架号校验(与小程序 dj.pad.api.vin.validate 一致)
*/
export function padVinValidate(data = {}) {
data.method = "dj.pad.api.vin.validate";
return request(data, RequestMethods.POST, [], {
url: djPadRopUrl(),
returnAll: true,
});
}
/**
* SCRM 车生活 — 品牌/子品牌/车系(或下级)树,供级联选择(与 axios2 相同 sign,网关 rop-scrm-carlife)
*/
export function scrmCarlifeGetOnlyCarBrandList(data = {}) {
data.method = "scrm.api.carlife.common.getOnlyCarBrandList";
return request(data, RequestMethods.POST, [], { url: scrmCarlifeRopUrl() });
}
/**
* SCRM 车生活 — 车系列表(需 brandId + childBrandId)
*/
export function scrmCarlifeGetCarSeriesList(data = {}) {
data.method = "scrm.api.carlife.common.getCarSeriesList";
return request(data, RequestMethods.POST, [], { url: scrmCarlifeRopUrl() });
}
/**
* SCRM 车生活 — 车型列表(需 carSeriesId)
*/
export function scrmCarlifeGetCarTypeList(data = {}) {
data.method = "scrm.api.carlife.common.getCarTypeList";
return request(data, RequestMethods.POST, [], { url: scrmCarlifeRopUrl() });
}
// 数据看板指标统计 // 数据看板指标统计
export function getdataBoard(data) { export function getdataBoard(data) {
return gscPost("/dataBoard/index", data); return gscPost("/dataBoard/index", data);
...@@ -232,6 +286,21 @@ export function verifySmsCode(data = {}) { ...@@ -232,6 +286,21 @@ export function verifySmsCode(data = {}) {
returnAll: true, returnAll: true,
}); });
} }
// 驻店人员下拉 dj.api.merchant.staff.list(mainMerchantId、sceneTypeEnum 等)
export function merchantStaffList(data = {}) {
data.method = "dj.api.merchant.staff.list";
return request(data, RequestMethods.POST);
}
/** 园区店在职员工下拉(merchantId 传 sellerMerchantId)— rop-dj-car-boutique */
export function getEmployeeOnTheJobByMerchantId(data = {}) {
data.method = "dj.api.smartcarlife.employee.onTheJob.getByMerchantId";
return request(data, RequestMethods.POST, [], {
url: baseConfig.axios8.baseURL,
});
}
/** /**
* 合同批量上传 * 合同批量上传
*/ */
...@@ -299,9 +368,13 @@ export function checkContract(data = {}) { ...@@ -299,9 +368,13 @@ export function checkContract(data = {}) {
* 合同压缩包下载 * 合同压缩包下载
*/ */
export function exportContractImageZipAsync(data = {}) { export function exportContractImageZipAsync(data = {}) {
return gscPost("/evalElectronicContract/exportContractImageZipAsync", data, { return gscPost(
"/evalElectronicContract/exportContractImageZipAsync",
data,
{
timeout: 30000, timeout: 30000,
}); }
);
} }
/** /**
* 更改开户行 * 更改开户行
...@@ -378,3 +451,155 @@ export function getcheckReportDetail(data = {}) { ...@@ -378,3 +451,155 @@ export function getcheckReportDetail(data = {}) {
timeout: 30000, timeout: 30000,
}); });
} }
/**
* 车况信息分页列表
*/
export function getVehicleConditionInfoPage(data = {}) {
return gscPost("/carCondition/page", data, {
timeout: 30000,
});
}
/**
* 车况模块 — 查询条件所属门店列表(分页)
*/
export function getCarConditionMerchantPageList(data = {}) {
return gscPost("/carCondition/merchantPageList", data, {
timeout: 30000,
});
}
/**
* 车况信息详情
*/
export function getCarConditionDetail(data = {}) {
return gscPost("/carCondition/detail", data, {
timeout: 30000,
});
}
/**
* 车况基础信息更新(车牌号、车架号、上牌时间、交强险/年审/商业险到期 yyyy-MM-dd、原车主电话 11 位)
*/
export function updateCarCondition(data = {}) {
return gscPost("/carCondition/update", data, {
timeout: 30000,
returnAll: true,
});
}
/**
* 车况一键生成评估单
*/
export function oneClickCreateEvalOrder(data = {}) {
return gscPost("/carCondition/oneClickCreateEvalOrder", data, {
timeout: 60000,
returnAll: true,
});
}
/**
* 车况生成 AI 收车报告
*/
export function generateCarConditionAiReport(data = {}) {
return gscPost("/carCondition/generateAiReport", data, {
timeout: 60000,
returnAll: true,
});
}
/**
* 第三方出险报告校验(勾选「融合高阶第三方出险报告」时调用,路径以后端为准)
*/
export function checkCarConditionThirdPartyReport(data = {}) {
return gscPost("/carCondition/checkThirdPartyReport", data, {
timeout: 30000,
returnAll: true,
});
}
/**
* 一客一码分页列表
*/
export function getLiveCodePage(data) {
return gscPost("/liveCode/page", data);
}
/**
* 一客一群 - 获取企微群列表
*/
export function getGroupChatList(data) {
return gscPost("/liveCode/group/list", data);
}
/**
* 一客一群 - 获取开通二手车场景的4S店列表
*/
export function getCarDealerList(data) {
return gscPost("/merchant/carDealer/list", data);
}
/**
* 一客一群 - 活码配置新增
*/
export function addLiveCode(data) {
return gscPost("/liveCode/add", data, {
returnAll: true,
});
}
/**
* 一客一群 - 活码配置编辑
*/
export function updateLiveCode(data) {
return gscPost("/liveCode/update", data, {
returnAll: true,
});
}
/**
* 一客一群 - 活码配置删除
*/
export function deleteLiveCode(data) {
return gscPost("/liveCode/delete", data, {
returnAll: true,
});
}
/**
* 一客一群 - 活码配置详情
*/
export function getLiveCodeDetail(data) {
return gscPost("/liveCode/details", data);
}
/**
* 4S店配置分页
*/
export function getStoreConfigPage(data) {
return gscPost("/storeConfig/page", data);
}
/**
* 一客一群 - 总部定价师列表
*/
export function getPricingStaffList(data) {
return gscPost("/staff/pricingStaff/list", data);
}
/**
* 一客一群 - 4S店配置新增
*/
export function addStoreConfig(data) {
return gscPost("/storeConfig/create", data, {
returnAll: true,
});
}
/**
* 一客一群 - 4S店配置编辑
*/
export function updateStoreConfig(data) {
return gscPost("/storeConfig/edit", data, {
returnAll: true,
});
}
/**
* 一客一群 - 4S店配置删除
*/
export function deleteStoreConfig(data) {
return gscPost("/storeConfig/delete", data, {
returnAll: true,
});
}
...@@ -25,6 +25,20 @@ export const config = { ...@@ -25,6 +25,20 @@ export const config = {
code_message_map: {} code_message_map: {}
} }
}, },
/** 园区店 ROP(与配置中心 axios8 对齐;仅 baseURL 被带 url 的 request options 使用) */
axios8: {
baseURL: "https://dj.glsx.com.cn/rop-dj-car-boutique/router",
appkey: "d7ffc3346fc9a45bccaaa35300d59022",
secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353",
timeout: 50000,
result: {
data_key: "data",
message_key: "message",
code_key: "code",
code_success_value: 0,
code_message_map: {}
}
},
axios2: { axios2: {
baseURL: "https://scrm.glsx.com.cn/rop-scrm-shopmall/router", baseURL: "https://scrm.glsx.com.cn/rop-scrm-shopmall/router",
appkey: "48e5e13229b82c1b4e6e8c96151f0637", appkey: "48e5e13229b82c1b4e6e8c96151f0637",
...@@ -38,6 +52,8 @@ export const config = { ...@@ -38,6 +52,8 @@ export const config = {
code_message_map: {} code_message_map: {}
} }
}, },
/** 与 axios2 相同鉴权参数,网关为 rop-scrm-carlife(request 仍走 scrm→axios2 签名,仅 url 覆盖) */
axios2CarlifeRouter: "https://scrm.glsx.com.cn/rop-scrm-carlife/router",
common: { common: {
baseURL: baseURL:
"http://didicb.glsx.com.cn/router?method=glsx.accounts.biz.common.pictureUpload", "http://didicb.glsx.com.cn/router?method=glsx.accounts.biz.common.pictureUpload",
......
...@@ -16,7 +16,6 @@ export const BaseData = { ...@@ -16,7 +16,6 @@ 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-张 */
export const priceUnitTypeList = [ export const priceUnitTypeList = [
{ value: 1, label: "把" }, { value: 1, label: "把" },
...@@ -522,10 +521,10 @@ export const warrantyProList = [1, 4, 6, 12, 14]; ...@@ -522,10 +521,10 @@ export const warrantyProList = [1, 4, 6, 12, 14];
// 所属场景 // 所属场景
export const sceneCodeList = [ export const sceneCodeList = [
{ confId: 0, confValue: "会员权益/升级" },
{ confId: 1, confValue: "精品升级" }, { confId: 1, confValue: "精品升级" },
{ confId: 2, confValue: "次新车转化" }, { confId: 2, confValue: "次新车转化" },
{ confId: 3, confValue: "售后众筹" }, { confId: 3, confValue: "售后众筹" },
{ confId: 0, confValue: "会员权益/升级" },
{ confId: 4, confValue: "积分商城" }, { confId: 4, confValue: "积分商城" },
]; ];
export const otherSceneList = [{ confId: 7, confValue: "二手车" }]; export const otherSceneList = [{ confId: 7, confValue: "二手车" }];
...@@ -936,7 +935,7 @@ export const downloadReportManage_reportType = [ ...@@ -936,7 +935,7 @@ export const downloadReportManage_reportType = [
{ {
confId: "BIAnalysisReport", confId: "BIAnalysisReport",
confValue: "BI数据分析表", confValue: "BI数据分析表",
} },
]; ];
// 下载报表 业务类型 // 下载报表 业务类型
...@@ -1655,6 +1654,7 @@ export const evaluationSourceOpt = [ ...@@ -1655,6 +1654,7 @@ export const evaluationSourceOpt = [
{ confId: 1, confValue: "app" }, { confId: 1, confValue: "app" },
{ confId: 2, confValue: "小程序" }, { confId: 2, confValue: "小程序" },
{ confId: 3, confValue: "人工导入" }, { confId: 3, confValue: "人工导入" },
{ confId: 4, confValue: "车况生成" },
]; ];
export const evaluationStatusOptMap = { export const evaluationStatusOptMap = {
"10": "#FDB757", "10": "#FDB757",
...@@ -2026,3 +2026,23 @@ export const reviewCaseStatusOptMap = { ...@@ -2026,3 +2026,23 @@ export const reviewCaseStatusOptMap = {
1: "#2CCA74", 1: "#2CCA74",
2: "#EB4E4E", 2: "#EB4E4E",
}; };
export const connectionFlagOpt = [
{
confId: 1,
confValue: "已关联",
},
{
confId: 0,
confValue: "未关联",
},
];
export const connectionFlagOptMap = {
true: "#2CCA74",
false: "#EB4E4E",
};
export const changeTypeOpt = [
{ confId: 1, confValue: "区域运营" },
{ confId: 2, confValue: "技师督导" },
{ confId: 3, confValue: "招聘负责人" },
{ confId: 4, confValue: "创建人" },
];
<template>
<el-select ref="selectRef"
:key="forceKey"
v-select-load-more="loadMore"
:value="value"
v-bind="selectProps"
v-on="selectEvent"
@visible-change="handleVisibleChange"
@change="handleSelectChange">
<el-option v-for="subItem in localOptions"
:key="subItem[fieldName.value]"
v-bind="{
value: $attrs['value-key'] ? subItem : subItem[fieldName.value],
label: subItem[fieldName.label],
...isFunction(optionProps) ? optionProps(subItem) : optionProps,
}">
<slot name="options" :row="subItem"></slot>
</el-option>
<template #empty>
<div class="temp-wrapper empty-wrapper" style="text-align: center;cursor: not-allowed;padding:4px 0;">
<div v-if="loading">
<span class="el-icon-loading" />
</div>
<div v-else title="请键入其他关键字">
没有找到相关数据
</div>
</div>
</template>
<div class="temp-wrapper page-tips" title="不要点我">
<div v-if="(pageQuery.currentPage <= pageQuery.pages) && loading">
<span>
下一页加载中
</span>
<span class="el-icon-loading" />
</div>
<div v-else>
到底没有更多了
</div>
</div>
</el-select>
</template>
<script>
import { isFunction, omit } from "lodash-es";
import { nanoid } from "nanoid";
export default {
name: "",
directives: {
"select-load-more": {
bind(el, binding, vnode) {
const getWrapDom = () => vnode.componentInstance?.$refs?.popper?.$el?.querySelector(".el-select-dropdown__wrap");
const onScroll = function () {
// 容差 2px,避免小数滚动高度导致触底判断抖动
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight + 2;
if (condition) {
binding.value();
}
};
const bindScroll = () => {
const wrapDom = getWrapDom();
if (!wrapDom || el.__selectLoadMoreWrap === wrapDom) {
return;
}
if (el.__selectLoadMoreWrap && el.__selectLoadMoreOnScroll) {
el.__selectLoadMoreWrap.removeEventListener("scroll", el.__selectLoadMoreOnScroll);
}
wrapDom.addEventListener("scroll", onScroll);
el.__selectLoadMoreWrap = wrapDom;
};
el.__selectLoadMoreOnScroll = onScroll;
el.__selectLoadMoreBindScroll = bindScroll;
setTimeout(bindScroll, 0);
setTimeout(bindScroll, 100);
},
componentUpdated(el) {
el.__selectLoadMoreBindScroll?.();
},
unbind(el) {
if (el.__selectLoadMoreWrap && el.__selectLoadMoreOnScroll) {
el.__selectLoadMoreWrap.removeEventListener("scroll", el.__selectLoadMoreOnScroll);
}
delete el.__selectLoadMoreWrap;
delete el.__selectLoadMoreOnScroll;
delete el.__selectLoadMoreBindScroll;
},
},
},
props: {
fetchApi: {
required: true,
type: Function,
},
immediate: {
default: false,
type: Boolean,
},
optionProps: {
default: () => ({}),
type: [Object, Function],
},
options: {
default: () => ([]),
type: Array,
},
value: {
required: true,
type: [Array, String, Number],
},
fieldName: {
type: Object,
default: () => ({
label: "label",
value: "value",
}),
},
},
data() {
return {
localOptions: [],
pageQuery: {
searchValue: "",
currentPage: 1,
pageSize: 10,
pages: 0,
},
// 初始时候为false的话. 输入文字的一瞬间会显示为空
loading: true,
forceKey: nanoid(),
};
},
computed: {
selectProps() {
return {
"collapse-tags": true,
"filterable": true,
"multiple": true,
"remote": true,
"reserve-keyword": true,
"placeholder": "请选择",
"remote-method": this.remoteOptions,
...this.$attrs,
};
},
selectEvent() {
return {
"visible-change": this.visibleChange,
...omit(this.$listeners, ["change", "blur"]),
};
},
},
watch: {
options: {
handler(val) {
this.localOptions = [...this.options];
},
immediate: true,
},
},
async mounted() {
console.log("初始化?");
if (this.immediate) {
await this.getApi(false, true);
}
},
methods: {
blur() {
if (this.$refs.selectRef) {
console.log("使失焦?");
this.$refs.selectRef.blur();
}
},
async getApi(loadMore = false, isImmediate = false) {
this.loading = true;
try {
const { list, query } = await this.fetchApi({
// 组件内部的 查询
pageQuery: this.pageQuery,
// 组件内部维护的options列表
localOptions: this.localOptions,
// 是否加载更多触发的
loadMore,
// 是否第一次触发
isImmediate,
});
if (loadMore) {
this.localOptions = this.localOptions.concat(list);
} else {
this.localOptions = list;
}
this.$emit("update:options", this.localOptions);
Object.assign(this.pageQuery, query);
} finally {
this.$nextTick(() => {
this.loading = false;
});
}
},
handleSelectChange(e) {
this.$emit("input", e);
if (isFunction(this.$listeners?.change)) {
this.$listeners.change(e);
}
},
async handleVisibleChange(e) {
// 在多选的情况下 @blur响应不了 用这个替代
if (!e) {
// 失焦时, 检查 query.searchValue的内容. 如果有值
// 需要去掉searchValue 重新获取默认的options
console.log("失焦?", this.pageQuery.searchValue);
if (this.pageQuery.searchValue) {
console.log("重新获取默认的options");
this.pageQuery.searchValue = "";
// 重置页数
this.resetPageQuery();
await this.getApi();
}
if (isFunction(this.$listeners?.blur)) {
this.$listeners.blur();
}
}
},
isFunction,
async loadMore() {
if (this.loading) {
return;
}
const query = this.pageQuery;
if (query.pages > 0 && query.currentPage >= query.pages) {
return;
}
query.currentPage += 1;
await this.getApi(true);
},
async remoteOptions(query) {
this.loading = true;
// 还原滚动条位置
const wrap = this.$refs.selectRef.$refs.popper.$el.querySelector(".el-select-dropdown__wrap");
if (wrap) {
this.$refs.selectRef.$refs.scrollbar.moveY = 0;
wrap.scrollTop = 0;
}
// this.$refs.selectRef.$refs.scrollbar.scrollTop = 0;
// 清空选项
this.localOptions = [];
this.$emit("update:options", this.localOptions);
// 重置query
this.resetPageQuery();
this.pageQuery.searchValue = query;
await this.getApi();
},
// 重置页数.做成函数可以给父组件调用
resetPageQuery() {
this.pageQuery.currentPage = 1;
},
forceUpdate() {
this.forceKey = nanoid();
},
visibleChange(show) {
// if (!show) {
// this.options = [];
// this.loading = true;
// }
},
},
};
</script>
<style scoped lang="scss">
.temp-wrapper {
font-size: 14px;
color: #606266;
line-height: 34px;
&.page-tips {
cursor: not-allowed;
padding: 0 20px;
color: #ccc;
}
}
</style>
<script>
export default {
functional: true,
props: {
render: Function,
row: Object,
},
render(h, ctx) {
return ctx.props.render(h, ctx.props.row);
},
};
</script>
...@@ -42,7 +42,7 @@ function errorLog(error) { ...@@ -42,7 +42,7 @@ function errorLog(error) {
// 创建一个 axios 实例 // 创建一个 axios 实例
const service = axios.create({ const service = axios.create({
// baseURL: baseURL, // baseURL: baseURL,
timeout: 300000, // 请求超时时间 timeout: 1000 * 30 * 5, // 请求超时时间
transformRequest: [ transformRequest: [
function (data) { function (data) {
return Qs.stringify(data); return Qs.stringify(data);
......
...@@ -411,6 +411,14 @@ export const routerName = { ...@@ -411,6 +411,14 @@ export const routerName = {
category: "Button", category: "Button",
handle: "handleExport", handle: "handleExport",
}, },
{
authId: "9031211",
parentId: "90312",
label: "批量修改库存模式",
category: "Button",
type: "primary",
handle: "handleBatchModifyInventory",
},
], ],
component: _import("goods/packageManage/index"), component: _import("goods/packageManage/index"),
}, },
...@@ -462,7 +470,7 @@ export const routerName = { ...@@ -462,7 +470,7 @@ export const routerName = {
label: "嘀加上架与销售合同", label: "嘀加上架与销售合同",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleAdd", handle: "handleEdit",
addRoutePath: [ addRoutePath: [
{ {
authId: "9031302", authId: "9031302",
...@@ -527,7 +535,7 @@ export const routerName = { ...@@ -527,7 +535,7 @@ export const routerName = {
authId: "9031309", authId: "9031309",
parentId: "90313", parentId: "90313",
label: "重新发起", label: "重新发起",
handle: "handleAgain", handle: "handleEdit",
addRoutePath: [ addRoutePath: [
{ {
authId: "9031302", authId: "9031302",
...@@ -549,7 +557,7 @@ export const routerName = { ...@@ -549,7 +557,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/shelfManage", activePath: "/shelfManage",
}, },
component: _import("goods/shelfManage/editShelf"), component: _import("goods/shelfManage/view/modifyTable"),
}, },
9031305: { 9031305: {
path: "/contractDetail", path: "/contractDetail",
...@@ -561,7 +569,7 @@ export const routerName = { ...@@ -561,7 +569,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/shelfManage", activePath: "/shelfManage",
}, },
component: _import("goods/shelfManage/contractDetail"), component: _import("goods/shelfManage/view/contractDetail"),
}, },
9031307: { 9031307: {
path: "/editContract", path: "/editContract",
...@@ -573,7 +581,7 @@ export const routerName = { ...@@ -573,7 +581,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/shelfManage", activePath: "/shelfManage",
}, },
component: _import("goods/shelfManage/editContract"), component: _import("goods/shelfManage/view/editMultilateralContract"),
}, },
9031310: { 9031310: {
path: "/editMultilateralContract", path: "/editMultilateralContract",
...@@ -585,7 +593,7 @@ export const routerName = { ...@@ -585,7 +593,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/shelfManage", activePath: "/shelfManage",
}, },
component: _import("goods/shelfManage/editMultilateralContract"), component: _import("goods/shelfManage/view/editMultilateralContract"),
}, },
90314: { 90314: {
path: "/purchaseOnShelves", path: "/purchaseOnShelves",
......
...@@ -1218,6 +1218,14 @@ export const routerName = { ...@@ -1218,6 +1218,14 @@ export const routerName = {
handle: "handleExport", handle: "handleExport",
}, },
{ {
authId: "9122308",
parentId: "91223",
label: "批量变更",
category: "Button",
type: "primary",
handle: "handleBatchChange",
},
{
authId: "9122303", authId: "9122303",
parentId: "91223", parentId: "91223",
label: "查看", label: "查看",
...@@ -1249,6 +1257,12 @@ export const routerName = { ...@@ -1249,6 +1257,12 @@ export const routerName = {
handle: "handleComplete", handle: "handleComplete",
}, },
{ {
authId: "9122309",
parentId: "91223",
label: "关联",
handle: "handleRelate",
},
{
authId: "9122306", authId: "9122306",
parentId: "91223", parentId: "91223",
label: "处理", label: "处理",
......
...@@ -433,4 +433,131 @@ export const routerName = { ...@@ -433,4 +433,131 @@ export const routerName = {
], ],
component: _import("usedCarManagement/reportManagement/index"), component: _import("usedCarManagement/reportManagement/index"),
}, },
92009: {
path: "/vehicleConditionInfo",
name: "vehicleConditionInfo",
meta: {
title: "车况信息",
authId: "92009",
parentId: "920",
cache: false,
},
auth: [
{
authId: "9200901",
parentId: "92009",
label: "详情",
handle: "handleDetail",
addRoutePath: [
{
authId: "9200903",
name: "车况信息详情",
parentId: "92009",
},
],
},
{
authId: "9200902",
parentId: "92009",
label: "AI收车报告",
handle: "handleAiReport",
},
],
component: _import("usedCarManagement/vehicleConditionInfo/index"),
},
9200903: {
path: "/vehicleConditionDetail",
name: "vehicleConditionDetail",
meta: {
title: "车况信息详情",
authId: "9200903",
parentId: "92009",
cache: false,
sideHidden: false,
activePath: "/vehicleConditionInfo",
},
auth: [],
component: _import("usedCarManagement/vehicleConditionInfo/vehicleConditionDetail"),
},
92010: {
path: "/oneCustomerOneGroup",
name: "oneCustomerOneGroup",
meta: {
title: "一客一群(预生成)",
authId: "92010",
parentId: "920",
cache: false,
},
auth: [
{
authId: "9201001",
parentId: "92010",
label: "创建群活码",
category: "Button",
type: "primary",
handle: "handleEditGroupCode",
addRoutePath: [
{
authId: "9201006",
name: "创建群活码",
parentId: "92010",
},
],
},
{
authId: "9201002",
parentId: "92010",
label: "批量删除",
category: "Button",
type: "primary",
handle: "handleBatchDelete",
},
{
authId: "9201003",
parentId: "92010",
label: "下载",
handle: "handleDownload",
},
{
authId: "9201004",
parentId: "92010",
label: "修改",
handle: "handleEditGroupCode",
},
{
authId: "9201005",
parentId: "92010",
label: "删除",
handle: "handleDelete",
},
{
authId: "9201007",
parentId: "92010",
label: "新增配置",
category: "Button",
type: "primary",
handle: "handleEditConfig",
},
{
authId: "9201008",
parentId: "92010",
label: "修改配置",
handle: "handleEditConfig",
}
],
component: _import("usedCarManagement/oneCustomerOneGroup/index"),
},
9201006: {
path: "/createGroupCode",
name: "createGroupCode",
meta: {
title: "创建群活码",
authId: "9201006",
parentId: "92010",
activePath: "/oneCustomerOneGroup",
cache: false,
},
auth: [],
component: _import("usedCarManagement/oneCustomerOneGroup/createGroupCode"),
},
}; };
import Vue from "vue"; import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import ShelfManage from "@/views/goods/shelfManage/store/index.js";
import performanceFormStore from "@/views/residentManage/salaryPerformance/performanceScheme/store/performanceFormStore.js"; import performanceFormStore from "@/views/residentManage/salaryPerformance/performanceScheme/store/performanceFormStore.js";
import cacheStore from "./modules/cacheStore";
import d2admin, { storeResets } from "./modules/d2admin"; import d2admin, { storeResets } from "./modules/d2admin";
import FinancialRules from "./modules/FinancialRules"; import FinancialRules from "./modules/FinancialRules";
import goodsInfoData from "./modules/goodsInfoData"; import goodsInfoData from "./modules/goodsInfoData";
...@@ -23,8 +26,10 @@ if (!isProd) { ...@@ -23,8 +26,10 @@ if (!isProd) {
export default new Vuex.Store({ export default new Vuex.Store({
modules: { modules: {
d2admin, d2admin,
cacheStore,
goodsInfoData, goodsInfoData,
FinancialRules, FinancialRules,
PerformanceFormStore: performanceFormStore, PerformanceFormStore: performanceFormStore,
ShelfManage,
}, },
}); });
# Vuex 缓存模块使用指南
## 1. 模块注册
### 在 `src/store/index.js` 中注册模块
```javascript
import cacheStore from "./modules/cacheStore";
export default new Vuex.Store({
modules: {
cacheStore // 使用命名空间 'cacheStore'
}
});
```
## 2. 组件调用示例
### 基础用法:缓存优先策略
```vue
<template>
<div class="example-container">
<!-- 加载状态 -->
<div v-if="isLoading" class="loading">
数据加载中...
</div>
<!-- 错误显示 -->
<div v-else-if="error" class="error">
{{ error }}
</div>
<!-- 数据显示 -->
<div v-else-if="userData" class="data">
<h3>用户信息</h3>
<p>姓名: {{ userData.name }}</p>
<p>邮箱: {{ userData.email }}</p>
</div>
<!-- 操作按钮 -->
<div class="actions">
<button @click="fetchUserData">
获取用户数据(缓存优先)
</button>
<button @click="refreshUserData">
刷新数据(强制更新)
</button>
<button @click="clearData">
清除缓存
</button>
</div>
</div>
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import * as userApi from "@/api/user"; // 导入 API 模块
export default {
name: "UserExample",
data() {
return {
userId: 123 // 示例用户 ID
};
},
computed: {
// 使用 getter 获取缓存数据、加载状态、错误信息
...mapGetters("cacheStore", {
userData: state => state.getCacheData("user_123"),
isLoading: state => state.isLoading("user_123"),
error: state => state.getError("user_123")
})
},
methods: {
...mapActions("cacheStore", ["fetchData", "clearCache"]),
// 缓存优先:第一次调用会从接口获取,第二次调用直接返回缓存
async fetchUserData() {
try {
const data = await this.fetchData({
key: "user_123",
apiFn: userApi.getUserDetailApi,
params: { userId: this.userId }
});
console.log("用户数据:", data);
} catch (error) {
console.error("获取数据失败:", error);
}
},
// 强制刷新:忽略缓存,重新从接口获取
async refreshUserData() {
try {
const data = await this.fetchData({
key: "user_123",
apiFn: userApi.getUserDetailApi,
params: { userId: this.userId },
forceRefresh: true // 强制刷新
});
console.log("最新用户数据:", data);
} catch (error) {
console.error("刷新失败:", error);
}
},
// 清除缓存
clearData() {
this.clearCache("user_123");
}
},
mounted() {
// 组件挂载时自动获取数据
this.fetchUserData();
}
};
</script>
<style scoped>
.loading,
.error,
.data {
padding: 20px;
margin-bottom: 20px;
border-radius: 4px;
}
.loading {
background-color: #e3f2fd;
color: #1976d2;
}
.error {
background-color: #ffebee;
color: #c62828;
}
.data {
background-color: #f3e5f5;
color: #6a1b9a;
}
.actions {
margin-top: 20px;
}
button {
margin-right: 10px;
padding: 8px 16px;
border: 1px solid #ccc;
border-radius: 4px;
cursor: pointer;
}
</style>
```
## 3. 高级用法:带缓存时间限制
```vue
<script>
export default {
methods: {
// 数据缓存 5 分钟(300000 毫秒)后过期
async fetchProductList() {
await this.fetchData({
key: "product_list",
apiFn: productApi.getProductListApi,
params: { category: "electronics" },
cacheTime: 300000 // 5 分钟有效期
});
}
}
};
</script>
```
## 4. API 模块示例
在 `src/api/user.js` 中:
```javascript
import request from "./request";
const path = "dj.api.smartcarlife.";
/**
* 获取用户详情
* @param {object} data - 请求数据
* @param {number} data.userId - 用户 ID
*/
export function getUserDetailApi(data) {
data.method = `${path}user.detail`;
return request(data, "post");
}
/**
* 更新用户信息
*/
export function updateUserApi(data) {
data.method = `${path}user.update`;
return request(data, "post");
}
```
## 5. Vuex 模块核心特性
### ✅ 缓存优先策略
```javascript
// 第一次调用:从接口获取数据并缓存
await this.fetchData({
key: "user_123",
apiFn: userApi.getUserDetailApi,
params: { userId: 123 }
});
// 第二次调用:直接返回缓存数据,不调用接口
await this.fetchData({
key: "user_123",
apiFn: userApi.getUserDetailApi,
params: { userId: 123 }
});
```
### ✅ 避免重复请求
如果在第一个请求还未完成时,又发起了相同的请求,模块会复用之前的 Promise:
```javascript
// 同时发起三个相同的请求
Promise.all([
this.fetchData({ key: "data", apiFn: api1 }),
this.fetchData({ key: "data", apiFn: api1 }),
this.fetchData({ key: "data", apiFn: api1 })
]);
// 只会触发一次接口调用,其他请求复用 Promise
```
### ✅ 完整的状态管理
```javascript
computed: {
...mapGetters('cacheStore', {
data: state => state.getCacheData('key'),
isLoading: state => state.isLoading('key'),
error: state => state.getError('key'),
hasCache: state => state.hasCacheData('key')
})
}
```
### ✅ 灵活的缓存控制
```javascript
// 清除指定缓存
this.$store.dispatch("cacheStore/clearCache", "user_123");
// 清除所有缓存
this.$store.dispatch("cacheStore/clearAllCache");
// 手动更新缓存
this.$store.dispatch("cacheStore/updateCache", {
key: "user_123",
value: newData
});
```
## 6. 在路由守卫中预加载数据
```javascript
// src/router/index.js
router.beforeEach((to, from, next) => {
if (to.meta.requiresData) {
store.dispatch('cacheStore/fetchData', {
key: to.meta.dataKey,
apiFn: to.meta.dataApi,
params: to.params
}).then(() => {
next()
}).catch(() => {
next(false)
})
} else {
next()
}
})
// 路由定义
{
path: '/user/:id',
component: UserDetail,
meta: {
requiresData: true,
dataKey: 'user_detail',
dataApi: userApi.getUserDetailApi
}
}
```
## 7. TypeScript 支持(可选)
如果项目使用 TypeScript,可以定义接口:
```typescript
interface FetchDataOptions {
key: string
apiFn: (params: any) => Promise<any>
params?: Record<string, any>
forceRefresh?: boolean
cacheTime?: number
}
interface CacheState {
cache: Record<string, any>
loading: Record<string, boolean>
errors: Record<string, string | null>
requestMap: Record<string, Promise<any>>
}
```
## 总结
| 功能 | 说明 |
|------|------|
| 缓存优先 | 优先检查 state 中的缓存,无缓存则调用接口 |
| 接口兜底 | 缓存无效时自动调用接口获取最新数据 |
| 避免重复 | 相同请求进行中时复用 Promise,避免重复调用 |
| 时间限制 | 支持设置缓存有效期,过期自动更新 |
| 完整状态 | 加载状态、错误信息、缓存数据全方位管理 |
| 命名空间 | 开启 namespaced,防止状态冲突 |
| 响应式 | 通过 mutation 更新,保证视图同步更新 |
/**
* Vuex 缓存模块 - 支持缓存优先、接口兜底
* 特性:
* 1. 缓存优先策略:state中有有效值则直接返回,无则调用接口
* 2. 支持自定义参数:接口函数可接收 params 参数
* 3. 避免重复请求:使用 requestMap 跟踪请求中的 Promise
* 4. 完整的加载/错误状态管理
* 5. 开启命名空间防止状态冲突
*/
export default {
namespaced: true,
state: {
// 缓存数据存储对象,key为缓存键名,value为缓存数据
cache: {},
// 加载状态映射,key为缓存键名,value为 boolean
loading: {},
// 错误信息映射,key为缓存键名,value为错误信息字符串
errors: {},
// 正在进行的请求 Promise 映射,用于避免重复请求
// key为缓存键名,value为 Promise 对象
requestMap: {},
},
mutations: {
/**
* 设置缓存数据
* @param {string} key - 缓存键名
* @param {*} value - 缓存数据值
*/
SET_CACHE(state, { key, value }) {
state.cache[key] = value;
},
/**
* 设置加载状态
* @param {string} key - 缓存键名
* @param {boolean} loading - 加载状态
*/
SET_LOADING(state, { key, loading }) {
state.loading[key] = loading;
},
/**
* 设置错误信息
* @param {string} key - 缓存键名
* @param {string} error - 错误信息,null 表示清除错误
*/
SET_ERROR(state, { key, error }) {
state.errors[key] = error;
},
/**
* 设置请求 Promise(用于防止重复请求)
* @param {string} key - 缓存键名
* @param {Promise} promise - Promise 对象或 null
*/
SET_REQUEST(state, { key, promise }) {
if (promise) {
state.requestMap[key] = promise;
} else {
delete state.requestMap[key];
}
},
/**
* 清除指定键的所有数据
* @param {string} key - 缓存键名
*/
CLEAR_CACHE(state, key) {
delete state.cache[key];
delete state.loading[key];
delete state.errors[key];
delete state.requestMap[key];
},
/**
* 清空所有缓存数据
*/
CLEAR_ALL_CACHE(state) {
state.cache = {};
state.loading = {};
state.errors = {};
state.requestMap = {};
},
},
actions: {
/**
* 获取缓存数据或调用接口获取
* 核心方法:实现缓存优先、接口兜底的逻辑
*
* @param {object} context - Vuex action context
* @param {object} options - 配置选项
* @param {string} options.key - 缓存键名(必填)
* @param {Function} options.apiFn - 接口函数(必填),返回 Promise
* @param {object} options.params - 接口参数(可选)
* @param {boolean} options.forceRefresh - 是否强制刷新,忽略缓存(可选,默认 false)
* @param {number} options.cacheTime - 缓存有效期(毫秒),0 表示永久有效(可选,默认 0)
* @returns {Promise} 返回缓存数据或接口响应数据
*/
async fetchData({ state, commit }, options) {
const { key, apiFn, params = {}, forceRefresh = false, cacheTime = 0 } = options;
if (!key || !apiFn) {
throw new Error("fetchData 方法必须提供 key 和 apiFn 参数");
}
// 1. 检查是否有正在进行的请求,有则直接返回 Promise (避免重复请求)
if (state.requestMap[key]) {
return state.requestMap[key];
}
// 2. 缓存优先策略:检查是否有有效缓存(非强制刷新)
if (!forceRefresh && state.cache[key] !== undefined) {
// 如果设置了缓存时间限制,需要检查缓存是否过期
if (cacheTime === 0 || (state.cache[key]._timestamp && Date.now() - state.cache[key]._timestamp < cacheTime)) {
return state.cache[key];
}
}
// 3. 无有效缓存,调用接口获取数据
commit("SET_LOADING", { key, loading: true });
commit("SET_ERROR", { key, error: null });
const promise = apiFn(params).then((response) => {
// 接口成功响应
const data = response.data || response;
// 如果设置了缓存时间,记录时间戳
const cacheData = cacheTime > 0
? Object.assign({}, data, { _timestamp: Date.now() })
: data;
// 存储到 state,保证响应式
commit("SET_CACHE", { key, value: cacheData });
commit("SET_ERROR", { key, error: null });
commit("SET_LOADING", { key, loading: false });
commit("SET_REQUEST", { key, promise: null });
return cacheData;
}).catch((error) => {
// 接口调用失败
const errorMsg = error.message || "数据获取失败";
commit("SET_ERROR", { key, error: errorMsg });
commit("SET_LOADING", { key, loading: false });
commit("SET_REQUEST", { key, promise: null });
console.error(`[cacheStore] 接口请求失败 [${key}]:`, error);
throw error;
});
// 保存正在进行的请求
commit("SET_REQUEST", { key, promise });
return promise;
},
/**
* 手动更新缓存数据
* @param {object} context - Vuex action context
* @param {object} options - 配置选项
* @param {string} options.key - 缓存键名
* @param {*} options.value - 新的缓存值
*/
updateCache({ commit }, { key, value }) {
commit("SET_CACHE", { key, value });
},
/**
* 清除指定缓存
* @param {object} context - Vuex action context
* @param {string} key - 缓存键名
*/
clearCache({ commit }, key) {
commit("CLEAR_CACHE", key);
},
/**
* 清空所有缓存
* @param {object} context - Vuex action context
*/
clearAllCache({ commit }) {
commit("CLEAR_ALL_CACHE");
},
},
getters: {
/**
* 获取指定键的缓存数据
*/
getCacheData: state => (key) => {
return state.cache[key];
},
/**
* 获取指定键的加载状态
*/
isLoading: state => (key) => {
return state.loading[key] || false;
},
/**
* 获取指定键的错误信息
*/
getError: state => (key) => {
return state.errors[key] || null;
},
/**
* 检查指定键是否有有效缓存
*/
hasCacheData: state => (key) => {
return state.cache[key] !== undefined;
},
},
};
<!-- 标签课程 --> <!-- 标签课程 -->
<template> <template>
<d2-container class="customer-tags"> <d2-container class="customer-tags">
<div class="header" slot="header"> <template #header>
<d2-search ref="showSearch" class="show-search" :search-form="searchForm" :label-width="'100px'" <div class="header">
:form-data="showFormData"> <d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
label-width="100px"
:search-form="searchForm">
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button size="small" type="primary" @click="handleSearch"> <el-button size="small"
type="primary"
@click="handleSearch">
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button> <el-button size="small" @click="handleReset">
重置
</el-button>
</div> </div>
</div> </div>
</template>
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<el-button size="small" type="primary" @click="addLabelCourse"> <el-button size="small"
type="primary"
@click="addLabelCourse">
新增课程标签 新增课程标签
</el-button> </el-button>
</d2-table-header> </d2-table-header>
<d2-table ref="table" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams" <d2-table ref="table"
:before-search-fn="beforeSearchFn"> :before-search-fn="beforeSearchFn"
<template slot="tagName" scope="scope"> :get-list-api="getListApi"
:search-form="searchFormSearch"
:table-params="tableParams">
<template #tagName="scope">
<!-- <div v-for="(item, index) in scope.scope.tagList.split(',')" :key="index"> <!-- <div v-for="(item, index) in scope.scope.tagList.split(',')" :key="index">
{{ item }} {{ item }}
</div> --> </div> -->
<el-tooltip class="item" effect="dark" placement="top"> <el-tooltip class="item"
<div slot="content" class="tag-name"> effect="dark"
<div v-for="(item, index) in scope.scope.tagList.split(',')" :key="index">{{ item }}</div> placement="top">
<template #content>
<div class="tag-name">
<div v-for="(item, index) in scope.scope.tagList.split(',')" :key="index">
{{ item }}
</div> </div>
</div>
</template>
<div> <div>
{{ scope.scope.tagList.split(',')[0] + (scope.scope.tagList.split(',').length == 1 ? '' : '...') + ' ' + {{ `${scope.scope.tagList.split(',')[0] + (scope.scope.tagList.split(',').length == 1 ? '' : '...')} `
`(${scope.scope.tagList.split(',').length}条)` }} + `(${scope.scope.tagList.split(',').length}条)` }}
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
<template slot="courseList" scope="scope"> <template #courseList="scope">
<el-tooltip v-for="(item, index) in scope.scope.courseList.split(',')" :key="index" class="item" effect="dark" <el-tooltip v-for="(item, index) in scope.scope.courseList.split(',')"
:content="item" placement="top"> :key="index"
class="item"
:content="item"
effect="dark"
placement="top">
<div class="one-line-ellipsis"> <div class="one-line-ellipsis">
{{ item }} {{ item }}
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
<auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> <template #auth-button="scope">
<auth-button :data="scope.scope" />
</template>
</d2-table> </d2-table>
</div> </div>
<labelCourseDialog :recordInfo="recordInfo" v-if="dialogVisible" :dialogVisible.sync="dialogVisible" <LabelCourseDialog v-if="dialogVisible"
:dialogVisible.sync="dialogVisible"
:record-info="recordInfo"
@confirmDialogFn="confirmDialogFn"> @confirmDialogFn="confirmDialogFn">
</labelCourseDialog> </LabelCourseDialog>
</d2-container> </d2-container>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import labelCourseDialog from "./labelCourseDialog"
import { Util, deepClone } from "@/common/util"
import { import {
findStaffTagCourseRelationPage,
deletecourserelation, deletecourserelation,
updatecourserelation, findStaffTagCourseRelationPage,
savecourserelation } from "@api/contentManager";
} from "@api/contentManager" import noDataImg from "@/assets/empty.png";
import noDataImg from "@/assets/empty.png" import { deepClone, Util } from "@/common/util";
import dayjs from "dayjs" import labelCourseDialog from "./labelCourseDialog";
export default { export default {
name: "labelCourse", name: "LabelCourse",
components: { components: {
labelCourseDialog LabelCourseDialog: labelCourseDialog,
}, },
data() { data() {
return { return {
...@@ -76,7 +102,7 @@ export default { ...@@ -76,7 +102,7 @@ export default {
classifyVisible: false, classifyVisible: false,
searchForm: { searchForm: {
courseName: "", courseName: "",
tagName: "" tagName: "",
// bussinessScene: "", // bussinessScene: "",
// merchantId: "", // merchantId: "",
// scriptMatching: "", // scriptMatching: "",
...@@ -92,14 +118,14 @@ export default { ...@@ -92,14 +118,14 @@ export default {
name: "tagName", name: "tagName",
type: "input", type: "input",
isClear: true, isClear: true,
maxlength: 50 maxlength: 50,
}, },
{ {
label: "课程名称", label: "课程名称",
name: "courseName", name: "courseName",
type: "input", type: "input",
isClear: true, isClear: true,
maxlength: 50 maxlength: 50,
}, },
], ],
getListApi: findStaffTagCourseRelationPage, getListApi: findStaffTagCourseRelationPage,
...@@ -107,7 +133,7 @@ export default { ...@@ -107,7 +133,7 @@ export default {
tableParams: { tableParams: {
listName: "list", listName: "list",
tableOption: { tableOption: {
width: "100" width: "100",
}, },
tableColumns: [ tableColumns: [
{ {
...@@ -118,7 +144,7 @@ export default { ...@@ -118,7 +144,7 @@ export default {
{ {
label: "课程列表", label: "课程列表",
// minWidth: 144, // minWidth: 144,
addHtml: "courseList" addHtml: "courseList",
}, },
// { // {
// label: "销售姓名", // label: "销售姓名",
...@@ -160,22 +186,22 @@ export default { ...@@ -160,22 +186,22 @@ export default {
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.createdDate return cellValue.createdDate
? Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss") ? Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss")
: "-" : "-";
}, },
width: 140 width: 140,
}, },
{ {
label: "最后更新时间", label: "最后更新时间",
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue.updatedDate return cellValue.updatedDate
? Util.dateFormate(cellValue.updatedDate, "YYYY-MM-DD HH:mm:ss") ? Util.dateFormate(cellValue.updatedDate, "YYYY-MM-DD HH:mm:ss")
: "-" : "-";
}, },
width: 140 width: 140,
} },
] ],
} },
} };
}, },
created() { }, created() { },
mounted() { mounted() {
...@@ -184,52 +210,52 @@ export default { ...@@ -184,52 +210,52 @@ export default {
methods: { methods: {
beforeSearchFn(type = 1) { beforeSearchFn(type = 1) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.searchFormSearch = deepClone(this.searchForm) this.searchFormSearch = deepClone(this.searchForm);
resolve() resolve();
}) });
}, },
handleSearch() { handleSearch() {
this.page = this.$options.data.call(this).page this.page = this.$options.data.call(this).page;
this.$refs.table.refreshTable(true, true) this.$refs.table.refreshTable(true, true);
// this.getCustomerFileStatic() // this.getCustomerFileStatic()
}, },
handleReset() { handleReset() {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm;
this.handleSearch() this.handleSearch();
}, },
addLabelCourse() { addLabelCourse() {
this.recordInfo = null this.recordInfo = null;
this.dialogVisible = true this.dialogVisible = true;
}, },
customerTagName(list) { customerTagName(list) {
let tag = [] let tag = [];
list.map((e) => { list.map((e) => {
tag.push(e.labelName) tag.push(e.labelName);
}) });
return tag.join("|") return tag.join("|");
}, },
handleEdit(row) { handleEdit(row) {
console.log(row) console.log(row);
this.recordInfo = row this.recordInfo = row;
this.dialogVisible = true this.dialogVisible = true;
}, },
confirmDialogFn(e) { confirmDialogFn(e) {
this.handleSearch() this.handleSearch();
}, },
// 删除 // 删除
handleDelete(row) { handleDelete(row) {
this.$confirm('是否确认删除该课程?', '提示', { this.$confirm("是否确认删除该课程?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'error' type: "error",
}).then(() => { }).then(() => {
deletecourserelation({ id: row.id }).then(res => { deletecourserelation({ id: row.id }).then((res) => {
this.notice.okTips() this.notice.okTips();
this.$refs.table.refreshTable() this.$refs.table.refreshTable();
}) });
}).catch(err => { }).catch((err) => {
console.log(err) console.log(err);
}) });
}, },
// jumpDetail(row) { // jumpDetail(row) {
// this.$router.push({ // this.$router.push({
...@@ -242,8 +268,8 @@ export default { ...@@ -242,8 +268,8 @@ export default {
// } // }
// }) // })
// } // }
} },
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
> >
<el-radio <el-radio
v-for="item in baseData.followStatusOptions" v-for="item in baseData.followStatusOptions"
:key="item.confId"
:label="item.confId" :label="item.confId"
>{{ item.confValue }}</el-radio >{{ item.confValue }}</el-radio
> >
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
> >
<el-radio <el-radio
v-for="item in baseData.followStatusOptions" v-for="item in baseData.followStatusOptions"
:key="item.confId"
:label="item.confId" :label="item.confId"
>{{ item.confValue }}</el-radio> >{{ item.confValue }}</el-radio>
</el-radio-group> </el-radio-group>
......
<template>
<div class="recruitment">
<div class="recruitment-title">招聘概况</div>
<div class="recruitment-content">
<div class="recruitment-card" v-for="(item, index) in recruitmentOptions" :key="index">
<div class="card-label">{{ item.label }}</div>
<div class="card-value">
{{ recruitmentData[item.key] || 0 }}<span class="card-unit">人</span>
</div>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import data from '@/views/stockManage/returnManage/constant/data';
import {
getRecruitmentDemandOverview
} from '@/api/earlyWarningManager'
export default {
name: 'Recruitment',
inject: ['GET_PARAMS_INFO'],
data () {
return {
recruitmentData: {},
recruitmentOptions: [
{ label: '需求总数', key: 'allOfDemand' },
{ label: '在招数量', key: 'recruitingCount' },
{ label: '入职人数', key: 'allOfOnboarding' },
{ label: '离职人数', key: 'resignedCount' }
]
}
},
computed: {
paramsInfo () {
return this.GET_PARAMS_INFO()
},
},
mounted () {
},
methods: {
init () {
this.getRecruitmentData()
},
async getRecruitmentData () {
let { merchantIds, bizs } = this.paramsInfo
const data = await getRecruitmentDemandOverview({
biz: bizs,
merchantId: merchantIds[0]
})
console.log(data, 'Recruitment/index.vue(查询门店招聘数据)')
this.recruitmentData = data || {}
}
}
}
</script>
<style scoped lang='scss'>
.recruitment {
padding: 0 20px 20px;
border-top: 1px solid #e5e5e5;
&-title {
height: 50px;
color: #333333;
font-size: 16px;
font-weight: 500;
display: flex;
align-items: center;
}
&-content {
display: flex;
gap: 10px;
border-radius: 8px;
background: #f2f7ff;
padding: 10px;
}
&-card {
flex: 1;
border-radius: 8px;
background: #ffffffcc;
padding: 12px 20px;
min-width: 0;
.card-label {
margin-bottom: 8px;
color: #666666;
font-size: 14px;
font-weight: 500;
line-height: 20px;
}
.card-value {
color: #2A58AD;
font-size: 30px;
font-weight: 600;
text-align: center;
.card-unit {
font-size: 16px;
font-weight: 500;
margin-left: 4px;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -48,7 +48,7 @@ const STRATEGY_FORM_2456 = [ ...@@ -48,7 +48,7 @@ const STRATEGY_FORM_2456 = [
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 {
...@@ -83,7 +83,7 @@ const STRATEGY_FORM_7 = [ ...@@ -83,7 +83,7 @@ const STRATEGY_FORM_7 = [
let { let {
executePersons executePersons
} = val } = val
return executePersons.map(item => item.username).join('/') || '-' return executePersons?.map(item => item.username).join('/') || '-'
}, },
}, },
] ]
......
...@@ -3,47 +3,21 @@ ...@@ -3,47 +3,21 @@
<div class="strategy-title flex"> <div class="strategy-title flex">
策略中心 策略中心
<div class="add"> <div class="add">
<el-button <el-button type="text" @click="addStrategyVisible = true"> <i class="el-icon-plus"></i>添加策略</el-button>
type="text"
@click="addStrategyVisible = true"
> <i class="el-icon-plus"></i>添加策略</el-button>
</div> </div>
</div> </div>
<el-scrollbar <el-scrollbar class="strategy-list" :key="viewKey" v-loading="loading" ref="scrollbar">
class="strategy-list" <template v-for="(i, index) in list">
:key="viewKey" <strategy-item :key="index" :index="index" :item="i" :isLast="index == list.length - 1"
v-loading="loading" :class="[{ first: index == 0 }, { last: index == list.length - 1 }]" @toDetail="toDetail"
ref="scrollbar" @refresh="init"></strategy-item>
>
<template v-for="(i,index) in list">
<strategy-item
:key="index"
:index="index"
:item="i"
:isLast="index == list.length - 1"
:class="[{first:index == 0},{last:index == list.length - 1}]"
@toDetail="toDetail"
@refresh="init"
></strategy-item>
</template> </template>
<div <div v-if="loading && list.length > 0" class="loading-more">加载中...</div>
v-if="loading && list.length > 0" <div v-if="noMoreData && list.length > 0" class="no-more-data">没有更多了</div>
class="loading-more"
>加载中...</div>
<div
v-if="noMoreData && list.length > 0"
class="no-more-data"
>没有更多了</div>
</el-scrollbar> </el-scrollbar>
<add-strategy <add-strategy :dialogVisible.sync="addStrategyVisible" @refresh="init"></add-strategy>
:dialogVisible.sync="addStrategyVisible" <strategy-detail :dialogVisible.sync="strategyDetailVisible" :item="currentItem"
@refresh="init" @openReceptionDialog="$emit('openReceptionDialog', $event)"></strategy-detail>
></add-strategy>
<strategy-detail
:dialogVisible.sync="strategyDetailVisible"
:item="currentItem"
@openReceptionDialog="$emit('openReceptionDialog',$event)"
></strategy-detail>
</div> </div>
</template> </template>
...@@ -150,16 +124,11 @@ export default { ...@@ -150,16 +124,11 @@ export default {
}, },
handleScroll (event) { handleScroll (event) {
console.log('handleScroll 被触发了!', event)
const wrap = event.target const wrap = event.target
const scrollTop = wrap.scrollTop const scrollTop = wrap.scrollTop
const scrollHeight = wrap.scrollHeight const scrollHeight = wrap.scrollHeight
const clientHeight = wrap.clientHeight const clientHeight = wrap.clientHeight
console.log('滚动信息:', { scrollTop, scrollHeight, clientHeight })
if (scrollTop + clientHeight >= scrollHeight - 10 && !this.loading && !this.noMoreData) { if (scrollTop + clientHeight >= scrollHeight - 10 && !this.loading && !this.noMoreData) {
console.log('触发加载下一页,当前页码:', this.pageNum)
this.pageNum++ this.pageNum++
this.getStrategyList() this.getStrategyList()
} }
...@@ -173,12 +142,15 @@ export default { ...@@ -173,12 +142,15 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.strategy { .strategy {
width: 100%; width: 100%;
height: 100%; height: 100%;
::v-deep .el-scrollbar__wrap { ::v-deep .el-scrollbar__wrap {
overflow: auto !important; overflow: auto !important;
} }
&-title { &-title {
height: 50px; height: 50px;
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
...@@ -187,10 +159,12 @@ export default { ...@@ -187,10 +159,12 @@ export default {
color: #333333; color: #333333;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
.add { .add {
font-weight: 400; font-weight: 400;
color: #2a58ad; color: #2a58ad;
font-size: 14px; font-size: 14px;
.el-icon-plus { .el-icon-plus {
font-size: 12px; font-size: 12px;
font-weight: 700; font-weight: 700;
...@@ -198,18 +172,22 @@ export default { ...@@ -198,18 +172,22 @@ export default {
} }
} }
} }
&-list { &-list {
width: 100%; width: 100%;
height: calc(100% - 51px); height: calc(100% - 51px);
box-sizing: border-box; box-sizing: border-box;
.first { .first {
margin-top: 16px; margin-top: 16px;
} }
.last { .last {
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
} }
.loading-more, .loading-more,
.no-more-data { .no-more-data {
text-align: center; text-align: center;
...@@ -217,6 +195,7 @@ export default { ...@@ -217,6 +195,7 @@ export default {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
} }
.no-more-data { .no-more-data {
color: #ccc; color: #ccc;
} }
......
<template> <template>
<div class="layout"> <div class="layout">
<el-scrollbar class="left"> <el-scrollbar class="left">
<store-signboard-info <store-signboard-info @dateChange="dateChange" @changeMerchant="changeMerchant"
@dateChange="dateChange" ref="storeSignboardInfo"></store-signboard-info>
@changeMerchant="changeMerchant"
ref="storeSignboardInfo"
></store-signboard-info>
<business-overview ref="businessOverview"></business-overview> <business-overview ref="businessOverview"></business-overview>
<summary-overview ref="summaryOverview"></summary-overview> <summary-overview ref="summaryOverview"></summary-overview>
<staff-overview ref="staffOverview"></staff-overview> <staff-overview ref="staffOverview"></staff-overview>
<recruitment ref="recruitment"></recruitment>
</el-scrollbar> </el-scrollbar>
<div class="right"> <div class="right">
<strategy-list <strategy-list @openReceptionDialog="openReceptionDialog" ref="strategyList"></strategy-list>
@openReceptionDialog="openReceptionDialog"
ref="strategyList"
></strategy-list>
</div> </div>
<quality-detail <quality-detail :is-quality-visible="isQualityVisible" v-if="isQualityVisible" :currentNum="currentNum"
:is-quality-visible="isQualityVisible" :qualityDetailList="qualityDetailList" @closeDialog="closeReceptionDialog" ref="qualityDetail"></quality-detail>
v-if="isQualityVisible" <new-quality-detail :is-quality-visible="isNewQualityVisible" v-if="isNewQualityVisible" :currentNum="currentNum"
:currentNum="currentNum" :qualityDetailList="qualityDetailList" @closeDialog="closeReceptionDialog"
:qualityDetailList="qualityDetailList" ref="newQualityDetail"></new-quality-detail>
@closeDialog="closeReceptionDialog"
ref="qualityDetail"
></quality-detail>
<new-quality-detail
:is-quality-visible="isNewQualityVisible"
v-if="isNewQualityVisible"
:currentNum="currentNum"
:qualityDetailList="qualityDetailList"
@closeDialog="closeReceptionDialog"
ref="newQualityDetail"
></new-quality-detail>
</div> </div>
</template> </template>
...@@ -45,6 +29,7 @@ import StaffOverview from './components/StaffOverview/index.vue'; ...@@ -45,6 +29,7 @@ import StaffOverview from './components/StaffOverview/index.vue';
import { deepClone } from "@/common/util" import { deepClone } from "@/common/util"
import qualityDetail from '@/views/residentManage/components/qualityDetail' import qualityDetail from '@/views/residentManage/components/qualityDetail'
import newQualityDetail from '@/views/residentManage/components/newQualityDetail' import newQualityDetail from '@/views/residentManage/components/newQualityDetail'
import Recruitment from './components/Recruitment/index.vue'
const rise = require('@/assets/strategy/rise.png') const rise = require('@/assets/strategy/rise.png')
const just01 = require('@/assets/strategy/just01.png') const just01 = require('@/assets/strategy/just01.png')
const decline = require('@/assets/strategy/decline.png') const decline = require('@/assets/strategy/decline.png')
...@@ -56,7 +41,8 @@ export default { ...@@ -56,7 +41,8 @@ export default {
SummaryOverview, SummaryOverview,
StaffOverview, StaffOverview,
qualityDetail, qualityDetail,
newQualityDetail newQualityDetail,
Recruitment
}, },
name: 'storeSignboard', name: 'storeSignboard',
...@@ -103,7 +89,10 @@ export default { ...@@ -103,7 +89,10 @@ export default {
}, },
strategyListRef () { strategyListRef () {
return this.$refs.strategyList return this.$refs.strategyList
} },
recruitmentRef () {
return this.$refs.recruitment
},
}, },
// 在beforeDestroy钩子中移除事件监听 // 在beforeDestroy钩子中移除事件监听
beforeDestroy () { beforeDestroy () {
...@@ -150,7 +139,7 @@ export default { ...@@ -150,7 +139,7 @@ export default {
this.storeSignboardInfoRef.init() this.storeSignboardInfoRef.init()
this.businessOverviewRef.init() this.businessOverviewRef.init()
this.strategyListRef.init() this.strategyListRef.init()
this.recruitmentRef.init()
}, },
preventBack () { preventBack () {
if (this.isQualityVisible || this.isNewQualityVisible) { if (this.isQualityVisible || this.isNewQualityVisible) {
...@@ -252,12 +241,14 @@ export default { ...@@ -252,12 +241,14 @@ export default {
width: calc(100% - 40px); width: calc(100% - 40px);
height: calc(100% - 20px); height: calc(100% - 20px);
overflow: hidden; overflow: hidden;
.left { .left {
// width: 875px; // width: 875px;
width: 60.76vw; width: 60.76vw;
height: 100%; height: 100%;
flex-shrink: 0; flex-shrink: 0;
} }
.right { .right {
// width: calc(100% - 875px); // width: calc(100% - 875px);
width: calc(100% - 60.76vw); width: calc(100% - 60.76vw);
...@@ -265,6 +256,7 @@ export default { ...@@ -265,6 +256,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
border-left: 1px solid #e5e5e5; border-left: 1px solid #e5e5e5;
} }
::v-deep .el-scrollbar__wrap { ::v-deep .el-scrollbar__wrap {
overflow: auto scroll; overflow: auto scroll;
} }
......
export function filterSpecsStr(data) { export function filterSpecsStr(data) {
let specificationTypeSequenceArr = let specificationTypeSequenceArr
(data?.specificationTypeSequence && = (data?.specificationTypeSequence
data?.specificationTypeSequence?.split(";~;")) || && data?.specificationTypeSequence?.split(";~;"))
[] || [];
let specificationValueSequenceArr = data?.specificationData?.split(";~;") // [0,0]
// [中,1]
let specificationValueSequenceArr = data?.specificationData?.split(";~;");
const suffixMapping = { const suffixMapping = {
1: "年", 1: "年",
2: "(km/万)", 2: "(km/万)",
3: "万" 3: "万",
} };
if (specificationTypeSequenceArr?.length) { if (specificationTypeSequenceArr?.length) {
specificationValueSequenceArr?.forEach((val, index) => { specificationValueSequenceArr?.forEach((val, index) => {
const suffix = suffixMapping[specificationTypeSequenceArr[index]] const suffix = suffixMapping[specificationTypeSequenceArr[index]];
if (suffix) { if (suffix) {
specificationValueSequenceArr[index] = `${val}${suffix}` specificationValueSequenceArr[index] = `${val}${suffix}`;
} }
}) });
return specificationValueSequenceArr?.join("/") return specificationValueSequenceArr?.join("/");
} else if (data?.specificationData?.includes(";~;")) { } else if (data?.specificationData?.includes(";~;")) {
return data?.specificationData?.replace(RegExp(";~;", "g"), "/") return data?.specificationData?.replace(new RegExp(";~;", "g"), "/");
} else { } else {
return "-" return "-";
} }
} }
export function convertYuanToWan(yuan) { export function convertYuanToWan(yuan) {
// 将元转换为万元 // 将元转换为万元
const wan = yuan / 10000 const wan = yuan / 10000;
// 判断小数部分是否为零 // 判断小数部分是否为零
if (wan % 1 === 0) { if (wan % 1 === 0) {
return wan.toFixed(0) // 如果是整数,保留0位小数 return wan.toFixed(0); // 如果是整数,保留0位小数
} else { } else {
return wan.toFixed(2) // 否则保留2位小数 return wan.toFixed(2); // 否则保留2位小数
} }
} }
...@@ -186,7 +186,8 @@ ...@@ -186,7 +186,8 @@
:placeholder="item.label" :placeholder="item.label"
:style="{ width: item.width || formItemWidth }" :style="{ width: item.width || formItemWidth }"
@blur="blur(item)" @blur="blur(item)"
@input="input($event, item)"> @input="input($event, item)"
>
</el-input> </el-input>
<template v-if="item.name == 'minSellPrice'"> <template v-if="item.name == 'minSellPrice'">
<el-checkbox v-model="formData.validMinSellPriceFlag" <el-checkbox v-model="formData.validMinSellPriceFlag"
...@@ -340,8 +341,8 @@ ...@@ -340,8 +341,8 @@
:prop="item.name" :prop="item.name"
:style="{ 'margin-bottom': !item.type ? '0px' : '22px' }"> :style="{ 'margin-bottom': !item.type ? '0px' : '22px' }">
<template> <template>
<el-upload accept=".jpg,.png,.pdf" <el-upload
action="" accept=".jpg,.png,.pdf"action=""
:auto-upload="false" :auto-upload="false"
class="upload-file" class="upload-file"
drag drag
...@@ -463,6 +464,7 @@ ...@@ -463,6 +464,7 @@
<el-input v-model.trim="storeSearchForm.yqMerchantName" <el-input v-model.trim="storeSearchForm.yqMerchantName"
clearable clearable
placeholder="服务对接" placeholder="服务对接"
clearable
@keydown.native="handleStoreInput" /> @keydown.native="handleStoreInput" />
</el-form-item> </el-form-item>
<el-form-item label="服务对接商户号:"> <el-form-item label="服务对接商户号:">
......
...@@ -2,35 +2,43 @@ ...@@ -2,35 +2,43 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-06-12 15:21:09 * @Date: 2024-06-12 15:21:09
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-03-23 18:41:31 * @LastEditTime: 2026-04-08 17:13:53
* @FilePath: \dj-car-life-system\src\views\goods\grounding\components\relateStoreTable.vue * @FilePath: \dj-car-life-system\src\views\goods\grounding\components\relateStoreTable.vue
* @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
--> -->
<template> <template>
<div class="store-table"> <div class="store-table">
<el-table border <el-table border
:data="merchantGoodsRefList" :data="isHide ? tableData : merchantGoodsRefList"
header-cell-class-name="header-cell-class-name" header-cell-class-name="header-cell-class-name"
:header-row-style="headerRowStyle" :header-row-style="headerRowStyle"
:span-method="isHide ? objectSpanMethod : ''"
style="width: 100%"> style="width: 100%">
<el-table-column align="center" <el-table-column align="center"
label="序号" label="序号"
type="index" width="60px">
width="60px" /> <template #default="scope">
{{ getIndex(scope.$index) }}
</template>
</el-table-column>
<el-table-column align="center" <el-table-column align="center"
label="门店名称" label="门店名称"
prop="merchantName" /> prop="merchantName" />
<el-table-column align="center" <el-table-column align="center"
label="门店商户号" label="门店商户号"
prop="merchantId" /> prop="merchantId" />
<el-table-column v-if="!isHide" <el-table-column v-if="isHide"
align="center" align="center"
label="商品名称"
prop="upgradeGoodsName" />
<el-table-column align="center"
label="库存管控"> label="库存管控">
<template #default="scope"> <template #default="scope">
<span v-if="isDetail">{{ scope.row.inventoryType == 1 ? '虚拟' : '实物' }}</span> <span v-if="isDetail">{{ scope.row.inventoryType == 1 ? '虚拟' : '实物' }}</span>
<el-select v-else <el-select v-else
v-model="scope.row.inventoryType" v-model="scope.row.inventoryType"
placeholder="请选择"> placeholder="请选择"
@change="handleInventoryChange(scope.row)">
<el-option label="实物" :value="2"></el-option> <el-option label="实物" :value="2"></el-option>
<el-option label="虚拟" :value="1"></el-option> <el-option label="虚拟" :value="1"></el-option>
...@@ -71,12 +79,100 @@ export default { ...@@ -71,12 +79,100 @@ export default {
}, },
data() { data() {
return { return {
tableData: [],
}; };
}, },
watch: {
merchantGoodsRefList: {
handler(val) {
if (this.isHide)
this.initData();
},
immediate: true,
},
},
mounted() {
},
methods: { methods: {
initData() {
const tableData = [];
(this.merchantGoodsRefList || []).forEach((pkg) => {
if (pkg.inventoryTypeRefList && pkg.inventoryTypeRefList.length > 0) {
pkg.inventoryTypeRefList.forEach((goods) => {
if (goods) {
tableData.push({
merchantId: pkg.merchantId,
merchantName: pkg.merchantName,
merchantGoodsId: goods.merchantGoodsId,
upgradeGoodsName: goods.upgradeGoodsName,
inventoryType: goods.inventoryType,
});
}
});
} else {
tableData.push({
merchantId: pkg.merchantId,
merchantName: pkg.merchantName,
merchantGoodsId: "",
upgradeGoodsName: "",
inventoryType: 2,
});
}
});
this.tableData = tableData;
this.getSpanArr(this.tableData);
},
getIndex(index) {
if (!this.isHide) {
return index + 1;
}
// 当有合并单元格时,计算当前行在 spanArr 中是第几个非0项,从而得出正确的顺序序号
let count = 0;
for (let i = 0; i <= index; i++) {
if (this.spanArr[i] > 0) {
count++;
}
}
return count;
},
getSpanArr(data) {
this.spanArr = [];
this.pos = 0;
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
// 判断当前元素与上一个元素是否属于同一个套餐
if (data[i].merchantId === data[i - 1].merchantId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
// 合并序号(0)和套餐名称(1)列
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 5) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
},
handleDelete(item) { handleDelete(item) {
this.$emit("handleDelete", item); this.$emit("handleDelete", item);
}, },
handleInventoryChange(row) {
this.$emit("updateInventory", row);
},
headerRowStyle() { headerRowStyle() {
return { return {
height: "40px", height: "40px",
......
export const productList = [{ export const productList = [{
confId: 1, confId: 1,
confName: '基础产品' confName: "基础产品",
}, { }, {
confId: 2, confId: 2,
confName: '升级产品' confName: "升级产品",
}] }];
export const baseSupplyModeList = [{ export const baseSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 2, confId: 2,
confName: '门店' confName: "门店",
}] }];
// 太阳膜升级产品供货模式 // 太阳膜升级产品供货模式
export const upgradeSupplyModeList = [{ export const upgradeSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 3, confId: 3,
confName: '门店套码+嘀加' confName: "门店套码+嘀加",
}, { }, {
confId: 4, confId: 4,
confName: '门店回收原厂+嘀加' confName: "门店回收原厂+嘀加",
}, { }, {
confId: 5, confId: 5,
confName: '服务商自采+嘀加' confName: "服务商自采+嘀加",
}] }];
// 1.3场景 升级产品供货模式 // 1.3场景 升级产品供货模式
export const crowdUpgradeSupplyModeList = [{ export const crowdUpgradeSupplyModeList = [{
confId: 1, confId: 1,
confName: '嘀加' confName: "嘀加",
}, { }, {
confId: 2, confId: 2,
confName: '门店' confName: "门店",
}] }];
// 套餐上架商品信息form表单 // 套餐上架商品信息form表单
export const packageGoodsForm = [{ export const packageGoodsForm = [{
name: 'upgradeGoodsId', name: "upgradeGoodsId",
label: '上架商品', label: "上架商品",
isRequired: true, isRequired: true,
type: 'searchSelect', type: "searchSelect",
optionList: [], optionList: [],
isClear: false, isClear: false,
optionId: 'confId', optionId: "confId",
optionNameLabel: 'confNameValue', optionNameLabel: "confNameValue",
optionTypeNameLabel: 'confTypeNameValue', optionTypeNameLabel: "confTypeNameValue",
width: '432px' width: "432px",
}, { }, {
type: 'incidBox', type: "incidBox",
key: 'goodsType', key: "goodsType",
detailInfo: [{ detailInfo: [{
label: '商品名称', label: "商品名称",
value: 'upgradeGoodsName' value: "upgradeGoodsName",
}, { }, {
label: '规格', label: "规格",
value: 'specificationData' value: "specificationData",
}, { }, {
label: '商品编码', label: "商品编码",
value: 'type' value: "type",
}, { }, {
label: '第三方编码', label: "第三方编码",
value: 'thirdPartyCode' value: "thirdPartyCode",
}, { }, {
label: '采购价', label: "采购价",
value: 'purchasePrice', value: "purchasePrice",
unit: true unit: true,
}, { }, {
label: '参考售价', label: "参考售价",
value: 'upgradePrice', value: "upgradePrice",
unit: true unit: true,
}, { }, {
label: '适用车型', label: "适用车型",
value: 'carTypeConfigName' value: "carTypeConfigName",
}, { }, {
label: '所属系列', label: "所属系列",
value: 'goodsName' value: "goodsName",
}, { }, {
label: '所属分类', label: "所属分类",
value: 'tempGoodsTypeName' value: "tempGoodsTypeName",
}, { }, {
label: '商品ID', label: "商品ID",
value: 'upgradeCommodityCode' value: "upgradeCommodityCode",
}] }],
}, { }, {
name: 'position', name: "position",
label: '上架部位', label: "上架部位",
type: 'radio', type: "radio",
radioGroupList: [] radioGroupList: [],
}, { }, {
name: 'goodsAlias', name: "goodsAlias",
label: '商品别名', label: "商品别名",
type: 'input', type: "input",
maxlength: 50, maxlength: 50,
width: '432px' width: "432px",
}, { }, {
name: 'warrantyType', name: "warrantyType",
label: '质保卡类型', label: "质保卡类型",
type: 'select', type: "select",
isClear: false, isClear: false,
optionList: [{ optionList: [{
confId: 0, confId: 0,
confName: '质保卡' confName: "质保卡",
}, { }, {
confId: 1, confId: 1,
confName: '质保权益卡' confName: "质保权益卡",
}], }],
optionId: 'confId', optionId: "confId",
optionLabel: 'confName', optionLabel: "confName",
width: '432px' width: "432px",
}, { }, {
name: 'upgradeSupplyMode', name: "upgradeSupplyMode",
label: '升级/产品供货模式', label: "升级/产品供货模式",
type: 'radio', type: "radio",
index: 2, index: 2,
radioGroupList: [] radioGroupList: [],
}, { }, {
name: 'sellPrice', name: "sellPrice",
label: '售价', label: "售价",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'minSellPrice', name: "minSellPrice",
label: '最低售价', label: "最低售价",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'upgradeProductCost', name: "upgradeProductCost",
label: '产品、升级成本', label: "产品、升级成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'recoveryCost', name: "recoveryCost",
label: '回收成本', label: "回收成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'virtualAccountCost', name: "virtualAccountCost",
label: '虚拟对账成本', label: "虚拟对账成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}, { }, {
name: 'djCost', name: "djCost",
label: '嘀加成本', label: "嘀加成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
isDisabled: false, isDisabled: false,
handleInput: true handleInput: true,
}, { }, {
name: 'thirdPartyCost', name: "thirdPartyCost",
label: '第三方成本', label: "第三方成本",
type: 'input', type: "input",
width: '432px', width: "432px",
unit: true, unit: true,
handleInput: true handleInput: true,
}] }];
// 套餐查看详情form // 套餐查看详情form
export const packageGoodsDetail = [ export const packageGoodsDetail = [
{ {
name: 'upgradeGoodsName', name: "upgradeGoodsName",
label: '上架商品', label: "上架商品",
type: 'incidBox', type: "incidBox",
key: 'goodsType', key: "goodsType",
detailInfo: [{ detailInfo: [{
label: '商品名称', label: "商品名称",
value: 'upgradeGoodsName' value: "upgradeGoodsName",
}, {
label: '规格',
value: 'specificationData'
}, {
label: '商品编码',
value: 'type'
}, {
label: '第三方编码',
value: 'thirdPartyCode'
}, {
label: '采购价',
value: 'purchasePrice',
unit: true
}, {
label: '参考售价',
value: 'upgradePrice',
unit: true
}, {
label: '适用车型',
value: 'carTypeConfigName'
}, { }, {
label: '所属系列', label: "规格",
value: 'goodsName' value: "specificationData",
}, { }, {
label: '所属分类', label: "商品编码",
value: 'tempGoodsTypeName' value: "type",
}, { }, {
label: '商品ID', label: "第三方编码",
value: 'upgradeCommodityCode' value: "thirdPartyCode",
}]
}, { }, {
name: 'positionStr', label: "采购价",
label: '上架部位' value: "purchasePrice",
}, { unit: true,
name: 'goodsAlias',
label: '商品别名'
}, {
name: 'warrantyTypeStr',
label: '质保卡类型'
}, {
name: 'upgradeSupplyModeStr',
label: '升级产品供货模式'
}, {
name: 'sellPrice',
label: '售价',
unit: true
}, {
name: 'minSellPrice',
label: '最低售价',
unit: true
}, { }, {
name: 'upgradeProductCost', label: "参考售价",
label: '产品、升级成本', value: "upgradePrice",
unit: true unit: true,
}, { }, {
name: 'recoveryCost', label: "适用车型",
label: '回收成本', value: "carTypeConfigName",
unit: true
}, { }, {
name: 'virtualAccountCost', label: "所属系列",
label: '虚拟对账成本', value: "goodsName",
unit: true
}, { }, {
name: 'djCost', label: "所属分类",
label: '嘀加成本', value: "tempGoodsTypeName",
unit: true
}, { }, {
name: 'thirdPartyCost', label: "商品ID",
label: '第三方成本', value: "upgradeCommodityCode",
unit: true }],
} },
] {
name: "positionStr",
label: "上架部位",
},
{
name: "goodsAlias",
label: "商品别名",
},
{
name: "warrantyTypeStr",
label: "质保卡类型",
},
{
name: "upgradeSupplyModeStr",
label: "升级产品供货模式",
},
{
name: "sellPrice",
label: "售价",
unit: true,
},
{
name: "minSellPrice",
label: "最低售价",
unit: true,
},
{
name: "upgradeProductCost",
label: "产品、升级成本",
unit: true,
},
{
name: "recoveryCost",
label: "回收成本",
unit: true,
},
{
name: "virtualAccountCost",
label: "虚拟对账成本",
unit: true,
},
{
name: "djCost",
label: "嘀加成本",
unit: true,
},
{
name: "thirdPartyCost",
label: "第三方成本",
unit: true,
},
];
<!-- 上架编辑 -->
<template> <template>
<d2-container v-loading="!show" class="edit-commodity"> <d2-container v-loading="!show" class="edit-commodity">
<div v-if="show" class=""> <div v-if="show" class="">
...@@ -25,7 +24,6 @@ import { baseConfig } from "@/main"; ...@@ -25,7 +24,6 @@ import { baseConfig } from "@/main";
import { convertYuanToWan, filterSpecsStr } from "../filterOption"; import { convertYuanToWan, filterSpecsStr } from "../filterOption";
import groundingForm from "./components/groundingForm.vue"; import groundingForm from "./components/groundingForm.vue";
import { baseSupplyModeList, productList, upgradeSupplyModeList } from "./constants/data"; import { baseSupplyModeList, productList, upgradeSupplyModeList } from "./constants/data";
export default { export default {
name: "EditGrounding", name: "EditGrounding",
components: { components: {
...@@ -39,7 +37,8 @@ export default { ...@@ -39,7 +37,8 @@ export default {
proFormRef: "pro", proFormRef: "pro",
editForm: [{ editForm: [{
title: "商品信息", title: "商品信息",
formBlock: [{ formBlock: [
{
name: "upgradeGoodsId", name: "upgradeGoodsId",
label: "上架商品", label: "上架商品",
isRequired: true, isRequired: true,
...@@ -97,7 +96,8 @@ export default { ...@@ -97,7 +96,8 @@ export default {
type: "input", type: "input",
maxlength: 50, maxlength: 50,
width: "432px", width: "432px",
}, { },
{
name: "warrantyType", name: "warrantyType",
label: "质保卡类型", label: "质保卡类型",
type: "select", type: "select",
...@@ -123,55 +123,63 @@ export default { ...@@ -123,55 +123,63 @@ export default {
type: "radio", type: "radio",
index: 1, index: 1,
radioGroupList: [], radioGroupList: [],
}, { },
{
name: "upgradeSupplyMode", name: "upgradeSupplyMode",
label: "升级/产品供货模式", label: "升级/产品供货模式",
type: "radio", type: "radio",
index: 2, index: 2,
radioGroupList: [], radioGroupList: [],
}, { },
{
name: "sellPrice", name: "sellPrice",
label: "售价", label: "售价",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "minSellPrice", name: "minSellPrice",
label: "最低售价", label: "最低售价",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "upgradeProductCost", name: "upgradeProductCost",
label: "产品、升级成本", label: "产品、升级成本",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "giftCost", name: "giftCost",
label: "赠送成本", label: "赠送成本",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "recoveryCost", name: "recoveryCost",
label: "回收成本", label: "回收成本",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "virtualAccountCost", name: "virtualAccountCost",
label: "虚拟对账成本", label: "虚拟对账成本",
type: "input", type: "input",
width: "432px", width: "432px",
unit: true, unit: true,
handleInput: true, handleInput: true,
}, { },
{
name: "djCost", name: "djCost",
label: "嘀加成本", label: "嘀加成本",
type: "input", type: "input",
...@@ -179,7 +187,8 @@ export default { ...@@ -179,7 +187,8 @@ export default {
unit: true, unit: true,
isDisabled: false, isDisabled: false,
handleInput: true, handleInput: true,
}, { },
{
name: "thirdPartyCost", name: "thirdPartyCost",
label: "第三方成本", label: "第三方成本",
type: "input", type: "input",
...@@ -423,7 +432,7 @@ export default { ...@@ -423,7 +432,7 @@ export default {
}; };
if (params.tempValidDate) { if (params.tempValidDate) {
delete params.tempValidDate; delete params.tempValidDate;
} };
if (data?.goodsType == 1 && data?.sceneType != 1) if (data?.goodsType == 1 && data?.sceneType != 1)
return this.$message.warning("太阳膜类商品仅支持上架至精品升级场景"); return this.$message.warning("太阳膜类商品仅支持上架至精品升级场景");
if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0) if (this.extendedPosiType.includes(data.goodsType) && data?.sceneType != 0)
......
<template>
<d2-dialog btn-ok-label="确认"
class="batch-modify-package-inventory-dialog"
:is-visible.sync="dialogVisible"
title="批量修改库存模式"
width="1080px"
@closeDialog="handleClose"
@confirmDialog="handleConfirm">
<div class="tip-text">
已选择{{ selectedPackageCount }}个组合套餐,{{ totalGoodsCount }}个商品,涉及到{{ relatedStoreCount }}家门店
</div>
<div class="tip-sub-text">
统一设置所有商品的门店管控模式
</div>
<el-table border
:data="tableData"
max-height="400"
:span-method="objectSpanMethod"
style="width: 100%; margin-top: 20px;">
<el-table-column align="center"
label="序号"
type="index"
width="60">
<template #default="scope">
{{ getIndex(scope.$index) }}
</template>
</el-table-column>
<el-table-column align="center"
label="套餐名称"
min-width="120"
prop="packageName"
show-overflow-tooltip>
</el-table-column>
<el-table-column align="center"
label="商品名称"
min-width="120"
prop="upgradeGoodsName"
show-overflow-tooltip>
</el-table-column>
<el-table-column align="center"
label="商品规格"
min-width="100"
prop="specificationData"
show-overflow-tooltip>
</el-table-column>
<el-table-column align="center"
label="商品UID"
min-width="180"
prop="commodityCode"
show-overflow-tooltip>
</el-table-column>
<el-table-column align="center"
label="库存模式"
width="120">
<template #default="scope">
<el-select v-model="scope.row.inventoryType" size="small">
<el-option label="实物" :value="2"></el-option>
<el-option label="虚拟" :value="1"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center"
label="应用范围"
width="180">
<template #default="scope">
<el-radio-group v-model="scope.row.bindAllMerchant" @change="handleScopeChange(scope.row)">
<el-radio :label="false">
指定门店
</el-radio>
<el-radio :label="true">
所有门店
</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column align="center"
label="具体门店"
width="160">
<template #default="scope">
<el-select v-if="!scope.row.bindAllMerchant"
v-model="scope.row.merchantIdList"
collapse-tags
filterable
multiple
placeholder="请选择"
size="small">
<el-option v-for="merchant in merchantList"
:key="merchant.merchantId"
:label="merchant.merchantName"
:value="merchant.merchantId">
</el-option>
</el-select>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
</d2-dialog>
</template>
<script>
import { batchEditInventoryTypeByPackageId, getGoodsByPackageIdList, queryRelatedMerchantByPackageIdList } from "@/api/packageManage";
export default {
name: "BatchModifyPackageInventoryDialog",
props: {
visible: {
type: Boolean,
default: false,
},
selectedData: {
type: Array,
default: () => [],
},
},
data() {
return {
dialogVisible: false,
tableData: [],
merchantList: [],
spanArr: [], // 用于合并单元格
pos: 0,
};
},
computed: {
selectedPackageCount() {
return this.selectedData.length;
},
totalGoodsCount() {
return this.tableData.length;
},
relatedStoreCount() {
return this.merchantList.length;
},
},
watch: {
visible(val) {
this.dialogVisible = val;
if (val) {
this.tableData = [];
this.merchantList = [];
this.spanArr = [];
this.pos = 0;
this.fetchData();
}
},
dialogVisible(val) {
this.$emit("update:visible", val);
},
},
methods: {
getIndex(index) {
// 当有合并单元格时,计算当前行在 spanArr 中是第几个非0项,从而得出正确的顺序序号
let count = 0;
for (let i = 0; i <= index; i++) {
if (this.spanArr[i] > 0) {
count++;
}
}
return count;
},
async fetchData() {
const idList = this.selectedData.map(item => item.id);
if (idList.length === 0)
return;
try {
const [merchantRes, goodsRes] = await Promise.all([
queryRelatedMerchantByPackageIdList({ idList }),
getGoodsByPackageIdList({ idList }),
]);
this.merchantList = merchantRes.merchantList || [];
const tableData = [];
(goodsRes || []).forEach((pkg) => {
if (pkg.goodsList && pkg.goodsList.length > 0) {
pkg.goodsList.forEach((goods) => {
tableData.push({
packageId: pkg.packageId,
packageName: pkg.packageName,
merchantGoodsId: goods.merchantGoodsId,
upgradeGoodsId: goods.upgradeGoodsId,
upgradeGoodsName: goods.upgradeGoodsName,
specificationData: goods.specificationData,
commodityCode: goods.commodityCode,
inventoryType: "", // 默认实物
bindAllMerchant: false, // 默认指定门店
merchantIdList: [],
});
});
}
});
this.tableData = tableData;
this.getSpanArr(this.tableData);
} catch (error) {
console.error(error);
}
},
getSpanArr(data) {
console.log(data, "9999");
this.spanArr = [];
this.pos = 0;
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
// 判断当前元素与上一个元素是否属于同一个套餐
if (data[i].packageId === data[i - 1].packageId) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
// 合并序号(0)和套餐名称(1)列
if (columnIndex === 0 || columnIndex === 1) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
},
handleScopeChange(row) {
if (row.bindAllMerchant) {
row.merchantIdList = [];
}
},
handleClose() {
this.dialogVisible = false;
this.$emit("close");
},
handleConfirm() {
// 校验
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i];
if (!row.inventoryType) {
this.$message.warning(`请选择 ${row.upgradeGoodsName} 的库存模式`);
return;
}
if (row.bindAllMerchant === false && (!row.merchantIdList || row.merchantIdList.length === 0)) {
this.$message.warning(`请选择 ${row.upgradeGoodsName} 的具体门店`);
return;
}
}
// 组装数据
const packageMap = {};
this.tableData.forEach((row) => {
if (!packageMap[row.packageId]) {
packageMap[row.packageId] = {
packageId: row.packageId,
goodsList: [],
};
}
packageMap[row.packageId].goodsList.push({
merchantGoodsId: row.merchantGoodsId,
upgradeGoodsId: row.upgradeGoodsId,
inventoryType: row.inventoryType,
bindAllMerchant: row.bindAllMerchant,
merchantIdList: row.bindAllMerchant ? [] : row.merchantIdList,
});
});
const packageList = Object.values(packageMap);
batchEditInventoryTypeByPackageId({ packageList }).then((res) => {
if (res) {
this.$message.success("批量修改库存模式成功");
this.dialogVisible = false;
this.$emit("confirm");
}
});
},
},
};
</script>
<style lang="scss" scoped>
.batch-modify-package-inventory-dialog {
.tip-text {
font-size: 14px;
color: #333;
margin-bottom: 8px;
padding-left: 10px;
border-left: 3px solid #1890ff;
}
.tip-sub-text {
font-size: 14px;
color: #666;
margin-bottom: 10px;
margin-left: 13px;
}
::v-deep .el-radio {
margin-right: 10px;
}
::v-deep .el-radio__label {
padding-left: 5px;
}
}
</style>
...@@ -254,9 +254,12 @@ ...@@ -254,9 +254,12 @@
选择上架门店 选择上架门店
</el-button> </el-button>
<RelateStoreTable v-if="$$(formData.merchantGoodsRefList, 'length')" <RelateStoreTable v-if="$$(formData.merchantGoodsRefList, 'length')"
ref="relateStoreTable"
:is-hide="true" :is-hide="true"
:merchant-goods-ref-list="formData.merchantGoodsRefList" :merchant-goods-ref-list="formData.merchantGoodsRefList"
@handleDelete="handleDelete"> @handleDelete="handleDelete"
@updateInventory="handleUpdateInventory">
</RelateStoreTable> </RelateStoreTable>
</el-form-item> </el-form-item>
</div> </div>
...@@ -640,6 +643,66 @@ export default { ...@@ -640,6 +643,66 @@ export default {
if (!this.filterEmpty(_valueObj?.djCost)) if (!this.filterEmpty(_valueObj?.djCost))
_formData.djCost = _valueObj?.djCost; // 嘀加成本 商品信息自带数据 _formData.djCost = _valueObj?.djCost; // 嘀加成本 商品信息自带数据
this.handleSelectGoodsClose(); this.handleSelectGoodsClose();
this.updateMerchantGoodsRefList();
},
// 上架商品加入上架门店
updateMerchantGoodsRefList() {
// 在重新生成商品列表前,先同步当前的表格数据状态
if (this.$refs.relateStoreTable && this.$refs.relateStoreTable[0]) {
const currentTableData = this.$refs.relateStoreTable[0].tableData || [];
this.syncTableDataToFormData(currentTableData);
}
let _formData = [];
this.formData.groundingGoodsList.forEach((item) => {
if (item?.id || item?.upgradeGoods?.id) {
_formData.push({
merchantGoodsId: item?.id || item?.upgradeGoods?.id,
upgradeGoodsName: item.upgradeGoods?.upgradeGoodsName,
inventoryType: item.inventoryType || 2,
});
}
});
// 遍历已有的门店,如果门店里已经有某些商品了,保留它们的 inventoryType
let merchantGoodsRefList = this.formData.merchantGoodsRefList.map((merchant) => {
const newInventoryTypeRefList = _formData.map((newGoods) => {
// 去老数据里找找看这个商品原来在不在
const oldGoods = (merchant.inventoryTypeRefList || []).find(g => g.merchantGoodsId === newGoods.merchantGoodsId);
if (oldGoods) {
// 如果老数据有,保留老数据的库存模式
return {
...newGoods,
inventoryType: oldGoods.inventoryType,
};
}
// 如果没有,就用新的默认值
return newGoods;
});
return {
...merchant,
inventoryTypeRefList: newInventoryTypeRefList,
};
});
this.formData.merchantGoodsRefList = merchantGoodsRefList;
},
handleAddMerchantGoods() {
let _formData = [];
this.formData.groundingGoodsList.forEach((item) => {
_formData.push({
merchantGoodsId: item.id,
upgradeGoodsName: item.upgradeGoods?.upgradeGoodsName,
inventoryType: item.inventoryType || 2,
});
});
this.formData.merchantGoodsRefList.forEach((item) => {
if (!item.inventoryTypeRefList || item.inventoryTypeRefList.length == 0) {
item.inventoryTypeRefList = _formData;
}
});
}, },
handleSelectGoodsClose() { handleSelectGoodsClose() {
this.selectGoodsVisible = false; this.selectGoodsVisible = false;
...@@ -790,7 +853,21 @@ export default { ...@@ -790,7 +853,21 @@ export default {
}, },
delGroundingGoods(index) { delGroundingGoods(index) {
const groundingGoodsList = this.formData.groundingGoodsList; const groundingGoodsList = this.formData.groundingGoodsList;
const deletedGoodsId = groundingGoodsList[index]?.id || groundingGoodsList[index]?.upgradeGoods?.id;
groundingGoodsList?.splice(index, 1); groundingGoodsList?.splice(index, 1);
// 同步删除商户列表中的对应商品
if (deletedGoodsId) {
this.formData.merchantGoodsRefList = this.formData.merchantGoodsRefList.map((merchant) => {
if (merchant.inventoryTypeRefList) {
merchant.inventoryTypeRefList = merchant.inventoryTypeRefList.filter(
goods => goods.merchantGoodsId !== deletedGoodsId,
);
}
return merchant;
});
// 触发更新视图
this.updateMerchantGoodsRefList();
}
}, },
// 删除文件 // 删除文件
handleFileDelete(targetItem, subIndex) { handleFileDelete(targetItem, subIndex) {
...@@ -844,7 +921,22 @@ export default { ...@@ -844,7 +921,22 @@ export default {
}); });
return true; return true;
} }
this.formData.merchantGoodsRefList = selectedData;
// 合并保留旧的 inventoryTypeRefList 数据,防止已选的库存模式丢失
const oldMerchantList = this.formData.merchantGoodsRefList || [];
const mergedData = selectedData.map((newMerchant) => {
const oldMerchant = oldMerchantList.find(m => m.merchantId === newMerchant.merchantId);
if (oldMerchant) {
return {
...newMerchant,
inventoryTypeRefList: deepClone(oldMerchant.inventoryTypeRefList) || [],
};
}
return newMerchant;
});
this.formData.merchantGoodsRefList = mergedData;
this.updateMerchantGoodsRefList();
this.relateStoreVisible = false; this.relateStoreVisible = false;
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
...@@ -859,8 +951,59 @@ export default { ...@@ -859,8 +951,59 @@ export default {
}, },
// 删除上架门店 // 删除上架门店
handleDelete(item) { handleDelete(item) {
// 在删除前,需要将当前组件内的子组件的表格数据同步回 formData
// 否则如果只是纯粹 filter,会导致没保存的值又丢失了
if (this.$refs.relateStoreTable && this.$refs.relateStoreTable[0]) {
const currentTableData = this.$refs.relateStoreTable[0].tableData || [];
this.syncTableDataToFormData(currentTableData);
}
const filterArr = this.formData.merchantGoodsRefList.filter(i => i.merchantId !== item.merchantId); const filterArr = this.formData.merchantGoodsRefList.filter(i => i.merchantId !== item.merchantId);
this.$set(this.formData, "merchantGoodsRefList", filterArr); this.$set(this.formData, "merchantGoodsRefList", filterArr);
this.updateMerchantGoodsRefList();
},
syncTableDataToFormData(tableData) {
const merchantGoodsMap = {};
tableData.forEach((item) => {
if (!merchantGoodsMap[item.merchantId]) {
merchantGoodsMap[item.merchantId] = {
merchantId: item.merchantId,
merchantName: item.merchantName,
inventoryTypeRefList: [],
};
}
merchantGoodsMap[item.merchantId].inventoryTypeRefList.push({
merchantGoodsId: item?.merchantGoodsId || item?.upgradeGoods?.id,
merchantId: item?.merchantId,
merchantName: item?.merchantName,
inventoryType: item.inventoryType,
});
});
// 将分组后的数据合并回 formData.merchantGoodsRefList
this.formData.merchantGoodsRefList = this.formData.merchantGoodsRefList.map((merchant) => {
if (merchantGoodsMap[merchant.merchantId]) {
return {
...merchant,
inventoryTypeRefList: merchantGoodsMap[merchant.merchantId].inventoryTypeRefList,
};
}
return merchant;
});
},
handleUpdateInventory(row) {
const merchant = this.formData.merchantGoodsRefList.find(m => m.merchantId === row.merchantId);
if (merchant && merchant.inventoryTypeRefList) {
const goods = merchant.inventoryTypeRefList.find(g => g.merchantGoodsId === row.merchantGoodsId);
if (goods) {
goods.inventoryType = row.inventoryType;
}
}
},
getRelateStoreTableData() {
if (this.$refs.relateStoreTable) {
return this.$refs.relateStoreTable[0].tableData || [];
}
return [];
}, },
// 下拉加载更多 下拉框显示隐藏触发 // 下拉加载更多 下拉框显示隐藏触发
visibleChange(data) { visibleChange(data) {
......
...@@ -230,12 +230,14 @@ export default { ...@@ -230,12 +230,14 @@ export default {
}, },
getDetailInfo(id) { getDetailInfo(id) {
getPackageDetailInfo({ id }).then((res) => { getPackageDetailInfo({ id }).then((res) => {
console.log(res, "getPackageDetailInfo");
res.groundingGoodsList = []; res.groundingGoodsList = [];
res?.merchantGoodsInfoList?.forEach((val) => { res?.merchantGoodsInfoList?.forEach((val) => {
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {}; const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {};
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName]; const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName];
const result = types.filter(type => type).join("-"); const result = types.filter(type => type).join("-");
const positionNamesArr = deepClone(this.positionTypeList)?.filter(subVal => (val?.upgradeGoods?.position?.split(","))?.includes(subVal.position + "")) || []; const positionNamesArr = deepClone(this.positionTypeList)?.filter(subVal => (val?.upgradeGoods?.position?.split(","))?.includes(subVal.position + "")) || [];
// 商品信息
res.groundingGoodsList.push({ res.groundingGoodsList.push({
id: val.id, id: val.id,
goodsType: val?.goodsType, // 类目值 goodsType: val?.goodsType, // 类目值
...@@ -279,7 +281,12 @@ export default { ...@@ -279,7 +281,12 @@ export default {
if (val.voucherFileUrl) if (val.voucherFileUrl)
val.uploadProgress = 100; val.uploadProgress = 100;
}); });
res.merchantGoodsRefList = res.merchantGoodsRefList || []; // 上架门店 res.merchantGoodsRefList = res.merchantGoodsRefList.map((item) => {
return {
...item,
inventoryTypeRefList: item.inventoryTypeRefList || [],
};
}) || []; // 上架门店
res.voucherList = res.voucherList || []; // 上架凭证 res.voucherList = res.voucherList || []; // 上架凭证
this.editData = res || {}; this.editData = res || {};
this.$nextTick(() => { this.$nextTick(() => {
...@@ -309,12 +316,35 @@ export default { ...@@ -309,12 +316,35 @@ export default {
}); });
}); });
const arr = []; const arr = [];
data?.merchantGoodsRefList?.forEach((val) => { // 上架门店组合数据 防止请求参数过长
arr.push({ // 从 RelateStoreTable 组件获取用户操作后的库存模式数据
merchantId: val.merchantId, const tableData = this.$refs.d2GroundingForm ? this.$refs.d2GroundingForm.getRelateStoreTableData() : [];
merchantName: val.merchantName, const merchantGoodsMap = {};
console.log(tableData, "tableData");
// 根据商户Id分组数据
tableData.forEach((item) => {
if (!merchantGoodsMap[item.merchantId]) {
merchantGoodsMap[item.merchantId] = {
merchantId: item.merchantId,
merchantName: item.merchantName,
inventoryTypeRefList: [],
};
}
merchantGoodsMap[item.merchantId].inventoryTypeRefList.push({
merchantGoodsId: item.merchantGoodsId,
merchantId: item.merchantId,
merchantName: item.merchantName,
inventoryType: item.inventoryType,
}); });
}); });
// 转为数组格式
for (let key in merchantGoodsMap) {
arr.push(merchantGoodsMap[key]);
}
console.log(arr, "arr");
const fileArr = []; const fileArr = [];
data?.voucherList?.forEach((val) => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空 data?.voucherList?.forEach((val) => { // 处理上传凭证数据 删除或取消上传并不会删除数组 只是将url置空
if (val.voucherFileUrl) { if (val.voucherFileUrl) {
......
...@@ -383,7 +383,7 @@ export default { ...@@ -383,7 +383,7 @@ export default {
{ required: true, message: "请输入采购价", trigger: "blur" }, { required: true, message: "请输入采购价", trigger: "blur" },
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
; +value <= 0 ? callback(new Error("售价需大于0")) : callback() ; +value < 0 ? callback(new Error("采购价需大于0")) : callback()
} }
} }
], ],
......
<!-- 编辑 - 基础信息 -->
<template>
<div v-loading="loading" class="edit-page base-info">
<div class="title">
<span>基础信息</span>
</div>
<div style="padding: 20px 20px 0">
<el-form label-width="150px" :model="basicInfo">
<el-form-item v-for="(item, index) in editFormData"
:key="index"
class="form-item"
:style="{ width: [2, 7].includes(item.inputType) ? '100%' : '48%' }">
<template #label>
<span class="label">{{ item.title }}:</span>
</template>
<div v-if="item.inputType === 7">
<div v-if="!item.fileList.length">
-
</div>
<div v-else style="width:100%">
<div v-for="(k, kIdx) in item.fileList"
:key="kIdx"
class="file-name-wrapper">
<div class="name text-hide" :title="k.fileName">
{{ k.fileName }}
</div>
<el-link class="download"
:href="k.url"
type="primary">
下载
</el-link>
</div>
</div>
</div>
<span v-else
class="rich-text text-hide"
:title="item.showValue || '-'">
{{ item.showValue || "-" }}
</span>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { last } from "lodash-es";
import { getBusisDetailBasic } from "@/api/shelfManage.js";
export default {
name: "BaseInfo",
props: {
shelveId: {
type: [String, Number],
require: true,
},
},
data() {
return {
loading: false,
basicInfo: {},
editFormData: [],
};
},
computed: {
},
watch: {
},
async mounted() {
this.loading = true;
try {
await this.getData(this.shelveId);
} finally {
this.loading = false;
}
},
methods: {
async getData(shelveId) {
const { basicInfo } = await getBusisDetailBasic({ id: shelveId });
console.log("basicInfo", basicInfo);
if (!basicInfo?.basicApproveInfo) {
return [];
}
const editFormData = JSON.parse(basicInfo.basicApproveInfo);
console.log("editFormData", editFormData);
editFormData.forEach((item) => {
// 直接展示
if ([1, 2, 3, 4].includes(item.inputType)) {
item.showValue = item.value;
} else if (item.inputType === 5) {
// 单选
item.showValue = item.options.find(k => k.key == item.value)?.value || "";
} else if (item.inputType === 6) {
// 多选
// console.log(item.value, 'item.value')
const list = item.value.split(",");
item.showValue = "";
list.forEach((m, idx) => {
let label = item.options.find(k => k.key == m)?.value || "";
item.showValue = item.showValue + (idx !== 0 ? "," + label : label);
});
} else if (item.inputType === 7) {
// 附件
item.fileList = [];
if (basicInfo.goodsCreateExcel) {
const goodsCreateExcel = basicInfo.goodsCreateExcel.split("/");
item.fileList.push({
url: basicInfo.goodsCreateExcel,
fileName: last(goodsCreateExcel),
});
}
if (basicInfo?.submitGoodsCreateExcel) {
const submitGoodsCreateExcel = basicInfo.submitGoodsCreateExcel.split("/");
item.fileList.push({
url: basicInfo.submitGoodsCreateExcel,
fileName: last(submitGoodsCreateExcel),
});
}
// console.log(item.value, 'item.value')
const valueList = item.value ? item.value.split(",") : [];
valueList.forEach((k, kIdx) => {
if (k) {
item.fileList.push({
url: k,
fileName: k.split("/")[k.split("/").length - 1],
});
}
});
}
});
this.editFormData = editFormData;
this.baseInfo = basicInfo;
},
},
};
</script>
<style lang="scss">
@import "../../style/editdetailCon.scss";
.base-info {
.el-form-item__label {
padding-right: 0;
}
.el-form-item__label,
.el-form-item__content {
line-height: 20px !important;
}
.form-item {
display: inline-block;
line-height: 20px;
margin-bottom: 20px;
.file-name-wrapper {
width: 100%;
display: flex;
align-items: center;
overflow: hidden;
.download {
margin-left: 12px;
flex-shrink: 0;
}
}
}
.rich-text {
display: inline-block;
max-width: 98%;
overflow-wrap: break-word;
}
}
</style>
<!-- 驳回 --> <!-- 驳回 -->
<template> <template>
<baseDialog :dialog-config="dialogConfig" <baseDialog class="accountDailog"
:dialog-config="dialogConfig"
:is-show.sync="visible" :is-show.sync="visible"
class="accountDailog"
@handleClick="handleAddConfirm"> @handleClick="handleAddConfirm">
<div class="reject-dialog"> <div class="reject-dialog">
<glsx-combi-form class="edit-form-container" <glsx-combi-form ref="formRef"
ref="formRef" class="edit-form-container"
label-width="150px"
default-width="350px" default-width="350px"
:form-ref="rejectRef"
:form-obj="infoForm"
:form-data="editFormData" :form-data="editFormData"
:form-rules="formRules"></glsx-combi-form> :form-obj="infoForm"
:form-ref="rejectRef"
:form-rules="formRules"
label-width="150px">
</glsx-combi-form>
</div> </div>
</baseDialog> </baseDialog>
</template> </template>
<script> <script>
import { import {
reject reject,
} from "@api/shelfManage.js" } from "@api/shelfManage.js";
export default { export default {
name: 'RejectDialog', name: "RejectDialog",
props: {
rejectVisible: {
type: Boolean,
default: false,
},
paramsObj: {
type: Object,
default: () => ({}),
},
},
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
infoForm: { infoForm: {
remark: '' remark: "",
}, },
dialogConfig: { dialogConfig: {
title: '驳回', title: "驳回",
width: '600px' width: "600px",
}, },
rejectRef: 'rejectRef', rejectRef: "rejectRef",
formRules: { formRules: {
remark: [{ required: true, message: '请输入驳回原因', trigger: 'blur' }] remark: [{ required: true, message: "请输入驳回原因", trigger: "blur" }],
}, },
editFormData: [{ editFormData: [{
label: '驳回原因', label: "驳回原因",
name: 'remark', name: "remark",
type: 'input', type: "input",
maxlength: 50, maxlength: 50,
inputType: 'textarea', inputType: "textarea",
showLimit: true, showLimit: true,
rows: 4 rows: 4,
}], }],
baseData: { baseData: {
}
}
},
props: {
rejectVisible: {
type: Boolean,
default: false
}, },
paramsObj: { };
type: Object,
default: {}
}
}, },
computed: { computed: {
visible: { visible: {
get() { get() {
return this.rejectVisible return this.rejectVisible;
}, },
set(newVal) { set(newVal) {
this.$emit('dialogClose', { flag: newVal, attrName: 'rejectVisible' }) this.$emit("dialogClose", { flag: newVal, attrName: "rejectVisible" });
} },
} },
}, },
mounted() { mounted() {
console.log('paramsObj', this.paramsObj) console.log("paramsObj", this.paramsObj);
}, },
methods: { methods: {
handleAddConfirm() { handleAddConfirm() {
this.$refs.formRef.$refs[this.rejectRef].validate(valid => { this.$refs.formRef.$refs[this.rejectRef].validate((valid) => {
if (valid) { if (valid) {
var params = {} let params = {};
params.rejectedReason = this.infoForm.remark params.rejectedReason = this.infoForm.remark;
params.id = this.paramsObj.id params.id = this.paramsObj.id;
reject(params).then(res => { reject(params).then((res) => {
this.notice.okTips('操作成功') this.notice.okTips("操作成功");
this.visible = true this.visible = true;
}) });
}
})
}
} }
} });
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.reject-dialog { .reject-dialog {
margin: 65px 0; margin: 65px 0;
......
import { limitPrice } from "@/common/format";
import store from "@/store";
export const CategoryTypeOptions = [
{ label: "按商品分类", value: 1 },
{ label: "按具体商品", value: 2 },
{ label: "按具体套餐", value: 3 },
];
<template>
<el-row class="description-wrapper">
<template v-for="item in schema">
<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">
<div class="text-hide" :style="{ width: item.valueWidth || '100%' }">
<template v-if="item.render">
<RenderProxy :render="item.render"
:row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
<template v-if="item.tooltip && (getValue(item.descKey || item.name))">
<el-tooltip :content="isZeroOrNumber(getValue(item.descKey || item.name)) " v-bind="item.tooltipProps">
<div class="text-hide">
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</div>
</el-tooltip>
</template>
<template v-else>
<slot :name="`${item.slot || item.name}-value`">
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</slot>
</template>
</template>
</div>
</span>
</div>
</slot>
</el-col>
</template>
</el-row>
</template>
<script>
import { get, isFunction } from "lodash-es";
import { nanoid } from "nanoid";
import RenderProxy from "@/components/renderProxy/index.vue";
import { isZeroOrNumber } from "../../utils/index.js";
export default {
name: "Descriptions",
components: {
RenderProxy,
},
props: {
// 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
schema: {
type: Array,
default: () => ([]),
},
data: {
type: Object,
default: () => ({}),
},
},
computed: {
getSchema() {
return this.schema.map(item => ({
...item,
_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>
...@@ -131,10 +131,7 @@ export default { ...@@ -131,10 +131,7 @@ export default {
const textArr = []; const textArr = [];
this.editableTabs.push({ this.editableTabs.push({
title: title: item.groupType == 1 ? "全部品类" : "特殊品类" + (hasAllGoodsType ? index : index + 1),
item.groupType == 1
? "全部品类"
: "特殊品类" + (hasAllGoodsType ? index : index + 1),
name: (index + 1).toString(), name: (index + 1).toString(),
}); });
// 按具体商品 // 按具体商品
......
...@@ -6,16 +6,19 @@ ...@@ -6,16 +6,19 @@
</div> </div>
<div class="check-tab"> <div class="check-tab">
<el-tabs v-model="tabsValue" <el-tabs v-model="tabsValue"
type="card" class="my-tab-pane"
class="my-tab-pane"> type="card">
<el-tab-pane v-for="(item, idx) in goodTabs" <el-tab-pane v-for="(item, idx) in goodTabs"
:key="item.name" :key="item.name"
:name="item.name"> :name="item.name">
<span slot="label"><i class="el-icon-warning car-error-txt" <template #label>
v-if="item.valiadError == 'Y'" />{{ item.title ? item.title + (idx + 1) : item.goodsName }} <span>
<i v-if="item.valiadError == 'Y'"
class="el-icon-warning car-error-txt" />{{ item.title ? item.title + (idx + 1) : item.goodsName }}
</span> </span>
</template>
<span> <span>
<good-tab :info="item.info" <GoodTab :info="item.info"
:tab-idx="item.tabIndex" /> :tab-idx="item.tabIndex" />
</span> </span>
</el-tab-pane> </el-tab-pane>
...@@ -23,11 +26,14 @@ ...@@ -23,11 +26,14 @@
:key="item.name" :key="item.name"
:label="item.title" :label="item.title"
:name="item.name"> :name="item.name">
<span slot="label"><i class="el-icon-warning car-error-txt" <template #label>
v-if="item.valiadError == 'Y'" />{{ item.title ? item.title + (idx + 1) : item.goodsName }} <span>
<i v-if="item.valiadError == 'Y'"
class="el-icon-warning car-error-txt" />{{ item.title ? item.title + (idx + 1) : item.goodsName }}
</span> </span>
</template>
<span> <span>
<package-tab :info="item.info" <PackageTab :info="item.info"
:tab-idx="item.tabIndex" :tab-idx="item.tabIndex"
@packageEditInfo="getPackageEditInfo_notice" /> @packageEditInfo="getPackageEditInfo_notice" />
</span> </span>
...@@ -38,21 +44,22 @@ ...@@ -38,21 +44,22 @@
</template> </template>
<script> <script>
import { getGoodsDetail } from "@api/shelfManage.js" import { getGoodsDetail } from "@api/shelfManage.js";
import goodTab from "./common/goodTab.vue" import { deepClone } from "@/common/util";
import packageTab from "./common/packageTab.vue" import goodTab from "./common/goodTab.vue";
import { deepClone } from "@/common/util" import packageTab from "./common/packageTab.vue";
export default { export default {
name: "GoodsInfo", name: "GoodsInfo",
components: {
GoodTab: goodTab,
PackageTab: packageTab,
},
props: { props: {
recordId: { recordId: {
type: Number, type: Number,
default: null default: null,
}
}, },
components: {
goodTab,
packageTab
}, },
data() { data() {
// 这里存放数据 // 这里存放数据
...@@ -65,92 +72,93 @@ export default { ...@@ -65,92 +72,93 @@ export default {
packageTabs: [], packageTabs: [],
goodInfoList: [], goodInfoList: [],
packageInfoList: [], packageInfoList: [],
goodsInfo: {} goodsInfo: {},
} };
}, },
computed: { computed: {
routeInfo() { routeInfo() {
return this.$route.params return this.$route.params;
} },
}, },
mounted() { mounted() {
this.getDetail() this.getDetail();
}, },
methods: { methods: {
getDetail() { getDetail() {
console.log("getGoodsDetail") console.log("getGoodsDetail");
// this.recordId // this.recordId
getGoodsDetail({ id: this.routeInfo.id }) getGoodsDetail({ id: this.routeInfo.id })
.then((res) => { .then((res) => {
console.log(res, "getGoodsDetail") console.log(res, "getGoodsDetail");
this.goodsInfo = res this.goodsInfo = res;
const goodsList = deepClone(res.goodsList) const goodsList = deepClone(res.goodsList);
const packageGoodsList = deepClone(res.packageGoodsList) const packageGoodsList = deepClone(res.packageGoodsList);
goodsList.forEach((item, idx) => { goodsList.forEach((item, idx) => {
const length = this.goodTabs.length const length = this.goodTabs.length;
const tabIndex = const tabIndex
length == 0 ? length : this.goodTabs[length - 1].tabIndex + 1 = length == 0 ? length : this.goodTabs[length - 1].tabIndex + 1;
this.goodTabs.push({ this.goodTabs.push({
goodsName: item.upgradeGoodsName, goodsName: item.upgradeGoodsName,
name: "good_" + tabIndex, name: "good_" + tabIndex,
tabIndex: tabIndex, tabIndex,
// goodId: item.id, // goodId: item.id,
info: item info: item,
}) });
this.tabsValue = "good_" + tabIndex this.tabsValue = "good_" + tabIndex;
}) });
packageGoodsList.forEach((item, idx) => { packageGoodsList.forEach((item, idx) => {
const length = this.packageTabs.length const length = this.packageTabs.length;
const tabIndex = const tabIndex
length == 0 ? length : this.packageTabs[length - 1].tabIndex + 1 = length == 0 ? length : this.packageTabs[length - 1].tabIndex + 1;
this.packageTabs.push({ this.packageTabs.push({
goodsName: item.packageName, goodsName: item.packageName,
name: "package_" + tabIndex, name: "package_" + tabIndex,
tabIndex: tabIndex, tabIndex,
// goodId: item.id, // goodId: item.id,
info: item info: item,
}) });
this.tabsValue = "package_" + tabIndex this.tabsValue = "package_" + tabIndex;
}) });
this.packageNotice() this.packageNotice();
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err);
}) });
}, },
/* 活动标签切换时触发 */ /* 活动标签切换时触发 */
beforeLeave(currentName, oldName) { beforeLeave(currentName, oldName) {
// console.log("currentName", currentName) // console.log("currentName", currentName)
// 通过tab标签的切换事件触发增加的函数 // 通过tab标签的切换事件触发增加的函数
// 如果name是add,则调用增加tab的函数 // 如果name是add,则调用增加tab的函数
this.currentIndex = currentName this.currentIndex = currentName;
}, },
// 填写套餐名称时通知 // 填写套餐名称时通知
getPackageEditInfo_notice(obj) { getPackageEditInfo_notice(obj) {
console.log("obj", obj) console.log("obj", obj);
this.packageTabs.find((item) => item.tabIndex == obj.idx).info = obj.info this.packageTabs.find(item => item.tabIndex == obj.idx).info = obj.info;
this.packageNotice() this.packageNotice();
}, },
// 初始化、填写套餐名称时、删除套餐时通知 // 初始化、填写套餐名称时、删除套餐时通知
packageNotice() { packageNotice() {
this.packageInfoList = [] this.packageInfoList = [];
this.packageTabs.forEach((item) => { this.packageTabs.forEach((item) => {
if (item.info) { if (item.info) {
console.log(item) console.log(item);
const o = { const o = {
name: item.info.val1 || item.info.packageName, name: item.info.val1 || item.info.packageName,
virtualCode: item.info.timeId, virtualCode: item.info.timeId,
id: item.info.id, id: item.info.id,
packageCode: item.info.packageCode packageCode: item.info.packageCode,
} };
this.packageInfoList.push(o) this.packageInfoList.push(o);
}
})
} }
} });
} },
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../style/editdetailCon.scss"; @import "../../style/editdetailCon.scss";
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
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!