diff --git a/das/pom.xml b/das/pom.xml index 1a04d99e..a87c77b7 100644 --- a/das/pom.xml +++ b/das/pom.xml @@ -24,6 +24,7 @@ 42.7.3 1.38.0 + 4.0.1 4.8.6 @@ -72,6 +73,20 @@ ${sa.version} + + + com.alibaba + easyexcel + ${easyexcel.version} + + + org.apache.poi + poi-ooxml-schemas + + + + + org.apache.commons diff --git a/das/src/main/java/com/das/common/utils/ExcelUtil.java b/das/src/main/java/com/das/common/utils/ExcelUtil.java new file mode 100644 index 00000000..59377730 --- /dev/null +++ b/das/src/main/java/com/das/common/utils/ExcelUtil.java @@ -0,0 +1,55 @@ +package com.das.common.utils; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.das.modules.equipment.domain.excel.SheetInfoBean; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import java.io.IOException; +import java.net.URLEncoder; +import java.util.List; + +/** +* EXCEL处理工具类 + * @author 王凯 + * @version 1.0.0 + * @since 2022-08-17 +*/ +public class ExcelUtil { + + /**导出*/ + public static void exportMoreSheet(String fileName, + HttpServletRequest request, + HttpServletResponse response, + List sheetInfoList){ + try { +// response.reset(); + response.setHeader("Access-Control-Allow-Origin", "*"); + if (request.getMethod().equals("OPTIONS")) { + response.addHeader("Access-Control-Allow-Methods", "GET,HEAD,POST,PUT,DELETE,TRACE,OPTIONS,PATCH"); + response.addHeader("Access-Control-Allow-Headers", "dnt,Origin, X-Requested-With,Content-Type, Accept, Authorization"); + } + response.setCharacterEncoding("utf-8"); + response.setContentType("application/vnd.ms-excel"); + String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFileName); + ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); + WriteSheet writeSheet; + for (SheetInfoBean bean : sheetInfoList) { + // 构建sheet对象 + writeSheet = EasyExcel.writerSheet(bean.getSheetName()).head(bean.getHeadClass()).build(); + // 写出sheet数据 + excelWriter.write(bean.getDataList(), writeSheet); + } +// // 关流 + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + } + + +} diff --git a/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java b/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java index 68fd3a6a..1f0e07af 100644 --- a/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java +++ b/das/src/main/java/com/das/modules/equipment/controller/SysIotModelController.java @@ -4,13 +4,17 @@ import cn.dev33.satoken.stp.StpUtil; import com.das.common.constant.SysAuthorityIds; import com.das.common.exceptions.ServiceException; import com.das.common.result.R; +import com.das.common.utils.ExcelUtil; import com.das.modules.equipment.domain.dto.SysIotModelDto; import com.das.modules.equipment.domain.dto.SysIotModelFieldDto; import com.das.modules.equipment.domain.dto.SysIotModelServiceDto; import com.das.modules.equipment.domain.vo.SysIotModelFieldVo; import com.das.modules.equipment.domain.vo.SysIotModelServiceVo; import com.das.modules.equipment.domain.vo.SysIotModelVo; +import com.das.modules.equipment.entity.SysIotModel; import com.das.modules.equipment.service.SysIotModelService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -209,5 +213,16 @@ public class SysIotModelController { sysIotModelService.deleteSysIotModelService(sysIotModelServiceDto); return R.success(); } + + /** 物模型导出 */ + @PostMapping("/export") + public void exportSysIotModel(@RequestBody SysIotModelDto sysIotModelDto, HttpServletRequest request, HttpServletResponse response) { + + if (sysIotModelDto.getId() == null) { + throw new ServiceException("请选择需要下载的物模型属性信息"); + } + sysIotModelService.exportSysIotModel(sysIotModelDto,request, response); + + } } diff --git a/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelFieldDto.java b/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelFieldDto.java index d6131537..591c43d1 100644 --- a/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelFieldDto.java +++ b/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelFieldDto.java @@ -32,5 +32,5 @@ public class SysIotModelFieldDto implements Serializable { */ private Integer porder; - private Integer version; + private Integer revision; } diff --git a/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelServiceDto.java b/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelServiceDto.java index 6d6ae5a6..7c508776 100644 --- a/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelServiceDto.java +++ b/das/src/main/java/com/das/modules/equipment/domain/dto/SysIotModelServiceDto.java @@ -35,5 +35,5 @@ public class SysIotModelServiceDto implements Serializable { */ private Integer porder; - private Integer version; + private Integer revision; } diff --git a/das/src/main/java/com/das/modules/equipment/domain/excel/SheetInfoBean.java b/das/src/main/java/com/das/modules/equipment/domain/excel/SheetInfoBean.java new file mode 100644 index 00000000..9917333d --- /dev/null +++ b/das/src/main/java/com/das/modules/equipment/domain/excel/SheetInfoBean.java @@ -0,0 +1,63 @@ +package com.das.modules.equipment.domain.excel; + +import java.util.List; + +public class SheetInfoBean { + + /** + * sheet页名称 + */ + private String sheetName; + + /** + * sheet标题bean + */ + private Class headClass; + + /** + * sheet页数据 + */ + private List dataList; + + public SheetInfoBean() { + } + + public SheetInfoBean(String sheetName, Class headClass, List dataList) { + this.sheetName = sheetName; + this.headClass = headClass; + this.dataList = dataList; + } + + public String getSheetName() { + return sheetName; + } + + public void setSheetName(String sheetName) { + this.sheetName = sheetName; + } + + public Class getHeadClass() { + return headClass; + } + + public void setHeadClass(Class headClass) { + this.headClass = headClass; + } + + public List getDataList() { + return dataList; + } + + public void setDataList(List dataList) { + this.dataList = dataList; + } + + @Override + public String toString() { + return "SheetInfoBean{" + + "sheetName='" + sheetName + '\'' + + ", headClass=" + headClass + + ", dataList=" + dataList + + '}'; + } +} diff --git a/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelFieldExcel.java b/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelFieldExcel.java new file mode 100644 index 00000000..4bb2b2c2 --- /dev/null +++ b/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelFieldExcel.java @@ -0,0 +1,49 @@ +package com.das.modules.equipment.domain.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + + +/** + * 物模型属性前端回显 + * + * @author guchengwei + */ +@Data +public class SysIotModelFieldExcel { + + + /** + * 所属物模型ID + */ + @ExcelProperty(value = "所属物模型名称",index = 0) + private String iotModelName; + + + /** + * 物模型动作编码 + */ + @ExcelProperty(value = "物模型属性编码",index = 1) + private String attributeCode; + + /** + * 物模型动作名称 + */ + @ExcelProperty(value = "物模型属性名称",index = 2) + private String attributeName; + + /** + * 属性类型 + */ + @ExcelProperty(value = "属性类型",index = 3) + private Integer attributeType; + + /** + * 测点序号 + */ + @ExcelProperty(value = "测点序号",index = 4) + private Integer porder; + +} diff --git a/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelServiceExcel.java b/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelServiceExcel.java new file mode 100644 index 00000000..8eeb311b --- /dev/null +++ b/das/src/main/java/com/das/modules/equipment/domain/excel/SysIotModelServiceExcel.java @@ -0,0 +1,51 @@ +package com.das.modules.equipment.domain.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + + +/** + * 物模型动作前端回显 + * + * @author guchengwei + */ +@Data +public class SysIotModelServiceExcel implements Serializable { + + + /** + * 所属物模型ID + */ + @ExcelProperty(value = "所属物模型名称",index = 0) + private String iotModelName; + + + /** + * 物模型动作编码 + */ + @ExcelProperty(value = "物模型动作编码",index = 1) + private String serviceCode; + + /** + * 物模型动作名称 + */ + @ExcelProperty(value = "物模型动作名称",index = 2) + private String serviceName; + + /** + * 动作类型 + */ + @ExcelProperty(value = "动作类型",index = 3) + private Integer serviceType; + + /** + * 测点序号 + */ + @ExcelProperty(value = "测点序号",index = 4) + private Integer porder; + +} diff --git a/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelFieldVo.java b/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelFieldVo.java index c555027b..ae842a20 100644 --- a/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelFieldVo.java +++ b/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelFieldVo.java @@ -43,6 +43,6 @@ public class SysIotModelFieldVo { */ private Integer porder; - private Integer version; + private Integer revision; } diff --git a/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelServiceVo.java b/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelServiceVo.java index 8f79f4c0..8de08171 100644 --- a/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelServiceVo.java +++ b/das/src/main/java/com/das/modules/equipment/domain/vo/SysIotModelServiceVo.java @@ -43,6 +43,6 @@ public class SysIotModelServiceVo { */ private Integer porder; - private Integer version; + private Integer revision; } diff --git a/das/src/main/java/com/das/modules/equipment/mapper/SysIotModelMapper.java b/das/src/main/java/com/das/modules/equipment/mapper/SysIotModelMapper.java index 14520cd1..08e974f6 100644 --- a/das/src/main/java/com/das/modules/equipment/mapper/SysIotModelMapper.java +++ b/das/src/main/java/com/das/modules/equipment/mapper/SysIotModelMapper.java @@ -2,10 +2,20 @@ package com.das.modules.equipment.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.das.modules.equipment.domain.excel.SysIotModelFieldExcel; +import com.das.modules.equipment.domain.excel.SysIotModelServiceExcel; +import com.das.modules.equipment.domain.vo.SysIotModelFieldVo; +import com.das.modules.equipment.domain.vo.SysIotModelServiceVo; import com.das.modules.equipment.entity.SysIotModel; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface SysIotModelMapper extends BaseMapper { + List queryFieldByModelId(Long id); + + List queryServiceByModelId(Long id); + } diff --git a/das/src/main/java/com/das/modules/equipment/service/SysIotModelService.java b/das/src/main/java/com/das/modules/equipment/service/SysIotModelService.java index e11a50e1..0e4253d3 100644 --- a/das/src/main/java/com/das/modules/equipment/service/SysIotModelService.java +++ b/das/src/main/java/com/das/modules/equipment/service/SysIotModelService.java @@ -6,6 +6,8 @@ import com.das.modules.equipment.domain.dto.SysIotModelServiceDto; import com.das.modules.equipment.domain.vo.SysIotModelFieldVo; import com.das.modules.equipment.domain.vo.SysIotModelServiceVo; import com.das.modules.equipment.domain.vo.SysIotModelVo; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.util.List; @@ -34,4 +36,6 @@ public interface SysIotModelService { void deleteSysIotModelService(SysIotModelServiceDto sysIotModelServiceDto); + void exportSysIotModel(SysIotModelDto sysIotModelDto, HttpServletRequest request, HttpServletResponse response); + } diff --git a/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java b/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java index 30acdb91..f9126848 100644 --- a/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java +++ b/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java @@ -5,10 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.das.common.config.SessionUtil; import com.das.common.exceptions.ServiceException; import com.das.common.utils.BeanCopyUtils; +import com.das.common.utils.ExcelUtil; import com.das.modules.auth.domain.vo.SysUserVo; +import com.das.modules.equipment.domain.excel.SheetInfoBean; import com.das.modules.equipment.domain.dto.SysIotModelDto; import com.das.modules.equipment.domain.dto.SysIotModelFieldDto; import com.das.modules.equipment.domain.dto.SysIotModelServiceDto; +import com.das.modules.equipment.domain.excel.SysIotModelFieldExcel; +import com.das.modules.equipment.domain.excel.SysIotModelServiceExcel; import com.das.modules.equipment.domain.vo.SysIotModelFieldVo; import com.das.modules.equipment.domain.vo.SysIotModelServiceVo; import com.das.modules.equipment.domain.vo.SysIotModelVo; @@ -19,6 +23,8 @@ import com.das.modules.equipment.mapper.SysIotModelFieldMapper; import com.das.modules.equipment.mapper.SysIotModelMapper; import com.das.modules.equipment.mapper.SysIotModelServiceMapper; import com.das.modules.equipment.service.SysIotModelService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -67,14 +73,6 @@ public class SysIotModelServiceImpl implements SysIotModelService { public SysIotModelVo updateSysIotModel(SysIotModelDto sysIotModelDto) { SysIotModel sysIotModel = new SysIotModel(); BeanCopyUtils.copy(sysIotModelDto,sysIotModel); - - QueryWrapper sysIotModelQueryWrapper = new QueryWrapper<>(); - sysIotModelQueryWrapper.eq("iot_model_code", sysIotModelDto.getIotModelCode()); - sysIotModelQueryWrapper.eq("id", sysIotModelDto.getId()); - SysIotModel sysIotModelQuery = sysIotModelMapper.selectOne(sysIotModelQueryWrapper); - if (!(sysIotModelQuery == null)){ - throw new ServiceException("更新的物模型编码code重复"); - } SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); sysIotModel.setUpdatedTime(new Date()); sysIotModel.setUpdatedBy(sysUserVo.getAccount()); @@ -116,7 +114,7 @@ public class SysIotModelServiceImpl implements SysIotModelService { public List querySysIotModelField(SysIotModelFieldDto sysIotModelFieldDto) { List sysIotModelFieldVoList = new ArrayList<>(); QueryWrapper sysIotModelFieldQueryWrapper = new QueryWrapper<>(); - sysIotModelFieldQueryWrapper.like("iot_model_id",sysIotModelFieldDto.getIotModelId()); + sysIotModelFieldQueryWrapper.eq("iot_model_id",sysIotModelFieldDto.getIotModelId()); List sysIotModelFields = sysIotModelFieldMapper.selectList(sysIotModelFieldQueryWrapper); for (SysIotModelField item : sysIotModelFields){ SysIotModelFieldVo sysIotModelVo = new SysIotModelFieldVo(); @@ -154,14 +152,6 @@ public class SysIotModelServiceImpl implements SysIotModelService { public SysIotModelFieldVo updateSysIotModelField(SysIotModelFieldDto sysIotModelFieldDto) { SysIotModelField sysIotModelField = new SysIotModelField(); BeanCopyUtils.copy(sysIotModelFieldDto,sysIotModelField); - - QueryWrapper sysIotModelFieldQueryWrapper = new QueryWrapper<>(); - sysIotModelFieldQueryWrapper.eq("attribute_code", sysIotModelFieldDto.getAttributeCode()); - sysIotModelFieldQueryWrapper.eq("id", sysIotModelFieldDto.getId()); - SysIotModelField sysIotModelFieldQuery = sysIotModelFieldMapper.selectOne(sysIotModelFieldQueryWrapper); - if (!(sysIotModelFieldQuery == null)){ - throw new ServiceException("物模型属性修改的code已经存在"); - } SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); sysIotModelField.setUpdatedTime(new Date()); sysIotModelField.setUpdatedBy(sysUserVo.getAccount()); @@ -181,7 +171,7 @@ public class SysIotModelServiceImpl implements SysIotModelService { public List querySysIotModelService(SysIotModelServiceDto sysIotModelServiceDto) { List sysIotModelServiceVoList = new ArrayList<>(); QueryWrapper sysIotModelServicesQueryWrapper = new QueryWrapper<>(); - sysIotModelServicesQueryWrapper.like("iot_model_id",sysIotModelServiceDto.getIotModelId()); + sysIotModelServicesQueryWrapper.eq("iot_model_id",sysIotModelServiceDto.getIotModelId()); List sysIotModelServices = sysIotModelServiceMapper.selectList(sysIotModelServicesQueryWrapper); for (SysIotModelServices item : sysIotModelServices){ SysIotModelServiceVo sysIotServiceVo = new SysIotModelServiceVo(); @@ -219,14 +209,6 @@ public class SysIotModelServiceImpl implements SysIotModelService { public SysIotModelServiceVo updateSysIotModelService(SysIotModelServiceDto sysIotModelServiceDto) { SysIotModelServices sysIotModelServices = new SysIotModelServices(); BeanCopyUtils.copy(sysIotModelServiceDto,sysIotModelServices); - - QueryWrapper sysIotModelFieldQueryWrapper = new QueryWrapper<>(); - sysIotModelFieldQueryWrapper.eq("service_code", sysIotModelServiceDto.getServiceCode()); - sysIotModelFieldQueryWrapper.eq("id", sysIotModelServiceDto.getId()); - SysIotModelField sysIotModelFieldQuery = sysIotModelFieldMapper.selectOne(sysIotModelFieldQueryWrapper); - if (!(sysIotModelFieldQuery == null)){ - throw new ServiceException("物模型动作更新code已经存在"); - } SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); sysIotModelServices.setUpdatedTime(new Date()); sysIotModelServices.setUpdatedBy(sysUserVo.getAccount()); @@ -242,4 +224,20 @@ public class SysIotModelServiceImpl implements SysIotModelService { sysIotModelServiceMapper.deleteById(sysIotModelServiceDto.getId()); } + @Override + public void exportSysIotModel(SysIotModelDto sysIotModelDto, HttpServletRequest request, HttpServletResponse response) { + // 查询物模型属性和动作 + List sysIotModelFieldVoList = sysIotModelMapper.queryFieldByModelId(sysIotModelDto.getId()); + List sysIotModelServiceVoList = sysIotModelMapper.queryServiceByModelId(sysIotModelDto.getId()); + SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelDto.getId()); + String fileName = sysIotModel.getIotModelName()+":物模型信息表"; + List sheetInfoBeanList = new ArrayList<>(); + SheetInfoBean sheetInfoBean1 = new SheetInfoBean("物模型属性", SysIotModelFieldExcel.class, sysIotModelFieldVoList); + SheetInfoBean sheetInfoBean2 = new SheetInfoBean("物模型动作", SysIotModelServiceExcel.class, sysIotModelServiceVoList); + sheetInfoBeanList.add(sheetInfoBean1); + sheetInfoBeanList.add(sheetInfoBean2); + ExcelUtil.exportMoreSheet(fileName,request,response,sheetInfoBeanList); + + } + } diff --git a/das/src/main/resources/mapper/SysIotModelMapper.xml b/das/src/main/resources/mapper/SysIotModelMapper.xml new file mode 100644 index 00000000..dfca0ab6 --- /dev/null +++ b/das/src/main/resources/mapper/SysIotModelMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/datacollect/README.md b/docs/datacollect/README.md index d91e354b..99ff6f36 100644 --- a/docs/datacollect/README.md +++ b/docs/datacollect/README.md @@ -94,19 +94,69 @@ `ws://127.0.0.1:7790/gate/{nodeId}` +PS: 同一节点只允许建立一条连接。 + ## 通讯报文 -### 节点上线请求 - -?> 方向: `采集程序` -> `系统` +### 报文格式 ```json { - //节点ID - "nodeId" : "nx10928234", - //消息ID - "messageId": "123512351235123", //命令 - "action" : "online" + "cmd": "heartbeat", + //命令ID + "cmdId": "123123", + //发送时间(毫秒) + "time": 123123123123, + //数据体 + "data": {} } ``` + +### 节点心跳报文 + +?> 方向: `采集程序` -> `系统` + +**命令:** `heartbeat` + +**数据体:** +```json +{ + //心跳生存时间(毫秒) + "ttl": 30000, + //终端状态, 0 - 离线, 1 - 在线 + "status": 0, + //通讯链路监控信息 + "links": [ + { + //通讯链路IRN + "linkId": 3444, + //通讯链路状态 + "online": true + }, + { + "linkId": 123, + "online": false + } + ] +} +``` +### 实时数据上报 + +?> 方向: `采集程序` -> `系统` + +**命令:** `realdata` + +**数据体:** +```json +{ + //key为设备ID + "1123451235": { + //key为属性名 + "Ia": 123.1, + "Ib": 122.1, + "Ic": 123.1, + "Switch01": 1 + } +} +``` \ No newline at end of file diff --git a/ui/dasadmin/src/styles/mixins.scss b/ui/dasadmin/src/styles/mixins.scss index ae0d086d..1a868b41 100644 --- a/ui/dasadmin/src/styles/mixins.scss +++ b/ui/dasadmin/src/styles/mixins.scss @@ -1,14 +1,40 @@ +@use 'sass:math'; +@use 'sass:map'; + @mixin set-css-var-value($name, $value) { #{joinVarName($name)}: #{$value}; } @function joinVarName($list) { $name: '--ba'; + @each $item in $list { - @if $item != '' { - $name: $name + '-' + $item; + @if $item !='' { + $name: '#{$name}-#{$item}'; } } + + @return $name; +} + +@mixin set-css-var-value2($name, $value) { + @if $value=='' {} + + @else { + #{joinVarName2($name)}: #{$value}; + } + +} + +@function joinVarName2($list) { + $name: '--el'; + + @each $item in $list { + @if $item !='' { + $name: #{$name}+'-'+#{$item}; + } + } + @return $name; } @@ -20,11 +46,27 @@ * 通过映射设置所有的CSS变量 */ @mixin set-component-css-var($name, $variables) { - @each $attribute, $value in $variables { - @if $attribute == 'default' { + + @each $attribute, + $value in $variables { + @if $attribute =='default' { #{getCssVarName($name)}: #{$value}; - } @else { + } + + @else { #{getCssVarName($name, $attribute)}: #{$value}; } } } + +@mixin set-css-color-type($colors, $type) { + @include set-css-var-value2(('color', $type), map.get($colors, $type, 'base')); + + @each $i in (3, 5, 7, 8, 9) { + @include set-css-var-value2(('color', $type, 'light', $i), + map.get($colors, $type, 'light-#{$i}')); + } + + @include set-css-var-value2(('color', $type, 'dark-2'), + map.get($colors, $type, 'dark-2')); +} \ No newline at end of file diff --git a/ui/dasadmin/src/styles/var.scss b/ui/dasadmin/src/styles/var.scss index c200ea4d..6994e6ba 100644 --- a/ui/dasadmin/src/styles/var.scss +++ b/ui/dasadmin/src/styles/var.scss @@ -17,6 +17,8 @@ $colors: map.deep-merge(( // 白色和黑色作为基本颜色选项 ), 'warning': ('base': #e6a23c, ), + 'danger': ('base': #f56c6c, + ), 'error': ('base': #f56c6c, ), 'info': ('base': #909399, @@ -33,38 +35,45 @@ $color-black: map.get($colors, 'black') !default; // 黑色 $color-primary: map.get($colors, 'primary', 'base') !default; // 主要颜色,默认使用'base'色调 $color-success: map.get($colors, 'success', 'base') !default; // 成功状态颜色,默认使用'base'色调 $color-warning: map.get($colors, 'warning', 'base') !default; // 警告状态颜色,默认使用'base'色调 +$color-danger: map.get($colors, 'danger', 'base') !default; $color-error: map.get($colors, 'error', 'base') !default; // 错误状态颜色,默认使用'base'色调 $color-info: map.get($colors, 'info', 'base') !default; // 信息状态颜色,默认使用'base'色调 -// @mixin set-color-mix-level($type, -// $number, -// $mode: 'light', -// $mix-color: $color-white) { -// $colors: map.deep-merge(($type: ('#{$mode}-#{$number}': mix($mix-color, -// map.get($colors, $type, 'base'), -// math.percentage(math.div($number, 10))), -// ), -// ), -// $colors ) !global; -// } -// @mixin set-css-color-type($colors, $type) { -// @include set-css-var-value(('color', $type), map.get($colors, $type, 'base')); +@mixin set-color-mix-level($type, + $number, + $mode: 'light', + $mix-color: $color-white) { + $colors: map.deep-merge(($type: ('#{$mode}-#{$number}': mix($mix-color, + map.get($colors, $type, 'base'), + math.percentage(math.div($number, 10))), + ), + ), + $colors ) !global; +} -// @each $i in (3, 5, 7, 8, 9) { -// @include set-css-var-value(('color', $type, 'light', $i), -// map.get($colors, $type, 'light-#{$i}')); -// } +// $colors.primary.light-i +// --el-color-primary-light-i +// 10% 53a8ff +// 20% 66b1ff +// 30% 79bbff +// 40% 8cc5ff +// 50% a0cfff +// 60% b3d8ff +// 70% c6e2ff +// 80% d9ecff +// 90% ecf5ff +@each $type in $types { + @for $i from 1 through 9 { + @include set-color-mix-level($type, $i, 'light', $color-white); + } +} -// @include set-css-var-value(('color', $type, 'dark-2'), -// map.get($colors, $type, 'dark-2')); -// } +// --el-color-primary-dark-2 +@each $type in $types { + @include set-color-mix-level($type, 2, 'dark', $color-black); +} -// @each $type in $types { -// @for $i from 1 through 9 { -// @include set-color-mix-level($type, $i, 'light', $color-white); -// } -// } // // --el-color-primary-dark-2 // @each $type in $types { @@ -95,11 +104,11 @@ $border-color: map.merge(('': #f6f6f6, :root { - --el-color-primary: #0064AA !important; + // --el-color-primary: #0064AA !important; - // @each $type in $types { - // @include set-css-color-type($colors, $type); - // } + @each $type in $types { + @include set-css-color-type($colors, $type); + } @include set-css-var-value('main-space', $main-space); @include set-css-var-value('color-primary-light', $primary-light); diff --git a/ui/dasadmin/src/utils/layout.ts b/ui/dasadmin/src/utils/layout.ts index e45ceb34..cb832903 100644 --- a/ui/dasadmin/src/utils/layout.ts +++ b/ui/dasadmin/src/utils/layout.ts @@ -12,7 +12,7 @@ export function mainHeight(extra = 0): CSSProperties { let height = extra const adminLayoutMainExtraHeight: anyObj = { Default: 70, - Classic: 148, + Classic: 150, Streamline: 60, } if (isAdminApp()) { diff --git a/ui/dasadmin/src/views/backend/auth/menuManagement/index.vue b/ui/dasadmin/src/views/backend/auth/menu/index.vue similarity index 100% rename from ui/dasadmin/src/views/backend/auth/menuManagement/index.vue rename to ui/dasadmin/src/views/backend/auth/menu/index.vue diff --git a/ui/dasadmin/src/views/backend/InstitutionalManagement/InstitutionalManagement.vue b/ui/dasadmin/src/views/backend/auth/org/index.vue similarity index 100% rename from ui/dasadmin/src/views/backend/InstitutionalManagement/InstitutionalManagement.vue rename to ui/dasadmin/src/views/backend/auth/org/index.vue diff --git a/ui/dasadmin/src/views/backend/InstitutionalManagement/request.ts b/ui/dasadmin/src/views/backend/auth/org/request.ts similarity index 100% rename from ui/dasadmin/src/views/backend/InstitutionalManagement/request.ts rename to ui/dasadmin/src/views/backend/auth/org/request.ts diff --git a/ui/dasadmin/src/views/backend/InstitutionalManagement/type.ts b/ui/dasadmin/src/views/backend/auth/org/type.ts similarity index 100% rename from ui/dasadmin/src/views/backend/InstitutionalManagement/type.ts rename to ui/dasadmin/src/views/backend/auth/org/type.ts diff --git a/ui/dasadmin/src/views/backend/RoleManagement/RoleManagement.vue b/ui/dasadmin/src/views/backend/auth/role/index.vue similarity index 100% rename from ui/dasadmin/src/views/backend/RoleManagement/RoleManagement.vue rename to ui/dasadmin/src/views/backend/auth/role/index.vue diff --git a/ui/dasadmin/src/views/backend/RoleManagement/request.ts b/ui/dasadmin/src/views/backend/auth/role/request.ts similarity index 100% rename from ui/dasadmin/src/views/backend/RoleManagement/request.ts rename to ui/dasadmin/src/views/backend/auth/role/request.ts diff --git a/ui/dasadmin/src/views/backend/RoleManagement/type.ts b/ui/dasadmin/src/views/backend/auth/role/type.ts similarity index 100% rename from ui/dasadmin/src/views/backend/RoleManagement/type.ts rename to ui/dasadmin/src/views/backend/auth/role/type.ts diff --git a/ui/dasadmin/src/views/backend/auth/userManagement/index.vue b/ui/dasadmin/src/views/backend/auth/user/index.vue similarity index 100% rename from ui/dasadmin/src/views/backend/auth/userManagement/index.vue rename to ui/dasadmin/src/views/backend/auth/user/index.vue