@ -1,13 +1,7 @@
< template >
< template >
< section >
< section >
< el -row >
< el -row >
< el -col v-show ="!batchEditVisible&& !filters.product" :span="24" class="app-container" >
< xm -product -mng :sel-project ="selProject" @row-click ="onProductSelected" ref = "xmProductMng" :simple ="true" > < / x m - p r o d u c t - m n g >
< / e l - c o l >
< el -col v -show = " filters.product " :span ="24" >
< el -row class = "app-container" >
< el -row class = "app-container" v-if =" !batchEditVisible" >
< el -row >
< el -select v -model = " filters.taskFilterType " placeholder = "是否分配了任务?" clearable >
< el -select v -model = " filters.taskFilterType " placeholder = "是否分配了任务?" clearable >
< el -option value = "not-join" label = "未分配任何任务的故事" > < / e l - o p t i o n >
< el -option value = "not-join" label = "未分配任何任务的故事" > < / e l - o p t i o n >
< el -option value = "join" label = "已分配任务的故事" > < / e l - o p t i o n >
< el -option value = "join" label = "已分配任务的故事" > < / e l - o p t i o n >
@ -32,15 +26,9 @@
< / e l - i n p u t >
< / e l - i n p u t >
< el -button v-if =" batchEditVisible==false " type="primary" @click="showAdd" icon="el-icon-plus" > 故事 < / el -button >
< el -button v-if =" batchEditVisible==false" @click="toBatchEdit" icon="el-icon-edit" > 修改 < / el -button >
< el -button v-if =" batchEditVisible==true " type="warning" @click="batchSaveMenu" icon="el-icon-finished" > 保存 < / el -button >
< el -button v-if =" batchEditVisible==true" type="success" @click="handlePopover(null,'add')" icon="el-icon-plus" > 故事 < / el -button >
< el -button v-if =" batchEditVisible==true " @click="noBatchEdit" icon="el-icon-back" > 返回 < / el -button >
< el -button v-if =" batchEditVisible==false && filters.product " @click="toSelectProduct" icon="el-icon-back" > 返回 < / el -button >
< el -button v-if =" batchEditVisible==true " type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" > 批量删除 < / el -button >
< el -button type = "primary" @click ="showAdd" icon = "el-icon-plus" > 故事 < / e l - b u t t o n >
< el -button @click ="toBatchEdit" icon = "el-icon-edit" > 修改 < / e l - b u t t o n >
< el -button @click ="toSelectProduct" icon = "el-icon-back" > 产品 < / e l - b u t t o n >
< el -popover
< el -popover
placement = "top-start"
placement = "top-start"
title = ""
title = ""
@ -101,120 +89,72 @@
< / e l - p o p o v e r >
< / e l - p o p o v e r >
< / e l - r o w >
< / e l - r o w >
< el -row ref = "table" >
< el -row v-show ="batchEditVisible" class="app-container" >
< el -table ref = "table1" :max-height ="tableHeight" :data ="xmMenusTreeData" class = "drag-table" default -expand -all row -key = " menuId " : 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 sortable type = "selection" width = "45" > < / e l - t a b l e - c o l u m n >
< el -table -column sortable prop = "seqNo" label = "序号" min -width = " 100 " >
< template slot -scope = " scope " >
< div style = "display:flex;width:100%;" >
< el -popover
placement = "top"
width = "400"
trigger = "click" >
< div style = "text-align: center; margin: 0" >
< div :ref ="'menu_'+scope.$index" :data-menu-id ="scope.row.menuId" > < / div >
< el -button type = "primary" size = "mini" @click ="handlePopover(scope.row,'highestPmenuId')" > 成为顶级节点 < / el -button >
< el -button type = "danger" size = "mini" @click ="handlePopover(scope.row,'delete')" > 删除当前行 < / el -button >
< el -button type = "success" size = "mini" @click ="handlePopover(scope.row,'addSub')" > 增加子行 < / el -button >
< / div >
< el -button slot = "reference" :type ="scope.row.opType?'success':'plain'" size = "mini" icon = "el-icon-more" circle > < / e l - b u t t o n >
< / e l - p o p o v e r >
< el -input style = "width:100%;" v-model ="scope.row.seqNo" @change="fieldChange(scope.row,'seqNo')" > < / el -input >
< el -row style = "padding-top:12px;" >
< el -table ref = "table" :max-height ="tableHeight" :data ="xmMenusTreeData" default -expand -all row -key = " menuId " : tree -props = " { children : ' children ' , hasChildren : ' hasChildren ' } " @sort-change ="sortChange" highlight -current -row v-loading ="load.list" border @selection-change="selsChange" @row-click="rowClick" >
< el -table -column sortable type = "selection" width = "40" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "menuName" label = "故事名称" min -width = " 160 " show -overflow -tooltip >
< template slot -scope = " scope " >
< span > { { scope . row . seqNo } } & nbsp ; & nbsp ; < el -link type = "primary" @click ="showMenuExchange(scope.row)" > {{ scope.row.menuName }} < / el -link > < / span >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "mmUsername" label = "负责人" min -width = " 80 " show -overflow -tooltip >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "finishRate" label = "总体进度" width = "100" >
< template slot -scope = " scope " >
{ { scope . row . finishRate } } %
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "remark" label = "描述" min -width = " 120 " show -overflow -tooltip >
< template slot -scope = " scope " >
< el -popover
v - if = "scope.row.remark && scope.row.remark.length>20"
placement = "top-start"
title = "故事备注"
width = "400"
trigger = "click" >
< div v-html ="scope.row.remark" >
< / div >
< / div >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "menuName" label = "故事名称" min -width = " 140 " >
< template slot -scope = " scope " >
< el -input v-model ="scope.row.menuName" @change="fieldChange(scope.row,'menuName')" > < / el -input >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "mmUsername" label = "负责人" min -width = " 100 " >
< template slot -scope = " scope " >
< el -tag v-if ="scope.row.mmUserid" closable @close="clearPmUser(scope.row)" > {{ scope.row.mmUsername }} < / el -tag >
< el -tag v-else > 未配置 < / el -tag >
< el -button @click ="selectUser(scope.row)" > 选人 < / el -button >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "remark" label = "描述" min -width = " 140 " >
< template slot -scope = " scope " >
< el -input v-model ="scope.row.remark" type="textarea" @change="fieldChange(scope.row,'remark')" > < / el -input >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< 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;" > < / e l - p a g i n a t i o n >
< / e l - r o w >
< el -row v-show ="!batchEditVisible" class="app-container" >
< el -table ref = "table2" :max-height ="tableHeight" :data ="xmMenusTreeData" default -expand -all row -key = " menuId " : 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 sortable type = "selection" width = "40" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "menuName" label = "故事名称" min -width = " 140 " >
< template slot -scope = " scope " >
{ { scope . row . seqNo } } & nbsp ; & nbsp ; < el -link type = "primary" @click ="showMenuExchange(scope.row)" > {{ scope.row.menuName }} < / el -link >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "mmUsername" label = "负责人" min -width = " 80 " >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "finishRate" label = "总体进度" width = "100" >
< template slot -scope = " scope " >
{ { scope . row . finishRate } } %
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "remark" label = "描述" min -width = " 140 " >
< template slot -scope = " scope " >
< el -popover
v - if = "scope.row.remark && scope.row.remark.length>20"
< div slot = "reference" > { { scope . row . remark ? scope . row . remark . substr ( 0 , 18 ) + "..." : "" } } < / div >
< / e l - p o p o v e r >
< div v -else v-html ="scope.row.remark" >
< / div >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "操作" width = "200" fixed = "right" >
< template slot -scope = " scope " >
< el -button type = "primary" @ click = "showSubAdd( scope.row,scope.$index)" icon = "el-icon-plus" circle > < / e l - b u t t o n >
< el -button @click ="showEdit(scope.row)" icon = "el-icon-edit" circle > < / e l - b u t t o n >
< el -popover style = "padding-left:10px;"
v - if = "isPmUser"
placement = "top-start"
placement = "top-start"
title = "故事备注"
width = "400"
width = "200"
trigger = "click" >
trigger = "click" >
< div v-html ="scope.row.remark" >
< / div >
< div slot = "reference" > { { scope . row . remark ? scope . row . remark . substr ( 0 , 18 ) + "..." : "" } } < / div >
< el -row >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "success" @click ="showImportFromMenuTemplate(scope.row)" icon = "el-icon-upload2" > 由模板快速导入 < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "danger" @click ="handleDel(scope.row)" icon = "el-icon-delete" circle > < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button v-if ="!selProject" type="primary" @click="showTaskListForMenu(scope.row,scope.$index)" icon="el-icon-s-operation" > 查看任务 < / el -button >
< el -button v-if ="selProject" type="primary" @click="showTasks(scope.row,scope.$index)" icon="el-icon-s-operation" > 查看任务 < / el -button >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "primary" @click ="toIterationList(scope.row,scope.$index)" icon = "el-icon-document-copy" > 查看迭代计划 < / e l - b u t t o n >
< / e l - c o l >
< / e l - r o w >
< el -button slot = "reference" icon = "el-icon-more" circle > < / e l - b u t t o n >
< / e l - p o p o v e r >
< / e l - p o p o v e r >
< div v -else v-html ="scope.row.remark" >
< / div >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "操作" width = "200" fixed = "right" >
< template slot -scope = " scope " >
< el -button type = "primary" @ click = "showSubAdd( scope.row,scope.$index)" icon = "el-icon-plus" circle > < / e l - b u t t o n >
< el -button @click ="showEdit(scope.row)" icon = "el-icon-edit" circle > < / e l - b u t t o n >
< el -popover style = "padding-left:10px;"
v - if = "isPmUser"
placement = "top-start"
width = "200"
trigger = "click" >
< el -row >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "success" @click ="showImportFromMenuTemplate(scope.row)" icon = "el-icon-upload2" > 由模板快速导入 < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "danger" @click ="handleDel(scope.row)" icon = "el-icon-delete" circle > < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button v-if ="!selProject" type="primary" @click="showTaskListForMenu(scope.row,scope.$index)" icon="el-icon-s-operation" > 查看任务 < / el -button >
< el -button v-if ="selProject" type="primary" @click="showTasks(scope.row,scope.$index)" icon="el-icon-s-operation" > 查看任务 < / el -button >
< / e l - c o l >
< el -col :span ="24" style = "padding-top:5px;" >
< el -button type = "primary" @click ="toIterationList(scope.row,scope.$index)" icon = "el-icon-document-copy" > 查看迭代计划 < / e l - b u t t o n >
< / e l - c o l >
< / e l - r o w >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< 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;" > < / e l - p a g i n a t i o n >
< el -button slot = "reference" icon = "el-icon-more" circle > < / e l - b u t t o n >
< / e l - p o p o v e r >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< 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;" > < / e l - p a g i n a t i o n >
< / e l - r o w >
< / e l - r o w >
< / e l - r o w >
< / e l - c o l >
<!-- 编辑 XmMenu xm_project_menu界面 -- >
<!-- 编辑 XmMenu xm_project_menu界面 -- >
< el -dialog title = "编辑故事" :visible.sync ="editFormVisible" width = "50%" append -to -body :close-on-click-modal ="false" >
< el -dialog title = "编辑故事" :visible.sync ="editFormVisible" width = "50%" append -to -body :close-on-click-modal ="false" >
< xm -menu -edit :xm-menu ="editForm" :visible ="editFormVisible" @cancel ="editFormVisible=false" @submit ="afterEditSubmit" > < / xm -menu -edit >
< xm -menu -edit :xm-menu ="editForm" :visible ="editFormVisible" @cancel ="editFormVisible=false" @submit ="afterEditSubmit" > < / xm -menu -edit >
@ -232,6 +172,9 @@
< xm -menu -rich -detail :visible ="menuDetailVisible" :reload ="false" :xm-menu ="editForm" > < / x m - m e n u - r i c h - d e t a i l >
< xm -menu -rich -detail :visible ="menuDetailVisible" :reload ="false" :xm-menu ="editForm" > < / x m - m e n u - r i c h - d e t a i l >
< / e l - d i a l o g >
< / e l - d i a l o g >
< el -dialog title = "选择产品" :visible.sync ="productVisible" width = "60%" append -to -body :close-on-click-modal ="false" >
< xm -product -mng :sel-project ="selProject" @row-click ="onProductSelected" ref = "xmProductMng" :simple ="true" > < / x m - p r o d u c t - m n g >
< / e l - d i a l o g >
< el -dialog title = "选中任务" :visible.sync ="selectTaskVisible" width = "80%" append -to -body :close-on-click-modal ="false" >
< el -dialog title = "选中任务" :visible.sync ="selectTaskVisible" width = "80%" append -to -body :close-on-click-modal ="false" >
< xm -task -list :sel-project ="selProject" :is-multi-select ="true" @tasks-selected ="onSelectedTasks" > < / x m - t a s k - l i s t >
< xm -task -list :sel-project ="selProject" :is-multi-select ="true" @tasks-selected ="onSelectedTasks" > < / x m - t a s k - l i s t >
< / e l - d i a l o g >
< / e l - d i a l o g >
@ -259,7 +202,10 @@
< el -dialog title = "选择员工" :visible.sync ="userSelectVisible" width = "60%" append -to -body >
< el -dialog title = "选择员工" :visible.sync ="userSelectVisible" width = "60%" append -to -body >
< users -select @confirm ="onUserSelected" ref = "usersSelect" > < / u s e r s - s e l e c t >
< users -select @confirm ="onUserSelected" ref = "usersSelect" > < / u s e r s - s e l e c t >
< / e l - d i a l o g >
< / e l - d i a l o g >
< / e l - r o w >
< / e l - r o w >
< el -row v-if ="batchEditVisible && filters.product" :span ="24" >
< xm -menu -mng -batch @ no -batch -edit = noBatchEdit :product ="filters.product" > < / x m - m e n u - m n g - b a t c h >
< / e l - r o w >
< / e l - r o w >
< / section >
< / section >
< / template >
< / template >
@ -275,6 +221,7 @@
import XmMenuAdd from './XmMenuAdd' ; / / 新 增 界 面
import XmMenuAdd from './XmMenuAdd' ; / / 新 增 界 面
import XmMenuEdit from './XmMenuEdit' ; / / 修 改 界 面
import XmMenuEdit from './XmMenuEdit' ; / / 修 改 界 面
import XmMenuMngBatch from './XmMenuMngBatch' ; / / 修 改 界 面
import XmProductMng from '../xmProduct/XmProductSelect' ; / / 新 增 界 面
import XmProductMng from '../xmProduct/XmProductSelect' ; / / 新 增 界 面
import XmMenuTemplateMng from '../xmMenuTemplate/XmMenuTemplateMng' ; / / 新 增 界 面
import XmMenuTemplateMng from '../xmMenuTemplate/XmMenuTemplateMng' ; / / 新 增 界 面
import XmMenuRichDetail from './XmMenuRichDetail' ;
import XmMenuRichDetail from './XmMenuRichDetail' ;
@ -308,9 +255,6 @@
}
}
const xmMenusTreeData = this . translateDataToTree ( xmMenus ) ;
const xmMenusTreeData = this . translateDataToTree ( xmMenus ) ;
if ( this . batchEditVisible ) {
this . rowDrop ( ) ;
}
return xmMenusTreeData ;
return xmMenusTreeData ;
} ,
} ,
@ -324,6 +268,11 @@
}
}
} ,
} ,
watch : {
watch : {
'filters.product' ( product ) {
if ( product == null ) {
this . productVisible = true ;
}
}
} ,
} ,
data ( ) {
data ( ) {
const beginDate = new Date ( ) ;
const beginDate = new Date ( ) ;
@ -378,6 +327,7 @@
util . formatDate . format ( endDate , "yyyy-MM-dd" )
util . formatDate . format ( endDate , "yyyy-MM-dd" )
] ,
] ,
pickerOptions : util . pickerOptions ( 'datarange' ) ,
pickerOptions : util . pickerOptions ( 'datarange' ) ,
productVisible : false ,
/**begin 自定义属性请在下面加 请加备注**/
/**begin 自定义属性请在下面加 请加备注**/
/**end 自定义属性请在上面加 请加备注**/
/**end 自定义属性请在上面加 请加备注**/
@ -518,6 +468,7 @@
} ,
} ,
onProductSelected : function ( product ) {
onProductSelected : function ( product ) {
this . filters . product = product
this . filters . product = product
this . productVisible = false ;
this . getXmMenus ( )
this . getXmMenus ( )
} ,
} ,
/ / 删 除 x m M e n u
/ / 删 除 x m M e n u
@ -567,159 +518,6 @@
rowClick : function ( row , event , column ) {
rowClick : function ( row , event , column ) {
this . $emit ( 'row-click' , row , event , column ) ; / / @ r o w - c l i c k = " r o w C l i c k "
this . $emit ( 'row-click' , row , event , column ) ; / / @ r o w - c l i c k = " r o w C l i c k "
} ,
/ / 行 拖 拽
rowDrop ( ) {
const _this = this
/ / 被 拖 动 的 元 素 的 索 引
let dragged = null ;
/ / 被 拖 动 的 元 素 的 索 引
let draggedIndex = - 1 ;
/ / 目 标 元 素
let target = document . querySelector ( '.drag-table .el-table__body-wrapper .el-table__body tbody' ) ;
console . log ( 'rowDrop--target==' , target ) ;
let rows = 0 ; / / 行 数
setTimeout ( function ( ) {
rows = target . childElementCount
console . log ( 'rowDrop--rows==' , rows ) ;
for ( let i = 0 ; i < target . childElementCount ; i ++ ) {
const child = target . children [ i ]
child . draggable = true
/ / c h i l d . s t y l e . c u r s o r = ' c o p y '
child . ondragstart = function ( e ) {
console . log ( '开始--ondragstart--e==' , e ) ;
dragged = e . path [ 0 ]
draggedIndex = e . path [ 0 ] . rowIndex
console . log ( 'child' + i + '开始拖拽' + draggedIndex ) ;
_this . cellMouseIndex = - 1
dragged . style . cursor = 'grabbing'
}
child . ondragend = function ( ) {
console . log ( 'child' + i + '拖拽结束' ) ;
}
}
} , 0 )
/ / 被 拖 动 的 元 素 正 在 那 个 容 器 里
let dragIndex = - 1
target . ondragenter = function ( e ) {
clearTimeout ( loop )
/ / 由 于 被 拖 动 的 元 素 经 过 t b o d y 中 的 每 一 元 素 都 会 触 发 该 事 件 , 但 是 我 们 只 需 要 它 正 在 那 一 行 上 就 行 了
if ( e . path [ 0 ] . nodeName === 'TD' ) {
/ / t h r o u g h R o w 表 示 被 拖 动 的 元 素 正 在 哪 一 行 上
const throughRow = e . path . find ( path => {
if ( path . className . split ( ' ' ) . includes ( 'el-table__row' ) ) {
return path
}
} )
if ( dragIndex !== throughRow . rowIndex ) {
if ( dragIndex > - 1 ) {
/ / 清 除 上 次 进 入 的 容 器 的 状 态
const last = target . children [ dragIndex ] ;
clearClass ( last )
}
/ / c o n s o l e . l o g ( ' 拖 动 进 入 目 标 元 素 ' + s e l e c t R o w . r o w I n d e x ) ;
/ / 不 是 自 己 或 未 文 件 夹 时 才 改 变 状 态
if ( draggedIndex !== throughRow . rowIndex ) {
/ / 改 变 本 次 进 入 的 容 器 的 状 态
dragged . style . cursor = 'copy'
throughRow . style . height = 60 + 'px'
throughRow . style . backgroundColor = '#e9fdcf'
}
dragIndex = throughRow . rowIndex
}
}
leaveIndex = - 1
}
target . ondragover = function ( e ) {
/ / c o n s o l e . l o g ( ' 目 标 元 素 中 拖 拽 . . . ' ) ;
e . preventDefault ( ) ;
leaveIndex = - 1
}
let loop = null
let leaveIndex = - 1 / / 是 否 拖 出 了 整 个 t a b l e , - 1 表 示 还 在 t a b l e 内
target . ondragleave = function ( e ) {
console . log ( 'ondragleave--e==' , e ) ;
clearTimeout ( loop )
if ( e . path [ 0 ] . nodeName ) {
const throughRow = e . path . find ( path => {
if ( path . className . split ( ' ' ) . includes ( 'el-table__row' ) ) {
return path ;
}
} )
if ( throughRow && dragIndex !== throughRow . rowIndex ) {
/ / c o n s o l e . l o g ( ' 拖 动 离 开 目 标 元 素 ' + s e l e c t R o w . r o w I n d e x ) ;
/ / s e l e c t R o w . s t y l e . h e i g h t = ' u n s e t '
/ / s e l e c t R o w . s t y l e . b a c k g r o u n d C o l o r = ' # f f f '
/ / d r a g I n d e x = s e l e c t R o w . r o w I n d e x
}
if ( throughRow . rowIndex === 0 || throughRow . rowIndex === rows - 1 ) {
/ / 离 开 第 一 行 或 最 后 一 行
leaveIndex = throughRow . rowIndex
loop = setTimeout ( function ( ) {
if ( leaveIndex > - 1 ) {
console . log ( "离开了" , leaveIndex )
const leave = target . children [ leaveIndex ] ;
clearClass ( leave )
dragIndex = - 1
}
} , 100 )
} ` `
}
}
target . ondrop = function ( ) {
console . log ( 'ondrop--放下了' + draggedIndex ) ;
/ / 清 除 上 次 进 入 的 容 器 的 状 态
const last = target . children [ dragIndex ] ;
clearClass ( last )
dragged . style . cursor = 'default'
console . log ( 'ondrop--draggedIndex==' , draggedIndex ) ;
console . log ( 'ondrop--dragIndex==' , dragIndex ) ;
const form = _this . xmMenusTreeData [ draggedIndex ] ;
const to = _this . xmMenusTreeData [ dragIndex ] ;
const startId = _this . $refs [ 'menu_' + draggedIndex ] . dataset . menuId ; ;
const endId = _this . $refs [ 'menu_' + dragIndex ] . dataset . menuId ;
if ( startId !== endId ) {
_this . changePmenuId ( startId , endId )
}
}
let clearClass = function ( node ) {
if ( node ) {
node . style . height = 'unset'
node . style . backgroundColor = '#fff'
}
dragged . style . cursor = 'grabbing'
}
/ / i f ( l a s t & & f o r m . m e n u I d ! = = t o . m e n u I d & & t o . i s F o l d e r ) {
/ / / / 移 动 文 件 / 文 件 夹
/ / _ t h i s . c o p y O r M o v e A p i ( ' m o v e ' , f o r m . m e n u I d , t o . m e n u I d )
/ / }
} ,
/ / 判 断 前 后 两 个 数 据 是 否 存 在 同 一 回 路 里 面
/ / d i c t 为 字 典 ; s I d 拖 拽 到 m e n u I d ; e P m e u I d 是 放 置 位 置 的 祖 先 m e n u I d ;
judgePmenuId ( dict , sId , ePmeuId ) {
if ( sId === ePmeuId ) {
return true ;
} else if ( dict [ ePmeuId ] ) {
return this . judgePmenuId ( dict , sId , dict [ ePmeuId ] ) ;
} else {
return false ;
}
} ,
} ,
handleExport ( ) {
handleExport ( ) {
this . downloadLoading = true
this . downloadLoading = true
@ -758,35 +556,7 @@
} )
} )
return dataList ;
return dataList ;
} ,
} ,
changePmenuId ( sId , eId ) {
let dict = { } ;
this . xmMenus . forEach ( d => {
dict [ d . menuId ] = d . pmenuId || '' ;
} ) ;
if ( ! dict [ eId ] ) {
this . xmMenus . find ( d => {
if ( d . menuId === sId ) {
d . pmenuId = eId ;
console . log ( '更新关系1' ) ;
this . fieldChange ( d , 'pmenuId' , true ) ;
}
} )
} else {
const isSynezesis = this . judgePmenuId ( dict , sId , dict [ eId ] ) ;
if ( ! isSynezesis ) {
this . xmMenus . find ( d => {
if ( d . menuId === sId ) {
d . pmenuId = eId ;
console . log ( '更新关系2' ) ;
this . fieldChange ( d , 'pmenuId' , true ) ;
}
} )
} else {
console . log ( '形成闭合回路--拖拽不更新' ) ;
}
}
} ,
/**begin 自定义函数请在下面加**/
/**begin 自定义函数请在下面加**/
translateDataToTree ( data2 ) {
translateDataToTree ( data2 ) {
@ -918,66 +688,14 @@
this . $message ( { message : "只有产品经理、产品组长能够修改故事" , type : 'error' } ) ;
this . $message ( { message : "只有产品经理、产品组长能够修改故事" , type : 'error' } ) ;
return false ;
return false ;
}
}
this . valueChangeRows = [ ] ;
this . batchEditVisible = true ;
this . batchEditVisible = true ;
} ,
} ,
noBatchEdit ( ) {
noBatchEdit ( ) {
this . batchEditVisible = false ;
this . batchEditVisible = false ;
if ( this . valueChangeRows . length > 0 ) {
this . getXmMenus ( ) ;
}
this . valueChangeRows = [ ] ;
} ,
batchSaveMenu ( ) {
if ( ! this . roles . some ( i => i . roleid == 'productAdmin' ) && ! this . roles . some ( i => i . roleid == 'productTeamAdmin' ) ) {
this . $message ( { message : "只有产品经理、产品组长能够修改故事" , type : 'error' } ) ;
return false ;
}
if ( this . valueChangeRows . length == 0 ) {
this . $message . success ( "没有数据被修改" ) ;
return
}
batchEditXmMenu ( this . valueChangeRows ) . then ( res => {
var tips = res . data . tips ;
if ( tips . isOk ) {
this . valueChangeRows = [ ]
this . getXmMenus ( )
}
this . $message ( { message : tips . msg , type : tips . isOk ? 'success' : 'error' } ) ;
} ) ;
this . getXmMenus ( ) ;
} ,
} ,
fieldChange : function ( row , fieldName , nextReplace ) {
console . log ( 'fieldChange--row==' , row ) ;
if ( nextReplace ) {
row . nextReplace = nextReplace
}
if ( row . opType ) {
var index = this . valueChangeRows . findIndex ( i => i . menuId == row . menuId ) ;
if ( index >= 0 ) {
this . valueChangeRows . splice ( index , 1 ) ;
this . valueChangeRows . push ( row )
} else {
this . valueChangeRows . push ( row )
}
} else {
var oneRow = this . valueChangeRows . find ( i => i . menuId == row . menuId ) ;
if ( oneRow ) {
if ( oneRow . nextReplace ) {
var index = this . valueChangeRows . findIndex ( i => i . menuId == row . menuId ) ;
this . valueChangeRows . splice ( index , 1 ) ;
this . valueChangeRows . push ( row )
} else {
return ;
}
} else {
this . valueChangeRows . push ( row )
}
}
} ,
showTaskList ( row ) {
showTaskList ( row ) {
if ( ! this . roles . some ( i => i . roleid == 'productAdmin' ) && ! this . roles . some ( i => i . roleid == 'productTeamAdmin' ) ) {
if ( ! this . roles . some ( i => i . roleid == 'productAdmin' ) && ! this . roles . some ( i => i . roleid == 'productTeamAdmin' ) ) {
@ -1033,57 +751,7 @@
this . editForm = row
this . editForm = row
this . taskListForMenuVisible = true
this . taskListForMenuVisible = true
} ,
} ,
/**end 自定义函数请在上面加**/
handlePopover : function ( row , opType ) {
if ( 'add' == opType ) {
var subRow = JSON . parse ( JSON . stringify ( this . addForm ) ) ;
subRow . pmenuId = null
subRow . menuId = sn ( ) ;
subRow . seqNo = "1"
subRow . opType = opType
subRow . productId = this . filters . product . id
subRow . productName = this . filters . product . productName
this . fieldChange ( subRow , 'seqNo' ) ;
this . xmMenus . unshift ( subRow ) ;
} else if ( 'addSub' == opType ) {
var subRow = JSON . parse ( JSON . stringify ( row ) ) ;
subRow . children = [ ] ;
subRow . pmenuId = row . menuId
subRow . menuId = sn ( ) ;
subRow . seqNo = row . seqNo + ".1"
subRow . opType = opType
this . fieldChange ( subRow , 'seqNo' ) ;
this . xmMenus . unshift ( subRow ) ;
} else if ( 'delete' == opType ) {
if ( row . opType && ( row . opType == 'addSub' || row . opType == 'add' ) ) {
if ( row . children && row . children . length > 0 ) {
this . $message . error ( "请先删除子元素" ) ;
return ;
} else {
var index = this . xmMenus . findIndex ( i => i . menuId == row . menuId )
var indexValueChanges = this . valueChangeRows . findIndex ( i => i . menuId == row . menuId )
this . valueChangeRows . splice ( indexValueChanges , 1 ) ;
this . xmMenus . splice ( index , 1 ) ;
}
} else {
this . $message . error ( "只能删除未保存的行" ) ;
return ;
}
} else if ( 'highestPmenuId' === opType ) {
if ( row . pmenuId ) {
this . xmMenus . find ( d => {
if ( d . menuId === row . menuId ) {
d . pmenuId = '' ;
this . fieldChange ( d , 'seqNo' , true ) ;
}
} ) ;
}
}
} ,
loadTasksToXmMenuState : function ( ) {
loadTasksToXmMenuState : function ( ) {
this . load . edit = true ;
this . load . edit = true ;
if ( ! this . filters . product ) {
if ( ! this . filters . product ) {
@ -1104,21 +772,6 @@
this . editForm = row
this . editForm = row
this . userSelectVisible = true ;
this . userSelectVisible = true ;
} ,
} ,
onUserSelected ( users ) {
if ( users && users . length > 0 ) {
this . editForm . mmUserid = users [ 0 ] . userid
this . editForm . mmUsername = users [ 0 ] . username
this . fieldChange ( this . editForm , "mmUsername" ) ;
}
this . userSelectVisible = false
} ,
clearPmUser : function ( row ) {
this . editForm = row
row . mmUserid = ''
row . mmUsername = ''
this . fieldChange ( row , "mmUsername" ) ;
} ,
clearFiltersMmUser : function ( ) {
clearFiltersMmUser : function ( ) {
this . filters . mmUser = null ;
this . filters . mmUser = null ;
this . searchXmMenus ( ) ;
this . searchXmMenus ( ) ;
@ -1141,7 +794,7 @@
this . searchXmMenus ( ) ;
this . searchXmMenus ( ) ;
} ,
} ,
toSelectProduct ( ) {
toSelectProduct ( ) {
this . filters . product = null ;
this . productVisible = true ;
}
}
} , / / e n d m e t h o d s
} , / / e n d m e t h o d s
components : {
components : {
@ -1155,29 +808,20 @@
XmTaskListForMenu ,
XmTaskListForMenu ,
XmIterationMng ,
XmIterationMng ,
UsersSelect ,
UsersSelect ,
XmMenuMngBatch ,
/ / 在 下 面 添 加 其 它 组 件
/ / 在 下 面 添 加 其 它 组 件
} ,
} ,
mounted ( ) {
mounted ( ) {
if ( this . filters . product == null ) {
this . productVisible = true ;
}
this . $nextTick ( ( ) => {
this . $nextTick ( ( ) => {
var subHeight = 350 / 1000 * window . innerHeight
if ( this . selProject ) {
subHeight = 400 / 1000 * window . innerHeight
}
this . tableHeight = window . innerHeight - subHeight
let self = this ;
window . onresize = function ( ) {
self . tableHeight = window . innerHeight - subHeight ;
}
var clientRect = this . $refs . table . $el . getBoundingClientRect ( ) ;
var subHeight = 70 / 1000 * window . innerHeight ;
this . tableHeight = window . innerHeight - clientRect . y - this . $refs . table . $el . offsetTop - subHeight ;
this . getXmMenus ( ) ;
this . getXmMenus ( ) ;
} ) ;
} ) ;
/ / 阻 止 默 认 行 为
document . body . ondrop = function ( event ) {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
} ;
this . rowDrop ( ) ;
}
}
}
}
@ -1189,19 +833,5 @@
text - align : center ;
text - align : center ;
float : left ;
float : left ;
padding - top : 5 px ;
padding - top : 5 px ;
}
. el - table {
box - sizing : border - box ;
/deep/ . cell {
- webkit - box - sizing : border - box ;
box - sizing : border - box ;
overflow : hidden ;
text - overflow : ellipsis ;
white - space : normal ;
word - break : break - all ;
line - height : 23 px ;
padding - right : 10 px ;
display : flex ;
}
}
}
< / style >
< / style >