Browse Source

优化

master
陈裕财 4 years ago
parent
commit
cd28d23aa9
  1. 8
      src/views/xm/core/xmProduct/XmProductTplMng.vue
  2. 28
      src/views/xm/core/xmProject/XmProjectTplMng.vue
  3. 32
      src/views/xm/core/xmTask/XmTaskMng.vue
  4. 160
      src/views/xm/core/xmTaskTemplate/XmTaskTemplateMng.vue

8
src/views/xm/core/xmProduct/XmProductTplMng.vue

@ -66,10 +66,12 @@
</el-table-column> </el-table-column>
<el-table-column prop="productName" label="产品模板(参考学习用)" sortable show-overflow-tooltip> <el-table-column prop="productName" label="产品模板(参考学习用)" sortable show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-link @click="intoInfo(scope.row)">{{scope.row.productName}}</el-link>
<div v-if="isSelect===true">{{scope.row.productName}}</div>
<el-link v-else @click="intoInfo(scope.row)">{{scope.row.productName}}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="80" fixed="right">
<el-table-column v-if="isSelect!==true" label="操作" width="80" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" title="通过复制创建新的项目" @click="onCopyToBtnClick(scope.row)" :disabled="load.add" v-loading="load.add">复制</el-button> <el-button type="text" title="通过复制创建新的项目" @click="onCopyToBtnClick(scope.row)" :disabled="load.add" v-loading="load.add">复制</el-button>
</template> </template>
@ -128,7 +130,7 @@
export default { export default {
props:['selProject','xmIteration','showType'],
props:['selProject','xmIteration','showType','isSelect'],
computed: { computed: {
...mapGetters([ ...mapGetters([
'userInfo','roles' 'userInfo','roles'

28
src/views/xm/core/xmProject/XmProjectTplMng.vue

@ -22,10 +22,11 @@
<el-table :height="maxTableHeight" ref="table" v-cloak stripe :data="ScreenData" @sort-change="sortChange" highlight-current-row v-loading="load.list" @selection-change="selsChange" @row-click="rowClick" style="width: 100%;"> <el-table :height="maxTableHeight" ref="table" v-cloak stripe :data="ScreenData" @sort-change="sortChange" highlight-current-row v-loading="load.list" @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column prop="name" label="项目模板(学习/参考)" min-width="200" > <el-table-column prop="name" label="项目模板(学习/参考)" min-width="200" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link @click.stop="intoInfo(scope.row)">{{scope.row.name}}</el-link>
<div v-if="isSelect===true">{{scope.row.name}}</div>
<el-link v-else @click.stop="intoInfo(scope.row)">{{scope.row.name}}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="" width="100" fixed="right">
<el-table-column label="" width="100" fixed="right" v-if="isSelect!==true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" title="通过复制创建新的项目" @click="onCopyToBtnClick(scope.row)" :disabled="load.add" v-loading="load.add">复制</el-button> <el-button type="text" title="通过复制创建新的项目" @click="onCopyToBtnClick(scope.row)" :disabled="load.add" v-loading="load.add">复制</el-button>
<el-button type="text" title="删除该模板" @click="handleDel(scope.row)" :disabled="load.del" v-loading="load.del">删除</el-button> <el-button type="text" title="删除该模板" @click="handleDel(scope.row)" :disabled="load.del" v-loading="load.del">删除</el-button>
@ -85,20 +86,14 @@
//import { listOption } from '@/api/mdp/meta/itemOption';// //import { listOption } from '@/api/mdp/meta/itemOption';//
import { listXmProject, editStatus, delXmProject, batchDelXmProject,copyTo,createProjectCode} from '@/api/xm/core/xmProject'; import { listXmProject, editStatus, delXmProject, batchDelXmProject,copyTo,createProjectCode} from '@/api/xm/core/xmProject';
import { addXmMyFocus , delXmMyFocus } from '@/api/xm/core/xmMyFocus'; import { addXmMyFocus , delXmMyFocus } from '@/api/xm/core/xmMyFocus';
import XmProjectEdit from './XmProjectEdit';//
import { mapGetters } from 'vuex'
import xmProjectInfo from './XmProjectInfo';
import { mapGetters } from 'vuex'
if(!Vue.component("xm-project-info")){
Vue.component('xm-project-info',xmProjectInfo)
Vue.use(xmProjectInfo);
}
export default { export default {
props:['dataScope','showType'],
props:['dataScope','showType','isSelect'],
computed: { computed: {
...mapGetters([ ...mapGetters([
'userInfo','roles' 'userInfo','roles'
@ -345,10 +340,9 @@
}).catch( err => this.load.del=false ); }).catch( err => this.load.del=false );
}); });
}, },
rowClick: function(row, event, column){
const that = this;
//that.intoInfo(row.id);
// this.$emit('row-click',row, event, column);// @row-click="rowClick"
rowClick: function(row, event, column){
this.editForm=row
this.$emit('row-click',row, event, column);// @row-click="rowClick"
}, },
onCopyToBtnClick(row){ onCopyToBtnClick(row){
this.xmProjectCopy.id=row.id; this.xmProjectCopy.id=row.id;
@ -566,9 +560,7 @@
/**end 自定义函数请在上面加**/ /**end 自定义函数请在上面加**/
},//end methods },//end methods
components: {
'xm-project-edit':XmProjectEdit,
//
components: {
}, },
mounted() { mounted() {
if(this.$route.params){ if(this.$route.params){

32
src/views/xm/core/xmTask/XmTaskMng.vue

@ -1856,21 +1856,23 @@ export default {
translator(parents, children); translator(parents, children);
taskTemplates2.forEach((i) => { taskTemplates2.forEach((i) => {
i.branchId = this.selProject.branchId;
i.projectId = this.selProject.id;
i.projectName = this.selProject.name;
if (this.projectPhase == null) {
i.phaseId = this.parentTask.phaseId;
i.projectPhaseName = this.parentTask.projectPhaseName;
i.sortLevel = i.sortLevel ? i.sortLevel : this.parentTask.sortLevel;
i.taskType = i.taskType ? i.taskType : this.parentTask.taskType;
i.taskClass = i.taskClass ? i.taskClass : this.parentTask.taskClass;
} else {
i.phaseId = this.projectPhase.id;
i.projectPhaseName = this.projectPhase.name;
i.sortLevel = i.sortLevel ? i.sortLevel : this.projectPhase.seqNo;
i.taskType = i.taskType ? i.taskType : this.projectPhase.taskType;
}
if(this.ptype==='1'){
i.branchId=this.xmProduct.branchId;
i.ptype="1"
i.projectId=null;
i.projectName=null;
i.productId=this.xmProduct.id
i.menuId=null;
i.menuName=null;
}else if(this.ptype==='0'){
i.branchId=this.filters.selProject.branchId;
i.ptype="0"
i.projectId=this.filters.selProject.id;
i.projectName=this.filters.selProject.name;
i.productId=null
i.menuId=null;
i.menuName=null;
}
i.budgetCost = 0; i.budgetCost = 0;
i.budgetWorkload = 80; i.budgetWorkload = 80;
i.level = i.level ? i.level : "3"; i.level = i.level ? i.level : "3";

160
src/views/xm/core/xmTaskTemplate/XmTaskTemplateMng.vue

@ -1,19 +1,28 @@
<template> <template>
<section class="page-container padding border">
<el-row>
<el-col :span="filters.projectTemplate&&filters.projectTemplate.id?6:0" >
<xm-phase-template-mng :sel-project-template="filters.projectTemplate" :simple="true" @row-click="projectPhaseTemplateRowClick" @selected-project-template="onSelectedProjectTemplate" ref="projectPhaseTemplate"></xm-phase-template-mng>
</el-col>
<el-col :span="filters.projectTemplate&&filters.projectTemplate.id?18:24">
<el-row>
<section class="page-container padding border">
<el-row>
<el-popover
placement="bottom"
width="400"
trigger="click">
<xm-project-tpl-mng :auto-select="true" :isSelect="true" showType="simple" @row-click="onProjectRowClick" @clear-select="onProjectClearSelect"></xm-project-tpl-mng>
<el-link type="warning" slot="reference" icon="el-icon-search"><font style="font-size:14px;">{{filters.project?filters.project.name:'选择项目模板'}}</font></el-link>
</el-popover>
<el-popover
placement="bottom"
width="400"
trigger="click">
<xm-product-tpl-mng :auto-select="true" :isSelect="true" showType="simple" @row-click="onProductRowClick" @clear-select="onProductClearSelect"></xm-product-tpl-mng>
<el-link type="warning" slot="reference" icon="el-icon-search"><font style="font-size:14px;">{{filters.product?filters.product.productName:'选择产品模板'}}</font></el-link>
</el-popover>
<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="searchXmTaskTemplates">查询</el-button> <el-button type="primary" v-loading="load.list" :disabled="load.list==true" v-on:click="searchXmTaskTemplates">查询</el-button>
<el-button v-if="!selProjectTemplate" @click="showProjectTemplate">选择模板</el-button>
<el-button v-if="isSelect" type="primary" @click="selectedConfirm">确认选择</el-button>
<el-button v-if="isSelect" type="primary" @click="selectConfirm">确认选择</el-button>
</el-row> </el-row>
<el-row class="page-main"> <el-row class="page-main">
<!--列表 XmTaskTemplate xm_task_template select-confirm--> <!--列表 XmTaskTemplate xm_task_template select-confirm-->
<el-table ref="table" :height="maxTableHeight" :data="xmTaskTemplatesTreeData" row-key="id" :tree-props="{children: 'children', hasChildren: 'childrenCnt'}" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table ref="table" lazy :load="loadXmTaskLazy" :height="maxTableHeight" :data="xmTaskTemplatesTreeData" row-key="id" :tree-props="{children: 'children', hasChildren: 'childrenCnt'}" @sort-change="sortChange" 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="name" label="任务名称" min-width="150" > <el-table-column prop="name" label="任务名称" min-width="150" >
<template slot-scope="scope"> <template slot-scope="scope">
@ -32,9 +41,7 @@
</el-table> </el-table>
</el-row> </el-row>
<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-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-col>
</el-row>
</section> </section>
</template> </template>
@ -43,9 +50,9 @@
import treeTool from '@/common/js/treeTool';// 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 { listXmTask } from '@/api/xm/core/xmTask';
import xmPhaseTemplateMng from '../xmPhaseTemplate/XmPhaseTemplateMng';
import { listXmTask } from '@/api/xm/core/xmTask';
import XmProductTplMng from '../xmProduct/XmProductTplMng'
import XmProjectTplMng from '../xmProject/XmProjectTplMng'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
@ -58,18 +65,15 @@
return treeTool.translateDataToTree(this.xmTaskTemplates,"parentTaskid","id"); return treeTool.translateDataToTree(this.xmTaskTemplates,"parentTaskid","id");
}, },
}, },
watch:{
selProjectTemplate:function(selProjectTemplate){
this.filters.projectTemplate=this.selProjectTemplate
this.getXmTaskTemplates();
}
watch:{
}, },
props:['selProjectTemplate','isSelect'],
props:['isSelect'],
data() { data() {
return { return {
filters: { filters: {
key: '', key: '',
projectTemplate:null,
project:null,
product:null,
}, },
xmTaskTemplates: [],// xmTaskTemplates: [],//
pageInfo:{// pageInfo:{//
@ -96,7 +100,6 @@
id:'',name:'',parentTaskid:'',parentTaskname:'',projectId:'',projectName:'',level:'',sortLevel:'',preTaskid:'',preTaskname:'',startTime:'',endTime:'',milestone:'',description:'',remarks:'',createUserid:'',createUsername:'',createTime:'',rate:'',budgetCost:'',budgetWorkload:'',taskState:'',taskType:'',taskClass:'',toTaskCenter:'',phaseId:'',projectPhaseName:'',taskSkillNames:'',taskSkillIds:'',taskOut:'',planType:'',settleSchemel:'',menuId:'',menuName:'' id:'',name:'',parentTaskid:'',parentTaskname:'',projectId:'',projectName:'',level:'',sortLevel:'',preTaskid:'',preTaskname:'',startTime:'',endTime:'',milestone:'',description:'',remarks:'',createUserid:'',createUsername:'',createTime:'',rate:'',budgetCost:'',budgetWorkload:'',taskState:'',taskType:'',taskClass:'',toTaskCenter:'',phaseId:'',projectPhaseName:'',taskSkillNames:'',taskSkillIds:'',taskOut:'',planType:'',settleSchemel:'',menuId:'',menuName:''
}, },
parentTaskTemplate:null, parentTaskTemplate:null,
projectPhaseTemplate:null,
maxTableHeight:300, maxTableHeight:300,
/**begin 自定义属性请在下面加 请加备注**/ /**begin 自定义属性请在下面加 请加备注**/
@ -144,23 +147,20 @@
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i]) orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
} }
params.orderBy= orderBys.join(",") params.orderBy= orderBys.join(",")
}
if(this.filters.project){
params.ptype="0"
params.projectId=this.filters.project.id
} }
if(this.projectPhaseTemplate){
params.phaseId=this.projectPhaseTemplate.id
}
if(this.filters.projectTemplate){
params.projectId=this.filters.projectTemplate.id
if(this.filters.product){
params.ptype="1"
params.productId=this.filters.product.id
} }
if(!params.projectId){
this.$notify({showClose: true, message: "选择一个模板项目", type: 'error' });
if(!params.productId && !params.projectId){
this.$notify({showClose: true, message: "选择一个模板", type: 'error' });
return; return;
}
if(!params.phaseId){
this.$notify({showClose: true, message: "请在左边计划列表中选择一个计划", type: 'error' });
return;
}
}
params.isTpl="1" params.isTpl="1"
this.load.list = true; this.load.list = true;
listXmTask(params).then((res) => { listXmTask(params).then((res) => {
@ -183,7 +183,7 @@
}, },
// XmTaskTemplate xm_task_template // XmTaskTemplate xm_task_template
showAdd: function () { showAdd: function () {
if(!this.filters.projectTemplate){
if(!this.filters.project){
this.$notify.error("请选择模板") this.$notify.error("请选择模板")
return; return;
} }
@ -212,71 +212,57 @@
//xmTaskTemplate //xmTaskTemplate
selsChange: function (sels) { selsChange: function (sels) {
this.sels = sels; this.sels = sels;
},
//xmTaskTemplate
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id: row.id };
delXmTask(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.count=true;
this.getXmTaskTemplates();
}
this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTaskTemplate
batchDel: function () {
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmTaskTemplate(this.sels).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.pageInfo.count=true;
this.getXmTaskTemplates();
}
this.$notify({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"
}, },
selectedConfirm(){
selectConfirm(){
this.$emit("select-confirm",this.sels) this.$emit("select-confirm",this.sels)
},
onProjectRowClick:function(project){
this.filters.project=project
this.filters.product=null;
this.getXmTaskTemplates();
}, },
projectPhaseTemplateRowClick:function(projectPhaseTemplate){
this.projectPhaseTemplate=projectPhaseTemplate
onProjectClearSelect(){
this.filters.project=null;
this.getXmTaskTemplates();
},
onProductRowClick:function(product){
this.filters.product=product
this.filters.project=null;
this.getXmTaskTemplates(); this.getXmTaskTemplates();
}, },
showProjectTemplate(){
this.$refs.projectPhaseTemplate.showProjectTemplate();
},
onSelectedProjectTemplate:function(projectTemplate){
this.filters.projectTemplate=projectTemplate
onProductClearSelect(){
this.filters.product=null;
this.getXmTaskTemplates(); this.getXmTaskTemplates();
}
},
loadXmTaskLazy(tree, treeNode, resolve) {
var params={parentTaskid:tree.id}
params.isTop=""
this.load.list = true;
var func=listXmTask
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: { components: {
xmPhaseTemplateMng,
XmProjectTplMng,XmProductTplMng,
// //
}, },
mounted() { mounted() {
if(this.selProjectTemplate){ if(this.selProjectTemplate){
this.filters.projectTemplate=this.selProjectTemplate
this.filters.project=this.selProjectTemplate
} }
this.$nextTick(() => { this.$nextTick(() => {

Loading…
Cancel
Save