You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>选择城市</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../static/css/font.css">
<link rel="stylesheet" href="../../static/css/weadmin.css">
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
select {
width: 150px;
height: 38px;
line-height: 38px;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 15px;
padding-left: 6px;
color: #666;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item">
<div class="layui-input-inline" id="select_3" style="width:288px"></div>
<script type="text/html" id="test3">
<select name="service_type" id="sel3">
<% for (var i = 0; i < data.length; i ++) { %>
<option value="<%=data[i].city_id%>"><%=data[i].city_name%></option>
<% } %>
</select>
</script>
<button class="layui-btn" lay-filter="add" lay-submit="" id="save">确定</button>
</div>
</form>
</div>
<script src="../../lib/layui/layui.js"></script>
<script src="../../lib/template.js"></script>
<script src="../../lib/base64.js"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'laytpl', 'admin', 'layer', 'table'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer,
table = layui.table,
laytpl = layui.laytpl;
//绑定数据
window.bindSelect = function () {
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/baseService/base/getAllUserCity",
success: function (data) {
var html = template.render('test3', data);
document.getElementById('select_3').innerHTML = html;
form.render();
}
});
};
bindSelect();
//监听提交
form.on('submit(add)', function (data) {
var val = $('#sel3').val();
parent.$("#area_id").val(val);
parent.$("#level_id").val("2");
parent.$("#regionTree").show();
//绑定下拉树
parent.bindSelectTree();
//显示地区名称
parent.$("#area").val(parent.getAreaNameByAreaId());
parent.bindtable();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
});
</script>
</body>
</html>