Commit 6904ec5d authored by 黄奎's avatar 黄奎

页面修改

parent def76c52
<style>
.movefolder_left{
color:#3A8BFF;
float:left;
margin:20px;
.movefolder_left {
color: #3A8BFF;
float: left;
margin: 20px;
cursor: pointer;
}
.movefolder_left i{
margin-right:3px;
font-size:18px;
.movefolder_left i {
margin-right: 3px;
font-size: 18px;
}
.movefolder_left:hover{
.movefolder_left:hover {
opacity: .7;
}
.move_Icon i{
font-size:20px;
color:#3A8BFF;
.move_Icon i {
font-size: 20px;
color: #3A8BFF;
}
.treeDiv .el-tree-node__content{
.treeDiv .el-tree-node__content {
height: auto;
}
</style>
<!--移动到文件夹-->
<template>
......@@ -29,16 +34,16 @@
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="treeDiv">
<el-tree :data="dataList" node-key="PaperId" ref="paperFolderTree" highlight-current
:props="defaultProps" @check="checkChange" @node-click="handleNodeClick">
<span class="custom-tree-node" slot-scope="{node,data,index}">
<el-tree :data="dataList" node-key="PaperId" ref="paperFolderTree" highlight-current :props="defaultProps"
@node-click="handleNodeClick" default-expand-all>
<span class="custom-tree-node" slot-scope="{node,data}">
<span>
<i class="iconfont icon-wenjianjia" style="font-size:18px;margin-right:3px;"></i>
<template v-if="data.isEdit">
<el-input size="small" v-if="data.isEdit"></el-input>
<el-input size="small" v-model="folderMsg.PaperName"></el-input>
<span class="move_Icon">
<i class="iconfont icon-queren" style="margin:0 10px;"></i>
<i class="iconfont icon-shanchu2" @click="delMoveData(index)"></i>
<i class="iconfont icon-queren" style="margin:0 10px;" @click="setFolder"></i>
<i class="iconfont icon-shanchu2" @click="() => delMoveData(node, data)"></i>
</span>
</template>
<template v-else>{{data.PaperName}}</template>
......@@ -46,8 +51,11 @@
</span>
</el-tree>
</div>
<div class="movefolder_left" @click="CreateNewFolder">
<i class="iconfont icon-xinjianwenjianjia"></i>新建文件夹
<div class="movefolder_left" @click="CreateNewFolder(1)">
<i class="iconfont icon-xinjianwenjianjia"></i>同级目录
</div>
<div class="movefolder_left" @click="CreateNewFolder(2)">
<i class="iconfont icon-xinjianwenjianjia"></i>子目录
</div>
</q-card-section>
<q-separator />
......@@ -59,7 +67,6 @@
</q-card>
</q-dialog>
</template>
<script>
import {
queryFolderTree,
......@@ -76,7 +83,8 @@
data() {
return {
persistent: true,
objOption: {
//新增文件夹参数
folderMsg: {
PaperId: 0,
PaperName: '', //文件夹名称
PaperType: 1, //试卷类型(1-文件夹,2-试卷)
......@@ -93,7 +101,8 @@
PaperId: 0,
ParentId: 0,
},
checkArray:[],
//选中的文件夹
checkFolder: null,
}
},
created() {
......@@ -105,41 +114,73 @@
this.initObj();
},
methods: {
delMoveData(index){
console.log(index,'index');
//删除节点
delMoveData(node, nodeData) {
const parent = node.parent;
const children = parent.data.children || parent.data;
const index = children.findIndex(d => d.PaperId === nodeData.PaperId);
children.splice(index, 1);
},
handleNodeClick(val){
console.log(val,'value');
this.checkArray=[];
this.checkArray.push(val);;
handleNodeClick(val) {
this.checkFolder = val;
},
//创建文件夹
CreateNewFolder(){
let obj={
PaperId:0,
PaperName:'',
ParentId:0,
ChildList:[],
isEdit:true
CreateNewFolder(type) {
if (!this.checkFolder) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择目标文件夹`
})
return
}
let obj = {
PaperId: 0,
PaperName: '',
ParentId: 0,
ChildList: [],
isEdit: true
}
if(this.checkArray.length==0){
//同级目录
if (type == 1) {
this.folderMsg.ParentId = 0;
this.dataList.push(obj);
}else{
this.checkArray[0].ChildList.push(obj);
}
//子目录
else if (type == 2) {
this.folderMsg.ParentId = this.checkFolder.PaperId;
this.checkFolder.ChildList.push(obj);
}
},
//保存文件夹
setFolder() {
savePaperFolderInfo(this.folderMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
timeout: 2000,
message: "创建文件夹成功!",
position: 'top'
})
this.clearMsg();
this.initObj();
}
});
},
//选择改变
checkChange(data) {
var labvalojb = data; //暂存选中节点
this.$refs.paperFolderTree.setCheckedKeys([]); //删除所有选中节点
this.$refs.paperFolderTree.setCheckedNodes([labvalojb]); //选中已选中节点
//清空文件夹提交数据
clearMsg() {
this.checkFolder = null;
this.folderMsg.PaperId = 0;
this.folderMsg.PaperName = "";
this.folderMsg.PaperType = 1;
this.folderMsg.ParentId = 0;
},
//初始化下拉列表
initObj() {
queryFolderTree({}).then(res => {
if (res.Code == 1) {
this.dataList = res.Data;
}
})
},
closeSaveForm() {
......@@ -147,9 +188,7 @@
this.persistent = false
},
setMoveFolderInfo() {
if (this.checkArray != null && this.checkArray.length > 0) {
this.moveMsg.ParentId = this.checkArray[0].PaperId;
} else {
if (!this.checkFolder) {
this.$q.notify({
type: 'negative',
position: "top",
......@@ -158,8 +197,7 @@
return
}
this.saveLoading = true;
console.log(this.checkArray);
return
this.moveMsg.ParentId=this.checkFolder.PaperId;
movePaperInfo(this.moveMsg).then(res => {
this.saveLoading = false
this.$q.notify({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment