车辆归属的船舶

This commit is contained in:
2025-06-24 08:59:42 +08:00
parent 6f541557f8
commit 92a73d4361
7 changed files with 488 additions and 5 deletions
+39
View File
@@ -94,6 +94,15 @@
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required"><?= $translations['ship'] ?? '运输船舶' ?></label>
<div class="layui-input-block">
<select name="ship_id" lay-filter="category" required lay-verify="required" id="ship_id" required>
<option value=""><?= $translations['please_ship'] ?? '请选择船舶' ?></option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required"><?= $translations['final_location'] ?? '最终目的地' ?></label>
@@ -194,6 +203,36 @@
layer.msg('请求失败: ' + xhr.status);
}
});
$.ajax({
url: '/app/admin/logisticsShip/getAll',
type: 'GET',
dataType: 'json',
success: function(res) {
if (res.code !== 0) {
layer.msg(res.msg || '加载失败');
return;
}
const select = $('#ship_id');
select.empty().append("<option value=''><?= $translations['please_ship'] ?? '请选择船舶' ?></option>");
$.each(res.data, function(index, item){
select.append(`<option value="${item.id}">${item.ship_name}</option>`);
});
// 重新渲染下拉框
form.render('select');
// 如果有回调函数,执行回调
if (typeof callback === 'function') {
callback();
}
},
error: function(xhr) {
layer.msg('请求失败: ' + xhr.status);
}
});
}
loadOptions();