| | |
| | | * @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: 写入你的描述 |
| | | */ |
| | |
| | | */ |
| | | function formatAreaInPut(coreHelper, idname, areaid = "") { |
| | | let area = 0; |
| | | |
| | | if ((areaid !== "")&&(areaid!==null) &&(areaid!==0)) |
| | | area = areaid.split(",").reverse()[0]; |
| | | |
| | |
| | | $.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); |
| | | }); |
| | | } |