Commit 1b56a1c9 by liuyang

2024-07-26 设备管理新增供应商,联系人,联系电话地址, 保养周期天数

parent b8afae88
......@@ -56,7 +56,7 @@ public enum DdynamicEnum {
* 用途:供应商档案下拉框
* 编写:
*/
SUP_RECORD_BLOCK_ID("sup_record_block_id","supCode","supName","HGPZ003.queryComboBox"),
SUP_RECORD_BLOCK_ID("sup_record_block_id","supCode","supName","headName","phoneName","address","HGPZ003.queryComboBox"),
/**
* 模块:存货类型
......
......@@ -309,7 +309,10 @@
resultClass="java.util.HashMap">
SELECT DISTINCT
SUP_CODE as "supCode",
SUP_NAME as "supName"
SUP_NAME as "supName",
HEAD_NAME as "headName", <!-- 负责人 -->
PHONE_NAME as "phoneName", <!-- 负责人联系方式 -->
ADDRESS as "address" <!-- 地址 -->
FROM ${hggpSchema}.HGPZ003
WHERE DELETE_FLAG = 0
AND STATUS=1
......
package com.baosight.hggp.hg.sb.domain;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
......@@ -46,6 +48,13 @@ public class HGSB001 extends DaoEPBase {
public static final String FIELD_DEVICE_STATUS = "deviceStatus"; /* 设备状态 0-停止 1-启用*/
public static final String FIELD_COMPANY_CODES = "companyCodes";
public static final String FIELD_SUP_CODE = "supCode"; /* 供应商编码*/
public static final String FIELD_SUP_NAME = "supName"; /* 供应商名称*/
public static final String FIELD_HEAD_NAME = "headName"; /* 负责人*/
public static final String FIELD_PHONE_NAME = "phoneName"; /* 负责人联系方式*/
public static final String FIELD_ADDRESS = "address"; /* 地址*/
public static final String FIELD_PERIOD_DAYS = "periodDays";
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
......@@ -104,6 +113,12 @@ public class HGSB001 extends DaoEPBase {
private String maintainDate = " "; /* 保养日期*/
private String deviceUserId = " "; /* 设备负责人*/
private Integer deviceStatus = 1; /* 设备状态 0-停止 1-启用*/
private String supCode = " "; /* 供应商编码*/
private String supName = " "; /* 供应商名称*/
private String headName = " "; /* 联系人*/
private String phoneName = " "; /* 联系电话*/
private String address = " "; /* 地址*/
public Integer periodDays = 0;
/**
* initialize the metadata.
......@@ -208,6 +223,29 @@ public class HGSB001 extends DaoEPBase {
eiColumn.setDescName("设备状态 0-停止 1-启用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_CODE);
eiColumn.setDescName("供应商编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUP_NAME);
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_HEAD_NAME);
eiColumn.setDescName("负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PHONE_NAME);
eiColumn.setDescName("负责人联系方式");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ADDRESS);
eiColumn.setDescName("地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PERIOD_DAYS);
eiColumn.setDescName("保养周期天数");
eiMetadata.addMeta(eiColumn);
}
......@@ -602,6 +640,55 @@ public class HGSB001 extends DaoEPBase {
public void setDeviceStatus(Integer deviceStatus) {
this.deviceStatus = deviceStatus;
}
public String getSupCode() {
return supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public String getHeadName() {
return headName;
}
public void setHeadName(String headName) {
this.headName = headName;
}
public String getPhoneName() {
return phoneName;
}
public void setPhoneName(String phoneName) {
this.phoneName = phoneName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getPeriodDays() {
return periodDays;
}
public void setPeriodDays(Integer periodDays) {
this.periodDays = periodDays;
}
/**
* get the value from Map.
*
......@@ -630,10 +717,16 @@ public class HGSB001 extends DaoEPBase {
setDeviceCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_CODE)), deviceCode));
setDeviceName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_NAME)), deviceName));
setDeviceModel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_MODEL)), deviceModel));
setPurchaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PURCHASE_DATE)), purchaseDate));
setMaintainDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MAINTAIN_DATE)), maintainDate));
setPurchaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PURCHASE_DATE))), purchaseDate));
setMaintainDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_MAINTAIN_DATE))), maintainDate));
setDeviceUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEVICE_USER_ID)), deviceUserId));
setDeviceStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DEVICE_STATUS)), deviceStatus));
setSupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_CODE)), supCode));
setSupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUP_NAME)), supName));
setHeadName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_HEAD_NAME)), headName));
setPhoneName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PHONE_NAME)), phoneName));
setAddress(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ADDRESS)), address));
setPeriodDays(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PERIOD_DAYS)), periodDays));
}
/**
......@@ -667,6 +760,12 @@ public class HGSB001 extends DaoEPBase {
map.put(FIELD_MAINTAIN_DATE, StringUtils.toString(maintainDate, eiMetadata.getMeta(FIELD_MAINTAIN_DATE)));
map.put(FIELD_DEVICE_USER_ID, StringUtils.toString(deviceUserId, eiMetadata.getMeta(FIELD_DEVICE_USER_ID)));
map.put(FIELD_DEVICE_STATUS, StringUtils.toString(deviceStatus, eiMetadata.getMeta(FIELD_DEVICE_STATUS)));
map.put(FIELD_SUP_CODE, StringUtils.toString(supCode, eiMetadata.getMeta(FIELD_SUP_CODE)));
map.put(FIELD_SUP_NAME, StringUtils.toString(supName, eiMetadata.getMeta(FIELD_SUP_NAME)));
map.put(FIELD_HEAD_NAME, StringUtils.toString(headName, eiMetadata.getMeta(FIELD_HEAD_NAME)));
map.put(FIELD_PHONE_NAME, StringUtils.toString(phoneName, eiMetadata.getMeta(FIELD_PHONE_NAME)));
map.put(FIELD_ADDRESS, StringUtils.toString(address, eiMetadata.getMeta(FIELD_ADDRESS)));
map.put(FIELD_PERIOD_DAYS, StringUtils.toString(periodDays, eiMetadata.getMeta(FIELD_PERIOD_DAYS)));
return map;
}
......
......@@ -43,6 +43,7 @@ public class ServiceHGSB001 extends ServiceEPBase {
Map<String,Object> qarma = new HashMap<>();
EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
//角色公司
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
......
......@@ -55,7 +55,13 @@
PURCHASE_DATE as "purchaseDate", <!-- 购置日期 -->
MAINTAIN_DATE as "maintainDate", <!-- 保养日期 -->
DEVICE_USER_ID as "deviceUserId", <!-- 设备负责人 -->
DEVICE_STATUS as "deviceStatus" <!-- 设备状态 0-停止 1-启用 -->
DEVICE_STATUS as "deviceStatus", <!-- 设备状态 0-停止 1-启用 -->
SUP_CODE as "supCode", <!-- 供应商编码 -->
SUP_NAME as "supName", <!-- 供应商名称 -->
HEAD_NAME as "headName", <!-- 负责人 -->
PHONE_NAME as "phoneName", <!-- 负责人联系方式 -->
ADDRESS as "address", <!-- 地址 -->
PERIOD_DAYS as "periodDays"
</sql>
<sql id="authCondition">
......@@ -158,6 +164,21 @@
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
SUP_NAME LIKE CONCAT('%', #supName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="headName">
HEAD_NAME = #headName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="phoneName">
PHONE_NAME = #phoneName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="address">
ADDRESS = #address#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -281,9 +302,18 @@
PURCHASE_DATE, <!-- 购置日期 -->
MAINTAIN_DATE, <!-- 保养日期 -->
DEVICE_USER_ID, <!-- 设备负责人 -->
DEVICE_STATUS <!-- 设备状态 0-停止 1-启用 -->
DEVICE_STATUS, <!-- 设备状态 0-停止 1-启用 -->
SUP_CODE, <!-- 供应商编码 -->
SUP_NAME, <!-- 供应商名称 -->
HEAD_NAME, <!-- 负责人 -->
PHONE_NAME, <!-- 负责人联系方式 -->
ADDRESS, <!-- 地址 -->
PERIOD_DAYS
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #purchaseDate#, #maintainDate#, #deviceUserId#, #deviceStatus#)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #factoryCode#, #factoryName#, #groupCode#,
#groupName#, #deviceType#, #deviceCode#, #deviceName#, #deviceModel#, #purchaseDate#, #maintainDate#,
#deviceUserId#, #deviceStatus#, #supCode#, #supName#, #headName#, #phoneName#, #address#, #periodDays#)
</insert>
<delete id="delete">
......@@ -326,7 +356,13 @@
PURCHASE_DATE = #purchaseDate#, <!-- 购置日期 -->
MAINTAIN_DATE = #maintainDate#, <!-- 保养日期 -->
DEVICE_USER_ID = #deviceUserId#, <!-- 设备负责人 -->
DEVICE_STATUS = #deviceStatus# <!-- 设备状态 0-停止 1-启用 -->
DEVICE_STATUS = #deviceStatus#, <!-- 设备状态 0-停止 1-启用 -->
SUP_CODE = #supCode#, <!-- 供应商编码 -->
SUP_NAME = #supName#, <!-- 供应商名称 -->
HEAD_NAME = #headName#, <!-- 负责人 -->
PHONE_NAME = #phoneName#, <!-- 负责人联系方式 -->
ADDRESS = #address#, <!-- 地址 -->
PERIOD_DAYS = #periodDays#
WHERE
ID = #id#
</update>
......
......@@ -292,6 +292,9 @@
TASK_STATUS
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #planDate#, #planCode#, #planType#, #planStartDate#, #planEndDate#, #planUserId#, #planUserName#, #planStatus#, #taskStatus#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGSB002
</selectKey>
</insert>
<delete id="delete">
......
$(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows();
var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows();
var supRecordBox = __eiInfo.getBlock("sup_record_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
......@@ -56,7 +56,7 @@ $(function () {
defaultValue: function () {
return currShortDate();
}
}, {
}/*, {
field: "maintainDate",
attributes: {
class: "i-input-readonly"
......@@ -64,7 +64,7 @@ $(function () {
defaultValue: function () {
return currShortDate();
}
}, {
}*/, {
field: "companyCode",
title: "公司名称",
filter: function (option) {
......@@ -137,6 +137,7 @@ $(function () {
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
......@@ -146,6 +147,31 @@ $(function () {
loadChange(grid,e,"companyCode");
}
//loadChange(grid,e,"userId");
}else if (e.field === "supCode") {
let item = e.items[0];
for (let i = 0; i < supRecordBox.length; i++) {
if (supRecordBox[i]["valueField"] === item["supCode"]){
resultGrid.setCellValue(item,'supName',supRecordBox[i]["textField"]);
resultGrid.setCellValue(item,'headName',supRecordBox[i]["param1Field"]=="null"?"":supRecordBox[i]["param1Field"]);
resultGrid.setCellValue(item,'phoneName',supRecordBox[i]["param2Field"]=="null"?"":supRecordBox[i]["param2Field"]);
resultGrid.setCellValue(item,'address',supRecordBox[i]["param3Field"]=="null"?"":supRecordBox[i]["param3Field"]);
break;
}
}
}else if (e.field === "periodDays") {
if (e.items[0]["periodDays"] !== "null"){
let purchaseDate = e.items[0]["purchaseDate"];
let periodDays = e.items[0]["periodDays"];
let maintainDate = dayjs(purchaseDate).add(periodDays,"day").format("YYYYMMDD");
resultGrid.setCellValue(e.items[0],"maintainDate",maintainDate);
loadChange(grid,e,"supCode");
}
}else if (e.field === "maintainDate") {
let purchaseDate = dayjs(e.items[0]["purchaseDate"]);
let maintainDate = dayjs(e.items[0]["maintainDate"]);
let periodDays =maintainDate.diff(purchaseDate,"d");
resultGrid.setCellValue(e.items[0],"periodDays",periodDays);
loadChange(grid,e,"supCode");
}
});
},
......
......@@ -15,6 +15,7 @@
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="设备台账">
<EF:EFRegion id="inqu" title="查询条件">
......@@ -35,6 +36,8 @@
<EF:EFDatePicker blockId="inqu_status" row="0" ename="purchaseDate" cname="购置日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceCode" cname="设备编码" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFAutoComplete ename="inqu_status-0-supName" dataField="supName" cname="供应商" queryMethod="query"
serviceName="HGPZ003" resultId="result"/>
<EF:EFInput blockId="inqu_status" row="0" ename="factoryCode" cname="公司名称" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
......@@ -70,6 +73,10 @@
<EF:EFColumn ename="deviceModel" cname="设备型号" width="120" enable="true" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="purchaseDate" cname="购置日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="periodDays" cname="保养周期天数" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="maintainDate" cname="保养日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFComboColumn ename="deviceUserId" cname="设备负责人" defaultValue="${loginName}"
......@@ -79,6 +86,17 @@
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" hidden="true"/>
<EF:EFColumn ename="headName" cname="联系人" width="100" enable="true" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="phoneName" cname="联系电话" width="160" enable="true" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="address" cname="地址" width="200" enable="true" readonly="false" align="center" required="true"/>
<EF:EFComboColumn ename="deviceStatus" cname="设备状态" width="80" align="center" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
......
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.dayjs=n()}(this,function(){"use strict";var t="millisecond",n="second",e="minute",r="hour",i="day",s="week",u="month",o="quarter",a="year",h=/^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,f=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=function(t,n,e){var r=String(t);return!r||r.length>=n?t:""+Array(n+1-r.length).join(e)+t},d={s:c,z:function(t){var n=-t.utcOffset(),e=Math.abs(n),r=Math.floor(e/60),i=e%60;return(n<=0?"+":"-")+c(r,2,"0")+":"+c(i,2,"0")},m:function(t,n){var e=12*(n.year()-t.year())+(n.month()-t.month()),r=t.clone().add(e,u),i=n-r<0,s=t.clone().add(e+(i?-1:1),u);return Number(-(e+(n-r)/(i?r-s:s-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return{M:u,y:a,w:s,d:i,D:"date",h:r,m:e,s:n,ms:t,Q:o}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},l="en",m={};m[l]=$;var y=function(t){return t instanceof v},M=function(t,n,e){var r;if(!t)return l;if("string"==typeof t)m[t]&&(r=t),n&&(m[t]=n,r=t);else{var i=t.name;m[i]=t,r=i}return e||(l=r),r},g=function(t,n,e){if(y(t))return t.clone();var r=n?"string"==typeof n?{format:n,pl:e}:n:{};return r.date=t,new v(r)},D=d;D.l=M,D.i=y,D.w=function(t,n){return g(t,{locale:n.$L,utc:n.$u,$offset:n.$offset})};var v=function(){function c(t){this.$L=this.$L||M(t.locale,null,!0),this.parse(t)}var d=c.prototype;return d.parse=function(t){this.$d=function(t){var n=t.date,e=t.utc;if(null===n)return new Date(NaN);if(D.u(n))return new Date;if(n instanceof Date)return new Date(n);if("string"==typeof n&&!/Z$/i.test(n)){var r=n.match(h);if(r)return e?new Date(Date.UTC(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}return new Date(n)}(t),this.init()},d.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},d.$utils=function(){return D},d.isValid=function(){return!("Invalid Date"===this.$d.toString())},d.isSame=function(t,n){var e=g(t);return this.startOf(n)<=e&&e<=this.endOf(n)},d.isAfter=function(t,n){return g(t)<this.startOf(n)},d.isBefore=function(t,n){return this.endOf(n)<g(t)},d.$g=function(t,n,e){return D.u(t)?this[n]:this.set(e,t)},d.year=function(t){return this.$g(t,"$y",a)},d.month=function(t){return this.$g(t,"$M",u)},d.day=function(t){return this.$g(t,"$W",i)},d.date=function(t){return this.$g(t,"$D","date")},d.hour=function(t){return this.$g(t,"$H",r)},d.minute=function(t){return this.$g(t,"$m",e)},d.second=function(t){return this.$g(t,"$s",n)},d.millisecond=function(n){return this.$g(n,"$ms",t)},d.unix=function(){return Math.floor(this.valueOf()/1e3)},d.valueOf=function(){return this.$d.getTime()},d.startOf=function(t,o){var h=this,f=!!D.u(o)||o,c=D.p(t),d=function(t,n){var e=D.w(h.$u?Date.UTC(h.$y,n,t):new Date(h.$y,n,t),h);return f?e:e.endOf(i)},$=function(t,n){return D.w(h.toDate()[t].apply(h.toDate(),(f?[0,0,0,0]:[23,59,59,999]).slice(n)),h)},l=this.$W,m=this.$M,y=this.$D,M="set"+(this.$u?"UTC":"");switch(c){case a:return f?d(1,0):d(31,11);case u:return f?d(1,m):d(0,m+1);case s:var g=this.$locale().weekStart||0,v=(l<g?l+7:l)-g;return d(f?y-v:y+(6-v),m);case i:case"date":return $(M+"Hours",0);case r:return $(M+"Minutes",1);case e:return $(M+"Seconds",2);case n:return $(M+"Milliseconds",3);default:return this.clone()}},d.endOf=function(t){return this.startOf(t,!1)},d.$set=function(s,o){var h,f=D.p(s),c="set"+(this.$u?"UTC":""),d=(h={},h[i]=c+"Date",h.date=c+"Date",h[u]=c+"Month",h[a]=c+"FullYear",h[r]=c+"Hours",h[e]=c+"Minutes",h[n]=c+"Seconds",h[t]=c+"Milliseconds",h)[f],$=f===i?this.$D+(o-this.$W):o;if(f===u||f===a){var l=this.clone().set("date",1);l.$d[d]($),l.init(),this.$d=l.set("date",Math.min(this.$D,l.daysInMonth())).toDate()}else d&&this.$d[d]($);return this.init(),this},d.set=function(t,n){return this.clone().$set(t,n)},d.get=function(t){return this[D.p(t)]()},d.add=function(t,o){var h,f=this;t=Number(t);var c=D.p(o),d=function(n){var e=g(f);return D.w(e.date(e.date()+Math.round(n*t)),f)};if(c===u)return this.set(u,this.$M+t);if(c===a)return this.set(a,this.$y+t);if(c===i)return d(1);if(c===s)return d(7);var $=(h={},h[e]=6e4,h[r]=36e5,h[n]=1e3,h)[c]||1,l=this.$d.getTime()+t*$;return D.w(l,this)},d.subtract=function(t,n){return this.add(-1*t,n)},d.format=function(t){var n=this;if(!this.isValid())return"Invalid Date";var e=t||"YYYY-MM-DDTHH:mm:ssZ",r=D.z(this),i=this.$locale(),s=this.$H,u=this.$m,o=this.$M,a=i.weekdays,h=i.months,c=function(t,r,i,s){return t&&(t[r]||t(n,e))||i[r].substr(0,s)},d=function(t){return D.s(s%12||12,t,"0")},$=i.meridiem||function(t,n,e){var r=t<12?"AM":"PM";return e?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:o+1,MM:D.s(o+1,2,"0"),MMM:c(i.monthsShort,o,h,3),MMMM:h[o]||h(this,e),D:this.$D,DD:D.s(this.$D,2,"0"),d:String(this.$W),dd:c(i.weekdaysMin,this.$W,a,2),ddd:c(i.weekdaysShort,this.$W,a,3),dddd:a[this.$W],H:String(s),HH:D.s(s,2,"0"),h:d(1),hh:d(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:D.s(u,2,"0"),s:String(this.$s),ss:D.s(this.$s,2,"0"),SSS:D.s(this.$ms,3,"0"),Z:r};return e.replace(f,function(t,n){return n||l[t]||r.replace(":","")})},d.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},d.diff=function(t,h,f){var c,d=D.p(h),$=g(t),l=6e4*($.utcOffset()-this.utcOffset()),m=this-$,y=D.m(this,$);return y=(c={},c[a]=y/12,c[u]=y,c[o]=y/3,c[s]=(m-l)/6048e5,c[i]=(m-l)/864e5,c[r]=m/36e5,c[e]=m/6e4,c[n]=m/1e3,c)[d]||m,f?y:D.a(y)},d.daysInMonth=function(){return this.endOf(u).$D},d.$locale=function(){return m[this.$L]},d.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),r=M(t,n,!0);return r&&(e.$L=r),e},d.clone=function(){return D.w(this.$d,this)},d.toDate=function(){return new Date(this.valueOf())},d.toJSON=function(){return this.isValid()?this.toISOString():null},d.toISOString=function(){return this.$d.toISOString()},d.toString=function(){return this.$d.toUTCString()},c}();return g.prototype=v.prototype,g.extend=function(t,n){return t(n,v,g),g},g.locale=M,g.isDayjs=y,g.unix=function(t){return g(1e3*t)},g.en=m[l],g.Ls=m,g});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment