更改市区选择方式

master
dshclm 10 months ago
parent 1a36258039
commit 210db3de47

File diff suppressed because it is too large Load Diff

@ -38,6 +38,7 @@
<script th:src="@{/ajax/libs/layui/layui.min.js?v=2.7.5}"></script> <script th:src="@{/ajax/libs/layui/layui.min.js?v=2.7.5}"></script>
<script th:src="@{/ruoyi/js/common.js?v=4.7.7}"></script> <script th:src="@{/ruoyi/js/common.js?v=4.7.7}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js?v=4.7.7}"></script> <script th:src="@{/ruoyi/js/ry-ui.js?v=4.7.7}"></script>
<script th:src="@{/ruoyi/js/vue.js?v=4.7.7}"></script>
</div> </div>
<!-- ztree树插件 --> <!-- ztree树插件 -->

@ -5,18 +5,28 @@
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-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" id="app">
<form class="form-horizontal m" id="form-train-add"> <form class="form-horizontal m" id="form-train-add">
<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">
<input name="AREAID" class="form-control" type="text" required> <select id="City" name="AREAID" required @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">请选择</option>
<option v-for="option in CityList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">所属区县:</label> <label class="col-sm-3 control-label">所属区县:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="FRAMEWORK" class="form-control" type="text" required> <select id="Area" name="FRAMEWORK" v-model="Area" class="form-control m-b">
<option value="">请选择</option>
<option v-for="option in AreaList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -101,6 +111,48 @@
$("#form-train-add").validate({ $("#form-train-add").validate({
focusCleanup: true focusCleanup: true
}); });
var app = new Vue({
el: '#app',
data: {
CityList: [],
AreaList:[],
City:'',
Area:'',
params:{
parentId:'',
}
},
mounted(){
// 初始化地市列表
this.getCityList();
if (this.City){
this.getAreaList()
}
},
methods:{
getCityList(){
$.ajax({
url: ctx + "system/area/getSysAreaList",
type: 'GET',
data:this.params ,
success:((res)=>{
this.CityList = res.data
}) ,
});
},
getAreaList(){
this.params.parentId = this.City
$.ajax({
url: ctx + "system/area/getSysAreaList",
type: 'GET',
data:this.params,
success:((res)=>{
this.AreaList = res.data
}) ,
});
}
}
})
layui.use('laydate', function(){ layui.use('laydate', function(){
var laydate = layui.laydate; var laydate = layui.laydate;
@ -121,7 +173,6 @@
} }
} }
}); });
var endDate = laydate.render({ var endDate = laydate.render({
elem: '#laydate-endTime', elem: '#laydate-endTime',
theme: 'molv', theme: 'molv',

@ -5,19 +5,29 @@
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-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" id="app">
<form class="form-horizontal m" id="form-train-edit" th:object="${tdTrain}"> <form class="form-horizontal m" id="form-train-edit" th:object="${tdTrain}">
<input name="ID" th:field="*{ID}" type="hidden"> <input name="ID" th:field="*{ID}" type="hidden">
<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">
<input name="AREAID" th:field="*{AREAID}" class="form-control" type="text" required> <select id="City" name="AREAID" required @change="getAreaList()" v-model="City" class="form-control m-b">
<option value="">请选择</option>
<option v-for="option in CityList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">所属区县:</label> <label class="col-sm-3 control-label">所属区县:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="FRAMEWORK" th:field="*{FRAMEWORK}" class="form-control" type="text"> <select id="Area" name="FRAMEWORK" v-model="Area" class="form-control m-b">
<option value="">请选择</option>
<option v-for="option in AreaList" :value="option.id" :key="option.id">
{{ option.name }}
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -74,11 +84,54 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/train"; var prefix = ctx + "system/train";
$("#form-train-edit").validate({ $("#form-train-edit").validate({
focusCleanup: true focusCleanup: true
}); });
var app = new Vue({
el: '#app',
data: {
CityList: [],
AreaList:[],
City:[[${tdTrain.AREAID}]],
Area:[[${tdTrain.FRAMEWORK}]],
params:{
parentId:'',
}
},
mounted(){
// 初始化地市列表
this.getCityList();
if (this.City){
this.getAreaList()
}
},
methods:{
getCityList(){
$.ajax({
url: ctx + "system/area/getSysAreaList",
type: 'GET',
data:this.params ,
success:((res)=>{
this.CityList = res.data
}) ,
});
},
getAreaList(){
this.params.parentId = this.City
$.ajax({
url: ctx + "system/area/getSysAreaList",
type: 'GET',
data:this.params,
success:((res)=>{
this.AreaList = res.data
}) ,
});
}
}
})
layui.use('laydate', function(){ layui.use('laydate', function(){
var laydate = layui.laydate; var laydate = layui.laydate;

Loading…
Cancel
Save