新增根據位置 進入校園的搜尋條件

This commit is contained in:
威勝 張 2024-04-24 12:51:45 +08:00
parent 802cad71aa
commit c5aaca4df4
3 changed files with 57 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:2361", "applicationUrl": "http://140.125.20.183:2361",
"sslPort": 44352 "sslPort": 44352
} }
}, },
@ -11,7 +11,7 @@
"Parking_spaces": { "Parking_spaces": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "http://localhost:5173", "applicationUrl": "http://140.125.20.183:5173",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },

View File

@ -14,6 +14,8 @@
<button style="height:30px;float:right " class="btn btn-outline-secondary" onclick="serch_click()">搜尋</button> <button style="height:30px;float:right " class="btn btn-outline-secondary" onclick="serch_click()">搜尋</button>
<input type="text" style="float:right" placeholder="請輸入車牌 ex:ABC4321" id="serch_text_id" /> <input type="text" style="float:right" placeholder="請輸入車牌 ex:ABC4321" id="serch_text_id" />
<br/>
<select style="width:10%" id="location_select_id" onchange="location_select()"></select>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -132,6 +134,31 @@
} }
}); });
*/ */
var select = document.getElementById("location_select_id")
$.ajax({
type: "GET",
url: "http://140.125.20.183:7700/api/Yuntech_in_car_table/location_name" ,
data: {},
headers: {
'Authorization': token
},
contentType: "application/json",
headers: {
'Authorization': token
},
success: function (Model) {
console.log(Model)
// 清除现有的选项
select.innerHTML = "";
// 添加新的选项
Model.forEach(function (item) {
var option = document.createElement('option');
option.text = item.location_name;
select.add(option);
});
}
});
} }
@ -370,6 +397,33 @@
} }
</script> </script>
<!--透過進入位置搜尋-->
<script>
function location_select() {
var select_location = document.getElementById("location_select_id").value
console.log(select_location)
$.ajax({
type: "GET",
url: "http://140.125.20.183:7700/api/Yuntech_in_car_table/location-" + select_location,
data: {},
headers: {
'Authorization': token
},
contentType: "application/json",
headers: {
'Authorization': token
},
success: function (Model) {
//console.log(Model)
All_Model = Model
set_data(Model)
}
});
}
</script>
<!--檢查token--> <!--檢查token-->
<script> <script>
var token var token

View File

@ -232,7 +232,7 @@
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: 'Park_spaces/Parking_spaces_total_table', url: 'Park_spaces/Parking_spaces_total_table',
//url: 'http://localhost:5173/Users/token', //url: 'http://140.125.20.183:5173/Users/token',
headers: { headers: {
'Authorization': token 'Authorization': token
}, },