From bcacdc9af9e060c77d167e05319406bdc6871b7e Mon Sep 17 00:00:00 2001 From: caoyang Date: Tue, 22 Mar 2022 16:44:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../splitting/modules/SplitAddForm.vue | 5 +- .../splitting/modules/SplitDetail.vue | 172 +++++++++++++++++- .../documentManage/tags/dialog/DicList.vue | 15 +- .../documentManage/tags/dialog/TreeTable.vue | 13 +- 4 files changed, 179 insertions(+), 26 deletions(-) diff --git a/jero-web/src/views/documentManage/splitting/modules/SplitAddForm.vue b/jero-web/src/views/documentManage/splitting/modules/SplitAddForm.vue index 07b4d3199..bc2ff3d59 100644 --- a/jero-web/src/views/documentManage/splitting/modules/SplitAddForm.vue +++ b/jero-web/src/views/documentManage/splitting/modules/SplitAddForm.vue @@ -3,7 +3,7 @@
-
- +
+
@@ -12,6 +12,8 @@ :defaultExpandAll="true" :tree-data="gData" @expand="onExpand" + @rightClick="rightClick" + @select="onSelect" > +
+ + + +
@@ -98,7 +111,7 @@
+

{{contentValue}}

- + + + + + + + + + + + +
@@ -139,6 +178,8 @@ }, data() { return { + labelCol: { span: 6 }, + wrapperCol: { span: 16 }, contentVisible:false, //条款内容弹框显示 queryParams:{ pageNo:1, @@ -236,7 +277,22 @@ attId:'', data:[], confirmLoading:false, - + NodeTreeItem:null, //右键菜单 + tmpStyle:'', //右键菜单位置 + menuTitle:this.$t('add'), + formTitle:'', + menuRightVisible:false, + form:{}, + rules: { + clauseNo: [ + { required: true, message: this.$t('PleaseEnter')+this.$t('clauseNo'), trigger: 'blur' }, + { min: 1, max: 20, message: this.$t('cantExeed') + '20' + this.$t('characters'), trigger: 'blur' }, + ], + clauseName: [ + { required: true, message: this.$t('PleaseEnter')+this.$t('clauseName'), trigger: 'blur' }, + { min: 1, max: 20, message: this.$t('cantExeed') + '20' + this.$t('characters'), trigger: 'blur' }, + ], + } } }, mounted() { @@ -301,16 +357,97 @@ //获取左侧目录数据 loadMenuData(){ let params={ - } - // this.loading=true - getAction(`sys/category/getSysCategoryTree`, params).then(res => { + this.loading=true + getAction(`split/sarFileSplitMenu/getSplitMenusByInfoId`, params).then(res => { if (res.success) { - this.data = [...res.result] - this.gData = [...this.data] + this.data = this.toTree(res.result) + this.gData= [...this.data] } + }).finally(()=>{ + this.loading=false }) }, + //将数据拼成树形结构 + toTree(config) { + // 删除 所有 children,以防止多次调用 + config.forEach(function(item) { + delete item.children; + }); + // 将数据存储为 以 id 为 KEY 的 map 索引数据列 + let map = {}; + config.forEach((item) => { + item.label = item.name; + item.key=item.id; + item.title=item.name+(item.itemName?' '+item.itemName:'') + map[item.id] = item; + }); + let val = []; + config.forEach((item) => { + // 以当前遍历项,的pid,去map对象中找到索引的id + let parent = map[item.pid]; + // 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中 + if (parent) { + (parent.children || (parent.children = [])).push(item); + } else { + //如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级 + val.push(item); + } + }); + return val; + }, + //鼠标右键 + rightClick({event,node}){ + // console.log('eee',event,node) + const x = + event.currentTarget.offsetLeft + event.currentTarget.clientWidth; + const y = event.currentTarget.offsetTop; + this.NodeTreeItem = { + pageX: x, + pageY: y, + id: node._props.dataRef.id, + title: node._props.dataRef.title, + pid: node._props.dataRef.pid || null + }; + this.tmpStyle = { + position: 'absolute', + maxHeight: 40, + textAlign: 'center', + left: `${x + 10 - 0}px`, + top: `${y + 6 - 0}px`, + background:`#FFFFFF`, + zIndex:`2` + }; + }, + // 用于点击空白处隐藏增删改菜单 + clearMenu () { + this.NodeTreeItem = null; + }, + //选择树节点 + onSelect(selectedKeys){ + console.log('sele',selectedKeys) + }, + //树形新增 + orgAdd(){ + this.menuRightVisible=true + + }, + //树形修改 + orgEdit(){ + + }, + //树形删除 + orgDelete(){ + + }, + handleCancelMenuRight(){ + this.menuRightVisible=false + }, + //增加条款确定 + hideModalMenuRight(){ + this.menuRightVisible=false + + }, //获取列表数据 loadData(){ let params={ @@ -360,6 +497,7 @@ }, //新增 handleAddManage(){ + this.formTitle=this.$t('add') this.addVisible=true }, closeVisible(val){ @@ -422,6 +560,7 @@ }, //编辑 onEdit(val){ + this.formTitle=this.$t('edit') this.addVisible=true }, //删除 @@ -556,6 +695,19 @@ min-width: 260px; padding-right: 20px; border-right: 1px solid #666666; + .menu-item{ + padding: 2px 8px; + border: 1px solid #000000; + border-bottom: none; + cursor: pointer; + } + .menu-bottom{ + border-bottom: 1px solid #000000; + } + .menu-item:hover{ + background: #00B3BE; + color: #ffffff; + } } .split-detail-right{ padding-left: 20px; diff --git a/jero-web/src/views/documentManage/tags/dialog/DicList.vue b/jero-web/src/views/documentManage/tags/dialog/DicList.vue index 3f2c79353..f7eaafa05 100644 --- a/jero-web/src/views/documentManage/tags/dialog/DicList.vue +++ b/jero-web/src/views/documentManage/tags/dialog/DicList.vue @@ -4,7 +4,7 @@
- +
@@ -23,8 +23,8 @@
- - + +
{ - let parentNode=[] - this.tabletreeDataSource=[...res.result] + this.tabletreeDataSource=[...res.result.records] this.total=res.result.total let data = this.toTree(this.tabletreeDataSource) this.tabletreeData=data @@ -437,9 +436,11 @@ getAction(`sys/category/logicDeleteBatch`, params).then(res => { if(res.success){ - this.queryParams.pageNo=1 - this.loadData() + if(this.selectedIds.length==this.tableData.length&&this.queryParams.pageNo!=1){ + this.queryParams.pageNo=this.queryParams.pageNo-1 + } this.$message.success(this.$t('OperationSuccessful')) + this.loadData() }else{ this.$message.warning(this.$t('operationFailed')) } diff --git a/jero-web/src/views/documentManage/tags/dialog/TreeTable.vue b/jero-web/src/views/documentManage/tags/dialog/TreeTable.vue index 9595459b9..dc202436d 100644 --- a/jero-web/src/views/documentManage/tags/dialog/TreeTable.vue +++ b/jero-web/src/views/documentManage/tags/dialog/TreeTable.vue @@ -39,16 +39,12 @@ props:{ tabletreeData:Array, record:Object, - total:String + total:String, + queryParams:Object }, data(){ return{ - loading:false, - total:0, - queryParams:{ - pageNo:1, - pageSize:10 - }, //搜索条件 + loading:false, //搜索条件 columns: [ { title: this.$t('name'), @@ -137,6 +133,9 @@ getAction(`sys/category/logicDelete`, { id: val.id }).then((res) => { if (res.success) { this.$message.success(this.$t('OperationSuccessful')); + if(this.tabData&&this.tabData.length==1){ + this.queryParams.pageNo=1 + } this.$emit('ok',this.queryParams) }else{ this.$message.warning(this.$t('operationFailed'));