2107.10.10 全选和自动任务

分享人:李俊


1. 全选

在对数据进行批量操作的时候,单个选择很繁琐,若是在每一条数据前加一个选择框,并且配上一个全选框能够简化很多操作。具体方法:

  • 在画表格时加入:

    

  • 编写方法:
$scope.checkedList = [];
        //checkbox全选     
        $scope.isSelectAll = false;
        $scope.selectAll = function () {
            if ($scope.isSelectAll) {
                $scope.checkedList = [];
                angular.forEach($scope.monitorRemindList, function (i) {
                    i.checked = true;
                    $scope.checkedList.push(i.MR_Tid);
                    $scope.monitorList.push(i);
                });
            } else {
                angular.forEach($scope.monitorRemindList, function (i) {
                    i.checked = false;
                    $scope.checkedList = [];
                    $scope.monitorList = [];
                });
            }
        };
        $scope.selectOne = function () {
            angular.forEach($scope.monitorRemindList, function (i) {
                var index = $scope.checkedList.indexOf(i.MR_Tid);
                if (i.checked && index === -1) {
                    $scope.checkedList.push(i.MR_Tid);
                    $scope.monitorList.push(i);
                } else if (!i.checked && index !== -1) {
                    $scope.checkedList.splice(index, 1);
                }
            });
            if ($scope.monitorRemindList.length == $scope.checkedList.length) {
                $scope.isSelectAll = true
            } else {
                $scope.isSelectAll = false;
            }
        };

  • 效果:
2107.10.10 全选和自动任务_第1张图片
image.png

2. 自动任务

在进行增删改查等操作之前,先对数据自动进行删选,如监控某人的证件是否即将到期,人为对证件的到期日期查询很繁琐,如果能够自动监控到期日期的话更方便直接,还能防止遗漏。具体方法:

  • 在Bll的Business文件夹下编写自动任务的方法,即你要自动的具体操作,在本实例中是要自动对语言资质表、运行资质表等数据表中的到期日期进行监控,将还有30天到期的数据自动删选并存放在一个监控提醒表中:
public class BsQtMrMonitorRemindInfo
   {
       public static void GetMonitorRemindInfoList(DB.IInnerLoginUser loginUser)
       {
           DB.QtMrMonitorRemind mr = new QtMrMonitorRemind();
           ///语言资质
           Model.QtUiLanguageQualif languageSearch = new Model.QtUiLanguageQualif();
           languageSearch.Status = Model.Enums.ActiveStatus.Enable;
           Model.QtUiLanguageQualif[] language = new DB.QtUiLanguageQualif().GetLanguageQualifList(loginUser, languageSearch, null);
           language = language.Where(p => p.LQ_DueDate < DateTime.Now.AddDays(30)).ToArray();
           foreach (var languageitem in language)
           {
               Model.QtMrMonitorRemind remind = new Model.QtMrMonitorRemind();
               remind.oper.SetRecordModify();
               remind.MR_UserTid = languageitem.LQ_UserTid;
               remind.MR_Department = "";
               remind.MR_DueDate = languageitem.LQ_DueDate;
               remind.MR_MobilePhone = "";
               //remind.MR_MonitorType = 0;
               remind.MR_NoticeWay = 0;
               remind.MR_PushDate = DateTime.Now;
               remind.MR_PushStatus = 0;
               //通过子项code反查menu
               Model.QtBiQualifTypeCode searchcode = new Model.QtBiQualifTypeCode();
               searchcode.QT_QualificationCode = languageitem.LQ_QualificationCode;
               Model.QtBiQualifTypeCode[] codes = DB.QtBiQualifTypeCode.GetQualifTypeCode(loginUser, searchcode);
               if (codes.Length > 0)
               {
                   remind.MR_QulifyName = codes[0].QT_QualificationName;
                   if (codes[0].QT_Type == Model.Enums.QualificationType.Chinese)
                   {
                       remind.MR_MonitorType = Model.Enums.MonitorType.Chinese;
                   }
                   if (codes[0].QT_Type == Model.Enums.QualificationType.English)
                   {
                       remind.MR_MonitorType = Model.Enums.MonitorType.English;
                   }
               }
               remind.MR_RefCode = languageitem.LQ_QualificationCode;
               remind.MR_Reward = "";
               remind.MR_SendTime = 0;
               remind.MR_UserName = languageitem.LQ_UserName;
               remind.CreateId = languageitem.CreateId;
               remind.LastGuid = languageitem.LastGuid;
               remind.ProxyUserId = languageitem.ProxyUserId;
               remind.Status = languageitem.Status;
               remind.UpdateDate = languageitem.UpdateDate;
               remind.UpdateId = languageitem.UpdateId;
               mr.AddMonitorRemind(loginUser, remind);
           }
  • 在WinForm的Auto文件夹中调用前面的自动任务方法:
public void SyncFocCrewList()
        {
            try
            {
                DB.Business.BsQtMrMonitorRemindInfo.GetMonitorRemindInfoList(DB.Config.systemAdmin);
            }
            catch (Exception e)
            {
                Common.Logger.Fatal("【AutoRunSyncFocCrewList】" + e.Message);
            }
        }


你可能感兴趣的:(2107.10.10 全选和自动任务)