|
@@ -1,34 +1,34 @@
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
<head>
|
|
<head>
|
|
- <th:block th:include="include :: header('修改关系中间')" />
|
|
|
|
|
|
+ <th:block th:include="include :: header('修改学区配置')" />
|
|
<th:block th:include="include :: select2-css" />
|
|
<th:block th:include="include :: select2-css" />
|
|
</head>
|
|
</head>
|
|
<body class="white-bg">
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-pv-edit" th:object="${btpSchoolPv}">
|
|
<form class="form-horizontal m" id="form-pv-edit" th:object="${btpSchoolPv}">
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
- <label class="col-sm-3 control-label is-required">派出所:</label>
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">学校:</label>
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
- <select id="pId" name="pId" th:field="*{pId}" class="form-control select2-multiple">
|
|
|
|
- <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
|
|
|
|
|
|
+ <select id="schoolId" name="schoolId" th:field="*{schoolId}" class="form-control select2-multiple">
|
|
|
|
+ <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
|
|
</select>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
- <label class="col-sm-3 control-label is-required">委(村):</label>
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">派出所:</label>
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
- <select id="vId" class="form-control select2-multiple" multiple>
|
|
|
|
- <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}"
|
|
|
|
- th:selected="${#arrays.contains(btpSchoolPv.id.split(','),village.pvId.toString())}"></option>
|
|
|
|
|
|
+ <select id="pId" name="pId" th:field="*{pId}" class="form-control select2-multiple">
|
|
|
|
+ <option th:each="policestation:${policestations}" th:value="${policestation.pvId}" th:text="${policestation.pvName}"></option>
|
|
</select>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
- <label class="col-sm-3 control-label is-required">学校:</label>
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">委(村):</label>
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
- <select id="schoolId" name="schoolId" th:field="*{schoolId}" class="form-control select2-multiple">
|
|
|
|
- <option th:each="school:${schools}" th:value="${school.schoolId}" th:text="${school.schoolName}"></option>
|
|
|
|
|
|
+ <select id="vId" name="vId" class="form-control select2-multiple" multiple>
|
|
|
|
+ <option th:each="village:${villages}" th:value="${village.pvId}" th:text="${village.pvName}"
|
|
|
|
+ th:selected="${#arrays.contains(btpSchoolPv.id.split('_')[1].split(','),village.pvId.toString())}"></option>
|
|
</select>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -37,7 +37,7 @@
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: select2-js" />
|
|
<th:block th:include="include :: select2-js" />
|
|
<script th:inline="javascript">
|
|
<script th:inline="javascript">
|
|
- var prefix = ctx + "schooldistrict/config";
|
|
|
|
|
|
+ var prefix = ctx + "schooldistrict/config", removeId = [[${btpSchoolPv.id}]];
|
|
$("#form-pv-edit").validate({
|
|
$("#form-pv-edit").validate({
|
|
focusCleanup: true
|
|
focusCleanup: true
|
|
});
|
|
});
|
|
@@ -45,33 +45,37 @@
|
|
function submitHandler() {
|
|
function submitHandler() {
|
|
if ($.validate.form()) {
|
|
if ($.validate.form()) {
|
|
var data = $("#form-pv-edit").serializeArray();
|
|
var data = $("#form-pv-edit").serializeArray();
|
|
|
|
+ data.push({"name": "removeId", "value": removeId});
|
|
var vIds = $.form.selectSelects("vId");
|
|
var vIds = $.form.selectSelects("vId");
|
|
data.push({"name": "id", "value": vIds});
|
|
data.push({"name": "id", "value": vIds});
|
|
$.operate.save(prefix + "/edit", data);
|
|
$.operate.save(prefix + "/edit", data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function getData(array) {
|
|
|
|
+ $.each(array, function (index, item) {
|
|
|
|
+ item.id = item.pvId;
|
|
|
|
+ item.text = item.pvName;
|
|
|
|
+ })
|
|
|
|
+ return array;
|
|
|
|
+ }
|
|
|
|
+
|
|
$(function() {
|
|
$(function() {
|
|
$('#pId').select2({
|
|
$('#pId').select2({
|
|
- placeholder: "请选择派出所",
|
|
|
|
- allowClear: false
|
|
|
|
|
|
+ placeholder: "请选择派出所"
|
|
}).on('select2:select', function (e) {
|
|
}).on('select2:select', function (e) {
|
|
$.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
|
|
$.get("/schooldistrict/policestationvillage/getPolicestationVillagesByParentId?parentId=" + this.value, function(result) {
|
|
$('#vId').empty().select2({
|
|
$('#vId').empty().select2({
|
|
data: getData(result),
|
|
data: getData(result),
|
|
- placeholder: "请选择委(村)",
|
|
|
|
- allowClear: false
|
|
|
|
|
|
+ placeholder: "请选择委(村)"
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- $('#pId').trigger("select");
|
|
|
|
$('#vId').select2({
|
|
$('#vId').select2({
|
|
- placeholder: "请选择委(村)",
|
|
|
|
- allowClear: false
|
|
|
|
|
|
+ placeholder: "请选择委(村)"
|
|
});
|
|
});
|
|
$('#schoolId').select2({
|
|
$('#schoolId').select2({
|
|
- placeholder: "请选择学校",
|
|
|
|
- allowClear: false
|
|
|
|
|
|
+ placeholder: "请选择学校"
|
|
});
|
|
});
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|