Browse Source

合并代码

apply
song 4 years ago
parent
commit
0bd7dc8f21
  1. 4
      apis/projectFinance.js
  2. 211
      components/BarEcharts.vue
  3. 6
      components/Expenditure.vue
  4. 4
      components/FinanceManage.vue
  5. 28
      pages/applicant.vue
  6. 25
      pages/financial-approval.vue
  7. 226
      pages/index.vue

4
apis/projectFinance.js

@ -27,3 +27,7 @@ export const queryProjectFinance = params =>
// 修改任务或项目的预算和奖金信息
export const updateFinance = params =>
http.post(`${projectFinance}/updateFinance`, params);
// 时间财务图统计
export const timeFinancialChart = params =>
http.post(`${projectFinance}/timeFinancialChart`, params);

211
components/BarEcharts.vue

@ -1,113 +1,144 @@
<template>
<div id="barEcharts" style="width:380px;height:350px"></div>
<div id="barEcharts" style="width: 380px; height: 350px"></div>
</template>
<script setup>
import{onMounted} from 'vue';
import { onMounted } from 'vue';
import { timeFinancialChart } from 'apis/projectFinance';
onMounted(()=>{
const myChart = echarts.init(document.getElementById('barEcharts'));
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
legend: {
top:10,
right:0,
icon: 'circle',
orient: 'horizontal',
itemGap: 10,
itemWidth: 10,
itemHeight: 14,
textStyle: {
fontSize: 14,
color: '#858585',
fontWeight: 400,
},
const projectId = useProjectId();
},
data: ['任务一', '任务二', '任务三', '任务四'],
color: ['#7E84A3', '#FF914C', '#5189F8', '#3FC7BB'],
grid: {
left: '10%',
right: '0',
bottom: '5%',
containLabel: false,
},
xAxis: {
type: 'category',
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
axisTick: {
show: false,
},
axisLabel: {
show: true,
},
axisLine: {
show: false,
},
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#F3F4F5',
},
},
},
series: [
{
name: '任务四',
const data = reactive({
timeList: [],
taskNameList: [],
});
async function getChartData() {
try {
const params = { param: { projectId: projectId.value } };
const res = await timeFinancialChart(params);
console.log('res:', res);
return processing(res);
} catch (error) {
console.error(error);
}
}
function processing(list) {
let timeList = [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
];
for (let i = 0; i < list.length; i++) {
for (let j = 0; j < list[i].data.length; j++) {
const m = list[i].data[j].time - 0;
timeList[m - 1] = m + '月';
}
}
for (let i = 0; i < timeList.length; i++) {
if (!timeList[i]) {
timeList.splice(i, 1);
i -= 1;
}
}
let series = [];
let taskNameList = [];
for (let i = 0; i < list.length; i++) {
let data = [];
taskNameList.push(list[i].name);
for (let k = 0; k < timeList.length; k++) {
data.push(null);
}
for (let k = 0; k < list[i].data.length; k++) {
for (let m = 0; m < timeList.length; m++) {
if (list[i].data[k].time - 0 + '月' === timeList[m]) {
data[m] = list[i].data[k].expend - 0;
}
}
}
let obj = {
name: list[i].name,
type: 'bar',
stack: 'total',
label: {
show: false,
color: '#FFFFFF',
},
itemStyle: {
borderRadius: [0, 0, 0, 0],
},
barWidth: 12,
data: [320, 80, 301, 334, 390, 330, 320, 390, 330, 320, 390, 390],
data: data,
};
series.push(obj);
}
data.timeList = timeList;
data.taskNameList = taskNameList;
console.log('series: ', series);
return series;
}
onMounted(async () => {
const myChart = echarts.init(document.getElementById('barEcharts'));
const series = await getChartData();
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
{
name: '任务三',
type: 'bar',
stack: 'total',
label: {
show: false,
color: '#FFFFFF',
legend: {
top: 10,
right: 0,
icon: 'circle',
orient: 'horizontal',
itemGap: 10,
itemWidth: 10,
itemHeight: 14,
textStyle: {
fontSize: 14,
color: '#858585',
fontWeight: 400,
},
data: [120, 132, 101, 134, 90, 230, 210, 302, 301, 334, 390, 330],
},
{
name: '任务二',
type: 'bar',
stack: 'total',
label: {
data: data.taskNameList,
color: ['#7E84A3', '#FF914C', '#5189F8', '#3FC7BB'],
grid: {
left: '15%',
right: '0',
bottom: '5%',
containLabel: false,
},
xAxis: {
type: 'category',
data: data.timeList,
axisTick: {
show: false,
color: '#FFFFFF',
},
data: [18, 66, 191, 234, 290, 330, 310, 182, 191, 234, 290, 330],
},
{
name: '任务一',
type: 'bar',
stack: 'total',
label: {
axisLabel: {
show: true,
},
axisLine: {
show: false,
color: '#FFFFFF',
},
itemStyle: {
borderRadius: [0, 0, 0, 0],
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#F3F4F5',
},
},
data: [150, 212, 201, 154, 190, 330, 410, 182, 191, 234, 290, 330],
},
],
};
series: series,
};
myChart.setOption(option);
})
});
</script>

6
components/Expenditure.vue

@ -27,7 +27,7 @@
/>
</td>
<td>
<van-icon name="plus" @click="toApplication" />
<van-icon name="plus" @click="toApplication(item)" />
</td>
</tr>
</table>
@ -110,9 +110,11 @@ async function handleUpdateBudget(item) {
}
// ,
function toApplication() {
function toApplication(item) {
const routeValue = router.currentRoute.value;
const query = routeValue.query;
query.tn = item.taskName;
// console.log('query: ', query);
router.push({ path: '/Initiate-application', query });
}

4
components/FinanceManage.vue

@ -4,8 +4,8 @@
<table class="w-full text-gray-500 mt-4 text-ms">
<tr class="bg-gray-100">
<td class="name">任务名称</td>
<td class="">预算()</td>
<td class="">奖金()</td>
<td>预算()</td>
<td>奖金()</td>
</tr>
<tr v-for="item in data.info.taskFinanceList.list">
<td>{{item.name}}</td>

28
pages/applicant.vue

@ -9,24 +9,27 @@
title-active-color="#59B4FF"
>
<van-tab title="我的申请">
<div class="mt-8 bg-white flex flex-col">
<div class="p-4 pb-0 text-gray-500 font-semibold">历史申请</div>
<Search class="px-4 pt-0" />
<HistoricalApplication class="px-4 mt-0" />
</div>
<!-- 底部提交按钮部分 -->
<div class="mt-20" @click="toApplication">
<van-button type="primary" block>发起申请</van-button>
<div class=" bg-white px-4">
<div class="mt-4 flex flex-col overflow-hidden h-full">
<div class="py-4 pb-0 text-gray-500 font-semibold">历史申请</div>
<Search />
<HistoricalApplication />
</div>
<!-- 底部提交按钮部分 -->
<div class="fixed w-11/12 box-border bottom-10 " @click="toApplication">
<van-button type="primary" block size="small">发起申请</van-button>
</div>
</div>
</van-tab>
<van-tab title="我的奖金">
<div class="mt-8 bg-white">
<div class="mt-4 bg-white">
<div class="p-4 pb-0 text-gray-500 font-semibold">奖金领取记录</div>
<Search class="px-4 pt-0" />
<BonusCollection class="px-4 mt-0" />
</div>
<div class="my-4 bg-white">
<div class="mt-4 bg-white">
<div class="text-gray-500 font-semibold m-4 py-3 border-b">
待领取奖金
</div>
@ -61,13 +64,8 @@ import { useRouter } from 'vue-router';
const router = useRouter();
const active = ref(0);
const isShow = ref(true);
const isBonus = ref(true);
function onClickLeft() {
console.log('返回上一页');
}
function toApplication() {
const routeValue = router.currentRoute.value;
const query = routeValue.query;

25
pages/financial-approval.vue

@ -1,9 +1,9 @@
<template>
<div class="mb-60">
<!-- 财务审批页面 -->
<div class="bg-white p-4 flex text-gray-500 flex-col d_jump">
<div class="bg-white p-4 flex text-gray-500 flex-col">
<div>
<span class="font-semibold" id="finance-audit">财务审批</span> <span class="ml-2 text-xs">对员工提交的申请进行审批</span>
<span class="font-semibold" id="finance-audit">财务审批</span> <span class="ml-2">对员工提交的申请进行审批</span>
</div>
<Search />
<FinanceExamine />
@ -60,7 +60,7 @@
</div>
<!-- 成员财务图 -->
<div class="h-64 overflow-hidden">
<div>
<div class="mt-5">
<span class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"></span>
<span>成员财务图</span>
</div>
@ -73,19 +73,16 @@
<span>时间财务图</span>
</div>
<BarEcharts class="w-full h-full mt-5" />
<!-- 没有数据展示空组件 -->
<!-- <van-empty description="暂无图表数据信息" /> -->
</div>
</div>
<!-- 悬浮跳转 -->
<ul class="menu">
<a href="#finance-audit">财务审批</a>
<a href="#finance-statistical">财务统计</a>
</ul>
</div>
</template>
<script>
@ -99,21 +96,7 @@ import {ref} from 'vue'
const taskState = ref(true);
const nameState = ref(true);
function onClickLeft(){
console.log('返回上一页')
}
function jump(index) {
let jump = document.querySelectorAll('.d_jump')
//
let total = jump[index].offsetTop
// Chrome
document.body.scrollTop = total
// Firefox
document.documentElement.scrollTop = total
// Safari
window.pageYOffset = total
}
</script>
<style lang="less" scoped>

226
pages/index.vue

@ -1,5 +1,5 @@
<template>
<div class="mb-60">
<div class="fixed bg-gray-100">
<van-tabs
v-model:active="active"
shrink
@ -8,123 +8,130 @@
title-active-color="#59B4FF"
>
<van-tab title="财务管理">
<!-- 财务管理页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<span class="font-semibold" id="finance-manage">财务管理</span>
<span class="ml-2">对项目预算奖金进行配置</span>
</div>
<Search />
<FinanceManage />
</div>
<!-- 财务审批页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<span class="font-semibold" id="finance-audit">财务审批</span>
<span class="ml-2">对员工提交的申请进行审批</span>
</div>
<Search />
<FinanceExamine />
</div>
<!-- 财务统计页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<span class="font-semibold" id="finance-statistical">财务统计</span>
<span class="ml-2">财务明细统计查看</span>
</div>
<!-- 任务支出统计 -->
<div class="h-64 overflow-hidden">
<div class="mt-5 flex justify-between">
<div class="h-screen w-full pb-60 overflow-y-scroll">
<!-- 财务管理页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>任务支出统计</span>
<span class="font-semibold" id="finance-manage">财务管理</span>
<span class="ml-2">对项目预算奖金进行配置</span>
</div>
<Search class="mr-5"/>
<FinanceManage class="mr-5"/>
</div>
<!-- 财务审批页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<van-button
:type="taskState ? 'primary' : 'default'"
size="mini"
@click="taskState = true"
>图表</van-button
>
<van-button
:type="!taskState ? 'primary' : 'default'"
size="mini"
@click="taskState = false"
>表格</van-button
>
<span class="font-semibold" id="finance-audit">财务审批</span>
<span class="ml-2">对员工提交的申请进行审批</span>
</div>
<Search class="mr-5"/>
<div class="overflow-x-hidden mr-5 table-box">
<FinanceExamine />
</div>
</div>
<!-- 任务支出统计的图表展示 -->
<div v-show="taskState">
<!-- <van-empty description="暂无图表数据信息" /> -->
<RingEcharts class="w-full h-full" id="taskEcharts" />
</div>
<!-- 任务支出统计的表格展示 -->
<div v-show="!taskState">
<Expenditure class="w-full h-full" id="taskTable" />
</div>
</div>
<!-- 名目支出统计 -->
<div class="h-64 overflow-hidden">
<div class="mt-5 flex justify-between">
<!-- 财务统计页面 -->
<div class="bg-white p-4 mt-5 text-gray-500 flex-col">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>名目支出统计</span>
<span class="font-semibold" id="finance-statistical">财务统计</span>
<span class="ml-2">财务明细统计查看</span>
</div>
<div>
<van-button
:type="nameState ? 'primary' : 'default'"
size="mini"
@click="nameState = true"
>图表</van-button
>
<van-button
:type="!nameState ? 'primary' : 'default'"
size="mini"
@click="nameState = false"
>表格</van-button
>
<!-- 任务支出统计 -->
<div class="h-64 overflow-hidden">
<div class="mt-5 flex justify-between">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>任务支出统计</span>
</div>
<div class="mr-5">
<van-button
:type="taskState ? 'primary' : 'default'"
size="mini"
@click="taskState = true"
>图表</van-button
>
<van-button
:type="!taskState ? 'primary' : 'default'"
size="mini"
@click="taskState = false"
>表格</van-button
>
</div>
</div>
<!-- 任务支出统计的图表展示 -->
<div v-show="taskState">
<!-- <van-empty description="暂无图表数据信息" /> -->
<RingEcharts class="w-full h-full" id="taskEcharts" />
</div>
<!-- 任务支出统计的表格展示 -->
<div v-show="!taskState">
<Expenditure class="w-full h-full" id="taskTable" />
</div>
</div>
<!-- 名目支出统计 -->
<div class="h-64 overflow-hidden">
<div class="mt-5 flex justify-between">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>名目支出统计</span>
</div>
<div class="mr-5">
<van-button
:type="nameState ? 'primary' : 'default'"
size="mini"
@click="nameState = true"
>图表</van-button
>
<van-button
:type="!nameState ? 'primary' : 'default'"
size="mini"
@click="nameState = false"
>表格</van-button
>
</div>
</div>
<!-- 名目支出统计的图表展示 -->
<div v-show="nameState">
<!-- <van-empty description="暂无图表数据信息" /> -->
<RingEcharts class="w-full h-full" id="nameEcharts" />
</div>
<!-- 名目支出统计的表格展示 -->
<div v-show="!nameState">
<Expenditure class="w-full h-full" id="nameTable" />
</div>
</div>
<!-- 成员财务图 -->
<div class="h-64 overflow-hidden">
<div class="mt-5">
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>成员财务图</span>
</div>
<RingEcharts class="w-full h-full" id="memberEcharts" />
</div>
<!-- 时间财务图 -->
<div class="h-96 overflow-hidden">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>时间财务图</span>
</div>
<BarEcharts class="w-full h-full" />
</div>
</div>
<!-- 名目支出统计的图表展示 -->
<div v-show="nameState">
<!-- <van-empty description="暂无图表数据信息" /> -->
<RingEcharts class="w-full h-full" id="nameEcharts" />
</div>
<!-- 名目支出统计的表格展示 -->
<div v-show="!nameState">
<Expenditure class="w-full h-full" id="nameTable" />
</div>
</div>
<!-- 成员财务图 -->
<div class="h-64 overflow-hidden">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>成员财务图</span>
</div>
<RingEcharts class="w-full h-full" id="memberEcharts" />
</div>
<!-- 时间财务图 -->
<div class="h-72 overflow-hidden">
<div>
<span
class="inline-block w-2 h-2 border-2 border-blue-400 rounded-full mr-3"
></span>
<span>时间财务图</span>
</div>
<BarEcharts class="w-full h-full" />
</div>
</div>
</div>
</van-tab>
<van-tab title="角色管理">角色管理</van-tab>
<van-tab title="任务管理">任务管理</van-tab>
<van-tab title="成员管理">成员管理</van-tab>
<van-tab title="角色管理"> <div class="h-screen overflow-y-scroll w-screen mt-4">角色管理</div></van-tab>
<van-tab title="任务管理"><div class="h-screen overflow-y-scroll w-screen mt-4">任务管理</div></van-tab>
<van-tab title="成员管理"><div class="h-screen overflow-y-scroll w-screen mt-4">成员管理</div></van-tab>
</van-tabs>
<div class="menu">
@ -198,4 +205,7 @@ async function scrollToElementByHash() {
.van-button--mini + .van-button--mini {
margin-left: 0px;
}
.table-box{
width: 95%;
}
</style>

Loading…
Cancel
Save