master
xy 1 year ago
parent c48ede4116
commit b6ae82b2cc

@ -26,10 +26,26 @@ export function readNotice(params){
})
}
export function statistic(params,noLoading = false){
export function statisticProgress(params,noLoading = false){
return request({
method:'get',
url:'/api/ht/notice/statistic',
url:'/api/ht/notice/statistic-progress',
params,
noLoading
})
}
export function statisticDepartment(params,noLoading = false){
return request({
method:'get',
url:'/api/ht/notice/statistic-department',
params,
noLoading
})
}
export function statisticType(params,noLoading = false){
return request({
method:'get',
url:'/api/ht/notice/statistic-type',
params,
noLoading
})

@ -66,9 +66,9 @@
// padding-top: 10px;
font-weight: bold;
font-size: 15px;
color: #338de3;
color: var(--theme-color);
white-space: nowrap;
border-bottom: 2px solid #338de3;
border-bottom: 2px solid var(--theme-color);
>span {
position: relative;

@ -80,6 +80,7 @@ export default {
this.$emit('change', val)
Cookies.set('defaultTheme', val)
document.body.style.setProperty('--theme-color', val)
this.handleIViewTheme()
index++
$message?.close()
}
@ -159,6 +160,87 @@ export default {
}
clusters.push(shadeColor(theme, 0.1))
return clusters
},
handleIViewTheme() {
const styleSheets = document.styleSheets;
const lightColor = this.colorUtils(this.theme, 0.2)
for (let i = 0; i < styleSheets.length; i++) {
const styleSheet = styleSheets[i];
try {
//
const rules = styleSheet.cssRules || styleSheet.rules;
//
for (let j = 0; j < rules.length; j++) {
const rule = rules[j];
// .ivu-btn-primary
if(rule.selectorText === '.ivu-btn-ghost.ivu-btn-primary') {
rule.style.color = this.theme;
}
else if (rule.selectorText === '.ivu-btn-ghost.ivu-btn-primary:hover') {
rule.style.color = lightColor;
}
else if(rule.selectorText === '.ivu-page-item-active') {
rule.style.borderColor = this.theme;
}
else if (/^.ivu-.*?-primary$|^.ivu-input-search$/.test(rule.selectorText)) {
// color
rule.style.borderColor = this.theme; //
rule.style.backgroundColor = this.theme;
} else if(/^.ivu-.*?-primary(:hover|:focus)$|^.ivu-input-search(:hover|:active)$/.test(rule.selectorText)) {
rule.style.borderColor = lightColor; //
rule.style.backgroundColor = lightColor;
}
}
} catch (e) {
// 访
console.error(e);
}
}
},
colorUtils(color, level) {
function hex2Rgb(str) {
var r = /^#?[0-9a-fA-F]{6}$/;
//testtruefalse
if (!r.test(str)) {
console.log("输入错误的hex")
return
}
//replace
str = str.replace("#", "");
//match
var hxs = str.match(/../g);
for (var i = 0; i < 3; i++) {
hxs[i] = parseInt(hxs[i], 16);
}
return hxs;
}
function rgb2Hex(a, b, c) {
var r = /^\d{1,3}$/;
if (!r.test(a) || !r.test(b) || !r.test(c)) {
console.log("输入错误的rgb颜色值")
return
}
var hexs = [a.toString(16), b.toString(16), c.toString(16)];
for (var i = 0; i < 3; i++) {
if (hexs[i].length === 1) hexs[i] = "0" + hexs[i];
}
return "#" + hexs.join("");
}
var r = /^#?[0-9a-fA-F]{6}$/;
if (!r.test(color)) {
console.log("输入错误的hex颜色值")
return
}
var rgbc = hex2Rgb(color);
for (var i = 0; i < 3; i++){
rgbc[i] = Math.floor((255 - rgbc[i]) * level + rgbc[i]);
}
return rgb2Hex(rgbc[0], rgbc[1], rgbc[2]);
}
}
}
@ -179,4 +261,7 @@ export default {
.theme-picker-dropdown .el-color-dropdown__link-btn {
display: none;
}
:root {
--theme-color: #409EFF;
}
</style>

@ -135,7 +135,7 @@ export default {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-bottom: none;
box-shadow: 0 2px 10px 1px $primaryColor;
box-shadow: 0 2px 10px 1px var(--theme-color);
position: relative;
&::after{
@ -155,8 +155,8 @@ export default {
//width: 100%;
background: rgba(239,242,250,0.95);
border-radius: 0 4px 4px 4px;
border: $primaryColor solid 1px;
box-shadow: 0 4px 10px 1px $primaryColor;
border: var(--theme-color) solid 1px;
box-shadow: 0 4px 10px 1px var(--theme-color);
z-index: 4;
position: absolute;
@ -174,7 +174,7 @@ export default {
padding: 36px 0 44px 8px;
&::-webkit-scrollbar-thumb{
background: $primaryColor;
background: var(--theme-color);
}
}
&-btn{

@ -2,11 +2,6 @@
<div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar class="sidebar-container" />
<div class="mobile-sidebar-button" v-show="device==='mobile' && !sidebar.opened" @click="toggleSideBar">
<el-button type="primary" circle>
<SvgIcon icon-class="menu"></SvgIcon>
</el-button>
</div>
<div class="main-container">
<app-main />
</div>

@ -88,7 +88,7 @@ else if(window.top !== window.self) {
store,
render: h => h(App)
}).$mount("#app")
router.push('/')
router.push(getQueryParam('to') || '/')
// window._IN_IFRAME = true;
// window.addEventListener("message",function (e) {
// const { module_name, auth_token } = e.data;

@ -19,7 +19,6 @@ router.beforeEach(async(to, from, next) => {
// determine whether the user has logged in
const hasToken = getToken()
console.log(4444,hasToken)
if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page

@ -130,7 +130,7 @@ export default {
},
computed: {
selectedDepartments () {
return this.departments.filter(i => this.departmentSelect.find(j => j === i.plan_department_id))
return this.departments?.filter(i => this.departmentSelect.find(j => j === i.plan_department_id)) || []
},
totalMoneyTotal1 () {
return this.selectedDepartments.reduce((pre,cur)=>(pre+Number(cur.money_total_1||0)),0) || 0
@ -150,16 +150,16 @@ export default {
},
selectedTypes () {
return this.types.filter(i => this.typeSelect.find(j => j === i.id))
return this.types?.filter(i => this.typeSelect.find(j => j === i.id)) || []
},
totalMoneyTotal1Type () {
return this.selectedTypes.reduce((pre,cur)=>(pre+Number(cur.money_total_1||0)),0) || 0
return this.selectedTypes?.reduce((pre,cur)=>(pre+Number(cur.money_total_1||0)),0) || 0
},
totalMoneyTotal2Type () {
return this.selectedTypes.reduce((pre,cur)=>(pre+Number(cur.money_total_2||0)),0) || 0
return this.selectedTypes?.reduce((pre,cur)=>(pre+Number(cur.money_total_2||0)),0) || 0
},
totalUseMoneyTotalType () {
return this.selectedTypes.reduce((pre,cur)=>(pre+Number(cur.use_money_total||0)),0) || 0
return this.selectedTypes?.reduce((pre,cur)=>(pre+Number(cur.use_money_total||0)),0) || 0
},
},
watch: {

@ -312,7 +312,7 @@ import Pagination from "@/components/Pagination";
import PieChart from "./components/PieChart.vue";
import { adminDepartmentList } from '@/api/system/department';
import { adminUserList, getInfo } from '@/api/me';
import { getNotice, readNotice, statistic, carry } from "@/api/dashboard/notice";
import { getNotice, readNotice, statisticProgress, statisticDepartment, statisticType, carry } from "@/api/dashboard/notice";
import { parseTime, moneyFormatter } from '@/utils';
import { Message } from "element-ui";
import budgetStatic from '@/views/dashboard/components/budgetStatic.vue'
@ -600,7 +600,7 @@ export default {
this.lineChartData = {
rotate: 54,
xArr: res?.map(i => i.plan_department?.name),
xArr: res?.map(i => i.plan_department?.name || i.plan_department_id || ' '),
series: [
{
z: 1,
@ -783,12 +783,15 @@ export default {
this.getStatistic();
},
async getStatistic() {
const res = await statistic(this.select);
console.log(res);
this.statistic = res;
let m2 = res.progress.money_total_2;
let m1 = res.progress.money_total_1;
var user_m = res.progress.use_money_total;
const resTotal = await Promise.all([statisticProgress(this.select),statisticType(this.select),statisticDepartment(this.select)]);
this.statistic = {
progress: resTotal[0].progress,
departmentList: resTotal[1].departmentList,
typeList: resTotal[2].typeList
};
let m2 = this.statistic.progress.money_total_2;
let m1 = this.statistic.progress.money_total_1;
var user_m = this.statistic.progress.use_money_total;
var m3=m1-user_m
if (m2 != 0) {
m3=m2-user_m;

Loading…
Cancel
Save