|
|
@ -2,30 +2,43 @@ |
|
|
<section class="page-container page-full-height padding border"> |
|
|
<section class="page-container page-full-height padding border"> |
|
|
<el-row v-if="!simple"> |
|
|
<el-row v-if="!simple"> |
|
|
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input> |
|
|
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input> |
|
|
<el-button type="primary" v-loading="load.list" :disabled="load.list==true" v-on:click="searchXmProjectPhaseTemplates">查询</el-button> |
|
|
|
|
|
<el-button v-if="!selProjectTemplate" type="primary" @click="showProjectTemplate">选择项目模板</el-button> |
|
|
|
|
|
<el-button v-if="!isSelect" type="primary" @click="showAdd">+项目计划</el-button> |
|
|
|
|
|
<el-button v-if="isSelect" type="primary" @click="selectedConfirm">确认选择</el-button> |
|
|
|
|
|
|
|
|
<el-input v-model="filters.projectName" style="width: 20%;" placeholder="点击选择项目" @click.native="showProjectTemplate"></el-input> |
|
|
|
|
|
<el-button type="primary" v-loading="load.list" :disabled="load.list==true" v-on:click="searchXmProjectPhases">查询</el-button> |
|
|
|
|
|
<el-button v-if="isSelect" type="primary" @click="selectedConfirm">确认选择</el-button> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row class="page-main" v-if="!simple"> |
|
|
<el-row class="page-main" v-if="!simple"> |
|
|
<!--列表 XmProjectPhaseTemplate xm_phase_template--> |
|
|
<!--列表 XmProjectPhaseTemplate xm_phase_template--> |
|
|
<el-table default-expand-all :data="xmProjectPhaseTemplateTreeData" @sort-change="sortChange" row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;"> |
|
|
|
|
|
|
|
|
<el-table lazy :load="loadXmProjectPhaseLazy" :data="xmProjectPhaseTemplateTreeData" @sort-change="sortChange" row-key="id" :tree-props="{children: 'children', hasChildren: 'childrenCnt'}" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;"> |
|
|
<el-table-column sortable type="selection" width="40"></el-table-column> |
|
|
<el-table-column sortable type="selection" width="40"></el-table-column> |
|
|
<el-table-column prop="phaseName" label="计划名称" min-width="260" > |
|
|
<el-table-column prop="phaseName" label="计划名称" min-width="260" > |
|
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
{{scope.row.seqNo}} {{scope.row.phaseName}} |
|
|
|
|
|
|
|
|
<span> |
|
|
|
|
|
<span v-show="scope.row.milestone=='1'"> |
|
|
|
|
|
<i class="el-icon-star-on"></i> |
|
|
|
|
|
</span> |
|
|
|
|
|
<span v-show="scope.row.isKeyPath=='1'"> |
|
|
|
|
|
<i class="el-icon-s-help"></i> |
|
|
|
|
|
</span> |
|
|
|
|
|
<el-link :icon="scope.row.ntype=='1'?'el-icon-folder-opened':''" type="primary">{{scope.row.seqNo}} |
|
|
|
|
|
</el-link> |
|
|
|
|
|
{{scope.row.phaseName}} |
|
|
|
|
|
</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column prop="remark" label="备注" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetHours" label="工时" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetStaffNu" label="投入人员数" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="projectTypeName" label="项目类型名称" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetNouserAt" label="非人力成本总预算" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetInnerUserAt" label="内部人力成本总预算" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetOutUserAt" label="外购人力成本总预算" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetWorkload" label="总工作量单位人时" min-width="80" ></el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column prop="remark" label="备注" min-width="80" show-overflow-tooltip></el-table-column> |
|
|
|
|
|
<el-table-column label="预计工作量(人时)" min-width="80" show-overflow-tooltip> |
|
|
|
|
|
<el-table-column prop="phaseBudgetHours" label="工时" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetStaffNu" label="投入人员数" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetWorkload" label="总工作量" min-width="80" ></el-table-column> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="成本预算(元)" min-width="80" show-overflow-tooltip> |
|
|
|
|
|
<el-table-column prop="phaseBudgetAt" label="总预算" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetNouserAt" label="非人力" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetInnerUserAt" label="内部" min-width="80" ></el-table-column> |
|
|
|
|
|
<el-table-column prop="phaseBudgetOutUserAt" label="外购" min-width="80" ></el-table-column> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column label="操作" width="260" fixed="right" v-if="!isSelect" > |
|
|
<el-table-column label="操作" width="260" fixed="right" v-if="!isSelect" > |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button @click="showEdit( scope.row,scope.$index)">改</el-button> |
|
|
<el-button @click="showEdit( scope.row,scope.$index)">改</el-button> |
|
|
@ -68,11 +81,10 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import util from '@/common/js/util';//全局公共库 |
|
|
import util from '@/common/js/util';//全局公共库 |
|
|
|
|
|
import treeTool from '@/common/js/treeTool';//全局公共库 |
|
|
//import Sticky from '@/components/Sticky' // 粘性header组件 |
|
|
//import Sticky from '@/components/Sticky' // 粘性header组件 |
|
|
import { listOption } from '@/api/mdp/meta/itemOption';//下拉框数据查询 |
|
|
import { listOption } from '@/api/mdp/meta/itemOption';//下拉框数据查询 |
|
|
import { listXmProjectPhaseTemplate, delXmProjectPhaseTemplate, batchDelXmProjectPhaseTemplate } from '@/api/xm/core/xmProjectPhaseTemplate'; |
|
|
|
|
|
import XmProjectPhaseTemplateAdd from './XmProjectPhaseTemplateAdd';//新增界面 |
|
|
|
|
|
import XmProjectPhaseTemplateEdit from './XmProjectPhaseTemplateEdit';//修改界面 |
|
|
|
|
|
|
|
|
import { listXmProjectPhase } from '@/api/xm/core/xmProjectPhase'; |
|
|
import XmProjectTemplateList from '../xmProjectTemplate/XmProjectTemplateList';//修改界面 |
|
|
import XmProjectTemplateList from '../xmProjectTemplate/XmProjectTemplateList';//修改界面 |
|
|
import { mapGetters } from 'vuex' |
|
|
import { mapGetters } from 'vuex' |
|
|
|
|
|
|
|
|
@ -84,7 +96,7 @@ |
|
|
'userInfo','roles' |
|
|
'userInfo','roles' |
|
|
]), |
|
|
]), |
|
|
xmProjectPhaseTemplateTreeData(){ |
|
|
xmProjectPhaseTemplateTreeData(){ |
|
|
return this.translateDataToTree(this.xmProjectPhaseTemplates); |
|
|
|
|
|
|
|
|
return treeTool.translateDataToTree(this.xmProjectPhases,'parentPhaseId','id'); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
watch:{ |
|
|
watch:{ |
|
|
@ -94,15 +106,19 @@ |
|
|
}else{ |
|
|
}else{ |
|
|
this.filters.projectTemplate=null; |
|
|
this.filters.projectTemplate=null; |
|
|
} |
|
|
} |
|
|
this.getXmProjectPhaseTemplates() |
|
|
|
|
|
|
|
|
this.getXmProjectPhases() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
filters: { |
|
|
filters: { |
|
|
key: '', |
|
|
key: '', |
|
|
|
|
|
projectId:'', |
|
|
|
|
|
projectName:'', |
|
|
|
|
|
productId:'', |
|
|
|
|
|
productName:'', |
|
|
}, |
|
|
}, |
|
|
xmProjectPhaseTemplates: [],//查询结果 |
|
|
|
|
|
|
|
|
xmProjectPhases: [],//查询结果 |
|
|
pageInfo:{//分页数据 |
|
|
pageInfo:{//分页数据 |
|
|
total:0,//服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算。 |
|
|
total:0,//服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算。 |
|
|
pageSize:500,//每页数据 |
|
|
pageSize:500,//每页数据 |
|
|
@ -136,11 +152,11 @@ |
|
|
methods: { |
|
|
methods: { |
|
|
handleSizeChange(pageSize) { |
|
|
handleSizeChange(pageSize) { |
|
|
this.pageInfo.pageSize=pageSize; |
|
|
this.pageInfo.pageSize=pageSize; |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
}, |
|
|
}, |
|
|
handleCurrentChange(pageNum) { |
|
|
handleCurrentChange(pageNum) { |
|
|
this.pageInfo.pageNum = pageNum; |
|
|
this.pageInfo.pageNum = pageNum; |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
}, |
|
|
}, |
|
|
// 表格排序 obj.order=ascending/descending,需转化为 asc/desc ; obj.prop=表格中的排序字段,字段驼峰命名 |
|
|
// 表格排序 obj.order=ascending/descending,需转化为 asc/desc ; obj.prop=表格中的排序字段,字段驼峰命名 |
|
|
sortChange( obj ){ |
|
|
sortChange( obj ){ |
|
|
@ -154,14 +170,23 @@ |
|
|
this.pageInfo.orderFields=['xxx']; |
|
|
this.pageInfo.orderFields=['xxx']; |
|
|
this.pageInfo.orderDirs=[dir]; |
|
|
this.pageInfo.orderDirs=[dir]; |
|
|
} |
|
|
} |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
}, |
|
|
}, |
|
|
searchXmProjectPhaseTemplates(){ |
|
|
|
|
|
|
|
|
searchXmProjectPhases(){ |
|
|
this.pageInfo.count=true; |
|
|
this.pageInfo.count=true; |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
|
|
|
}, |
|
|
|
|
|
getParams(params){ |
|
|
|
|
|
if( this.filters.projectId ){ |
|
|
|
|
|
params.projectId=this.filters.projectId |
|
|
|
|
|
} |
|
|
|
|
|
if( this.filters.productId ){ |
|
|
|
|
|
params.productId=this.filters.productId |
|
|
|
|
|
} |
|
|
|
|
|
return params; |
|
|
}, |
|
|
}, |
|
|
//获取列表 XmProjectPhaseTemplate xm_phase_template |
|
|
//获取列表 XmProjectPhaseTemplate xm_phase_template |
|
|
getXmProjectPhaseTemplates() { |
|
|
|
|
|
|
|
|
getXmProjectPhases() { |
|
|
let params = { |
|
|
let params = { |
|
|
pageSize: this.pageInfo.pageSize, |
|
|
pageSize: this.pageInfo.pageSize, |
|
|
pageNum: this.pageInfo.pageNum, |
|
|
pageNum: this.pageInfo.pageNum, |
|
|
@ -175,19 +200,19 @@ |
|
|
} |
|
|
} |
|
|
params.orderBy= orderBys.join(",") |
|
|
params.orderBy= orderBys.join(",") |
|
|
} |
|
|
} |
|
|
if( this.filters.projectTemplate ){ |
|
|
|
|
|
params.projectId=this.filters.projectTemplate.id |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.$message({showClose: true, message: "请选择项目模板", type: 'error' }); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
this.getParams(params) |
|
|
|
|
|
if(!params.projectId && !params.productId){ |
|
|
|
|
|
this.$message({showClose: true, message: "请选择项目模板/产品模板", type: 'error' }); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
params.isTop="1" |
|
|
this.load.list = true; |
|
|
this.load.list = true; |
|
|
listXmProjectPhaseTemplate(params).then((res) => { |
|
|
|
|
|
|
|
|
listXmProjectPhase(params).then((res) => { |
|
|
var tips=res.data.tips; |
|
|
var tips=res.data.tips; |
|
|
if(tips.isOk){ |
|
|
if(tips.isOk){ |
|
|
this.pageInfo.total = res.data.total; |
|
|
this.pageInfo.total = res.data.total; |
|
|
this.pageInfo.count=false; |
|
|
this.pageInfo.count=false; |
|
|
this.xmProjectPhaseTemplates = res.data.data; |
|
|
|
|
|
|
|
|
this.xmProjectPhases = res.data.data; |
|
|
}else{ |
|
|
}else{ |
|
|
this.$message({showClose: true, message: tips.msg, type: 'error' }); |
|
|
this.$message({showClose: true, message: tips.msg, type: 'error' }); |
|
|
} |
|
|
} |
|
|
@ -216,7 +241,7 @@ |
|
|
afterAddSubmit(){ |
|
|
afterAddSubmit(){ |
|
|
this.addFormVisible=false; |
|
|
this.addFormVisible=false; |
|
|
this.pageInfo.count=true; |
|
|
this.pageInfo.count=true; |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
}, |
|
|
}, |
|
|
afterEditSubmit(){ |
|
|
afterEditSubmit(){ |
|
|
this.editFormVisible=false; |
|
|
this.editFormVisible=false; |
|
|
@ -225,115 +250,54 @@ |
|
|
selsChange: function (sels) { |
|
|
selsChange: function (sels) { |
|
|
this.sels = sels; |
|
|
this.sels = sels; |
|
|
}, |
|
|
}, |
|
|
//删除xmProjectPhaseTemplate |
|
|
|
|
|
handleDel: function (row,index) { |
|
|
|
|
|
this.$confirm('确认删除该记录吗?', '提示', { |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
this.load.del=true; |
|
|
|
|
|
let params = { id: row.id }; |
|
|
|
|
|
delXmProjectPhaseTemplate(params).then((res) => { |
|
|
|
|
|
this.load.del=false; |
|
|
|
|
|
var tips=res.data.tips; |
|
|
|
|
|
if(tips.isOk){ |
|
|
|
|
|
this.pageInfo.count=true; |
|
|
|
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
} |
|
|
|
|
|
this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' }); |
|
|
|
|
|
}).catch( err => this.load.del=false ); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
//批量删除xmProjectPhaseTemplate |
|
|
|
|
|
batchDel: function () { |
|
|
|
|
|
|
|
|
|
|
|
this.$confirm('确认删除选中记录吗?', '提示', { |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
this.load.del=true; |
|
|
|
|
|
batchDelXmProjectPhaseTemplate(this.sels).then((res) => { |
|
|
|
|
|
this.load.del=false; |
|
|
|
|
|
var tips=res.data.tips; |
|
|
|
|
|
if( tips.isOk ){ |
|
|
|
|
|
this.pageInfo.count=true; |
|
|
|
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
} |
|
|
|
|
|
this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error'}); |
|
|
|
|
|
}).catch( err => this.load.del=false ); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
rowClick: function(row, event, column){ |
|
|
rowClick: function(row, event, column){ |
|
|
this.$emit('row-click',row, event, column);// @row-click="rowClick" |
|
|
this.$emit('row-click',row, event, column);// @row-click="rowClick" |
|
|
}, |
|
|
}, |
|
|
/**begin 自定义函数请在下面加**/ |
|
|
/**begin 自定义函数请在下面加**/ |
|
|
selectedConfirm(){ |
|
|
selectedConfirm(){ |
|
|
this.$emit("selected-confirm",this.sels); |
|
|
this.$emit("selected-confirm",this.sels); |
|
|
}, |
|
|
|
|
|
translateDataToTree(data2) { |
|
|
|
|
|
var data=JSON.parse(JSON.stringify(data2)); |
|
|
|
|
|
let parents = data.filter(value =>{ |
|
|
|
|
|
//如果我的上级为空,则我是最上级 |
|
|
|
|
|
if(value.parentPhaseId == 'undefined' || value.parentPhaseId == null || value.parentPhaseId == ''){ |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//如果我的上级不在列表中,我作为最上级 |
|
|
|
|
|
}else if(data.some(i=>value.parentPhaseId==i.id)){ |
|
|
|
|
|
return false; |
|
|
|
|
|
}else { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
let children = data.filter(value =>{ |
|
|
|
|
|
if(data.some(i=>value.parentPhaseId==i.id)){ |
|
|
|
|
|
return true; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let translator = (parents, children) => { |
|
|
|
|
|
parents.forEach((parent) => { |
|
|
|
|
|
children.forEach((current, index) => { |
|
|
|
|
|
if (current.parentPhaseId === parent.id) { |
|
|
|
|
|
let temp = JSON.parse(JSON.stringify(children)) |
|
|
|
|
|
temp.splice(index, 1) |
|
|
|
|
|
translator([current], temp) |
|
|
|
|
|
typeof parent.children !== 'undefined' ? parent.children.push(current) : parent.children = [current] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
translator(parents, children) |
|
|
|
|
|
|
|
|
|
|
|
return parents |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
showProjectTemplate:function(){ |
|
|
showProjectTemplate:function(){ |
|
|
this.projectTemplateVisible=true; |
|
|
this.projectTemplateVisible=true; |
|
|
}, |
|
|
}, |
|
|
onProjectTemplateSelected:function(projectTemplate){ |
|
|
onProjectTemplateSelected:function(projectTemplate){ |
|
|
this.projectTemplateVisible=false; |
|
|
this.projectTemplateVisible=false; |
|
|
this.filters.projectTemplate=projectTemplate; |
|
|
|
|
|
|
|
|
this.filters.projectId=projectTemplate.id; |
|
|
|
|
|
this.filters.projectName=projectTemplate.name; |
|
|
this.$emit('selected-project-template',projectTemplate) |
|
|
this.$emit('selected-project-template',projectTemplate) |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
loadXmProjectPhaseLazy(tree, treeNode, resolve) { |
|
|
|
|
|
var params={parentPhaseId:tree.id} |
|
|
|
|
|
params=this.getParams(params); |
|
|
|
|
|
params.isTop="" |
|
|
|
|
|
this.load.list = true; |
|
|
|
|
|
var func=listXmProjectPhase |
|
|
|
|
|
func(params).then(res=>{ |
|
|
|
|
|
this.load.list = false |
|
|
|
|
|
var tips = res.data.tips; |
|
|
|
|
|
if(tips.isOk){ |
|
|
|
|
|
resolve(res.data.data) |
|
|
|
|
|
}else{ |
|
|
|
|
|
resolve([]) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch( err => this.load.list = false ); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
/**end 自定义函数请在上面加**/ |
|
|
/**end 自定义函数请在上面加**/ |
|
|
|
|
|
|
|
|
},//end methods |
|
|
},//end methods |
|
|
components: { |
|
|
|
|
|
'xm-project-phase-template-add':XmProjectPhaseTemplateAdd, |
|
|
|
|
|
'xm-project-phase-template-edit':XmProjectPhaseTemplateEdit, |
|
|
|
|
|
XmProjectTemplateList, |
|
|
|
|
|
|
|
|
|
|
|
//在下面添加其它组件 |
|
|
|
|
|
|
|
|
components: { |
|
|
|
|
|
XmProjectTemplateList, |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
if(this.selProjectTemplate){ |
|
|
if(this.selProjectTemplate){ |
|
|
this.filters.projectTemplate=this.selProjectTemplate |
|
|
this.filters.projectTemplate=this.selProjectTemplate |
|
|
} |
|
|
} |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.getXmProjectPhaseTemplates(); |
|
|
|
|
|
|
|
|
this.getXmProjectPhases(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|