Skip to content

Commit

Permalink
1.修改路由表结构
Browse files Browse the repository at this point in the history
2.新增员工当日考勤信息导入功能
3.加入统计Echats柱状图,日历图(待完善)
  • Loading branch information
BoBoooooo committed Jan 19, 2018
1 parent 93777ec commit 3f122cd
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 191 deletions.
7 changes: 7 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ module.exports = {
pathRewrite: {
'^/report': ''//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
}
},
'/music': {
target: 'http://music.163.com/api/playlist/detail',//设置你调用的接口域名和端口号 别忘了加http
changeOrigin: true,
pathRewrite: {
'^/music': ''//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
}
}


Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
"axios": "0.17.1",
"echarts": "^3.8.5",
"element-ui": "^2.0.11",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",
"http-proxy-middleware": "^0.17.3",
"jquery": "^3.2.1",
"js-cookie": "2.1.4",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"vue": "2.5.2",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",

"screenfull": "3.3.2",
"screenfull": "3.3.2",
"showdown": "1.8.5",
"simplemde": "1.11.2",
"sortablejs": "1.7.0",
"vue": "2.5.2",
"vue-aplayer": "^1.0.1",
"vue-multiselect": "^2.0.8",
"vue-splitpane": "1.0.2",
"vuedraggable": "2.15.0",
"vue-router": "3.0.1",
"vue-splitpane": "1.0.2",
"vuedraggable": "2.15.0",
"vuex": "3.0.1"
},
"devDependencies": {
Expand Down
10 changes: 2 additions & 8 deletions src/api/KaoQin/Attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ export function AttenDetailByPerson(ID){
})
}

export function SaveNewAtten(data){
return fetch({
url: '/Attendance/SaveNewAtten',
method: 'post',
data
})
}


