Commit 5ddf2473 authored by zhengke's avatar zhengke

修改

parent 978ef702
...@@ -240,16 +240,16 @@ ...@@ -240,16 +240,16 @@
</strong> </strong>
<i class="iconfont icon-edit" title="编辑" style="font-size:18px;margin-right:5px;" @click="getNameEdit(DataObj.GroupList,gIndex)"></i> <i class="iconfont icon-edit" title="编辑" style="font-size:18px;margin-right:5px;" @click="getNameEdit(DataObj.GroupList,gIndex)"></i>
<i class="iconfont icon-ico_commodity_defaul" v-if="gItem.isShowEdit" title="保存" style="top:0;margin-right:5px;" @click="saveExamName(DataObj.GroupList)"></i> <i class="iconfont icon-ico_commodity_defaul" v-if="gItem.isShowEdit" title="保存" style="top:0;margin-right:5px;" @click="saveExamName(DataObj.GroupList)"></i>
<i class="iconfont icon-shangyi2" style="margin-right:5px;" v-if="gIndex!=0"></i> <i class="iconfont icon-shangyi2" style="margin-right:5px;" @click.stop="MoveFatherItem(gIndex,0)" v-if="gIndex!=0"></i>
<i class="iconfont icon-xiayi" v-if="gIndex!=DataObj.GroupList.length-1"></i> <i class="iconfont icon-xiayi" @click.stop="MoveFatherItem(gIndex,1)" v-if="gIndex!=DataObj.GroupList.length-1"></i>
</div> </div>
<ul class="List-ul" v-if="gItem.DetailsList&&gItem.DetailsList.length>0"> <ul class="List-ul" v-if="gItem.DetailsList&&gItem.DetailsList.length>0">
<li class="" style="cursor:pointer;" v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex" <li class="" style="cursor:pointer;" v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex"
@click="ClickItem(dItem)"> @click="ClickItem(dItem)">
{{dIndex+1}}<span class="exam_DetailList" @click="ClickItem(dItem)" v-html="dItem.ShowTitle"></span> {{dIndex+1}}<span class="exam_DetailList" @click="ClickItem(dItem)" v-html="dItem.ShowTitle"></span>
<span class="exam_ListSHow"> <span class="exam_ListSHow">
<i class="iconfont icon-shangyi2" style="margin-right:5px;" v-if="dIndex!=0"></i> <i class="iconfont icon-shangyi2" @click.stop="MoveChildItem(gIndex,dIndex,0)" style="margin-right:5px;" v-if="dIndex!=0"></i>
<i class="iconfont icon-xiayi" v-if="dIndex!=gItem.DetailsList.length-1"></i> <i class="iconfont icon-xiayi" @click.stop="MoveChildItem(gIndex,dIndex,1)" v-if="dIndex!=gItem.DetailsList.length-1"></i>
<i class="iconfont icon-shanchu2" style="margin-left:5px;font-size:17px;"></i> <i class="iconfont icon-shanchu2" style="margin-left:5px;font-size:17px;"></i>
</span> </span>
</li> </li>
...@@ -452,10 +452,50 @@ ...@@ -452,10 +452,50 @@
this.GetPaperInfo() this.GetPaperInfo()
}, },
methods: { methods: {
//上移下移(IsUp:0上移,1下移)
MoveFatherItem(subIndex, IsUp) {
var currentItem = this.DataObj.GroupList[subIndex];
//上移
if (IsUp == 0) {
if (subIndex > 0) {
var upItem = this.DataObj.GroupList[subIndex - 1];
this.$set(this.DataObj.GroupList, subIndex - 1, currentItem);
this.$set(this.DataObj.GroupList, subIndex, upItem);
this.$forceUpdate();
}
} else {
//下移
if (subIndex != this.DataObj.GroupList.length - 1) {
var downItem = this.DataObj.GroupList[subIndex + 1];
this.$set(this.DataObj.GroupList, subIndex + 1, currentItem);
this.$set(this.DataObj.GroupList, subIndex, downItem);
this.$forceUpdate();
}
}
},
//移动子项
MoveChildItem(Index,subIndex, IsUp){
var currentItem = this.DataObj.GroupList[Index].DetailsList[subIndex];
//上移
if (IsUp == 0) {
if (subIndex > 0) {
var upItem = this.DataObj.GroupList[Index].DetailsList[subIndex - 1];
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex - 1, currentItem);
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex, upItem);
this.$forceUpdate();
}
} else {
//下移
if (subIndex != this.DataObj.GroupList[Index].DetailsList.length - 1) {
var downItem = this.DataObj.GroupList[Index].DetailsList[subIndex + 1];
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex + 1, currentItem);
this.$set(this.DataObj.GroupList[Index].DetailsList, subIndex, downItem);
this.$forceUpdate();
}
}
},
//点击修改标题名字和分数 //点击修改标题名字和分数
getNameEdit(item,index){ getNameEdit(item,index){
console.log(item,'item');
console.log(index,'index');
item.forEach(x=>{ item.forEach(x=>{
x.isShowEdit=false; x.isShowEdit=false;
}) })
...@@ -529,7 +569,6 @@ ...@@ -529,7 +569,6 @@
this.DataObj.GroupList.forEach(x=>{ this.DataObj.GroupList.forEach(x=>{
x.isShowEdit = false; x.isShowEdit = false;
}) })
console.log("this.DataObj", this.DataObj);
}) })
}, },
//点击问题 //点击问题
......
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