Commit b8603d2f authored by 赵啸非's avatar 赵啸非

修改同步逻辑

parent 77d1ff5f
...@@ -131,6 +131,8 @@ export default { ...@@ -131,6 +131,8 @@ export default {
methods: { methods: {
showFileList(){ showFileList(){
console.log("value",this.value)
let temp = 1; let temp = 1;
// 首先将值转为数组 // 首先将值转为数组
const filePathlist = this.value.split(','); const filePathlist = this.value.split(',');
......
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
"deviceStatus", "deviceStatus",
"enabled", "enabled",
], ],
toArrays:[
"workmanId"
],
toDate:[], toDate:[],
// 表单校验 // 表单校验
rules: { rules: {
...@@ -127,11 +130,16 @@ ...@@ -127,11 +130,16 @@
this.fileNames = "" this.fileNames = ""
this.filePaths = "" this.filePaths = ""
if (data.entity.deviceFileEntityList && data.entity.deviceFileEntityList.length > 0) { if (data.entity.deviceFileEntityList && data.entity.deviceFileEntityList.length > 0) {
this.fileNames=data.entity.deviceFileEntityList.map(i=>i.fileName+",") this.fileNames=data.entity.deviceFileEntityList.map(i=>i.fileName+"").join(",")
this.filePaths=data.entity.deviceFileEntityList.map(i=>i.filePaths+",") this.filePaths=data.entity.deviceFileEntityList.map(i=>i.filePath+"").join(",")
} }
console.log("filePaths:"+this.filePaths)
//处理选择的人员
if (data.entity.deviceWorkmanEntityList && data.entity.deviceWorkmanEntityList.length > 0) {
data.entity.workmanId=data.entity.deviceWorkmanEntityList.map(i=>i.workmanId+"").join(",")
console.log("fileNames:"+this.fileNames) }
console.log("afterdata",data)
return data; return data;
}, },
......
...@@ -148,26 +148,18 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -148,26 +148,18 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
protected void updateAfter(DeviceEntity entity, Context context) throws AppException { protected void updateAfter(DeviceEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getDeviceWorkmanEntityList())) { if (!ObjectUtils.isEmpty(entity.getDeviceWorkmanEntityList())) {
//先删除 再添加 //先删除 再添加
List<Long> deviceIdList = entity.getDeviceWorkmanEntityList().stream().map(i -> i.getDeviceId()).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(deviceIdList)) {
DeviceWorkmanQuery deviceWorkmanQuery = new DeviceWorkmanQuery(); DeviceWorkmanQuery deviceWorkmanQuery = new DeviceWorkmanQuery();
deviceWorkmanQuery.setDeviceIdList(deviceIdList); deviceWorkmanQuery.setDeviceId(entity.getId());
Long[] deviceIds = deviceWorkmanService.find(deviceWorkmanQuery).stream().map(DeviceWorkmanEntity::getId).toArray(Long[]::new); Long[] deviceIds = deviceWorkmanService.find(deviceWorkmanQuery).stream().map(DeviceWorkmanEntity::getId).toArray(Long[]::new);
deviceWorkmanService.remove(deviceIds, context); deviceWorkmanService.remove(deviceIds, context);
}
saveDeviceWorkman(entity, context); saveDeviceWorkman(entity, context);
} }
if (!ObjectUtils.isEmpty(entity.getDeviceFileEntityList())) { if (!ObjectUtils.isEmpty(entity.getDeviceFileEntityList())) {
List<Long> deviceIdList = entity.getDeviceFileEntityList().stream().map(i -> i.getDeviceId()).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(deviceIdList)) {
DeviceFileQuery deviceFileQuery = new DeviceFileQuery(); DeviceFileQuery deviceFileQuery = new DeviceFileQuery();
deviceFileQuery.setDeviceIdList(deviceIdList); deviceFileQuery.setDeviceId(entity.getId());
Long[] deviceIds = deviceFileService.find(deviceFileQuery).stream().map(DeviceFileEntity::getId).toArray(Long[]::new); Long[] deviceIds = deviceFileService.find(deviceFileQuery).stream().map(DeviceFileEntity::getId).toArray(Long[]::new);
deviceFileService.remove(deviceIds, context); deviceFileService.remove(deviceIds, context);
}
saveDeviceFile(entity, context); saveDeviceFile(entity, context);
} }
} }
......
...@@ -14,14 +14,12 @@ client.global.set("authToken", JSON.parse(response.body).data.token); ...@@ -14,14 +14,12 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
%} %}
###设备管理列表 ###设备管理列表
POST {{baseUrl}}/device/list POST {{baseUrl}}/device/infoByCode
Content-Type: application/json Content-Type: application/json
{ {
"deviceName":"sjfrrr",
"deviceCode":"d6u6i3", "deviceCode":"18-93-7F-C0-AD-B5"
"page":1,
"size":10
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"baseLogin": "http://127.0.0.1:18222/m" "baseLogin": "http://127.0.0.1:18222/m"
}, },
"dev": { "dev": {
"baseUrl": "http://192.168.0.217:18222/m", "baseUrl": "http://192.168.0.252:/m",
"baseLogin": "http://192.168.0.98:11078/base" "baseLogin": "http://192.168.0.98:11078/base"
}, },
"test": { "test": {
......
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