Commit fa2c0d8d authored by 刘杰's avatar 刘杰

企业微信前端

parent dde14e60
......@@ -211,18 +211,18 @@
<view class="chart-header">
<text class="chart-title">项目对比(前10)</text>
<view class="sort-buttons">
<text class="sort-btn" :class="{active: sortType === 'receivable'}"
@click="sortChart('receivable','myProjectChart')">
<text class="sort-btn" :class="{active: projectSortType === 'receivable'}"
@click="sortProjectChart('receivable','myProjectChart')">
<text class="sort-icon"></text>
应收
</text>
<text class="sort-btn" :class="{active: sortType === 'payable'}"
@click="sortChart('payable','myProjectChart')">
<text class="sort-btn" :class="{active: projectSortType === 'payable'}"
@click="sortProjectChart('payable','myProjectChart')">
<text class="sort-icon"></text>
应付
</text>
<text class="sort-btn" :class="{active: sortType === 'profitRate'}"
@click="sortChart('profitRate','myProjectChart')">
<text class="sort-btn" :class="{active: projectSortType === 'profitRate'}"
@click="sortProjectChart('profitRate','myProjectChart')">
<text class="sort-icon"></text>
利润
</text>
......@@ -237,7 +237,7 @@
<view class="table-container">
<text class="table-title">模拟老板运营情况</text>
<view class="table-scroll">
<uni-table :data="currentData.tableData" border stripe :loading="loading" emptyText="暂无数据">
<uni-table :data="currentData.tableData" border :loading="loading" emptyText="暂无数据">
<uni-tr>
<uni-th align="center" width="60">模拟老板</uni-th>
<uni-th align="center" width="50">应收(万)</uni-th>
......@@ -290,387 +290,14 @@
data() {
return {
staffCode: "",
staffKind: "",
loading: true,
activeTime: 'today',
myLeaderChart: null,
myProjectChart: null,
sortType: 'receivable',
searchDatas: {},
// 所有时间维度的数据集合
timeData: {
month: {
overview: {
submitRate: 35.68,
submitCount: 156,
totalCount: 200,
stats: {
projectCount: 256,
orderCount: 328,
volumeCount: 45,
weightCount: 89
}
},
finance: {
receivable: {
total: 892650,
profit: 678900,
profitRate: 92.35
},
payable: {
total: 8920,
cash: 3580,
monthly: 5340
}
},
leaderChartData: {
bossNames: ['老板A', '老板B', '老板C', '老板D', '老板E', '老板F'],
receivable: [320, 450, 380, 420, 390, 410],
payable: [220, 350, 280, 320, 290, 310],
profitRate: [45.5, 38.2, 42.8, 35.6, 48.9, 40.2]
},
projectChartData: {
projectNames: ['项目A', '项目B', '项目C', '项目D', '项目E', '项目F'],
receivable: [320, 450, 380, 420, 390, 410],
payable: [220, 350, 280, 320, 290, 310],
profitRate: [45.5, 38.2, 42.8, 35.6, 48.9, 40.2]
},
tableData: [{
boss: '老板A',
receivable: 156800,
payable: 128900,
cashPayable: 38670,
profitRate: 17.8,
orderCount: 156,
volume: 890,
weight: 1250,
manpower: 25
},
{
boss: '老板B',
receivable: 198500,
payable: 158400,
cashPayable: 47520,
profitRate: 20.2,
orderCount: 189,
volume: 1020,
weight: 1580,
manpower: 32
},
{
boss: '老板C',
receivable: 145600,
payable: 116480,
cashPayable: 34944,
profitRate: 20.0,
orderCount: 142,
volume: 760,
weight: 980,
manpower: 18
},
{
boss: '老板D',
receivable: 178900,
payable: 143120,
cashPayable: 42936,
profitRate: 20.0,
orderCount: 168,
volume: 920,
weight: 1350,
manpower: 28
},
{
boss: '老板E',
receivable: 134500,
payable: 107600,
cashPayable: 32280,
profitRate: 20.0,
orderCount: 128,
volume: 680,
weight: 850,
manpower: 15
}
]
},
week: {
overview: {
submitRate: 28.45,
submitCount: 95,
totalCount: 200,
stats: {
projectCount: 168,
orderCount: 235,
volumeCount: 28,
weightCount: 65
}
},
finance: {
receivable: {
total: 568950,
profit: 458900,
profitRate: 88.69
},
payable: {
total: 5860,
cash: 2680,
monthly: 3180
}
},
leaderChartData: {
bossNames: ['老板A', '老板B', '老板C', '老板D', '老板E', '老板F'],
receivable: [220, 350, 280, 320, 290, 310],
payable: [120, 250, 180, 220, 190, 210],
profitRate: [42.5, 35.2, 39.8, 32.6, 45.9, 37.2]
},
projectChartData: {
projectNames: ['项目A', '项目B', '项目C', '项目D', '项目E', '项目F'],
receivable: [320, 450, 380, 420, 390, 410],
payable: [220, 350, 280, 320, 290, 310],
profitRate: [45.5, 38.2, 42.8, 35.6, 48.9, 40.2]
},
tableData: [{
boss: '老板A',
receivable: 1534.5,
payable: 1286.3,
cashPayable: 3867,
profitRate: 17.8,
orderCount: 156,
volume: 890,
weight: 1250,
manpower: 25
},
{
boss: '老板B',
receivable: 1286.3,
payable: 1025.3,
cashPayable: 2680,
profitRate: 20.2,
orderCount: 189,
volume: 1020,
weight: 1580,
manpower: 32
},
{
boss: '老板C',
receivable: 956.8,
payable: 765.8,
cashPayable: 2405,
profitRate: 20.0,
orderCount: 142,
volume: 760,
weight: 980,
manpower: 18
},
{
boss: '老板D',
receivable: 843.2,
payable: 674.2,
cashPayable: 2405,
profitRate: 20.0,
orderCount: 168,
volume: 920,
weight: 1350,
manpower: 28
},
{
boss: '老板E',
receivable: 732.1,
payable: 585.1,
cashPayable: 1302.76,
profitRate: 20.0,
orderCount: 128,
volume: 680,
weight: 850,
manpower: 15
}
]
},
yesterday: {
overview: {
submitRate: 25.35,
submitCount: 85,
totalCount: 200,
stats: {
projectCount: 138,
orderCount: 186,
volumeCount: 22,
weightCount: 58
}
},
finance: {
receivable: {
total: 498950,
profit: 398580,
profitRate: 85.69
},
payable: {
total: 4810,
cash: 2405,
monthly: 2405
}
},
leaderChartData: {
bossNames: ['老板A', '老板B', '老板C', '老板D', '老板E', '老板F'],
receivable: [180, 290, 220, 260, 230, 250],
payable: [80, 190, 120, 160, 130, 150],
profitRate: [40.5, 33.2, 37.8, 30.6, 43.9, 35.2]
},
projectChartData: {
projectNames: ['项目A', '项目B', '项目C', '项目D', '项目E', '项目F'],
receivable: [320, 450, 380, 420, 390, 410],
payable: [220, 350, 280, 320, 290, 310],
profitRate: [45.5, 38.2, 42.8, 35.6, 48.9, 40.2]
},
tableData: [{
boss: '老板A',
receivable: 934.5,
payable: 886.3,
cashPayable: 2405,
profitRate: 85.69,
orderCount: 186,
volume: 22,
weight: 58,
manpower: 15
},
{
boss: '老板B',
receivable: 886.3,
payable: 796.3,
cashPayable: 2405,
profitRate: 85.69,
orderCount: 189,
volume: 22,
weight: 58,
manpower: 18
},
{
boss: '老板C',
receivable: 756.8,
payable: 666.8,
cashPayable: 2405,
profitRate: 85.69,
orderCount: 142,
volume: 22,
weight: 58,
manpower: 18
},
{
boss: '老板D',
receivable: 643.2,
payable: 553.2,
cashPayable: 2405,
profitRate: 85.69,
orderCount: 168,
volume: 22,
weight: 58,
manpower: 28
},
{
boss: '老板E',
receivable: 532.1,
payable: 442.1,
cashPayable: 1302.76,
profitRate: 85.69,
orderCount: 128,
volume: 22,
weight: 58,
manpower: 15
}
]
},
today: {
overview: {
submitRate: 22.35,
submitCount: 80,
totalCount: 200,
stats: {
projectCount: 128,
orderCount: 156,
volumeCount: 19,
weightCount: 55
}
},
finance: {
receivable: {
total: 488950,
profit: 58674,
profitRate: 12.2
},
payable: {
total: 430276,
cash: 130276,
monthly: 300000
}
},
leaderChartData: {
bossNames: ['老板A', '老板B', '老板C', '老板D', '老板E', '老板F'],
receivable: [150, 260, 190, 230, 200, 220, 180, 240, 210, 170],
payable: [250, 160, 90, 310, 100, 120, 80, 140, 110, 70],
profitRate: [38.5, 31.2, 35.8, 28.6, 41.9, 33.2, 36.5, 29.8, 34.5, 32.1]
},
projectChartData: {
projectNames: ['项目A', '项目B', '项目C', '项目D', '项目E', '项目F'],
receivable: [320, 450, 380, 420, 390, 410],
payable: [220, 150, 280, 320, 290, 310],
profitRate: [45.5, 38.2, 42.8, 35.6, 48.9, 40.2]
},
tableData: [{
boss: '老板A',
receivable: 834.5,
payable: 786.3,
cashPayable: 130276,
profitRate: 12.2,
orderCount: 156,
volume: 19,
weight: 55,
manpower: 15
},
{
boss: '老板B',
receivable: 786.3,
payable: 738.3,
cashPayable: 130276,
profitRate: 12.2,
orderCount: 189,
volume: 19,
weight: 55,
manpower: 18
},
{
boss: '老板C',
receivable: 656.8,
payable: 608.8,
cashPayable: 130276,
profitRate: 12.2,
orderCount: 142,
volume: 19,
weight: 55,
manpower: 18
},
{
boss: '老板D',
receivable: 543.2,
payable: 495.2,
cashPayable: 130276,
profitRate: 12.2,
orderCount: 168,
volume: 19,
weight: 55,
manpower: 28
},
{
boss: '老板E',
receivable: 432.1,
payable: 384.1,
cashPayable: 130276,
profitRate: 12.2,
orderCount: 128,
volume: 19,
weight: 55,
manpower: 15
}
]
}
}
projectSortType: 'receivable',
timeData: {},
}
},
computed: {
......@@ -678,12 +305,12 @@
currentData() {
//todo 调用后端接口,直接返回对应时间区间的数据
return this.timeData[this.activeTime]
return this.timeData["activeTime"]
},
currentSearchData() {
//todo 调用后端接口,直接返回对应时间区间的数据
return this.searchDatas[this.activeTime]
return this.timeData["activeTime"]
},
// 应付现结比例
cashRatio() {
......@@ -716,7 +343,7 @@
// 对领导图表进行排序,按应收数据排序
this.sortChart('receivable', 'myLeaderChart')
// 对项目图表进行排序,按应收数据排序
this.sortChart('receivable', 'myProjectChart')
this.sortProjectChart('receivable', 'myProjectChart')
// 监听窗口的 resize 事件,调用 onResize 方法以适应图表大小
window.addEventListener('resize', this.onResize)
})
......@@ -724,15 +351,18 @@
methods: {
async initData() {
this.staffCode = uni.getStorageSync(`staffCode`);
this.staffKind = uni.getStorageSync(`uc_staff_kind`);
const data = {
"aux": {
"activeTime": this.activeTime,
"staffCode": this.staffCode
"staffCode": this.staffCode,
"staffKind": this.staffKind
}
}
await searchBossCard(data).then(res => {
this.searchDatas = res.data.data
this.timeData = res.data.data
this.loading = false
console.log()
})
......@@ -1003,6 +633,7 @@
switchTime(time) {
this.activeTime = time
this.initData()
// 更新图表数据
this.updateChartSeries()
},
......@@ -1075,7 +706,69 @@
})
}
},
sortProjectChart(type, chart) {
this.projectSortType = type
let data = null
let xAxisNames = null
if (chart === 'myLeaderChart') {
data = this.currentData.leaderChartData
xAxisNames = this.currentData.leaderChartData.bossNames
} else if (chart === 'myProjectChart') {
data = this.currentData.projectChartData
xAxisNames = this.currentData.projectChartData.projectNames
}
// 创建排序用的数组
const sortArray = xAxisNames.map((name, index) => ({
name,
receivable: data.receivable[index],
payable: data.payable[index],
profitRate: data.profitRate[index]
}))
// 排序
sortArray.sort((a, b) => {
// 降序排列
return b[type] - a[type]
})
// 更新图表
if (chart === 'myLeaderChart') {
this.myLeaderChart.setOption({
xAxis: {
data: sortArray.map(item => item.name)
},
series: [{
name: '应收',
data: sortArray.map(item => item.receivable)
}, {
name: '应付',
data: sortArray.map(item => item.payable)
}, {
name: '利润率',
data: sortArray.map(item => item.profitRate)
}]
})
} else if (chart === 'myProjectChart') {
this.myProjectChart.setOption({
xAxis: {
data: sortArray.map(item => item.name)
},
series: [{
name: '应收',
data: sortArray.map(item => item.receivable)
}, {
name: '应付',
data: sortArray.map(item => item.payable)
}, {
name: '利润率',
data: sortArray.map(item => item.profitRate)
}]
})
}
},
updateChartSeries() {
this.myLeaderChart.setOption({
series: [{
data: this.currentData.leaderChartData.receivable
......@@ -1552,6 +1245,54 @@
}
}
&.receivable1 {
.left-section .icon {
background-color: #52C41A;
}
.right-section {
.amount-section {
.amount,
.label {
color: #52C41A;
}
}
.extra-info .info-row .value {
color: #52C41A;
}
.progress-bar .progress {
background-color: #52C41A;
}
}
}
&.receivable1 {
.left-section .icon {
background-color: #52C41A;
}
.right-section {
.amount-section {
.amount,
.label {
color: #52C41A;
}
}
.extra-info .info-row .value {
color: #52C41A;
}
.progress-bar .progress {
background-color: #52C41A;
}
}
}
&.payable {
.left-section .icon {
background-color: #FF4D4F;
......@@ -1594,6 +1335,49 @@
}
}
}
&.payable1 {
.left-section .icon {
background-color: #FF4D4F;
}
.right-section {
.amount-section {
.amount,
.label {
color: #FF4D4F;
}
}
.extra-info {
.info-row {
.value {
&.cash {
color: #FFA940;
}
&.monthly {
color: #13C2C2;
}
}
}
}
.progress-bar {
position: relative;
.progress {
&.cash,
&.monthly {
position: absolute;
height: 100%;
}
}
}
}
}
}
}
......
......@@ -83,6 +83,7 @@
isLeave: '否',
leaveReason: ''
},
staffCode: "",
leaveOptions: ['是', '否']
}
},
......@@ -138,6 +139,9 @@
})
return
}
this.staffCode = uni.getStorageSync(`staffCode`);
const data = {
"aux": {
reporter: this.formData.reporter,
......@@ -145,7 +149,8 @@
todayWork: this.formData.todayWork,
weekWork: this.formData.weekWork,
isLeave: this.formData.isLeave,
leaveReason: this.formData.leaveReason
leaveReason: this.formData.leaveReason,
staffCode: this.staffCode
}
}
console.log('提交的日报数据:', data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment