Commit 079c9b2a authored by 耿迪迪's avatar 耿迪迪

供需平衡气量监管-日历插件

parent b5547c89
package com.zehong.web.controller.supplybalance;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TSupBalGasSup;
import com.zehong.system.service.ITSupBalGasSupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 供需平衡-气量监管Controller
*
* @author zehong
* @date 2024-06-15
*/
@RestController
@RequestMapping("/supplyBalance/gas")
public class TSupBalGasSupController extends BaseController
{
@Autowired
private ITSupBalGasSupService tSupBalGasSupService;
/**
* 查询供需平衡-气量监管列表
*/
@GetMapping("/list")
public TableDataInfo list(TSupBalGasSup tSupBalGasSup)
{
startPage();
List<TSupBalGasSup> list = tSupBalGasSupService.selectTSupBalGasSupList(tSupBalGasSup);
return getDataTable(list);
}
/**
* 导出供需平衡-气量监管列表
*/
@Log(title = "供需平衡-气量监管", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSupBalGasSup tSupBalGasSup)
{
List<TSupBalGasSup> list = tSupBalGasSupService.selectTSupBalGasSupList(tSupBalGasSup);
ExcelUtil<TSupBalGasSup> util = new ExcelUtil<TSupBalGasSup>(TSupBalGasSup.class);
return util.exportExcel(list, "供需平衡-气量监管数据");
}
/**
* 获取供需平衡-气量监管详细信息
*/
@GetMapping(value = "/{fGasSupId}")
public AjaxResult getInfo(@PathVariable("fGasSupId") Long fGasSupId)
{
return AjaxResult.success(tSupBalGasSupService.selectTSupBalGasSupById(fGasSupId));
}
/**
* 新增供需平衡-气量监管
*/
@Log(title = "供需平衡-气量监管", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSupBalGasSup tSupBalGasSup)
{
return toAjax(tSupBalGasSupService.insertTSupBalGasSup(tSupBalGasSup));
}
/**
* 修改供需平衡-气量监管
*/
@Log(title = "供需平衡-气量监管", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSupBalGasSup tSupBalGasSup)
{
return toAjax(tSupBalGasSupService.updateTSupBalGasSup(tSupBalGasSup));
}
/**
* 删除供需平衡-气量监管
*/
@Log(title = "供需平衡-气量监管", businessType = BusinessType.DELETE)
@DeleteMapping("/{fGasSupIds}")
public AjaxResult remove(@PathVariable Long[] fGasSupIds)
{
return toAjax(tSupBalGasSupService.deleteTSupBalGasSupByIds(fGasSupIds));
}
/**
* 获取上报信息
* @param companyId 企业id
* @param reportDate 上报时间
* @return
*/
@GetMapping(value = "/getReportInfoByCompany")
public AjaxResult getReportInfoByCompany(@RequestParam(value="companyId")String companyId,@RequestParam(value="reportDate")String reportDate){
return AjaxResult.success(tSupBalGasSupService.getReportInfoByCompany(companyId,reportDate));
}
@GetMapping("/reportInfoList")
public AjaxResult reportInfoList(TSupBalGasSup tSupBalGasSup){
List<TSupBalGasSup> list = tSupBalGasSupService.selectTSupBalGasSupList(tSupBalGasSup);
return AjaxResult.success(list);
}
}
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 供需平衡-气量监管对象 t_sup_bal_gas_sup
*
* @author zehong
* @date 2024-06-15
*/
public class TSupBalGasSup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long fGasSupId;
/** 企业uuid */
private String fCompanyInfoId;
@Excel(name = "企业名称")
private String enterpriseName;
/** 计划量 */
@Excel(name = "计划量")
private Long fPlanQuan;
/** 批复量 */
@Excel(name = "批复量")
private Long fApprQuan;
/** 供气量 */
@Excel(name = "供气量")
private Long fSupGasVol;
/** 存储量 */
@Excel(name = "存储量")
private Long fStorageVol;
/** 监管气量日期 */
@Excel(name = "监管气量日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date fSupDate;
/** 上报状态 0-未上报,1-已上报 */
@Excel(name = "上报状态 0-未上报,1-已上报")
private String fRepStatus;
/** 上报日期 */
@Excel(name = "上报日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date fRepDate;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date beginRepDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endRepDate;
public void setfGasSupId(Long fGasSupId)
{
this.fGasSupId = fGasSupId;
}
public Long getfGasSupId()
{
return fGasSupId;
}
public void setfCompanyInfoId(String fCompanyInfoId)
{
this.fCompanyInfoId = fCompanyInfoId;
}
public String getfCompanyInfoId()
{
return fCompanyInfoId;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public void setfPlanQuan(Long fPlanQuan)
{
this.fPlanQuan = fPlanQuan;
}
public Long getfPlanQuan()
{
return fPlanQuan;
}
public void setfApprQuan(Long fApprQuan)
{
this.fApprQuan = fApprQuan;
}
public Long getfApprQuan()
{
return fApprQuan;
}
public void setfSupGasVol(Long fSupGasVol)
{
this.fSupGasVol = fSupGasVol;
}
public Long getfSupGasVol()
{
return fSupGasVol;
}
public void setfStorageVol(Long fStorageVol)
{
this.fStorageVol = fStorageVol;
}
public Long getfStorageVol()
{
return fStorageVol;
}
public void setfSupDate(Date fSupDate)
{
this.fSupDate = fSupDate;
}
public Date getfSupDate()
{
return fSupDate;
}
public void setfRepStatus(String fRepStatus)
{
this.fRepStatus = fRepStatus;
}
public String getfRepStatus()
{
return fRepStatus;
}
public void setfRepDate(Date fRepDate)
{
this.fRepDate = fRepDate;
}
public Date getfRepDate()
{
return fRepDate;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public Date getBeginRepDate() {
return beginRepDate;
}
public void setBeginRepDate(Date beginRepDate) {
this.beginRepDate = beginRepDate;
}
public Date getEndRepDate() {
return endRepDate;
}
public void setEndRepDate(Date endRepDate) {
this.endRepDate = endRepDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fGasSupId", getfGasSupId())
.append("fCompanyInfoId", getfCompanyInfoId())
.append("fPlanQuan", getfPlanQuan())
.append("fApprQuan", getfApprQuan())
.append("fSupGasVol", getfSupGasVol())
.append("fStorageVol", getfStorageVol())
.append("fSupDate", getfSupDate())
.append("fRepStatus", getfRepStatus())
.append("fRepDate", getfRepDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TSupBalGasSup;
/**
* 供需平衡-气量监管Mapper接口
*
* @author zehong
* @date 2024-06-15
*/
public interface TSupBalGasSupMapper
{
/**
* 查询供需平衡-气量监管
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 供需平衡-气量监管
*/
public TSupBalGasSup selectTSupBalGasSupById(Long fGasSupId);
/**
* 查询供需平衡-气量监管列表
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 供需平衡-气量监管集合
*/
public List<TSupBalGasSup> selectTSupBalGasSupList(TSupBalGasSup tSupBalGasSup);
/**
* 新增供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
public int insertTSupBalGasSup(TSupBalGasSup tSupBalGasSup);
/**
* 修改供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
public int updateTSupBalGasSup(TSupBalGasSup tSupBalGasSup);
/**
* 删除供需平衡-气量监管
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 结果
*/
public int deleteTSupBalGasSupById(Long fGasSupId);
/**
* 批量删除供需平衡-气量监管
*
* @param fGasSupIds 需要删除的数据ID
* @return 结果
*/
public int deleteTSupBalGasSupByIds(Long[] fGasSupIds);
/**
* 获取上报信息
*/
TSupBalGasSup getReportInfoByCompany(Map<String, String> param);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TSupBalGasSup;
/**
* 供需平衡-气量监管Service接口
*
* @author zehong
* @date 2024-06-15
*/
public interface ITSupBalGasSupService
{
/**
* 查询供需平衡-气量监管
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 供需平衡-气量监管
*/
public TSupBalGasSup selectTSupBalGasSupById(Long fGasSupId);
/**
* 查询供需平衡-气量监管列表
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 供需平衡-气量监管集合
*/
public List<TSupBalGasSup> selectTSupBalGasSupList(TSupBalGasSup tSupBalGasSup);
/**
* 新增供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
public int insertTSupBalGasSup(TSupBalGasSup tSupBalGasSup);
/**
* 修改供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
public int updateTSupBalGasSup(TSupBalGasSup tSupBalGasSup);
/**
* 批量删除供需平衡-气量监管
*
* @param fGasSupIds 需要删除的供需平衡-气量监管ID
* @return 结果
*/
public int deleteTSupBalGasSupByIds(Long[] fGasSupIds);
/**
* 删除供需平衡-气量监管信息
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 结果
*/
public int deleteTSupBalGasSupById(Long fGasSupId);
/**
* 获取上报信息
* @param companyId 企业id
* @param reportDate 上报时间
* @return
*/
TSupBalGasSup getReportInfoByCompany(String companyId, String reportDate);
}
package com.zehong.system.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSupBalGasSupMapper;
import com.zehong.system.domain.TSupBalGasSup;
import com.zehong.system.service.ITSupBalGasSupService;
/**
* 供需平衡-气量监管Service业务层处理
*
* @author zehong
* @date 2024-06-15
*/
@Service
public class TSupBalGasSupServiceImpl implements ITSupBalGasSupService
{
@Autowired
private TSupBalGasSupMapper tSupBalGasSupMapper;
/**
* 查询供需平衡-气量监管
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 供需平衡-气量监管
*/
@Override
public TSupBalGasSup selectTSupBalGasSupById(Long fGasSupId)
{
return tSupBalGasSupMapper.selectTSupBalGasSupById(fGasSupId);
}
/**
* 查询供需平衡-气量监管列表
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 供需平衡-气量监管
*/
@Override
public List<TSupBalGasSup> selectTSupBalGasSupList(TSupBalGasSup tSupBalGasSup)
{
return tSupBalGasSupMapper.selectTSupBalGasSupList(tSupBalGasSup);
}
/**
* 新增供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
@Override
public int insertTSupBalGasSup(TSupBalGasSup tSupBalGasSup)
{
tSupBalGasSup.setCreateTime(DateUtils.getNowDate());
tSupBalGasSup.setfSupDate(new Date());
tSupBalGasSup.setfCompanyInfoId(SecurityUtils.getLoginUser().getUser().getDeptId());
return tSupBalGasSupMapper.insertTSupBalGasSup(tSupBalGasSup);
}
/**
* 修改供需平衡-气量监管
*
* @param tSupBalGasSup 供需平衡-气量监管
* @return 结果
*/
@Override
public int updateTSupBalGasSup(TSupBalGasSup tSupBalGasSup)
{
tSupBalGasSup.setUpdateTime(DateUtils.getNowDate());
return tSupBalGasSupMapper.updateTSupBalGasSup(tSupBalGasSup);
}
/**
* 批量删除供需平衡-气量监管
*
* @param fGasSupIds 需要删除的供需平衡-气量监管ID
* @return 结果
*/
@Override
public int deleteTSupBalGasSupByIds(Long[] fGasSupIds)
{
return tSupBalGasSupMapper.deleteTSupBalGasSupByIds(fGasSupIds);
}
/**
* 删除供需平衡-气量监管信息
*
* @param fGasSupId 供需平衡-气量监管ID
* @return 结果
*/
@Override
public int deleteTSupBalGasSupById(Long fGasSupId)
{
return tSupBalGasSupMapper.deleteTSupBalGasSupById(fGasSupId);
}
/**
* 获取上报信息
* @param companyId 企业id
* @param reportDate 上报时间
* @return
*/
@Override
public TSupBalGasSup getReportInfoByCompany(String companyId, String reportDate){
Map<String,String> param = new HashMap();
param.put("companyId",companyId);
param.put("reportDate",reportDate);
return tSupBalGasSupMapper.getReportInfoByCompany(param);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TSupBalGasSupMapper">
<resultMap type="TSupBalGasSup" id="TSupBalGasSupResult">
<result property="fGasSupId" column="f_gas_sup_id" />
<result property="fCompanyInfoId" column="f_company_info_id" />
<result property="fPlanQuan" column="f_plan_quan" />
<result property="fApprQuan" column="f_appr_quan" />
<result property="fSupGasVol" column="f_sup_gas_vol" />
<result property="fStorageVol" column="f_storage_vol" />
<result property="fSupDate" column="f_sup_date" />
<result property="fRepStatus" column="f_rep_status" />
<result property="fRepDate" column="f_rep_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTSupBalGasSupVo">
SELECT
sup.f_gas_sup_id,
sup.f_company_info_id,
sup.f_plan_quan,
sup.f_appr_quan,
sup.f_sup_gas_vol,
sup.f_storage_vol,
sup.f_sup_date,
sup.f_rep_status,
sup.f_rep_date,
sup.create_by,
sup.create_time,
sup.update_by,
sup.update_time,
sup.is_del,
sup.remarks,
en.enterprise_name as enterpriseName
FROM
t_sup_bal_gas_sup sup
LEFT JOIN t_enterprise_info en ON sup.f_company_info_id = en.enterprise_id
</sql>
<select id="selectTSupBalGasSupList" parameterType="TSupBalGasSup" resultMap="TSupBalGasSupResult">
<include refid="selectTSupBalGasSupVo"/>
<where>
<if test="fCompanyInfoId != null and fCompanyInfoId != ''"> and sup.f_company_info_id like concat('%', #{fCompanyInfoId}, '%')</if>
<if test="fPlanQuan != null "> and sup.f_plan_quan = #{fPlanQuan}</if>
<if test="fApprQuan != null "> and sup.f_appr_quan = #{fApprQuan}</if>
<if test="fSupGasVol != null "> and sup.f_sup_gas_vol = #{fSupGasVol}</if>
<if test="fStorageVol != null "> and sup.f_storage_vol = #{fStorageVol}</if>
<if test="fRepStatus != null and fRepStatus != ''"> and sup.f_rep_status = #{fRepStatus}</if>
<if test="beginRepDate != null and endRepDate != null">and sup.f_rep_date between #{beginRepDate} and #{endRepDate}</if>
<if test="enterpriseName != null and enterpriseName != ''"> and en.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
</where>
</select>
<select id="selectTSupBalGasSupById" parameterType="Long" resultMap="TSupBalGasSupResult">
<include refid="selectTSupBalGasSupVo"/>
where sup.f_gas_sup_id = #{fGasSupId}
</select>
<insert id="insertTSupBalGasSup" parameterType="TSupBalGasSup" useGeneratedKeys="true" keyProperty="fGasSupId">
insert into t_sup_bal_gas_sup
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fCompanyInfoId != null and fCompanyInfoId != ''">f_company_info_id,</if>
<if test="fPlanQuan != null">f_plan_quan,</if>
<if test="fApprQuan != null">f_appr_quan,</if>
<if test="fSupGasVol != null">f_sup_gas_vol,</if>
<if test="fStorageVol != null">f_storage_vol,</if>
<if test="fSupDate != null">f_sup_date,</if>
<if test="fRepStatus != null and fRepStatus != ''">f_rep_status,</if>
<if test="fRepDate != null">f_rep_date,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fCompanyInfoId != null and fCompanyInfoId != ''">#{fCompanyInfoId},</if>
<if test="fPlanQuan != null">#{fPlanQuan},</if>
<if test="fApprQuan != null">#{fApprQuan},</if>
<if test="fSupGasVol != null">#{fSupGasVol},</if>
<if test="fStorageVol != null">#{fStorageVol},</if>
<if test="fSupDate != null">#{fSupDate},</if>
<if test="fRepStatus != null and fRepStatus != ''">#{fRepStatus},</if>
<if test="fRepDate != null">#{fRepDate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTSupBalGasSup" parameterType="TSupBalGasSup">
update t_sup_bal_gas_sup
<trim prefix="SET" suffixOverrides=",">
<if test="fCompanyInfoId != null and fCompanyInfoId != ''">f_company_info_id = #{fCompanyInfoId},</if>
<if test="fPlanQuan != null">f_plan_quan = #{fPlanQuan},</if>
<if test="fApprQuan != null">f_appr_quan = #{fApprQuan},</if>
<if test="fSupGasVol != null">f_sup_gas_vol = #{fSupGasVol},</if>
<if test="fStorageVol != null">f_storage_vol = #{fStorageVol},</if>
<if test="fSupDate != null">f_sup_date = #{fSupDate},</if>
<if test="fRepStatus != null and fRepStatus != ''">f_rep_status = #{fRepStatus},</if>
<if test="fRepDate != null">f_rep_date = #{fRepDate},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where f_gas_sup_id = #{fGasSupId}
</update>
<delete id="deleteTSupBalGasSupById" parameterType="Long">
delete from t_sup_bal_gas_sup where f_gas_sup_id = #{fGasSupId}
</delete>
<delete id="deleteTSupBalGasSupByIds" parameterType="String">
delete from t_sup_bal_gas_sup where f_gas_sup_id in
<foreach item="fGasSupId" collection="array" open="(" separator="," close=")">
#{fGasSupId}
</foreach>
</delete>
<select id="getReportInfoByCompany" parameterType="Map" resultMap="TSupBalGasSupResult">
<include refid="selectTSupBalGasSupVo"/>
where sup.f_company_info_id = #{companyId} and f_rep_date like concat('%', #{reportDate}, '%')
</select>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询供需平衡-气量监管列表
export function listSup(query) {
return request({
url: '/supplyBalance/gas/list',
method: 'get',
params: query
})
}
// 查询供需平衡-气量监管详细
export function getSup(fGasSupId) {
return request({
url: '/supplyBalance/gas/' + fGasSupId,
method: 'get'
})
}
// 新增供需平衡-气量监管
export function addSup(data) {
return request({
url: '/supplyBalance/gas',
method: 'post',
data: data
})
}
// 修改供需平衡-气量监管
export function updateSup(data) {
return request({
url: '/supplyBalance/gas',
method: 'put',
data: data
})
}
// 删除供需平衡-气量监管
export function delSup(fGasSupId) {
return request({
url: '/supplyBalance/gas/' + fGasSupId,
method: 'delete'
})
}
// 导出供需平衡-气量监管
export function exportSup(query) {
return request({
url: '/supplyBalance/gas/export',
method: 'get',
params: query
})
}
export function getReportInfoByCompany(query) {
return request({
url: '/supplyBalance/gas/getReportInfoByCompany',
method: 'get',
params: query
})
}
export function reportInfoList(query) {
return request({
url: '/supplyBalance/gas/reportInfoList',
method: 'get',
params: query
})
}
<!-- 日历组件 -->
<template>
<div class="calender-select" :style="{width: width}">
<el-date-picker
class="time-select"
v-model="selectDate"
type="month"
value-format="yyyy-MM"
:picker-options="pickerOptions"
popper-class='my-date-picker'
@change="timerChange"
>
</el-date-picker>
<el-calendar
v-model="selectCalender"
@input="dayChange"
>
<template slot="dateCell" slot-scope="{date, data}">
<div
class="day-tag"
>
{{ data.day.split('-')[2] }}
<div class="day-status">{{ getStatus(data.day) }}</div>
</div>
</template>
</el-calendar>
</div>
</template>
<script>
import moment from "moment";
export default {
name: "calender-index",
props:{
value: {
type: String,
default: "",
},
scheduleData: {
type: Array,
default: ()=>[],
},
width: {
type: [Number, String],
default: '30%'
}
},
data(){
return{
selectCalender: new Date(),
selectDate: new Date(),
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
}
},
}
},
mounted(){
this.setDisabledDayClass();
},
methods:{
timerChange(time){
this.selectCalender = time;
this.$emit("input", time + "-01");
this.$emit('dateChange',0);
this.$nextTick(()=>{
this.setDisabledDayClass();
})
},
dayChange(value){
this.selectDate = moment(value).format("YYYY-MM");
this.$emit("input", moment(value.getTime()).format("YYYY-MM-DD"));
this.$emit('dateChange',1);
this.$nextTick(()=>{
this.setDisabledDayClass();
})
},
getStatus(date){
const data = this.scheduleData.find(item => item.date == date);
return data ? data.content : "";
},
//限制今天后时间不可选
setDisabledDayClass() {
let disabledDayNode = document.getElementsByTagName('td');
const jArr=JSON.parse(JSON.stringify(disabledDayNode) );
const Array = [];
for(let item in jArr){
Array.push(disabledDayNode[item]);
}
let toIndex = Array.findIndex(item=>item.className&&item.className.includes('is-today'));
Array.forEach((element,index) => {
if( toIndex >= index || toIndex<0){
element.className =element.className&& element.className.replaceAll("is-pervDay","");
}else {
element.className += ' is-pervDay'
}
})
},
}
}
</script>
<style lang="scss">
.calender-select{
//width: 30%;
position: relative;
.time-select{
position: absolute;
right: 20px;
width: 190px;
}
.el-calendar__button-group{
display: none;
}
.el-calendar-table__row td {
// 去掉边框
border: none !important;
// 缩小高度
.el-calendar-day {
height: 50px;
width: 50px;
border-radius: 50%;
margin: 2px auto;
text-align: center;
display: flex;
}
}
// 自定义选中、悬浮颜色
.el-calendar-table .el-calendar-day:hover {
color: #fff;
background-color: #1890ff !important;
}
.el-calendar-table .is-today .el-calendar-day{
color: #1890ff;
//background-color: dodgerblue !important;
}
.el-calendar-table .is-selected{
background-color: transparent;
}
.el-calendar-table .is-selected .el-calendar-day{
color: #fff;
background-color: #1890ff;
}
/* .current .el-calendar-day{
background-color: rgba(255, 151, 10, 0.23);
//border: 1px solid;
}*/
.day-tag{
margin: auto auto;
}
.day-status{
font-size: 9px;
font-weight: 500;
}
.is-pervDay {
pointer-events: none;
background-color: #f5f5f5;
color: #00000040 !important;
/*.el-calendar-day{
background-color: transparent;
}*/
}
}
//时间选择器
.my-date-picker{
width: 220px !important;
.el-picker-panel__content{
width: 200px !important;
}
.el-month-table td .cell {
width: 40px !important;
}
}
</style>
This diff is collapsed.
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