Compare commits
89 Commits
f79fa1dd3d
...
Breach
| Author | SHA1 | Date | |
|---|---|---|---|
| b2ce9d93db | |||
| 8260b345dc | |||
| 2cd59adfc9 | |||
| baa89001c8 | |||
| 9b3c5da105 | |||
| a4c0aca1c2 | |||
| 9f19b8fb66 | |||
| 14ddd2839b | |||
| 6d2d3bda67 | |||
| b48b7749f2 | |||
| 2ba88eff08 | |||
| 6cf6829334 | |||
| 9d52b99414 | |||
| b9f74dc810 | |||
| 1647970bed | |||
| e696f768e6 | |||
| 6b76d36946 | |||
| 8e5f7335d8 | |||
| 5ff42dbbad | |||
| b0c2f28d7f | |||
| 51091d097e | |||
| 86cf54b9de | |||
| 10fb9dd4f2 | |||
| 2979e7e216 | |||
| 288a525537 | |||
| db6433693a | |||
| 99efa8de75 | |||
| d75fd9beb8 | |||
| 094f655634 | |||
| 10c8c7b796 | |||
| ea32a16e5d | |||
| 57be345996 | |||
| 3ed490d6dc | |||
| 1fdd8fe12a | |||
| a6f4c96f1f | |||
| 73c84f7b8d | |||
| 3a529bafa8 | |||
| 822afb422c | |||
| 7e8f272dfe | |||
| 93febd0964 | |||
| 9555bb66fd | |||
| 575a08ed3a | |||
| b3f5178470 | |||
| 859821dfb3 | |||
| d661b77afa | |||
| 676b213a7d | |||
| 600684570a | |||
| 6f0d10b881 | |||
| 4885674f23 | |||
| 3033326def | |||
| 11c1bcc626 | |||
| 2447985cb2 | |||
| 62a4eb0319 | |||
| 1d63829ed6 | |||
| 87c926ebb1 | |||
| 1e6f987172 | |||
| a00a20c4ee | |||
| b030a201a7 | |||
| 5a930ac084 | |||
| be3c724a5e | |||
| f47211b0b0 | |||
| e94ea6b592 | |||
| 328ae8cd55 | |||
| e9a8605073 | |||
| d5792be702 | |||
| e7f9abcc19 | |||
| 7af2ee9e25 | |||
| c261594a25 | |||
| fa2754e124 | |||
| c10b514779 | |||
| d204c7befe | |||
| beec8c6cfb | |||
| 4c06067dd4 | |||
| f87c6b8252 | |||
| d6db489f80 | |||
| 4ad91cabe3 | |||
| d0ad4e56dd | |||
| 04b19bc45d | |||
| 2827d70f65 | |||
| 2f380b1fe5 | |||
| 21ef158ce4 | |||
| 0627caf37c | |||
| 6d22aecc29 | |||
| 4eea8f8a8a | |||
| 2a52e8f0f6 | |||
| 2ba97b83ec | |||
| 71d2432df5 | |||
| 14a536bd1c | |||
| 787703fa12 |
@@ -1,10 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<link rel="icon" href="/NYC_logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue</title>
|
||||
<title>暖洋葱家庭教育数据看板</title>
|
||||
<script defer src="https://umami.nycjy.cn/script.js" data-website-id="0d851950-9420-4c3e-a12a-c221fcf039b5"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
181
my-vue-app/package-lock.json
generated
181
my-vue-app/package-lock.json
generated
@@ -9,6 +9,7 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@fullcalendar/core": "^6.1.19",
|
||||
"axios": "^1.10.0",
|
||||
"chart.js": "^4.5.0",
|
||||
"dompurify": "^3.2.6",
|
||||
@@ -17,11 +18,12 @@
|
||||
"markdown-it": "^14.1.0",
|
||||
"marked": "^16.1.1",
|
||||
"pinia": "^3.0.2",
|
||||
"pnpm": "^10.15.0",
|
||||
"pinia-plugin-persistedstate": "^4.5.0",
|
||||
"vue": "^3.5.17",
|
||||
"vue-chartjs": "^5.3.2",
|
||||
"vue-echarts": "^7.0.3",
|
||||
"vue-router": "^4.5.0"
|
||||
"vue-router": "^4.5.0",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "^22.0.1",
|
||||
@@ -1211,6 +1213,15 @@
|
||||
"integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@fullcalendar/core": {
|
||||
"version": "6.1.19",
|
||||
"resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.19.tgz",
|
||||
"integrity": "sha512-z0aVlO5e4Wah6p6mouM0UEqtRf1MZZPt4mwzEyU6kusaNL+dlWQgAasF2cK23hwT4cmxkEmr4inULXgpyeExdQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"preact": "~10.12.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmmirror.com/@humanfs/core/-/core-0.19.1.tgz",
|
||||
@@ -2823,6 +2834,15 @@
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/adler-32": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
|
||||
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
|
||||
@@ -3031,6 +3051,19 @@
|
||||
],
|
||||
"license": "CC-BY-4.0"
|
||||
},
|
||||
"node_modules/cfb": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
|
||||
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"crc-32": "~1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
|
||||
@@ -3076,6 +3109,15 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/codepage": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
|
||||
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@@ -3137,6 +3179,18 @@
|
||||
"url": "https://github.com/sponsors/mesqueeb"
|
||||
}
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@@ -3209,6 +3263,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/deep-pick-omit": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-pick-omit/-/deep-pick-omit-1.2.1.tgz",
|
||||
"integrity": "sha512-2J6Kc/m3irCeqVG42T+SaUMesaK7oGWaedGnQQK/+O0gYc+2SP5bKh/KKTE7d7SJ+GCA9UUE1GRzh6oDe0EnGw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/default-browser": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/default-browser/-/default-browser-5.2.1.tgz",
|
||||
@@ -3252,6 +3312,12 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/defu": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
|
||||
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
@@ -3261,6 +3327,12 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/destr": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
|
||||
"integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||
@@ -3970,6 +4042,15 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/frac": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
|
||||
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "11.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-11.3.1.tgz",
|
||||
@@ -4583,7 +4664,7 @@
|
||||
},
|
||||
"node_modules/markdown-it": {
|
||||
"version": "14.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/markdown-it/-/markdown-it-14.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
|
||||
"integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -5084,20 +5165,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pnpm": {
|
||||
"version": "10.15.0",
|
||||
"resolved": "https://registry.npmmirror.com/pnpm/-/pnpm-10.15.0.tgz",
|
||||
"integrity": "sha512-SG68JZ0+mZpOhpHOA7XKxKccvso5Nyqbdiy1AM/fCHPiyxar49lRse4s8BJQPwJ7mLZYTk3yJSTgx0UNnseqew==",
|
||||
"node_modules/pinia-plugin-persistedstate": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-4.5.0.tgz",
|
||||
"integrity": "sha512-QTkP1xJVyCdr2I2p3AKUZM84/e+IS+HktRxKGAIuDzkyaKKV48mQcYkJFVVDuvTxlI5j6X3oZObpqoVB8JnWpw==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"pnpm": "bin/pnpm.cjs",
|
||||
"pnpx": "bin/pnpx.cjs"
|
||||
"dependencies": {
|
||||
"deep-pick-omit": "^1.2.1",
|
||||
"defu": "^6.1.4",
|
||||
"destr": "^2.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.12"
|
||||
"peerDependencies": {
|
||||
"@nuxt/kit": ">=3.0.0",
|
||||
"@pinia/nuxt": ">=0.10.0",
|
||||
"pinia": ">=3.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/pnpm"
|
||||
"peerDependenciesMeta": {
|
||||
"@nuxt/kit": {
|
||||
"optional": true
|
||||
},
|
||||
"@pinia/nuxt": {
|
||||
"optional": true
|
||||
},
|
||||
"pinia": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
@@ -5142,6 +5234,16 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/preact": {
|
||||
"version": "10.12.1",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz",
|
||||
"integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/preact"
|
||||
}
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
@@ -5491,6 +5593,18 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ssf": {
|
||||
"version": "0.11.2",
|
||||
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
|
||||
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"frac": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-final-newline": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
|
||||
@@ -6151,6 +6265,24 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/wmf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
|
||||
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
|
||||
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmmirror.com/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||
@@ -6177,6 +6309,27 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/xlsx": {
|
||||
"version": "0.18.5",
|
||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"adler-32": "~1.3.0",
|
||||
"cfb": "~1.2.1",
|
||||
"codepage": "~1.15.0",
|
||||
"crc-32": "~1.2.1",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"bin": {
|
||||
"xlsx": "bin/xlsx.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/xml-name-validator": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
"vue": "^3.5.17",
|
||||
"vue-chartjs": "^5.3.2",
|
||||
"vue-echarts": "^7.0.3",
|
||||
"vue-router": "^4.5.0"
|
||||
"vue-router": "^4.5.0",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "^22.0.1",
|
||||
|
||||
1452
my-vue-app/pnpm-lock.yaml
generated
1452
my-vue-app/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
BIN
my-vue-app/public/NYC_logo.png
Normal file
BIN
my-vue-app/public/NYC_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
@@ -7,7 +7,7 @@ export const getProblemDistribution = (params) => {
|
||||
|
||||
// 今日通话 /api/v1/more_level_screening/today_call
|
||||
export const getTodayCall = (params) => {
|
||||
return https.post('/api/v1/sales/today_call', params)
|
||||
return https.post('/api/v1/sales/current_camp_call', params)
|
||||
}
|
||||
|
||||
// 表格填写率 /api/v1/more_level_screening/table_filling_rate
|
||||
@@ -77,5 +77,12 @@ export const getGoldContactTime = (params) => {
|
||||
export const getAvgCallTime = (params) => {
|
||||
return https.post('/api/v1/sales/get_avg_call_time', params)
|
||||
}
|
||||
// 电话接通率 /api/v1/sales/get_call_success_rate
|
||||
export const getCallSuccessRate = (params) => {
|
||||
return https.post('/api/v1/sales/get_call_success_rate', params)
|
||||
}
|
||||
|
||||
|
||||
// 二阶分析报告
|
||||
export const getSecondOrderAnalysisReport = (params) => {
|
||||
return https.post('/api/v1/sales/get_second_analysis_report', params)
|
||||
}
|
||||
@@ -44,6 +44,22 @@ export const getGroupDetail = (params) => {
|
||||
export const getGroupCallDuration = (params) => {
|
||||
return https.post('/api/v1/manager/group_call_duration', params)
|
||||
}
|
||||
// 二阶分析报告 /api/v1/sales/get_call_text
|
||||
export const GetSecondOrderAnalysisReport = (params) => {
|
||||
return https.post('/api/v1/manager/group_second_report', params)
|
||||
}
|
||||
|
||||
// 通话分类数据 /api/v1/manager/get_member_call_classify
|
||||
export const getMemberCallClassify = (params) => {
|
||||
return https.post('/api/v1/manager/get_member_call_classify', params)
|
||||
}
|
||||
|
||||
// 团队整体三阶分析报告 /api/v1/manager/group_entirety_third_report
|
||||
export const getGroupEntiretyThirdReport = (params) => {
|
||||
return https.post('/api/v1/manager/group_entirety_third_report', params)
|
||||
}
|
||||
|
||||
// 获取优秀录音文件 /api/v1/level_five/overview/get_excellent_record_file
|
||||
export const getExcellentRecordFile = (params) => {
|
||||
return https.post('/api/v1/level_five/overview/get_excellent_record_file', params)
|
||||
}
|
||||
@@ -66,11 +66,30 @@ export const getCampPeriodAdmin = (params) => {
|
||||
}
|
||||
// 获取优秀录音文件 /api/v1/level_four/overview/get_excellent_record_file
|
||||
export const getExcellentRecordFile = (params) => {
|
||||
return https.post('/api/v1/common/get_excellent_record_file', params)
|
||||
return https.post('/api/v1/level_four/overview/get_excellent_record_file', params)
|
||||
}
|
||||
// 修改营期 /api/v1/level_four/overview/change_camp_period
|
||||
export const changeCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/change_camp_period', params)
|
||||
}
|
||||
// 获取历史营期 /api/v1/level_four/overview/get_history_camp_period
|
||||
export const getHistoryCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/get_history_camp_period', params)
|
||||
}
|
||||
// 切换历史营期 /api/v1/level_four/overview/switch_history_camp_period
|
||||
export const switchHistoryCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/switch_history_camp_period', params)
|
||||
}
|
||||
// 返回当前营期 /api/v1/level_four/overview/cancel_switch_history_camp_period
|
||||
export const cancelSwitchHistoryCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/cancel_switch_history_camp_period', params)
|
||||
}
|
||||
|
||||
// 一键导出 api/v1/level_four/overview/export_customers
|
||||
export const exportCustomers = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/export_all_customers_under_sales', params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,11 @@ export const getTimeoutRate = (params) => {
|
||||
export const getTableFillingRate = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/table_filling_rate', params)
|
||||
}
|
||||
// 销售漏斗
|
||||
|
||||
// 销售漏斗 /api/v1/level_three/overview/team_sales_funnel
|
||||
export const getTeamSalesFunnel = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/team_sales_funnel', params)
|
||||
}
|
||||
|
||||
// 客户迫切解决的问题 /api/v1/level_three/overview/urgent_need_to_address
|
||||
export const getUrgentNeedToAddress = (params) => {
|
||||
@@ -66,8 +70,28 @@ export const getTeamRankingInfo = (params) => {
|
||||
export const getAbnormalResponseRate = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/abnormal_response_rate', params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 历史营期 /api/v1/level_three/overview/get_history_camps
|
||||
export const getHistoryCamps = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/get_history_camps', params)
|
||||
}
|
||||
// 数据对比 /api/v1/level_three/overview/get_team_many_target
|
||||
export const getTeamManyTarget = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/get_team_many_target', params)
|
||||
}
|
||||
|
||||
// 优秀录音 /api/v1/level_three/overview/get_current_center_excellent_record_file
|
||||
export const getExcellentRecordFile = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/get_current_center_excellent_record_file', params)
|
||||
}
|
||||
|
||||
// 团队下各组分析报告 /api/v1/level_three/overview/team_every_group_report
|
||||
export const getTeamEveryGroupReport = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/team_every_group_report', params)
|
||||
}
|
||||
|
||||
// 部门整体分析报告 /api/v1/level_three/overview/team_entirety_report
|
||||
export const getTeamEntiretyReport = (params) => {
|
||||
return https.post('/api/v1/level_three/overview/team_entirety_report', params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ export const getDetailedDataTable = (params) => {
|
||||
export const getPeriodStage = (params) => {
|
||||
return https.get('/api/v1/level_five/overview/get_period_stage', params)
|
||||
}
|
||||
// 获取优秀录音文件 /api/v1/level_four/overview/get_excellent_record_file
|
||||
// 获取优秀录音文件 /api/v1/level_five/overview/get_excellent_record_file
|
||||
export const getExcellentRecordFile = (params) => {
|
||||
return https.post('/api/v1/common/get_excellent_record_file', params)
|
||||
return https.post('/api/v1/level_five/overview/get_excellent_record_file', params)
|
||||
}
|
||||
|
||||
|
||||
334
my-vue-app/src/components/FeedbackForm.vue
Normal file
334
my-vue-app/src/components/FeedbackForm.vue
Normal file
@@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<div v-if="isVisible" class="modal-overlay" @click="closeModal">
|
||||
<div class="modal-container" @click.stop>
|
||||
<div class="modal-header">
|
||||
<h3>意见反馈</h3>
|
||||
<button class="modal-close-btn" @click="closeModal">×</button>
|
||||
</div>
|
||||
<div class="feedback-form-container">
|
||||
<h2>意见反馈</h2>
|
||||
<p class="subtitle">我们期待听到您的声音,不断改进我们的产品。</p>
|
||||
|
||||
<!-- 提交成功或失败的提示信息 -->
|
||||
<div v-if="submitStatus === 'success'" class="feedback-message success">
|
||||
✓ 感谢您的反馈!我们已经收到您的宝贵意见。
|
||||
</div>
|
||||
<div v-if="submitStatus === 'error'" class="feedback-message error">
|
||||
✗ 提交失败,请检查网络或稍后重试。
|
||||
</div>
|
||||
|
||||
<form v-if="submitStatus !== 'success'" @submit.prevent="handleSubmit">
|
||||
<!-- 反馈类型 -->
|
||||
<div class="form-group">
|
||||
<label for="feedback-type">反馈类型</label>
|
||||
<select id="feedback-type" v-model="formData.type">
|
||||
<option>功能建议</option>
|
||||
<option>界面优化</option>
|
||||
<option>Bug 反馈</option>
|
||||
<option>其他</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 反馈内容 -->
|
||||
<div class="form-group">
|
||||
<label for="feedback-content">反馈内容 (必填)</label>
|
||||
<textarea
|
||||
id="feedback-content"
|
||||
v-model="formData.content"
|
||||
placeholder="请详细描述您的问题或建议..."
|
||||
rows="6"
|
||||
required
|
||||
></textarea>
|
||||
</div>
|
||||
<!-- 提交按钮 -->
|
||||
<div class="form-actions">
|
||||
<button type="submit" :disabled="isSubmitting">
|
||||
<span v-if="isSubmitting">正在提交...</span>
|
||||
<span v-else>提交反馈</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, reactive } from 'vue';
|
||||
|
||||
// 定义组件的props
|
||||
const props = defineProps({
|
||||
isVisible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
// 定义组件要触发的事件
|
||||
const emit = defineEmits(['submit-feedback', 'close']);
|
||||
|
||||
// 使用 reactive 创建响应式表单数据对象
|
||||
const formData = reactive({
|
||||
type: '功能建议', // 默认值
|
||||
content: '',
|
||||
contact: '',
|
||||
screenshot: null, // 存储文件对象
|
||||
});
|
||||
|
||||
// ref 用于独立的响应式值
|
||||
const isSubmitting = ref(false); // 是否正在提交
|
||||
const submitStatus = ref(null); // 'success', 'error', or null
|
||||
const imagePreviewUrl = ref(null); // 图片预览 URL
|
||||
const fileInputRef = ref(null); // 用于引用文件输入元素
|
||||
|
||||
// 文件选择变化时的处理函数
|
||||
const handleFileChange = (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
formData.screenshot = file;
|
||||
// 创建一个临时的 URL 用于图片预览
|
||||
imagePreviewUrl.value = URL.createObjectURL(file);
|
||||
}
|
||||
};
|
||||
|
||||
// 移除已选图片
|
||||
const removeImage = () => {
|
||||
formData.screenshot = null;
|
||||
imagePreviewUrl.value = null;
|
||||
// 清空文件输入框的值,以便用户可以再次选择相同的文件
|
||||
if (fileInputRef.value) {
|
||||
fileInputRef.value.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
// 关闭模态框
|
||||
const closeModal = () => {
|
||||
emit('close');
|
||||
};
|
||||
|
||||
// 表单提交处理函数
|
||||
const handleSubmit = async () => {
|
||||
// 简单验证
|
||||
if (!formData.content.trim()) {
|
||||
alert('反馈内容不能为空!');
|
||||
return;
|
||||
}
|
||||
|
||||
isSubmitting.value = true;
|
||||
submitStatus.value = null;
|
||||
|
||||
try {
|
||||
// 创建 FormData 对象
|
||||
// 获取 token (假设存储在 localStorage 中)
|
||||
const token = localStorage.getItem('token') || '';
|
||||
|
||||
// 发送 POST 请求到后端接口
|
||||
const response = await axios.post('https://feedback.api.nycjy.cn/api/v1/feedback/submit_feedback', {project:'mldash',type: formData.type, content: formData.content}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
// console.log('响应状态8888:', response.data.message);
|
||||
// 提交成功
|
||||
submitStatus.value = 'success';
|
||||
// 触发父组件的事件,并传递数据
|
||||
emit('submit-feedback', { ...formData });
|
||||
} catch (error) {
|
||||
console.error('提交反馈失败:', error);
|
||||
// 提交失败
|
||||
submitStatus.value = 'error';
|
||||
} finally {
|
||||
// 请求结束
|
||||
isSubmitting.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
background-color: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
max-width: 600px;
|
||||
width: 90%;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 2rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
color: #1a202c;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.modal-close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #718096;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.modal-close-btn:hover {
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.feedback-form-container {
|
||||
padding: 2rem;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
color: #1a202c;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
color: #718096;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 600;
|
||||
color: #4a5568;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
select,
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid #cbd5e0;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
color: #2d3748;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus,
|
||||
select:focus,
|
||||
textarea:focus {
|
||||
outline: none;
|
||||
border-color: #4299e1;
|
||||
box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
margin-top: 1rem;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.image-preview img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.remove-image-btn {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: -10px;
|
||||
background-color: #e53e3e;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button[type="submit"] {
|
||||
padding: 0.75rem 2rem;
|
||||
background-color: #4299e1;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
button[type="submit"]:hover:not(:disabled) {
|
||||
background-color: #3182ce;
|
||||
}
|
||||
|
||||
button[type="submit"]:disabled {
|
||||
background-color: #a0aec0;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.feedback-message {
|
||||
padding: 1rem;
|
||||
border-radius: 6px;
|
||||
text-align: center;
|
||||
margin-bottom: 1.5rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.feedback-message.success {
|
||||
background-color: #c6f6d5;
|
||||
color: #2f855a;
|
||||
border: 1px solid #9ae6b4;
|
||||
}
|
||||
|
||||
.feedback-message.error {
|
||||
background-color: #fed7d7;
|
||||
color: #c53030;
|
||||
border: 1px solid #feb2b2;
|
||||
}
|
||||
</style>
|
||||
@@ -25,6 +25,13 @@
|
||||
</svg>
|
||||
修改密码
|
||||
</div>
|
||||
<div class="dropdown-item" @click="handleDisplaySettings">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" style="margin-right: 8px;">
|
||||
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z" fill="currentColor"/>
|
||||
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z" fill="currentColor"/>
|
||||
</svg>
|
||||
显示设置
|
||||
</div>
|
||||
<div class="dropdown-item logout-item" @click="handleLogout">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" style="margin-right: 8px;">
|
||||
<path d="M6 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H6zM5 3a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V3z" fill="currentColor"/>
|
||||
@@ -148,6 +155,49 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 显示设置弹窗 -->
|
||||
<div v-if="showDisplayModal" class="display-modal-overlay" @click="cancelDisplaySettings">
|
||||
<div class="display-modal" @click.stop>
|
||||
<div class="display-modal-header">
|
||||
<h2>显示设置</h2>
|
||||
<p>选择要显示的模块</p>
|
||||
</div>
|
||||
|
||||
<div class="display-modal-body">
|
||||
<div class="checkbox-group">
|
||||
<label v-for="(visible, key) in localCardVisibility" :key="key" class="checkbox-item">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="localCardVisibility[key]"
|
||||
:disabled="displayLoading"
|
||||
/>
|
||||
<span class="checkbox-label">{{ getCardDisplayName(key) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="display-modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-cancel"
|
||||
@click="cancelDisplaySettings"
|
||||
:disabled="displayLoading"
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-confirm"
|
||||
@click="handleDisplaySubmit"
|
||||
:disabled="displayLoading"
|
||||
>
|
||||
<span v-if="displayLoading" class="loading-spinner"></span>
|
||||
{{ displayLoading ? '应用中...' : '确认应用' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 退出登录确认弹窗 -->
|
||||
<div v-if="showLogoutModal" class="logout-modal-overlay" @click="cancelLogout">
|
||||
<div class="logout-modal" @click.stop>
|
||||
@@ -166,11 +216,28 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import http from '@/utils/https'
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
cardVisibility: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
timeline: true,
|
||||
rawData: true,
|
||||
customerDetail: true,
|
||||
analytics: true,
|
||||
weekAnalysis: true
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(['update-card-visibility'])
|
||||
|
||||
// 路由实例
|
||||
const router = useRouter()
|
||||
|
||||
@@ -192,6 +259,50 @@ const passwordForm = ref({
|
||||
newPassword: ''
|
||||
}) // 修改密码表单数据
|
||||
const passwordLoading = ref(false) // 修改密码加载状态
|
||||
const showDisplayModal = ref(false) // 显示设置弹窗显示状态
|
||||
const displayLoading = ref(false) // 显示设置加载状态
|
||||
const localCardVisibility = reactive({}) // 本地卡片显示状态
|
||||
|
||||
// 监听props变化,同步到本地状态
|
||||
watch(() => props.cardVisibility, (newVal) => {
|
||||
Object.assign(localCardVisibility, newVal)
|
||||
}, { immediate: true, deep: true })
|
||||
|
||||
// 获取卡片显示名称
|
||||
const getCardDisplayName = (key) => {
|
||||
const nameMap = {
|
||||
// sale.vue 页面的卡片
|
||||
timeline: '销售时间线',
|
||||
rawData: '原始数据',
|
||||
customerDetail: '客户详情',
|
||||
analytics: '数据分析',
|
||||
weekAnalysis: '周期分析',
|
||||
// seniorManager.vue 页面的卡片
|
||||
centerOverview: '中心概览',
|
||||
teamAlerts: '团队预警',
|
||||
statisticalIndicators: '统计指标',
|
||||
groupRanking: '组别排名',
|
||||
problemRanking: '问题排名',
|
||||
groupComparison: '组别对比',
|
||||
teamDetail: '团队详情',
|
||||
// secondTop.vue 页面的卡片
|
||||
actionItems: '行动项目',
|
||||
customerType: '客户类型',
|
||||
goodMusic: '优秀录音',
|
||||
// topone.vue 页面的卡片
|
||||
kpiMetrics: '核心业绩指标',
|
||||
salesProgress: '销售实时进度',
|
||||
periodStage: '各中心营期阶段',
|
||||
funnelChart: '转化漏斗',
|
||||
personalSalesRanking: '销售个人业绩排行榜',
|
||||
qualityCalls: '优质通话',
|
||||
rankingList: '业绩排行榜',
|
||||
problemRanking: '客户迫切解决的问题排行榜',
|
||||
campManagement: '营期管理',
|
||||
detailedDataTable: '详细数据表格'
|
||||
}
|
||||
return nameMap[key] || key
|
||||
}
|
||||
|
||||
// 切换下拉菜单显示状态
|
||||
const toggleDropdown = () => {
|
||||
@@ -309,6 +420,39 @@ const cancelPasswordChange = () => {
|
||||
passwordForm.value.newPassword = ''
|
||||
}
|
||||
|
||||
// 显示设置
|
||||
const handleDisplaySettings = () => {
|
||||
console.log('显示设置')
|
||||
showDropdown.value = false
|
||||
showDisplayModal.value = true
|
||||
}
|
||||
|
||||
// 显示设置处理函数
|
||||
const handleDisplaySubmit = async () => {
|
||||
displayLoading.value = true
|
||||
|
||||
try {
|
||||
// 发送事件给父组件更新卡片显示状态
|
||||
emit('update-card-visibility', { ...localCardVisibility })
|
||||
|
||||
// 模拟异步操作
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
||||
showDisplayModal.value = false
|
||||
} catch (error) {
|
||||
console.error('显示设置失败:', error)
|
||||
} finally {
|
||||
displayLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 取消显示设置
|
||||
const cancelDisplaySettings = () => {
|
||||
showDisplayModal.value = false
|
||||
// 恢复到原始状态
|
||||
Object.assign(localCardVisibility, props.cardVisibility)
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = () => {
|
||||
showDropdown.value = false
|
||||
@@ -319,15 +463,21 @@ const handleLogout = () => {
|
||||
const confirmLogout = () => {
|
||||
console.log('用户确认退出登录')
|
||||
|
||||
// 清除用户信息(如果有的话)
|
||||
// localStorage.removeItem('token')
|
||||
// sessionStorage.clear()
|
||||
try {
|
||||
// 清除用户状态
|
||||
userStore.logout()
|
||||
|
||||
// 关闭弹窗
|
||||
showLogoutModal.value = false
|
||||
|
||||
// 跳转到登录页面
|
||||
router.push('/login')
|
||||
} catch (error) {
|
||||
console.error('退出登录失败:', error)
|
||||
// 即使出错也要关闭弹窗并跳转
|
||||
showLogoutModal.value = false
|
||||
router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
// 取消退出登录
|
||||
@@ -649,6 +799,142 @@ const cancelLogout = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 显示设置弹窗样式 */
|
||||
.display-modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.display-modal {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
min-width: 400px;
|
||||
max-width: 500px;
|
||||
animation: modalSlideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.display-modal-header {
|
||||
padding: 24px 24px 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.display-modal-header h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.display-modal-header p {
|
||||
font-size: 14px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.display-modal-body {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.checkbox-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: 6px;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.checkbox-item:hover {
|
||||
background-color: #f8fafc;
|
||||
}
|
||||
|
||||
.checkbox-item input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-right: 12px;
|
||||
cursor: pointer;
|
||||
accent-color: #667eea;
|
||||
}
|
||||
|
||||
.checkbox-item input[type="checkbox"]:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-size: 14px;
|
||||
color: #374151;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.display-modal-footer {
|
||||
padding: 16px 24px 24px 24px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel,
|
||||
.display-modal-footer .btn-confirm {
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border: none;
|
||||
min-width: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel {
|
||||
background: #f8fafc;
|
||||
color: #64748b;
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel:hover:not(:disabled) {
|
||||
background: #f1f5f9;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-confirm {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-confirm:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.display-modal-footer .btn-cancel:disabled,
|
||||
.display-modal-footer .btn-confirm:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* 修改密码弹窗样式 */
|
||||
.password-modal-overlay {
|
||||
position: fixed;
|
||||
|
||||
@@ -11,43 +11,43 @@ const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
redirect: '/sale'
|
||||
redirect: '/login'
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: Login,
|
||||
// meta: { requiresAuth: false }
|
||||
meta: { requiresAuth: false }
|
||||
},
|
||||
{
|
||||
path: '/sale',
|
||||
name: 'Sale',
|
||||
component: Sale,
|
||||
// meta: { requiresAuth: true, minLevel: 1 }
|
||||
meta: { requiresAuth: true, minLevel: 1 }
|
||||
},
|
||||
{
|
||||
path: '/manager',
|
||||
name: 'Manager',
|
||||
component: Manager,
|
||||
// meta: { requiresAuth: true, minLevel: 2 }
|
||||
meta: { requiresAuth: true, minLevel: 2 }
|
||||
},
|
||||
{
|
||||
path: '/senior-manager',
|
||||
name: 'SeniorManager',
|
||||
component: SeniorManager,
|
||||
// meta: { requiresAuth: true, minLevel: 3 }
|
||||
meta: { requiresAuth: true, minLevel: 3 }
|
||||
},
|
||||
{
|
||||
path: '/second-top',
|
||||
name: 'SecondTop',
|
||||
component: SecondTop,
|
||||
// meta: { requiresAuth: true, minLevel: 4 }
|
||||
meta: { requiresAuth: true, minLevel: 4 }
|
||||
},
|
||||
{
|
||||
path: '/top',
|
||||
name: 'Top',
|
||||
component: TopOne,
|
||||
// meta: { requiresAuth: true, minLevel: 5 }
|
||||
meta: { requiresAuth: true, minLevel: 5 }
|
||||
}
|
||||
]
|
||||
|
||||
@@ -57,15 +57,59 @@ const router = createRouter({
|
||||
})
|
||||
|
||||
// 路由守卫
|
||||
router.beforeEach((to, from, next) => {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 检查URL参数中是否包含token和用户信息(来自其他页面的跳转)
|
||||
const urlToken = to.query.token
|
||||
const urlUsername = to.query.username
|
||||
const urlLevel = to.query.level
|
||||
|
||||
// 如果URL中包含token和用户信息,进行自动登录
|
||||
if (urlToken && urlUsername && urlLevel) {
|
||||
try {
|
||||
// 解码用户名(URL编码的中文)
|
||||
const decodedUsername = decodeURIComponent(urlUsername)
|
||||
|
||||
// 直接设置用户信息到store(跳过API验证,因为token来自可信源)
|
||||
userStore.login(urlToken, decodedUsername, parseInt(urlLevel), '', '')
|
||||
|
||||
// 根据用户等级跳转到对应页面
|
||||
const defaultRoutes = {
|
||||
1: '/sale',
|
||||
2: '/manager',
|
||||
3: '/senior-manager',
|
||||
4: '/second-top',
|
||||
5: '/top'
|
||||
}
|
||||
|
||||
const targetRoute = defaultRoutes[parseInt(urlLevel)] || '/sale'
|
||||
|
||||
// 如果当前路由就是目标路由,直接通过;否则重定向
|
||||
if (to.path === targetRoute) {
|
||||
next()
|
||||
} else {
|
||||
next(targetRoute)
|
||||
}
|
||||
return
|
||||
} catch (error) {
|
||||
console.error('自动登录失败:', error)
|
||||
// 如果自动登录失败,继续正常的路由守卫逻辑
|
||||
}
|
||||
}
|
||||
|
||||
// 如果路由不需要认证,直接通过
|
||||
if (!to.meta.requiresAuth) {
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// 如果访问登录页面,始终允许访问(允许重新登录)
|
||||
if (to.path === '/login') {
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// 检查是否已登录
|
||||
if (!userStore.isLoggedIn || !userStore.userInfo) {
|
||||
next('/login')
|
||||
|
||||
135
my-vue-app/src/stores/cache.js
Normal file
135
my-vue-app/src/stores/cache.js
Normal file
@@ -0,0 +1,135 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useCacheStore = defineStore('cache', () => {
|
||||
// 缓存Map
|
||||
const cache = ref(new Map())
|
||||
const CACHE_DURATION = 30 * 60 * 1000 // 30分钟缓存时长
|
||||
|
||||
// 生成缓存键
|
||||
const getCacheKey = (apiName, params = {}) => {
|
||||
const sortedParams = Object.keys(params)
|
||||
.sort()
|
||||
.reduce((result, key) => {
|
||||
result[key] = params[key]
|
||||
return result
|
||||
}, {})
|
||||
return `${apiName}_${JSON.stringify(sortedParams)}`
|
||||
}
|
||||
|
||||
// 检查缓存是否有效
|
||||
const isValidCache = (cacheData) => {
|
||||
return cacheData && (Date.now() - cacheData.timestamp) < CACHE_DURATION
|
||||
}
|
||||
|
||||
// 设置缓存
|
||||
const setCache = (key, data) => {
|
||||
cache.value.set(key, {
|
||||
data,
|
||||
timestamp: Date.now()
|
||||
})
|
||||
}
|
||||
|
||||
// 获取缓存
|
||||
const getCache = (key) => {
|
||||
const cacheData = cache.value.get(key)
|
||||
if (isValidCache(cacheData)) {
|
||||
return cacheData.data
|
||||
}
|
||||
// 如果缓存过期,删除它
|
||||
if (cacheData) {
|
||||
cache.value.delete(key)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// 缓存包装器函数
|
||||
const withCache = async (apiName, apiFunction, params = {}) => {
|
||||
const cacheKey = getCacheKey(apiName, params)
|
||||
const cachedData = getCache(cacheKey)
|
||||
|
||||
if (cachedData) {
|
||||
console.log(`[缓存命中] ${apiName}:`, cachedData)
|
||||
return cachedData
|
||||
}
|
||||
|
||||
console.log(`[API调用] ${apiName}`)
|
||||
const result = await apiFunction(params)
|
||||
setCache(cacheKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
// 清除所有缓存
|
||||
const clearCache = () => {
|
||||
cache.value.clear()
|
||||
console.log('所有缓存已清除')
|
||||
}
|
||||
|
||||
// 清除特定缓存
|
||||
const clearSpecificCache = (apiName, params = {}) => {
|
||||
const key = getCacheKey(apiName, params)
|
||||
cache.value.delete(key)
|
||||
console.log(`已清除缓存: ${key}`)
|
||||
}
|
||||
|
||||
// 获取缓存信息并清理过期缓存
|
||||
const getCacheInfo = () => {
|
||||
const now = Date.now()
|
||||
const validCaches = []
|
||||
const expiredCaches = []
|
||||
|
||||
for (const [key, data] of cache.value.entries()) {
|
||||
if (isValidCache(data)) {
|
||||
validCaches.push({
|
||||
key,
|
||||
timestamp: data.timestamp,
|
||||
age: Math.round((now - data.timestamp) / 1000) + 's'
|
||||
})
|
||||
} else {
|
||||
expiredCaches.push(key)
|
||||
cache.value.delete(key)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
validCount: validCaches.length,
|
||||
expiredCount: expiredCaches.length,
|
||||
validCaches,
|
||||
expiredCaches
|
||||
}
|
||||
}
|
||||
|
||||
// 清除过期缓存
|
||||
const clearExpiredCache = () => {
|
||||
const info = getCacheInfo()
|
||||
console.log(`清理了 ${info.expiredCount} 个过期缓存`)
|
||||
return info
|
||||
}
|
||||
|
||||
// 获取缓存统计信息
|
||||
const getCacheStats = () => {
|
||||
return {
|
||||
totalCount: cache.value.size,
|
||||
duration: CACHE_DURATION / (1000 * 60) + '分钟',
|
||||
...getCacheInfo()
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
// 状态
|
||||
cache,
|
||||
CACHE_DURATION,
|
||||
|
||||
// 方法
|
||||
getCacheKey,
|
||||
isValidCache,
|
||||
setCache,
|
||||
getCache,
|
||||
withCache,
|
||||
clearCache,
|
||||
clearSpecificCache,
|
||||
getCacheInfo,
|
||||
clearExpiredCache,
|
||||
getCacheStats
|
||||
}
|
||||
})
|
||||
@@ -5,8 +5,8 @@ import { useUserStore } from '@/stores/user'
|
||||
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
// baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
|
||||
baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
|
||||
baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
|
||||
// baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
|
||||
timeout: 100000, // 请求超时时间
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
@@ -16,9 +16,6 @@ const service = axios.create({
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// 在发送请求之前做些什么
|
||||
// console.log('发送请求:', config)
|
||||
|
||||
// 添加token到请求头
|
||||
const userStore = useUserStore()
|
||||
const token = userStore.token
|
||||
@@ -32,13 +29,9 @@ service.interceptors.request.use(
|
||||
_t: Date.now()
|
||||
}
|
||||
}
|
||||
|
||||
// 显示加载状态
|
||||
if (config.showLoading !== false) {
|
||||
// 可以在这里添加全局loading
|
||||
console.log('显示加载中...')
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
@@ -48,15 +41,9 @@ service.interceptors.request.use(
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
// 隐藏加载状态
|
||||
// console.log('隐藏加载中...')
|
||||
|
||||
// 对响应数据做点什么
|
||||
// console.log('收到响应:', response)
|
||||
|
||||
const { data, status } = response
|
||||
|
||||
|
||||
@@ -395,6 +395,9 @@ const handleLogin = async () => {
|
||||
loading.value = true
|
||||
errorMessage.value = ''
|
||||
|
||||
// 清除本地存储的用户数据,确保使用最新的登录信息
|
||||
userStore.logout()
|
||||
|
||||
try {
|
||||
// 调用登录API
|
||||
// token检测
|
||||
@@ -552,12 +555,25 @@ const cancelSecuritySetup = () => {
|
||||
}
|
||||
|
||||
// Token验证登录函数
|
||||
const handleTokenLogin = async (token) => {
|
||||
const handleTokenLogin = async (token, username = null, userLevel = null) => {
|
||||
loading.value = true
|
||||
errorMessage.value = ''
|
||||
|
||||
try {
|
||||
// 使用token进行验证登录
|
||||
// 如果URL中包含用户信息,直接使用(跳过API验证)
|
||||
if (username && userLevel) {
|
||||
// 解码用户名
|
||||
const decodedUsername = decodeURIComponent(username)
|
||||
|
||||
// 直接设置用户信息到store
|
||||
userStore.login(token, decodedUsername, parseInt(userLevel), '', '')
|
||||
|
||||
// 根据用户等级跳转到对应页面
|
||||
navigateToUserPage(parseInt(userLevel))
|
||||
return
|
||||
}
|
||||
|
||||
// 使用token进行API验证登录
|
||||
const response = await http.post('/api/v1/token_login', {
|
||||
token: token
|
||||
})
|
||||
@@ -586,9 +602,13 @@ const handleTokenLogin = async (token) => {
|
||||
// 组件挂载时检查路由参数中的token
|
||||
onMounted(() => {
|
||||
const token = route.query.token
|
||||
const username = route.query.username
|
||||
const userLevel = route.query.level
|
||||
|
||||
if (token) {
|
||||
// 如果路由参数中有token,直接进行token验证登录
|
||||
handleTokenLogin(token)
|
||||
// 如果路由参数中有token,进行token验证登录
|
||||
// 如果同时有用户信息,直接使用;否则通过API验证
|
||||
handleTokenLogin(token, username, userLevel)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
1144
my-vue-app/src/views/maneger/components/GoodMusic.vue
Normal file
1144
my-vue-app/src/views/maneger/components/GoodMusic.vue
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
v-for="(member, index) in displayMembers"
|
||||
:key="member.user_name || member.id"
|
||||
class="table-row"
|
||||
:class="{ active: selectedMember && (selectedMember.user_name === member.user_name || selectedMember.id === member.id) }"
|
||||
:class="{ active: selectedMember && selectedMember === member }"
|
||||
@click="selectMember(member)"
|
||||
@dblclick="handleDoubleClick(member)"
|
||||
>
|
||||
|
||||
@@ -91,6 +91,7 @@ const aggregatedAlerts = computed(() => {
|
||||
padding: 0.25rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 0.2rem;
|
||||
|
||||
&.warning {
|
||||
background: #fef3c7;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="team-report">
|
||||
<div class="header-container">
|
||||
<h2>今日团队实时战报</h2>
|
||||
<button class="analysis-button" @click="showTeamAnalysis">团队分析</button>
|
||||
</div>
|
||||
<div class="report-grid">
|
||||
<div class="report-card">
|
||||
<div class="card-header">
|
||||
@@ -32,7 +35,7 @@
|
||||
</div>
|
||||
<div class="report-card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">月度总业绩 <i class="info-icon" @mouseenter="showTooltip('monthlyRevenue', $event)" @mouseleave="hideTooltip">ⓘ</i></span>
|
||||
<span class="card-title">本月成交单数 <i class="info-icon" @mouseenter="showTooltip('monthlyRevenue', $event)" @mouseleave="hideTooltip">ⓘ</i></span>
|
||||
<span class="card-trend positive">+8% vs 上月</span>
|
||||
</div>
|
||||
<div class="card-value">{{ formatCurrency(weekTotalData.week_add_fee_total?.total_add_fee || 0) }} 元</div>
|
||||
@@ -76,6 +79,9 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
// 定义emit
|
||||
const emit = defineEmits(['show-team-analysis'])
|
||||
|
||||
// 监听数据变化,用于调试
|
||||
watch(() => props.weekTotalData, (newData) => {
|
||||
console.log('TeamReport 收到的数据:', newData)
|
||||
@@ -122,8 +128,8 @@ const metricDescriptions = {
|
||||
description: '本期新增的成交订单数量,已确认付款或签约的客户订单。'
|
||||
},
|
||||
monthlyRevenue: {
|
||||
title: '月度总业绩',
|
||||
description: '本月团队累计完成的销售业绩总额,包括所有已确认的订单金额。'
|
||||
title: '本月成交单数',
|
||||
description: '本月团队累计完成的销售订单数量,包括所有已确认的订单。'
|
||||
},
|
||||
conversionRate: {
|
||||
title: '定金转化率',
|
||||
@@ -146,6 +152,11 @@ const showTooltip = (metricType, event) => {
|
||||
const hideTooltip = () => {
|
||||
tooltip.visible = false
|
||||
}
|
||||
|
||||
// 显示团队分析
|
||||
const showTeamAnalysis = () => {
|
||||
emit('show-team-analysis')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -156,11 +167,33 @@ const hideTooltip = () => {
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin: 0 0 1.5rem 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.analysis-button {
|
||||
background: #409eff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 8px 16px;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background: #337ecc;
|
||||
}
|
||||
}
|
||||
|
||||
.report-grid {
|
||||
|
||||
@@ -37,9 +37,11 @@
|
||||
<!-- Top Section - Team Alerts and Today's Report -->
|
||||
<div class="top-section">
|
||||
<!-- Team Alerts -->
|
||||
<TeamAlerts :abnormalData="groupAbnormalResponse" />
|
||||
<!-- <TeamAlerts :abnormalData="groupAbnormalResponse" /> -->
|
||||
<GoodMusic :quality-calls="excellentRecord"
|
||||
/>
|
||||
<!-- Today's Team Report -->
|
||||
<TeamReport :weekTotalData="weekTotalData" />
|
||||
<TeamReport :weekTotalData="weekTotalData" @show-team-analysis="fetchTeamAnalysis" />
|
||||
|
||||
</div>
|
||||
<!-- Sales Funnel Section -->
|
||||
@@ -60,73 +62,47 @@
|
||||
<!-- Right Section -->
|
||||
<div class="right-section">
|
||||
<!-- Member Details -->
|
||||
<MemberDetails :selected-member="selectedMember" />
|
||||
<MemberDetails :selected-member="selectedMember" :memberDetails="memberDetails" />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<!-- 团队分析弹窗 -->
|
||||
<div v-if="showTeamAnalysisModal" class="modal-overlay" @click="showTeamAnalysisModal = false">
|
||||
<div class="modal-content" @click.stop>
|
||||
<div class="modal-header">
|
||||
<h3>团队整体三阶分析报告</h3>
|
||||
<button class="close-button" @click="showTeamAnalysisModal = false">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div v-for="(report, index) in teamAnalysisData" :key="index" class="report-item">
|
||||
<div class="report-meta">
|
||||
<span class="time-range">{{ report.start_time }} 至 {{ report.end_time }}</span>
|
||||
<span class="created-at">生成时间: {{ report.created_at }}</span>
|
||||
</div>
|
||||
<div class="report-content" v-html="formatReportContent(report.report)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import TeamAlerts from "./components/TeamAlerts.vue";
|
||||
import GoodMusic from "./components/GoodMusic.vue";
|
||||
import TeamReport from "./components/TeamReport.vue";
|
||||
import SalesFunnel from "./components/SalesFunnel.vue";
|
||||
import PerformanceRanking from "./components/PerformanceRanking.vue";
|
||||
import MemberDetails from "./components/MemberDetails.vue";
|
||||
import Sale from "../person/Sale.vue";
|
||||
import Sale from "../person/sale.vue";
|
||||
import SalesTimelineWithTaskList from "../person/components/SalesTimelineWithTaskList.vue";
|
||||
import RawDataCards from "../person/components/RawDataCards.vue";
|
||||
import CustomerDetail from "../person/components/CustomerDetail.vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { useRouter } from "vue-router";
|
||||
import {getGroupAbnormalResponse, getWeekTotalCall, getWeekAddCustomerTotal, getWeekAddDealTotal,
|
||||
getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking, getGroupCallDuration} from "@/api/manager.js";
|
||||
|
||||
// 缓存系统
|
||||
const cache = new Map()
|
||||
const CACHE_DURATION = 30 * 60 * 1000 // 30分钟缓存
|
||||
|
||||
// 缓存工具函数
|
||||
function getCacheKey(apiName, params = {}) {
|
||||
return `${apiName}_${JSON.stringify(params)}`
|
||||
}
|
||||
|
||||
function isValidCache(cacheData) {
|
||||
return cacheData && (Date.now() - cacheData.timestamp) < CACHE_DURATION
|
||||
}
|
||||
|
||||
function setCache(key, data) {
|
||||
cache.set(key, {
|
||||
data,
|
||||
timestamp: Date.now()
|
||||
})
|
||||
}
|
||||
|
||||
function getCache(key) {
|
||||
const cacheData = cache.get(key)
|
||||
if (isValidCache(cacheData)) {
|
||||
return cacheData.data
|
||||
}
|
||||
cache.delete(key)
|
||||
return null
|
||||
}
|
||||
|
||||
// 通用缓存包装函数
|
||||
async function withCache(apiName, apiCall, params = {}) {
|
||||
const key = getCacheKey(apiName, params)
|
||||
const cachedData = getCache(key)
|
||||
|
||||
if (cachedData) {
|
||||
console.log(`使用缓存数据: ${key}`)
|
||||
return cachedData
|
||||
}
|
||||
|
||||
console.log(`调用API: ${key}`)
|
||||
const result = await apiCall()
|
||||
setCache(key, result)
|
||||
return result
|
||||
}
|
||||
getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking, getGroupCallDuration,getGroupDetail, getGroupEntiretyThirdReport,getExcellentRecordFile} from "@/api/manager.js";
|
||||
|
||||
// 团队成员数据
|
||||
const teamMembers = [
|
||||
@@ -153,9 +129,10 @@ const userStore = useUserStore();
|
||||
// 获取通用请求参数的函数
|
||||
const getRequestParams = () => {
|
||||
const params = {}
|
||||
// 只从路由参数获取
|
||||
// 从路由参数获取
|
||||
const routeUserLevel = router.currentRoute.value.query.user_level || router.currentRoute.value.params.user_level
|
||||
const routeUserName = router.currentRoute.value.query.user_name || router.currentRoute.value.params.user_name
|
||||
|
||||
// 如果路由有参数,使用路由参数
|
||||
if (routeUserLevel) {
|
||||
params.user_level = routeUserLevel.toString()
|
||||
@@ -164,6 +141,14 @@ const getRequestParams = () => {
|
||||
params.user_name = routeUserName
|
||||
}
|
||||
|
||||
// 如果没有路由参数,使用当前登录用户的信息
|
||||
if (!params.user_level && userStore.userInfo?.user_level) {
|
||||
params.user_level = userStore.userInfo.user_level.toString()
|
||||
}
|
||||
if (!params.user_name && userStore.userInfo?.username) {
|
||||
params.user_name = userStore.userInfo.username
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
@@ -191,14 +176,14 @@ const weekTotalData = ref({
|
||||
pay_deposit_to_money_rate: {},
|
||||
group_funnel: {},
|
||||
group_call_duration: {},
|
||||
});
|
||||
})
|
||||
// 团队异常预警
|
||||
const groupAbnormalResponse = ref({})
|
||||
async function TeamGetGroupAbnormalResponse() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const response = await withCache('getGroupAbnormalResponse', () => getGroupAbnormalResponse(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const response = await getGroupAbnormalResponse(hasParams ? params : undefined)
|
||||
const rawData = response.data
|
||||
|
||||
// 转换数据格式,生成预警消息
|
||||
@@ -206,9 +191,9 @@ async function TeamGetGroupAbnormalResponse() {
|
||||
let alertId = 1
|
||||
|
||||
// 处理严重超时异常人员
|
||||
const timeoutPersons = rawData.erious_timeout_rate_abnorma || []
|
||||
const timeoutPersons = rawData?.serious_timeout_rate_abnorma || []
|
||||
// 处理表格填写异常人员
|
||||
const fillingPersons = rawData.table_filling_abnormal || []
|
||||
const fillingPersons = rawData?.table_filling_abnormal || []
|
||||
|
||||
// 为每个异常人员生成独立的预警消息
|
||||
|
||||
@@ -243,7 +228,7 @@ async function TeamGetGroupAbnormalResponse() {
|
||||
async function TeamGetWeekTotalCall() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getWeekTotalCall', () => getWeekTotalCall(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getWeekTotalCall(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.week_total_call = res.data
|
||||
@@ -253,7 +238,7 @@ async function TeamGetWeekTotalCall() {
|
||||
async function TeamGetGroupCallDuration() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getGroupCallDuration', () => getGroupCallDuration(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getGroupCallDuration(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.group_call_duration = res.data
|
||||
@@ -263,7 +248,7 @@ async function TeamGetGroupCallDuration() {
|
||||
async function TeamGetWeekAddCustomerTotal() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getWeekAddCustomerTotal', () => getWeekAddCustomerTotal(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getWeekAddCustomerTotal(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.week_add_customer_total = res.data
|
||||
@@ -273,20 +258,61 @@ async function TeamGetWeekAddCustomerTotal() {
|
||||
async function TeamGetWeekAddDealTotal() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getWeekAddDealTotal', () => getWeekAddDealTotal(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getWeekAddDealTotal(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.week_add_deal_total = res.data
|
||||
}
|
||||
}
|
||||
// 月度总业绩
|
||||
// 优秀录音
|
||||
// 获取优秀录音
|
||||
const excellentRecord = ref([]);
|
||||
// 获取优秀录音文件
|
||||
async function CentergetGoodRecord() {
|
||||
console.log('CentergetGoodRecord 开始执行')
|
||||
try {
|
||||
const params = getRequestParams()
|
||||
const params1 = {
|
||||
user_level: userStore.userInfo?.user_level?.toString() || '',
|
||||
user_name: userStore.userInfo?.username || ''
|
||||
}
|
||||
|
||||
// 检查参数是否有效
|
||||
const hasParams = params.user_name && params.user_level
|
||||
const requestParams = hasParams ? {
|
||||
...params,
|
||||
} : params1
|
||||
|
||||
console.log('CentergetGoodRecord request params:', requestParams)
|
||||
|
||||
// 验证必要参数是否存在
|
||||
if (!requestParams.user_name || !requestParams.user_level) {
|
||||
console.error("缺少必要的请求参数:", requestParams);
|
||||
return;
|
||||
}
|
||||
|
||||
// 直接发送请求,不使用缓存
|
||||
const res = await getExcellentRecordFile(requestParams)
|
||||
console.log(972872132,res)
|
||||
if (res && res.code === 200 && res.data) {
|
||||
excellentRecord.value = res.data || []
|
||||
console.log('获取优秀录音成功:', res.data)
|
||||
} else {
|
||||
console.error("获取优秀录音失败,响应数据不完整:", res);
|
||||
excellentRecord.value = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取优秀录音失败:", error);
|
||||
excellentRecord.value = []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 定金转化
|
||||
async function TeamGetWeekAddFeeTotal() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getPayDepositToMoneyRate', () => getPayDepositToMoneyRate(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getPayDepositToMoneyRate(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.pay_deposit_to_money_rate = res.data
|
||||
@@ -296,7 +322,7 @@ async function TeamGetWeekAddFeeTotal() {
|
||||
async function TeamGetGroupFunnel() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getGroupFunnel', () => getGroupFunnel(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getGroupFunnel(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
weekTotalData.value.group_funnel = res.data
|
||||
@@ -321,7 +347,7 @@ const groupRanking = ref({})
|
||||
async function TeamGetGroupRanking() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const res = await withCache('getGroupRanking', () => getGroupRanking(hasParams ? params : undefined), hasParams ? params : {})
|
||||
const res = await getGroupRanking(hasParams ? params : undefined)
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
groupRanking.value = res.data
|
||||
@@ -331,107 +357,121 @@ async function TeamGetGroupRanking() {
|
||||
const memberDetails = ref({})
|
||||
|
||||
|
||||
// 团队分析数据
|
||||
const teamAnalysisData = ref([])
|
||||
const showTeamAnalysisModal = ref(false)
|
||||
|
||||
// 当前选中的成员,默认为空
|
||||
const selectedMember = ref(null);
|
||||
|
||||
// 选择成员函数
|
||||
const selectMember = (member) => {
|
||||
selectedMember.value = member;
|
||||
console.log(122331,member)
|
||||
TeamGetGroupDetail(member.user_name)
|
||||
};
|
||||
|
||||
// 缓存管理功能
|
||||
// 清除所有缓存
|
||||
function clearCache() {
|
||||
cache.clear()
|
||||
console.log('所有缓存已清除')
|
||||
// 成员详细数据
|
||||
async function TeamGetGroupDetail(member) {
|
||||
const res = await getGroupDetail({user_name:member})
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
memberDetails.value = res.data
|
||||
/**
|
||||
* add_customer_count:32
|
||||
call_count:96
|
||||
month_order_count:5
|
||||
total_call_duration_hour
|
||||
:
|
||||
1.92
|
||||
user_name
|
||||
:
|
||||
"李晓雪"
|
||||
week_order_count
|
||||
:
|
||||
2
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
// 清除特定缓存
|
||||
function clearSpecificCache(apiName, params = {}) {
|
||||
const key = getCacheKey(apiName, params)
|
||||
cache.delete(key)
|
||||
console.log(`已清除缓存: ${key}`)
|
||||
}
|
||||
// 获取团队分析数据
|
||||
const fetchTeamAnalysis = async () => {
|
||||
try {
|
||||
showTeamAnalysisModal.value = true
|
||||
|
||||
// 获取缓存信息并清理过期缓存
|
||||
function getCacheInfo() {
|
||||
const now = Date.now()
|
||||
const validCaches = []
|
||||
const expiredCaches = []
|
||||
const params = getRequestParams()
|
||||
const response = await getGroupEntiretyThirdReport(params)
|
||||
|
||||
for (const [key, data] of cache.entries()) {
|
||||
if (isValidCache(data)) {
|
||||
validCaches.push({
|
||||
key,
|
||||
timestamp: data.timestamp,
|
||||
age: Math.round((now - data.timestamp) / 1000) + 's'
|
||||
})
|
||||
// 根据API响应结构调整数据处理逻辑
|
||||
if (response.data) {
|
||||
if (Array.isArray(response.data)) {
|
||||
// 如果response.data本身就是数组
|
||||
teamAnalysisData.value = response.data
|
||||
} else if (response.data.data && Array.isArray(response.data.data)) {
|
||||
// 如果response.data.data是数组
|
||||
teamAnalysisData.value = response.data.data
|
||||
} else {
|
||||
expiredCaches.push(key)
|
||||
cache.delete(key)
|
||||
// 其他情况,可能是单个对象
|
||||
teamAnalysisData.value = [response.data]
|
||||
}
|
||||
}
|
||||
|
||||
console.log('有效缓存:', validCaches)
|
||||
console.log('已清理过期缓存:', expiredCaches)
|
||||
|
||||
return {
|
||||
validCount: validCaches.length,
|
||||
expiredCount: expiredCaches.length,
|
||||
validCaches,
|
||||
expiredCaches
|
||||
} catch (error) {
|
||||
console.error('获取团队分析数据失败:', error)
|
||||
teamAnalysisData.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 强制刷新所有数据(清除缓存并重新调用所有API)
|
||||
async function forceRefreshAllData() {
|
||||
console.log('开始强制刷新所有数据...')
|
||||
clearCache()
|
||||
// 格式化报告内容
|
||||
const formatReportContent = (content) => {
|
||||
if (!content || content === "None") {
|
||||
return "<p>暂无分析报告内容</p>";
|
||||
}
|
||||
|
||||
// 重新调用所有API
|
||||
await Promise.all([
|
||||
TeamGetGroupAbnormalResponse(),
|
||||
TeamGetWeekTotalCall(),
|
||||
TeamGetGroupCallDuration(),
|
||||
TeamGetWeekAddCustomerTotal(),
|
||||
TeamGetWeekAddDealTotal(),
|
||||
TeamGetWeekAddFeeTotal(),
|
||||
TeamGetGroupFunnel(),
|
||||
TeamGetGroupRanking()
|
||||
])
|
||||
// 处理报告内容,保留换行和基本格式
|
||||
let formattedContent = content
|
||||
// 替换连续的换行符
|
||||
.replace(/\n\s*\n/g, '</p><p>')
|
||||
// 替换单个换行符为<br>
|
||||
.replace(/\n/g, '<br>')
|
||||
// 替换Markdown风格的标题为HTML标签
|
||||
.replace(/^### (.*?)(<br>|$)/gim, '<h3>$1</h3>')
|
||||
.replace(/^## (.*?)(<br>|$)/gim, '<h2>$1</h2>')
|
||||
.replace(/^# (.*?)(<br>|$)/gim, '<h1>$1</h1>')
|
||||
// 替换粗体
|
||||
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
|
||||
// 替换斜体
|
||||
.replace(/\*(.*?)\*/g, '<em>$1</em>')
|
||||
// 替换无序列表项
|
||||
.replace(/^\* (.*?)(<br>|$)/gim, '<li>$1</li>');
|
||||
|
||||
console.log('所有数据刷新完成')
|
||||
// 包装列表项到<ul>标签中
|
||||
formattedContent = formattedContent.replace(/(<li>.*?<\/li>)+/g, '<ul>$&</ul>');
|
||||
|
||||
// 处理段落
|
||||
if (!formattedContent.startsWith('<p>')) {
|
||||
formattedContent = '<p>' + formattedContent;
|
||||
}
|
||||
if (!formattedContent.endsWith('</p>')) {
|
||||
formattedContent = formattedContent + '</p>';
|
||||
}
|
||||
|
||||
// 清理多余的<br>标签
|
||||
formattedContent = formattedContent.replace(/<br><\/p>/g, '</p>');
|
||||
|
||||
return formattedContent;
|
||||
}
|
||||
|
||||
// 团队异常预警
|
||||
|
||||
onMounted(async () => {
|
||||
// 输出缓存状态信息
|
||||
console.log('Manager页面缓存系统已初始化,缓存时长:', CACHE_DURATION / (1000 * 60), '分钟')
|
||||
|
||||
await TeamGetGroupAbnormalResponse()
|
||||
await TeamGetWeekTotalCall()
|
||||
await TeamGetGroupCallDuration()
|
||||
await TeamGetWeekAddCustomerTotal()
|
||||
await TeamGetWeekAddDealTotal()
|
||||
await TeamGetWeekAddFeeTotal()
|
||||
await TeamGetGroupFunnel()
|
||||
await TeamGetGroupRanking()
|
||||
|
||||
// 输出初始缓存信息
|
||||
getCacheInfo()
|
||||
|
||||
// 开发环境下暴露缓存管理函数到全局对象,方便调试
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
window.managerCache = {
|
||||
clearCache,
|
||||
clearSpecificCache,
|
||||
getCacheInfo,
|
||||
forceRefreshAllData,
|
||||
cache
|
||||
}
|
||||
console.log('开发模式:缓存管理函数已暴露到 window.managerCache')
|
||||
}
|
||||
CentergetGoodRecord()
|
||||
TeamGetGroupAbnormalResponse()
|
||||
TeamGetWeekTotalCall()
|
||||
TeamGetGroupCallDuration()
|
||||
TeamGetWeekAddCustomerTotal()
|
||||
TeamGetWeekAddDealTotal()
|
||||
TeamGetWeekAddFeeTotal()
|
||||
TeamGetGroupFunnel()
|
||||
TeamGetGroupRanking()
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -748,12 +788,12 @@ onMounted(async () => {
|
||||
.top-section {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 3fr;
|
||||
gap: 1rem;
|
||||
gap: 0.5rem;
|
||||
|
||||
// PC端保持一致布局
|
||||
@media (min-width: 1024px) {
|
||||
grid-template-columns: 1fr 3fr;
|
||||
gap: 1.5rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
// 平板端适配
|
||||
@@ -778,7 +818,7 @@ onMounted(async () => {
|
||||
.analytics-section {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
// PC端保持一致布局
|
||||
@@ -1952,5 +1992,267 @@ onMounted(async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 团队分析弹窗样式 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 1rem 1.5rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.close-button:hover {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1.5rem;
|
||||
overflow-y: auto;
|
||||
max-height: calc(90vh - 80px);
|
||||
}
|
||||
|
||||
.report-item {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.report-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.report-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.9rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.report-content {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.report-content :deep(h1),
|
||||
.report-content :deep(h2),
|
||||
.report-content :deep(h3),
|
||||
.report-content :deep(h4),
|
||||
.report-content :deep(h5),
|
||||
.report-content :deep(h6) {
|
||||
margin: 1.5rem 0 1rem 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.report-content :deep(h1) {
|
||||
font-size: 1.75rem;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(h2) {
|
||||
font-size: 1.5rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(h3) {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.report-content :deep(p) {
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
.report-content :deep(ul),
|
||||
.report-content :deep(ol) {
|
||||
margin: 0.75rem 0;
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(li) {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.report-content :deep(strong) {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.report-content :deep(em) {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
/* 团队分析弹窗 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 1rem 1.5rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.close-button:hover {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1.5rem;
|
||||
overflow-y: auto;
|
||||
max-height: calc(90vh - 80px);
|
||||
}
|
||||
|
||||
.report-item {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.report-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.report-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.9rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.report-content {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.report-content :deep(h1),
|
||||
.report-content :deep(h2),
|
||||
.report-content :deep(h3),
|
||||
.report-content :deep(h4),
|
||||
.report-content :deep(h5),
|
||||
.report-content :deep(h6) {
|
||||
margin: 1.5rem 0 1rem 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.report-content :deep(h1) {
|
||||
font-size: 1.75rem;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(h2) {
|
||||
font-size: 1.5rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(h3) {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.report-content :deep(p) {
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
.report-content :deep(ul),
|
||||
.report-content :deep(ol) {
|
||||
margin: 0.75rem 0;
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.report-content :deep(li) {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.report-content :deep(strong) {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.report-content :deep(em) {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
<button
|
||||
@click="startSopAnalysis"
|
||||
class="analysis-button sop-button"
|
||||
:disabled="isSopAnalysisLoading"
|
||||
:disabled="!hasCallData"
|
||||
>
|
||||
{{ isSopAnalysisLoading ? 'SOP分析中...' : 'SOP通话分析' }}
|
||||
{{ hasCallData ? 'SOP通话分析' : '暂无20分钟通话数据'}}
|
||||
</button>
|
||||
<!-- <button
|
||||
<button
|
||||
@click="startDemandAnalysis"
|
||||
class="analysis-button demand-button"
|
||||
:disabled="isDemandAnalysisLoading"
|
||||
>
|
||||
{{ isDemandAnalysisLoading ? '诉求分析中...' : '客户诉求分析' }}
|
||||
</button> -->
|
||||
{{ isDemandAnalysisLoading ? '数据分析中...' : '总通话分析' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,21 +65,21 @@
|
||||
</div>
|
||||
|
||||
<!-- 下方整行区域 -->
|
||||
<!-- <div class="bottom-row">
|
||||
<div class="bottom-row">
|
||||
<div class="analysis-section demand-analysis">
|
||||
<div class="section-header">
|
||||
<h4>客户诉求分析</h4>
|
||||
<h4>总通话分析</h4>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
<div class="text-content" v-if="demandAnalysisResult">
|
||||
<div class="analysis-text" v-html="formattedDemandAnalysis"></div>
|
||||
</div>
|
||||
<div class="placeholder-text" v-else>
|
||||
<p>点击"客户诉求分析"按钮开始深度分析客户需求和诉求</p>
|
||||
<p>点击"总通话分析"按钮开始深度分析该客户的所有通话</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { SimpleChatService } from '@/utils/ChatService.js';
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import https from '@/utils/https'
|
||||
import axios from 'axios'
|
||||
|
||||
// 定义props
|
||||
const props = defineProps({
|
||||
@@ -102,8 +104,8 @@ const props = defineProps({
|
||||
default: null
|
||||
},
|
||||
formInfo: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
chatRecords: {
|
||||
type: Array,
|
||||
@@ -127,7 +129,7 @@ const isDemandAnalysisLoading = ref(false); // 诉求分析加载状态
|
||||
|
||||
// Dify API配置
|
||||
const DIFY_API_KEY_01 = 'app-h4uBo5kOGoiYhjuBF1AHZi8b'; //基础信息分析
|
||||
const DIFY_API_KEY = 'app-ZIJSFWbcdZLufkwCp9RrvpUR';
|
||||
const DIFY_API_KEY = 'app-ZIJSFWbcdZLufkwCp9RrvpUR'; // 总通话分析
|
||||
// 初始化ChatService
|
||||
const chatService_01 = new SimpleChatService(DIFY_API_KEY_01);
|
||||
const chatService = new SimpleChatService(DIFY_API_KEY);
|
||||
@@ -157,6 +159,11 @@ const formattedDemandAnalysis = computed(() => {
|
||||
return md.render(demandAnalysisResult.value);
|
||||
});
|
||||
|
||||
// 计算属性:检查是否有20分钟通话数据
|
||||
const hasCallData = computed(() => {
|
||||
return props.callRecords && props.callRecords.some(call => call && call.record_tag === '20分钟通话');
|
||||
});
|
||||
|
||||
// 监听selectedContact变化,重置所有分析结果
|
||||
watch(() => props.selectedContact, (newContact) => {
|
||||
if (newContact) {
|
||||
@@ -179,181 +186,115 @@ watch(() => props.selectedContact, (newContact) => {
|
||||
}, { immediate: true });
|
||||
|
||||
// 基础信息分析
|
||||
const startBasicAnalysis = async () => {
|
||||
if (!props.selectedContact) return;
|
||||
// const startBasicAnalysis = async () => {
|
||||
// if (!props.selectedContact) return;
|
||||
|
||||
isBasicAnalysisLoading.value = true;
|
||||
basicAnalysisResult.value = '';
|
||||
// isBasicAnalysisLoading.value = true;
|
||||
// basicAnalysisResult.value = '';
|
||||
|
||||
// 构建表单信息
|
||||
const formData = props.formInfo || {};
|
||||
let formInfoText = '暂无表单信息';
|
||||
// // 构建表单信息
|
||||
// const formData = props.formInfo || [];
|
||||
// let formInfoText = '暂无表单信息';
|
||||
|
||||
if (Object.keys(formData).length > 0) {
|
||||
console.log(888888,formData);
|
||||
const allInfo = [];
|
||||
// // ** 适配新的 formInfo 数组格式 **
|
||||
// if (Array.isArray(formData) && formData.length > 0) {
|
||||
// const allInfo = [];
|
||||
|
||||
// 处理第一种格式:基础信息和additional_info
|
||||
if (formData.name || formData.mobile || formData.additional_info) {
|
||||
const basicInfo = [];
|
||||
const additionalInfo = [];
|
||||
// // 遍历新格式: [{ question_label: "...", answer: "..." }, ...]
|
||||
// formData.forEach(item => {
|
||||
// // 检查字段是否存在且答案有效
|
||||
// if (
|
||||
// item.question_label &&
|
||||
// item.answer &&
|
||||
// item.answer !== '暂无' &&
|
||||
// item.answer !== ''
|
||||
// ) {
|
||||
// // 格式化为 "问题标签: 答案"
|
||||
// allInfo.push(`${item.question_label.trim()}: ${item.answer.trim()}`);
|
||||
// }
|
||||
// });
|
||||
|
||||
// 处理基础信息字段
|
||||
const basicFields = {
|
||||
name: '姓名',
|
||||
mobile: '手机号',
|
||||
occupation: '职业',
|
||||
territory: '地区',
|
||||
child_name: '孩子姓名',
|
||||
child_gender: '孩子性别',
|
||||
child_education: '孩子教育阶段',
|
||||
child_relation: '与孩子关系'
|
||||
};
|
||||
// // 格式化表单信息文本
|
||||
// formInfoText = allInfo.length > 0
|
||||
// ? `=== 问卷/表单信息 ===\n${allInfo.join('\n')}`
|
||||
// : '暂无有效问卷/表单信息';
|
||||
// }
|
||||
// // ** 适配结束 **
|
||||
|
||||
Object.entries(basicFields).forEach(([key, label]) => {
|
||||
if (formData[key] && formData[key] !== '暂无' && formData[key] !== '') {
|
||||
basicInfo.push(`${label}: ${formData[key]}`);
|
||||
}
|
||||
});
|
||||
// // 构建聊天记录信息
|
||||
// const chatData = props.chatRecords || [];
|
||||
// const chatInfoText = chatData.messages && chatData.messages.length > 0 ?
|
||||
// `聊天记录数量: ${chatData.messages.length}条\n最近聊天内容: ${JSON.stringify(chatData.messages.slice(-3), null, 2)}` :
|
||||
// '暂无聊天记录';
|
||||
|
||||
// 处理 additional_info 数组
|
||||
if (formData.additional_info && Array.isArray(formData.additional_info)) {
|
||||
formData.additional_info.forEach(item => {
|
||||
if (item.topic && item.answer) {
|
||||
additionalInfo.push(`${item.topic}\n答案: ${item.answer}`);
|
||||
}
|
||||
});
|
||||
// // 构建通话记录信息
|
||||
// const callData = props.callRecords || [];
|
||||
// const callInfoText = callData.length > 0 ?
|
||||
// `通话记录数量: ${callData.length}次\n通话记录详情: ${JSON.stringify(callData, null, 2)}` :
|
||||
// '暂无通话记录';
|
||||
|
||||
// const query = `请对客户进行基础信息分析:
|
||||
// 客户姓名:${props.selectedContact.name}
|
||||
// 联系电话:${props.selectedContact.phone || '未提供'}
|
||||
// 销售阶段:${props.selectedContact.salesStage || '未知'}
|
||||
|
||||
// === 表单信息 ===
|
||||
// ${formInfoText}
|
||||
|
||||
// === 聊天记录 ===
|
||||
// ${chatInfoText}
|
||||
|
||||
// === 通话记录 ===
|
||||
// ${callData.length > 0 && callData[0].record_context ? callData[0].record_context : callInfoText}
|
||||
|
||||
// 请基于以上客户的表单信息、聊天记录和通话记录,分析客户的基本情况、背景信息和初步画像。`;
|
||||
|
||||
// try {
|
||||
// await chatService_01.sendMessage(
|
||||
// query,
|
||||
// (update) => {
|
||||
// basicAnalysisResult.value = update.content;
|
||||
// },
|
||||
// () => {
|
||||
// isBasicAnalysisLoading.value = false;
|
||||
// console.log('基础信息分析完成');
|
||||
// }
|
||||
// );
|
||||
// } catch (error) {
|
||||
// console.error('基础信息分析失败:', error);
|
||||
// basicAnalysisResult.value = `分析失败: ${error.message}`;
|
||||
// isBasicAnalysisLoading.value = false;
|
||||
// }
|
||||
// };
|
||||
const startBasicAnalysis=async ()=>{
|
||||
console.log("客户基础信息:", props.selectedContact);
|
||||
const res=await https.post('api/v1/sales_timeline/get_customer_basic_info',{
|
||||
user_name:props.selectedContact.name,
|
||||
phone:props.selectedContact.phone
|
||||
})
|
||||
if(res.data){
|
||||
basicAnalysisResult.value = res.data;
|
||||
console.log("客户基础信息分析结果:", res);
|
||||
}else{
|
||||
basicAnalysisResult.value = '基础信息暂无数据'
|
||||
}
|
||||
|
||||
// 添加基础信息
|
||||
if (basicInfo.length > 0) {
|
||||
allInfo.push('=== 基础信息 ===');
|
||||
allInfo.push(...basicInfo);
|
||||
}
|
||||
|
||||
// 添加问卷信息
|
||||
if (additionalInfo.length > 0) {
|
||||
allInfo.push('\n=== 问卷信息 ===');
|
||||
allInfo.push(...additionalInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理第二种格式:customerExpandFieldMap
|
||||
if (formData.customerExpandFieldMap) {
|
||||
const expandInfo = [];
|
||||
const map = formData.customerExpandFieldMap;
|
||||
|
||||
// 处理所有expand字段
|
||||
Object.entries(map).forEach(([key, value]) => {
|
||||
// 跳过原型链上的属性
|
||||
if (!map.hasOwnProperty(key)) return;
|
||||
|
||||
// 如果是对象类型(包含key和typeCode的字段)
|
||||
if (value && typeof value === 'object' && value.key) {
|
||||
const question = value.key;
|
||||
let answer = '';
|
||||
|
||||
// 根据不同的类型处理答案
|
||||
if (value.typeCode === 'SINGLE_SELECT' || value.typeCode === 'MULTIPLE_SELECT') {
|
||||
if (value.expandValueList && value.expandValueList.length > 0) {
|
||||
answer = value.expandValueList.map(item => item.itemName).join('、');
|
||||
}
|
||||
} else if (value.typeCode === 'TEXT' || value.typeCode === 'TEXTAREA' || value.typeCode === 'NUMBER') {
|
||||
// 直接从formData中获取对应的expand值
|
||||
answer = formData[key] || '';
|
||||
}
|
||||
|
||||
// 只添加有答案的问题
|
||||
if (answer && answer !== '暂无' && answer !== '') {
|
||||
expandInfo.push(`${question}\n答案: ${answer}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 添加扩展信息
|
||||
if (expandInfo.length > 0) {
|
||||
if (allInfo.length > 0) allInfo.push('\n'); // 如果已有其他信息,添加分隔行
|
||||
allInfo.push('=== 问卷详细信息 ===');
|
||||
allInfo.push(...expandInfo);
|
||||
}
|
||||
}
|
||||
|
||||
formInfoText = allInfo.length > 0 ? allInfo.join('\n') : '暂无表单信息';
|
||||
}
|
||||
|
||||
// 构建聊天记录信息
|
||||
const chatData = props.chatRecords || [];
|
||||
const chatInfoText = chatData.messages.length > 0 ?
|
||||
`聊天记录数量: ${chatData.messages.length}条\n最近聊天内容: ${JSON.stringify(chatData.messages.slice(-3), null, 2)}` :
|
||||
'暂无聊天记录';
|
||||
|
||||
// 构建通话记录信息
|
||||
const callData = props.callRecords || [];
|
||||
const callInfoText = callData.length > 0 ?
|
||||
`通话记录数量: ${callData.length}次\n通话记录详情: ${JSON.stringify(callData, null, 2)}` :
|
||||
'暂无通话记录';
|
||||
|
||||
const query = `请对客户进行基础信息分析:
|
||||
客户姓名:${props.selectedContact.name}
|
||||
联系电话:${props.selectedContact.phone || '未提供'}
|
||||
销售阶段:${props.selectedContact.salesStage || '未知'}
|
||||
|
||||
=== 表单信息 ===
|
||||
${formInfoText}
|
||||
|
||||
=== 聊天记录 ===
|
||||
${chatInfoText}
|
||||
|
||||
=== 通话记录 ===
|
||||
${callData.length > 0 && callData[0].record_context ? callData[0].record_context : callInfoText}
|
||||
|
||||
请基于以上客户的表单信息、聊天记录和通话记录,分析客户的基本情况、背景信息和初步画像。`;
|
||||
|
||||
console.log(888888,formInfoText);
|
||||
try {
|
||||
await chatService_01.sendMessage(
|
||||
query,
|
||||
(update) => {
|
||||
basicAnalysisResult.value = update.content;
|
||||
},
|
||||
() => {
|
||||
isBasicAnalysisLoading.value = false;
|
||||
console.log('基础信息分析完成');
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('基础信息分析失败:', error);
|
||||
basicAnalysisResult.value = `分析失败: ${error.message}`;
|
||||
isBasicAnalysisLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
// SOP通话分析
|
||||
const startSopAnalysis = async () => {
|
||||
if (!props.selectedContact) return;
|
||||
|
||||
isSopAnalysisLoading.value = true;
|
||||
sopAnalysisResult.value = '';
|
||||
// 构建通话记录信息
|
||||
const callData = props.callRecords || [];
|
||||
const callInfoText = callData.length > 0 ?
|
||||
`通话记录数量: ${callData.length}次\n通话记录详情: ${JSON.stringify(callData, null, 2)}` :
|
||||
'暂无通话记录';
|
||||
const query = `=== 通话记录 ===
|
||||
${callData.length > 0 && callData[0].record_context ? callData[0].record_context : callInfoText}`;
|
||||
|
||||
|
||||
try {
|
||||
await chatService.sendMessage(
|
||||
query,
|
||||
(update) => {
|
||||
sopAnalysisResult.value = update.content;
|
||||
},
|
||||
() => {
|
||||
isSopAnalysisLoading.value = false;
|
||||
console.log('SOP通话分析完成');
|
||||
const res = await axios.get('https://analysis.api.nycjy.cn/api/v1/call', {
|
||||
params: {
|
||||
wechat_id: props.selectedContact.wechat_id
|
||||
}
|
||||
);
|
||||
});
|
||||
sopAnalysisResult.value = res.data.report_content;
|
||||
isSopAnalysisLoading.value = false;
|
||||
} catch (error) {
|
||||
console.error('SOP通话分析失败:', error);
|
||||
sopAnalysisResult.value = `分析失败: ${error.message}`;
|
||||
@@ -361,30 +302,31 @@ ${callData.length > 0 && callData[0].record_context ? callData[0].record_context
|
||||
}
|
||||
};
|
||||
|
||||
// 客户诉求分析
|
||||
// 总通话分析
|
||||
const startDemandAnalysis = async () => {
|
||||
console.log("所有通话记录:", props.callRecords);
|
||||
if (!props.selectedContact) return;
|
||||
|
||||
isDemandAnalysisLoading.value = true;
|
||||
demandAnalysisResult.value = '';
|
||||
|
||||
const query = `请对客户 ${props.selectedContact.name} 进行深度诉求分析:
|
||||
// 1. 检查并拼接所有通话记录,为每次通话添加清晰的标签和区分
|
||||
let allCallTexts = '暂无通话记录';
|
||||
if (props.callRecords && props.callRecords.length > 0) {
|
||||
allCallTexts = props.callRecords
|
||||
.map((call, index) => {
|
||||
// 为每段通话记录构建一个结构化的“信息头”,包含序号、标签和时间
|
||||
return `--- 通话记录 ${index + 1} ---\n标签: ${call.record_tag || '无'}\n时间: ${call.record_create_time || '未知'}\n\n内容:\n${call.record_context}`;
|
||||
})
|
||||
.join('\n\n'); // 使用两个换行符清晰地分隔不同的通话记录
|
||||
}
|
||||
|
||||
请从以下维度分析客户的真实需求和诉求:
|
||||
1. 显性需求分析(客户明确表达的需求)
|
||||
2. 隐性需求挖掘(潜在的、未明确表达的需求)
|
||||
3. 痛点识别(客户面临的主要问题和挑战)
|
||||
4. 决策因素分析(影响客户决策的关键因素)
|
||||
5. 价值期望(客户期望获得的价值和收益)
|
||||
6. 风险顾虑(客户可能的担忧和顾虑)
|
||||
7. 个性化建议(针对性的解决方案建议)
|
||||
|
||||
客户信息:
|
||||
姓名:${props.selectedContact.name}
|
||||
公司:${props.selectedContact.company || '未提供'}
|
||||
职位:${props.selectedContact.position || '未提供'}
|
||||
销售阶段:${props.selectedContact.salesStage || '未知'}
|
||||
健康度:${props.selectedContact.health || '未知'}%`;
|
||||
// 2. 构建一个详细的、结构化的分析指令
|
||||
const query = `
|
||||
请基于以下该客户的所有通话记录,进行全面深入的分析:
|
||||
=== 全部通话记录 ===
|
||||
${allCallTexts}
|
||||
`;
|
||||
|
||||
try {
|
||||
await chatService.sendMessage(
|
||||
@@ -394,11 +336,11 @@ const startDemandAnalysis = async () => {
|
||||
},
|
||||
() => {
|
||||
isDemandAnalysisLoading.value = false;
|
||||
console.log('客户诉求分析完成');
|
||||
console.log('总通话分析完成');
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('客户诉求分析失败:', error);
|
||||
console.error('总通话分析失败:', error);
|
||||
demandAnalysisResult.value = `分析失败: ${error.message}`;
|
||||
isDemandAnalysisLoading.value = false;
|
||||
}
|
||||
@@ -871,12 +813,18 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Markdown样式
|
||||
.analysis-text {
|
||||
|
||||
// Markdown样式
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
:deep(h1),
|
||||
:deep(h2),
|
||||
:deep(h3),
|
||||
:deep(h4),
|
||||
:deep(h5),
|
||||
:deep(h6) {
|
||||
margin: 1rem 0 0.5rem 0;
|
||||
font-weight: 600;
|
||||
color: $slate-800;
|
||||
@@ -886,14 +834,31 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
|
||||
h1 { font-size: 1.25rem; }
|
||||
h2 { font-size: 1.125rem; }
|
||||
h3 { font-size: 1rem; }
|
||||
h4 { font-size: 0.875rem; }
|
||||
h5 { font-size: 0.75rem; }
|
||||
h6 { font-size: 0.75rem; }
|
||||
:deep(h1) {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
p {
|
||||
:deep(h2) {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
:deep(h3) {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
:deep(h4) {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
:deep(h5) {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
:deep(h6) {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
:deep(p) {
|
||||
margin: 0.5rem 0;
|
||||
|
||||
&:first-child {
|
||||
@@ -905,7 +870,8 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
:deep(ul),
|
||||
:deep(ol) {
|
||||
margin: 0.5rem 0;
|
||||
padding-left: 1.5rem;
|
||||
|
||||
@@ -914,23 +880,24 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
|
||||
blockquote {
|
||||
:deep(blockquote) {
|
||||
margin: 1rem 0;
|
||||
padding: 0.5rem 1rem;
|
||||
border-left: 4px solid $blue;
|
||||
background: rgba(59, 130, 246, 0.05);
|
||||
font-style: italic;
|
||||
color: $slate-600;
|
||||
}
|
||||
|
||||
code {
|
||||
:deep(code) {
|
||||
background: $slate-100;
|
||||
padding: 0.125rem 0.25rem;
|
||||
border-radius: 0.25rem;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 0.8rem;
|
||||
color: $indigo;
|
||||
}
|
||||
|
||||
pre {
|
||||
:deep(pre) {
|
||||
background: $slate-100;
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
@@ -943,16 +910,16 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
|
||||
strong {
|
||||
:deep(strong) {
|
||||
font-weight: 600;
|
||||
color: $slate-800;
|
||||
}
|
||||
|
||||
em {
|
||||
:deep(em) {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
a {
|
||||
:deep(a) {
|
||||
color: $blue;
|
||||
text-decoration: none;
|
||||
|
||||
@@ -961,18 +928,19 @@ $purple: #a855f7;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
:deep(hr) {
|
||||
margin: 1.5rem 0;
|
||||
border: none;
|
||||
border-top: 1px solid $slate-200;
|
||||
}
|
||||
|
||||
table {
|
||||
:deep(table) {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 1rem 0;
|
||||
|
||||
th, td {
|
||||
th,
|
||||
td {
|
||||
padding: 0.5rem;
|
||||
border: 1px solid $slate-200;
|
||||
text-align: left;
|
||||
@@ -1069,8 +1037,6 @@ h4 {
|
||||
background-color: $white;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
// padding: 1rem;
|
||||
// margin-top: 12px;
|
||||
}
|
||||
|
||||
// 分析区域布局优化
|
||||
@@ -1109,5 +1075,4 @@ h4 {
|
||||
min-height: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<div class="personal-dashboard">
|
||||
<!-- 头部标题 -->
|
||||
<div class="dashboard-header">
|
||||
<div class="dashboard-header" style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<h2>个人工作仪表板</h2>
|
||||
<button @click="showSecondOrderAnalysisReport">阶段分析报告</button>
|
||||
</div>
|
||||
|
||||
<!-- 核心KPI & 统计卡片 -->
|
||||
@@ -13,10 +14,10 @@
|
||||
<div class="kpi-grid">
|
||||
<div class="kpi-item">
|
||||
<div class="kpi-value">{{ props.kpiData.totalCalls }}</div>
|
||||
<p>今日通话 <i class="info-icon" @mouseenter="showTooltip('totalCalls', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<p>本期通话 <i class="info-icon" @mouseenter="showTooltip('totalCalls', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item">
|
||||
<div class="kpi-value">{{ props.kpiData.successRate }}%</div>
|
||||
<div class="kpi-value">{{ props.kpiData.successRate }}</div>
|
||||
<p>电话接通率 <i class="info-icon" @mouseenter="showTooltip('successRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item">
|
||||
@@ -105,6 +106,29 @@
|
||||
:description="tooltip.description"
|
||||
/>
|
||||
|
||||
<!-- 阶段分析报告弹框 -->
|
||||
<div v-if="showAnalysisModal" class="modal-overlay" @click.self="closeAnalysisModal">
|
||||
<div class="modal-container">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">阶段分析报告</h3>
|
||||
<button class="modal-close-btn" @click="closeAnalysisModal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="analysis-content">
|
||||
<div v-if="!analysisReport || Object.keys(analysisReport).length === 0" class="loading-message">正在生成分析报告...</div>
|
||||
<div v-else-if="Array.isArray(analysisReport) && analysisReport.length === 0" class="error-message">数据为空</div>
|
||||
<div v-else-if="Array.isArray(analysisReport)">
|
||||
<div v-for="(report, index) in analysisReport" :key="index" class="report-section">
|
||||
<h4>{{ report.name }} ({{ report.start_time }} 至 {{ report.end_time }})</h4>
|
||||
<div v-html="report.report.replace(/\n/g, '<br>')"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="error-message">数据格式错误</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -114,11 +138,34 @@ import { ref, reactive, onMounted, onBeforeUnmount, computed, watch } from 'vue'
|
||||
import StatisticData from './StatisticData.vue';
|
||||
import * as echarts from 'echarts';
|
||||
import Chart from 'chart.js/auto';
|
||||
import {getTableFillingRate,getAverageResponseTime,getWeeklyActiveCommunicationRate,getTimeoutResponseRate} from "@/api/api.js"
|
||||
import {getSecondOrderAnalysisReport} from "@/api/api.js"
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { useRouter } from "vue-router";
|
||||
import { SimpleChatService } from '@/utils/ChatService.js';
|
||||
|
||||
// 用户store
|
||||
const userStore = useUserStore();
|
||||
// 路由实例
|
||||
const router = useRouter();
|
||||
|
||||
const Dify_API_Key_02 = 'app-MGaBOx5QFblsMZ7dSkxKJDKm'
|
||||
const chatService_02= new SimpleChatService(Dify_API_Key_02)
|
||||
|
||||
// 获取通用请求参数的函数
|
||||
const getRequestParams = () => {
|
||||
const params = {}
|
||||
// 只从路由参数获取
|
||||
const routeUserLevel = router.currentRoute.value.query.user_level || router.currentRoute.value.params.user_level
|
||||
const routeUserName = router.currentRoute.value.query.user_name || router.currentRoute.value.params.user_name
|
||||
// 如果路由有参数,使用路由参数
|
||||
if (routeUserLevel) {
|
||||
params.user_level = routeUserLevel.toString()
|
||||
}
|
||||
if (routeUserName) {
|
||||
params.user_name = routeUserName
|
||||
}
|
||||
return params
|
||||
}
|
||||
// 定义props
|
||||
const props = defineProps({
|
||||
kpiData: {
|
||||
@@ -159,9 +206,20 @@ const props = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
async function CenterGetSecondOrderAnalysisReport() {
|
||||
const params = getRequestParams()
|
||||
const res = await getSecondOrderAnalysisReport(params)
|
||||
if (res.code === 200) {
|
||||
console.log(11111,res.data)
|
||||
analysisReport.value = res.data
|
||||
}
|
||||
}
|
||||
// Chart.js 实例
|
||||
const chartInstances = {};
|
||||
|
||||
// 添加组件挂载状态跟踪
|
||||
const isComponentMounted = ref(true);
|
||||
|
||||
// DOM 元素引用
|
||||
const personalFunnelChartCanvas = ref(null);
|
||||
const contactTimeChartCanvas = ref(null);
|
||||
@@ -177,18 +235,26 @@ const tooltip = reactive({
|
||||
|
||||
// 指标说明配置
|
||||
const kpiDescriptions = {
|
||||
totalCalls: {
|
||||
title: '本期通话',
|
||||
description: '本期总共通话的次数。'
|
||||
},
|
||||
successRate: {
|
||||
title: '电话接通率',
|
||||
description: '拨通电话 ÷ 拨打的电话'
|
||||
},
|
||||
avgDuration: {
|
||||
title: '平均通话时长',
|
||||
description: '所有通话总时长 ÷ 拨打电话次数。'
|
||||
description: '所有通话总时长 ÷ 拨打的电话次数。'
|
||||
},
|
||||
conversionRate: {
|
||||
title: '成交转化率',
|
||||
description: '成交人数 ÷ 本期总数据。'
|
||||
},
|
||||
assignedData: {
|
||||
title: '本期分配数据',
|
||||
description: '本期内分配到的数据总量。'
|
||||
},
|
||||
wechatAddRate: {
|
||||
title: '加微率',
|
||||
description: '加微人数 ÷ 本期数据总人数'
|
||||
@@ -218,7 +284,8 @@ const createOrUpdateChart = (chartId, canvasRef, config) => {
|
||||
if (chartInstances[chartId]) {
|
||||
chartInstances[chartId].destroy();
|
||||
}
|
||||
if (canvasRef.value) {
|
||||
// 确保组件仍然挂载且canvas引用存在
|
||||
if (isComponentMounted.value && canvasRef.value) {
|
||||
const ctx = canvasRef.value.getContext('2d');
|
||||
chartInstances[chartId] = new Chart(ctx, config);
|
||||
}
|
||||
@@ -226,6 +293,9 @@ const createOrUpdateChart = (chartId, canvasRef, config) => {
|
||||
|
||||
// Chart.js: 渲染销售漏斗图
|
||||
const renderPersonalFunnelChart = () => {
|
||||
// 确保组件仍然挂载
|
||||
if (!isComponentMounted.value) return;
|
||||
|
||||
const config = {
|
||||
type: 'bar',
|
||||
data: {
|
||||
@@ -250,6 +320,9 @@ const renderPersonalFunnelChart = () => {
|
||||
|
||||
// Chart.js: 渲染黄金联络时段图
|
||||
const renderContactTimeChart = () => {
|
||||
// 确保组件仍然挂载
|
||||
if (!isComponentMounted.value) return;
|
||||
|
||||
if (!props.contactTimeData || !props.contactTimeData.gold_contact_success_rate) {
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +379,20 @@ const hideTooltip = () => {
|
||||
tooltip.visible = false;
|
||||
};
|
||||
|
||||
// 阶段分析报告模态框状态
|
||||
const showAnalysisModal = ref(false);
|
||||
// 阶段分析报告数据
|
||||
const analysisReport = ref({});
|
||||
// 显示阶段分析报告模态框
|
||||
const showSecondOrderAnalysisReport = () => {
|
||||
showAnalysisModal.value = true;
|
||||
CenterGetSecondOrderAnalysisReport()
|
||||
};
|
||||
|
||||
// 关闭阶段分析报告模态框
|
||||
const closeAnalysisModal = () => {
|
||||
showAnalysisModal.value = false;
|
||||
};
|
||||
|
||||
watch(() => props.contactTimeData, () => {
|
||||
renderContactTimeChart();
|
||||
@@ -315,11 +401,13 @@ watch(() => props.contactTimeData, () => {
|
||||
// --- 生命周期钩子 ---
|
||||
|
||||
onMounted(() => {
|
||||
isComponentMounted.value = true;
|
||||
renderPersonalFunnelChart();
|
||||
renderContactTimeChart();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
isComponentMounted.value = false;
|
||||
Object.values(chartInstances).forEach(chart => chart.destroy());
|
||||
});
|
||||
</script>
|
||||
@@ -511,7 +599,7 @@ $white: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 20px 16px;
|
||||
padding: 10px 20px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
h3 { margin: 0; color: $slate-900; font-size: 18px; font-weight: 600; }
|
||||
}
|
||||
@@ -705,7 +793,14 @@ $white: #ffffff;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -735,4 +830,163 @@ $white: #ffffff;
|
||||
position: relative;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
/* 模态框样式 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
width: 90%;
|
||||
max-width: 600px;
|
||||
max-height: 60vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-right: auto; // 将标题推到最左边
|
||||
}
|
||||
|
||||
.modal-close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
color: #909399;
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 16px; // 与按钮组保持间距
|
||||
flex-shrink: 0;
|
||||
|
||||
|
||||
&:hover {
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.period-switcher {
|
||||
display: flex;
|
||||
flex-shrink: 0; // 防止按钮组在空间不足时被压缩
|
||||
}
|
||||
|
||||
.period-switcher button {
|
||||
padding: 6px 14px;
|
||||
border: 1px solid #dcdfe6;
|
||||
background: white;
|
||||
border-radius: 0;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
transition: all 0.3s ease;
|
||||
margin-left: -1px; // 让边框重叠,形成一体化效果
|
||||
|
||||
&:first-child {
|
||||
border-radius: 4px 0 0 4px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: #a0cfff;
|
||||
color: #409eff;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #409eff;
|
||||
border-color: #409eff;
|
||||
color: white;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.analysis-content h4 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 15px;
|
||||
color: #303133;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.analysis-content p {
|
||||
color: #606266;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: #f56c6c;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
border: 1px solid #f56c6c;
|
||||
border-radius: 4px;
|
||||
background-color: #fef0f0;
|
||||
}
|
||||
|
||||
.loading-message {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.report-section {
|
||||
margin-bottom: 20px;
|
||||
padding: 15px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
|
||||
.report-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.report-section h4 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 15px;
|
||||
color: #303133;
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -14,16 +14,30 @@
|
||||
</svg>
|
||||
</div>
|
||||
<h3 class="card-title">表单信息</h3>
|
||||
<div class="form-filter">
|
||||
<button
|
||||
v-for="option in formFilterOptions"
|
||||
:key="option"
|
||||
class="form-filter-btn"
|
||||
:class="{ active: formFilter === option }"
|
||||
@click="formFilter = option"
|
||||
>
|
||||
{{ option }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div v-for="(section, sectionIndex) in displayedFormSections" :key="sectionIndex" class="form-section">
|
||||
<div v-if="section.title" class="form-section-title">{{ section.title }}</div>
|
||||
<div class="form-data-list">
|
||||
<div v-for="(field, index) in formFields" :key="index" class="form-field">
|
||||
<div v-for="(field, index) in section.fields" :key="index" class="form-field">
|
||||
<span class="field-label">{{ field.label }}:</span>
|
||||
<span class="field-value">{{ field.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 聊天记录和通话录音卡片 -->
|
||||
<div class="data-card communication-card">
|
||||
@@ -70,7 +84,7 @@
|
||||
<span class="content-time">最新: {{ chatData.lastMessage }}</span>
|
||||
</div>
|
||||
<div class="message-list">
|
||||
<div v-for="(message, index) in props.chatInfo.messages" :key="index" class="message-item">
|
||||
<div v-for="(message, index) in props.chatInfo?.messages" :key="index" class="message-item">
|
||||
<div class="message-header">
|
||||
<span class="message-sender">{{ message.format_direction }}</span>
|
||||
<span class="message-time">{{ message.format_add_time }}</span>
|
||||
@@ -89,11 +103,25 @@
|
||||
<div class="call-list">
|
||||
<div v-for="(call, index) in callRecords" :key="index" class="call-item">
|
||||
<div class="call-header">
|
||||
<div class="header-main" style="display: flex; flex-direction: row;">
|
||||
<div class="user-info">
|
||||
<span class="call-type">用户: {{ call.user_name }}</span>
|
||||
<span class="call-duration">客户: {{ call.customer_name }}</span>
|
||||
<span class="call-time">录音文件: {{ call.record_file_addr_list?.length || 0 }} 个</span>
|
||||
</div>
|
||||
<div class="header-tags">
|
||||
<span class="call-tag" :class="{
|
||||
'tag-20min': call.record_tag === '20分钟通话',
|
||||
'tag-invalid': call.record_tag === '无效通话',
|
||||
'tag-other': call.record_tag !== '20分钟通话' && call.record_tag !== '无效通话'
|
||||
}" v-if="call.record_tag">{{ call.record_tag }}</span>
|
||||
<!-- 分数移到类型标签后面 -->
|
||||
<span class="stat-value" :class="getScoreClass(call.score)">{{ call.score }}分</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="call-time">{{ formatDateTime(call.record_create_time) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="call-actions">
|
||||
<div class="action-buttons">
|
||||
<button class="action-btn download-btn" @click="downloadRecording(call)">
|
||||
<i class="icon-download"></i>
|
||||
录音下载
|
||||
@@ -102,6 +130,9 @@
|
||||
<i class="icon-view"></i>
|
||||
查看原文
|
||||
</button>
|
||||
<!-- 时长移到操作按钮后面 -->
|
||||
<span class="call-duration">{{ formatCallDuration(call.call_duration) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,7 +146,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import axios from 'axios'
|
||||
|
||||
// Props
|
||||
@@ -125,8 +156,8 @@ const props = defineProps({
|
||||
default: () => ({})
|
||||
},
|
||||
formInfo: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
chatInfo: {
|
||||
type: Object,
|
||||
@@ -139,7 +170,7 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(['analyze-sop'])
|
||||
const emit = defineEmits(['analyze-sop', 'show-modal', 'show-download-modal'])
|
||||
|
||||
// 当前激活的tab
|
||||
const activeTab = ref('chat')
|
||||
@@ -149,21 +180,50 @@ const chatMessages = computed(() => {
|
||||
return props.chatInfo?.messages || []
|
||||
})
|
||||
|
||||
// 表单字段数据
|
||||
const formFields = computed(() => {
|
||||
const formFilter = ref('全部')
|
||||
|
||||
const formSections = computed(() => {
|
||||
const formData = props.formInfo
|
||||
if (!formData || Object.keys(formData).length === 0) {
|
||||
return [
|
||||
const emptyFields = [
|
||||
{ label: '姓名', value: '暂无数据' },
|
||||
{ label: '联系方式', value: '暂无数据' },
|
||||
{ label: '孩子信息', value: '暂无数据' },
|
||||
{ label: '地区', value: '暂无数据' }
|
||||
]
|
||||
|
||||
const makeSection = (fields, title = '表单信息') => [{ title, fields }]
|
||||
|
||||
const buildFieldsFromAnswers = (answers = []) => {
|
||||
return answers.map(item => ({
|
||||
label: item.question_label,
|
||||
value: item.answer || '暂无回答'
|
||||
}))
|
||||
}
|
||||
|
||||
let dataArray = null
|
||||
if (Array.isArray(formData)) {
|
||||
dataArray = formData
|
||||
} else if (formData && Array.isArray(formData.data)) {
|
||||
dataArray = formData.data
|
||||
}
|
||||
|
||||
if (Array.isArray(dataArray) && dataArray.length > 0) {
|
||||
if (dataArray[0].form_title && Array.isArray(dataArray[0].answers)) {
|
||||
return dataArray.map(form => ({
|
||||
title: form.form_title || '表单信息',
|
||||
fields: buildFieldsFromAnswers(form.answers || [])
|
||||
}))
|
||||
}
|
||||
if (dataArray[0].question_label && Object.prototype.hasOwnProperty.call(dataArray[0], 'answer')) {
|
||||
return makeSection(buildFieldsFromAnswers(dataArray))
|
||||
}
|
||||
}
|
||||
|
||||
if (!formData || (typeof formData === 'object' && Object.keys(formData).length === 0)) {
|
||||
return makeSection(emptyFields)
|
||||
}
|
||||
|
||||
let fields = []
|
||||
|
||||
// 检查是否为第一种格式(包含name, mobile等字段)
|
||||
if (formData.name || formData.mobile || formData.child_name) {
|
||||
const customerInfo = [formData.name, formData.mobile, formData.child_relation, formData.occupation].filter(item => item && item !== '暂无').join(' | ')
|
||||
const childInfo = [formData.child_name, formData.child_gender, formData.child_education].filter(item => item && item !== '暂无').join(' | ')
|
||||
@@ -174,7 +234,6 @@ const formFields = computed(() => {
|
||||
{ label: '地区', value: formData.territory || '暂无' }
|
||||
]
|
||||
|
||||
// 如果有additional_info,添加所有问题
|
||||
if (formData.additional_info && Array.isArray(formData.additional_info)) {
|
||||
formData.additional_info.forEach((item) => {
|
||||
fields.push({
|
||||
@@ -184,7 +243,6 @@ const formFields = computed(() => {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 第二种格式(expandXXX字段)
|
||||
const customerInfo = [formData.expandTwentyOne, formData.expandOne].filter(item => item && item !== '暂无').join(' | ')
|
||||
const childInfo = [formData.expandTwentyNine, formData.expandTwentyFive, formData.expandTwo].filter(item => item && item !== '暂无').join(' | ')
|
||||
|
||||
@@ -200,12 +258,30 @@ const formFields = computed(() => {
|
||||
{ label: '预期时间', value: formData.expandThirty || '暂无' }
|
||||
]
|
||||
}
|
||||
// 合并表单数据和聊天数据
|
||||
const allFields = [...fields]
|
||||
|
||||
return allFields
|
||||
return makeSection(fields)
|
||||
})
|
||||
|
||||
const formFilterOptions = computed(() => {
|
||||
const titles = formSections.value.map(section => section.title).filter(Boolean)
|
||||
const uniqueTitles = Array.from(new Set(titles))
|
||||
if (uniqueTitles.length <= 1) return ['全部']
|
||||
return ['全部', ...uniqueTitles]
|
||||
})
|
||||
|
||||
const displayedFormSections = computed(() => {
|
||||
if (formFilter.value === '全部') return formSections.value
|
||||
const filtered = formSections.value.filter(section => section.title === formFilter.value)
|
||||
return filtered.length > 0 ? filtered : formSections.value
|
||||
})
|
||||
|
||||
watch(formFilterOptions, (options) => {
|
||||
if (!options.includes(formFilter.value)) {
|
||||
formFilter.value = options[0] || '全部'
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
|
||||
// 聊天数据
|
||||
const chatData = computed(() => ({
|
||||
count: props.chatInfo?.messages?.length || 0,
|
||||
@@ -220,74 +296,169 @@ const callData = computed(() => ({
|
||||
|
||||
// 通话记录列表
|
||||
const callRecords = computed(() => {
|
||||
console.log('RawDataCards - props.callInfo:', props.callInfo)
|
||||
|
||||
// 从 props.callInfo 中获取真实的通话记录数据
|
||||
if (props.callInfo && Array.isArray(props.callInfo)) {
|
||||
console.log('RawDataCards - callInfo is array:', props.callInfo)
|
||||
console.log('通话记录:', props.callInfo)
|
||||
return props.callInfo
|
||||
}
|
||||
|
||||
// 如果 callInfo 是单个对象(API返回的数据格式)
|
||||
if (props.callInfo && typeof props.callInfo === 'object' && props.callInfo.user_name) {
|
||||
console.log('RawDataCards - callInfo is single object:', props.callInfo)
|
||||
return [props.callInfo] // 将单个对象包装成数组
|
||||
}
|
||||
|
||||
// 如果 callInfo 是对象且包含数据数组
|
||||
if (props.callInfo && props.callInfo.data && Array.isArray(props.callInfo.data)) {
|
||||
console.log('RawDataCards - callInfo.data is array:', props.callInfo.data)
|
||||
return props.callInfo.data
|
||||
if (props.callInfo && props.callInfo && Array.isArray(props.callInfo)) {
|
||||
return props.callInfo
|
||||
}
|
||||
|
||||
console.log('RawDataCards - no valid call data found, returning empty array')
|
||||
// 如果没有数据,返回空数组
|
||||
return []
|
||||
})
|
||||
|
||||
// 新增:格式化通话时长的方法
|
||||
const formatCallDuration = (durationInMinutes) => {
|
||||
if (typeof durationInMinutes !== 'number' || durationInMinutes < 0) {
|
||||
return '暂无';
|
||||
}
|
||||
const totalSeconds = Math.round(durationInMinutes * 60);
|
||||
const minutes = Math.floor(totalSeconds / 60);
|
||||
const seconds = totalSeconds % 60;
|
||||
return `${minutes}分${seconds}秒`;
|
||||
};
|
||||
|
||||
// 新增:根据分数获取CSS类的方法
|
||||
const getScoreClass = (score) => {
|
||||
if (score >= 80) {
|
||||
return 'score-high';
|
||||
} else if (score >= 60) {
|
||||
return 'score-medium';
|
||||
} else {
|
||||
return 'score-low';
|
||||
}
|
||||
};
|
||||
|
||||
// 录音下载方法
|
||||
const downloadRecording = (call) => {
|
||||
const downloadRecording = async (call) => {
|
||||
console.log('下载录音:', call)
|
||||
|
||||
// 检查是否有录音文件地址
|
||||
if (call.record_file_addr_list && call.record_file_addr_list.length > 0) {
|
||||
const recordingUrl = call.record_file_addr_list[0]
|
||||
if (call.record_file_addr) {
|
||||
const recordingUrl = call.record_file_addr
|
||||
|
||||
// 从URL中提取文件名
|
||||
const urlParts = recordingUrl.split('/')
|
||||
const fileName = urlParts[urlParts.length - 1]
|
||||
try {
|
||||
// 显示下载开始提示
|
||||
emit('show-download-modal', '下载提示', '正在下载录音文件,请稍候...')
|
||||
|
||||
// 创建下载链接
|
||||
// 若为 HTTPS 页面请求 HTTP 资源,浏览器会拦截,回退为在新标签页打开
|
||||
if (window.location.protocol === 'https:' && recordingUrl.startsWith('http://')) {
|
||||
const parts = recordingUrl.split('/')
|
||||
const fallbackName = parts[parts.length - 1] || 'recording'
|
||||
const link = document.createElement('a')
|
||||
link.href = recordingUrl
|
||||
link.download = fileName
|
||||
link.target = '_blank'
|
||||
|
||||
// 触发下载
|
||||
link.rel = 'noopener'
|
||||
link.download = fallbackName
|
||||
link.style.display = 'none'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
emit('show-download-modal', '提示', '目标为不安全的HTTP资源,已在新标签页打开下载链接。')
|
||||
return
|
||||
}
|
||||
|
||||
console.log(`正在下载录音文件: ${fileName}`)
|
||||
// 通过请求的方式下载
|
||||
const response = await fetch(recordingUrl, {
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
credentials: 'omit',
|
||||
redirect: 'follow',
|
||||
referrerPolicy: 'no-referrer'
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`下载失败,状态码: ${response.status}`)
|
||||
}
|
||||
|
||||
// 从响应头或URL中提取文件名
|
||||
let fileName = 'recording'
|
||||
const disposition = response.headers.get('content-disposition')
|
||||
if (disposition) {
|
||||
const match = disposition.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i)
|
||||
if (match) fileName = decodeURIComponent(match[1] || match[2])
|
||||
}
|
||||
if (!fileName || fileName === 'recording') {
|
||||
try {
|
||||
const urlObj = new URL(recordingUrl, window.location.href)
|
||||
const segments = urlObj.pathname.split('/')
|
||||
fileName = segments[segments.length - 1] || 'recording'
|
||||
} catch (e) {
|
||||
const parts = recordingUrl.split('/')
|
||||
fileName = parts[parts.length - 1] || 'recording'
|
||||
}
|
||||
}
|
||||
|
||||
const blob = await response.blob()
|
||||
const objectUrl = URL.createObjectURL(blob)
|
||||
|
||||
const a = document.createElement('a')
|
||||
a.href = objectUrl
|
||||
a.download = fileName
|
||||
a.style.display = 'none'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
setTimeout(() => URL.revokeObjectURL(objectUrl), 1000)
|
||||
|
||||
// 下载成功提示
|
||||
emit('show-download-modal', '下载成功', '录音文件下载完成!')
|
||||
} catch (error) {
|
||||
console.error('下载录音文件失败:', error)
|
||||
|
||||
// 回退:尝试在新标签页直接打开原始链接(适用于CORS或其他限制)
|
||||
try {
|
||||
const link = document.createElement('a')
|
||||
link.href = recordingUrl
|
||||
link.target = '_blank'
|
||||
link.rel = 'noopener'
|
||||
link.style.display = 'none'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
emit('show-download-modal', '提示', '无法直接下载,已在新标签页打开录音链接。')
|
||||
} catch (e) {
|
||||
emit('show-download-modal', '下载失败', '下载录音文件失败,请检查网络连接或文件是否存在')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert('该通话记录暂无录音文件')
|
||||
emit('show-download-modal', '提示', '该通话记录暂无录音文件')
|
||||
}
|
||||
}
|
||||
|
||||
// 查看原文方法
|
||||
const viewTranscript = async (call) => {
|
||||
// 触发SOP分析
|
||||
emit('analyze-sop', {
|
||||
type: 'call',
|
||||
data: call,
|
||||
content: call.record_context || ''
|
||||
})
|
||||
const title = '通话原文内容'
|
||||
const content = call.record_context || '该通话记录暂无原文内容'
|
||||
|
||||
// 显示通话记录内容
|
||||
if (call.record_context) {
|
||||
alert(call.record_context)
|
||||
} else {
|
||||
alert('该通话记录暂无原文内容')
|
||||
emit('show-modal', { title, content })
|
||||
}
|
||||
|
||||
// 时间格式化方法
|
||||
const formatDateTime = (dateTimeString) => {
|
||||
if (!dateTimeString) return '暂无时间'
|
||||
|
||||
try {
|
||||
const date = new Date(dateTimeString)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
} catch (error) {
|
||||
console.error('时间格式化错误:', error)
|
||||
return dateTimeString
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -378,6 +549,58 @@ const viewTranscript = async (call) => {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.form-filter {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.form-filter-btn {
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid #e5e7eb;
|
||||
background: #ffffff;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #6b7280;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.form-filter-btn.active {
|
||||
border-color: #10b981;
|
||||
color: #059669;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
|
||||
.form-filter-btn:hover {
|
||||
color: #059669;
|
||||
border-color: #a7f3d0;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.form-section + .form-section {
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px dashed #e5e7eb;
|
||||
}
|
||||
|
||||
.form-section-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
background: #f0fdf4;
|
||||
border: 1px solid #dcfce7;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
// 表单字段样式
|
||||
.form-data-list {
|
||||
.form-field {
|
||||
@@ -509,54 +732,139 @@ const viewTranscript = async (call) => {
|
||||
.call-list {
|
||||
.call-item {
|
||||
margin-bottom: 16px;
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
background: #f9fafb;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #e5e7eb;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 6px 16px rgba(0,0,0,0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.call-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
align-items: flex-start;
|
||||
.header-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.call-type {
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 20px;
|
||||
background: #dbeafe;
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.call-duration {
|
||||
font-size: 12px;
|
||||
.call-customer {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #6b7280;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
|
||||
.header-tags {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.call-tag {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 4px 10px;
|
||||
border-radius: 20px;
|
||||
|
||||
&.tag-20min {
|
||||
background: #dcfce7;
|
||||
color: #16a34a;
|
||||
border: 1px solid #bbf7d0;
|
||||
}
|
||||
|
||||
&.tag-invalid {
|
||||
background: #fee2e2;
|
||||
color: #dc2626;
|
||||
border: 1px solid #fecaca;
|
||||
}
|
||||
|
||||
&.tag-other {
|
||||
background: #fef3c7;
|
||||
color: #d97706;
|
||||
border: 1px solid #fed7aa;
|
||||
}
|
||||
}
|
||||
|
||||
// 分数样式
|
||||
.stat-value {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
padding: 4px 10px;
|
||||
border-radius: 20px;
|
||||
|
||||
&.score-high {
|
||||
color: #16a34a; // 绿色
|
||||
background-color: #dcfce7;
|
||||
}
|
||||
&.score-medium {
|
||||
color: #d97706; // 橙色
|
||||
background-color: #fef3c7;
|
||||
}
|
||||
&.score-low {
|
||||
color: #dc2626; // 红色
|
||||
background-color: #fee2e2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.call-time {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
padding: 4px 8px;
|
||||
background: #f9fafb;
|
||||
border-radius: 4px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.call-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 12px;
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
|
||||
.action-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
padding: 8px 14px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
|
||||
&.download-btn {
|
||||
background: #dbeafe;
|
||||
@@ -564,7 +872,12 @@ const viewTranscript = async (call) => {
|
||||
|
||||
&:hover {
|
||||
background: #bfdbfe;
|
||||
transform: translateY(-1px);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,13 +887,18 @@ const viewTranscript = async (call) => {
|
||||
|
||||
&:hover {
|
||||
background: #a7f3d0;
|
||||
transform: translateY(-1px);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 6px rgba(5, 150, 105, 0.2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
i {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
|
||||
&.icon-download::before {
|
||||
content: '⬇';
|
||||
@@ -591,78 +909,19 @@ const viewTranscript = async (call) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-content {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
// 通话时长样式
|
||||
.call-duration {
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
font-size: 14px;
|
||||
margin: 0 0 16px 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.card-stats {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
|
||||
@media (max-width: 480px) {
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 14px;
|
||||
color: #111827;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
border-top: 1px solid #f3f4f6;
|
||||
padding-top: 16px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.view-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: #6b7280;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
padding: 8px 0;
|
||||
transition: color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
color: #111827;
|
||||
background: #f9fafb;
|
||||
padding: 6px 12px;
|
||||
border-radius: 20px;
|
||||
border: 1px solid #e5e7eb;
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
&:hover svg {
|
||||
transform: translateX(2px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,8 +972,10 @@ const viewTranscript = async (call) => {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
font-size: 13px;
|
||||
.call-actions {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,12 +6,12 @@
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon customer-rate"><i class="el-icon-chat-dot-round"></i></div>
|
||||
<div class="kpi-value">{{ customerCommunicationRate }}</div>
|
||||
<p>活跃客户沟通率 <i class="info-icon" @mouseenter="showTooltip('customerCommunicationRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<p>客户沟通率 <i class="info-icon" @mouseenter="showTooltip('customerCommunicationRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon response-time"><i class="el-icon-timer"></i></div>
|
||||
<div class="kpi-value">{{ averageResponseTime }}<span class="kpi-unit">分钟</span></div>
|
||||
<p>平均应答时间 <i class="info-icon" @mouseenter="showTooltip('averageResponseTime', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<div class="kpi-value">{{ averageResponseTime }}<span class="kpi-unit">分</span></div>
|
||||
<p>均响应时间 <i class="info-icon" @mouseenter="showTooltip('averageResponseTime', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item" >
|
||||
<div class="stat-icon timeout-rate"><i class="el-icon-warning"></i></div>
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon severe-timeout-rate"><i class="el-icon-warning-outline"></i></div>
|
||||
<div class="kpi-value">{{ severeTimeoutRate }}</div>
|
||||
<p>严重超时应答率 <i class="info-icon" @mouseenter="showTooltip('severeTimeoutRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
<p>严重超时率 <i class="info-icon" @mouseenter="showTooltip('severeTimeoutRate', $event)" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon form-rate"><i class="el-icon-document"></i></div>
|
||||
|
||||
475
my-vue-app/src/views/person/components/WeekAnalize.vue
Normal file
475
my-vue-app/src/views/person/components/WeekAnalize.vue
Normal file
@@ -0,0 +1,475 @@
|
||||
<template>
|
||||
<div class="week-analyze">
|
||||
<div class="analyze-header">
|
||||
<h3>本周综合表现分析</h3>
|
||||
<p class="analyze-subtitle">基于本周销售数据的综合分析报告</p>
|
||||
</div>
|
||||
|
||||
<div class="analyze-content">
|
||||
<!-- 周期表现概览 -->
|
||||
<div class="performance-overview">
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 2L15.09 8.26L22 9L17 14L18.18 21L12 17.77L5.82 21L7 14L2 9L8.91 8.26L12 2Z" fill="#FFD700"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>综合评分</h4>
|
||||
<div class="score">{{ overallScore }}<span class="score-unit">/100</span></div>
|
||||
<div class="score-trend" :class="scoreTrend.type">
|
||||
{{ scoreTrend.text }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M16 6L18.29 8.29L13.41 13.17L9.41 9.17L2 16.59L3.41 18L9.41 12L13.41 16L19.71 9.71L22 12V6H16Z" fill="#4CAF50"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>目标完成率</h4>
|
||||
<div class="score">{{ targetCompletion }}<span class="score-unit">%</span></div>
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" :style="{ width: targetCompletion + '%' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-card">
|
||||
<div class="card-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12S6.48 22 12 22 22 17.52 22 12 17.52 2 12 2ZM13 17H11V15H13V17ZM13 13H11V7H13V13Z" fill="#FF9800"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h4>改进建议</h4>
|
||||
<div class="suggestions-count">{{ suggestions.length }}项</div>
|
||||
<div class="suggestions-preview">{{ suggestions[0]?.title || '暂无建议' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 详细分析 -->
|
||||
<div class="detailed-analysis">
|
||||
<div class="analysis-section">
|
||||
<h4>关键指标表现</h4>
|
||||
<div class="metrics-grid">
|
||||
<div v-for="metric in keyMetrics" :key="metric.name" class="metric-item">
|
||||
<div class="metric-header">
|
||||
<span class="metric-name">{{ metric.name }}</span>
|
||||
<span class="metric-trend" :class="metric.trend">
|
||||
{{ metric.trendText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="metric-value">
|
||||
<span class="current-value">{{ metric.current }}</span>
|
||||
<span class="target-value">/ {{ metric.target }}</span>
|
||||
</div>
|
||||
<div class="metric-progress">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" :style="{ width: (metric.current / metric.target * 100) + '%' }"></div>
|
||||
</div>
|
||||
<span class="progress-text">{{ Math.round(metric.current / metric.target * 100) }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="analysis-section">
|
||||
<h4>改进建议</h4>
|
||||
<div class="suggestions-list">
|
||||
<div v-for="suggestion in suggestions" :key="suggestion.id" class="suggestion-item">
|
||||
<div class="suggestion-priority" :class="suggestion.priority"></div>
|
||||
<div class="suggestion-content">
|
||||
<h5>{{ suggestion.title }}</h5>
|
||||
<p>{{ suggestion.description }}</p>
|
||||
<div class="suggestion-actions">
|
||||
<span class="action-tag" v-for="action in suggestion.actions" :key="action">{{ action }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
weekData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
// 响应式数据
|
||||
const overallScore = ref(78)
|
||||
const targetCompletion = ref(65)
|
||||
|
||||
const scoreTrend = computed(() => {
|
||||
const score = overallScore.value
|
||||
if (score >= 80) {
|
||||
return { type: 'positive', text: '表现优秀' }
|
||||
} else if (score >= 60) {
|
||||
return { type: 'neutral', text: '表现良好' }
|
||||
} else {
|
||||
return { type: 'negative', text: '需要改进' }
|
||||
}
|
||||
})
|
||||
|
||||
const keyMetrics = ref([
|
||||
{
|
||||
name: '通话量',
|
||||
current: 85,
|
||||
target: 100,
|
||||
trend: 'positive',
|
||||
trendText: '↗ +12%'
|
||||
},
|
||||
{
|
||||
name: '接通率',
|
||||
current: 68,
|
||||
target: 80,
|
||||
trend: 'neutral',
|
||||
trendText: '→ 持平'
|
||||
},
|
||||
{
|
||||
name: '转化率',
|
||||
current: 12,
|
||||
target: 15,
|
||||
trend: 'negative',
|
||||
trendText: '↘ -3%'
|
||||
},
|
||||
{
|
||||
name: '客户满意度',
|
||||
current: 4.2,
|
||||
target: 4.5,
|
||||
trend: 'positive',
|
||||
trendText: '↗ +0.2'
|
||||
}
|
||||
])
|
||||
|
||||
const suggestions = ref([
|
||||
{
|
||||
id: 1,
|
||||
title: '提升通话转化率',
|
||||
description: '当前转化率低于目标,建议优化话术和跟进策略',
|
||||
priority: 'high',
|
||||
actions: ['话术优化', '跟进策略', '客户画像分析']
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '增加客户互动频次',
|
||||
description: '客户响应时间较长,建议增加主动联系频次',
|
||||
priority: 'medium',
|
||||
actions: ['主动联系', '内容营销', '社群运营']
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '优化时间管理',
|
||||
description: '通话时长分布不均,建议优化时间分配',
|
||||
priority: 'low',
|
||||
actions: ['时间规划', '效率工具', '任务优先级']
|
||||
}
|
||||
])
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
// 可以在这里根据传入的数据计算分析结果
|
||||
console.log('WeekAnalize组件已挂载', props.weekData)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.week-analyze {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.analyze-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.analyze-header h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.analyze-subtitle {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.performance-overview {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card-content h4 {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 0 0 8px 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.score {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #1a1a1a;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.score-unit {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.score-trend {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.score-trend.positive {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.score-trend.neutral {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.score-trend.negative {
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: #e9ecef;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
|
||||
border-radius: 3px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.suggestions-count {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #FF9800;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.suggestions-preview {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.detailed-analysis {
|
||||
display: grid;
|
||||
gap: 32px;
|
||||
}
|
||||
|
||||
.analysis-section h4 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 16px 0;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.metric-item {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.metric-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.metric-name {
|
||||
font-size: 14px;
|
||||
color: #1a1a1a;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.metric-trend {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.metric-trend.positive {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.metric-trend.neutral {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.metric-trend.negative {
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.current-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
.target-value {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.metric-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.metric-progress .progress-bar {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
min-width: 35px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.suggestions-list {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.suggestion-item {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.suggestion-priority {
|
||||
width: 4px;
|
||||
border-radius: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.suggestion-priority.high {
|
||||
background: #f44336;
|
||||
}
|
||||
|
||||
.suggestion-priority.medium {
|
||||
background: #FF9800;
|
||||
}
|
||||
|
||||
.suggestion-priority.low {
|
||||
background: #4CAF50;
|
||||
}
|
||||
|
||||
.suggestion-content h5 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.suggestion-content p {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin: 0 0 12px 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.suggestion-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-tag {
|
||||
background: #e3f2fd;
|
||||
color: #1976d2;
|
||||
font-size: 11px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.week-analyze {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.performance-overview {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,18 +3,19 @@
|
||||
<div class="overview-header">
|
||||
<h2>中心整体概览</h2>
|
||||
<div class="stats-toggle">
|
||||
<button
|
||||
:class="['toggle-btn', { active: statsMode === 'monthly' }]"
|
||||
@click="switchStatsMode('monthly')"
|
||||
>
|
||||
按月统计
|
||||
</button>
|
||||
<button
|
||||
:class="['toggle-btn', { active: statsMode === 'period' }]"
|
||||
@click="switchStatsMode('period')"
|
||||
>
|
||||
按期统计
|
||||
</button>
|
||||
<button
|
||||
:class="['toggle-btn', { active: statsMode === 'month' }]"
|
||||
@click="switchStatsMode('month')"
|
||||
>
|
||||
按月统计
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-grid">
|
||||
@@ -117,7 +118,7 @@ import { reactive, ref } from 'vue'
|
||||
import Tooltip from '@/components/Tooltip.vue'
|
||||
|
||||
// 统计模式状态
|
||||
const statsMode = ref('monthly') // 默认按月统计
|
||||
const statsMode = ref('month') // 默认按月统计
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits(['update-check-type'])
|
||||
@@ -126,7 +127,7 @@ const emit = defineEmits(['update-check-type'])
|
||||
const switchStatsMode = (mode) => {
|
||||
statsMode.value = mode
|
||||
// 向父组件发送事件,修改CheckType的值
|
||||
const checkTypeValue = mode === 'monthly' ? 'month' : 'period'
|
||||
const checkTypeValue = mode === 'period' ? 'period' : 'month'
|
||||
emit('update-check-type', checkTypeValue)
|
||||
console.log('切换统计模式:', mode, '发送CheckType值:', checkTypeValue)
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ onBeforeUnmount(() => {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 20px 16px;
|
||||
padding: 10px 20px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
h3 { margin: 0; color: #303133; font-size: 18px; font-weight: 600; }
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
:class="{ active: selectedRecording === index }"
|
||||
@click="selectRecording(index)"
|
||||
>
|
||||
<span class="recording-index">{{ recording.score}}</span>
|
||||
<div class="recording-info">
|
||||
<div class="recording-name" :title="recording.name">{{ recording.name.length > 10 ? recording.name.substring(0, 10) + '...' : recording.name }}</div>
|
||||
<div class="recording-meta">
|
||||
@@ -172,8 +173,8 @@ import MarkdownIt from 'markdown-it'
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
qualityCalls: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
@@ -221,25 +222,23 @@ const recordings = computed(() => {
|
||||
if (!props.qualityCalls ) {
|
||||
return staticRecordings.value;
|
||||
}
|
||||
|
||||
const recordingsList = [];
|
||||
Object.keys(props.qualityCalls).forEach(userName => {
|
||||
props.qualityCalls[userName].forEach((record, index) => {
|
||||
props.qualityCalls.forEach((record, index) => {
|
||||
recordingsList.push({
|
||||
id: recordingsList.length + 1,
|
||||
name: record.obj_file_name ? record.obj_file_name.split('/').pop() : `${record.sale_name}-录音-${index + 1}`,
|
||||
name: record.record_name ? record.record_name : `${record.sale_name}-录音-${index + 1}`,
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
url: record.obj_file_name,
|
||||
transcription: record.context || null,
|
||||
score: record.score,
|
||||
sop: record.sop,
|
||||
sale_name: record.sale_name,
|
||||
url: record.record_file_addr,
|
||||
transcription: record.record_context || null,
|
||||
score: record.record_score,
|
||||
sop: record.record_report,
|
||||
sale_name: record.record_name,
|
||||
size: 2048576, // 默认文件大小 2MB
|
||||
uploadTime: new Date().toLocaleDateString('zh-CN')
|
||||
});
|
||||
uploadTime: record.created_at,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
return recordingsList;
|
||||
})
|
||||
|
||||
@@ -505,14 +504,14 @@ const downloadRecording = (index) => {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
height: 400px;
|
||||
height: 420px;
|
||||
}
|
||||
|
||||
.chart-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 20px 0;
|
||||
padding: 10px 20px 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
@@ -549,7 +548,7 @@ const downloadRecording = (index) => {
|
||||
}
|
||||
|
||||
.chart-content {
|
||||
padding: 20px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.recording-section {
|
||||
@@ -562,7 +561,6 @@ const downloadRecording = (index) => {
|
||||
.recording-list {
|
||||
margin-bottom: 20px;
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.recording-item {
|
||||
@@ -602,6 +600,39 @@ const downloadRecording = (index) => {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.recording-index {
|
||||
/* 基础分数样式 */
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background-color: #e9ecef;
|
||||
color: #495057;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* 第一名样式 */
|
||||
.recording-item:first-child .recording-index {
|
||||
background: linear-gradient(135deg, #FFD700, #FFA500);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
|
||||
}
|
||||
|
||||
/* 第二名样式 */
|
||||
.recording-item:nth-child(2) .recording-index {
|
||||
background: linear-gradient(135deg, #C0C0C0, #A9A9A9);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(192, 192, 192, 0.3);
|
||||
}
|
||||
|
||||
/* 第三名样式 */
|
||||
.recording-item:nth-child(3) .recording-index {
|
||||
background: linear-gradient(135deg, #CD7F32, #A0522D);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(205, 127, 50, 0.3);
|
||||
}
|
||||
|
||||
|
||||
.recording-meta {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="chart-container">
|
||||
<div class="chart-header">
|
||||
<h3>客户迫切解决的问题排行榜</h3>
|
||||
<button @click="exportData" v-if="userStore.userInfo.user_level === 4">一键导出</button>
|
||||
</div>
|
||||
<div class="chart-content">
|
||||
<div v-if="sortedData.length > 0" class="problem-ranking">
|
||||
@@ -33,7 +34,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { computed,onMounted } from 'vue';
|
||||
import { exportCustomers, getExcellentRecordFile } from '@/api/secondTop';
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { ElMessage } from 'element-plus';
|
||||
import * as XLSX from 'xlsx';
|
||||
// 用户store实例
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 定义Props,接收一个包含 { name: string, value: string | number } 的数组
|
||||
const props = defineProps({
|
||||
@@ -73,6 +80,190 @@ const getRankingClass = (index) => {
|
||||
const getRankBadgeClass = (index) => {
|
||||
return ['badge-gold', 'badge-silver', 'badge-bronze'][index] || 'badge-default';
|
||||
};
|
||||
|
||||
async function exportData() {
|
||||
const params = {
|
||||
user_name: userStore.userInfo.username,
|
||||
user_level: userStore.userInfo.user_level.toString(),
|
||||
}
|
||||
|
||||
try {
|
||||
ElMessage.info('正在导出数据,请稍候...')
|
||||
console.log('导出参数:', params)
|
||||
const res = await exportCustomers()
|
||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||
ElMessage.success('数据导出成功')
|
||||
// 处理数据,将复杂的嵌套对象展平
|
||||
const exportData = res.data.map(customer => {
|
||||
const flatData = {
|
||||
'昵称': customer.nickname || '',
|
||||
'客户姓名': customer.customer_name || '',
|
||||
'性别': customer.gender || '',
|
||||
'跟进人': customer.follow_up_name || '',
|
||||
'手机号': customer.phone || '',
|
||||
'是否入群': customer.is_in_group || '',
|
||||
'用户ID': customer.mantis_user_id || '',
|
||||
}
|
||||
|
||||
const parseFormData = (formData) => {
|
||||
if (typeof formData === 'string') {
|
||||
try {
|
||||
return JSON.parse(formData)
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return formData || null
|
||||
}
|
||||
|
||||
const normalizeFormArray = (formData) => {
|
||||
const data = parseFormData(formData)
|
||||
console.log('解析后的表单数据:', data)
|
||||
if (Array.isArray(data)) return data
|
||||
if (data && Array.isArray(data.data)) return data.data
|
||||
if (data && typeof data === 'object' && !data.answers) {
|
||||
const numericKeys = Object.keys(data).filter(key => String(Number(key)) === key)
|
||||
if (numericKeys.length > 0) {
|
||||
return numericKeys
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map(key => data[key])
|
||||
.filter(Boolean)
|
||||
}
|
||||
}
|
||||
if (data && data.answers) return [data]
|
||||
return data ? [data] : []
|
||||
}
|
||||
|
||||
const ensureUniqueKey = (key) => {
|
||||
if (!flatData[key]) return key
|
||||
let index = 2
|
||||
while (flatData[`${key}(${index})`]) {
|
||||
index += 1
|
||||
}
|
||||
return `${key}(${index})`
|
||||
}
|
||||
|
||||
const parsedFormData = parseFormData(customer.wechat_form)
|
||||
const formArray = normalizeFormArray(parsedFormData)
|
||||
if (formArray.length > 0) {
|
||||
console.log('表单数组:', formArray)
|
||||
const isAnswerList = formArray.every(item => item && item.question_label && Object.prototype.hasOwnProperty.call(item, 'answer'))
|
||||
const isFormWithAnswers = formArray.every(item => item && Array.isArray(item.answers))
|
||||
console.log('是否为答案列表:', isAnswerList)
|
||||
console.log('是否为表单含 answers:', isFormWithAnswers)
|
||||
if (isAnswerList) {
|
||||
let formAnswerCount = 0
|
||||
formArray.forEach((answerItem) => {
|
||||
const label = String(answerItem.question_label || '').trim()
|
||||
if (!label) return
|
||||
const key = ensureUniqueKey(label)
|
||||
flatData[key] = answerItem.answer ?? ''
|
||||
formAnswerCount += 1
|
||||
})
|
||||
if (formAnswerCount === 0 && formArray.length > 0) {
|
||||
const fallbackKey = ensureUniqueKey('表单答案')
|
||||
flatData[fallbackKey] = formArray.map(item => `${item.question_label || ''}: ${item.answer || ''}`).join(' | ')
|
||||
}
|
||||
} else if (isFormWithAnswers) {
|
||||
console.log('表单含 answers:', formArray)
|
||||
formArray.forEach((formItem) => {
|
||||
const formTitle = formItem.form_title || '表单'
|
||||
if (Array.isArray(formItem.answers)) {
|
||||
let formAnswerCount = 0
|
||||
formItem.answers.forEach((answerItem) => {
|
||||
const label = String(answerItem.question_label || '').trim()
|
||||
if (!label) return
|
||||
const key = ensureUniqueKey(`${formTitle}-${label}`)
|
||||
flatData[key] = answerItem.answer ?? ''
|
||||
formAnswerCount += 1
|
||||
})
|
||||
if (formAnswerCount === 0 && formItem.answers.length > 0) {
|
||||
const fallbackKey = ensureUniqueKey(`${formTitle}-表单答案`)
|
||||
flatData[fallbackKey] = formItem.answers.map(item => `${item.question_label || ''}: ${item.answer || ''}`).join(' | ')
|
||||
}
|
||||
}
|
||||
if (formItem.created_at) {
|
||||
const key = ensureUniqueKey(`${formTitle}-创建时间`)
|
||||
flatData[key] = new Date(formItem.created_at).toLocaleString()
|
||||
}
|
||||
if (formItem.updated_at) {
|
||||
const key = ensureUniqueKey(`${formTitle}-更新时间`)
|
||||
flatData[key] = new Date(formItem.updated_at).toLocaleString()
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (parsedFormData && typeof parsedFormData === 'object') {
|
||||
flatData['家长姓名'] = parsedFormData.name || ''
|
||||
flatData['孩子姓名'] = parsedFormData.child_name || ''
|
||||
flatData['孩子性别'] = parsedFormData.child_gender || ''
|
||||
flatData['职业'] = parsedFormData.occupation || ''
|
||||
flatData['孩子教育阶段'] = parsedFormData.child_education || ''
|
||||
flatData['与孩子关系'] = parsedFormData.child_relation || ''
|
||||
flatData['联系电话'] = parsedFormData.mobile || ''
|
||||
flatData['地区'] = parsedFormData.territory || ''
|
||||
flatData['创建时间'] = parsedFormData.created_at ? new Date(parsedFormData.created_at).toLocaleString() : ''
|
||||
flatData['更新时间'] = parsedFormData.updated_at ? new Date(parsedFormData.updated_at).toLocaleString() : ''
|
||||
}
|
||||
|
||||
// 处理到课情况
|
||||
if (customer.live) {
|
||||
flatData['课一到课情况'] = customer.live['课一'] || ''
|
||||
flatData['课二到课情况'] = customer.live['课二'] || ''
|
||||
flatData['课三到课情况'] = customer.live['课三'] || ''
|
||||
flatData['课四到课情况'] = customer.live['课四'] || ''
|
||||
}
|
||||
|
||||
// 处理问卷调查信息
|
||||
if (parsedFormData && parsedFormData.additional_info) {
|
||||
parsedFormData.additional_info.forEach((item) => {
|
||||
const key = ensureUniqueKey(item.topic || '')
|
||||
if (key) {
|
||||
flatData[key] = item.answer || ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return flatData
|
||||
})
|
||||
|
||||
// 创建工作簿
|
||||
const wb = XLSX.utils.book_new()
|
||||
const allKeys = Array.from(new Set(exportData.flatMap(item => Object.keys(item))))
|
||||
const ws = XLSX.utils.json_to_sheet(exportData, { header: allKeys })
|
||||
|
||||
// 设置列宽
|
||||
const colWidths = allKeys.map(key => {
|
||||
const maxCellLength = exportData.reduce((max, row) => {
|
||||
const value = row[key]
|
||||
const length = value === null || value === undefined ? 0 : String(value).length
|
||||
return Math.max(max, length)
|
||||
}, 0)
|
||||
return { wch: Math.min(50, Math.max(10, key.length, maxCellLength)) }
|
||||
})
|
||||
ws['!cols'] = colWidths
|
||||
|
||||
// 添加工作表到工作簿
|
||||
XLSX.utils.book_append_sheet(wb, ws, '客户数据')
|
||||
|
||||
// 生成文件名(包含当前时间)
|
||||
const now = new Date()
|
||||
const fileName = `客户数据导出_${now.getFullYear()}${(now.getMonth() + 1).toString().padStart(2, '0')}${now.getDate().toString().padStart(2, '0')}_${now.getHours().toString().padStart(2, '0')}${now.getMinutes().toString().padStart(2, '0')}.xlsx`
|
||||
|
||||
// 导出文件
|
||||
XLSX.writeFile(wb, fileName)
|
||||
|
||||
ElMessage.success(`导出成功!共导出 ${exportData.length} 条数据`)
|
||||
} else {
|
||||
alert('暂无数据可导出')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error)
|
||||
ElMessage.error('导出失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -87,14 +278,42 @@ const getRankBadgeClass = (index) => {
|
||||
}
|
||||
|
||||
.chart-header {
|
||||
padding: 20px 20px 16px;
|
||||
padding: 10px 20px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
color: #303133;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 8px 16px;
|
||||
background: linear-gradient(135deg, #409eff, #3a8ee6);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #3a8ee6, #337ecc);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(64, 158, 255, 0.4);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.chart-content {
|
||||
|
||||
@@ -28,7 +28,18 @@
|
||||
|
||||
<div v-if="!isRouteNavigation">
|
||||
<!-- 用户下拉菜单 -->
|
||||
<UserDropdown />
|
||||
<div style="display: flex; align-items: center; gap: 20px;">
|
||||
<button @click="showFeedbackFormModal" class="feedback-btn">意见反馈</button>
|
||||
<FeedbackForm
|
||||
:is-visible="showFeedbackForm"
|
||||
@close="closeFeedbackFormModal"
|
||||
@submit-feedback="closeFeedbackFormModal"
|
||||
/>
|
||||
<UserDropdown
|
||||
:card-visibility="cardVisibility"
|
||||
@update-card-visibility="updateCardVisibility"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -39,37 +50,52 @@
|
||||
<!-- Top Section - Center Overview and Action Items -->
|
||||
<div class="top-section">
|
||||
<!-- Center Performance Overview -->
|
||||
<CenterOverview :key="CheckType" :overall-data="overallCenterPerformance" @update-check-type="updateCheckType" />
|
||||
<CenterOverview
|
||||
v-if="cardVisibility.centerOverview"
|
||||
:key="CheckType"
|
||||
:overall-data="overallCenterPerformance"
|
||||
@update-check-type="updateCheckType"
|
||||
/>
|
||||
|
||||
<!-- Action Items (Compact) -->
|
||||
<div class="action-items-compact">
|
||||
<div v-if="cardVisibility.actionItems" class="action-items-compact">
|
||||
<ActionItems :selected-group="selectedGroup" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="BB-section">
|
||||
<!--客户类型占比-->
|
||||
<CustomerType :customer-data="customerTypeDistribution" @category-change="handleCustomerTypeChange" />
|
||||
<CustomerType
|
||||
v-if="cardVisibility.customerType"
|
||||
:customer-data="customerTypeDistribution"
|
||||
@category-change="handleCustomerTypeChange"
|
||||
/>
|
||||
<!-- 优秀录音 -->
|
||||
<GoodMusic :quality-calls="excellentRecord" />
|
||||
<GoodMusic
|
||||
v-if="cardVisibility.goodMusic"
|
||||
:quality-calls="excellentRecord"
|
||||
/>
|
||||
<!-- 客户问题排行 -->
|
||||
<ProblemRanking :ranking-data="formattedUrgentNeedData" />
|
||||
<ProblemRanking
|
||||
v-if="cardVisibility.problemRanking"
|
||||
:ranking-data="formattedUrgentNeedData"
|
||||
/>
|
||||
</div>
|
||||
<!-- Bottom Section -->
|
||||
<div class="bottom-section">
|
||||
<!-- Left Section - Group Performance Ranking -->
|
||||
<div class="left-section">
|
||||
<div v-if="cardVisibility.groupRanking" class="left-section">
|
||||
<GroupRanking :groups="groups" :selected-group="selectedGroup" :conversion-data="conversionRateVsAverage" @select-group="selectGroup" />
|
||||
</div>
|
||||
|
||||
<!-- Right Section - Group Comparison -->
|
||||
<div class="right-section">
|
||||
<div v-if="cardVisibility.groupComparison" class="right-section">
|
||||
<GroupComparison :groups="groups" :senior-manager-data="seniorManagerList" :group-list="groupList" @select-group="selectGroup" @manager-change="handleManagerChange" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Team Members Detail Section -->
|
||||
<div class="team-detail-section" v-if="selectedGroup">
|
||||
<div class="team-detail-section" v-if="selectedGroup && cardVisibility.teamDetail">
|
||||
<div class="team-detail-header">
|
||||
<h2>{{ selectedGroup.name }} - 团队成员详情</h2>
|
||||
<div class="team-summary">
|
||||
@@ -86,6 +112,22 @@
|
||||
<span class="value">{{ selectedGroup.conversionRate }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group-performance">
|
||||
<button @click="showTeamAnalysisModal">团队整体分析</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 团队整体分析弹窗 -->
|
||||
<div v-if="showTeamAnalysis" class="team-analysis-modal" @click.self="closeTeamAnalysisModal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3>团队整体分析</h3>
|
||||
<button class="close-btn" @click="closeTeamAnalysisModal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>这里是团队整体分析的内容</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="members-grid">
|
||||
@@ -152,13 +194,13 @@
|
||||
</main>
|
||||
|
||||
<!-- Loading 组件 -->
|
||||
<Loading :visible="isLoading" text="数据加载中..." />
|
||||
<!-- <Loading :visible="isLoading" text="数据加载中..." /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed,reactive } from 'vue'
|
||||
|
||||
import FeedbackForm from "@/components/FeedbackForm.vue";
|
||||
// 30分钟数据缓存系统
|
||||
const cache = new Map()
|
||||
const CACHE_DURATION = 30 * 60 * 1000 // 30分钟
|
||||
@@ -241,6 +283,48 @@
|
||||
// 用户store实例
|
||||
const userStore = useUserStore();
|
||||
const CheckType = ref('month')
|
||||
|
||||
// 卡片显示状态
|
||||
const cardVisibility = ref({
|
||||
centerOverview: true,
|
||||
actionItems: true,
|
||||
customerType: true,
|
||||
goodMusic: true,
|
||||
problemRanking: true,
|
||||
groupRanking: true,
|
||||
groupComparison: true,
|
||||
teamDetail: true
|
||||
})
|
||||
|
||||
// FeedbackForm 控制变量
|
||||
const showFeedbackForm = ref(false)
|
||||
|
||||
// 团队整体分析弹窗控制变量
|
||||
const showTeamAnalysis = ref(false)
|
||||
|
||||
// 更新卡片显示状态
|
||||
const updateCardVisibility = (newVisibility) => {
|
||||
Object.assign(cardVisibility.value, newVisibility)
|
||||
console.log('卡片显示状态已更新:', cardVisibility.value)
|
||||
}
|
||||
|
||||
// FeedbackForm 控制方法
|
||||
const showFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = true
|
||||
}
|
||||
|
||||
const closeFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = false
|
||||
}
|
||||
|
||||
// 团队整体分析弹窗控制方法
|
||||
const showTeamAnalysisModal = () => {
|
||||
showTeamAnalysis.value = true
|
||||
}
|
||||
|
||||
const closeTeamAnalysisModal = () => {
|
||||
showTeamAnalysis.value = false
|
||||
}
|
||||
// 营期调控逻辑
|
||||
// This would ideally come from a prop or API call based on the logged-in user
|
||||
const centerData = ref({
|
||||
@@ -693,7 +777,10 @@ const conversionRateVsAverage = ref({})
|
||||
|
||||
// 根据传来的组名字来获取组业绩详情
|
||||
async function CenterGroupPerformance(groupName) {
|
||||
const params = getRequestParams()
|
||||
const routeParams = getRequestParams()
|
||||
const params = routeParams.user_name
|
||||
? routeParams
|
||||
: {user_name: userStore.userInfo.username, user_level: userStore.userInfo.user_level.toString()}
|
||||
const hasParams = params.user_name
|
||||
const requestParams = hasParams ? {
|
||||
...params,
|
||||
@@ -747,7 +834,7 @@ const conversionRateVsAverage = ref({})
|
||||
deals: member.deals_this_period || 0,
|
||||
rank: member.rank || 0
|
||||
}))
|
||||
.sort((a, b) => b.deals - a.deals) // 根据成交单数从高到低排序
|
||||
.sort((a, b) => a.rank - b.rank) // 根据排名降序排列(排名数字越大越靠后)
|
||||
|
||||
// 更新selectedGroup的members数据
|
||||
selectedGroup.value = {
|
||||
@@ -801,29 +888,44 @@ const conversionRateVsAverage = ref({})
|
||||
})
|
||||
}
|
||||
// 获取优秀录音
|
||||
const excellentRecord = ref({});
|
||||
const excellentRecord = ref([]);
|
||||
// 获取优秀录音文件
|
||||
async function CentergetGoodRecord() {
|
||||
console.log('CentergetGoodRecord 开始执行')
|
||||
try {
|
||||
const params = getRequestParams()
|
||||
const params1 = {
|
||||
user_level:userStore.userInfo.user_level.toString(),
|
||||
user_name:userStore.userInfo.username
|
||||
user_level: userStore.userInfo?.user_level?.toString() || '',
|
||||
user_name: userStore.userInfo?.username || ''
|
||||
}
|
||||
const hasParams = params.user_name
|
||||
|
||||
// 检查参数是否有效
|
||||
const hasParams = params.user_name && params.user_level
|
||||
const requestParams = hasParams ? {
|
||||
...params,
|
||||
} : params1
|
||||
console.log(188811111,requestParams)
|
||||
|
||||
try {
|
||||
const res = await withCache('CentergetGoodRecord',
|
||||
() => getExcellentRecordFile(requestParams),
|
||||
requestParams
|
||||
)
|
||||
excellentRecord.value = res.data.excellent_record_list
|
||||
console.log(111111,res.data.excellent_record_list)
|
||||
console.log('CentergetGoodRecord request params:', requestParams)
|
||||
|
||||
// 验证必要参数是否存在
|
||||
if (!requestParams.user_name || !requestParams.user_level) {
|
||||
console.error("缺少必要的请求参数:", requestParams);
|
||||
return;
|
||||
}
|
||||
|
||||
// 直接发送请求,不使用缓存
|
||||
const res = await getExcellentRecordFile(requestParams)
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
excellentRecord.value = res.data || []
|
||||
console.log('获取优秀录音成功:', res.data)
|
||||
} else {
|
||||
console.error("获取优秀录音失败,响应数据不完整:", res);
|
||||
excellentRecord.value = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取优秀录音失败:", error);
|
||||
excellentRecord.value = []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -880,21 +982,21 @@ const excellentRecord = ref({});
|
||||
(currentQuery.user_name && currentQuery.user_level)
|
||||
|
||||
if (!isFromRoute) {
|
||||
await CenterCampPeriodAdmin()
|
||||
CenterCampPeriodAdmin()
|
||||
}
|
||||
CentergetGoodRecord()
|
||||
CenterOverallCenterPerformance()
|
||||
CenterTotalGroupCount()
|
||||
CenterConversionRate()
|
||||
CenterTotalCallCount()
|
||||
CenterNewCustomer()
|
||||
CenterDepositConversionRate()
|
||||
CenterCustomerType()
|
||||
CenterUrgentNeedToAddress()
|
||||
CenterConversionRateVsAverage()
|
||||
|
||||
await CenterOverallCenterPerformance()
|
||||
await CenterTotalGroupCount()
|
||||
await CenterConversionRate()
|
||||
await CenterTotalCallCount()
|
||||
await CenterNewCustomer()
|
||||
await CenterDepositConversionRate()
|
||||
await CenterCustomerType()
|
||||
await CenterUrgentNeedToAddress()
|
||||
await CenterConversionRateVsAverage()
|
||||
await CenterSeniorManagerList()
|
||||
// await CentergetGoodRecord()
|
||||
await CenterGroupList('all')
|
||||
CenterSeniorManagerList()
|
||||
CenterGroupList('all')
|
||||
|
||||
console.log('[强制刷新] 所有数据已重新加载')
|
||||
} catch (error) {
|
||||
@@ -922,14 +1024,13 @@ const excellentRecord = ref({});
|
||||
await CenterTotalGroupCount()
|
||||
await CenterConversionRate()
|
||||
await CenterTotalCallCount()
|
||||
await CentergetGoodRecord()
|
||||
await CenterNewCustomer()
|
||||
await CenterDepositConversionRate()
|
||||
await CenterCustomerType()
|
||||
await CenterUrgentNeedToAddress()
|
||||
await CenterConversionRateVsAverage()
|
||||
await CenterSeniorManagerList()
|
||||
// 获取优秀录音
|
||||
await CentergetGoodRecord()
|
||||
await CenterGroupList('all') // 初始化加载全部高级经理数据
|
||||
|
||||
// 输出缓存信息
|
||||
@@ -1563,6 +1664,76 @@ const hideTooltip = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 团队分析弹窗样式 */
|
||||
.team-analysis-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-content {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
max-height: 80vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-header h3 {
|
||||
margin: 0;
|
||||
color: #1a202c;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.team-analysis-modal .close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #718096;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.team-analysis-modal .close-btn:hover {
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-body {
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-body p {
|
||||
margin: 0;
|
||||
color: #4a5568;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
// 路由导航顶栏样式
|
||||
.route-header {
|
||||
display: flex;
|
||||
@@ -1610,6 +1781,22 @@ const hideTooltip = () => {
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 意见反馈按钮样式 */
|
||||
.feedback-btn {
|
||||
background-color: #4299e1;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
|
||||
&:hover {
|
||||
background-color: #3182ce;
|
||||
}
|
||||
}
|
||||
}
|
||||
.stage-control {
|
||||
margin-left: 20px;
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
团队总业绩
|
||||
<span class="info-icon" @mouseenter="showTooltip($event, 'teamPerformance')" @mouseleave="hideTooltip">ⓘ</span>
|
||||
</span>
|
||||
<span class="card-trend positive">{{ totalPerformance.team_current_vs_previous_deals }} vs 上期</span>
|
||||
<span class="card-trend positive">{{ totalPerformance.team_current_vs_previous_period_deals_comparison }} vs 上期</span>
|
||||
</div>
|
||||
<div class="card-value">{{ totalPerformance.current_team_odd_numbers||0 }}</div>
|
||||
<div class="card-subtitle">月目标完成率: {{ totalPerformance.team_monthly_performance }}</div>
|
||||
<div class="card-subtitle">月目标完成率: {{ totalPerformance.team_monthly_target_completion_rate }}</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-card">
|
||||
@@ -48,7 +48,7 @@
|
||||
团队转化率
|
||||
<span class="info-icon" @mouseenter="showTooltip($event, 'conversionRate')" @mouseleave="hideTooltip">ⓘ</span>
|
||||
</span>
|
||||
<span class="card-trend positive">{{ conversionRate.team_current_vs_previous_deals }} vs 上期</span>
|
||||
<span class="card-trend positive">{{ conversionRate.team_current_vs_previous_conversion_rate }} vs 上期</span>
|
||||
</div>
|
||||
<div class="card-value">{{ conversionRate.center_conversion_rate }}</div>
|
||||
<div class="card-subtitle">团队平均转化率: {{ conversionRate.average_conversion_rate }}</div>
|
||||
@@ -135,7 +135,6 @@ const props = defineProps({
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(99999,props.overallTeamPerformance)
|
||||
// 计算属性
|
||||
const totalPerformance = computed(() => {
|
||||
return props.overallTeamPerformance.totalPerformance
|
||||
@@ -158,7 +157,6 @@ const newCustomers = computed(() => {
|
||||
})
|
||||
|
||||
const depositConversions = computed(() => {
|
||||
console.log(999991111,props.overallTeamPerformance.depositConversions)
|
||||
return props.overallTeamPerformance.depositConversions
|
||||
})
|
||||
|
||||
|
||||
@@ -27,18 +27,25 @@ const contextPanelRef = ref(null);
|
||||
const sentimentChartCanvas = ref(null);
|
||||
const chartInstances = {};
|
||||
|
||||
// 添加组件挂载状态跟踪
|
||||
const isComponentMounted = ref(true);
|
||||
|
||||
// CHARTING
|
||||
const createOrUpdateChart = (chartId, canvasRef, config) => {
|
||||
if (chartInstances[chartId]) {
|
||||
chartInstances[chartId].destroy();
|
||||
}
|
||||
if (canvasRef.value) {
|
||||
// 确保组件仍然挂载且canvas引用存在
|
||||
if (isComponentMounted.value && canvasRef.value) {
|
||||
const ctx = canvasRef.value.getContext('2d');
|
||||
chartInstances[chartId] = new Chart(ctx, config);
|
||||
}
|
||||
};
|
||||
|
||||
const renderSentimentChart = (history) => {
|
||||
// 确保组件仍然挂载
|
||||
if (!isComponentMounted.value) return;
|
||||
|
||||
if (!sentimentChartCanvas.value) return;
|
||||
const ctx = sentimentChartCanvas.value.getContext('2d');
|
||||
const gradient = ctx.createLinearGradient(0, 0, 0, 120);
|
||||
@@ -126,6 +133,21 @@ watch(() => props.selectedContact, (newContact) => {
|
||||
});
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
// LIFECYCLE HOOKS
|
||||
onMounted(() => {
|
||||
isComponentMounted.value = true;
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
isComponentMounted.value = false;
|
||||
// 清理所有图表实例
|
||||
Object.values(chartInstances).forEach(chart => {
|
||||
if (chart) {
|
||||
chart.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
1144
my-vue-app/src/views/senorManger/components/GoodMusic.vue
Normal file
1144
my-vue-app/src/views/senorManger/components/GoodMusic.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@
|
||||
<div class="key-metrics">
|
||||
<div class="mini-metric">
|
||||
<span class="mini-label">业绩</span>
|
||||
<span class="mini-value">{{ formatCurrency(group.todayPerformance) }}</span>
|
||||
<span class="mini-value">{{ group.todayPerformance }}单</span>
|
||||
</div>
|
||||
<div class="mini-metric">
|
||||
<span class="mini-label">转化</span>
|
||||
@@ -84,7 +84,7 @@ const processedGroups = computed(() => {
|
||||
id: index + 1,
|
||||
name: name,
|
||||
leader: leader,
|
||||
todayPerformance: performance * 10000, // 假设单位转换
|
||||
todayPerformance: performance, // 假设单位转换
|
||||
conversionRate: conversionRate,
|
||||
newClients: Math.floor(performance * 2.5), // 根据业绩估算
|
||||
deals: performance,
|
||||
|
||||
@@ -13,16 +13,23 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { ref, reactive, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
||||
import Chart from 'chart.js/auto'
|
||||
|
||||
const props = defineProps({
|
||||
selectedGroup: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
teamSalesFunnel: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
// 组件状态跟踪
|
||||
const isComponentMounted = ref(true)
|
||||
|
||||
// Chart.js 实例
|
||||
const chartInstances = {}
|
||||
|
||||
@@ -35,6 +42,21 @@ const funnelData = reactive({
|
||||
data: [120, 90, 45, 18, 10],
|
||||
})
|
||||
|
||||
// 监听teamSalesFunnel变化并更新图表数据
|
||||
watch(() => props.teamSalesFunnel, (newVal) => {
|
||||
if (newVal && Object.keys(newVal).length > 0 && isComponentMounted.value) {
|
||||
// 按照固定顺序提取数据
|
||||
const order = ['线索', '加微', '到课', '定金', '成交']
|
||||
funnelData.data = order.map(key => newVal[key] || 0)
|
||||
// 确保在DOM更新后再更新图表
|
||||
nextTick(() => {
|
||||
if (isComponentMounted.value) {
|
||||
renderPersonalFunnelChart()
|
||||
}
|
||||
})
|
||||
}
|
||||
}, { deep: true })
|
||||
|
||||
// Chart.js: 创建或更新图表
|
||||
const createOrUpdateChart = (chartId, canvasRef, config) => {
|
||||
if (chartInstances[chartId]) {
|
||||
@@ -72,10 +94,19 @@ const renderPersonalFunnelChart = () => {
|
||||
|
||||
// 生命周期钩子
|
||||
onMounted(() => {
|
||||
isComponentMounted.value = true
|
||||
// 处理初始传入的teamSalesFunnel数据
|
||||
if (props.teamSalesFunnel && Object.keys(props.teamSalesFunnel).length > 0) {
|
||||
const order = ['线索', '加微', '到课', '定金', '成交']
|
||||
funnelData.data = order.map(key => props.teamSalesFunnel[key] || 0)
|
||||
}
|
||||
if (isComponentMounted.value) {
|
||||
renderPersonalFunnelChart()
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
isComponentMounted.value = false
|
||||
Object.values(chartInstances).forEach(chart => chart.destroy())
|
||||
})
|
||||
</script>
|
||||
@@ -120,7 +151,7 @@ $white: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0px 20px 16px;
|
||||
padding: 0px 20px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
h3 {
|
||||
margin: 0;
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
<template>
|
||||
<div class="performance-comparison">
|
||||
<div class="comparison-header">
|
||||
<h2>业绩周期对比</h2>
|
||||
<div class="period-selector-wrapper">
|
||||
<label for="period-select">对比周期:</label>
|
||||
<select id="period-select" v-model="selectedPeriod" @change="fetchComparisonData" class="period-select">
|
||||
<option value="last_week">与上周对比</option>
|
||||
<option value="last_month">与上月对比</option>
|
||||
<option value="last_quarter">与上季度对比</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="loading-state">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>正在加载对比数据...</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="!previousPeriodData" class="empty-state">
|
||||
<p>暂无对比周期的数据。</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="comparison-table-wrapper">
|
||||
<table class="comparison-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="metric-col">核心指标</th>
|
||||
<th>本期数据</th>
|
||||
<th>{{ selectedPeriodLabel }}数据</th>
|
||||
<th class="change-col">变化情况</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="metric in comparedMetrics" :key="metric.key">
|
||||
<td class="metric-col">
|
||||
<span class="metric-label">{{ metric.label }}</span>
|
||||
</td>
|
||||
<td>{{ formatValue(metric.current, metric.unit) }}</td>
|
||||
<td>{{ formatValue(metric.previous, metric.unit) }}</td>
|
||||
<td class="change-col">
|
||||
<div class="change-cell">
|
||||
<span class="change-value" :class="getChangeClass(metric.change.trend)">
|
||||
<span v-if="metric.change.trend === 'up'" class="trend-icon">↑</span>
|
||||
<span v-if="metric.change.trend === 'down'" class="trend-icon">↓</span>
|
||||
{{ metric.change.percentage }}
|
||||
</span>
|
||||
<span class="change-diff">{{ formatChange(metric.change.diff, metric.unit) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue';
|
||||
// 假设你有一个API服务来获取对比数据
|
||||
// import { getPerformanceComparisonData } from '@/api/senorManger.js';
|
||||
|
||||
// **MODIFIED**: 更新模拟API以返回新的数据结构
|
||||
const getPerformanceComparisonData = async (params) => {
|
||||
console.log('模拟API请求 (新数据结构):', params);
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
let mockData;
|
||||
if (params.period === 'last_week') {
|
||||
mockData = {
|
||||
"allocated_data_volume": 650,
|
||||
"wechat_added_volume": 410,
|
||||
"call_volume_after_classification": { "加微通话": 10, "20分钟通话": 50, "未分类": 150, "无效通话": 100, "促到课": 40 },
|
||||
"call_avg_duration_after_classification": { "加微通话": 4.5, "20分钟通话": 15.0, "未分类": 1.5, "无效通话": 1.0, "促到课": 2.0 },
|
||||
"deposit_volume": 40,
|
||||
"transaction_volume": 52,
|
||||
"conversion_rate": "8.00%"
|
||||
};
|
||||
} else if (params.period === 'last_month') {
|
||||
mockData = {
|
||||
"allocated_data_volume": 2800,
|
||||
"wechat_added_volume": 1800,
|
||||
"call_volume_after_classification": { "加微通话": 40, "20分钟通话": 220, "未分类": 600, "视频通话": 50, "无效通话": 450, "促到课": 180 },
|
||||
"call_avg_duration_after_classification": { "加微通话": 5.0, "20分钟通话": 16.0, "未分类": 1.8, "视频通话": 6.0, "无效通话": 1.1, "促到课": 1.5 },
|
||||
"deposit_volume": 180,
|
||||
"transaction_volume": 230,
|
||||
"conversion_rate": "8.21%"
|
||||
};
|
||||
} else { // last_quarter
|
||||
mockData = {
|
||||
"allocated_data_volume": 8500,
|
||||
"wechat_added_volume": 5500,
|
||||
"call_volume_after_classification": { "加微通话": 120, "20分钟通话": 650, "未分类": 1800, "视频通话": 150, "无效通话": 1200, "促到课": 500 },
|
||||
"call_avg_duration_after_classification": { "加微通话": 4.8, "20分钟通话": 16.5, "未分类": 1.7, "视频通话": 5.5, "无效通话": 1.0, "促到课": 1.8 },
|
||||
"deposit_volume": 550,
|
||||
"transaction_volume": 700,
|
||||
"conversion_rate": "8.24%"
|
||||
};
|
||||
}
|
||||
resolve({ code: 200, data: mockData });
|
||||
}, 800);
|
||||
});
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
currentPeriodData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const selectedPeriod = ref('last_month');
|
||||
const previousPeriodData = ref(null);
|
||||
const isLoading = ref(false);
|
||||
|
||||
const periodLabels = {
|
||||
last_week: '上周',
|
||||
last_month: '上月',
|
||||
last_quarter: '上季度',
|
||||
};
|
||||
|
||||
const selectedPeriodLabel = computed(() => periodLabels[selectedPeriod.value]);
|
||||
|
||||
const fetchComparisonData = async () => {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const res = await getPerformanceComparisonData({ period: selectedPeriod.value });
|
||||
if (res.code === 200) {
|
||||
previousPeriodData.value = res.data;
|
||||
} else {
|
||||
previousPeriodData.value = null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取对比数据失败:', error);
|
||||
previousPeriodData.value = null;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchComparisonData();
|
||||
});
|
||||
|
||||
watch(() => props.currentPeriodData, () => {
|
||||
fetchComparisonData();
|
||||
}, { deep: true });
|
||||
|
||||
// **NEW**: 新增一个工具函数,用于处理API返回的复杂数据结构
|
||||
// 并将其转换为表格渲染所需的扁平化结构
|
||||
const processRawData = (rawData) => {
|
||||
if (!rawData) return null;
|
||||
|
||||
// 1. 计算通话总量
|
||||
const totalCalls = Object.values(rawData.call_volume_after_classification || {})
|
||||
.reduce((sum, count) => sum + count, 0);
|
||||
|
||||
// 2. 计算通话总时长 (分钟)
|
||||
// 逻辑: (分类通话数 * 分类平均时长) 的总和
|
||||
const callVolumes = rawData.call_volume_after_classification || {};
|
||||
const avgDurations = rawData.call_avg_duration_after_classification || {};
|
||||
const totalDurationInMinutes = Object.keys(callVolumes).reduce((sum, key) => {
|
||||
const volume = callVolumes[key] || 0;
|
||||
const avgDuration = avgDurations[key] || 0;
|
||||
return sum + (volume * avgDuration);
|
||||
}, 0);
|
||||
|
||||
// 3. 将转化率字符串 "7.98%" 转为数字 7.98
|
||||
const conversionRateValue = parseFloat(rawData.conversion_rate) || 0;
|
||||
|
||||
// 4. 返回一个与旧版组件兼容的对象结构
|
||||
return {
|
||||
assignedLeads: rawData.allocated_data_volume,
|
||||
wechatAdds: rawData.wechat_added_volume,
|
||||
calls: totalCalls,
|
||||
// 组件内部格式化时会除以60,因此这里需要乘以60,将分钟转为秒
|
||||
callDuration: totalDurationInMinutes * 60,
|
||||
deposits: rawData.deposit_volume,
|
||||
deals: rawData.transaction_volume,
|
||||
conversionRate: conversionRateValue,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
const comparedMetrics = computed(() => {
|
||||
// **MODIFIED**: 在计算前,先使用 processRawData 对数据进行处理
|
||||
const processedCurrentData = processRawData(props.currentPeriodData);
|
||||
const processedPreviousData = processRawData(previousPeriodData.value);
|
||||
|
||||
if (!processedCurrentData || !processedPreviousData) return [];
|
||||
|
||||
// 指标配置保持不变,因为数据已经被处理成它期望的格式
|
||||
const metricsConfig = [
|
||||
{ key: 'assignedLeads', label: '分配数据量', unit: '个' },
|
||||
{ key: 'wechatAdds', label: '加微量', unit: '个' },
|
||||
{ key: 'calls', label: '通话量', unit: '次' },
|
||||
{ key: 'callDuration', label: '通话总时长', unit: '分钟' },
|
||||
{ key: 'deposits', label: '定金量', unit: '单' },
|
||||
{ key: 'deals', label: '成交量', unit: '单' },
|
||||
{ key: 'conversionRate', label: '转化率', unit: '%' },
|
||||
];
|
||||
|
||||
return metricsConfig.map(metric => {
|
||||
const current = processedCurrentData[metric.key];
|
||||
const previous = processedPreviousData[metric.key];
|
||||
return {
|
||||
...metric,
|
||||
current,
|
||||
previous,
|
||||
change: calculateChange(current, previous),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const calculateChange = (current, previous) => {
|
||||
if (previous === null || previous === undefined || isNaN(current) || isNaN(previous)) {
|
||||
return { diff: 'N/A', percentage: 'N/A', trend: 'neutral' };
|
||||
}
|
||||
|
||||
const diff = current - previous;
|
||||
let percentage;
|
||||
if (previous === 0) {
|
||||
percentage = current > 0 ? '+100.0%' : '0.0%';
|
||||
} else {
|
||||
const percentageValue = (diff / previous) * 100;
|
||||
percentage = `${percentageValue > 0 ? '+' : ''}${percentageValue.toFixed(1)}%`;
|
||||
}
|
||||
|
||||
let trend = 'neutral';
|
||||
if (diff > 0) trend = 'up';
|
||||
if (diff < 0) trend = 'down';
|
||||
|
||||
return { diff, percentage, trend };
|
||||
};
|
||||
|
||||
const formatValue = (value, unit) => {
|
||||
if (value === null || value === undefined) return '-';
|
||||
if (unit === '分钟') {
|
||||
// 假设传入的value是秒,转换为分钟显示
|
||||
return `${Math.round(value / 60)} 分钟`;
|
||||
}
|
||||
if (unit === '%') {
|
||||
return `${value.toFixed(1)}%`;
|
||||
}
|
||||
return value.toLocaleString();
|
||||
};
|
||||
|
||||
const formatChange = (diff, unit) => {
|
||||
if (typeof diff !== 'number') return '';
|
||||
const prefix = diff > 0 ? '+' : '-';
|
||||
const absDiff = Math.abs(diff);
|
||||
|
||||
if (unit === '分钟') {
|
||||
// 假设diff是秒,转换为分钟显示
|
||||
return `${prefix}${Math.round(absDiff / 60)} 分钟`;
|
||||
}
|
||||
if (unit === '%') {
|
||||
return `${prefix}${absDiff.toFixed(1)}%`;
|
||||
}
|
||||
return `${prefix}${absDiff.toLocaleString()}`;
|
||||
};
|
||||
|
||||
const getChangeClass = (trend) => {
|
||||
if (trend === 'up') return 'positive';
|
||||
if (trend === 'down') return 'negative';
|
||||
return 'neutral';
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 样式部分无需改动,因此省略以保持简洁 */
|
||||
.performance-comparison {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.comparison-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
|
||||
h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: #1a202c;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.period-selector-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
|
||||
label {
|
||||
font-size: 0.9rem;
|
||||
color: #718096;
|
||||
}
|
||||
|
||||
.period-select {
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #cbd5e0;
|
||||
background-color: #ffffff;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: #a0aec0;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #4299e1;
|
||||
box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comparison-table-wrapper {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.comparison-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
|
||||
th, td {
|
||||
padding: 1rem 1.25rem;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
thead th {
|
||||
font-size: 0.8rem;
|
||||
color: #718096;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
background-color: #f7fafc;
|
||||
border-bottom: 2px solid #e2e8f0;
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
transition: background-color 0.15s ease-in-out;
|
||||
&:nth-child(odd) {
|
||||
background-color: #fdfdff;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #f0f5ff;
|
||||
}
|
||||
}
|
||||
|
||||
tbody td {
|
||||
font-size: 0.95rem;
|
||||
color: #2d3748;
|
||||
}
|
||||
|
||||
.metric-col {
|
||||
min-width: 150px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.change-col {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
|
||||
.change-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.25rem;
|
||||
|
||||
.change-value {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-weight: 600;
|
||||
padding: 0.25rem 0.6rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.85rem;
|
||||
|
||||
&.positive {
|
||||
background-color: #ecfdf5;
|
||||
color: #065f46;
|
||||
}
|
||||
&.negative {
|
||||
background-color: #fff1f2;
|
||||
color: #9f1239;
|
||||
}
|
||||
&.neutral {
|
||||
background-color: #f8fafc;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.trend-icon {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.change-diff {
|
||||
font-size: 0.8rem;
|
||||
color: #718096;
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.loading-state, .empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem;
|
||||
color: #a0aec0;
|
||||
font-size: 1rem;
|
||||
background-color: #f7fafc;
|
||||
border-radius: 8px;
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid #e2e8f0;
|
||||
border-top: 4px solid #4299e1;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
@@ -87,7 +87,7 @@ $white: #ffffff;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 26rem !important;
|
||||
height: 21.5rem !important;
|
||||
max-height: 26rem;
|
||||
// flex: 1;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ $white: #ffffff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 20px 16px;
|
||||
padding: 10px 20px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
h3 {
|
||||
|
||||
@@ -5,35 +5,35 @@
|
||||
<div class="stat-icon customer-rate">
|
||||
<i class="el-icon-chat-dot-round"></i>
|
||||
</div>
|
||||
<div class="kpi-value">{{ customerCommunicationRate.active_customer_communication_rate||0 }}</div>
|
||||
<div class="kpi-value">{{ (customerCommunicationRate && customerCommunicationRate.active_customer_communication_rate) || 0 }}</div>
|
||||
<p>活跃客户沟通率 <i class="el-icon-warning info-icon" @mouseenter="showTooltip($event, 'customerCommunicationRate')" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon response-time">
|
||||
<i class="el-icon-timer"></i>
|
||||
</div>
|
||||
<div class="kpi-value">{{ averageResponseTime.average_answer_time||0 }}<span class="kpi-unit">分钟</span></div>
|
||||
<div class="kpi-value">{{ (averageResponseTime && averageResponseTime.average_answer_time)||0 }}<span class="kpi-unit">分钟</span></div>
|
||||
<p>平均应答时间 <i class="el-icon-warning info-icon" @mouseenter="showTooltip($event, 'averageResponseTime')" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon timeout-rate">
|
||||
<i class="el-icon-warning"></i>
|
||||
</div>
|
||||
<div class="kpi-value">{{ timeoutResponseRate.timeout_rate||0 }}</div>
|
||||
<div class="kpi-value">{{ (timeoutResponseRate && timeoutResponseRate.timeout_rate)||0 }}</div>
|
||||
<p>超时应答率 <i class="el-icon-warning info-icon" @mouseenter="showTooltip($event, 'timeoutResponseRate')" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon severe-timeout-rate">
|
||||
<i class="el-icon-warning-outline"></i>
|
||||
</div>
|
||||
<div class="kpi-value">{{ timeoutResponseRate.serious_timeout_rate||0 }}</div>
|
||||
<div class="kpi-value">{{ (timeoutResponseRate && timeoutResponseRate.serious_timeout_rate)||0 }}</div>
|
||||
<p>严重超时应答率 <i class="el-icon-warning info-icon" @mouseenter="showTooltip($event, 'severeTimeoutRate')" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
<div class="kpi-item stat-item">
|
||||
<div class="stat-icon form-rate">
|
||||
<i class="el-icon-document"></i>
|
||||
</div>
|
||||
<div class="kpi-value">{{ formCompletionRate.table_filling_rate||0 }}</div>
|
||||
<div class="kpi-value">{{ (formCompletionRate && formCompletionRate.table_filling_rate)||0 }}</div>
|
||||
<p>表格填写率 <i class="el-icon-warning info-icon" @mouseenter="showTooltip($event, 'formCompletionRate')" @mouseleave="hideTooltip">ⓘ</i></p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,24 +53,24 @@ import Tooltip from '@/components/Tooltip.vue';
|
||||
|
||||
defineProps({
|
||||
customerCommunicationRate: {
|
||||
type: Number,
|
||||
default: 0
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
averageResponseTime: {
|
||||
type: Number,
|
||||
default: 0
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
timeoutResponseRate: {
|
||||
type: Number,
|
||||
default: 0
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
severeTimeoutRate: {
|
||||
type: Number,
|
||||
default: 0
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
formCompletionRate: {
|
||||
type: Number,
|
||||
default: 0
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,42 @@
|
||||
|
||||
<div v-if="!isRouteNavigation">
|
||||
<!-- 用户下拉菜单 -->
|
||||
<UserDropdown class="header-ringht" style="margin-left: auto;" />
|
||||
<div style="display: flex; align-items: center; gap: 20px;">
|
||||
<button @click="showDepartmentAnalysisModal" class="feedback-btn">部门分析</button>
|
||||
<button @click="showFeedbackFormModal" class="feedback-btn">意见反馈</button>
|
||||
<FeedbackForm
|
||||
:is-visible="showFeedbackForm"
|
||||
@close="closeFeedbackFormModal"
|
||||
@submit-feedback="closeFeedbackFormModal"
|
||||
/>
|
||||
<!-- 部门分析弹窗 -->
|
||||
<div v-if="showDepartmentAnalysis" class="department-analysis-modal" @click.self="closeDepartmentAnalysisModal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3>部门分析</h3>
|
||||
<button class="close-btn" @click="closeDepartmentAnalysisModal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div v-if="departmentAnalysisData && departmentAnalysisData.length > 0">
|
||||
<div v-for="(report, index) in departmentAnalysisData" :key="index" class="report-item">
|
||||
<h4>报告时间: {{ report.start_time }} 至 {{ report.end_time }}</h4>
|
||||
<div v-if="report.report && report.report !== 'None' && report.report.trim() !== ''" class="report-content" v-html="formatReportContent(report.report)"></div>
|
||||
<div v-else class="no-report">
|
||||
<p>暂无分析报告</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>暂无部门分析数据</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<UserDropdown
|
||||
:card-visibility="cardVisibility"
|
||||
@update-card-visibility="updateCardVisibility"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,37 +71,46 @@
|
||||
<main class="dashboard-main">
|
||||
<div class="top-section">
|
||||
<CenterOverview
|
||||
v-if="cardVisibility.centerOverview"
|
||||
style="height: 330px;"
|
||||
:overallTeamPerformance="overallTeamPerformance"
|
||||
@update-check-type="updateCheckType"
|
||||
/>
|
||||
<div class="action-items-compact">
|
||||
<TeamAlerts style="height: 300px;" :abnormalData="teamAlerts" />
|
||||
<div v-if="cardVisibility.teamAlerts" class="action-items-compact">
|
||||
<!-- <TeamAlerts style="height: 300px;" :abnormalData="teamAlerts" /> -->
|
||||
<div v-if="cardVisibility.problemRanking" class="problem-ranking">
|
||||
<!-- 客户迫切解决的问题 -->
|
||||
<ProblemRanking :problemRanking="problemRanking" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<StatisticalIndicators
|
||||
v-if="cardVisibility.statisticalIndicators"
|
||||
:customerCommunicationRate="statisticalIndicators.customerCommunicationRate"
|
||||
:averageResponseTime="statisticalIndicators.averageResponseTime"
|
||||
:timeoutResponseRate="statisticalIndicators.timeoutResponseRate"
|
||||
:severeTimeoutRate="statisticalIndicators.severeTimeoutRate"
|
||||
:formCompletionRate="statisticalIndicators.formCompletionRate"
|
||||
/>
|
||||
<!-- 新增:业绩周期对比组件 -->
|
||||
<div v-if="false" class="performance-comparison-section">
|
||||
<PerformanceComparison :current-period-data="currentPeriodMetrics" />
|
||||
</div>
|
||||
<!-- Bottom Section -->
|
||||
<div class="bottom-section">
|
||||
<!-- Left Section - Group Performance Ranking -->
|
||||
<div class="left-section">
|
||||
<div v-if="cardVisibility.groupRanking" class="left-section">
|
||||
<GroupRanking
|
||||
:groups="groups"
|
||||
:teamSalesFunnel="teamSalesFunnel"
|
||||
:selected-group="selectedGroup"
|
||||
@select-group="selectGroup"
|
||||
/>
|
||||
</div>
|
||||
<div class="problem-ranking">
|
||||
<!-- 客户迫切解决的问题 -->
|
||||
<ProblemRanking :problemRanking="problemRanking" />
|
||||
</div>
|
||||
<GoodMusic style="height: 300px;" :qualityCalls="excellentRecord" />
|
||||
<!-- Right Section - Group Comparison -->
|
||||
<div class="right-section">
|
||||
<div v-if="cardVisibility.groupComparison" class="right-section">
|
||||
<GroupComparison
|
||||
:groups="groups"
|
||||
:teamRanking="teamRanking"
|
||||
@@ -75,8 +119,11 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Team Members Detail Section -->
|
||||
<div class="team-detail-section" v-if="selectedGroup">
|
||||
<div class="team-detail-section" v-if="selectedGroup && cardVisibility.teamDetail">
|
||||
<!-- 团队详情加载状态 -->
|
||||
<div v-if="isTeamDetailLoading" class="team-loading">
|
||||
<div class="loading-spinner"></div>
|
||||
@@ -85,6 +132,7 @@
|
||||
<!-- 团队详情内容 -->
|
||||
<div v-else>
|
||||
<div class="team-detail-header">
|
||||
<div>
|
||||
<h2>{{ selectedGroup.name }} - 团队成员详情</h2>
|
||||
<div class="team-summary">
|
||||
<div class="summary-item">
|
||||
@@ -106,6 +154,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="group-performance">
|
||||
<button @click="showTeamAnalysisModal">团队整体分析</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 团队分析弹窗 -->
|
||||
<div v-if="showTeamAnalysis" class="team-analysis-modal" @click.self="closeTeamAnalysisModal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3>团队整体分析</h3>
|
||||
<button class="close-btn" @click="closeTeamAnalysisModal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div v-if="teamAnalysisData && teamAnalysisData.length > 0">
|
||||
<div v-for="(report, index) in teamAnalysisData" :key="index" class="report-item">
|
||||
<h4>报告时间: {{ report.start_time }} 至 {{ report.end_time }}</h4>
|
||||
<div v-if="report.report && report.report !== 'None' && report.report.trim() !== ''" class="report-content" v-html="formatReportContent(report.report)"></div>
|
||||
<div v-else class="no-report">
|
||||
<p>暂无分析报告</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>暂无团队分析数据</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="members-grid">
|
||||
<div
|
||||
v-for="member in teamPerformanceDetail.group_details"
|
||||
@@ -174,23 +251,26 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed, reactive } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { computed, reactive } from 'vue'
|
||||
import Tooltip from '@/components/Tooltip.vue'
|
||||
import CenterOverview from './components/CenterOverview.vue'
|
||||
import GroupComparison from './components/GroupComparison.vue'
|
||||
import GroupRanking from './components/GroupRanking.vue'
|
||||
import GoodMusic from './components/GoodMusic.vue'
|
||||
import TeamAlerts from '../maneger/components/TeamAlerts.vue'
|
||||
import ProblemRanking from './components/ProblemRanking.vue'
|
||||
import StatisticalIndicators from './components/StatisticalIndicators.vue'
|
||||
import UserDropdown from '@/components/UserDropdown.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
import PerformanceComparison from './components/PerformanceComparison.vue'; // 1. 导入新组件
|
||||
import { getOverallTeamPerformance,getTotalGroupCount,getConversionRate,getTotalCallCount,
|
||||
getNewCustomer,getDepositConversionRate,getActiveCustomerCommunicationRate,getAverageAnswerTime,
|
||||
getTimeoutRate,getTableFillingRate,getUrgentNeedToAddress,getTeamRanking,getTeamRankingInfo,getAbnormalResponseRate } from '@/api/senorManger.js'
|
||||
|
||||
getTimeoutRate,getTableFillingRate,getUrgentNeedToAddress,getTeamRanking,getTeamRankingInfo,
|
||||
getAbnormalResponseRate,getTeamSalesFunnel,getExcellentRecordFile,getTeamEveryGroupReport,
|
||||
getTeamEntiretyReport } from '@/api/senorManger.js'
|
||||
import { useUserStore } from '@/stores/user.js'
|
||||
import FeedbackForm from "@/components/FeedbackForm.vue";
|
||||
|
||||
// 缓存系统
|
||||
const cache = new Map()
|
||||
@@ -226,7 +306,6 @@ const withCache = async (functionName, apiCall, params = {}) => {
|
||||
return cachedData
|
||||
}
|
||||
|
||||
console.log(`调用API获取数据: ${functionName}`, params)
|
||||
const result = await apiCall()
|
||||
setCache(cacheKey, result)
|
||||
return result
|
||||
@@ -238,6 +317,25 @@ const clearCache = () => {
|
||||
console.log('所有缓存已清除')
|
||||
}
|
||||
|
||||
// 优秀录音
|
||||
const excellentRecord = ref([]);
|
||||
async function CenterExcellentRecord() {
|
||||
const params={
|
||||
user_level:userStore.userInfo.user_level.toString(),
|
||||
user_name:userStore.userInfo.username
|
||||
}
|
||||
try {
|
||||
const cacheKey = getCacheKey('CenterExcellentRecord', params);
|
||||
const result = await withCache(cacheKey, async () => {
|
||||
const res = await getExcellentRecordFile(params);
|
||||
return res.data;
|
||||
});
|
||||
excellentRecord.value = result;
|
||||
} catch (error) {
|
||||
console.error("获取优秀录音失败:", error);
|
||||
}
|
||||
}
|
||||
|
||||
const clearSpecificCache = (functionName, params = {}) => {
|
||||
const cacheKey = getCacheKey(functionName, params)
|
||||
cache.delete(cacheKey)
|
||||
@@ -273,19 +371,19 @@ const forceRefreshAllData = async () => {
|
||||
|
||||
try {
|
||||
isLoading.value = true
|
||||
await fetchOverallTeamPerformance()
|
||||
await fetchActiveGroups()
|
||||
await fetchConversionRate()
|
||||
await fetchTotalCallCount()
|
||||
await fetchNewCustomers()
|
||||
await fetchDepositConversions()
|
||||
await fetchAbnormalResponseRate()
|
||||
await fetchCustomerCommunicationRate()
|
||||
await fetchAverageResponseTime()
|
||||
await fetchTimeoutRate()
|
||||
await fetchTableFillingRate()
|
||||
await fetchUrgentNeedToAddress()
|
||||
await fetchTeamRanking()
|
||||
fetchOverallTeamPerformance()
|
||||
fetchActiveGroups()
|
||||
fetchConversionRate()
|
||||
fetchTotalCallCount()
|
||||
fetchNewCustomers()
|
||||
fetchDepositConversions()
|
||||
fetchAbnormalResponseRate()
|
||||
fetchCustomerCommunicationRate()
|
||||
fetchAverageResponseTime()
|
||||
fetchTimeoutRate()
|
||||
fetchTableFillingRate()
|
||||
fetchUrgentNeedToAddress()
|
||||
fetchTeamRanking()
|
||||
console.log('所有数据已强制刷新完成')
|
||||
} catch (error) {
|
||||
console.error('强制刷新数据失败:', error)
|
||||
@@ -300,6 +398,16 @@ const timeoutResponseRate = ref(5)
|
||||
const severeTimeoutRate = ref(2)
|
||||
const formCompletionRate = ref(90)
|
||||
const CheckType = ref('month')
|
||||
// FeedbackForm 控制变量
|
||||
const showFeedbackForm = ref(false)
|
||||
// 部门分析弹窗控制变量
|
||||
const showDepartmentAnalysis = ref(false)
|
||||
// 团队分析弹窗控制变量
|
||||
const showTeamAnalysis = ref(false)
|
||||
// 团队分析数据
|
||||
const teamAnalysisData = ref([])
|
||||
// 部门分析数据
|
||||
const departmentAnalysisData = ref([])
|
||||
|
||||
// 更新CheckType的方法
|
||||
const updateCheckType = async (newValue) => {
|
||||
@@ -311,6 +419,117 @@ const updateCheckType = async (newValue) => {
|
||||
console.log('数据已根据新的统计模式重新加载')
|
||||
}
|
||||
|
||||
// FeedbackForm 控制方法
|
||||
const showFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = true
|
||||
}
|
||||
|
||||
const closeFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = false
|
||||
}
|
||||
|
||||
// 部门分析弹窗控制方法
|
||||
const showDepartmentAnalysisModal = async () => {
|
||||
showDepartmentAnalysis.value = true
|
||||
// 获取部门分析数据
|
||||
try {
|
||||
// 获取当前登录的高级经理信息
|
||||
const currentUser = userStore.userInfo;
|
||||
const params = {
|
||||
user_name: currentUser.username,
|
||||
user_level: currentUser.user_level.toString(),
|
||||
part_count: 1 // 默认获取最近1份报告
|
||||
}
|
||||
|
||||
const response = await getTeamEntiretyReport(params)
|
||||
|
||||
// 根据API响应结构调整数据处理逻辑
|
||||
if (response.data) {
|
||||
if (Array.isArray(response.data)) {
|
||||
// 如果response.data本身就是数组
|
||||
departmentAnalysisData.value = response.data
|
||||
} else if (response.data.data && Array.isArray(response.data.data)) {
|
||||
// 如果response.data.data是数组
|
||||
departmentAnalysisData.value = response.data.data
|
||||
} else {
|
||||
// 其他情况,可能是单个对象
|
||||
departmentAnalysisData.value = [response.data]
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取部门分析数据失败:', error)
|
||||
departmentAnalysisData.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const closeDepartmentAnalysisModal = () => {
|
||||
showDepartmentAnalysis.value = false
|
||||
}
|
||||
|
||||
// 团队分析弹窗控制方法
|
||||
const showTeamAnalysisModal = async () => {
|
||||
showTeamAnalysis.value = true
|
||||
// 获取团队分析数据
|
||||
try {
|
||||
const params = {
|
||||
department_name: selectedGroup.value.name + '-' + selectedGroup.value.leader,
|
||||
part_count: 1 // 默认获取最近1份报告
|
||||
}
|
||||
const response = await getTeamEveryGroupReport(params)
|
||||
// 根据API响应结构调整数据处理逻辑
|
||||
if (response.data) {
|
||||
if (Array.isArray(response.data)) {
|
||||
// 如果response.data本身就是数组
|
||||
teamAnalysisData.value = response.data
|
||||
} else if (response.data.data && Array.isArray(response.data.data)) {
|
||||
// 如果response.data.data是数组
|
||||
teamAnalysisData.value = response.data.data
|
||||
} else {
|
||||
// 其他情况,可能是单个对象
|
||||
teamAnalysisData.value = [response.data]
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取团队分析数据失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const closeTeamAnalysisModal = () => {
|
||||
showTeamAnalysis.value = false
|
||||
}
|
||||
|
||||
// 格式化报告内容
|
||||
const formatReportContent = (content) => {
|
||||
if (!content) return ''
|
||||
// 将Markdown格式的标题转换为HTML标签
|
||||
return content
|
||||
.replace(/### (.*?)(?=\n|$)/g, '<h3>$1</h3>')
|
||||
.replace(/## (.*?)(?=\n|$)/g, '<h2>$1</h2>')
|
||||
.replace(/# (.*?)(?=\n|$)/g, '<h1>$1</h1>')
|
||||
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
|
||||
.replace(/\*(.*?)\*/g, '<em>$1</em>')
|
||||
.replace(/\n\n/g, '</p><p>')
|
||||
.replace(/\n/g, '<br>')
|
||||
}
|
||||
|
||||
// 卡片显示状态
|
||||
const cardVisibility = ref({
|
||||
centerOverview: true,
|
||||
teamAlerts: true,
|
||||
statisticalIndicators: true,
|
||||
groupRanking: true,
|
||||
problemRanking: true,
|
||||
groupComparison: true,
|
||||
teamDetail: true,
|
||||
performanceComparison: true, // 2. 新增组件的可见性控制
|
||||
})
|
||||
|
||||
// 更新卡片显示状态
|
||||
const updateCardVisibility = (newVisibility) => {
|
||||
Object.assign(cardVisibility.value, newVisibility)
|
||||
console.log('卡片显示状态已更新:', cardVisibility.value)
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
// 路由实例
|
||||
const router = useRouter()
|
||||
@@ -397,7 +616,6 @@ async function fetchActiveGroups() {
|
||||
requestParams
|
||||
)
|
||||
overallTeamPerformance.value.activeGroups = response.data
|
||||
console.log('活跃组数:', response.data)
|
||||
} catch (error) {
|
||||
console.error('获取活跃组数失败:', error)
|
||||
}
|
||||
@@ -478,20 +696,34 @@ async function fetchDepositConversions() {
|
||||
requestParams
|
||||
)
|
||||
overallTeamPerformance.value.depositConversions = response.data
|
||||
console.log(99888999,response.data)
|
||||
} catch (error) {
|
||||
console.error('获取定金转化失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const statisticalIndicators = ref({
|
||||
customerCommunicationRate: 0,
|
||||
averageResponseTime: 0,
|
||||
timeoutResponseRate: 0,
|
||||
severeTimeoutRate: 0,
|
||||
formCompletionRate: 0,
|
||||
customerCommunicationRate: {},
|
||||
averageResponseTime: {},
|
||||
timeoutResponseRate: {},
|
||||
severeTimeoutRate: {},
|
||||
formCompletionRate: {},
|
||||
})
|
||||
|
||||
// 销售漏斗
|
||||
const teamSalesFunnel = ref({})
|
||||
async function GetTeamSalesFunnel() {
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
const requestParams = hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value}
|
||||
const res = await getTeamSalesFunnel(requestParams)
|
||||
if (res.code === 200) {
|
||||
teamSalesFunnel.value = res.data
|
||||
}
|
||||
}
|
||||
|
||||
// 团队异常
|
||||
const teamAlerts = ref({})
|
||||
// 异常预警
|
||||
@@ -506,33 +738,30 @@ async function fetchAbnormalResponseRate() {
|
||||
() => getAbnormalResponseRate(hasParams ? params : undefined),
|
||||
requestParams
|
||||
)
|
||||
const rawData = response.data
|
||||
const rawData = response.data || {} // 添加默认值防止null访问
|
||||
|
||||
// 转换数据格式,按团队分组生成预警消息
|
||||
const processedAlerts = []
|
||||
const teamData = new Map()
|
||||
|
||||
// 收集严重超时异常数据
|
||||
// 添加安全检查防止访问null属性
|
||||
if (rawData.team_serious_timeout_abnormal_counts_by_group) {
|
||||
Object.entries(rawData.team_serious_timeout_abnormal_counts_by_group).forEach(([teamName, data]) => {
|
||||
if (!teamData.has(teamName)) {
|
||||
teamData.set(teamName, { timeoutCount: 0, fillingCount: 0 })
|
||||
}
|
||||
teamData.get(teamName).timeoutCount = data.count
|
||||
teamData.get(teamName).timeoutCount = data.count || 0
|
||||
})
|
||||
}
|
||||
|
||||
// 收集表格填写异常数据
|
||||
if (rawData.team_table_filling_abnormal_counts_by_group) {
|
||||
Object.entries(rawData.team_table_filling_abnormal_counts_by_group).forEach(([teamName, data]) => {
|
||||
if (!teamData.has(teamName)) {
|
||||
teamData.set(teamName, { timeoutCount: 0, fillingCount: 0 })
|
||||
}
|
||||
teamData.get(teamName).fillingCount = data.count
|
||||
teamData.get(teamName).fillingCount = data.count || 0
|
||||
})
|
||||
}
|
||||
|
||||
// 生成按团队分组的预警消息
|
||||
let alertId = 1
|
||||
teamData.forEach((counts, teamName) => {
|
||||
const messages = []
|
||||
@@ -553,7 +782,6 @@ async function fetchAbnormalResponseRate() {
|
||||
}
|
||||
})
|
||||
|
||||
// 设置处理后的数据
|
||||
teamAlerts.value = { processedAlerts }
|
||||
|
||||
} catch (error) {
|
||||
@@ -572,9 +800,12 @@ async function fetchCustomerCommunicationRate() {
|
||||
() => getActiveCustomerCommunicationRate(hasParams ? params : undefined),
|
||||
requestParams
|
||||
)
|
||||
statisticalIndicators.value.customerCommunicationRate = response.data
|
||||
// 确保响应数据不为null
|
||||
statisticalIndicators.value.customerCommunicationRate = response.data || {}
|
||||
} catch (error) {
|
||||
console.error('获取活跃客户沟通率失败:', error)
|
||||
// 出错时设置为空对象
|
||||
statisticalIndicators.value.customerCommunicationRate = {}
|
||||
}
|
||||
}
|
||||
// 统计指标--平均应答时间
|
||||
@@ -589,9 +820,12 @@ async function fetchAverageResponseTime() {
|
||||
() => getAverageAnswerTime(hasParams ? params : undefined),
|
||||
requestParams
|
||||
)
|
||||
statisticalIndicators.value.averageResponseTime = response.data
|
||||
// 确保响应数据不为null
|
||||
statisticalIndicators.value.averageResponseTime = response.data || {}
|
||||
} catch (error) {
|
||||
console.error('获取平均应答时间失败:', error)
|
||||
// 出错时设置为空对象
|
||||
statisticalIndicators.value.averageResponseTime = {}
|
||||
}
|
||||
}
|
||||
// 统计指标--超时应答率、严重超时应答率
|
||||
@@ -606,9 +840,15 @@ async function fetchTimeoutRate() {
|
||||
() => getTimeoutRate(hasParams ? params : undefined),
|
||||
requestParams
|
||||
)
|
||||
statisticalIndicators.value.timeoutResponseRate = response.data
|
||||
// 确保响应数据不为null
|
||||
statisticalIndicators.value.timeoutResponseRate = response.data || {}
|
||||
// severeTimeoutRate使用相同的数据源
|
||||
statisticalIndicators.value.severeTimeoutRate = response.data || {}
|
||||
} catch (error) {
|
||||
console.error('获取超时应答率失败:', error)
|
||||
// 出错时设置为空对象
|
||||
statisticalIndicators.value.timeoutResponseRate = {}
|
||||
statisticalIndicators.value.severeTimeoutRate = {}
|
||||
}
|
||||
}
|
||||
// 统计指标--表格填写率
|
||||
@@ -623,9 +863,12 @@ async function fetchTableFillingRate() {
|
||||
() => getTableFillingRate(hasParams ? params : undefined),
|
||||
requestParams
|
||||
)
|
||||
statisticalIndicators.value.formCompletionRate = response.data
|
||||
// 确保响应数据不为null
|
||||
statisticalIndicators.value.formCompletionRate = response.data || {}
|
||||
} catch (error) {
|
||||
console.error('获取表格填写率失败:', error)
|
||||
// 出错时设置为空对象
|
||||
statisticalIndicators.value.formCompletionRate = {}
|
||||
}
|
||||
}
|
||||
const problemRanking = ref({})
|
||||
@@ -700,6 +943,7 @@ onMounted(async ()=>{
|
||||
await fetchOverallTeamPerformance()
|
||||
await fetchActiveGroups()
|
||||
await fetchConversionRate()
|
||||
await GetTeamSalesFunnel()
|
||||
await fetchTotalCallCount()
|
||||
await fetchNewCustomers()
|
||||
await fetchDepositConversions()
|
||||
@@ -710,11 +954,10 @@ onMounted(async ()=>{
|
||||
await fetchTableFillingRate()
|
||||
await fetchUrgentNeedToAddress()
|
||||
await fetchTeamRanking()
|
||||
await CenterExcellentRecord()
|
||||
|
||||
// 输出缓存信息
|
||||
console.log('缓存状态:', getCacheInfo())
|
||||
|
||||
// 开发环境下暴露缓存管理函数到全局
|
||||
if (import.meta.env.DEV) {
|
||||
window.seniorManagerCache = {
|
||||
clearCache,
|
||||
@@ -732,6 +975,19 @@ onMounted(async ()=>{
|
||||
}
|
||||
})
|
||||
|
||||
// 3. 新增计算属性,为新组件聚合本期数据
|
||||
const currentPeriodMetrics = computed(() => {
|
||||
return {
|
||||
assignedLeads: overallTeamPerformance.value.newCustomers?.count_this_period || 0,
|
||||
wechatAdds: teamSalesFunnel.value?.['加微'] || 0,
|
||||
calls: overallTeamPerformance.value.totalCalls?.count_this_period || 0,
|
||||
callDuration: 12580, // 假设数据来自API,这里使用模拟值
|
||||
deposits: teamSalesFunnel.value?.['定金'] || 0,
|
||||
deals: teamSalesFunnel.value?.['成交'] || 0,
|
||||
conversionRate: parseFloat(overallTeamPerformance.value.conversionRate?.conversion_rate_this_period) || 0,
|
||||
};
|
||||
});
|
||||
|
||||
// 组别数据
|
||||
const groups=[]
|
||||
// 当前选中的组别,默认为第一个
|
||||
@@ -741,14 +997,10 @@ const selectedGroup = ref(groups[0])
|
||||
const selectGroup = async (group) => {
|
||||
console.log('选择的组别:', group)
|
||||
selectedGroup.value = group
|
||||
// 获取部门名称并调用团队业绩详情接口
|
||||
// 从teamRanking数据中查找对应的原始部门名称
|
||||
let department = group.name
|
||||
if (teamRanking.value && teamRanking.value.formal_plural) {
|
||||
// 在formal_plural中查找匹配的部门名称
|
||||
const departmentKeys = Object.keys(teamRanking.value.formal_plural)
|
||||
const matchedDepartment = departmentKeys.find(key => {
|
||||
// 提取部门名称的主要部分进行匹配
|
||||
const mainName = key.split('-')[0] || key
|
||||
return group.name.includes(mainName) || mainName.includes(group.name)
|
||||
})
|
||||
@@ -758,7 +1010,6 @@ const selectGroup = async (group) => {
|
||||
}
|
||||
console.log('选中的部门:', group.name, '-> 发送的部门名称:', department)
|
||||
|
||||
// 设置团队详情加载状态
|
||||
isTeamDetailLoading.value = true
|
||||
try {
|
||||
await fetchTeamPerformanceDetail(department)
|
||||
@@ -772,8 +1023,6 @@ const selectGroup = async (group) => {
|
||||
// 处理团队双击事件
|
||||
const handleTeamDoubleClick = (group) => {
|
||||
console.log('团队双击事件触发,团队数据:', group)
|
||||
|
||||
// 跳转到manager页面,携带团队负责人和用户等级
|
||||
router.push({
|
||||
path: '/manager',
|
||||
query: {
|
||||
@@ -786,12 +1035,9 @@ const handleTeamDoubleClick = (group) => {
|
||||
// 处理成员双击事件
|
||||
const handleMemberDoubleClick = (member) => {
|
||||
console.log('双击事件触发,成员数据:', member)
|
||||
|
||||
// 将成员等级写死为1,所有成员都可以跳转
|
||||
const memberLevel = 1
|
||||
console.log('等级设置为1,准备跳转到Sale页面')
|
||||
|
||||
// 跳转到Sale页面,携带成员姓名和等级
|
||||
router.push({
|
||||
name: 'Sale',
|
||||
query: {
|
||||
@@ -826,7 +1072,6 @@ const getStatusText = (status) => {
|
||||
return statusMap[status] || '未知'
|
||||
}
|
||||
|
||||
|
||||
// 工具提示状态
|
||||
const tooltip = reactive({
|
||||
visible: false,
|
||||
@@ -936,7 +1181,6 @@ const hideTooltip = () => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
.action-items-compact {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -1056,12 +1300,19 @@ const hideTooltip = () => {
|
||||
|
||||
.team-detail-header {
|
||||
margin-bottom: 2rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
|
||||
h2 {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin: 0 0 1rem 0;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.team-summary {
|
||||
@@ -1087,6 +1338,32 @@ const hideTooltip = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.group-performance {
|
||||
button {
|
||||
background-color: #3b82f6;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
height: fit-content;
|
||||
|
||||
&:hover {
|
||||
background-color: #2563eb;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.members-grid {
|
||||
@@ -1466,4 +1743,215 @@ const hideTooltip = () => {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// 意见反馈按钮样式
|
||||
.feedback-btn {
|
||||
background-color: #4299e1;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.feedback-btn:hover {
|
||||
background-color: #3182ce;
|
||||
}
|
||||
|
||||
/* 部门分析弹窗样式 */
|
||||
.department-analysis-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
max-height: 80vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.modal-header h3 {
|
||||
margin: 0;
|
||||
color: #1a202c;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #718096;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.modal-body p {
|
||||
margin: 0;
|
||||
color: #4a5568;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 团队分析弹窗样式 */
|
||||
.team-analysis-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-content {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
max-height: 80vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-header h3 {
|
||||
margin: 0;
|
||||
color: #1a202c;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.team-analysis-modal .close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
cursor: pointer;
|
||||
color: #718096;
|
||||
padding: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.team-analysis-modal .close-btn:hover {
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-body {
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.team-analysis-modal .modal-body p {
|
||||
margin: 0;
|
||||
color: #4a5568;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-item {
|
||||
margin-bottom: 20px;
|
||||
padding: 15px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 5px;
|
||||
background-color: #f8fafc;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-item h4 {
|
||||
margin-top: 0;
|
||||
color: #1a202c;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content {
|
||||
margin-top: 10px;
|
||||
color: #4a5568;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content h1,
|
||||
.team-analysis-modal .report-content h2,
|
||||
.team-analysis-modal .report-content h3 {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 10px;
|
||||
color: #1a202c;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content h2 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content h3 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.team-analysis-modal .report-content em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.team-analysis-modal .no-report {
|
||||
text-align: center;
|
||||
color: #718096;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="time-selector">
|
||||
<select v-model="selectedTimeRange" @change="handleTimeRangeChange" class="time-select">
|
||||
<option value="month">本月 vs 上月</option>
|
||||
<option value="periods">本期 vs 上期</option>
|
||||
<!-- <option value="periods">本期 vs 上期</option> -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
:class="{ active: selectedRecording === index }"
|
||||
@click="selectRecording(index)"
|
||||
>
|
||||
<span class="recording-index">{{ recording.score}}</span>
|
||||
<div class="recording-info">
|
||||
<div class="recording-name" :title="recording.name">{{ recording.name.length > 10 ? recording.name.substring(0, 10) + '...' : recording.name }}</div>
|
||||
<div class="recording-meta">
|
||||
@@ -172,8 +173,8 @@ import MarkdownIt from 'markdown-it'
|
||||
// Props定义
|
||||
const props = defineProps({
|
||||
qualityCalls: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
@@ -221,25 +222,23 @@ const recordings = computed(() => {
|
||||
if (!props.qualityCalls ) {
|
||||
return staticRecordings.value;
|
||||
}
|
||||
|
||||
const recordingsList = [];
|
||||
Object.keys(props.qualityCalls).forEach(userName => {
|
||||
props.qualityCalls[userName].forEach((record, index) => {
|
||||
props.qualityCalls.forEach((record, index) => {
|
||||
recordingsList.push({
|
||||
id: recordingsList.length + 1,
|
||||
name: record.obj_file_name ? record.obj_file_name.split('/').pop() : `${record.sale_name}-录音-${index + 1}`,
|
||||
name: record.record_name ? record.record_name : `${record.sale_name}-录音-${index + 1}`,
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
url: record.obj_file_name,
|
||||
transcription: record.context || null,
|
||||
score: record.score,
|
||||
sop: record.sop,
|
||||
sale_name: record.sale_name,
|
||||
url: record.record_file_addr,
|
||||
transcription: record.record_context || null,
|
||||
score: record.record_score,
|
||||
sop: record.record_report,
|
||||
sale_name: record.record_name,
|
||||
size: 2048576, // 默认文件大小 2MB
|
||||
uploadTime: new Date().toLocaleDateString('zh-CN')
|
||||
});
|
||||
uploadTime: record.created_at,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
return recordingsList;
|
||||
})
|
||||
|
||||
@@ -512,7 +511,7 @@ const downloadRecording = (index) => {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 20px 0;
|
||||
padding: 10px 20px 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
@@ -549,7 +548,7 @@ const downloadRecording = (index) => {
|
||||
}
|
||||
|
||||
.chart-content {
|
||||
padding: 20px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.recording-section {
|
||||
@@ -562,7 +561,6 @@ const downloadRecording = (index) => {
|
||||
.recording-list {
|
||||
margin-bottom: 20px;
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.recording-item {
|
||||
@@ -602,6 +600,39 @@ const downloadRecording = (index) => {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.recording-index {
|
||||
/* 基础分数样式 */
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background-color: #e9ecef;
|
||||
color: #495057;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* 第一名样式 */
|
||||
.recording-item:first-child .recording-index {
|
||||
background: linear-gradient(135deg, #FFD700, #FFA500);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
|
||||
}
|
||||
|
||||
/* 第二名样式 */
|
||||
.recording-item:nth-child(2) .recording-index {
|
||||
background: linear-gradient(135deg, #C0C0C0, #A9A9A9);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(192, 192, 192, 0.3);
|
||||
}
|
||||
|
||||
/* 第三名样式 */
|
||||
.recording-item:nth-child(3) .recording-index {
|
||||
background: linear-gradient(135deg, #CD7F32, #A0522D);
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgba(205, 127, 50, 0.3);
|
||||
}
|
||||
|
||||
|
||||
.recording-meta {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="card-header">
|
||||
<h3>团队业绩排行榜</h3>
|
||||
<select v-model="rankingPeriod" class="periods-select" @change="onPeriodChange">
|
||||
<option value="periods">本期</option>
|
||||
<!-- <option value="periods">本期</option> -->
|
||||
<option value="month">月度</option>
|
||||
<option value="year">年度</option>
|
||||
</select>
|
||||
@@ -39,7 +39,7 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['periods-change']);
|
||||
|
||||
const rankingPeriod = ref('periods');
|
||||
const rankingPeriod = ref('month');
|
||||
const centerSalesRank = ref({});
|
||||
|
||||
// 计算属性:转换 centerSalesRank 数据格式
|
||||
@@ -82,77 +82,6 @@ async function getCenterSalesRank(data) {
|
||||
const res = await getCenterPerformanceRank(params);
|
||||
console.log('获取中心业绩排行榜:', res);
|
||||
centerSalesRank.value = res.data;
|
||||
/**
|
||||
* 0
|
||||
:
|
||||
{center_leader: "潘加俊", total_deals: 0, average_deals_per_member: 0}
|
||||
average_deals_per_member
|
||||
:
|
||||
0
|
||||
center_leader
|
||||
:
|
||||
"潘加俊"
|
||||
total_deals
|
||||
:
|
||||
0
|
||||
1
|
||||
:
|
||||
{center_leader: "张三丰", total_deals: 44, average_deals_per_member: 1}
|
||||
average_deals_per_member
|
||||
:
|
||||
1
|
||||
center_leader
|
||||
:
|
||||
"张三丰"
|
||||
total_deals
|
||||
:
|
||||
44
|
||||
2
|
||||
:
|
||||
{center_leader: "朱一航", total_deals: 0, average_deals_per_member: 0}
|
||||
average_deals_per_member
|
||||
:
|
||||
0
|
||||
center_leader
|
||||
:
|
||||
"朱一航"
|
||||
total_deals
|
||||
:
|
||||
0
|
||||
3
|
||||
:
|
||||
{center_leader: "程琦", total_deals: 0, average_deals_per_member: 0}
|
||||
average_deals_per_member
|
||||
:
|
||||
0
|
||||
center_leader
|
||||
:
|
||||
"程琦"
|
||||
total_deals
|
||||
:
|
||||
0
|
||||
4
|
||||
:
|
||||
{center_leader: "王卓琳", total_deals: 6, average_deals_per_member: 0}
|
||||
average_deals_per_member
|
||||
:
|
||||
0
|
||||
center_leader
|
||||
:
|
||||
"王卓琳"
|
||||
total_deals
|
||||
:
|
||||
6
|
||||
5
|
||||
:
|
||||
{center_leader: "伍晶晶", total_deals: 5, average_deals_per_member: 0}
|
||||
average_deals_per_member
|
||||
:
|
||||
0
|
||||
center_leader
|
||||
:
|
||||
"伍晶晶"
|
||||
*/
|
||||
} catch (error) {
|
||||
console.error('获取全中心业绩排行榜失败:', error);
|
||||
}
|
||||
|
||||
@@ -4,28 +4,41 @@
|
||||
<div class="dashboard-header">
|
||||
<h1>管理者数据看板</h1>
|
||||
<!-- 头像 -->
|
||||
<UserDropdown />
|
||||
<div style="display: flex; align-items: center; gap: 20px;">
|
||||
<button @click="showFeedbackFormModal" class="feedback-btn">意见反馈</button>
|
||||
<FeedbackForm
|
||||
:is-visible="showFeedbackForm"
|
||||
@close="closeFeedbackFormModal"
|
||||
@submit-feedback="closeFeedbackFormModal"
|
||||
/>
|
||||
<UserDropdown
|
||||
:card-visibility="cardVisibility"
|
||||
@update-card-visibility="updateCardVisibility"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第一行:核心业绩指标、销售实时进度 -->
|
||||
<div class="dashboard-row row-1">
|
||||
<!-- 核心业绩指标 -->
|
||||
<kpi-metrics :kpi-data="totalDeals" :format-number="formatNumber" />
|
||||
<kpi-metrics v-if="cardVisibility.kpiMetrics" :kpi-data="totalDeals" :format-number="formatNumber" />
|
||||
<!-- 销售实时进度 -->
|
||||
<sales-progress :sales-data="realTimeProgress" />
|
||||
<sales-progress v-if="cardVisibility.salesProgress" :sales-data="realTimeProgress" />
|
||||
<!-- 各中心营期阶段 -->
|
||||
<period-stage />
|
||||
<period-stage v-if="cardVisibility.periodStage" />
|
||||
</div>
|
||||
<!-- 第二行 -->
|
||||
<div class="dashboard-row row-3">
|
||||
<!-- 转化漏斗 -->
|
||||
<funnel-chart
|
||||
v-if="cardVisibility.funnelChart"
|
||||
:funnel-data="formattedFunnelData"
|
||||
:comparison-data="formattedComparisonData"
|
||||
@time-range-change="handleTimeRangeChange"
|
||||
/>
|
||||
<!-- 销售个人业绩排行榜 -->
|
||||
<personal-sales-ranking
|
||||
v-if="cardVisibility.personalSalesRanking"
|
||||
:ranking-data="formattedSalesRankingData"
|
||||
:format-number="formatNumber"
|
||||
:get-rank-class="getRankClass"
|
||||
@@ -34,6 +47,7 @@
|
||||
/>
|
||||
<!-- 优质通话 -->
|
||||
<quality-calls
|
||||
v-if="cardVisibility.qualityCalls"
|
||||
:quality-calls="excellentRecord"
|
||||
@play-call="playCall"
|
||||
@download-call="downloadCall"
|
||||
@@ -43,21 +57,23 @@
|
||||
<div class="dashboard-row row-3">
|
||||
<!-- 业绩排行榜 -->
|
||||
<ranking-list
|
||||
v-if="cardVisibility.rankingList"
|
||||
:format-number="formatNumber"
|
||||
:get-rank-class="getRankClass"
|
||||
/>
|
||||
<!-- 客户类型占比 -->
|
||||
<customer-type :customer-data="customerTypeRatio" @category-change="getCustomerTypeRatio" />
|
||||
<customer-type v-if="cardVisibility.customerType" :customer-data="customerTypeRatio" @category-change="getCustomerTypeRatio" />
|
||||
<!-- 客户迫切解决的问题排行榜 -->
|
||||
<problem-ranking :ranking-data="problemRankingData" />
|
||||
<problem-ranking v-if="cardVisibility.problemRanking" :ranking-data="problemRankingData" />
|
||||
</div>
|
||||
<!-- 第四行:详细数据表格和数据详情 -->
|
||||
<div class="dashboard-row" v-show="false">
|
||||
<CampManagement />
|
||||
<CampManagement v-if="cardVisibility.campManagement" />
|
||||
</div>
|
||||
<!-- 第五行 -->
|
||||
<div class="dashboard-row" >
|
||||
<DetailedDataTable
|
||||
v-if="cardVisibility.detailedDataTable"
|
||||
:table-data="detailData"
|
||||
:level-tree="levelTree"
|
||||
v-model:selected-person="selectedPerson"
|
||||
@@ -103,6 +119,7 @@ import PeriodStage from "./components/PeriodStage.vue";
|
||||
import { getOverallCompanyPerformance,getCompanyDepositConversionRate,getCompanyTotalCallCount,getCompanyNewCustomer,getCompanyConversionRate,getCompanyRealTimeProgress
|
||||
,getCompanyConversionRateVsLast,getSalesMonthlyPerformance,getCustomerTypeDistribution,getUrgentNeedToAddress,getLevelTree,getDetailedDataTable,getExcellentRecordFile } from "@/api/top";
|
||||
import { useUserStore } from "@/stores/user.js";
|
||||
import FeedbackForm from "@/components/FeedbackForm.vue";
|
||||
|
||||
// 缓存系统
|
||||
const cache = new Map();
|
||||
@@ -213,6 +230,38 @@ const selectedPerson = ref(null);
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 卡片显示状态管理
|
||||
const cardVisibility = ref({
|
||||
kpiMetrics: true,
|
||||
salesProgress: true,
|
||||
periodStage: true,
|
||||
funnelChart: true,
|
||||
personalSalesRanking: true,
|
||||
qualityCalls: true,
|
||||
rankingList: true,
|
||||
customerType: true,
|
||||
problemRanking: true,
|
||||
campManagement: true,
|
||||
detailedDataTable: true
|
||||
});
|
||||
|
||||
// FeedbackForm 控制变量
|
||||
const showFeedbackForm = ref(false);
|
||||
|
||||
// FeedbackForm 控制方法
|
||||
const showFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = true;
|
||||
};
|
||||
|
||||
const closeFeedbackFormModal = () => {
|
||||
showFeedbackForm.value = false;
|
||||
};
|
||||
|
||||
// 更新卡片显示状态
|
||||
const updateCardVisibility = (newVisibility) => {
|
||||
Object.assign(cardVisibility.value, newVisibility);
|
||||
};
|
||||
|
||||
// 计算属性
|
||||
const filteredTableData = computed(() => {
|
||||
let filtered = tableData.value;
|
||||
@@ -476,7 +525,6 @@ async function getConversionComparison(data) {
|
||||
const res = await getCompanyConversionRateVsLast(params);
|
||||
return res.data;
|
||||
});
|
||||
console.log(111111,result);
|
||||
conversionComparison.value = result;
|
||||
} catch (error) {
|
||||
console.error("获取转化对比失败:", error);
|
||||
@@ -616,7 +664,7 @@ const handleFilterChange = (filterParams) => {
|
||||
getDetailData(filterParams)
|
||||
}
|
||||
// 优秀录音
|
||||
const excellentRecord = ref({});
|
||||
const excellentRecord = ref([]);
|
||||
async function CenterExcellentRecord() {
|
||||
const params={
|
||||
user_level:userStore.userInfo.user_level.toString(),
|
||||
@@ -626,10 +674,9 @@ const params={
|
||||
const cacheKey = getCacheKey('CenterExcellentRecord', params);
|
||||
const result = await withCache(cacheKey, async () => {
|
||||
const res = await getExcellentRecordFile(params);
|
||||
return res.data.excellent_record_list;
|
||||
return res.data;
|
||||
});
|
||||
excellentRecord.value = result;
|
||||
console.log(111111,result);
|
||||
} catch (error) {
|
||||
console.error("获取优秀录音失败:", error);
|
||||
}
|
||||
@@ -638,15 +685,15 @@ onMounted(async() => {
|
||||
// 页面初始化逻辑
|
||||
console.log('页面初始化,开始加载数据...');
|
||||
|
||||
await getRealTimeProgress()
|
||||
await getTotalDeals()
|
||||
await getConversionComparison('month')
|
||||
await getCompanySalesRank('red')
|
||||
await getCustomerTypeRatio('child_education')
|
||||
await getCustomerUrgency()
|
||||
await CusotomGetLevelTree()
|
||||
await getDetailData()
|
||||
await CenterExcellentRecord()
|
||||
getRealTimeProgress()
|
||||
getTotalDeals()
|
||||
getConversionComparison('month')
|
||||
getCompanySalesRank('red')
|
||||
getCustomerTypeRatio('child_education')
|
||||
getCustomerUrgency()
|
||||
CusotomGetLevelTree()
|
||||
getDetailData()
|
||||
CenterExcellentRecord()
|
||||
|
||||
// 输出缓存状态信息
|
||||
const cacheInfo = getCacheInfo();
|
||||
@@ -2136,4 +2183,20 @@ button {
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
/* 意见反馈按钮样式 */
|
||||
.feedback-btn {
|
||||
background-color: #4299e1;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.feedback-btn:hover {
|
||||
background-color: #3182ce;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user