Browse Source

优化

master
陈裕财 4 years ago
parent
commit
6075f5b375
  1. 384
      src/views/xm/core/xmIteration/XmIterationSelect.vue
  2. 2
      src/views/xm/core/xmIterationLink/XmIterationLinkForProduct.vue
  3. 2
      src/views/xm/core/xmIterationLink/XmIterationLinkForProject.vue
  4. 2
      src/views/xm/core/xmIterationMenu/XmIterationMenuMng.vue
  5. 6
      src/views/xm/core/xmMenu/XmMenuSelect.vue
  6. 4
      src/views/xm/core/xmProduct/XmProductMng.vue
  7. 11
      src/views/xm/core/xmQuestion/XmQuestionAdd.vue

384
src/views/xm/core/xmIteration/XmIterationSelect.vue

@ -1,384 +0,0 @@
<template>
<section>
<el-row>
<!--列表 XmIteration 迭代定义-->
<el-table ref="table" :height="maxTableHeight" :data="xmIterationTreeData" row-key="id" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="index" label="序号" ></el-table-column>
<el-table-column prop="iterationName" label="迭代名称" >
<template slot="header" slot-scope="scope">
迭代名称 <el-button type="text" @click="clearSelectIteration">清空所选</el-button> &nbsp;<el-button type="text" @click="close">关闭</el-button>
<el-popover v-if=" !menuId && !productId"
placement="top-start"
title=""
width="400"
trigger="hover" >
<el-row>
<el-col :span="24" style="padding-top:5px;">
<font class="more-label-font">
迭代查询范围
</font>
<el-select v-model="filters.queryScope" style="width:100%;" placeholder="迭代查询范围">
<el-option :label="userInfo.branchName+'机构下所有的迭代'" value="branchId"></el-option>
<el-option label="我相关的迭代" value="compete"></el-option>
<el-option label="按迭代编号精确查找" value="iterationId"></el-option>
<el-option label="后台智能匹配" value=""></el-option>
</el-select>
</el-col>
<el-col v-if="filters.queryScope=='iterationId'" :span="24" style="padding-top:5px;">
<el-input v-model="filters.id" style="width:100%;" placeholder="输入迭代编号" @keyup.enter.native="searchXmProducts">
</el-input>
</el-col>
<el-col v-if="filters.queryScope!='iterationId'" :span="24" style="padding-top:5px;">
<font class="more-label-font">上线时间:</font>
<el-date-picker
v-model="dateRangerOnline"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="完成日期"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00','23:59:59']"
:picker-options="pickerOptions"
></el-date-picker>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<font class="more-label-font">迭代名称:</font><el-input v-model="filters.key" style="width: 60%;" placeholder="模糊查询"></el-input>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<el-tag>默认只能查询本人创建的迭代本人作为需求责任人参与的迭代</el-tag>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<el-button type="primary" icon="el-icon-search" @click="getXmIterations">查询</el-button>
</el-col>
</el-row>
<el-button type="text" slot="reference" style="float:right;">更多条件</el-button>
</el-popover>
</template>
<template slot-scope="scope">
{{scope.row.iterationName}} <font :color="calcFinishRate(scope.row)==100?'green':'#FF8C00'">{{calcFinishRate(scope.row)}}%</font>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, prev, 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 { initSimpleDicts } from '@/api/mdp/meta/item';//
import { listXmIteration,listXmIterationWithState, delXmIteration, batchDelXmIteration,loadTasksToXmIterationState } from '@/api/xm/core/xmIteration';
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters([
'userInfo','roles'
]),
xmIterationTreeData(){
return this.translateDataToTree(this.xmIterations);
},
},
props:[ 'productId','menuId','visible','selProject','autoSelect'],
watch:{
visible:function(visible){
if(visible==true){
this.clearSelectIteration();
this.getXmIterations();
}
},
productId:function(){
this.getXmIterations();
}
},
data() {
const beginDate = new Date();
const endDate = new Date();
beginDate.setTime(beginDate.getTime() - 3600 * 1000 * 24 * 7 * 4 * 12 );
endDate.setTime(endDate.getTime() + 3600 * 1000 * 24 * 7 * 4 * 12 );
return {
filters: {
key: '',
queryScope:'',// iterationId\branchId\compete\''
id:'',//
},
pickerOptions: util.pickerOptions('datarange'),
dateRangerOnline: [
],//线
xmIterations: [],//
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:{
//sex:[],
},// params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
addFormVisible: false,//xmIteration
//xmIteration
addForm: {
id:'',branchId:'',iterationName:'',startTime:'',endTime:'',onlineTime:'',pid:'',adminUserid:'',adminUsername:'',ctime:'',budgetCost:'',budgetWorkload:'',distBudgetCost:'',distBudgetWorkload:'',actCost:'',actWorkload:'',actStaffNum:'',seqNo:'',
},
editFormVisible: false,//
//xmIteration
editForm: {
id:'',branchId:'',iterationName:'',startTime:'',endTime:'',onlineTime:'',pid:'',adminUserid:'',adminUsername:'',ctime:'',budgetCost:'',budgetWorkload:'',distBudgetCost:'',distBudgetWorkload:'',actCost:'',actWorkload:'',actStaffNum:'',seqNo:'',
},
editFormInit: {
id:'',branchId:'',iterationName:'',startTime:'',endTime:'',onlineTime:'',pid:'',adminUserid:'',adminUsername:'',ctime:'',budgetCost:'',budgetWorkload:'',distBudgetCost:'',distBudgetWorkload:'',actCost:'',actWorkload:'',actStaffNum:'',seqNo:'',
},
/**begin 自定义属性请在下面加 请加备注**/
valueChangeRows:[],
parentIteration:null,
iterationStateVisible:false,
gstcVisible:false,
maxTableHeight:300,
ganrrColumns: {
children: 'children',
name: 'iterationName',
id: 'id',
pid: 'pid',
startDate: 'startTime',
endDate: 'endTime',
}
/**end 自定义属性请在上面加 请加备注**/
}
},//end data
methods: {
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmIterations();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmIterations();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
if(obj.prop=='xxx'){
this.pageInfo.orderFields=['xxx'];
this.pageInfo.orderDirs=[dir];
}
this.getXmIterations();
},
searchXmIterations(){
this.pageInfo.count=true;
this.getXmIterations();
},
// XmIteration
getXmIterations() {
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.productId){
params.productId=this.productId
}
if(this.menuId){
params.menuId=this.menuId
}
if( !this.menuId && !this.productId ){
params.queryScope=this.filters.queryScope
if(this.filters.queryScope=='iterationId'){
if(!this.filters.id){
this.$notify({showClose: true, message:"您选择了按迭代编号精确查找模式,请输入迭代编号", type: 'error' });
return;
}
params.id=this.filters.id
}
if(this.filters.queryScope=="branchId"){
params.branchId=this.userInfo.branchId
}
}
if(this.selProject && this.selProject.id){
params.projectId=this.selProject.id
}
if(this.dateRangerOnline && this.dateRangerOnline.length==2){
params.onlineTimeStart=this.dateRangerOnline[0]
params.onlineTimeEnd=this.dateRangerOnline[1]
}
this.load.list = true;
listXmIterationWithState(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmIterations = res.data.data;
if(this.autoSelect===true&&this.xmIterations.length>0){
var row=this.xmIterations[0];
this.$refs.table.setCurrentRow(row);
this.rowClick(row);
}
}else{
this.$notify({showClose: true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
//xmIteration
selsChange: function (sels) {
this.sels = sels;
},
rowClick: function(row, event, column){
this.editForm=row
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
/**begin 自定义函数请在下面加**/
translateDataToTree(data2) {
var data=JSON.parse(JSON.stringify(data2));
let parents = data.filter(value =>{
//
if(value.pid == 'undefined' || value.pid == null || value.pid == ''){
return true;
//
}else if(data.some(i=>value.pid==i.id)){
return false;
}else {
return true
}
})
let children = data.filter(value =>{
if(data.some(i=>value.pid==i.id)){
return true;
}else{
return false;
}
})
let translator = (parents, children) => {
parents.forEach((parent) => {
children.forEach((current, index) => {
if (current.pid === 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
},
clearSelectIteration(){
this.editForm=this.editFormInit
this.$refs.table.setCurrentRow();
this.$emit('clear-select',null );// @row-click="rowClick"
},
fieldChange:function(row,fieldName){
if(this.valueChangeRows.some(i=>i.id==row.id)){
return;
}else{
this.valueChangeRows.push(row)
}
},
formatterDate(row,column,cellValue, index){
if(cellValue){
return cellValue.substr(0,10);
}else{
return cellValue;
}
},
/**end 自定义函数请在上面加**/
calcFinishRate(row){
if(row.finishRate){
return parseInt(row.finishRate);
}else{
return 0;
}
},
close(){
this.$emit("close")
},
loadTasksToXmIterationState(row){
this.load.edit=true;
loadTasksToXmIterationState({id:row.id}).then(res=>{
this.load.edit=false;
var tips =res.data.tips;
if(tips.isOk){
this.getXmIterations();
}
this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error'});
});
},
},//end methods
components: {
//
},
mounted() {
this.$nextTick(() => {
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el);
this.getXmIterations();
});
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.more-label-font{
text-align:center;
float:left;
padding-top:5px;
}
.font-class{
color: rgba(116, 85, 85, 0.493);
}
.align-right{
float: right;
}
</style>

2
src/views/xm/core/xmIterationLink/XmIterationLinkForProduct.vue

@ -46,7 +46,7 @@
import { mapGetters } from 'vuex'
import XmProductSelect from '@/views/xm/core/components/XmProductSelect.vue'
import XmIterationSelect from '../xmIteration/XmIterationSelect.vue';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';
import XmIterationAdd from '../xmIteration/XmIterationAdd';//

2
src/views/xm/core/xmIterationLink/XmIterationLinkForProject.vue

@ -47,7 +47,7 @@
import { mapGetters } from 'vuex'
import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect.vue'
;
import XmIterationSelect from '../xmIteration/XmIterationSelect.vue';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';
import XmIterationAdd from '../xmIteration/XmIterationAdd';//

2
src/views/xm/core/xmIterationMenu/XmIterationMenuMng.vue

@ -57,7 +57,7 @@
import config from '@/common/config';//
import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { listXmIterationMenu, delXmIterationMenu, batchDelXmIterationMenu,batchAddXmIterationMenu } from '@/api/xm/core/xmIterationMenu';
import XmIterationMng from '../xmIteration/XmIterationSelect';//
import XmIterationMng from '@/views/xm/core/components/XmIterationSelect';//
import { mapGetters } from 'vuex'
import xmMenuSelect from '../xmMenu/XmMenuSelect';

6
src/views/xm/core/xmMenu/XmMenuSelect.vue

@ -3,9 +3,9 @@
<el-row>
<el-col :span="24" style="padding-left:12px;" >
<el-row>
<xm-product-select v-if="!xmProduct&&!xmIteration" :auto-select="false" :link-project-id="selProject?selProject.id:null" @row-click="onProductSelected" ref="xmProductMng" :iteration-id="xmIteration?xmIteration.id:null" @clear-select="onProductClearSelect" @close="productVisible=false"></xm-product-select>
<xm-product-select style="display:inline;" v-if="!xmProduct&&!xmIteration" :auto-select="false" :link-project-id="selProject?selProject.id:null" @row-click="onProductSelected" ref="xmProductMng" :iteration-id="xmIteration?xmIteration.id:null" @clear-select="onProductClearSelect"></xm-product-select>
<xm-iteration-select v-if="!xmIteration" :auto-select="false" :link-project-id="selProject?selProject.id:null" @row-click="onIterationSelected" ref="xmIterationMng" :product-id="xmProduct?xmProduct.id:null" @clear-select="onIterationClearSelect" @close="iterationVisible=false"></xm-iteration-select>
<xm-iteration-select style="display:inline;" v-if="!xmIteration" :auto-select="false" :link-project-id="selProject?selProject.id:null" @row-click="onIterationSelected" ref="xmIterationMng" :product-id="xmProduct?xmProduct.id:null" @clear-select="onIterationClearSelect"></xm-iteration-select>
<el-select v-model="filters.taskFilterType" placeholder="已分配任务的需求?" clearable v-if="taskFilterType">
<el-option value="not-join-any-project" label="未分配过任务的需求"></el-option>
@ -197,7 +197,7 @@
import TagMng from "@/views/mdp/arc/tag/TagMng";
import XmIterationSelect from '../xmIteration/XmIterationSelect';//
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//
import {sn} from '@/common/js/sequence'
import { mapGetters } from 'vuex'

4
src/views/xm/core/xmProduct/XmProductMng.vue

@ -305,11 +305,11 @@
import XmProductEdit from './XmProductEdit';//
import XmProductTplMng from './XmProductTplMng';//
import { mapGetters } from 'vuex'
import XmIterationMng from '../xmIteration/XmIterationSelect';//
import XmIterationMng from '@/views/xm/core/components/XmIterationSelect';//
import XmProductStateMng from '../xmProductState/XmProductStateMng';//
import UsersSelect from "@/views/mdp/sys/user/UsersSelect";
import XmIterationSelect from '../xmIteration/XmIterationSelect.vue';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';
import XmProductSelect from '@/views/xm/core/components/XmProductSelect.vue';
import Guider from '@/components/Guider/Index.js';

11
src/views/xm/core/xmQuestion/XmQuestionAdd.vue

@ -12,17 +12,16 @@
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
<el-form-item label="缺陷标题" prop="name">
<el-input v-model="addForm.name" placeholder="缺陷标题" ></el-input>
<br><el-tooltip content="隶属需求">
<el-tag closable @click="showSelectMenu" @close.stop="handleCloseMenuTag">
<el-tag title="隶属需求" closable @click="showSelectMenu" @close.stop="handleCloseMenuTag">
<div class="icon" :style="{backgroundColor: 'rgb(79, 140, 255)' }">
<i :class=" 'el-icon-document' " ></i>
</div> {{addForm.menuName?addForm.menuName:"未关联需求"}}</el-tag></el-tooltip>
</div> {{addForm.menuName?addForm.menuName:"未关联需求"}}</el-tag>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="归属项目" prop="projectId">
<font v-if="filters.selProject">{{this.filters.selProject?this.filters.selProject.name:''}}</font>
<xm-project-select v-if="!selProject" @row-click="onPorjectConfirm"></xm-project-select>
<xm-project-select ref="xmProjectSelect" v-if="!selProject" @row-click="onPorjectConfirm"></xm-project-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -131,7 +130,7 @@
</el-drawer>
<el-drawer append-to-body title="需求选择" :visible.sync="selectMenuVisible" size="70%" :close-on-click-modal="false">
<xm-menu-select :is-select-menu="true" @selected="onSelectedMenu" :sel-project="filters.selProject"></xm-menu-select>
<xm-menu-select :is-select-menu="true" checkScope="0" @selected="onSelectedMenu" :sel-project="filters.selProject"></xm-menu-select>
</el-drawer>
</el-row>
<el-row>
@ -233,6 +232,7 @@
opStepEditorVisible:false,
expectResultEditorVisible:false,
descriptionEditorVisible:false,
xmProductVersions:[{id:"1.0.0" ,name:'1.0.0'}],
/**end 在上面加自定义属性**/
}//end return
@ -372,6 +372,7 @@
showSelectMenu:function(){
if(this.filters.selProject==null){
this.$notify({showClose: true, message: "请先选项目", type: 'error' });
this.$refs.xmProjectSelect.projectVisible=true;
return ;
}
this.selectMenuVisible=true;

Loading…
Cancel
Save