add(activiti/experiment_reques): 前端添加实验结果编辑功能并优化设备选择(两个设备都可以不选择)

- 在实验请求页面添加编辑实验结果功能
- 优化设备选择下拉框,增加请选择/无选项(两个设备都可以不选择)
- 修复设备选择下拉框默认选中问题
- 更新实验请求角色权限

—— 暂时未添加”增加验证不能越过前一步添加,必须按照顺序步骤,表格增加状态“逻辑
master
zch 1 month ago
parent 0e11b6f79a
commit 7fc407fabb

@ -35,9 +35,9 @@
<div class="form-group">
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<!-- <input name="deviceName" class="form-control" type="text">-->
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option value="">请选择设备</option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>
@ -47,6 +47,7 @@
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option value="">请选择设备</option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>

@ -62,8 +62,9 @@
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.deviceName}"></option>
</select>
<input type="hidden" name="deviceName" th:value="*{deviceName}">
</div>
@ -79,8 +80,9 @@
<select name="device2Name" class="form-control m-b readonly-select"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
readonly onfocus="this.blur()" style="pointer-events: none; background-color: #eee;">
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.device2Name}"></option>
</select>
</div>

@ -53,11 +53,11 @@
<div class="form-group">
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<!-- <input name="deviceName" class="form-control" type="text">-->
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option value="">请选择设备</option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.deviceName}"></option>
</select>
</div>
@ -65,8 +65,9 @@
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option value="">请选择设备</option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.device2Name}"></option>
</select>
</div>

@ -75,8 +75,9 @@
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.deviceName}"></option>
</select>
<input type="hidden" name="deviceName" th:value="*{deviceName}">
</div>
@ -87,8 +88,9 @@
<select name="device2Name" class="form-control m-b readonly-select"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
readonly onfocus="this.blur()" style="pointer-events: none; background-color: #eee;">
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.device2Name}"></option>
</select>
</div>

@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('修改实验结果')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-experiment_request-edit" th:object="${experimentRequest}">
<input name="objid" th:field="*{objid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerName" th:field="*{customerName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<input name="projectName" th:field="*{projectName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验创建时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="creationTime" th:value="${#dates.format(experimentRequest.creationTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验执行时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="executionTime" th:value="${#dates.format(experimentRequest.executionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.deviceName}"></option>
</select>
<input type="hidden" name="deviceName" th:value="*{deviceName}">
</div>
<label class="col-sm-2 control-label">实验设备2</label>
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b readonly-select"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
readonly onfocus="this.blur()" style="pointer-events: none; background-color: #eee;">
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.device2Name}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验内容:</label>
<div class="col-sm-8">
<textarea name="experimentDesc" class="form-control" readonly>[[*{experimentDesc}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验方案:</label>
<div class="col-sm-8">
<textarea name="experimentContent" class="form-control" readonly>[[*{experimentContent}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">准备工具:</label>
<div class="col-sm-8">
<textarea name="preparationTools" class="form-control" readonly>[[*{preparationTools}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交流内容:</label>
<div class="col-sm-8">
<textarea name="communicationContent" class="form-control" readonly>[[*{communicationContent}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验结果:</label>
<div class="col-sm-8">
<textarea name="experimentResult" class="form-control">[[*{experimentResult}]]</textarea>
</div>
</div>
<div class="form-group" style="display: none;">
<label class="col-sm-3 control-label">实验请求状态:</label>
<div class="col-sm-8">
<select name="status" class="form-control m-b" th:field="*{status}" th:with="type=${@dict.getType('process_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
<input type="hidden" name="status" value="5">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "activiti/experiment_request";
$("#form-experiment_request-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-experiment_request-edit').serialize());
}
}
$("input[name='creationTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='executionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>
<style>
.readonly-select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
</style>

@ -73,26 +73,29 @@
th:value="${dict.deviceName}"></option>
</select>
</div>-->
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
disabled>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>
<input type="hidden" name="deviceName" th:value="*{deviceName}">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.deviceName}"></option>
</select>
<input type="hidden" name="deviceName" th:value="*{deviceName}">
</div>
<label class="col-sm-2 control-label">实验设备2</label>
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b readonly-select"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
readonly onfocus="this.blur()" style="pointer-events: none; background-color: #eee;">
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>
<label class="col-sm-2 control-label">实验设备2</label>
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b readonly-select"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}"
readonly onfocus="this.blur()" style="pointer-events: none; background-color: #eee;">
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}" th:selected="${dict.deviceName == experimentRequest.device2Name}"></option>
</select>
</div>
</div>
<div class="form-group">

@ -144,6 +144,7 @@
var experimentContentRole = [[${@permission.hasAnyRoles('admin,experimentContentRole')}]];
var toolsRole = [[${@permission.hasAnyRoles('admin,toolsRole')}]];
var communicationContentRole = [[${@permission.hasAnyRoles('admin,communicationContentRole')}]];
var experimentRequestRole = [[${@permission.hasAnyRoles('admin,experimentRequestRole')}]];
/* function showTimeList(objId) {
@ -238,6 +239,10 @@
$.modal.open("修改" , prefix + "/editCommunicationContent/" + objId);
}
function editResult(objId) {
$.modal.open("修改", prefix + "/editResult/" + objId);
}
$(function() {
var options = {
url: prefix + "/list",
@ -250,6 +255,7 @@
updateExperimentContentUrl: prefix + "/editExperimentContent/{id}",
updateToolsUrl: prefix + "/editTools/{id}",
updateCommunicationContentUrl: prefix + "/editCommunicationContent/{id}",
updateResultUrl: prefix + "/editResult/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
@ -291,6 +297,15 @@
field: 'experimentDesc',
title: '实验方案'
},
{
field: 'status',
title: '当前状态',
formatter: function(value, row, index) {
var dicts = [[${@dict.getType('process_status')}]];
var statusLabel = dicts.find(dict => dict.dictValue == value)?.dictLabel || value;
return statusLabel;
}
},
{
title: '操作',
align: 'center',
@ -309,6 +324,8 @@
actions.push('<a class="btn btn-success btn-xs '+ toolsRole + editFlag + '" href="javascript:void(0)" onclick="editTools(\'' + row.objid + '\')"><i class="fa fa-edit"></i>编辑准备工具</a> ');
actions.push('<a class="btn btn-success btn-xs '+ communicationContentRole + editFlag + '" href="javascript:void(0)" onclick="editCommunicationContent(\'' + row.objid + '\')"><i class="fa fa-edit"></i>编辑交流内容</a> ');
actions.push('<a class="btn btn-success btn-xs '+ editFlag + '" href="javascript:void(0)" onclick="editResult(\'' + row.objid + '\')" data-status="' + row.status + '"><i class="fa fa-edit"></i>编辑实验结果</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objid + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');

Loading…
Cancel
Save