场所出入登记修改

pg_adapter
dshclm 8 months ago
parent b07e86ddb4
commit 7711bbce58

@ -16,7 +16,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label is-required">场所名称:</label> <label class="col-sm-4 control-label is-required">场所名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="placeName" name="placeName" onchange="doPlaceName()" required class="form-control"> <select id="placeName" onchange="doPlaceName()" required class="form-control">
<option value="">请选择场所名称</option> <option value="">请选择场所名称</option>
</select> </select>
</div> </div>
@ -150,9 +150,11 @@
} }
}); });
}); });
var placeName = ''
function doPlaceName(){ function doPlaceName(){
var selectedOption = $('#placeName option:selected'); var selectedOption = $('#placeName option:selected');
var placeId = selectedOption.val(); var placeId = selectedOption.val();
placeName = selectedOption.text();
$("input[name='placeId']").val(placeId); $("input[name='placeId']").val(placeId);
} }
function selectDeptTree() { function selectDeptTree() {
@ -176,8 +178,10 @@
} }
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-placeRegist-add').serialize()); var data = $("#form-placeRegist-add").serializeArray();
console.log($('#form-placeRegist-add').serialize()); data.push({"name": "placeName", "value": placeName});
$.operate.save(prefix + "/add", data);
console.log(data);
} }
} }
</script> </script>

@ -17,7 +17,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label is-required">场所名称:</label> <label class="col-sm-4 control-label is-required">场所名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="placeName" name="placeName" onchange="doPlaceName()" required class="form-control"> <select id="placeName" onchange="doPlaceName()" required class="form-control">
<option value="">请选择场所名称</option> <option value="">请选择场所名称</option>
</select> </select>
</div> </div>
@ -158,10 +158,11 @@
} }
}); });
}); });
var placeName = ''
function doPlaceName(){ function doPlaceName(){
var selectedOption = $('#placeName option:selected'); var selectedOption = $('#placeName option:selected');
var placeId = selectedOption.val(); var placeId = selectedOption.val();
placeName = selectedOption.text();
$("input[name='placeId']").val(placeId); $("input[name='placeId']").val(placeId);
} }
function selectDeptTree() { function selectDeptTree() {
@ -185,7 +186,9 @@
} }
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-placeRegist-edit').serialize()); var data = $("#form-placeRegist-edit").serializeArray();
data.push({"name": "placeName", "value": placeName});
$.operate.save(prefix + "/edit",data);
console.log($('#form-placeRegist-edit').serialize()); console.log($('#form-placeRegist-edit').serialize());
} }
} }

@ -14,6 +14,14 @@
<label>场所名称:</label> <label>场所名称:</label>
<input type="text" name="placeName"></input> <input type="text" name="placeName"></input>
</li> </li>
<li>
<label>登记人员:</label>
<input type="text" name="registName"></input>
</li>
<li>
<label>登记日期:</label>
<input type="text" class="time-input" placeholder="请选择登记日期" name="registTime"/>
</li>
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -45,23 +53,6 @@
var editFlag = [[${@permission.hasPermi('system:placeRegist:edit')}]]; var editFlag = [[${@permission.hasPermi('system:placeRegist:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:placeRegist:remove')}]]; var removeFlag = [[${@permission.hasPermi('system:placeRegist:remove')}]];
var prefix = ctx + "system/placeRegist"; var prefix = ctx + "system/placeRegist";
var placeCache = {};
// 预加载数据函数
function loadPlacesData() {
var apiUrl = ctx + 'system/place/getList';
return $.ajax({
url: apiUrl,
method: 'POST',
dataType: 'json'
}).done(function(data) {
data.data.forEach(function(item) {
placeCache[item.id] = item.placeName;
});
}).fail(function(xhr, status, error) {
console.error('预加载数据失败:', error);
});
}
$(function() { $(function() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
@ -86,9 +77,6 @@
{ {
field: 'placeName', field: 'placeName',
title: '场所名称', title: '场所名称',
formatter:function (value, row, index){
return placeCache[value] || '加载中...';
}
}, },
{ {
field: 'registName', field: 'registName',
@ -161,11 +149,6 @@
}; };
$.table.init(options); $.table.init(options);
}); });
$(document).ready(function() {
loadPlacesData().done(function() {
$('#bootstrap-table').bootstrapTable('refresh');
});
});
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save