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

页面修改

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