From 25bad9a765c608079258012766a37a571b5243aa Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期三, 10 四月 2024 13:40:04 +0800 Subject: [PATCH] 处理推广Bug --- CoreCms.Net.Web.Admin/wwwroot/views/liao.js | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/liao.js b/CoreCms.Net.Web.Admin/wwwroot/views/liao.js index b03b48e..94fb7bd 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/liao.js +++ b/CoreCms.Net.Web.Admin/wwwroot/views/liao.js @@ -3,7 +3,7 @@ * @Author: 灏忛渚� * @Date: 2024-03-01 09:11:24 * @LastEditors: Please set LastEditors - * @LastEditTime: 2024-04-01 12:39:54 + * @LastEditTime: 2024-04-10 13:37:35 * Copyright: 2024 MinTinge CO.,LTD. All Rights Reserved. * @Descripttion: 鍐欏叆浣犵殑鎻忚堪 */ @@ -78,6 +78,7 @@ */ function formatAreaInPut(coreHelper, idname, areaid = "") { let area = 0; + if ((areaid !== "")&&(areaid!==null) &&(areaid!==0)) area = areaid.split(",").reverse()[0]; @@ -87,20 +88,37 @@ $.each(data, function (i, n) { str += `<select lay-ignore name='${idname}_` + (i + 1) + "' dep='" + (i + 1) + "' class='select-address'>"; str += "<option value='' >璇烽�夋嫨</option>"; - $.each(n.list, function (h, z) { + + if(n?.list?.length>0) + { + $.each(n.list, function (h, z) { if (n.hasOwnProperty('info') && n.info?.id == z.id) { str += "<option value='" + z.id + "' selected='selected'>" + z.name + "</option>"; } else { str += "<option value='" + z.id + "' >" + z.name + "</option>"; } }); + } + else + { + $.each(n.thisList, function (h, z) { + if (n.hasOwnProperty('info') && n.info?.id == z.id) { + str += "<option value='" + z.id + "' selected='selected'>" + z.name + "</option>"; + } else { + str += "<option value='" + z.id + "' >" + z.name + "</option>"; + } + }); + } str += "</select>"; }); $(`input[name='${idname}']`).after(str); //浠ヤ笂鏁版嵁杈撳嚭瀹岋紝浠ヤ笅缁戝畾浜嬩欢 $.each(data, function (i, n) { if (i < (data.length)) { - $(`select[name='${idname}_` + (i + 1) + "']").change(function () { + // $(`select[name='${idname}_` + (i + 1) + "']").change(function () { + // changeareaIdArea(i + 1, data.length, idname); + // }); + $(`select[name='${idname}_` + (i + 1) + "']").click(function () { changeareaIdArea(i + 1, data.length, idname); }); } -- Gitblit v1.9.1