username@email.com
2024-04-02 7fdf7d7bd39cd0381c3969ad6302be0e693cad2d
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-03-21 09:47:04
 * @LastEditTime: 2024-04-01 12:39:54
 * Copyright: 2024  MinTinge CO.,LTD. All Rights Reserved.
 * @Descripttion: 写入你的描述
 */
@@ -78,7 +78,7 @@
 */
function formatAreaInPut(coreHelper,idname,areaid="") {
  let area=0;
  if(areaid!=="")
    if ((areaid !== "")&&(areaid!==null) &&(areaid!==0))
   area= areaid.split(",").reverse()[0];
  
  coreHelper.Post("Api/Tools/GetAreaCheckedList", { id: Number(area) }, function (data) {
@@ -157,3 +157,62 @@
    }
}
}
/**
 * 根据用户选择,格式化并更新 select 输入元素中的选项。
 * @param {object} coreHelper 核心辅助对象,用于执行 post 请求等操作。
 * @param {object} form 表单对象,用于重新渲染 select 元素。
 * @param {string} idname select 元素的 id 名称。
 */
function formatUserSelInPut(coreHelper, form, idname,selectedID="") {
    // 向服务器发送请求,获取用户列表
    coreHelper.PostForm("Api/CommonAPI/GetUserList", { sKey: "" }, function (data) {
        if (debug) { console.log(data); } // 如果处于调试模式,打印返回的数据
        if (data.code == 0) {
            // 获取指定 id 的 select 元素
            var selectElement = document.getElementById(idname);
            // 遍历返回的用户数据,为 select 元素创建并添加新的 option 选项
            for (var i = 0; i < data.data.length; i++) {
                var option = document.createElement('option');
                option.value = data.data[i].id;
                if(selectedID==data.data[i].id){
                    option.selected=true;
                }
                option.innerHTML = data.data[i].name;
                selectElement.appendChild(option);
            }
            // 重新渲染 select 元素,确保新的选项生效
            form.render('select');
        }
    })
}
Date.prototype.Format = function (fmt) {
    //author: meizz
    var o = {
      "M+": this.getMonth() + 1, //月份
      "d+": this.getDate(), //日
      "h+": this.getHours(), //小时
      "m+": this.getMinutes(), //分
      "s+": this.getSeconds(), //秒
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
    };
    if (/(y+)/.test(fmt))
      fmt = fmt.replace(
        RegExp.$1,
        (this.getFullYear() + "").substr(4 - RegExp.$1.length)
      );
    for (var k in o)
      if (new RegExp("(" + k + ")").test(fmt))
        fmt = fmt.replace(
          RegExp.$1,
          RegExp.$1.length == 1
            ? o[k]
            : ("00" + o[k]).substr(("" + o[k]).length)
        );
    return fmt;
  };