首页 > 其他分享 >1111

1111

时间:2023-08-18 19:23:31浏览次数:32  
标签:const 1111 defaultVal time date type dateTemp

import dayjs from 'dayjs'; import { nextTick } from 'vue'; import { useDictStore } from '/@/store/modules/dict'; import { useI18n } from '/@/hooks/web/useI18n';
const dictStore = useDictStore(); const { t } = useI18n();
export type Dimension = 'year' | 'month' | 'date' | 'time';
export const defaultValueMap = {   year: dayjs(),   month: dayjs(),   date: dayjs(),   time: dayjs(), };
export const defaultFormatMap = {   year: 'YYYY',   month: 'YYYY-MM',   date: 'YYYY-MM-DD',   time: 'YYYY-MM-DD HH', };
export const disableMap = {   year: {     type: 'year',     value: 2,   },   month: {     type: 'month',     value: 11,   },   date: {     type: 'days',     value: 30,   },   time: {     type: 'days',     value: 1,   }, };
/**  * @description: 维度操作方法  * @param {Dimension} defaultVal 默认维度  * @param {string} field rangePicker 字段ID  * @param {any} formActionType 表单操作  * @return {*}  */ export const dimensionAction = (defaultVal: Dimension, field: string, formActionType: any) => {   const { updateSchema, setFieldsValue } = formActionType;
  let hackValue: any = undefined;
  let disable: any = disableMap[defaultVal];   let dateTemp: any = defaultValueMap[defaultVal];   let format: any = defaultFormatMap[defaultVal];
  const disabledDate = (current) => {     if (!dateTemp || dateTemp.length === 0 || disable.type === 'year') {       // 年份不做限制,数据量过大,会导致弹框卡顿       return false;     }     const tooLate = current && current.diff(dateTemp[0], disable.type) > disable.value;     const tooEarly = dateTemp[1] && dateTemp[1].diff(current, disable.type) > disable.value;     return tooEarly || tooLate;   };
  const calendarChange = (date) => {     dateTemp = date;   };
  const openChange = (open: boolean) => {     if (open) {       hackValue = [];       dateTemp = [];     } else {       hackValue = undefined;     }
    setFieldsValue({       [field]: hackValue || dateTemp,     });   };
  nextTick(() => {     setFieldsValue({       [field]: hackValue || dateTemp,     });   });
  return {     options: dictStore.getTimeRange.map((item) => ({       label: t(`common.${item}`),       value: item,     })),     placeholder: `${t('common.chooseText')}${t('energy-balance.queryTime')}`,     useSearch: true,     onChange: (queryType) => {       disable = disableMap[queryType];       dateTemp = defaultValueMap[queryType];       format = defaultFormatMap[queryType];
      setFieldsValue({         timeRange: hackValue || dateTemp,       });
      updateSchema({         field,         componentProps: {           format: format,           showTime: queryType === 'time',           picker: queryType === 'time' ? 'date' : queryType,           disabledDate: disabledDate,           onCalendarChange: calendarChange,           onOpenChange: openChange,         },       });     },   }; };
/**  * @description: 重置维度和时间范围  * @return {*}  */ export const resetPicker = (   defaultVal: Dimension,   dimensionField: string,   timeRangeField: string,   formActionType: any, ) => {   const { updateSchema, setFieldsValue } = formActionType;
  updateSchema({     field: timeRangeField,     componentProps: {       format: defaultFormatMap[defaultVal],       showTime: defaultVal === 'time',       picker: defaultVal === 'time' ? 'date' : defaultVal,     },   });
  setFieldsValue({     [dimensionField]: defaultVal,     [timeRangeField]: defaultValueMap[defaultVal],   }); };

标签:const,1111,defaultVal,time,date,type,dateTemp
From: https://www.cnblogs.com/zhangyuanbi/p/17641419.html

相关文章

  • 使用Automatic1111在本地PC上运行SDXL 1.0
    这是我们部署StableDiffusion的第三篇文章了,前两篇文章都详细介绍了Automatic1111的stable-diffusion-webui的安装,这次主要介绍如何使用SDXL1.0模型。https://avoid.overfit.cn/post/3f640647d3eb4360ade44ee997091c87获取项目......
  • 1111
    redis的配置sudocat/etc/redis/redis.confredis安装成功以后,window下的配置文件保存在软件安装目录下,如果是mac或者linux,则默认安装/etc/redis/redis.conf3.2.1redis的核心配置选项redis与mysql类似,也是C/S架构的软件,所以存在客户端和服务端,默认的redis的服务端时re......
  • 111111111111
    ##----------PromptGenModule-----------------------classPromptGenBlock(nn.Module):def__init__(self,prompt_dim=128,prompt_len=5,prompt_size=96,lin_dim=192):super(PromptGenBlock,self).__init__()self.prompt_param=nn.Paramet......
  • 1111
    classGet_gradient_nopadding(nn.Module):def__init__(self):super(Get_gradient_nopadding,self).__init__()kernel_v=[[0,-1,0],[0,0,0],[0,1,0]]kernel_h=[[0,0,0],......
  • 111111
    defmake_layer(block,n_layers):layers=[]for_inrange(n_layers):layers.append(block())returnnn.Sequential(*layers)classResidualDenseBlock_5C(nn.Module):def__init__(self,nf=64,gc=32,bias=True):super(Residu......
  • ABAP-ALV1111
    *&---------------------------------------------------------------------**&ReportZALV1*&*&---------------------------------------------------------------------**&*&*&-----------------------------------------------------......
  • 111111
    ......
  • 1111.Django后台
    一、diango后台在项目的目录下我们会看到这样一个url的配置,你有自己去访问这个url地址吗?访问之后发现了什么呢?其实就是django的后台登录界面。前端访问 127.0.0.1:8000/admin/之后就会进入django的后台登录界面。1.Django管理界面为你的员工或客户生成一个用户添加,修改和......
  • 1111
    <!DOCTYPEhtml><html><head><title>图片过渡效果</title><style>.container{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;......
  • 11111111111
    importtorchfromtorchimportnnimportnumpyasnpimportmatplotlib.pyplotaspltfromPILimportImagefromtorchvisionimporttransformsfrommathimportsqrtimportosos.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"#读取两张图像img1=I......