Browse Source

优化报表

master
陈裕财 4 years ago
parent
commit
b04504915c
  1. 637
      src/views/xm/core/xmTaskWorkload/WorkloadSetDayList.vue
  2. 7
      src/views/xm/core/xmTaskWorkload/XmTaskWorkloadInfo.vue
  3. 320
      src/views/xm/core/xmTaskWorkload/XmTaskWorkloadSimpleListForBizDate.vue

637
src/views/xm/core/xmTaskWorkload/WorkloadSetDayList.vue

@ -1,212 +1,340 @@
<template>
<section class="padding">
<el-row :gutter="5">
<el-col :span="18">
<div>
<div class="main" id="projectWorkloadSetDayList" style="width:100%;height:600px;margin:0 auto;"></div>
</div>
</el-col>
<el-col :span="6" class="border padding">
<el-form :model="filters">
<el-form-item label="归属项目" v-if="!xmProject">
<xm-project-select v-if="!xmProject" ref="xmProjectSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProjectSelected" @clear="onProjectClear"></xm-project-select>
</el-form-item>
<el-form-item label="人员编号" v-if="queryScope!=='my'">
<el-input v-model="filters.userid"></el-input>
</el-form-item>
<el-form-item label="任务编号编号">
<el-input v-model="filters.taskId"></el-input>
</el-form-item>
<el-form-item label="日期区间">
<br>
<date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></date-range>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="listProjectWorkloadSetDay">查询</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</section>
<section class="padding">
<el-row :gutter="5">
<el-col :span="18">
<div>
<div
class="main"
id="projectWorkloadSetDayList"
style="width: 100%; height: 600px; margin: 0 auto"
></div>
</div>
</el-col>
<el-col :span="6" class="border padding">
<el-form :model="filters">
<el-form-item label="归属项目" v-if="!xmProject">
<xm-project-select
v-if="!xmProject"
ref="xmProjectSelect"
style="display: inline"
:auto-select="false"
:link-project-id="xmProject ? xmProject.id : null"
@row-click="onProjectSelected"
@clear="onProjectClear"
></xm-project-select>
</el-form-item>
<el-form-item label="人员编号" v-if="queryScope !== 'my'">
<el-input v-model="filters.userid"></el-input>
</el-form-item>
<el-form-item label="任务编号编号">
<el-input v-model="filters.taskId"></el-input>
</el-form-item>
<el-form-item label="日期区间">
<br />
<date-range
v-model="filters"
value-format="yyyy-MM-dd"
start-key="startBizDate"
end-key="endBizDate"
></date-range>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
@click="listProjectWorkloadSetDay"
>查询</el-button
>
</el-form-item>
</el-form>
</el-col>
</el-row>
<el-row class="padding-top">
<!--列表 XmTaskWorkload 工时登记表-->
<el-table
ref="xmTaskWorkloadTable"
:data="xmProjectWorkloadSetDays"
:row-style="{ height: '50px' }"
highlight-current-row
v-loading="load.list"
border
style="width: 100%"
:header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }"
>
<el-table-column
sortable
type="index"
width="55"
show-overflow-tooltip
fixed="left"
></el-table-column>
<el-table-column
prop="bizDate"
label="工时日期"
width="120"
show-overflow-tooltip
sortable
fixed="left"
>
<template slot-scope="scope">
<span>{{ scope.row.bizDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="workload"
label="登记工时"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.workload }}h </template>
</el-table-column>
<el-table-column
prop="toConfirmWorkload"
label="待确认"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.toConfirmWorkload }}h </template>
</el-table-column>
<el-table-column
prop="hadConfirmWorkload"
label="已确认"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.hadConfirmWorkload }}h </template>
</el-table-column>
<el-table-column
prop="notNeedSetWorkload"
label="无须结算"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.notNeedSetWorkload }}h </template>
</el-table-column>
<el-table-column
prop="toSetSworkload"
label="待结算"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.toSetSworkload }}h </template>
</el-table-column>
<el-table-column
prop="hadCommitSworkload"
label="已提交审核"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.hadCommitSworkload }}h </template>
</el-table-column>
<el-table-column
prop="hadAgreeSworkload"
label="已结算"
min-width="120"
show-overflow-tooltip
sortable
>
<template slot-scope="scope"> {{ scope.row.hadAgreeSworkload }}h </template>
</el-table-column>
</el-table>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { mapGetters } from 'vuex'
import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//
import { listProjectWorkloadSetDay } from '@/api/xm/core/xmTaskWorkload';
export default {
components: {
XmProjectSelect,
},
props:['xmProduct','xmProject','queryScope'],
computed: {
...mapGetters([
'userInfo','roles'
]),
dataSetCpd(){
return [
['日期',...this.xmProjectWorkloadSetDays.map(i=>i.bizDate)],
['登记工时',...this.xmProjectWorkloadSetDays.map(i=>i.workload)],
['待确认',...this.xmProjectWorkloadSetDays.map(i=>i.toConfirmWorkload)],
['已确认',...this.xmProjectWorkloadSetDays.map(i=>i.hadConfirmWorkload)],
['待结算',...this.xmProjectWorkloadSetDays.map(i=>i.toSetWorkload)],
['已提交审核',...this.xmProjectWorkloadSetDays.map(i=>i.hadCommitSworkload)],
//['',...this.xmProjectWorkloadSetDays.map(i=>i.hadAgreeSworkload)],
['已结算',...this.xmProjectWorkloadSetDays.map(i=>i.hadSetSworkload)]
]
}
},
watch: {
dataSetCpd(){
this.$nextTick(()=>{
this.drawCharts();
})
}
},
data() {
return {
filters:{
category:'',
product:null,
iteration:null,
project:null,
startBizDate:'',
endBizDate:'',
userid:'',
taskId:''
},
dicts:{},// params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
load:{ list: false, edit: false, del: false, add: false },//...
dateRanger:[],
maxTableHeight:300,
visible:false,
xmProjectWorkloadSetDays:[],
import util from "@/common/js/util"; //
import { initSimpleDicts } from "@/api/mdp/meta/item"; //
import { mapGetters } from "vuex";
}//end return
},//end data
methods: {
listProjectWorkloadSetDay(){
var params={}
if(this.filters.project){
params.projectId=this.filters.project.id
}
if(this.filters.startBizDate && this.filters.endBizDate){
params.startBizDate=this.filters.startBizDate;
params.endBizDate=this.filters.endBizDate;
}
if(this.filters.userid){
params.userid=this.filters.userid
}
if(this.filters.taskId){
params.taskId=this.filters.taskId
}
listProjectWorkloadSetDay(params).then(res=>{
this.xmProjectWorkloadSetDays=res.data.tips.isOk?res.data.data:this.xmProjectWorkloadSetDays;
})
},
initData(){
this.filters.product=this.xmProduct
this.filters.project=this.xmProject
this.filters.iteration=this.xmIteration
this.xmProjectWorkloadSetDays=[]
if(this.queryScope=='my'){
this.filters.userid=this.userInfo.userid
}
this.$nextTick(()=>{
if(this.$refs['xmProjectSelect'])this.$refs['xmProjectSelect'].clearSelect();
this.listProjectWorkloadSetDay();
})
},
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById("projectWorkloadSetDayList"));
var that=this;
this.myChart.on('updateAxisPointer', function (event) {
const xAxisInfo = event.axesInfo[0];
if (xAxisInfo) {
const dimension = xAxisInfo.value + 1;
that.myChart.setOption({
series: {
id: 'pie',
label: {
formatter: '{b}: {@[' + dimension + ']} ({d}%)'
},
encode: {
value: dimension,
tooltip: dimension
}
}
});
}
});
this.myChart.setOption({
title: {
text: '工时日报表',
},
tooltip: {
trigger: 'axis',
showContent: false
},
legend: {
},
import XmProjectSelect from "@/views/xm/core/components/XmProjectSelect"; //
import { listProjectWorkloadSetDay } from "@/api/xm/core/xmTaskWorkload";
import XmTaskWorkloadSimpleListForBizDate from '@/views/xm/core/xmTaskWorkload/XmTaskWorkloadSimpleListForBizDate'
export default {
components: {
XmProjectSelect,XmTaskWorkloadSimpleListForBizDate,
},
props: ["xmProduct", "xmProject", "queryScope"],
computed: {
...mapGetters(["userInfo", "roles"]),
dataSetCpd() {
return [
["日期", ...this.xmProjectWorkloadSetDays.map((i) => i.bizDate)],
//['',...this.xmProjectWorkloadSetDays.map(i=>i.workload)],
[
"待确认",
...this.xmProjectWorkloadSetDays.map((i) => i.toConfirmWorkload),
],
[
"已确认",
...this.xmProjectWorkloadSetDays.map((i) => i.hadConfirmWorkload),
],
[
"待结算",
...this.xmProjectWorkloadSetDays.map((i) => i.toSetSWorkload),
],
[
"已提交审核",
...this.xmProjectWorkloadSetDays.map((i) => i.hadCommitSworkload),
],
//['',...this.xmProjectWorkloadSetDays.map(i=>i.hadAgreeSworkload)],
[
"已结算",
...this.xmProjectWorkloadSetDays.map((i) => i.hadAgreeSworkload),
],
];
},
},
watch: {
dataSetCpd() {
this.$nextTick(() => {
this.drawCharts();
});
},
},
data() {
return {
filters: {
category: "",
product: null,
iteration: null,
project: null,
startBizDate: "",
endBizDate: "",
userid: "",
taskId: "",
},
dicts: {}, // params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
load: { list: false, edit: false, del: false, add: false }, //...
dateRanger: [],
maxTableHeight: 300,
visible: false,
xmProjectWorkloadSetDays: [],
}; //end return
}, //end data
methods: {
listProjectWorkloadSetDay() {
var params = {};
if (this.filters.project) {
params.projectId = this.filters.project.id;
}
dataset: {
source: this.dataSetCpd
},
xAxis: {
type: 'category',
},
yAxis: { gridIndex: 0 },
grid: { top: '55%' },
series: [
{ name:'登记工时',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{ name:'待确认',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{
name:'已确认',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{
name:'无需结算',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{ name:'待结算',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{ name:'已提交审核',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
/**
if (this.filters.startBizDate && this.filters.endBizDate) {
params.startBizDate = this.filters.startBizDate;
params.endBizDate = this.filters.endBizDate;
}
if (this.filters.userid) {
params.userid = this.filters.userid;
}
if (this.filters.taskId) {
params.taskId = this.filters.taskId;
}
listProjectWorkloadSetDay(params).then((res) => {
this.xmProjectWorkloadSetDays = res.data.tips.isOk
? res.data.data
: this.xmProjectWorkloadSetDays;
});
},
initData() {
this.filters.product = this.xmProduct;
this.filters.project = this.xmProject;
this.filters.iteration = this.xmIteration;
this.xmProjectWorkloadSetDays = [];
if (this.queryScope == "my") {
this.filters.userid = this.userInfo.userid;
}
this.$nextTick(() => {
if (this.$refs["xmProjectSelect"])
this.$refs["xmProjectSelect"].clearSelect();
this.listProjectWorkloadSetDay();
});
},
drawCharts() {
this.myChart = this.$echarts.init(
document.getElementById("projectWorkloadSetDayList")
);
var that = this;
this.myChart.on("updateAxisPointer", function (event) {
const xAxisInfo = event.axesInfo[0];
if (xAxisInfo) {
const dimension = xAxisInfo.value + 1;
that.myChart.setOption({
series: {
id: "pie",
label: {
formatter: "{b}: {@[" + dimension + "]} ({d}%)",
},
encode: {
value: dimension,
tooltip: dimension,
},
},
});
}
});
this.myChart.setOption({
title: {
text: "工时日报表",
},
tooltip: {
trigger: "axis",
showContent: false,
},
legend: {},
dataset: {
source: that.dataSetCpd,
},
xAxis: {
type: "category",
},
yAxis: { gridIndex: 0 },
grid: { top: "55%" },
series: [
{
name: "待确认",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
{
name: "已确认",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
{
name: "无需结算",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
{
name: "待结算",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
{
name: "已提交审核",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
/**
{ name:'已审核',
type: 'line',
seriesLayoutBy: 'row',
@ -214,64 +342,55 @@
emphasis: { focus: 'series' },
},
*/
{ name:'已结算',
type: 'line',
seriesLayoutBy: 'row',
smooth:true,
emphasis: { focus: 'series' },
},
{
type: 'pie',
id: 'pie',
radius: '30%',
center: ['50%', '25%'],
emphasis: {
focus: 'self'
},
label: {
formatter: '{b}: {@日期} ({d}%)'
},
encode: {
itemName: '日期',
value: '日期',
tooltip: '日期'
}
}
]
});
},
onProjectSelected(project){
this.filters.project=project
this.xmProjectWorkloadSetDays=[];
this.listProjectWorkloadSetDay();
},
onProjectClear(){
this.filters.project=null
this.xmProjectWorkloadSetDays=[];
},
},//end method
mounted() {
/**
initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
this.dicts=res.data.data;
})
*/
//this.charts();
//this.drawCharts();
this.initData();
}//end mounted
}
{
name: "已结算",
type: "line",
seriesLayoutBy: "row",
smooth: true,
emphasis: { focus: "series" },
},
{
type: "pie",
id: "pie",
radius: "30%",
center: ["50%", "25%"],
emphasis: {
focus: "self",
},
label: {
formatter: "{b}: {@日期} ({d}%)",
},
encode: {
itemName: "日期",
value: "日期",
tooltip: "日期",
},
},
],
});
},
onProjectSelected(project) {
this.filters.project = project;
this.xmProjectWorkloadSetDays = [];
this.listProjectWorkloadSetDay();
},
onProjectClear() {
this.filters.project = null;
this.xmProjectWorkloadSetDays = [];
},
}, //end method
mounted() {
this.initData();
}, //end mounted
};
</script>
<style scoped>
.image {
width: 100%;
display: block;
}
.image {
width: 100%;
display: block;
}
</style>

7
src/views/xm/core/xmTaskWorkload/XmTaskWorkloadInfo.vue

@ -104,8 +104,11 @@
</template>
</el-table-column>
<el-table-column prop="toConfirmWorkload" label="待确认工时" width="120" show-overflow-tooltip sortable>
<template slot-scope="scope">
{{scope.row.toConfirmWorkload}}h
<template slot-scope="scope">
<el-popover title="当前任务所有待确认工时记录">
<xm-task-workload-simple-list :visible="scope.row.id==editForm.id" :wstatus="'0'" :xm-task="{id:scope.row.taskId,name:scope.row.taskName,projectName:scope.row.projectName,projectId:scope.row.projectId,budgetWorkload:scope.row.budgetWorkload,actWorkload:scope.row.actWorkload}" ref="xmTaskWorkloadSimpleList2" @edit-some-fields="searchXmTaskWorkloads"></xm-task-workload-simple-list>
<el-link slot="reference" style="display:inline;">{{scope.row.toConfirmWorkload}}h</el-link>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="hadConfirmWorkload" label="已确认工时" width="120" show-overflow-tooltip sortable>

320
src/views/xm/core/xmTaskWorkload/XmTaskWorkloadSimpleListForBizDate.vue

@ -0,0 +1,320 @@
<template>
<section>
<el-row class="padding-top">
<el-table ref="xmTaskWorkloadTable" :data="xmTaskWorkloads" :row-style="{height:'50px'}" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip></el-table-column>
<el-table-column prop="username" label="姓名" width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="bizDate" label="登记日期" width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="workload" label="登记工时" width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="wstatus" label="确认状态" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<div class="cell-text">
<el-tag v-for="(item,index) in formatDictsWithClass(dicts,'wstatus',scope.row.wstatus)" :key="index" :type="item.className">{{item.name}}</el-tag>
</div>
<span class="cell-bar">
<el-select v-model="scope.row.wstatus" placeholder="工时状态" style="display:block;" @change="editXmTaskWorkloadSomeFields(scope.row,'wstatus',$event)">
<el-option :value="item.id" :label="item.name" v-for="(item,index) in dicts.wstatus" :key="index"></el-option>
</el-select>
</span>
</template>
</el-table-column>
<el-table-column prop="sstatus" label="结算状态" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<div class="cell-text">
<el-tag v-for="(item,index) in formatDictsWithClass(dicts,'sstatus',scope.row.sstatus)" :key="index" :type="item.className">{{item.name}}</el-tag>
</div>
<span class="cell-bar">
<el-select v-model="scope.row.sstatus" placeholder="结算状态" style="display:block;" @change="editXmTaskWorkloadSomeFields(scope.row,'sstatus',$event)">
<el-option :value="item.id" :label="item.name" v-for="(item,index) in dicts.sstatus" :key="index"></el-option>
</el-select>
</span>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" width="120" show-overflow-tooltip></el-table-column>
<el-table-column prop="ttype" label="任务类型" width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag v-for="(item,index) in formatDictsWithClass(dicts,'taskType',scope.row.ttype)" :key="index" :type="item.className">{{item.name}}</el-tag>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//
import { listXmTaskWorkload, delXmTaskWorkload, batchDelXmTaskWorkload,editXmTaskWorkloadSomeFields,initDicts } from '@/api/xm/core/xmTaskWorkload';
import XmTaskWorkloadEdit from './XmTaskWorkloadEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmTaskWorkloadSimpleListForBizDate',
components: {
XmTaskWorkloadEdit,
},
props:[ 'visible','wstatus','sstatus','bizDate','projectId','userid','taskId'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTaskWorkloads()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTaskWorkloads: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
taskType:[],
taskState:[],
wstatus:[],
sstatus:[],
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmTaskWorkload
addForm: {
userid:'',username:'',ctime:'',taskId:'',cuserid:'',bizDate:'',wstatus:'',remark:'',ttype:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:''
},
editFormVisible: false,//
editForm: {
userid:'',username:'',ctime:'',taskId:'',cuserid:'',bizDate:'',wstatus:'',remark:'',ttype:'',id:'',sbillId:'',stime:'',sstatus:'',amt:'',samt:'',workload:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
editXmTaskWorkloadSomeFields(row,fieldName,$event){
let params={
ids:[row.id],
};
if(this.sels.length>0){
if(this.sels.some(k=>k.projectId!=row.projectId)){
this.$notify({position:'bottom-left',showClose:true,message:'存在不同项目的工时单,请重新选择',type:'warning'})
return;
}
params.ids=this.sels.map(i=>i.id);
}else{
params.ids = [row.id];
params[fieldName]=$event
}
var func = editXmTaskWorkloadSomeFields
if(fieldName==='sbillId'){
func = editWorkloadToSbill
params.sbillId=$event.id
}else{
params[fieldName]=$event
}
func(params).then(res=>{
let tips = res.data.tips;
this.getXmTaskWorkloads();
if(tips.isOk){
this.$emit("edit-some-fields",params)
}else{
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
})
},
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTaskWorkloads();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTaskWorkloads();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmTaskWorkloads();
},
searchXmTaskWorkloads(){
this.pageInfo.count=true;
this.getXmTaskWorkloads();
},
// XmTaskWorkload
getXmTaskWorkloads() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
if(this.projectId){
params.projectId=this.projectId
}
if(this.taskId){
params.taskId=this.taskId
}
if(this.userid){
params.userid=this.userid
}
if(this.wstatus){
params.wstatus=this.wstatus
}
if(this.sstatus){
params.sstatus=this.sstatus
}
if(this.bizDate){
params.bizDate=this.bizDate
}
this.load.list = true;
listXmTaskWorkload(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTaskWorkloads = res.data.data;
}else{
this.$notify({position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmTaskWorkload
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTaskWorkload
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTaskWorkloads();
this.$emit('submit',this.editForm)
},
afterEditSubmit(){
this.editFormVisible=false;
this.$emit('submit',this.editForm)
},
//xmTaskWorkload
selsChange: function (sels) {
this.sels = sels;
},
//xmTaskWorkload
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmTaskWorkload(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.count=true;
this.getXmTaskWorkloads();
this.$emit('submit',this.editForm)
}
this.$notify({position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTaskWorkload
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { id:i.id}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmTaskWorkload(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.pageInfo.count=true;
this.getXmTaskWorkloads();
this.$emit('submit')
}
this.$notify({position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
rowClick: function(row, event, column){
this.editForm=row
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
if(this.visible==true){
this.initData()
this.searchXmTaskWorkloads();
}
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTaskWorkloadTable.$el)
});
}
}
</script>
<style scoped>
.label {
font-family: 黑体;
}
</style>
Loading…
Cancel
Save