应用、设备 下拉框修改

This commit is contained in:
xusd 2024-07-31 11:50:00 +08:00
parent ad41584915
commit f698fe5df3
5 changed files with 23 additions and 65 deletions

View File

@ -44,7 +44,9 @@ public class GatewayDeviceController extends BaseController
@GetMapping("/{appId}")
public String device(@PathVariable("appId") String appId, ModelMap mmap) {
List<GatewayApp> selection = gatewayAppService.selection();
mmap.put("appId", appId);
GatewayDevice device = new GatewayDevice();
device.setAppId(Long.valueOf(appId));
mmap.put("device", device);
mmap.put("selection", selection);
return prefix + "/device";
}
@ -79,9 +81,12 @@ public class GatewayDeviceController extends BaseController
/**
* 新增设备
*/
@GetMapping("/add")
public String add(ModelMap mmap)
@GetMapping("/add/{appId}")
public String add(@PathVariable String appId, ModelMap mmap)
{
GatewayDevice device = new GatewayDevice();
device.setAppId(Long.valueOf(appId));
mmap.put("device", device);
List<GatewayApp> selection = gatewayAppService.selection();
mmap.put("selection", selection);
return prefix + "/add";

View File

@ -1,6 +1,8 @@
package com.ruoyi.gateway.internet.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -12,6 +14,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2024-07-30
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class GatewayDevice extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -34,61 +38,4 @@ public class GatewayDevice extends BaseEntity
/** join_mode */
@Excel(name = "join_mode")
private String joinMode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAppId(Long appId)
{
this.appId = appId;
}
public Long getAppId()
{
return appId;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setClassValue(String classValue)
{
this.classValue = classValue;
}
public String getClassValue()
{
return classValue;
}
public void setJoinMode(String joinMode)
{
this.joinMode = joinMode;
}
public String getJoinMode()
{
return joinMode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("appId", getAppId())
.append("deviceName", getDeviceName())
.append("classValue", getClassValue())
.append("joinMode", getJoinMode())
.toString();
}
}

View File

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">应用:</label>
<div class="col-sm-8">
<select name="appId" class="form-control m-b">
<select id="appId" name="appId" th:field="*{device.appId}" class="form-control m-b" style="pointer-events: none;background-color:#eee;">
<option value="">所有</option>
<option th:each="item : ${selection}" th:text="${item['appName']}" th:value="${item['id']}"></option>
</select>

View File

@ -12,7 +12,7 @@
<ul>
<li>
<label>应用:</label>
<select id="appId" name="appId" th:field="*{appId}">
<select id="appId" name="appId" th:field="*{device.appId}">
<option value="">所有</option>
<option th:each="item : ${selection}" th:text="${item['appName']}" th:value="${item['id']}"></option>
</select>
@ -41,7 +41,7 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="internet:device:add">
<a class="btn btn-success" onclick="add()" shiro:hasPermission="internet:device:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="internet:device:edit">
@ -70,7 +70,7 @@
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
@ -124,6 +124,12 @@
$.form.reset();
$("#appId").val($("#appId").val()).trigger("change");
}
/*字典数据-新增字典*/
function add() {
var appId = $("#appId option:selected").val();
console.log(appId)
$.operate.add(appId);
}
</script>
</body>
</html>

View File

@ -10,7 +10,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">应用:</label>
<div class="col-sm-8">
<select name="appId" class="form-control m-b">
<select name="appId" class="form-control m-b" style="pointer-events: none;background-color:#eee;" th:field="*{appId}">
<option value="">所有</option>
<option th:each="item : ${selection}" th:text="${item['appName']}" th:value="${item['id']}"></option>
</select>