diff --git a/ruoyi-admin/src/main/resources/templates/system/carrier/add.html b/ruoyi-admin/src/main/resources/templates/system/carrier/add.html index af10a3a1..d2b80d56 100644 --- a/ruoyi-admin/src/main/resources/templates/system/carrier/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/carrier/add.html @@ -13,7 +13,7 @@
- +
@@ -887,7 +887,7 @@ type: 'GET', data:this.params , success:((res)=>{ - this.CityList = res.data + this.CityList = res.data.filter(obj => obj.id === '36625'); }) , }); }, diff --git a/ruoyi-admin/src/main/resources/templates/system/carrier/edit.html b/ruoyi-admin/src/main/resources/templates/system/carrier/edit.html index 1dc68335..8da39c37 100644 --- a/ruoyi-admin/src/main/resources/templates/system/carrier/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/carrier/edit.html @@ -13,7 +13,7 @@
- +
@@ -130,7 +130,7 @@ url: ctx + "system/area/getSysAreaList", method: 'GET', success: function(res) { - var cities = res.data; // 假设返回的数据中有一个叫做 'cities' 的字段包含市级数据 + var cities = res.data.filter(obj => obj.id === '36625'); // 假设返回的数据中有一个叫做 'cities' 的字段包含市级数据 var $citySelect = $('#City'); // 填充城市下拉框 @@ -140,7 +140,7 @@ text: city.name })); }); - + $citySelect.val('36625'); // 初始化 select2 插件 $citySelect.select2(); }, @@ -150,42 +150,42 @@ }); // 监听城市下拉框的变化事件 - $('#City').on('change', function() { - var selectedCityId = $(this).val(); + // $('#City').on('change', function() { + // var selectedCityId = $(this).val(); + // + // // 如果未选择城市,则不执行后续操作 + // if (!selectedCityId) return; - // 如果未选择城市,则不执行后续操作 - if (!selectedCityId) return; + // 根据选中的城市ID发送请求获取对应的区级数据 + $.ajax({ + url: ctx + "system/area/getSysAreaList", + data:{parentId:'36625'}, + method: 'GET', + success: function(res) { + var areas = res.data; // 假设返回的数据中有一个叫做 'areas' 的字段包含区级数据 + var $areaSelect = $('#Area'); - // 根据选中的城市ID发送请求获取对应的区级数据 - $.ajax({ - url: ctx + "system/area/getSysAreaList", - data:{parentId:selectedCityId}, - method: 'GET', - success: function(res) { - var areas = res.data; // 假设返回的数据中有一个叫做 'areas' 的字段包含区级数据 - var $areaSelect = $('#Area'); + // 清空区级下拉框并填充数据 + $areaSelect.empty().append($('