|
@@ -1,19 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<section>
|
|
<section>
|
|
<el-col :span="24" style="padding-bottom: 0px;text-align:center;margin-top:10px;">
|
|
<el-col :span="24" style="padding-bottom: 0px;text-align:center;margin-top:10px;">
|
|
- <!-- <el-date-picker
|
|
|
|
- v-model="dateRange"
|
|
|
|
- type="monthrange"
|
|
|
|
- align="right"
|
|
|
|
- unlink-panels
|
|
|
|
- :clearable="false"
|
|
|
|
- range-separator="至"
|
|
|
|
- start-placeholder="开始月份"
|
|
|
|
- end-placeholder="结束月份"
|
|
|
|
- :picker-options="pickerOptions"
|
|
|
|
- value-format="yyyy-MM"
|
|
|
|
- @change="getEchart">
|
|
|
|
- </el-date-picker> -->
|
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="dateRange" :editable="false"
|
|
v-model="dateRange" :editable="false"
|
|
format="yyyy-MM-dd" value-format="yyyy-MM-dd"
|
|
format="yyyy-MM-dd" value-format="yyyy-MM-dd"
|
|
@@ -25,13 +12,40 @@
|
|
end-placeholder="结束日期"
|
|
end-placeholder="结束日期"
|
|
></el-date-picker>
|
|
></el-date-picker>
|
|
|
|
|
|
- <el-radio-group v-model="radio" @change="getEchart">
|
|
|
|
|
|
+ <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;">
|
|
<el-radio-button label="项目"></el-radio-button>
|
|
<el-radio-button label="项目"></el-radio-button>
|
|
<el-radio-button label="部门"></el-radio-button>
|
|
<el-radio-button label="部门"></el-radio-button>
|
|
|
|
+ <el-radio-button label="人员"></el-radio-button>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-col>
|
|
</el-col>
|
|
<div id="container" :style="'height:'+containerHeight+'px'"></div>
|
|
<div id="container" :style="'height:'+containerHeight+'px'"></div>
|
|
- <div style="position:fixed;top:120px;right:150px;"><el-button @click="exportProjectData()">导出数据</el-button></div>
|
|
|
|
|
|
+ <div style="position:fixed;top:120px;right:150px;"><el-button @click="showExportDialog">报表导出</el-button></div>
|
|
|
|
+
|
|
|
|
+ <!--导出报表条件选择 -->
|
|
|
|
+ <el-dialog title="工时报表导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
|
|
|
|
+ <el-form ref="form3" :model="exportParam" >
|
|
|
|
+ <el-form-item prop="projectId" label="选择项目">
|
|
|
|
+ <el-select v-model="exportParam.projectId" placeholder="全部项目" clearable style="width:350px;">
|
|
|
|
+ <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="projectId" label="日期范围">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="exportParam.dateRange" :editable="false"
|
|
|
|
+ format="yyyy-MM-dd" value-format="yyyy-MM-dd"
|
|
|
|
+ :clearable="true"
|
|
|
|
+ range-separator="至"
|
|
|
|
+ type="daterange"
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
+ ></el-date-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="exportProjectData" style="width:100%;" >导出</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</section>
|
|
</section>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -40,6 +54,9 @@
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ projectList:[],
|
|
|
|
+ exportParam:{projectId:null,datRange:[]},
|
|
|
|
+ exportDialog:false,
|
|
dateRange:[],
|
|
dateRange:[],
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
|
|
radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
|
|
@@ -49,11 +66,40 @@
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ showExportDialog() {
|
|
|
|
+ this.exportDialog = true;
|
|
|
|
+ this.exportParam.dateRange = this.dateRange;
|
|
|
|
+ },
|
|
|
|
+ //获取我的项目列表
|
|
|
|
+ getMyProjectList() {
|
|
|
|
+ this.http.post('/project/getProjectList', {
|
|
|
|
+ },
|
|
|
|
+ res => {
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.projectList = res.data;
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: res.msg,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
exportProjectData() {
|
|
exportProjectData() {
|
|
var param = {};
|
|
var param = {};
|
|
- if (this.dateRange != null) {
|
|
|
|
|
|
+ if (this.exportParam.dateRange != null) {
|
|
param = {startDate:this.dateRange[0], endDate: this.dateRange[1]};
|
|
param = {startDate:this.dateRange[0], endDate: this.dateRange[1]};
|
|
}
|
|
}
|
|
|
|
+ if (this.exportParam.projectId != null) {
|
|
|
|
+ param.projectId = this.exportParam.projectId;
|
|
|
|
+ }
|
|
|
|
+
|
|
this.http.post("/project/exportTimeCost", param,
|
|
this.http.post("/project/exportTimeCost", param,
|
|
res => {
|
|
res => {
|
|
this.listLoading = false;
|
|
this.listLoading = false;
|
|
@@ -85,14 +131,22 @@
|
|
if (this.dateRange != null) {
|
|
if (this.dateRange != null) {
|
|
param = {startDate:this.dateRange[0], endDate: this.dateRange[1]};
|
|
param = {startDate:this.dateRange[0], endDate: this.dateRange[1]};
|
|
}
|
|
}
|
|
- this.http.post(this.radio=='项目'?this.port.project.listCost:this.port.project.depCost, param,
|
|
|
|
|
|
+ var url = '';
|
|
|
|
+ if (this.radio=='项目') {
|
|
|
|
+ url = this.port.project.listCost;
|
|
|
|
+ } else if (this.radio=='部门') {
|
|
|
|
+ url = this.port.project.depCost;
|
|
|
|
+ } else if (this.radio=='人员') {
|
|
|
|
+ url = '/project/getAllMembCost';
|
|
|
|
+ }
|
|
|
|
+ this.http.post(url, param,
|
|
res => {
|
|
res => {
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
var xList = [], yList = [], list = res.data.costList,
|
|
var xList = [], yList = [], list = res.data.costList,
|
|
- totalMoneyCost = (this.radio=='项目'?res.data.totalMoneyCost:res.data.totalCostMoney);
|
|
|
|
|
|
+ totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
|
|
for(var i in list) {
|
|
for(var i in list) {
|
|
- if(this.radio=='项目') {
|
|
|
|
- xList.push(list[i].project);
|
|
|
|
|
|
+ if(this.radio=='项目' || this.radio == '人员') {
|
|
|
|
+ xList.push(this.radio=='项目'?list[i].project:list[i].name);
|
|
yList.push({
|
|
yList.push({
|
|
"value": list[i].costMoney,
|
|
"value": list[i].costMoney,
|
|
"id": list[i].id,
|
|
"id": list[i].id,
|
|
@@ -185,7 +239,7 @@
|
|
} else {
|
|
} else {
|
|
_this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
|
|
_this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
|
|
+ } else if (_this.radio=='部门') {
|
|
if (_this.dateRange != null) {
|
|
if (_this.dateRange != null) {
|
|
_this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
|
|
_this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
|
|
+"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
|
|
+"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
|
|
@@ -228,12 +282,15 @@
|
|
var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
|
|
var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
|
|
this.dateRange = [startStr,t];
|
|
this.dateRange = [startStr,t];
|
|
}
|
|
}
|
|
|
|
+ this.exportParam.dateRange = this.dateRange;
|
|
|
|
|
|
this.getEchart();
|
|
this.getEchart();
|
|
var _this = this;
|
|
var _this = this;
|
|
window.addEventListener("resize", function() {
|
|
window.addEventListener("resize", function() {
|
|
_this.myChart.resize();
|
|
_this.myChart.resize();
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ this.getMyProjectList();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|