法规月报的上移下移
This commit is contained in:
+47
-7
@@ -28,9 +28,9 @@
|
||||
:data-source="dataSource"
|
||||
:columns="columns"
|
||||
>
|
||||
<span slot="operation" slot-scope="text,record">
|
||||
<a class="text-operation" @click="moveUpClick(record)">{{$t('moveUp')}}</a>
|
||||
<a class="text-operation" @click="moveDownClick(record)">{{$t('moveDown')}}</a>
|
||||
<span slot="operation" slot-scope="text,record,index">
|
||||
<a class="text-operation" @click="moveUpClick(record,index)">{{$t('moveUp')}}</a>
|
||||
<a class="text-operation" @click="moveDownClick(record,index)">{{$t('moveDown')}}</a>
|
||||
<a class="text-operation" @click="edit(record)">{{$t('edit')}}</a>
|
||||
<a class="text-operation" @click="deleteLib(record)">{{$t('deleteLib')}}</a>
|
||||
</span>
|
||||
@@ -69,6 +69,7 @@
|
||||
dataSource: [],
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
sortList: [],
|
||||
total: 0,
|
||||
columns: [
|
||||
{
|
||||
@@ -146,11 +147,49 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
moveUpClick() {
|
||||
|
||||
moveUpClick(row, index) {
|
||||
this.sortList = []
|
||||
this.sortList.push(row)
|
||||
if (row.parentId) {
|
||||
let content = this.dataSource.filter(res => {
|
||||
return row.parentId == res.id
|
||||
})
|
||||
if (index != 0) {
|
||||
this.sortList.push(content[0].children[index - 1])
|
||||
}
|
||||
} else {
|
||||
if (index != 0) {
|
||||
this.sortList.push(this.dataSource[index - 1])
|
||||
}
|
||||
}
|
||||
this.move()
|
||||
},
|
||||
moveDownClick() {
|
||||
|
||||
moveDownClick(row, index) {
|
||||
this.sortList = []
|
||||
this.sortList.push(row)
|
||||
if (row.parentId) {
|
||||
let content = this.dataSource.filter(res => {
|
||||
return row.parentId == res.id
|
||||
})
|
||||
if (index != (content[0].children.length - 1)) {
|
||||
this.sortList.push(content[0].children[index + 1])
|
||||
}
|
||||
} else {
|
||||
if (index != (this.dataSource.length - 1)) {
|
||||
this.sortList.push(this.dataSource[index + 1])
|
||||
}
|
||||
}
|
||||
this.move()
|
||||
},
|
||||
move() {
|
||||
postAction('/report/lawsMonthlyReportTitleTemplateEO/move', { lawsMonthlyReportTitleTemplateEOS: this.sortList }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('OperationSuccessful'))
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteLib(val) {
|
||||
let _this = this
|
||||
@@ -185,6 +224,7 @@
|
||||
text-align: right;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.text-operation {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user