Browse Source

修改统计

dev
caoyizhong 2 years ago
parent
commit
7ae08adfec
  1. 24
      src/utils/costTime.js
  2. 1
      src/views/modules/oss/OSSFileList.vue
  3. 5
      src/views/statisticanalysis/CostStatistic.vue
  4. 41
      src/views/statisticanalysis/costecharts/CaseCost.vue
  5. 42
      src/views/statisticanalysis/costecharts/Cost.vue
  6. 18
      src/views/statisticanalysis/costecharts/CostAnalysis.vue
  7. 6
      src/views/statisticanalysis/costecharts/ItemCost.vue
  8. 7
      src/views/statisticanalysis/costecharts/OnDayCost.vue

24
src/utils/costTime.js

@ -19,6 +19,28 @@ export function FilterTime(time,type) {
return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + s;
};
/**
* 获取登陆人员信息
*/
export function information(){
let userInfo = sessionStorage.getItem('USER_INFORMATION');
let res = JSON.parse(userInfo)
console.log("1111",res);
let bum = '';
if(res.post === '系统管理员'){
//查看全部数据
console.log("2222",res);
}else{
//根据部门查询
console.log("3333",res);
bum = res.departIds;
}
return bum;
}
/**
* 根据当前月份获取其前12个月的月份
* @param month
@ -36,4 +58,4 @@ export function GetRecentMonth(month,arr) {
return arr;
};
export default {GetRecentMonth,FilterTime };
export default {GetRecentMonth,FilterTime,information };

1
src/views/modules/oss/OSSFileList.vue

@ -249,6 +249,7 @@
},
handlePreview(record) {
if (record && record.url) {
console.log("-0=-=-=-=路径",record);
let url = window._CONFIG['onlinePreviewDomainURL']+encodeURIComponent(this.$Base64.encode(record.url))
window.open(url, '_blank')
}

5
src/views/statisticanalysis/CostStatistic.vue

@ -6,18 +6,21 @@
<OnDayCost/>
</div>
<div style="height: 39%;">
<!-- 项目部成本-->
<ItemCost/>
</div>
<div style="height: 38%;">
<!-- 成本-->
<!-- 公司 成本-->
<Cost/>
</div>
</div>
<div style="height: 100%;width:65%;">
<div style="height: 45%;background-color: #ffffff;border-radius: 10px">
<!-- 分析成本-->
<CostAnalysis/>
</div>
<div style="height: 54%;margin-top: 1%">
<!-- 项目部成本情况-->
<CaseCost/>
</div>
</div>

41
src/views/statisticanalysis/costecharts/CaseCost.vue

@ -3,7 +3,7 @@
<div style="width: 100%;height:100%;background-color: #ffffff;border-radius:15px;z-index: 999 ">
<div style="height: 10%;margin-left: 2%;padding-top: 1%">
<div style="font-size: 25px;margin-bottom: 5px">项目部成本情况
<j-dict-select-tag type="list" v-model="materialType" style="width: 20%;float: right;margin-right: 2%"
<j-dict-select-tag type="list" v-model="formData.materialType" style="width: 20%;float: right;margin-right: 2%"
:trigger-change="true" dictCode="material_type"
placeholder="请选择物资类型" @change="handleChange"/>
</div>
@ -45,6 +45,9 @@
<script>
import * as echarts from 'echarts';
import { FormTypes } from '@/utils/JEditableTableUtil'
import { GetRecentMonth } from '@/utils/costTime'
import moment from 'moment'
import { getAction } from '@api/manage'
export default {
@ -52,6 +55,11 @@ export default {
data(){
return{
materialType:null,
timeNum:[],
formData:{
dateItem: undefined,
materialType: 3,
},
/* table加载状态 */
loading:false,
dataSource: [
@ -147,6 +155,10 @@ export default {
// scopedSlots: { customRender: 'action' }
// }
],
url:{
listZhe:'',
listXiao:'',
}
}
},
@ -155,9 +167,24 @@ export default {
// this.echartsInitTwo();
// this.echartsInitThree();
},
created() {
this.formData.dateItem = moment(new Date(), 'YYYY-MM');
this.getList();
},
methods:{
getList(){
let date = new Date(this.formData.dateItem);
this.timeNum = GetRecentMonth(date.getMonth() + 1,this.timeNum);
getAction(this.url.listXiao,{}).then(res =>{
console.log(res.result);
})
},
handleChange(value) {
console.log(`selected ${value}`);
this.formData.materialType = value;
this.getList();
},
echartsInitOne() {
let myEcharts = echarts.init(document.getElementById("myOneCost"))
@ -224,7 +251,15 @@ export default {
// text: '',
// subtext: 'Living Expenses in Shenzhen'
// },
tooltip: {},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
// ,''¦ {number}(px)
grid: {
top: '10%', // y: '16%'
@ -235,7 +270,7 @@ export default {
},
xAxis: {
type: 'category',
data: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
data: this.timeNum,
// show: false,
axisLine: {
show: false,

42
src/views/statisticanalysis/costecharts/Cost.vue

@ -2,7 +2,7 @@
<div style="width: 95%;height:100% ;background-color: #ffffff;margin-top: 2%;border-radius: 10px">
<div style="height: 20%;margin-left: 6%;padding-top: 2%">
<div style="font-size: 25px;margin-bottom: 5px;margin-bottom: 2%">公司成本
<span style="margin-left: 9%;margin-right: 2%"> <a-month-picker :disabled-date="disabledDate" placeholder="选择日期" @change="disabledDate" v-model="formData.dateItem"/> </span>
<span style="margin-left: 9%;margin-right: 2%"> <a-month-picker placeholder="选择日期" @change="disabledDate" v-model="formData.dateItem"/> </span>
<j-dict-select-tag type="list" v-model="formData.materialType" style="width: 30%;margin-left: 2%"
:trigger-change="true" dictCode="material_type"
placeholder="请选择物资类型" @change="handleChange"/>
@ -32,7 +32,6 @@ name: "Cost",
data() {
return {
msg: '我的echarts图表',
materialType: null,
url:{
getSection: '/hy/processStatistics/getSection',
},
@ -56,7 +55,8 @@ name: "Cost",
this.timeNum = [];
// console.log( this.formData.dateItem,"====");
let date = new Date(this.formData.dateItem);
this.timeNum = GetRecentMonth(date.getMonth() + 1,this.timeNum)
this.timeNum = GetRecentMonth(date.getMonth() + 1,this.timeNum);
// console.log(ss,"sdasDFsd");
let it ={
@ -86,12 +86,16 @@ name: "Cost",
disabledDate(current) {
disabledDate() {
// Can not select days before today and today
return current && current < moment().endOf('day');
// return current && current < moment().endOf('day');
this.getList();
},
handleChange(value) {
console.log(`selected ${value}`);
this.formData.materialType = value;
this.getList();
},
handleBlur() {
console.log('blur');
@ -106,16 +110,36 @@ name: "Cost",
},
drawLine() {
drawLine(shuju) {
// let echarts = require('echarts/lib/echarts')
// domecharts
let shuzu = []
this.timeNum.forEach(item =>{
let num = 0;
shuju.forEach(it => {
if(item.substring(0,1) == it.sj){
// console.log("",item.substring(0,1));
num += it.lld;
}
})
shuzu.push(num);
})
let myChart = echarts.init(this.$refs["myChartCon"]);
let option ={
// title: {
// text: '',
// subtext: 'Living Expenses in Shenzhen'
// },
tooltip: {},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
// ,''¦ {number}(px)
grid: {
top: '10%', // y: '16%'
@ -126,7 +150,7 @@ name: "Cost",
},
xAxis: {
type: 'category',
data: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
data: this.timeNum,
// show: false,
axisLine: {
show: false,
@ -156,7 +180,7 @@ name: "Cost",
},
series: [
{
data: [10, 20, 40, 40, 50, 60,60,70,25,56,23,23], //X
data: shuzu, //X
type: 'line',
// itemStyle: {
// normal: {

18
src/views/statisticanalysis/costecharts/CostAnalysis.vue

@ -4,7 +4,7 @@
<!-- <div style="height: 9%;margin-left: 2%;width: 100%">-->
<div style="font-size: 25px;padding-left: 2%">分析成本
<div style="float: right;width: 38%;height: 35px;padding-top: 0px">
<span style="margin-right: 8%;padding-top: 0px"> <a-month-picker :disabled-date="disabledDate" placeholder="选择日期" /> </span>
<span style="margin-right: 8%;padding-top: 0px"> <a-month-picker placeholder="选择日期" @change="disabledDate" v-model="formData.dateItem"/> </span>
<j-dict-select-tag type="list" v-model="materialType" style="width: 45%;;padding-right: 4%"
:trigger-change="true" dictCode="material_type"
placeholder="请选择物资类型" @change="handleChange"/>
@ -19,6 +19,7 @@
<script>
import * as echarts from 'echarts'
import moment from 'moment'
export default {
name: "CostAnalysis",
@ -27,6 +28,10 @@ name: "CostAnalysis",
materialType:null,
options: { },
list:[],
formData:{
dateItem: undefined,
materialType: 3,
},
}
},
mounted() {
@ -35,15 +40,24 @@ name: "CostAnalysis",
// this.echartsInit()
this.getList();
},
created() {
this.formData.dateItem = moment(new Date(), 'YYYY-MM');
},
methods:{
disabledDate(current) {
// Can not select days before today and today
return current && current < moment().endOf('day');
// return current && current < moment().endOf('day');
this.getList();
},
handleChange(value) {
console.log(`selected ${value}`);
},
getList(){
this.list = [
{ value: 1048, name: '生产类物资' },
{ value: 735, name: '非生产类物资' },

6
src/views/statisticanalysis/costecharts/ItemCost.vue

@ -18,6 +18,7 @@
import * as echarts from 'echarts';
import moment from 'moment'
import { getAction } from '@api/manage'
import { information } from '@/utils/costTime'
//
// let echarts = require('echarts/lib/echarts')
@ -55,9 +56,12 @@ export default {
this.timeNum = this.getRecentMonth(date.getMonth() + 1)
// console.log(ss,"sdasDFsd");
let bu = information();
console.log(bu,"bum")
let it ={
time: moment(this.formData.dateItem._d).format('YYYY-MM-DD HH:mm:ss'),
materialsType : this.formData.materialType
materialsType : this.formData.materialType,
departId : bu
}
// console.log("====",moment(this.formData.dateItem._d).format('YYYY-MM-DD HH:mm:ss'));

7
src/views/statisticanalysis/costecharts/OnDayCost.vue

@ -35,6 +35,7 @@
import * as echarts from 'echarts';
import ChartCard from '@/components/ChartCard'
import '@/assets/less/TableExpand.less'
import { information } from '@/utils/costTime'
import { getAction } from '@api/manage'
export default {
@ -59,10 +60,12 @@ name: "OnDayCost",
},
methods:{
getList(){
getAction(this.url.getConsume).then(res=>{
let bu = information();
getAction(this.url.getConsume,{departId:bu}).then(res=>{
this.cost = res.result;
console.log("===",res.result);
// console.log("===",res.result);
})
},

Loading…
Cancel
Save