法规月报的上移下移
This commit is contained in:
+12
-2
@@ -1,5 +1,7 @@
|
||||
package com.jero.modules.report.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
@@ -23,6 +25,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -186,13 +189,20 @@ public class LawsMonthlyReportTitleTemplateEOController extends JeroController<L
|
||||
|
||||
/**
|
||||
* 上移下移
|
||||
* @param lawsMonthlyReportTitleTemplateEOS
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "上移下移")
|
||||
@ApiOperation(value="上移下移", notes="上移下移")
|
||||
@PostMapping(value = "/move")
|
||||
public Result<?> move(@RequestBody List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS) {
|
||||
public Result<?> move(@RequestBody JSONObject jsonObject) {
|
||||
JSONArray lawsMonthlyReportTitleTemplateJson = jsonObject.getJSONArray("lawsMonthlyReportTitleTemplateEOS");
|
||||
LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO = null;
|
||||
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS = new ArrayList<>();
|
||||
for (Object o : lawsMonthlyReportTitleTemplateJson) {
|
||||
lawsMonthlyReportTitleTemplateEO=JSONObject.parseObject(JSONObject.toJSONString(o),LawsMonthlyReportTitleTemplateEO.class);
|
||||
lawsMonthlyReportTitleTemplateEOS.add(lawsMonthlyReportTitleTemplateEO);
|
||||
}
|
||||
lawsMonthlyReportTitleTemplateEOService.move(lawsMonthlyReportTitleTemplateEOS);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
+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