export function UpdateAtten(data){
return fetch({
url: '/Attendance/UpdateAtten',
url: '/Attendance/SaveAtten',
method: 'post',
data
})
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const asyncRouterMap = [
noDropdown:true,
meta: { role: ['user','system'],title:"Table" ,icon:'zonghe',father:true},
meta: { role: ['user','system'],title:"table" ,icon:'zonghe'},
children: [{ path: 'import', name: 'table1', component: _import('table/index'), meta: { role: ['user','system'] ,title:"表格"}}]
children: [{ path: 'import', name: 'table1', component: _import('table/index'), meta: { role: ['user','system'] ,title:"EasyMock"}}]
},

{
Expand Down
251 changes: 177 additions & 74 deletions src/views/KaoQin/count.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<el-tabs :tab-position="tabPosition" style="height: 700px;">
<el-tab-pane label="个人月报">
<div class="charts">
<div id="main" style="width: 600px;height: 400px;"></div>
<div id="myChart" style="width: 600px;height: 400px;"></div>
</div>
</el-tab-pane>
<el-tab-pane label="部门月报"></el-tab-pane>
Expand All @@ -18,7 +18,9 @@
<span slot="label">
<i class="el-icon-date"></i> 年报</span>
<el-tabs :tab-position="tabPosition" style="height: 700px;">
<el-tab-pane label="个人年报"></el-tab-pane>
<el-tab-pane label="个人年报">
<div id="main" style="width: 1200px;height: 600px;"></div>
</el-tab-pane>
<el-tab-pane label="部门年报"></el-tab-pane>

</el-tabs>
Expand All @@ -28,81 +30,182 @@
</div>
</template>
<script>
// 引入基本模板
let echarts = require('echarts/lib/echarts')
// 引入柱状图组件
require('echarts/lib/chart/bar')
// 引入提示框和title组件
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
require('echarts/lib/chart/pie')
export default {
name: '',
data () {
return {
tabPosition:'left',
charts: '',
opinion:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎'],
opinionData:[
{value:335, name:'直接访问'},
{value:310, name:'邮件营销'},
{value:234, name:'联盟广告'},
{value:135, name:'视频广告'},
{value:1548, name:'搜索引擎'}
]
}
// 引入基本模板
// 引入 ECharts 主模块
var echarts = require('echarts/lib/echarts');
// 引入柱状图
require('echarts/lib/chart/heatmap');
require('echarts/lib/chart/bar');
require('echarts/lib/chart/pie');
// 引入提示框和标题组件
require('echarts/lib/component/tooltip');
require('echarts/lib/component/title');
require('echarts/lib/chart/scatter');
export default {
name: '',
data() {
return {
tabPosition: 'left',
}
},
methods: {
getVirtulData(year) {
year = year || '2018';
var date = +echarts.number.parseDate(year + '-01-01');
var end = +echarts.number.parseDate((+year + 1) + '-01-01');
var dayTime = 3600 * 24 * 1000;
var data = [];
for (var time = date; time < end; time += dayTime) {
data.push([
echarts.format.formatTime('yyyy-MM-dd', time),
Math.floor(Math.random() * 10000)
]);
}
return data;
},
drawLine() {
// 基于准备好的dom,初始化echarts实例
let myChart = echarts.init(document.getElementById('myChart'))
// 绘制图表
myChart.setOption({
title: { text: '个人月报' },
tooltip: {},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
methods:{
drawPie(id){
this.charts = echarts.init(document.getElementById(id))
this.charts.setOption({
tooltip: {
trigger: 'item',
formatter: '{a}<br/>{b}:{c} ({d}%)'
},
legend: {
orient: 'vertical',
x: 'left',
data:this.opinion
},
series: [
{
name:'访问来源',
type:'pie',
radius:['50%','70%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
emphasis: {
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'blod'
}
}
},
labelLine: {
normal: {
show: false
}
},
data:this.opinionData
}
]
})
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
});
},
// drawPie(id) {
// this.charts = echarts.init(document.getElementById(id))
// this.charts.setOption({
// tooltip: {
// position: 'top'
// },
// calendar: [{
// orient: 'vertical',
// yearLabel: {
// margin: 40
// },
// dayLabel: {
// firstDay: 1,
// nameMap: ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
// },
// monthLabel: {
// nameMap: 'cn',
// margin: 20
// },
// cellSize: 40,
// top: 100,
// left: 50,
// range: '2017-04'
// }],
// series: [{
// type: 'scatter',
// coordinateSystem: 'calendar',
// calendarIndex: 0,
// symbolSize: function (val) {
// return val[1] / 60;
// },
// data: []
// }]
// })
// },
drawPie_Year() {
let myChart = echarts.init(document.getElementById('main'))
let data = this.getVirtulData(2018);
myChart.setOption({
title: {
top: 30,
text: '个人年度报表',
left: 'center',
textStyle: {
color: '#000'
}
},
//调用
mounted(){
this.$nextTick(function() {
this.drawPie('main')
})
}
},
tooltip: {
trigger: 'item'
},
legend: {
top: '30',
left: '100',
data: ['步数', 'Top 12'],
textStyle: {
color: '#000'
}
},
calendar: [{
top: 100,
left: 'center',
range: ['2018-01-01', '2018-12-31'],
splitLine: {
show: true,
lineStyle: {
color: '#000',
width: 4,
type: 'solid'
}
},
yearLabel: {
formatter: '{start} 1st',
textStyle: {
color: '#fff'
}
},
itemStyle: {
normal: {
color: '#323c48',
borderWidth: 1,
borderColor: '#111'
}
}
}],
series: [{
name: '步数',
type: 'scatter',
coordinateSystem: 'calendar',
data: data,
symbolSize: function (val) {
return val[1] / 500;
},
itemStyle: {
normal: {
color: '#ddb926'
}
}
}
]
})
}
},
//调用
mounted() {
this.$nextTick(function () {
// this.drawPie('main1')
this.drawPie_Year()
this.drawLine()
})
}
}
</script>
<style lang="scss" scoped>
Expand Down
Loading

0 comments on commit 3f122cd

Please sign in to comment.