rev:平均分配页面显示问题
This commit is contained in:
@@ -13,6 +13,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -37,15 +38,16 @@ public class DeviceAssignedController {
|
||||
@PostMapping
|
||||
@Log("新增设备任务分配信息")
|
||||
@ApiOperation("新增设备任务分配信息")
|
||||
public ResponseEntity create(@Validated @RequestBody DeviceAssignedDto resources) {
|
||||
return new ResponseEntity<>(deviceAssignedService.insert(resources), HttpStatus.CREATED);
|
||||
public ResponseEntity create(@Validated @RequestBody Map resources) {
|
||||
deviceAssignedService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备任务分配信息")
|
||||
@ApiOperation("修改设备任务分配信息")
|
||||
public ResponseEntity update(@Validated @RequestBody DeviceAssignedDto resources) {
|
||||
deviceAssignedService.updateById(resources);
|
||||
public ResponseEntity update(@Validated @RequestBody Map resources) {
|
||||
deviceAssignedService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ public class DeviceAssignedDto implements Serializable {
|
||||
private String device_code;
|
||||
|
||||
@ApiModelProperty(value = "指令终点")
|
||||
private String inst_nextdevice_code;
|
||||
private String inst_nextDevice_code;
|
||||
|
||||
@ApiModelProperty(value = "任务终点")
|
||||
private String task_nextdevice_code;
|
||||
private String task_nextDevice_code;
|
||||
|
||||
@ApiModelProperty(value = "参数")
|
||||
private String param;
|
||||
|
||||
@@ -124,8 +124,8 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
JSONObject param = new JSONObject();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String device_code = whereJson.get("device_code").toString();
|
||||
String task_nextdevice = String.join(",", (List) whereJson.get("task_nextdevice_code"));
|
||||
String inst_nextdevice = String.join(",", (List) whereJson.get("inst_nextdevice_code"));
|
||||
String task_nextdevice = String.join(",", (List) whereJson.get("task_nextDevice_code"));
|
||||
String inst_nextdevice = String.join(",", (List) whereJson.get("inst_nextDevice_code"));
|
||||
ArrayList list = (ArrayList) whereJson.get("tableData");
|
||||
JSONObject jo = new JSONObject();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -133,16 +133,18 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
String device = one.get("device").toString();
|
||||
String limit = one.get("limit").toString();
|
||||
String scale = one.get("scale").toString();
|
||||
Boolean inOut = (Boolean) one.get("inOut");
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("limit", limit);
|
||||
data.put("scale", scale);
|
||||
data.put("inOut",inOut);
|
||||
jo.put(device, data);
|
||||
}
|
||||
String now = DateUtil.now();
|
||||
param.put("assigned_id", IdUtil.simpleUUID());
|
||||
param.put("device_code", device_code);
|
||||
param.put("task_nextdevice_code", task_nextdevice.toString());
|
||||
param.put("inst_nextdevice_code", inst_nextdevice.toString());
|
||||
param.put("task_nextDevice_code", task_nextdevice.toString());
|
||||
param.put("inst_nextDevice_code", inst_nextdevice.toString());
|
||||
param.put("param", jo);
|
||||
param.put("is_active", CommonFinalParam.ONE);
|
||||
param.put("is_delete", CommonFinalParam.ONE);
|
||||
@@ -159,12 +161,13 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
public void update(Map whereJson) {
|
||||
JSONObject param = new JSONObject();
|
||||
String device_code = whereJson.get("device_code").toString();
|
||||
String task_nextdevice = String.join(",", (List<String>) whereJson.get("task_nextdevice_code"));
|
||||
String inst_nextdevice = String.join(",", (List<String>) whereJson.get("inst_nextdevice_code"));
|
||||
String assgined_id = whereJson.get("assigned_id").toString();
|
||||
String task_nextdevice = String.join(",", (List<String>) whereJson.get("task_nextDevice_code"));
|
||||
String inst_nextdevice = String.join(",", (List<String>) whereJson.get("inst_nextDevice_code"));
|
||||
String assigned_id = whereJson.get("assigned_id").toString();
|
||||
param.put("assigned_id",assigned_id);
|
||||
param.put("device_code", device_code);
|
||||
param.put("task_nextdevice_code", task_nextdevice.toString());
|
||||
param.put("inst_nextdevice_code", inst_nextdevice.toString());
|
||||
param.put("task_nextDevice_code", task_nextdevice.toString());
|
||||
param.put("inst_nextDevice_code", inst_nextdevice.toString());
|
||||
ArrayList list = (ArrayList) whereJson.get("tableData");
|
||||
JSONObject jo = new JSONObject();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -172,9 +175,11 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
String device = one.get("device").toString();
|
||||
String limit = one.get("limit").toString();
|
||||
String scale = one.get("scale").toString();
|
||||
Boolean inOut = (Boolean) one.get("inOut");
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("limit", limit);
|
||||
data.put("scale", scale);
|
||||
data.put("inOut", inOut);
|
||||
jo.put(device, data);
|
||||
}
|
||||
param.put("param", jo);
|
||||
@@ -200,8 +205,8 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
for (DeviceAssignedDto deviceAssigned : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("设备编码", deviceAssigned.getDevice_code());
|
||||
map.put("指令终点", deviceAssigned.getInst_nextdevice_code());
|
||||
map.put("任务终点", deviceAssigned.getTask_nextdevice_code());
|
||||
map.put("指令终点", deviceAssigned.getInst_nextDevice_code());
|
||||
map.put("任务终点", deviceAssigned.getTask_nextDevice_code());
|
||||
map.put("参数", deviceAssigned.getParam());
|
||||
map.put("备注", deviceAssigned.getRemark());
|
||||
map.put("是否启用", deviceAssigned.getIs_active());
|
||||
|
||||
@@ -1559,8 +1559,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String flag2 = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DeviceAssignedDto dto = list.get(i);
|
||||
String inst_nextDevice_code = dto.getInst_nextdevice_code();
|
||||
String task_nextDevice_code = dto.getTask_nextdevice_code();
|
||||
String inst_nextDevice_code = dto.getInst_nextDevice_code();
|
||||
String task_nextDevice_code = dto.getTask_nextDevice_code();
|
||||
String param = dto.getParam();
|
||||
JSONObject jo = JSON.parseObject(param);
|
||||
String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】':”“’。、?]";
|
||||
|
||||
@@ -16,7 +16,8 @@ export default {
|
||||
'destination_configuration': 'Destination Configuration',
|
||||
'operation': 'Operation',
|
||||
'device_is_not_null': 'Device Code Cannot Be Empty',
|
||||
'mapping_relationship': 'Mapping Relationship'
|
||||
'mapping_relationship': 'Mapping Relationship',
|
||||
'inOut': 'Bidirectional point position'
|
||||
},
|
||||
'rules': {
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ export default {
|
||||
'destination_configuration': 'Konfigurasi Tujuan',
|
||||
'operation': 'Operasi',
|
||||
'device_is_not_null': 'Kode Perangkat Tidak Boleh Kosong',
|
||||
'mapping_relationship': 'Hubungan Pemetaan'
|
||||
'mapping_relationship': 'Hubungan Pemetaan',
|
||||
'inOut': 'Posisi titik bidireksi'
|
||||
},
|
||||
'rules': {
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ export default {
|
||||
'destination_configuration': '终点配置',
|
||||
'operation': '操作',
|
||||
'device_is_not_null': '设备编码不能为空',
|
||||
'mapping_relationship': '映射关系'
|
||||
'mapping_relationship': '映射关系',
|
||||
'inOut': '双向点位'
|
||||
},
|
||||
'rules': {
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('config.table.end_of_instruction')" prop="inst_nextDevice_code">
|
||||
<el-select
|
||||
v-model="form.inst_nextdevice_code"
|
||||
v-model="form.inst_nextDevice_code"
|
||||
multiple
|
||||
filterable
|
||||
:placeholder="$t('config.table.please_select')"
|
||||
@@ -48,7 +48,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('config.table.end_of_task')" prop="task_nextDevice_code">
|
||||
<el-select
|
||||
v-model="form.task_nextdevice_code"
|
||||
v-model="form.task_nextDevice_code"
|
||||
filterable
|
||||
multiple
|
||||
:placeholder="$t('config.table.please_select')"
|
||||
@@ -83,12 +83,25 @@
|
||||
<el-input v-model="form.tableData[scope.$index].scale" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="inOut" :label="$t('config.table.inOut')">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="form.tableData[scope.$index].inOut"
|
||||
:value="false"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">{{ $t('config.table.cancel') }}</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{ $t('config.table.confirm') }}</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{
|
||||
$t('config.table.confirm')
|
||||
}}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
@@ -104,8 +117,8 @@
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="assigned_id" label="任务标识" />
|
||||
<el-table-column prop="device_code" :label="$t('config.table.device_code')" />
|
||||
<el-table-column prop="task_nextdevice_code" :label="$t('config.table.destination_device')" />
|
||||
<el-table-column prop="inst_nextdevice_code" :label="$t('config.table.inst_nextdevice_code')" />
|
||||
<el-table-column prop="task_nextDevice_code" :label="$t('config.table.destination_device')" />
|
||||
<el-table-column prop="inst_nextDevice_code" :label="$t('config.table.inst_nextdevice_code')" />
|
||||
<el-table-column prop="param" :label="$t('config.table.destination_configuration')" :formatter="paramFormate" />
|
||||
<el-table-column
|
||||
v-permission="['admin','AcsDeviceAssigned:edit','AcsDeviceAssigned:del']"
|
||||
@@ -139,8 +152,8 @@ import i18n from '@/i18n'
|
||||
const defaultForm = {
|
||||
assigned_id: null,
|
||||
device_code: null,
|
||||
task_nextdevice_code: null,
|
||||
inst_nextdevice_code: null,
|
||||
task_nextDevice_code: null,
|
||||
inst_nextDevice_code: null,
|
||||
param: null,
|
||||
tableData: []
|
||||
}
|
||||
@@ -150,11 +163,16 @@ export default {
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: i18n.t('config.table.mapping_relationship'), url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
|
||||
title: i18n.t('config.table.mapping_relationship'),
|
||||
url: 'api/deviceAssigned',
|
||||
idField: 'assigned_id',
|
||||
sort: 'assigned_id',
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: true,
|
||||
del: true
|
||||
}, crudMethod: { ...crudAcsDeviceAssigned }
|
||||
},
|
||||
crudMethod: { ...crudAcsDeviceAssigned }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
@@ -188,6 +206,26 @@ export default {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
[CRUD.HOOK.beforeToEdit](data) {
|
||||
const form = JSON.stringify(data.form)
|
||||
const formObj = JSON.parse(form)
|
||||
this.form.assigned_id = formObj.assigned_id
|
||||
this.form.device_code = formObj.device_code
|
||||
this.form.task_nextDevice_code = formObj.task_nextDevice_code.split(',')
|
||||
this.form.inst_nextDevice_code = formObj.inst_nextDevice_code.split(',')
|
||||
const param = JSON.parse(formObj.param)
|
||||
const tableData = []
|
||||
Object.keys(param).forEach(key => {
|
||||
tableData.push({
|
||||
device: key,
|
||||
inOut: param[key].inOut,
|
||||
limit: param[key].limit,
|
||||
scale: param[key].scale
|
||||
})
|
||||
})
|
||||
this.form.tableData = tableData
|
||||
return true
|
||||
},
|
||||
paramFormate(row, index) {
|
||||
return JSON.stringify(row.param)
|
||||
},
|
||||
@@ -199,13 +237,23 @@ export default {
|
||||
}
|
||||
},
|
||||
getValue: function(value) {
|
||||
console.log(value)
|
||||
const tableData = []
|
||||
value.forEach(item => {
|
||||
tableData.push({
|
||||
device: item
|
||||
if (!(value && typeof value === 'object' && Object.keys(value).length === 0)) {
|
||||
// const oldTableData = JSON.parse(JSON.stringify(this.form.tableData))
|
||||
// if (oldTableData && oldTableData.length > 0) {
|
||||
// oldTableData.forEach(row => {
|
||||
// console.log(row)
|
||||
// })
|
||||
// }
|
||||
value.forEach(item => {
|
||||
tableData.push({
|
||||
device: item,
|
||||
limit: 50,
|
||||
scale: 50,
|
||||
inOut: false
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
this.form.tableData = tableData
|
||||
},
|
||||
changeNextDevice(value) {
|
||||
|
||||
Reference in New Issue
Block a user