Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
wx-notification
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1da2a209
authored
Sep 02, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(evection): 新增公司重点问题聚焦
1 parent
3c69f9c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
219 additions
and
13 deletions
src/views/evection/company.vue
src/views/evection/department.vue
src/views/evection/focusIssues.js
tests/focusIssues.test.cjs
src/views/evection/company.vue
View file @
1da2a20
...
...
@@ -132,6 +132,28 @@
</div>
</div>
</div>
<div
class=
"box focusIssues"
v-if=
"infoData.focusIssues && infoData.focusIssues.length"
>
<SectionTitle
title=
"重点问题聚焦"
:titleIcon=
"focusIssues"
></SectionTitle>
<div
class=
"focusIssues"
>
<div
class=
"focusIssues-list"
>
<div
class=
"focusIssues-group"
v-for=
"(group, groupIndex) in focusIssuesRows"
:key=
"groupIndex"
>
<div
class=
"group-title"
>
{{ groupIndex === 0 ? '当月用餐招待超标' : '当月差旅住宿连续超7天' }}
</div>
<div
class=
"focusIssues-item"
v-for=
"(item, index) in group"
:key=
"index"
>
<div
class=
"text"
>
{{ item.staffName }}
</div>
<div
class=
"value"
>
{{ item.value }}{{ groupIndex === 0 ? '次' : '天' }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
v-show=
"!$store.state.app.authorizePage"
class=
"loadingBox"
></div>
</div>
...
...
@@ -145,6 +167,7 @@ import DataItem from './components/DataItem.vue'
import
pieChart
from
'./components/pieChart.vue'
import
evectionApi
from
'@/api/evection'
import
{
formatNum
,
formatRatio
,
formatIsRatio
,
getIconSrc
,
getRatioColor
}
from
'@/utils/tools.js'
import
{
groupFocusIssues
}
from
'./focusIssues'
import
store
from
'@/store'
export
default
{
...
...
@@ -160,6 +183,7 @@ export default {
hospitalityIcon
:
require
(
'@/assets/images/hospitality.png'
),
deptIcon
:
require
(
'@/assets/images/deptIcon.png'
),
hotel
:
require
(
'@/assets/images/hotel.png'
),
focusIssues
:
require
(
'@/assets/images/focusIssues.png'
),
analyse
:
require
(
'@/assets/images/analyse.png'
),
pushId
:
this
.
$route
.
query
.
pushId
,
infoData
:
{},
...
...
@@ -221,6 +245,9 @@ export default {
}
return
rows
},
focusIssuesRows
()
{
return
groupFocusIssues
(
this
.
infoData
.
focusIssues
)
},
StatisticData
()
{
return
[
{
...
...
@@ -548,6 +575,45 @@ $boxWidth: 351;
}
}
}
.focusIssues
{
.focusIssues-list
{
display
:
flex
;
align-items
:
stretch
;
height
:
auto
;
.focusIssues-group
{
flex
:
1
;
padding
:
4px
8px
;
box-sizing
:
border-box
;
margin-right
:
4px
;
height
:
auto
;
.group-title
{
color
:
#666666
;
font-size
:
14px
;
}
.focusIssues-item
{
color
:
#222222
;
font-size
:
14px
;
margin-top
:
8px
;
display
:
flex
;
align-items
:
center
;
.text
{
padding-right
:
4px
;
border-right
:
1px
solid
#f0f0f0
;
max-width
:
100px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.value
{
padding-left
:
4px
;
}
}
}
.focusIssues-group
:nth-child
(
1
)
{
border-right
:
1px
solid
#f0f0f0
;
}
}
}
//
.block-145
{
//
width
:
formatWidth
(
145
,
$
boxWidth
);
//
}
...
...
src/views/evection/department.vue
View file @
1da2a20
...
...
@@ -128,6 +128,7 @@ import DataItem from './components/DataItem.vue'
import
pieChart
from
'./components/pieChart.vue'
import
evectionApi
from
'@/api/evection'
import
{
formatNum
,
formatRatio
,
formatIsRatio
,
getIconSrc
,
getRatioColor
}
from
'@/utils/tools.js'
import
{
groupFocusIssues
}
from
'./focusIssues'
import
store
from
'@/store'
export
default
{
...
...
@@ -230,19 +231,7 @@ export default {
return
rows
},
focusIssuesRows
()
{
const
groupedData
=
this
.
infoData
.
focusIssues
&&
this
.
infoData
.
focusIssues
.
reduce
((
acc
,
item
)
=>
{
const
key
=
item
.
sceneType
if
(
!
acc
[
key
])
{
acc
[
key
]
=
[]
}
acc
[
key
].
push
(
item
)
return
acc
},
{})
if
(
groupedData
)
{
return
[
groupedData
[
1
]
||
[],
groupedData
[
3
]
||
[]]
}
return
groupFocusIssues
(
this
.
infoData
.
focusIssues
)
},
StatisticData
()
{
if
(
this
.
infoData
.
reportDetail
)
{
...
...
src/views/evection/focusIssues.js
0 → 100644
View file @
1da2a20
function
groupFocusIssues
(
issues
)
{
const
rows
=
[[],
[]]
if
(
!
Array
.
isArray
(
issues
))
return
rows
issues
.
forEach
(
item
=>
{
if
(
!
item
)
return
if
(
item
.
sceneType
===
1
)
rows
[
0
].
push
(
item
)
if
(
item
.
sceneType
===
3
)
rows
[
1
].
push
(
item
)
})
return
rows
}
module
.
exports
=
{
groupFocusIssues
}
tests/focusIssues.test.cjs
0 → 100644
View file @
1da2a20
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const Vue = require('vue')
const { compile, parseComponent } = require('vue-template-compiler')
let groupFocusIssues
try {
const focusIssuesModule = require('../src/views/evection/focusIssues')
groupFocusIssues = focusIssuesModule.groupFocusIssues
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND' || !error.message.includes('focusIssues')) {
throw error
}
}
assert.strictEqual(
typeof groupFocusIssues,
'function',
'focusIssues should expose a shared grouping function'
)
const issues = [
{ sceneType: 3, staffName: '李四', value: 8 },
{ sceneType: 1, staffName: '张三', value: 0 },
{ sceneType: 2, staffName: '未知场景', value: 99 },
null,
{ sceneType: 1, staffName: '王五', value: 2 }
]
const issuesSnapshot = JSON.parse(JSON.stringify(issues))
assert.deepStrictEqual(groupFocusIssues(issues), [
[
{ sceneType: 1, staffName: '张三', value: 0 },
{ sceneType: 1, staffName: '王五', value: 2 }
],
[{ sceneType: 3, staffName: '李四', value: 8 }]
])
assert.deepStrictEqual(issues, issuesSnapshot, 'grouping should not mutate API data')
for (const emptyValue of [undefined, null, '', {}, []]) {
assert.deepStrictEqual(groupFocusIssues(emptyValue), [[], []])
}
function renderCompanyTemplate(renderData) {
const componentPath = path.resolve(__dirname, '../src/views/evection/company.vue')
const descriptor = parseComponent(fs.readFileSync(componentPath, 'utf8'))
const compiled = compile(descriptor.template.content)
assert.deepStrictEqual(compiled.errors, [], 'company template should compile')
Vue.config.silent = true
Vue.prototype.$store = {
state: {
app: {
authorizePage: true
}
}
}
const vm = new Vue({
data() {
return renderData
},
methods: {
formatNum: value => value,
formatRatio: value => value,
formatIsRatio: () => false,
getRatioColor: () => '',
getIconSrc: () => ''
},
render: new Function(compiled.render),
staticRenderFns: compiled.staticRenderFns.map(code => new Function(code))
})
return vm._render()
}
function collectRenderedText(vnode, output = []) {
if (!vnode) return output
if (typeof vnode.text === 'string') output.push(vnode.text)
if (vnode.data && vnode.data.attrs && vnode.data.attrs.title) {
output.push(vnode.data.attrs.title)
}
for (const child of vnode.children || []) collectRenderedText(child, output)
return output
}
const companyRenderData = {
analyse: '',
colors: [],
deptArrRows: [],
deptIcon: '',
deptSpendListData: null,
dinnerDeptSpendListData: null,
focusIssues: '',
focusIssuesRows: [
[{ sceneType: 1, staffName: '张三', value: 2 }],
[{ sceneType: 3, staffName: '李四', value: 8 }]
],
hospitalityIcon: '',
hotel: '',
infoData: {
focusIssues: [
{ sceneType: 1, staffName: '张三', value: 2 },
{ sceneType: 3, staffName: '李四', value: 8 }
],
monthEndDay: 30,
monthStartDay: 1,
monthValue: 9
},
StatisticData: [],
travelArrRows: [],
travelDeptSpendListData: []
}
const renderedText = collectRenderedText(renderCompanyTemplate(companyRenderData)).join('|')
assert.match(renderedText, /部门总览|差旅住宿.*重点问题聚焦/)
assert.match(renderedText, /当月用餐招待超标.*张三.*2次/)
assert.match(renderedText, /当月差旅住宿连续超7天.*李四.*8天/)
for (const emptyFocusIssues of [undefined, []]) {
const emptyRenderedText = collectRenderedText(
renderCompanyTemplate({
...companyRenderData,
focusIssuesRows: [[], []],
infoData: {
...companyRenderData.infoData,
focusIssues: emptyFocusIssues
}
})
).join('|')
assert.strictEqual(emptyRenderedText.includes('重点问题聚焦'), false)
}
console.log('focusIssues tests passed')
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment