修复默认选中问题

This commit is contained in:
liaozetao
2023-11-13 11:31:58 +08:00
parent 00185eefdc
commit 9598310a1d
2 changed files with 13 additions and 14 deletions

View File

@@ -16,17 +16,15 @@ export default {
}, },
// 设置默认值 // 设置默认值
setDef: function (idstr, defval) { setDef: function (idstr, defval) {
if (defval) { for (let i = 0, len = $(idstr + ' option').length; i < len; i++) {
for (let i = 0, len = $(idstr + ' option').length; i < len; i++) { let $option = $(idstr + ' option:eq(' + i + ')');
let $option = $(idstr + ' option:eq(' + i + ')'); if ($option.val() == defval) {
if ($option.val() == defval) { $option.prop('selected', true);
$option.prop('selected', true); } else {
} else { $option.prop('selected', false);
$option.prop('selected', false);
}
} }
$(idstr).btComboBox('parse');
} }
$(idstr).btComboBox('parse');
}, },
// 构建下拉组合框 // 构建下拉组合框
build: function (val, idstr, defval) { build: function (val, idstr, defval) {

View File

@@ -587,6 +587,12 @@ export default {
$("#nobleId").btComboBox('disable'); $("#nobleId").btComboBox('disable');
ComboboxHelper.setDef("#nobleId", '0'); ComboboxHelper.setDef("#nobleId", '0');
ComboboxHelper.setDef("#enable", '2'); ComboboxHelper.setDef("#enable", '2');
$("input:radio[name='enable']")[0].checked = true;
$("input:radio[name='isSale']")[0].checked = true;
$("input:radio[name='isNobleLimit']")[0].checked = true;
$("input:radio[name='isMonsterLimit']")[0].checked = true;
$("input:radio[name='isWeekStarLimit']")[0].checked = true;
$("input:radio[name='isActivityLimit']")[0].checked = true;
}); });
$("#nobleId").on('change', function () { $("#nobleId").on('change', function () {
if (ComboboxHelper.getSelected("#nobleId") != 0) { if (ComboboxHelper.getSelected("#nobleId") != 0) {
@@ -882,11 +888,6 @@ export default {
$("#tipModal").modal('show'); $("#tipModal").modal('show');
return; return;
} }
if (!effect) {
$("#tipMsg").text("请上传动画图片");
$("#tipModal").modal('show');
return;
}
if (!days || days <= 0) { if (!days || days <= 0) {
$("#tipMsg").text("请输入合理的购买天数"); $("#tipMsg").text("请输入合理的购买天数");
$("#tipModal").modal('show'); $("#tipModal").modal('show');