Merge branch 'main' of http://121.37.111.42:3000/zhengsl/WholeProcessPlatform into main_hzz
This commit is contained in:
commit
7aa98abdfb
@ -22,29 +22,29 @@ public class ResponseResult extends HashMap<String, Object> {
|
||||
|
||||
public static ResponseResult error(String msg) {
|
||||
ResponseResult json = new ResponseResult();
|
||||
json.put((String)"code", "1");//错误
|
||||
json.put((String)"msg", msg);
|
||||
json.put("code", "1");//错误
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static ResponseResult message(String code, String msg) {
|
||||
ResponseResult json = new ResponseResult();
|
||||
json.put((String)"code", code);
|
||||
json.put((String)"msg", msg);
|
||||
json.put("code", code);
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static ResponseResult success(String msg) {
|
||||
ResponseResult json = new ResponseResult();
|
||||
json.put((String)"code", "0");//正常
|
||||
json.put((String)"msg", msg);
|
||||
json.put("code", "0");//正常
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static ResponseResult successData(Object obj) {
|
||||
ResponseResult json = new ResponseResult();
|
||||
json.put((String)"code", "0");//正常
|
||||
json.put((String)"msg", "操作成功");
|
||||
json.put("code", "0");//正常
|
||||
json.put("msg", "操作成功");
|
||||
json.put("data", obj);
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -63,10 +63,12 @@ public class SecurityConfig {
|
||||
.requestMatchers("/data/fishDraft/previewFile").permitAll()
|
||||
.requestMatchers("/tempFile/**").permitAll()
|
||||
.requestMatchers("/system/user/auditUser").permitAll()
|
||||
.requestMatchers("/register/accessToken").permitAll()
|
||||
.requestMatchers("/api/oauth2/oauth/token").permitAll()
|
||||
.requestMatchers("/dict/cache/**").permitAll()
|
||||
.requestMatchers("/sys/psbmodulelbb/**").permitAll()
|
||||
.requestMatchers("/base/operationLog/**").permitAll()
|
||||
.requestMatchers("/system/**").permitAll()
|
||||
// .requestMatchers("/eng/**").permitAll()
|
||||
// .requestMatchers("/eq/**").permitAll()
|
||||
// .requestMatchers("/env/**").permitAll()
|
||||
|
||||
@ -12,6 +12,7 @@ import com.yfd.platform.qgc_base.domain.SdEngInfoBHOperateRequest;
|
||||
import com.yfd.platform.qgc_base.domain.SdFishDictoryB;
|
||||
import com.yfd.platform.qgc_base.service.ISdFishDictoryBService;
|
||||
import com.yfd.platform.qgc_data.service.AttachmentUploadService;
|
||||
import com.yfd.platform.utils.DataSourceRequestUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -55,7 +56,7 @@ public class SdFishDictoryBController {
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查询鱼类字典列表(支持动态过滤和排序,不分页)")
|
||||
public ResponseResult list(@RequestBody DataSourceRequest request) {
|
||||
List<SdFishDictoryB> list = sdFishDictoryBService.list();
|
||||
List<SdFishDictoryB> list = DataSourceRequestUtil.executeList(request, SdFishDictoryB.class, sdFishDictoryBService);
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,8 @@ public interface SdFpssBHMapper extends BaseMapper<SdFpssBH> {
|
||||
"WHERE 1=1 " +
|
||||
"<if test='baseId != null and baseId != \"\"'> AND E.BASE_ID = #{baseId} </if>" +
|
||||
"<if test='rstcd != null and rstcd != \"\"'> AND F.RSTCD = #{rstcd} </if>" +
|
||||
"<if test='rvcd != null and rvcd != \"\"'> AND E.REACHCD = #{rvcd} </if>" +
|
||||
"<if test='rvcd != null and rvcd != \"\"'> AND E.RVCD = #{rvcd} </if>" +
|
||||
"<if test='reachcd != null and reachcd != \"\"'> AND E.REACHCD = #{reachcd} </if>" +
|
||||
// "<if test='rstcd != null and rstcd != \"\"'> AND F.RSTCD = #{rstcd} </if>" +
|
||||
"<if test='stnm != null and stnm != \"\"'> AND F.STNM LIKE '%' || #{stnm} || '%' </if>" +
|
||||
"ORDER BY F.ORDER_INDEX DESC" +
|
||||
|
||||
@ -46,6 +46,13 @@ public class FishPassageController {
|
||||
return ResponseResult.successData(fpRunService.processQgcFpssrlQueryKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/query/qgc/GetKendoListCustAI")
|
||||
@Operation(summary = "全过程过鱼自动(AI设备)与人工监测数据查询")
|
||||
public ResponseResult getQgcFpssrlAiRQueryKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fpRunService.processQgcFpssrlAiRQueryKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/fpssTable/qgc/GetKendoListCust")
|
||||
@Operation(summary = "过鱼设施监测数据查询")
|
||||
public ResponseResult getQgcFpssTableKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
|
||||
@ -23,6 +23,8 @@ public interface FpRunService {
|
||||
|
||||
DataSourceResult<FpFpssrlQueryVo> processQgcFpssrlQueryKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FpFpssrlQueryVo> processQgcFpssrlAiRQueryKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FpTableVo> processQgcFpssTableKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FpRunAnalysisTableVo> getAnalysisData(DataSourceRequest dataSourceRequest);
|
||||
|
||||
@ -220,6 +220,15 @@ public class FpRunServiceImpl implements FpRunService {
|
||||
return queryQgcFpssrlGroupList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FpFpssrlQueryVo> processQgcFpssrlAiRQueryKendoList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
if (CollUtil.isEmpty(dataSourceRequest == null ? null : dataSourceRequest.getGroup())) {
|
||||
return queryQgcFpssrlAiRDetailList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
return queryQgcFpssrlAiRGroupList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FpTableVo> processQgcFpssTableKendoList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
@ -1211,6 +1220,33 @@ public class FpRunServiceImpl implements FpRunService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<FpFpssrlQueryVo> queryQgcFpssrlAiRDetailList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append(buildQgcFpssrlDetailSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||
.append(" FROM (")
|
||||
.append(buildQgcFpssrlAiRCoreSql())
|
||||
.append(") t WHERE 1 = 1 ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildQgcFpssrlFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
sql.append(buildQgcFpssrlOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<FpFpssrlQueryVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, FpFpssrlQueryVo.class
|
||||
);
|
||||
DataSourceResult<FpFpssrlQueryVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<FpFpssrlQueryVo> queryQgcFpssrlGroupList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
List<DataSourceRequest.GroupDescriptor> groups = dataSourceRequest.getGroup();
|
||||
@ -1284,6 +1320,79 @@ public class FpRunServiceImpl implements FpRunService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<FpFpssrlQueryVo> queryQgcFpssrlAiRGroupList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
List<DataSourceRequest.GroupDescriptor> groups = dataSourceRequest.getGroup();
|
||||
GroupingInfo[] groupInfos = loadOptions == null ? new GroupingInfo[0] : loadOptions.getGroup();
|
||||
|
||||
StringBuilder sql = new StringBuilder("SELECT ");
|
||||
List<String> selectItems = new ArrayList<>();
|
||||
for (DataSourceRequest.GroupDescriptor descriptor : groups) {
|
||||
if (descriptor == null || StrUtil.isBlank(descriptor.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapQgcFpssrlColumn(descriptor.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
selectItems.add(column + " AS " + descriptor.getField().toUpperCase());
|
||||
selectItems.add("COUNT(*) AS COUNT_" + descriptor.getField().toUpperCase());
|
||||
if (CollUtil.isNotEmpty(descriptor.getAggregates())) {
|
||||
for (DataSourceRequest.AggregateDescriptor aggregate : descriptor.getAggregates()) {
|
||||
String aggregateColumn = mapQgcFpssrlColumn(aggregate.getField());
|
||||
if (StrUtil.isBlank(aggregateColumn) || StrUtil.isBlank(aggregate.getAggregate())) {
|
||||
continue;
|
||||
}
|
||||
String aggregateSql = buildAggregateSql(aggregate.getAggregate(), aggregateColumn, aggregate.getField());
|
||||
if (StrUtil.isNotBlank(aggregateSql)) {
|
||||
selectItems.add(aggregateSql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selectItems.isEmpty()) {
|
||||
selectItems.add("t.STCD AS STCD");
|
||||
selectItems.add("COUNT(*) AS COUNT_STCD");
|
||||
}
|
||||
|
||||
sql.append(String.join(", ", selectItems))
|
||||
.append(" FROM (")
|
||||
.append(buildQgcFpssrlCoreSql())
|
||||
.append(") t WHERE 1 = 1 ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildQgcFpssrlFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
|
||||
List<String> groupByColumns = new ArrayList<>();
|
||||
for (DataSourceRequest.GroupDescriptor descriptor : groups) {
|
||||
if (descriptor == null || StrUtil.isBlank(descriptor.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapQgcFpssrlColumn(descriptor.getField());
|
||||
if (StrUtil.isNotBlank(column)) {
|
||||
groupByColumns.add(column);
|
||||
}
|
||||
}
|
||||
if (!groupByColumns.isEmpty()) {
|
||||
sql.append(" GROUP BY ").append(String.join(", ", groupByColumns)).append(" ");
|
||||
}
|
||||
sql.append(buildQgcFpssrlGroupOrderBySql(groups));
|
||||
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(null, sql.toString(), paramMap);
|
||||
DataSourceResult<FpFpssrlQueryVo> result = new DataSourceResult<>();
|
||||
if (Boolean.TRUE.equals(dataSourceRequest.getGroupResultFlat())) {
|
||||
result.setData((List<FpFpssrlQueryVo>) (List<?>) new GroupHelper().faltGroup(rows, Arrays.asList(groupInfos)));
|
||||
} else {
|
||||
result.setData((List<FpFpssrlQueryVo>) (List<?>) new GroupHelper().group(rows, Arrays.asList(groupInfos)));
|
||||
}
|
||||
result.setTotal(0L);
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<FpSdfpssrVo> queryQgcSdfpssrGroupList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
List<DataSourceRequest.GroupDescriptor> groups = dataSourceRequest.getGroup();
|
||||
@ -1566,6 +1675,161 @@ public class FpRunServiceImpl implements FpRunService {
|
||||
") src";
|
||||
}
|
||||
|
||||
|
||||
private String buildQgcFpssrlAiRCoreSql() {
|
||||
return "SELECT " +
|
||||
"src.ID AS id, " +
|
||||
"src.STCD AS stcd, " +
|
||||
"src.STNM AS stnm, " +
|
||||
"src.BASEID AS baseId, " +
|
||||
"src.BASENAME AS baseName, " +
|
||||
"src.RSTCD AS rstcd, " +
|
||||
"src.ENNM AS ennm, " +
|
||||
"src.HBRVCD AS hbrvcd, " +
|
||||
"src.BASESTEPSORT AS baseStepSort, " +
|
||||
"src.RVCDSTEPSORT AS rvcdStepSort, " +
|
||||
"src.SITESTEPSORT AS siteStepSort, " +
|
||||
"src.RSTCDSTEPSORT AS rstcdStepSort, " +
|
||||
"src.TM AS tm, " +
|
||||
"src.YR AS yr, " +
|
||||
"src.FTP AS ftp, " +
|
||||
"src.FISHID AS fishId, " +
|
||||
"src.FSZ AS fsz, " +
|
||||
"src.LENGTH AS length, " +
|
||||
"src.WIDTH AS width, " +
|
||||
"src.FISHSPEED AS fishspeed, " +
|
||||
"src.DIRECTION AS direction, " +
|
||||
"src.TEMPERATURE AS temperature, " +
|
||||
"src.SPEED AS speed, " +
|
||||
"src.CHANNELNO AS channelno, " +
|
||||
"src.FCNT AS fcnt, " +
|
||||
"src.FIRSTIMGURL AS firstimgurl, " +
|
||||
"src.VIDEOURL AS videourl, " +
|
||||
"src.MWAY AS mway, " +
|
||||
"src.STRDT AS strdt, " +
|
||||
"src.ENDDT AS enddt, " +
|
||||
"src.STCODE AS stCode, " +
|
||||
"src.STNAME AS stName " +
|
||||
"FROM ( " +
|
||||
" SELECT t.ID AS ID, " +
|
||||
" t.STCD AS STCD, " +
|
||||
" fp.STNM AS STNM, " +
|
||||
" eng.BASE_ID AS BASEID, " +
|
||||
" hb.BASENAME AS BASENAME, " +
|
||||
" fp.RSTCD AS RSTCD, " +
|
||||
" eng.ENNM AS ENNM, " +
|
||||
" eng.HBRVCD AS HBRVCD, " +
|
||||
" NVL(hb.ORDER_INDEX, 999999) AS BASESTEPSORT, " +
|
||||
" NVL(hbrv.ORDER_INDEX, 999999) AS RVCDSTEPSORT, " +
|
||||
" NVL(fp.ORDER_INDEX, 999999) AS SITESTEPSORT, " +
|
||||
" NVL(eng.ORDER_INDEX, 999999) AS RSTCDSTEPSORT, " +
|
||||
" t.TM AS TM, " +
|
||||
" TO_CHAR(t.TM, 'YYYY') AS YR, " +
|
||||
" COALESCE(fishRv.NAME, relRv.FISH_NAME, fishZy.NAME, relZy.FISH_NAME, fishDirect.NAME, t.FTP) AS FTP, " +
|
||||
" t.FTP AS FISHID, " +
|
||||
" t.FSZ AS FSZ, " +
|
||||
" TO_CHAR(t.LENGTH) AS LENGTH, " +
|
||||
" TO_CHAR(t.WIDTH) AS WIDTH, " +
|
||||
" TO_CHAR(t.FISHSPEED) AS FISHSPEED, " +
|
||||
" TO_CHAR(t.DIRECTION) AS DIRECTION, " +
|
||||
" TO_CHAR(t.TEMPERATURE) AS TEMPERATURE, " +
|
||||
" TO_CHAR(t.SPEED) AS SPEED, " +
|
||||
" t.CHANNELNO AS CHANNELNO, " +
|
||||
" TO_CHAR(t.FCNT) AS FCNT, " +
|
||||
" t.FIRSTIMGURL AS FIRSTIMGURL, " +
|
||||
" t.VIDEOURL AS VIDEOURL, " +
|
||||
" 2 AS MWAY, " +
|
||||
" CAST(NULL AS DATE) AS STRDT, " +
|
||||
" CAST(NULL AS DATE) AS ENDDT, " +
|
||||
" fp.STTP AS STCODE, " +
|
||||
" sttp.STTP_NAME AS STNAME " +
|
||||
" FROM SD_FPSSRL_AI_R t " +
|
||||
" INNER JOIN V_MS_STBPRP_T fp ON fp.STCD = t.STCD " +
|
||||
" LEFT JOIN SD_STTP_B sttp ON sttp.STTP_CODE = fp.STTP AND NVL(sttp.IS_DELETED, 0) = 0 AND NVL(sttp.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = fp.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD " +
|
||||
" AND hbrv.BASEID = eng.BASE_ID " +
|
||||
" AND NVL(hbrv.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(hbrv.ENABLED, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_RLTN_B relRv ON relRv.FISH_ID = t.FTP " +
|
||||
" AND relRv.RVCD = eng.HBRVCD " +
|
||||
" AND NVL(relRv.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishRv ON fishRv.ID = relRv.ZY_FISH_ID " +
|
||||
" AND NVL(fishRv.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishRv.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_RLTN_B relZy ON relZy.FISH_ID = t.FTP " +
|
||||
" AND relZy.RVCD = 'ZY' " +
|
||||
" AND NVL(relZy.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishZy ON fishZy.ID = relZy.ZY_FISH_ID " +
|
||||
" AND NVL(fishZy.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishZy.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishDirect ON fishDirect.ID = t.FTP " +
|
||||
" AND NVL(fishDirect.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishDirect.ENABLE, 1) = 1 " +
|
||||
" WHERE NVL(t.IS_DELETED, 0) = 0 " +
|
||||
" UNION ALL " +
|
||||
" SELECT t.ID AS ID, " +
|
||||
" t.STCD AS STCD, " +
|
||||
" fp.STNM AS STNM, " +
|
||||
" eng.BASE_ID AS BASEID, " +
|
||||
" hb.BASENAME AS BASENAME, " +
|
||||
" fp.RSTCD AS RSTCD, " +
|
||||
" eng.ENNM AS ENNM, " +
|
||||
" eng.HBRVCD AS HBRVCD, " +
|
||||
" NVL(hb.ORDER_INDEX, 999999) AS BASESTEPSORT, " +
|
||||
" NVL(hbrv.ORDER_INDEX, 999999) AS RVCDSTEPSORT, " +
|
||||
" NVL(fp.ORDER_INDEX, 999999) AS SITESTEPSORT, " +
|
||||
" NVL(eng.ORDER_INDEX, 999999) AS RSTCDSTEPSORT, " +
|
||||
" t.STRDT AS TM, " +
|
||||
" TO_CHAR(t.STRDT, 'YYYY') AS YR, " +
|
||||
" COALESCE(fishRv.NAME, relRv.FISH_NAME, fishZy.NAME, relZy.FISH_NAME, fishDirect.NAME, t.FTP) AS FTP, " +
|
||||
" t.FTP AS FISHID, " +
|
||||
" t.FSZ AS FSZ, " +
|
||||
" CAST(NULL AS VARCHAR2(50)) AS LENGTH, " +
|
||||
" CAST(NULL AS VARCHAR2(50)) AS WIDTH, " +
|
||||
" CAST(NULL AS VARCHAR2(50)) AS FISHSPEED, " +
|
||||
" TO_CHAR(t.DIRECTION) AS DIRECTION, " +
|
||||
" CAST(NULL AS VARCHAR2(50)) AS TEMPERATURE, " +
|
||||
" CAST(NULL AS VARCHAR2(50)) AS SPEED, " +
|
||||
" CAST(NULL AS VARCHAR2(100)) AS CHANNELNO, " +
|
||||
" TO_CHAR(t.FCNT) AS FCNT, " +
|
||||
" t.PICPTH AS FIRSTIMGURL, " +
|
||||
" t.VDPTH AS VIDEOURL, " +
|
||||
" 1 AS MWAY, " +
|
||||
" t.STRDT AS STRDT, " +
|
||||
" t.ENDDT AS ENDDT, " +
|
||||
" fp.STTP AS STCODE, " +
|
||||
" sttp.STTP_NAME AS STNAME " +
|
||||
" FROM SD_FPSS_R t " +
|
||||
" INNER JOIN SD_FPSS_B_H fp ON fp.STCD = t.STCD " +
|
||||
" LEFT JOIN SD_STTP_B sttp ON sttp.STTP_CODE = fp.STTP AND NVL(sttp.IS_DELETED, 0) = 0 AND NVL(sttp.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = fp.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD " +
|
||||
" AND hbrv.BASEID = eng.BASE_ID " +
|
||||
" AND NVL(hbrv.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(hbrv.ENABLED, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_RLTN_B relRv ON relRv.FISH_ID = t.FTP " +
|
||||
" AND relRv.RVCD = eng.HBRVCD " +
|
||||
" AND NVL(relRv.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishRv ON fishRv.ID = relRv.ZY_FISH_ID " +
|
||||
" AND NVL(fishRv.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishRv.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_RLTN_B relZy ON relZy.FISH_ID = t.FTP " +
|
||||
" AND relZy.RVCD = 'ZY' " +
|
||||
" AND NVL(relZy.IS_DELETED, 0) = 0 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishZy ON fishZy.ID = relZy.ZY_FISH_ID " +
|
||||
" AND NVL(fishZy.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishZy.ENABLE, 1) = 1 " +
|
||||
" LEFT JOIN SD_FISHDICTORY_B fishDirect ON fishDirect.ID = t.FTP " +
|
||||
" AND NVL(fishDirect.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(fishDirect.ENABLE, 1) = 1 " +
|
||||
" WHERE NVL(t.IS_DELETED, 0) = 0 " +
|
||||
// " AND (t.TASK_STATUS = 'Approved' OR t.TASK_STATUS IS NULL) " +
|
||||
") src";
|
||||
}
|
||||
|
||||
private String buildQgcSdfpssrDetailSelectSql(List<String> selectFields) {
|
||||
Map<String, String> selectMap = new LinkedHashMap<>();
|
||||
selectMap.put("stcd", "t.stcd AS stcd");
|
||||
|
||||
@ -37,6 +37,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -100,9 +101,13 @@ public class LoginController {
|
||||
Integer status = loginUser.getUser().getStatus();
|
||||
String regStatus = loginUser.getUser().getRegStatus();
|
||||
|
||||
if (StrUtil.isNotBlank(tenantId)&&!tenantId.equals(loginUser.getUser().getTenantId())) {
|
||||
// 多门户:验证用户是否有权限访问指定门户
|
||||
if (!loginUser.isSuperAdmin() && StrUtil.isNotBlank(tenantId)) {
|
||||
List<String> accessibleIds = loginUser.getAccessibleTenantIds();
|
||||
if (accessibleIds == null || !accessibleIds.contains(tenantId)) {
|
||||
return ResponseResult.error("账号不存在或密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(regStatus)&&"REJECTED".equals(regStatus)) {
|
||||
return ResponseResult.error("账号审核未通过");
|
||||
@ -149,6 +154,10 @@ public class LoginController {
|
||||
|
||||
String token = JWTUtil.createToken(map, "12345678".getBytes());
|
||||
map.put("token", token);
|
||||
// 返回可访问门户列表和超级管理员标识
|
||||
map.put("accessibleTenantIds", loginUser.getAccessibleTenantIds());
|
||||
map.put("superAdmin", loginUser.isSuperAdmin());
|
||||
map.put("currentTenantId", tenantId);
|
||||
//把完整的用户信息存入到HuTool缓存中,userId作为key
|
||||
String jsonStr = JSONUtil.toJsonStr(loginUser);
|
||||
webConfig.loginuserCache().put("login:" + userId, jsonStr);
|
||||
@ -232,7 +241,7 @@ public class LoginController {
|
||||
@Operation(summary = "查询当前用户信息")
|
||||
@ResponseBody
|
||||
public ResponseResult getUserInfo() {
|
||||
ResponseResult responseResult = userService.getLoginUserInfo();
|
||||
Map<String, Object> responseResult = userService.getLoginUserInfo();
|
||||
return ResponseResult.successData(responseResult);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.yfd.platform.system.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.hutool.jwt.JWTUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.config.WebConfig;
|
||||
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
||||
@ -11,6 +13,9 @@ import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
||||
import com.yfd.platform.qgc_base.service.ISdHbrvDicService;
|
||||
import com.yfd.platform.system.domain.*;
|
||||
import com.yfd.platform.system.mapper.SysMenuMapper;
|
||||
import com.yfd.platform.system.mapper.SysOrganizationMapper;
|
||||
import com.yfd.platform.system.mapper.SysRoleMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserTenantMapper;
|
||||
import com.yfd.platform.system.service.ISmsVerifyCodeService;
|
||||
import com.yfd.platform.system.service.ISysLogService;
|
||||
import com.yfd.platform.system.service.IUserService;
|
||||
@ -60,12 +65,23 @@ public class SmsVerifyCodeController {
|
||||
@Resource
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
|
||||
@Resource
|
||||
private SysOrganizationMapper organizationMapper;
|
||||
|
||||
@Resource
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Resource
|
||||
private ISysUserDataScopeService sysUserDataScopeService;
|
||||
|
||||
@Resource
|
||||
private ISdEngInfoBHService engInfoBHService;
|
||||
|
||||
@Resource
|
||||
private SysUserTenantMapper sysUserTenantMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserTenantMapper userTenantMapper;
|
||||
@Resource
|
||||
private ISdHbrvDicService hbrvDicService;
|
||||
|
||||
@ -113,8 +129,7 @@ public class SmsVerifyCodeController {
|
||||
// if (existUser.getStatus() == 0) {
|
||||
// return ResponseResult.error("账号已被禁用");
|
||||
// }
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ResponseResult.error("类型错误:1-注册 2-找回密码 3-登录");
|
||||
}
|
||||
|
||||
@ -173,13 +188,12 @@ public class SmsVerifyCodeController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
*/
|
||||
@PostMapping("/register")
|
||||
@Operation(summary = "注册用户")
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseResult register(@RequestHeader(value = "Tenant_id", required = false) String tenantId, @RequestBody SmsVerifyCodeRequest smsVerifyCodeRequest) {
|
||||
String code = smsVerifyCodeRequest.getCode();
|
||||
if (smsVerifyCodeRequest.getPhone() == null || smsVerifyCodeRequest.getPhone().isEmpty()) {
|
||||
@ -212,13 +226,15 @@ public class SmsVerifyCodeController {
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.error("密码解密失败");
|
||||
}
|
||||
SysOrganization aDefault = organizationMapper.selectOne(new LambdaQueryWrapper<SysOrganization>().eq(SysOrganization::getCustom1, "default"));
|
||||
String orgid = aDefault == null ? null : aDefault.getId();
|
||||
user.setRegStatus("PENDING");
|
||||
user.setPhone(smsVerifyCodeRequest.getPhone());
|
||||
user.setBelongingUnit(smsVerifyCodeRequest.getBelongingUnit());
|
||||
user.setRegTime(new Date());
|
||||
user.setNickname(smsVerifyCodeRequest.getRealName());
|
||||
user.setStatus(0);
|
||||
user.setOrgid("e90063ced25e3d469860e88d920c082f");
|
||||
user.setOrgid(orgid);
|
||||
user.setUsertype(1);
|
||||
user.setTenantId(tenantId);
|
||||
user.setUsername(smsVerifyCodeRequest.getUsername());
|
||||
@ -228,6 +244,12 @@ public class SmsVerifyCodeController {
|
||||
// 给注册用户加上默认权限
|
||||
SysUser savedUser = userService.getUserByPhone(smsVerifyCodeRequest.getPhone(), tenantId);
|
||||
if (savedUser != null) {
|
||||
SysUserTenant sysUserTenant = new SysUserTenant();
|
||||
sysUserTenant.setTenantId(tenantId);
|
||||
sysUserTenant.setUserId(user.getId());
|
||||
sysUserTenant.setId(user.getId());
|
||||
// sysUserTenant.setOperateTime(new Date());
|
||||
userTenantMapper.insert(sysUserTenant);
|
||||
this.addDefaultRole(savedUser.getId(), smsVerifyCodeRequest);
|
||||
}
|
||||
if (success) {
|
||||
@ -237,101 +259,142 @@ public class SmsVerifyCodeController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 给用户分配流域/电站数据权限 + 默认角色。
|
||||
* <p>
|
||||
* 逻辑说明:
|
||||
* 1. 收集前端传入的电站编码,按流域分组
|
||||
* 2. 如果用户选了某流域的所有电站 → 保存流域权限(RVCD)
|
||||
* 3. 如果用户只选了某流域的部分电站 → 逐个保存电站权限(STATION)
|
||||
* 4. 数据库中查不到的孤立电站编码 → 直接保存电站权限
|
||||
* <p>
|
||||
* 示例:
|
||||
* - 选了 A流域全部6个电站 + B流域全部3个电站 + C流域1个电站
|
||||
* → 两条 RVCD(A、B)+ 一条 STATION(C的电站)
|
||||
*/
|
||||
private boolean addDefaultRole(String userId, SmsVerifyCodeRequest smsVerifyCodeRequest) {
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1. 收集前端传入的电站编码
|
||||
String stationCode = smsVerifyCodeRequest.getStationCode();
|
||||
String rvcdCode = smsVerifyCodeRequest.getRvcdCode();
|
||||
|
||||
Set<String> selectedStationCodes = new HashSet<>();
|
||||
if (StringUtils.isNotEmpty(stationCode)) {
|
||||
selectedStationCodes.addAll(Arrays.asList(stationCode.split(",")));
|
||||
}
|
||||
|
||||
Set<String> selectedBasinCodes = new HashSet<>();
|
||||
// 2. 如果没有选择任何电站
|
||||
if (selectedStationCodes.isEmpty()) {
|
||||
// 如果只传了流域,直接保存流域权限
|
||||
String rvcdCode = smsVerifyCodeRequest.getRvcdCode();
|
||||
if (StringUtils.isNotEmpty(rvcdCode)) {
|
||||
selectedBasinCodes.addAll(Arrays.asList(rvcdCode.split(",")));
|
||||
for (String basinCode : rvcdCode.split(",")) {
|
||||
if (StringUtils.isNotEmpty(basinCode)) {
|
||||
addDataScope(userId, "RVCD", basinCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
assignRoleToUser(userId);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set<String> addedStationCodes = new HashSet<>();
|
||||
|
||||
for (String basinCode : selectedBasinCodes) {
|
||||
if (StringUtils.isEmpty(basinCode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<SdEngInfoBH> allStationsInBasin = engInfoBHService.lambdaQuery()
|
||||
.eq(SdEngInfoBH::getRvcd, basinCode)
|
||||
// 3. 批量查询所有选中电站的工程信息,获取每个电站所属的流域
|
||||
List<SdEngInfoBH> selectedStations = engInfoBHService.lambdaQuery()
|
||||
.in(SdEngInfoBH::getStcd, selectedStationCodes)
|
||||
.list();
|
||||
|
||||
if (allStationsInBasin == null || allStationsInBasin.isEmpty()) {
|
||||
SysUserDataScope scope = new SysUserDataScope();
|
||||
scope.setUserId(userId);
|
||||
scope.setOrgType("RVCD");
|
||||
scope.setOrgId(basinCode);
|
||||
scope.setStatus(1);
|
||||
scope.setPermissionType("READ");
|
||||
sysUserDataScopeService.addDataScope(scope);
|
||||
// 已通过电站权限处理过的电站编码
|
||||
Set<String> processedStationCodes = new HashSet<>();
|
||||
// 已通过电站分组处理过的流域编码(用于后续差集判断)
|
||||
Set<String> processedBasinCodes = new HashSet<>();
|
||||
|
||||
if (!selectedStations.isEmpty()) {
|
||||
// 4. 按流域分组:{rvcd -> Set<stcd>}
|
||||
Map<String, Set<String>> basinToStations = new LinkedHashMap<>();
|
||||
for (SdEngInfoBH station : selectedStations) {
|
||||
String reachcd = station.getReachcd();
|
||||
String stcd = station.getStcd();
|
||||
if (StrUtil.isBlank(reachcd)) {
|
||||
// 无流域归属的电站,直接保存电站权限
|
||||
addDataScope(userId, "STATION", stcd);
|
||||
processedStationCodes.add(stcd);
|
||||
continue;
|
||||
}
|
||||
basinToStations.computeIfAbsent(reachcd, k -> new HashSet<>()).add(stcd);
|
||||
}
|
||||
|
||||
// 5. 对每个流域,判断用户是否选中了该流域的全部电站
|
||||
for (Map.Entry<String, Set<String>> entry : basinToStations.entrySet()) {
|
||||
String basinCode = entry.getKey();
|
||||
Set<String> selectedInThisBasin = entry.getValue();
|
||||
|
||||
// 查询该流域下的所有电站
|
||||
List<SdEngInfoBH> allStationsInBasin = engInfoBHService.lambdaQuery()
|
||||
.eq(SdEngInfoBH::getReachcd, basinCode)
|
||||
.list();
|
||||
Set<String> allStationCodesInBasin = allStationsInBasin.stream()
|
||||
.map(SdEngInfoBH::getStcd)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
boolean allStationsSelected = allStationCodesInBasin.containsAll(selectedStationCodes)
|
||||
&& selectedStationCodes.containsAll(allStationCodesInBasin);
|
||||
|
||||
if (allStationsSelected) {
|
||||
SysUserDataScope scope = new SysUserDataScope();
|
||||
scope.setUserId(userId);
|
||||
scope.setOrgType("RVCD");
|
||||
scope.setOrgId(basinCode);
|
||||
scope.setStatus(1);
|
||||
scope.setPermissionType("READ");
|
||||
sysUserDataScopeService.addDataScope(scope);
|
||||
// addedStationCodes.add(basinCode);
|
||||
if (allStationCodesInBasin.equals(selectedInThisBasin)) {
|
||||
// 全选 → 保存流域权限
|
||||
addDataScope(userId, "RVCD", basinCode);
|
||||
} else {
|
||||
Set<String> stationsInBasinAndSelected = allStationCodesInBasin.stream()
|
||||
.filter(selectedStationCodes::contains)
|
||||
.collect(Collectors.toSet());
|
||||
// 部分选 → 逐个保存电站权限
|
||||
for (String stcd : selectedInThisBasin) {
|
||||
addDataScope(userId, "STATION", stcd);
|
||||
}
|
||||
}
|
||||
processedStationCodes.addAll(selectedInThisBasin);
|
||||
processedBasinCodes.add(basinCode);
|
||||
}
|
||||
}
|
||||
|
||||
for (String stationCd : stationsInBasinAndSelected) {
|
||||
// 6. 处理数据库中查不到的电站编码(孤立的电站),直接保存电站权限
|
||||
for (String stcd : selectedStationCodes) {
|
||||
if (!processedStationCodes.contains(stcd)) {
|
||||
addDataScope(userId, "STATION", stcd);
|
||||
}
|
||||
}
|
||||
|
||||
// 7. 处理前端传了流域、但该流域下未匹配到任何选中电站的情况(直接保存流域权限)
|
||||
String rvcdCode = smsVerifyCodeRequest.getRvcdCode();
|
||||
if (StringUtils.isNotEmpty(rvcdCode)) {
|
||||
for (String basinCode : rvcdCode.split(",")) {
|
||||
if (StringUtils.isNotEmpty(basinCode) && !processedBasinCodes.contains(basinCode)) {
|
||||
addDataScope(userId, "RVCD", basinCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 8. 分配默认角色
|
||||
assignRoleToUser(userId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存一条数据权限
|
||||
*/
|
||||
private void addDataScope(String userId, String orgType, String orgId) {
|
||||
SysUserDataScope scope = new SysUserDataScope();
|
||||
scope.setUserId(userId);
|
||||
scope.setOrgType("STATION");
|
||||
scope.setOrgId(stationCd);
|
||||
scope.setOrgType(orgType);
|
||||
scope.setOrgId(orgId);
|
||||
scope.setStatus(1);
|
||||
scope.setPermissionType("READ");
|
||||
sysUserDataScopeService.addDataScope(scope);
|
||||
// addedStationCodes.add(stationCd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set<String> standaloneStations = selectedStationCodes.stream()
|
||||
// .filter(code -> !addedStationCodes.contains(code))
|
||||
// .collect(Collectors.toSet());
|
||||
//
|
||||
// for (String stationCd : standaloneStations) {
|
||||
// if (StringUtils.isEmpty(stationCd)) {
|
||||
// continue;
|
||||
// }
|
||||
// SysUserDataScope scope = new SysUserDataScope();
|
||||
// scope.setUserId(userId);
|
||||
// scope.setOrgType("STATION");
|
||||
// scope.setOrgId(stationCd);
|
||||
// scope.setStatus(1);
|
||||
// scope.setPermissionType("READ");
|
||||
// sysUserDataScopeService.addDataScope(scope);
|
||||
// }
|
||||
/**
|
||||
* 给用户分配默认角色
|
||||
*/
|
||||
private void assignRoleToUser(String userId) {
|
||||
SysUser user = new SysUser();
|
||||
SysRole aDefault = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getCustom1, "default"));
|
||||
String roleids = aDefault == null ? null : aDefault.getId();
|
||||
user.setId(userId);
|
||||
userService.updateUserRoles( user,"c13481a486c9ee559cf305284df4d207");
|
||||
// 加上角色权限
|
||||
return true;
|
||||
userService.updateUserRoles(user, roleids);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -441,8 +504,14 @@ public class SmsVerifyCodeController {
|
||||
loginUser.setUser(user);
|
||||
loginUser.setUsername(user.getUsername());
|
||||
//Todo 根据用户查询权限信息 添加到LoginUser中
|
||||
List<String> permissions =
|
||||
sysMenuMapper.selectPermsByUserId(user.getId());
|
||||
// 加载权限:超级管理员加载全部权限,普通用户按门户过滤
|
||||
boolean isSuperAdmin = userService.isSuperAdmin(user.getId());
|
||||
List<String> permissions;
|
||||
if (isSuperAdmin) {
|
||||
permissions = sysMenuMapper.selectPermsByUserId(user.getId(), null);
|
||||
} else {
|
||||
permissions = sysMenuMapper.selectPermsByUserId(user.getId(), tenantId);
|
||||
}
|
||||
loginUser.setPermissions(permissions);
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
SysLog sysLog = new SysLog();
|
||||
|
||||
@ -101,6 +101,21 @@ public class SysMenuController {
|
||||
return sysMenuService.permissionAssignment(code, roleId, StrUtil.trimToNull(tenantId));
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:权限分配(按系统分组,附带系统标识和名称)
|
||||
* 参数说明
|
||||
* roleId 角色ID
|
||||
* 返回值说明: [{"systemCode":"1","systemName":"Web端","menus":[...]}, ...]
|
||||
* 系统名称通过字典 PLATFORM_TENANT 获取
|
||||
***********************************/
|
||||
@PostMapping("/permissionAssignmentGrouped")
|
||||
@Operation(summary = "获取分配权限-按系统分组(含系统标识和名称)")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> permissionAssignmentGrouped(String roleId,
|
||||
String tenantId) {
|
||||
return sysMenuService.permissionAssignmentGrouped(roleId, StrUtil.trimToNull(tenantId));
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 获取当前用户菜单结构树
|
||||
* 参数说明
|
||||
@ -111,11 +126,12 @@ public class SysMenuController {
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getMenuTreeByUser(@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
SysUser userInfo = userService.getUserInfo();
|
||||
boolean superAdmin = userService.isSuperAdmin(userInfo.getId());
|
||||
String id = "";
|
||||
if (0 != userInfo.getUsertype()) {
|
||||
if (0 != userInfo.getUsertype() && !superAdmin) {
|
||||
id = userInfo.getId();
|
||||
}
|
||||
return sysMenuService.getMenuTree(id, StrUtil.isNotBlank(tenantId) ? StrUtil.trimToNull(tenantId) : userInfo.getTenantId());
|
||||
return sysMenuService.getMenuTree(id, tenantId);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
@ -148,7 +164,7 @@ public class SysMenuController {
|
||||
@ResponseBody
|
||||
public ResponseResult addMenu(@RequestBody SysMenu sysMenu,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
if(StrUtil.isBlank(sysMenu.getTenantId())){
|
||||
sysMenu.setTenantId(sysMenu.getSystemcode());
|
||||
}
|
||||
@ -178,7 +194,7 @@ public class SysMenuController {
|
||||
if (sysMenuService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的菜单");
|
||||
}
|
||||
sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
if(StrUtil.isBlank(sysMenu.getTenantId())){
|
||||
sysMenu.setTenantId(sysMenu.getSystemcode());
|
||||
}
|
||||
@ -206,8 +222,8 @@ public class SysMenuController {
|
||||
public ResponseResult deleteIcon(@RequestParam String id,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysMenu::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysMenu::getId, id);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
if (sysMenuService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的菜单");
|
||||
}
|
||||
@ -234,7 +250,7 @@ public class SysMenuController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysMenu> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 修改是否显示 ,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("isdisplay", isdisplay).set(
|
||||
updateWrapper.eq("id", id).set("isdisplay", isdisplay).set(
|
||||
"lastmodifier", userService.getUsername()).set(
|
||||
"lastmodifydate",
|
||||
new Timestamp(System.currentTimeMillis()));
|
||||
@ -262,12 +278,12 @@ public class SysMenuController {
|
||||
@RequestParam int orderno,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysMenu::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysMenu::getId, id);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
if (sysMenuService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的菜单");
|
||||
}
|
||||
boolean ok = sysMenuService.moveOrderno(parentid, id, orderno, StrUtil.trimToNull(tenantId));
|
||||
boolean ok = sysMenuService.moveOrderno(parentid, id, orderno, null);
|
||||
if (ok) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
@ -288,8 +304,8 @@ public class SysMenuController {
|
||||
public ResponseResult deleteById(@RequestParam String id,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysMenu::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysMenu::getId, id);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
if (sysMenuService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的菜单");
|
||||
}
|
||||
@ -321,11 +337,11 @@ public class SysMenuController {
|
||||
return ResponseResult.error("切换失败!");
|
||||
}
|
||||
LambdaQueryWrapper<SysMenu> fromWrapper = new LambdaQueryWrapper<>();
|
||||
fromWrapper.eq(SysMenu::getId, fromId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
fromWrapper.eq(SysMenu::getId, fromId);
|
||||
// fromWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
LambdaQueryWrapper<SysMenu> toWrapper = new LambdaQueryWrapper<>();
|
||||
toWrapper.eq(SysMenu::getId, toId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
toWrapper.eq(SysMenu::getId, toId);
|
||||
// toWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
if (sysMenuService.getOne(fromWrapper) == null || sysMenuService.getOne(toWrapper) == null) {
|
||||
return ResponseResult.error("存在不属于当前租户的菜单");
|
||||
}
|
||||
@ -350,8 +366,8 @@ public class SysMenuController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) throws FileNotFoundException {
|
||||
if (StrUtil.isNotBlank(menuId)) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysMenu::getId, menuId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysMenu::getId, menuId);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId));
|
||||
SysMenu sysMenu = sysMenuService.getOne(queryWrapper);
|
||||
if (sysMenu == null) {
|
||||
return ResponseResult.error("未找到对应租户的菜单");
|
||||
|
||||
@ -53,7 +53,7 @@ public class SysOrganizationController {
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getOrgScopeTree(String roleId,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
return organizationService.getOrgScopeTree(roleId, StrUtil.trimToNull(tenantId));
|
||||
return organizationService.getOrgScopeTree(roleId, null);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
@ -67,7 +67,7 @@ public class SysOrganizationController {
|
||||
public List<Map<String, Object>> getOrgTree(String parentid,
|
||||
String params,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
return organizationService.getOrgTree(parentid, params, StrUtil.trimToNull(tenantId));
|
||||
return organizationService.getOrgTree(parentid, params, null);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
@ -85,7 +85,7 @@ public class SysOrganizationController {
|
||||
return ResponseResult.error("查询失败!");
|
||||
}
|
||||
List<SysOrganization> sysOrganizations =
|
||||
organizationService.getOrganizationById(id, orgName, StrUtil.trimToNull(tenantId));
|
||||
organizationService.getOrganizationById(id, orgName, null);
|
||||
return ResponseResult.successData(sysOrganizations);
|
||||
}
|
||||
|
||||
@ -102,8 +102,8 @@ public class SysOrganizationController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysOrganization> queryWrapper =
|
||||
new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysOrganization::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysOrganization::getId, id);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
SysOrganization sysOrganization = organizationService.getOne(queryWrapper);
|
||||
return ResponseResult.successData(sysOrganization);
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class SysOrganizationController {
|
||||
if("".equals(sysOrganization.getId())){
|
||||
sysOrganization.setId(null);
|
||||
}
|
||||
sysOrganization.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// sysOrganization.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
//填写 当前用户名称
|
||||
sysOrganization.setLastmodifier(userService.getUsername());
|
||||
//填写 当前日期
|
||||
@ -155,12 +155,12 @@ public class SysOrganizationController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysOrganization> queryWrapper =
|
||||
new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysOrganization::getId, sysOrganization.getId())
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysOrganization::getId, sysOrganization.getId());
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
if (organizationService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的组织");
|
||||
}
|
||||
sysOrganization.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// sysOrganization.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
//填写 当前用户名称
|
||||
sysOrganization.setLastmodifier(userService.getUsername());
|
||||
//填写 当前日期
|
||||
@ -189,7 +189,7 @@ public class SysOrganizationController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysOrganization> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 修改是否有效,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("isvaild", isvaild).set("lastmodifier"
|
||||
updateWrapper.eq("id", id).set("isvaild", isvaild).set("lastmodifier"
|
||||
, userService.getUsername()).set("lastmodifydate",
|
||||
new Timestamp(System.currentTimeMillis()));
|
||||
boolean isOk = organizationService.update(updateWrapper);
|
||||
@ -216,28 +216,24 @@ public class SysOrganizationController {
|
||||
for (String orgId : orgIds) {
|
||||
LambdaQueryWrapper<SysOrganization> currentWrapper =
|
||||
new LambdaQueryWrapper<>();
|
||||
currentWrapper.eq(SysOrganization::getId, orgId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
currentWrapper.eq(SysOrganization::getId, orgId);
|
||||
// currentWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
if (organizationService.getOne(currentWrapper) == null) {
|
||||
return ResponseResult.error("存在不属于当前租户的组织");
|
||||
return ResponseResult.error("不存在对应组织");
|
||||
}
|
||||
LambdaQueryWrapper<SysOrganization> queryWrapper =
|
||||
new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId));
|
||||
List<SysOrganization> list =
|
||||
organizationService.list(queryWrapper.eq(SysOrganization::getParentid, orgId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId)));
|
||||
organizationService.list(queryWrapper.eq(SysOrganization::getParentid, orgId));
|
||||
List<String> ids =
|
||||
list.stream().map(SysOrganization::getId).collect(Collectors.toList());
|
||||
list.stream().map(SysOrganization::getId).toList();
|
||||
boolean isOk = organizationService.remove(new LambdaQueryWrapper<SysOrganization>()
|
||||
.eq(SysOrganization::getId, orgId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId)));
|
||||
.eq(SysOrganization::getId, orgId));
|
||||
if (!isOk) {
|
||||
continue;
|
||||
}
|
||||
for (String oid : ids) {
|
||||
organizationService.remove(new LambdaQueryWrapper<SysOrganization>()
|
||||
.eq(SysOrganization::getId, oid)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, StrUtil.trim(tenantId)));
|
||||
organizationService.remove(new LambdaQueryWrapper<SysOrganization>().eq(SysOrganization::getId, oid));
|
||||
}
|
||||
}
|
||||
return ResponseResult.success();
|
||||
|
||||
@ -54,8 +54,23 @@ public class SysRoleController {
|
||||
@Operation(summary = "查询所有角色")
|
||||
@ResponseBody
|
||||
public List<SysRole> list(@RequestParam(required = false) String rolename,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
return roleService.selectRoleList(rolename, StrUtil.trimToNull(tenantId));
|
||||
@RequestParam(required = false) String tenantId) {
|
||||
return roleService.selectRoleList(rolename, tenantId);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:按门户分组查询角色(门户 → 角色两层结构)
|
||||
* 参数说明
|
||||
* rolename 角色名称(可选,模糊搜索)
|
||||
* 返回值说明: [{"tenantId":"...","tenantName":"水利门户","roles":[...]}, ...]
|
||||
* 门户中文名通过字典 PLATFORM_TENANT 获取
|
||||
***********************************/
|
||||
@PostMapping("/listGroupedByTenant")
|
||||
@Operation(summary = "按门户分组查询角色(含门户中文名)")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> listGroupedByTenant(@RequestParam(required = false) String rolename,
|
||||
@RequestParam(required = false) String tenantId) {
|
||||
return roleService.selectRoleListGroupedByTenant(tenantId,rolename);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
@ -70,8 +85,8 @@ public class SysRoleController {
|
||||
public ResponseResult getOneById(String id,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysRole::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysRole::getId, id);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
SysRole sysRole = roleService.getOne(queryWrapper);
|
||||
return ResponseResult.successData(sysRole);
|
||||
}
|
||||
@ -88,7 +103,7 @@ public class SysRoleController {
|
||||
@ResponseBody
|
||||
public ResponseResult addRole(@RequestBody SysRole sysRole,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
sysRole.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// sysRole.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
boolean isOk = roleService.addRole(sysRole);
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
@ -113,7 +128,7 @@ public class SysRoleController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysRole> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 更新权限,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("optscope", optscope).set(
|
||||
updateWrapper.eq("id", id).set("optscope", optscope).set(
|
||||
"lastmodifier", userService.getUsername()).set(
|
||||
"lastmodifydate", LocalDateTime.now());
|
||||
boolean ok = roleService.update(updateWrapper);
|
||||
@ -141,8 +156,7 @@ public class SysRoleController {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysRole::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysRole::getId, id);
|
||||
if (roleService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的角色");
|
||||
}
|
||||
@ -158,8 +172,7 @@ public class SysRoleController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
long menuCount = sysMenuService.count(new LambdaQueryWrapper<SysMenu>()
|
||||
.in(SysMenu::getId, menuIdList)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, StrUtil.trim(tenantId)));
|
||||
.in(SysMenu::getId, menuIdList));
|
||||
if (menuCount != menuIdList.size()) {
|
||||
return ResponseResult.error("存在不属于当前租户的菜单");
|
||||
}
|
||||
@ -188,7 +201,7 @@ public class SysRoleController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysRole> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 更新组织范围,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("orgscope", orgscope).set(
|
||||
updateWrapper.eq("id", id).set("orgscope", orgscope).set(
|
||||
"lastmodifier", userService.getUsername()).set(
|
||||
"lastmodifydate", LocalDateTime.now());
|
||||
boolean ok = roleService.update(updateWrapper);
|
||||
@ -215,7 +228,7 @@ public class SysRoleController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysRole> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 更新业务范围,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("busscope", busscope).set(
|
||||
updateWrapper.eq("id", id).set("busscope", busscope).set(
|
||||
"lastmodifier", userService.getUsername()).set(
|
||||
"lastmodifydate", LocalDateTime.now());
|
||||
boolean ok = roleService.update(updateWrapper);
|
||||
@ -240,8 +253,7 @@ public class SysRoleController {
|
||||
public ResponseResult setRoleUsers(String roleid, String userids,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysRole> roleWrapper = new LambdaQueryWrapper<>();
|
||||
roleWrapper.eq(SysRole::getId, roleid)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
roleWrapper.eq(SysRole::getId, roleid);
|
||||
if (roleService.getOne(roleWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的角色");
|
||||
}
|
||||
@ -270,8 +282,7 @@ public class SysRoleController {
|
||||
@RequestParam String userids,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysRole> roleWrapper = new LambdaQueryWrapper<>();
|
||||
roleWrapper.eq(SysRole::getId, roleid)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
roleWrapper.eq(SysRole::getId, roleid);
|
||||
if (roleService.getOne(roleWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的角色");
|
||||
}
|
||||
@ -298,7 +309,7 @@ public class SysRoleController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
UpdateWrapper<SysRole> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 更新业务范围,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).eq(StrUtil.isNotBlank(tenantId), "tenant_id", StrUtil.trim(tenantId)).set("isvaild", isvaild).set("lastmodifier"
|
||||
updateWrapper.eq("id", id).set("isvaild", isvaild).set("lastmodifier"
|
||||
, userService.getUsername()).set("lastmodifydate",
|
||||
LocalDateTime.now());
|
||||
boolean ok = roleService.update(updateWrapper);
|
||||
@ -321,8 +332,7 @@ public class SysRoleController {
|
||||
public ResponseResult updateById(@RequestBody SysRole sysRole,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysRole::getId, sysRole.getId())
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysRole::getId, sysRole.getId());
|
||||
if (roleService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("未找到对应租户的角色");
|
||||
}
|
||||
@ -354,8 +364,7 @@ public class SysRoleController {
|
||||
String[] roleIds = id.split(",");
|
||||
for (String roleId : roleIds) {
|
||||
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysRole::getId, roleId)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysRole::getId, roleId);
|
||||
if (roleService.getOne(queryWrapper) == null) {
|
||||
return ResponseResult.error("存在不属于当前租户的角色");
|
||||
}
|
||||
@ -383,7 +392,7 @@ public class SysRoleController {
|
||||
String rolename, String isvaild,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
return roleService.listRoleUsers(orgid, username, status, level,
|
||||
rolename, isvaild, StrUtil.trimToNull(tenantId));
|
||||
rolename, isvaild, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -45,7 +46,7 @@ public class UserController {
|
||||
public ResponseResult addUser(@RequestBody SysUser user,
|
||||
String roleids,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
user.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// user.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
Map reslut = userService.addUser(user, roleids);
|
||||
return ResponseResult.successData(reslut);
|
||||
}
|
||||
@ -60,7 +61,7 @@ public class UserController {
|
||||
if (StrUtil.isEmpty(user.getId())) {
|
||||
return ResponseResult.error("没有用户ID");
|
||||
}
|
||||
user.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
// user.setTenantId(StrUtil.trimToNull(tenantId));
|
||||
//填写 当前用户名称
|
||||
user.setLastmodifier(userService.getUsername());
|
||||
//填写 当前日期
|
||||
@ -79,7 +80,7 @@ public class UserController {
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
|
||||
Page<SysUser> mapPage = userService.queryUsers(orgid,
|
||||
username, StrUtil.trimToNull(tenantId), page);
|
||||
username, null, page);
|
||||
return ResponseResult.successData(mapPage);
|
||||
}
|
||||
|
||||
@ -115,8 +116,8 @@ public class UserController {
|
||||
public ResponseResult queryUserById(String id,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUser::getId, id)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysUser::getTenantId, StrUtil.trim(tenantId));
|
||||
queryWrapper.eq(SysUser::getId, id);
|
||||
// .eq(StrUtil.isNotBlank(tenantId), SysUser::getTenantId, StrUtil.trim(tenantId));
|
||||
SysUser user = userService.getOne(queryWrapper);
|
||||
return ResponseResult.successData(user);
|
||||
}
|
||||
@ -248,7 +249,57 @@ public class UserController {
|
||||
String name,
|
||||
String regStatus,
|
||||
@RequestHeader(value = "Tenant_id", required = false) String tenantId) {
|
||||
Page<SysUser> result = userService.queryPendingAuditUsers(page, name, regStatus, StrUtil.trimToNull(tenantId));
|
||||
Page<SysUser> result = userService.queryPendingAuditUsers(page, name, regStatus, null);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
// ==================== 多门户管理 ====================
|
||||
|
||||
/***********************************
|
||||
* 用途说明:为用户分配门户
|
||||
* 参数说明 userId 用户ID, tenantIds 门户ID列表(逗号分隔)
|
||||
************************************/
|
||||
@Log(module = "系统用户", value = "分配门户")
|
||||
@PostMapping("/assignTenant")
|
||||
@Operation(summary = "为用户分配门户")
|
||||
@ResponseBody
|
||||
public ResponseResult assignTenant(String userId, String tenantIds) {
|
||||
if (StrUtil.isBlank(userId) || StrUtil.isBlank(tenantIds)) {
|
||||
return ResponseResult.error("用户ID和门户ID不能为空");
|
||||
}
|
||||
List<String> tenantIdList = List.of(tenantIds.split(","));
|
||||
userService.assignTenantsToUser(userId, tenantIdList);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:移除用户的门户关联
|
||||
* 参数说明 userId 用户ID, tenantId 门户ID
|
||||
************************************/
|
||||
@Log(module = "系统用户", value = "移除门户")
|
||||
@PostMapping("/removeTenant")
|
||||
@Operation(summary = "移除用户的门户关联")
|
||||
@ResponseBody
|
||||
public ResponseResult removeTenant(String userId, String tenantId) {
|
||||
if (StrUtil.isBlank(userId) || StrUtil.isBlank(tenantId)) {
|
||||
return ResponseResult.error("用户ID和门户ID不能为空");
|
||||
}
|
||||
userService.removeTenantFromUser(userId, tenantId);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:获取用户关联的门户列表
|
||||
* 参数说明 userId 用户ID
|
||||
************************************/
|
||||
@GetMapping("/getUserTenants")
|
||||
@Operation(summary = "获取用户关联的门户列表")
|
||||
@ResponseBody
|
||||
public ResponseResult getUserTenants(String userId) {
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return ResponseResult.error("用户ID不能为空");
|
||||
}
|
||||
List<String> tenants = userService.getUserTenants(userId);
|
||||
return ResponseResult.successData(tenants);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,17 +24,42 @@ public class LoginUser implements UserDetails {
|
||||
|
||||
private List<String> permissions = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 当前登录的门户ID
|
||||
*/
|
||||
private String currentTenantId;
|
||||
|
||||
/**
|
||||
* 用户可访问的门户ID列表(用于门户切换)
|
||||
*/
|
||||
private List<String> accessibleTenantIds;
|
||||
|
||||
/**
|
||||
* 是否超级管理员(LEVEL=1)
|
||||
*/
|
||||
private boolean superAdmin;
|
||||
|
||||
/**
|
||||
* 自定义构造函数(如果需要特殊逻辑)
|
||||
*/
|
||||
public LoginUser(SysUser user, List<String> permissions) {
|
||||
this.user = user;
|
||||
// 4. 增加非空判断,确保 permissions 永远不为 null
|
||||
if (permissions != null) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
||||
public LoginUser(SysUser user, List<String> permissions,
|
||||
String currentTenantId, List<String> accessibleTenantIds, boolean superAdmin) {
|
||||
this.user = user;
|
||||
if (permissions != null) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
this.currentTenantId = currentTenantId;
|
||||
this.accessibleTenantIds = accessibleTenantIds;
|
||||
this.superAdmin = superAdmin;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private List<SimpleGrantedAuthority> authorities;
|
||||
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.yfd.platform.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户-门户关联表
|
||||
* </p>
|
||||
*/
|
||||
@Data
|
||||
@TableName("SYS_USER_TENANT")
|
||||
public class SysUserTenant implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 用户ID */
|
||||
private String userId;
|
||||
|
||||
/** 门户ID */
|
||||
private String tenantId;
|
||||
|
||||
@TableField("OPERATOR")
|
||||
private String operator;
|
||||
|
||||
@TableField("OPERATE_TIME")
|
||||
private Date operateTime;
|
||||
|
||||
}
|
||||
@ -44,7 +44,7 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
@Param("tenantId") String tenantId);
|
||||
|
||||
|
||||
List<String> selectPermsByUserId(String userId);
|
||||
List<String> selectPermsByUserId(@Param("userId") String userId, @Param("tenantId") String tenantId);
|
||||
|
||||
//List<SysMenu> selectMenuByUserId(String userId);
|
||||
List<SysMenu> selectMenuByUserId(@Param("userId") String userId, @Param("tenantId") String tenantId);
|
||||
|
||||
@ -29,7 +29,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* userid 用户id
|
||||
* 返回值说明:
|
||||
************************************/
|
||||
boolean addUserRoles(@Param("id")String id,@Param("roleid") String roleid,@Param("userid") String userid);
|
||||
boolean addUserRoles(@Param("operator") String operator,@Param("id")String id,@Param("roleid") String roleid,@Param("userid") String userid);
|
||||
|
||||
/***********************************
|
||||
* 用途说明:根据用户id 和角色id 查询 系统角色用户对照表
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.yfd.platform.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.system.domain.SysUserTenant;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户-门户关联表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserTenantMapper extends BaseMapper<SysUserTenant> {
|
||||
|
||||
/**
|
||||
* 查询用户可访问的门户ID列表
|
||||
*/
|
||||
List<String> getTenantIdsByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户-门户关联
|
||||
*/
|
||||
int deleteByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 批量新增用户-门户关联
|
||||
*/
|
||||
int batchInsert(@Param("operator") String operator,@Param("userId") String userId, @Param("tenantIds") List<String> tenantIds);
|
||||
|
||||
/**
|
||||
* 查询某门户下的所有用户ID
|
||||
*/
|
||||
List<String> getUserIdsByTenantId(@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 删除指定用户和指定门户的关联
|
||||
*/
|
||||
int deleteByUserIdAndTenantId(@Param("userId") String userId, @Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* 批量查询用户-门户关联(用于用户列表展示)
|
||||
*/
|
||||
List<java.util.Map<String, Object>> getTenantIdsByUserIds(@Param("userIds") List<String> userIds);
|
||||
}
|
||||
@ -97,5 +97,14 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
***********************************/
|
||||
List<Map<String, Object>> permissionAssignment(String code, String roleId, String tenantId);
|
||||
|
||||
/***********************************
|
||||
* 用途说明:权限分配(按系统分组,附带系统标识和名称)
|
||||
* 参数说明
|
||||
* roleId 角色ID
|
||||
* tenantId 门户ID
|
||||
* 返回值说明: [{"systemCode":"1","systemName":"Web端","menus":[...]}, ...]
|
||||
***********************************/
|
||||
List<Map<String, Object>> permissionAssignmentGrouped(String roleId, String tenantId);
|
||||
|
||||
String uploadIcon(MultipartFile icon) throws FileNotFoundException;
|
||||
}
|
||||
|
||||
@ -67,4 +67,13 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
List<SysRole> selectRoleList(String rolename, String tenantId);
|
||||
|
||||
List<SysRole> queryRolesList(String roleName, String tenantId);
|
||||
|
||||
/***********************************
|
||||
* 用途说明:按门户分组查询角色(门户 → 角色两层结构)
|
||||
* 参数说明
|
||||
* rolename 角色名称(可选,模糊搜索)
|
||||
* 返回值说明: [{"tenantId":"...","tenantName":"水利门户","roles":[...]}, ...]
|
||||
* 门户中文名通过字典 PLATFORM_TENANT 获取
|
||||
***********************************/
|
||||
List<Map<String, Object>> selectRoleListGroupedByTenant(String tenantId,String rolename);
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public interface IUserService extends IService<SysUser> {
|
||||
************************************/
|
||||
Map<String, String> getNameInfo();
|
||||
//获取当前用户信息带权限
|
||||
ResponseResult getLoginUserInfo();
|
||||
Map<String, Object> getLoginUserInfo();
|
||||
|
||||
/***********************************
|
||||
* 用途说明:新增用户
|
||||
@ -184,4 +184,23 @@ public interface IUserService extends IService<SysUser> {
|
||||
Page<SysUser> queryPendingAuditUsers(Page<SysUser> page, String name, String regStatus, String tenantId);
|
||||
|
||||
List<SysUser> queryUsersList(String name, String tenantId);
|
||||
|
||||
// ==================== 多门户管理 ====================
|
||||
|
||||
/**
|
||||
* 为用户分配门户
|
||||
*/
|
||||
void assignTenantsToUser(String userId, List<String> tenantIds);
|
||||
|
||||
/**
|
||||
* 移除用户的某个门户关联
|
||||
*/
|
||||
void removeTenantFromUser(String userId, String tenantId);
|
||||
|
||||
/**
|
||||
* 获取用户关联的门户ID列表
|
||||
*/
|
||||
List<String> getUserTenants(String userId);
|
||||
|
||||
boolean isSuperAdmin(String userId);
|
||||
}
|
||||
|
||||
@ -38,17 +38,17 @@ public class AdminAuthServiceImpl implements IAdminAuthService {
|
||||
public List<String> getSuperAdminUsernames() {
|
||||
|
||||
// 获取当前请求
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUser::getUsertype, 0).select(SysUser::getUsername);
|
||||
//根据用户名称或手机号查询用户信息
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
String tenantId = request.getHeader("Tenant_Id");
|
||||
if(StrUtil.isNotBlank(tenantId)){
|
||||
queryWrapper.eq(SysUser::getTenantId, tenantId);
|
||||
}
|
||||
}
|
||||
// if (attributes != null) {
|
||||
// HttpServletRequest request = attributes.getRequest();
|
||||
// String tenantId = request.getHeader("Tenant_Id");
|
||||
// if(StrUtil.isNotBlank(tenantId)){
|
||||
// queryWrapper.eq(SysUser::getTenantId, tenantId);
|
||||
// }
|
||||
// }
|
||||
List<SysUser> userList = userMapper.selectList(queryWrapper);
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return new ArrayList<>();
|
||||
@ -74,6 +74,8 @@ public class AdminAuthServiceImpl implements IAdminAuthService {
|
||||
|
||||
@Override
|
||||
public boolean isCurrentManagedAdmin() {
|
||||
return isManagedAdminUsername(SecurityUtils.getCurrentUsername());
|
||||
String maxLevel = userMapper.getMaxLevel(SecurityUtils.getUserId());
|
||||
boolean adminRole = "1".equals(maxLevel);
|
||||
return adminRole||isManagedAdminUsername(SecurityUtils.getCurrentUsername());
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
|
||||
LambdaQueryWrapper<SmsVerifyCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SmsVerifyCode::getPhone, phone)
|
||||
.eq(SmsVerifyCode::getType, type)
|
||||
.gt(SmsVerifyCode::getTenantId, tenantId)
|
||||
.eq(SmsVerifyCode::getTenantId, tenantId)
|
||||
.eq(SmsVerifyCode::getStatus, SmsVerifyCode.STATUS_UNUSED);
|
||||
|
||||
this.remove(queryWrapper);
|
||||
@ -161,7 +161,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
|
||||
}
|
||||
List<String> ids = userIds.stream().distinct().toList();
|
||||
List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().in(SysUser::getId, ids)
|
||||
.eq(SysUser::getRegStatus, "APPROVED").eq(SysUser::getTenantId, tenantId).eq(SysUser::getStatus,1).select(SysUser::getPhone));
|
||||
.eq(SysUser::getRegStatus, "APPROVED").eq(SysUser::getStatus,1).select(SysUser::getPhone));
|
||||
|
||||
if (sysUsers.isEmpty()) {
|
||||
log.warn("催促短信发送失败:未找到有效的手机号,userIds: {}", ids);
|
||||
|
||||
@ -7,10 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.system.domain.SysDictionary;
|
||||
import com.yfd.platform.system.domain.SysDictionaryItems;
|
||||
import com.yfd.platform.system.domain.SysMenu;
|
||||
import com.yfd.platform.system.domain.SysRole;
|
||||
import com.yfd.platform.system.mapper.SysMenuMapper;
|
||||
import com.yfd.platform.system.mapper.SysRoleMapper;
|
||||
import com.yfd.platform.system.service.ISysDictionaryItemsService;
|
||||
import com.yfd.platform.system.service.ISysDictionaryService;
|
||||
import com.yfd.platform.system.service.ISysMenuService;
|
||||
import com.yfd.platform.utils.FileUtil;
|
||||
import com.yfd.platform.config.FileSpaceProperties;
|
||||
@ -47,6 +51,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@Resource
|
||||
private UserServiceImpl currentUser;
|
||||
|
||||
@Resource
|
||||
private ISysDictionaryService sysDictionaryService;
|
||||
|
||||
@Resource
|
||||
private ISysDictionaryItemsService sysDictionaryItemsService;
|
||||
|
||||
@Resource
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
@ -443,6 +453,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
} else {
|
||||
sysMenuList = sysMenuMapper.selectMenuByUserId(id, tenantId);
|
||||
}
|
||||
if (sysMenuList==null||sysMenuList.isEmpty()) {
|
||||
throw new RuntimeException("无菜单");
|
||||
}
|
||||
// 将 SysMenu 转换为 Map 并构建树
|
||||
List<Map<String, Object>> list = sysMenuList.stream()
|
||||
.map(menu -> {
|
||||
@ -502,6 +515,77 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
return listTree;
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:权限分配(按系统分组,附带系统标识和名称)
|
||||
* 参数说明
|
||||
* roleId 角色ID
|
||||
* tenantId 门户ID
|
||||
* 返回值说明: [{"systemCode":"1","systemName":"Web端","menus":[...]}, ...]
|
||||
***********************************/
|
||||
@Override
|
||||
public List<Map<String, Object>> permissionAssignmentGrouped(String roleId, String tenantId) {
|
||||
// 1. 查询 PLATFORM_TENANT 字典项,构建 systemCode → systemName 映射
|
||||
Map<String, String> systemNameMap = new HashMap<>();
|
||||
SysDictionary tenantDict = sysDictionaryService.getByDictCode("PLATFORM_TENANT");
|
||||
if (tenantDict != null) {
|
||||
List<SysDictionaryItems> items = sysDictionaryItemsService.listByDictId(tenantDict.getId());
|
||||
if (items != null) {
|
||||
for (SysDictionaryItems item : items) {
|
||||
if (StrUtil.isNotBlank(item.getItemCode())) {
|
||||
systemNameMap.put(item.getItemCode(), item.getDictName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 查询所有菜单(不按 systemcode 过滤,按租户过滤)
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(SysMenu::getId, SysMenu::getParentid, SysMenu::getName,
|
||||
SysMenu::getSystemcode, SysMenu::getOrderno)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysMenu::getTenantId, tenantId)
|
||||
.orderByAsc(SysMenu::getSystemcode, SysMenu::getOrderno);
|
||||
List<Map<String, Object>> mapList = sysMenuMapper.selectMaps(queryWrapper);
|
||||
List<Map<String, Object>> listAll = ObjectConverterUtil.convertMapFieldsToEntityFormat(SysMenu.class, mapList);
|
||||
|
||||
// 3. 获取角色已有的菜单ID列表
|
||||
List<String> listRole = sysMenuMapper.selectMenuByRoleId(roleId, tenantId);
|
||||
|
||||
// 4. 标记 checkinfo
|
||||
for (Map<String, Object> map : listAll) {
|
||||
String id = (String) map.get("id");
|
||||
map.put("checkinfo", listRole != null && listRole.contains(id));
|
||||
}
|
||||
|
||||
// 5. 按 systemcode 分组
|
||||
Map<String, List<Map<String, Object>>> groupedBySystem = new LinkedHashMap<>();
|
||||
for (Map<String, Object> menu : listAll) {
|
||||
String sysCode = (String) menu.get("systemcode");
|
||||
if (StrUtil.isBlank(sysCode)) {
|
||||
sysCode = "1"; // 默认归属到 web 系统
|
||||
}
|
||||
groupedBySystem.computeIfAbsent(sysCode, k -> new ArrayList<>()).add(menu);
|
||||
}
|
||||
|
||||
// 6. 按系统分组构建树,并附加 systemCode 和 systemName
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<Map<String, Object>>> entry : groupedBySystem.entrySet()) {
|
||||
String sysCode = entry.getKey();
|
||||
List<Map<String, Object>> sysMenuList = entry.getValue();
|
||||
|
||||
// 构建菜单树
|
||||
List<Map<String, Object>> menuTree = buildTrees(sysMenuList);
|
||||
|
||||
// 组装结果
|
||||
Map<String, Object> systemGroup = new HashMap<>();
|
||||
systemGroup.put("systemCode", sysCode);
|
||||
systemGroup.put("systemName", systemNameMap.getOrDefault(sysCode, sysCode));
|
||||
systemGroup.put("menus", menuTree);
|
||||
result.add(systemGroup);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 另一种方法
|
||||
/*public List<Map<String, Object>> permissionAssignment(String roleId) {
|
||||
|
||||
|
||||
@ -66,7 +66,8 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||
|
||||
// 构建权限过滤条件
|
||||
Set<String> allowedOrgIds = new HashSet<>();
|
||||
if (userInfo.getUsertype() != 0) {
|
||||
boolean superAdmin = userService.isSuperAdmin(userInfo.getId());
|
||||
if (userInfo.getUsertype() != 0 && !superAdmin) {
|
||||
List<SysRole> roleByUserId = sysRoleMapper.getRoleByUserId(userInfo.getId());
|
||||
for (SysRole sysRole : roleByUserId) {
|
||||
String orgscope = sysRole.getOrgscope();
|
||||
@ -81,8 +82,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||
// 查询这些组织的父级ID
|
||||
List<SysOrganization> list = sysOrganizationMapper.selectList(
|
||||
new LambdaQueryWrapper<SysOrganization>()
|
||||
.in(SysOrganization::getId, stringList)
|
||||
.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, tenantId));
|
||||
.in(SysOrganization::getId, stringList));
|
||||
for (SysOrganization org : list) {
|
||||
if (org.getParentid() != null) {
|
||||
allowedOrgIds.add(org.getParentid());
|
||||
@ -97,9 +97,9 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||
if (!allowedOrgIds.isEmpty()) {
|
||||
queryWrapper.in("id", allowedOrgIds);
|
||||
}
|
||||
if (StrUtil.isNotBlank(tenantId)) {
|
||||
queryWrapper.eq("tenant_id", tenantId);
|
||||
}
|
||||
// if (StrUtil.isNotBlank(tenantId)) {
|
||||
// queryWrapper.eq("tenant_id", tenantId);
|
||||
// }
|
||||
if (StrUtil.isNotEmpty(params)) {
|
||||
queryWrapper.like("orgname", params);
|
||||
}
|
||||
@ -254,7 +254,8 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||
|
||||
// 收集所有允许的组织ID
|
||||
Set<String> allowedOrgIds = new HashSet<>();
|
||||
if (userInfo.getUsertype() != 0) {
|
||||
boolean superAdmin = userService.isSuperAdmin(userInfo.getId());
|
||||
if (userInfo.getUsertype() != 0 && !superAdmin) {
|
||||
List<SysRole> roleByUserId = sysRoleMapper.getRoleByUserId(userInfo.getId());
|
||||
for (SysRole sysRole : roleByUserId) {
|
||||
String orgscope = sysRole.getOrgscope();
|
||||
@ -274,7 +275,7 @@ public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMappe
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<SysOrganization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysOrganization::getParentid, id);
|
||||
queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, tenantId);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysOrganization::getTenantId, tenantId);
|
||||
|
||||
if (StrUtil.isNotBlank(orgName)) {
|
||||
queryWrapper.like(SysOrganization::getOrgname, orgName);
|
||||
|
||||
@ -6,8 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.system.domain.SysDictionary;
|
||||
import com.yfd.platform.system.domain.SysDictionaryItems;
|
||||
import com.yfd.platform.system.domain.SysRole;
|
||||
import com.yfd.platform.system.mapper.SysRoleMapper;
|
||||
import com.yfd.platform.system.service.ISysDictionaryItemsService;
|
||||
import com.yfd.platform.system.service.ISysDictionaryService;
|
||||
import com.yfd.platform.system.service.ISysRoleService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -16,8 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -37,6 +40,12 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
@Resource
|
||||
private UserServiceImpl currentuser;
|
||||
|
||||
@Resource
|
||||
private ISysDictionaryService sysDictionaryService;
|
||||
|
||||
@Resource
|
||||
private ISysDictionaryItemsService sysDictionaryItemsService;
|
||||
|
||||
/***********************************
|
||||
* 用途说明:新增角色
|
||||
* 参数说明
|
||||
@ -185,4 +194,57 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
return sysRoleList;
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:按门户分组查询角色(门户 → 角色两层结构)
|
||||
* 参数说明
|
||||
* rolename 角色名称(可选,模糊搜索)
|
||||
* 返回值说明: [{"tenantId":"...","tenantName":"水利门户","roles":[...]}, ...]
|
||||
* 门户中文名通过字典 PLATFORM_TENANT 获取
|
||||
***********************************/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectRoleListGroupedByTenant(String tenantId,String rolename) {
|
||||
// 1. 查询所有角色(排除超级管理员级别,支持角色名称模糊搜索)
|
||||
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysRole::getTenantId, tenantId);
|
||||
queryWrapper.like(StrUtil.isNotBlank(rolename), SysRole::getRolename, rolename);
|
||||
// queryWrapper.ne(SysRole::getLevel, "1");
|
||||
queryWrapper.orderByAsc(SysRole::getTenantId).orderByAsc(SysRole::getLevel);
|
||||
List<SysRole> roleList = this.list(queryWrapper);
|
||||
|
||||
// 2. 查询 PLATFORM_TENANT 字典项,构建 tenantId → tenantName 映射
|
||||
Map<String, String> tenantNameMap = new HashMap<>();
|
||||
SysDictionary tenantDict = sysDictionaryService.getByDictCode("PLATFORM_TENANT");
|
||||
if (tenantDict != null) {
|
||||
List<SysDictionaryItems> items = sysDictionaryItemsService.list(new LambdaQueryWrapper<SysDictionaryItems>().eq(SysDictionaryItems::getDictId, tenantDict.getId()).eq(StrUtil.isNotBlank(tenantId),SysDictionaryItems::getItemCode, tenantId).select(SysDictionaryItems::getItemCode, SysDictionaryItems::getDictName));
|
||||
if (items != null) {
|
||||
for (SysDictionaryItems item : items) {
|
||||
if (StrUtil.isNotBlank(item.getItemCode())) {
|
||||
tenantNameMap.put(item.getItemCode(), item.getDictName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 按 tenantId 分组(跳过无门户的角色)
|
||||
Map<String, List<SysRole>> grouped = new LinkedHashMap<>();
|
||||
for (SysRole role : roleList) {
|
||||
String code = role.getTenantId();
|
||||
if (StrUtil.isBlank(code)) {
|
||||
continue;
|
||||
}
|
||||
grouped.computeIfAbsent(code, k -> new ArrayList<>()).add(role);
|
||||
}
|
||||
|
||||
// 4. 组装两层结构:门户 → 角色
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<SysRole>> entry : grouped.entrySet()) {
|
||||
Map<String, Object> group = new HashMap<>();
|
||||
group.put("tenantId", entry.getKey());
|
||||
group.put("tenantName", tenantNameMap.getOrDefault(entry.getKey(), entry.getKey()));
|
||||
group.put("roles", entry.getValue());
|
||||
result.add(group);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,12 +3,13 @@ package com.yfd.platform.system.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.platform.datasource.DataSource;
|
||||
import com.yfd.platform.datasource.DataSourceKeys;
|
||||
import com.yfd.platform.datasource.TargetDataSource;
|
||||
import com.yfd.platform.system.domain.LoginUser;
|
||||
import com.yfd.platform.system.domain.SysUser;
|
||||
import com.yfd.platform.system.mapper.SysMenuMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserTenantMapper;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.system.service.IUserService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
@ -20,11 +21,14 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户服务实现类 继承UserDetailsService 实现接口
|
||||
* 支持多门户登录:用户可关联多个门户,登录时选择其中一个门户
|
||||
* 超级管理员(LEVEL=1)拥有跨所有门户的权限
|
||||
* </p>
|
||||
*
|
||||
* @author zhengsl
|
||||
@ -35,35 +39,74 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
|
||||
@Resource
|
||||
private IUserService userService;
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
@Resource
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserTenantMapper sysUserTenantMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
@TargetDataSource()
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// 获取当前请求
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
//根据用户名称或手机号查询用户信息
|
||||
|
||||
// 根据用户名称或手机号查询用户信息(不加tenantId过滤,支持跨门户登录)
|
||||
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.and(wrapper -> wrapper.eq("username", username).or().eq("phone", username));
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
String tenantId = request.getHeader("Tenant_Id");
|
||||
if(StrUtil.isNotBlank(tenantId)){
|
||||
queryWrapper.eq("TENANT_ID", tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
SysUser user = userService.getOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
throw new RuntimeException("用户账号不存在!");
|
||||
}
|
||||
//Todo 根据用户查询权限信息 添加到LoginUser中
|
||||
List<String> permissions =
|
||||
sysMenuMapper.selectPermsByUserId(user.getId());
|
||||
|
||||
//封装成UserDetails对象返回
|
||||
return new LoginUser(user,permissions);
|
||||
// 获取请求中的门户ID
|
||||
String tenantId = null;
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
tenantId = request.getHeader("Tenant_Id");
|
||||
}
|
||||
|
||||
// 判断是否为超级管理员(LEVEL=1)
|
||||
boolean isSuperAdmin = (isSuperAdmin(user.getId())||user.getUsertype()==0);
|
||||
|
||||
// 查询用户可访问的门户列表
|
||||
List<String> accessibleTenantIds = sysUserTenantMapper.getTenantIdsByUserId(user.getId());
|
||||
|
||||
// 非超级管理员必须指定门户,且必须在可访问列表中
|
||||
if (!isSuperAdmin) {
|
||||
if (StrUtil.isBlank(tenantId)) {
|
||||
throw new RuntimeException("用户无权限访问该平台");
|
||||
}
|
||||
if (accessibleTenantIds == null || !accessibleTenantIds.contains(tenantId)) {
|
||||
throw new RuntimeException("用户无权限访问该平台");
|
||||
}
|
||||
}
|
||||
|
||||
// 加载权限:超级管理员加载全部权限,普通用户按门户过滤
|
||||
List<String> permissions;
|
||||
if (isSuperAdmin) {
|
||||
permissions = sysMenuMapper.selectPermsByUserId(user.getId(), null);
|
||||
} else {
|
||||
permissions = sysMenuMapper.selectPermsByUserId(user.getId(), tenantId);
|
||||
}
|
||||
|
||||
// 封装成UserDetails对象返回,包含当前门户和可访问门户列表
|
||||
return new LoginUser(user, permissions, tenantId, accessibleTenantIds, isSuperAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否为超级管理员(拥有LEVEL=1的角色)
|
||||
*/
|
||||
private boolean isSuperAdmin(String userId) {
|
||||
String maxLevel = sysUserMapper.getMaxLevel(userId);
|
||||
return "1".equals(maxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,8 +20,10 @@ import com.yfd.platform.qgc_base.mapper.SdRvcdDicMapper;
|
||||
import com.yfd.platform.system.domain.LoginUser;
|
||||
import com.yfd.platform.system.domain.SysRole;
|
||||
import com.yfd.platform.system.domain.SysUser;
|
||||
import com.yfd.platform.system.domain.SysUserTenant;
|
||||
import com.yfd.platform.system.mapper.SysRoleMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserTenantMapper;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.system.service.IUserService;
|
||||
import com.yfd.platform.utils.FileUtil;
|
||||
@ -81,6 +83,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
@Resource
|
||||
private SysUserDataScopeMapper sysUserDataScopeMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserTenantMapper sysUserTenantMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
@ -122,7 +127,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult getLoginUserInfo() {
|
||||
public Map<String, Object> getLoginUserInfo() {
|
||||
UsernamePasswordAuthenticationToken authentication =
|
||||
(UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||
LoginUser loginuser = (LoginUser) authentication.getPrincipal();
|
||||
@ -138,7 +143,8 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
if(user.getUsertype()==0){
|
||||
collect.add("超级管理员");
|
||||
}
|
||||
ResponseResult responseResult = new ResponseResult();
|
||||
// 新写法(推荐)
|
||||
Map<String, Object> responseResult = new HashMap<>();
|
||||
responseResult.put("userInfo", userInfo);
|
||||
responseResult.put("roles", collect);
|
||||
responseResult.put("permissions", loginuser.getPermissions());
|
||||
@ -169,7 +175,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//账号有效
|
||||
sysUser.setStatus(1);
|
||||
//判断注册的登录账号是否存在
|
||||
if (isExistAccount(sysUser.getUsername(),sysUser.getTenantId() )) {
|
||||
if (isExistAccount(sysUser.getUsername())) {
|
||||
//新增用户
|
||||
boolean ok = this.save(sysUser);
|
||||
//新增用户分配权限
|
||||
@ -179,12 +185,24 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//系统生成id
|
||||
String id = IdUtil.fastSimpleUUID();
|
||||
//新增sys_role_users表数据
|
||||
ok = ok && sysUserMapper.addUserRoles(id, roleid,
|
||||
sysUser.getId());
|
||||
ok = ok && sysUserMapper.addUserRoles(SecurityUtils.getUserId(),id, roleid, sysUser.getId());
|
||||
}
|
||||
}
|
||||
//判断新增是否成功 消息提示
|
||||
if (ok) {
|
||||
// 插入用户-门户关联
|
||||
List<String> ids = StrUtil.split(roleids, ",");
|
||||
if(!ids.isEmpty()) {
|
||||
List<SysRole> selectedList = sysRoleMapper.selectList(new LambdaQueryWrapper<SysRole>().in(SysRole::getId, ids).select(SysRole::getTenantId));
|
||||
List<String> tenantIds = selectedList.stream().map(SysRole::getTenantId).distinct().toList();
|
||||
sysUserTenantMapper.batchInsert(SecurityUtils.getUserId(), sysUser.getId(), tenantIds);
|
||||
}
|
||||
// String tenantId = sysUser.getTenantId();
|
||||
// if (StrUtil.isNotBlank(tenantId)) {
|
||||
// List<String> tenantIds = new ArrayList<>();
|
||||
// tenantIds.add(tenantId);
|
||||
// sysUserTenantMapper.batchInsert(SecurityUtils.getUserId(),sysUser.getId(), tenantIds);
|
||||
// }
|
||||
result.put("status", "sucess");
|
||||
result.put("msg", "新增用户成功!");
|
||||
|
||||
@ -270,6 +288,14 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
// 根据角色给用户分配门户
|
||||
sysUserTenantMapper.deleteByUserId(sysUser.getId());
|
||||
if(StrUtil.isNotBlank(roleids)) {
|
||||
List<String> ids = StrUtil.split(roleids, ",");
|
||||
List<SysRole> selectedList = sysRoleMapper.selectList(new LambdaQueryWrapper<SysRole>().in(SysRole::getId, ids).select(SysRole::getTenantId));
|
||||
List<String> tenantIds = selectedList.stream().map(SysRole::getTenantId).distinct().toList();
|
||||
sysUserTenantMapper.batchInsert(SecurityUtils.getUserId(), sysUser.getId(), tenantIds);
|
||||
}
|
||||
// 处理角色分配
|
||||
String userId = sysUser.getId();
|
||||
if (StrUtil.isNotEmpty(roleids)) {
|
||||
@ -345,12 +371,21 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
|
||||
// 解析新角色列表
|
||||
String[] newRoles = roleIds.split(",");
|
||||
|
||||
String operator;
|
||||
try {
|
||||
operator = SecurityUtils.getUserId();
|
||||
} catch (Exception e) {
|
||||
// 记录日志,方便排查
|
||||
log.error("获取当前用户ID失败", e);
|
||||
// 根据业务需求处理:可返回默认值、抛出业务异常或置空
|
||||
operator = null; // 或 "anonymous" 等默认值
|
||||
}
|
||||
// 需要新增的角色(新角色 - 当前角色)
|
||||
for (String roleId : newRoles) {
|
||||
if (!currentRoleSet.contains(roleId)) {
|
||||
String id = IdUtil.fastSimpleUUID();
|
||||
sysUserMapper.addUserRoles(id, roleId, userId);
|
||||
|
||||
sysUserMapper.addUserRoles(operator,id, roleId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,7 +442,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//系统生成id
|
||||
String id = IdUtil.fastSimpleUUID();
|
||||
//新增sys_role_users表数据
|
||||
isOk = isOk && sysUserMapper.addUserRoles(id, roleid, userid);
|
||||
isOk = isOk && sysUserMapper.addUserRoles(SecurityUtils.getUserId(),id, roleid, userid);
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
@ -434,6 +469,8 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
if (isOk) {
|
||||
//根据用户id 删除该用户角色关联
|
||||
sysUserMapper.delRoleUsersByUserid(id);
|
||||
// 删除用户-门户关联
|
||||
sysUserTenantMapper.deleteByUserId(id);
|
||||
//判断是否存在 账号头像 存在删除
|
||||
if (StrUtil.isNotEmpty(sysUser.getAvatar())) {
|
||||
FileUtil.del(imgName);
|
||||
@ -580,7 +617,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//系统生成id
|
||||
String id = IdUtil.fastSimpleUUID();
|
||||
//新增sys_role_users表数据
|
||||
isOk = sysUserMapper.addUserRoles(id, roleid, userid);
|
||||
isOk = sysUserMapper.addUserRoles(SecurityUtils.getUserId(),id, roleid, userid);
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
@ -636,6 +673,10 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
}
|
||||
// 根据ID删除用户与角色的关联信息
|
||||
sysUserMapper.delRoleUsersByUserIds(ids);
|
||||
// 删除用户-门户关联
|
||||
for (String userId : ids) {
|
||||
sysUserTenantMapper.deleteByUserId(userId);
|
||||
}
|
||||
List<String> avatars =
|
||||
sysUsers.stream().map(SysUser::getAvatar).collect(Collectors.toList());
|
||||
if (avatars.size() > 0) {
|
||||
@ -654,7 +695,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
public SysUser getUserByPhone(String phone,String tenantId) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUser::getPhone, phone);
|
||||
queryWrapper.eq(SysUser::getTenantId, tenantId);
|
||||
// queryWrapper.eq(SysUser::getTenantId, tenantId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@ -893,15 +934,14 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:比较登录名称是否有重复
|
||||
* 用途说明:比较登录名称是否有重复(全局唯一,不区分门户)
|
||||
* 参数说明
|
||||
* account 登录名称
|
||||
* 返回值说明: 重复返回 false 否则返回 true
|
||||
************************************/
|
||||
private boolean isExistAccount(String username,String tenantId) {
|
||||
private boolean isExistAccount(String username) {
|
||||
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
||||
if (this.list(queryWrapper.eq("username", username).eq("TENANT_ID", tenantId)).size() > 0) {
|
||||
//判断 查询登录账号 结果集是否为null 重复返回 false 否则返回 tree
|
||||
if (this.list(queryWrapper.eq("username", username)).size() > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -912,7 +952,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
@Override
|
||||
public List<SysUser> queryUsersList(String name, String tenantId) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysUser::getTenantId, tenantId);
|
||||
// queryWrapper.eq(StrUtil.isNotBlank(tenantId), SysUser::getTenantId, tenantId);
|
||||
queryWrapper.eq(SysUser::getStatus, 1);
|
||||
queryWrapper.and(StrUtil.isNotBlank(name), wrapper ->
|
||||
wrapper.like(SysUser::getNickname, name)
|
||||
@ -923,4 +963,49 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
List<SysUser> sysUserList = this.list( queryWrapper);
|
||||
return sysUserList;
|
||||
}
|
||||
|
||||
// ==================== 多门户管理 ====================
|
||||
|
||||
/**
|
||||
* 为用户分配门户
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void assignTenantsToUser(String userId, List<String> tenantIds) {
|
||||
if (StrUtil.isBlank(userId) || tenantIds == null || tenantIds.isEmpty()) {
|
||||
throw new RuntimeException("用户ID和门户ID列表不能为空");
|
||||
}
|
||||
sysUserTenantMapper.batchInsert(SecurityUtils.getUserId(),userId, tenantIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除用户的某个门户关联
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeTenantFromUser(String userId, String tenantId) {
|
||||
if (StrUtil.isBlank(userId) || StrUtil.isBlank(tenantId)) {
|
||||
throw new RuntimeException("用户ID和门户ID不能为空");
|
||||
}
|
||||
sysUserTenantMapper.deleteByUserIdAndTenantId(userId, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户关联的门户ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getUserTenants(String userId) {
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return sysUserTenantMapper.getTenantIdsByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSuperAdmin(String userId) {
|
||||
String maxLevel = sysUserMapper.getMaxLevel(userId);
|
||||
SysUser sysUser = sysUserMapper.selectById(userId);
|
||||
return (sysUser!=null && sysUser.getUsertype()==0) || "1".equals(maxLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -92,6 +92,8 @@ public class DataSourceRequestUtil {
|
||||
|
||||
List<String> excludes = excludeFields != null ? excludeFields : new ArrayList<>();
|
||||
|
||||
applySelect(request, wrapper, entityClass, fieldMapping, excludes);
|
||||
|
||||
applyFilters(request.getFilter(), wrapper, entityClass, fieldMapping, excludes, "and");
|
||||
|
||||
applySort(request.getSort(), wrapper, entityClass);
|
||||
@ -145,6 +147,49 @@ public class DataSourceRequestUtil {
|
||||
return service.list(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用查询字段(select / distinctSelect)
|
||||
* distinctSelect 优先于 select,并附带 DISTINCT 去重
|
||||
*/
|
||||
private static <T> void applySelect(DataSourceRequest request,
|
||||
QueryWrapper<T> wrapper,
|
||||
Class<T> entityClass,
|
||||
Map<String, String> fieldMapping,
|
||||
List<String> excludeFields) {
|
||||
List<String> selectFields = request.getSelect();
|
||||
boolean distinct = false;
|
||||
if (CollectionUtil.isNotEmpty(request.getDistinctSelect())) {
|
||||
selectFields = request.getDistinctSelect();
|
||||
distinct = true;
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(selectFields)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> columns = new ArrayList<>();
|
||||
for (String field : selectFields) {
|
||||
if (StrUtil.isBlank(field) || excludeFields.contains(field)) {
|
||||
continue;
|
||||
}
|
||||
String columnName = getColumnName(field, entityClass, fieldMapping);
|
||||
if (columnName != null) {
|
||||
columns.add(columnName);
|
||||
}
|
||||
}
|
||||
|
||||
if (columns.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] columnArray = columns.toArray(new String[0]);
|
||||
if (distinct) {
|
||||
// MyBatis-Plus 3.5.16 无 wrapper.distinct() 方法,在首个查询列前加 DISTINCT 关键字实现去重
|
||||
columnArray[0] = "DISTINCT " + columnArray[0];
|
||||
}
|
||||
wrapper.select(columnArray);
|
||||
}
|
||||
|
||||
private static <T> void applyFilters(DataSourceRequest.FilterDescriptor filter,
|
||||
QueryWrapper<T> wrapper,
|
||||
Class<T> entityClass,
|
||||
|
||||
@ -19,6 +19,7 @@ import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yfd.platform.exception.BadRequestException;
|
||||
import com.yfd.platform.system.domain.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -105,4 +106,40 @@ public class SecurityUtils {
|
||||
.anyMatch(auth -> permission.equals(auth.getAuthority()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的门户ID
|
||||
* @return 门户ID,超级管理员可能返回null
|
||||
*/
|
||||
public static String getCurrentTenantId() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof LoginUser)) {
|
||||
return null;
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
return loginUser.getCurrentTenantId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否为超级管理员
|
||||
*/
|
||||
public static boolean isSuperAdmin() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof LoginUser)) {
|
||||
return false;
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
return loginUser.isSuperAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户可访问的门户ID列表
|
||||
*/
|
||||
public static List<String> getAccessibleTenantIds() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof LoginUser)) {
|
||||
return null;
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
return loginUser.getAccessibleTenantIds();
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ logging:
|
||||
level:
|
||||
root: info
|
||||
com.yfd.platform: info
|
||||
com.yfd.platform.common.MicroservicDynamicSQLMapper: debug
|
||||
com.yfd.platform.common.MicroservicDynamicSQLMapper: info
|
||||
# ... existing code ...
|
||||
# com.yfd.platform.*.mapper: trace
|
||||
|
||||
|
||||
@ -38,7 +38,10 @@
|
||||
r.isvaild = 1
|
||||
AND ru.userid = #{userId}
|
||||
AND permission IS NOT NULL
|
||||
-- AND permission != ''
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND r.tenant_id = #{tenantId}
|
||||
AND m.tenant_id = #{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMenuByUserId"
|
||||
|
||||
@ -123,7 +123,7 @@
|
||||
FROM sys_role_users
|
||||
WHERE userid = #{id}
|
||||
</select>
|
||||
<!--查询角色列表(Oracle 兼容版)-->
|
||||
<!--查询角色列表(Oracle 兼容版) AND r."LEVEL" != '1'-->
|
||||
<select id="selectRoleList" resultType="com.yfd.platform.system.domain.SysRole">
|
||||
SELECT r.id, r.rolecode, r.rolename, r."LEVEL", r.description,
|
||||
r.orgscope, r.optscope, r.busscope, r.isvaild,
|
||||
@ -136,7 +136,6 @@
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND r.tenant_id = #{tenantId}
|
||||
</if>
|
||||
AND r."LEVEL" != '1'
|
||||
</where>
|
||||
ORDER BY r."LEVEL" ASC, lastmodifydate ASC
|
||||
</select>
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
<!--用户分配角色 系统角色用户对照新增数据-->
|
||||
<insert id="addUserRoles">
|
||||
insert into sys_role_users values (#{id},#{roleid},#{userid})
|
||||
insert into sys_role_users(operator,id,roleid,userid) values (#{operator},#{id},#{roleid},#{userid})
|
||||
</insert>
|
||||
|
||||
<!--根据用户id 和角色id 查询 系统角色用户对照表-->
|
||||
@ -73,20 +73,22 @@
|
||||
u.lastmodifydate
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN SYS_USER_TENANT ut ON u.id = ut.USER_ID
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ( ( u.REG_STATUS != 'PENDING' AND u.REG_STATUS != 'REJECTED' ) OR u.REG_STATUS IS NULL )
|
||||
AND u.usertype != 0
|
||||
-- AND u.usertype != 0
|
||||
AND u.username != 'admin'
|
||||
<if test="orgid != null">
|
||||
and u.orgid = #{orgid}
|
||||
</if>
|
||||
<if test="username != null">
|
||||
and u.username LIKE '%' || #{username} || '%'
|
||||
and (u.username LIKE '%' || #{username} || '%' OR u.nickname LIKE '%' || #{username} || '%' OR u.phone LIKE '%' || #{username} || '%')
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and u.tenant_id = #{tenantId}
|
||||
and (ut.TENANT_ID = #{tenantId} OR u.tenant_id = #{tenantId})
|
||||
</if>
|
||||
ORDER BY u.lastmodifydate DESC
|
||||
ORDER BY u.username
|
||||
</select>
|
||||
<select id="getOrganizationByid" resultType="java.util.Map">
|
||||
SELECT DISTINCT
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
<?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.yfd.platform.system.mapper.SysUserTenantMapper">
|
||||
|
||||
<!-- 查询用户可访问的门户ID列表 -->
|
||||
<select id="getTenantIdsByUserId" resultType="java.lang.String">
|
||||
SELECT TENANT_ID
|
||||
FROM SYS_USER_TENANT
|
||||
WHERE USER_ID = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 批量删除用户-门户关联 -->
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM SYS_USER_TENANT WHERE USER_ID = #{userId}
|
||||
</delete>
|
||||
|
||||
<!-- 批量新增用户-门户关联(使用 MERGE 兼容 Oracle) -->
|
||||
<insert id="batchInsert">
|
||||
MERGE INTO SYS_USER_TENANT T
|
||||
USING (
|
||||
<foreach collection="tenantIds" item="tenantId" index="index" separator="UNION ALL">
|
||||
SELECT
|
||||
#{userId, jdbcType=VARCHAR} AS USER_ID,
|
||||
#{operator} AS OPERATOR,
|
||||
#{tenantId, jdbcType=VARCHAR} AS TENANT_ID
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
) S
|
||||
ON (T.USER_ID = S.USER_ID AND T.TENANT_ID = S.TENANT_ID)
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (ID, USER_ID, TENANT_ID, OPERATOR)
|
||||
VALUES (SYS_GUID(), S.USER_ID, S.TENANT_ID, S.OPERATOR)
|
||||
</insert>
|
||||
|
||||
<!-- 删除指定用户和指定门户的关联 -->
|
||||
<delete id="deleteByUserIdAndTenantId">
|
||||
DELETE FROM SYS_USER_TENANT WHERE USER_ID = #{userId} AND TENANT_ID = #{tenantId}
|
||||
</delete>
|
||||
|
||||
<!-- 查询某门户下的所有用户ID -->
|
||||
<select id="getUserIdsByTenantId" resultType="java.lang.String">
|
||||
SELECT USER_ID FROM SYS_USER_TENANT WHERE TENANT_ID = #{tenantId}
|
||||
</select>
|
||||
|
||||
<!-- 批量查询用户-门户关联 -->
|
||||
<select id="getTenantIdsByUserIds" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
USER_ID AS "userId",
|
||||
TENANT_ID AS "tenantId"
|
||||
FROM SYS_USER_TENANT
|
||||
WHERE USER_ID IN
|
||||
<foreach collection="userIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -11,9 +11,9 @@ VITE_APP_BASE_URL = 'http://localhost:8093'
|
||||
# 测试环境
|
||||
# VITE_APP_BASE_URL = 'http://172.16.21.142:8093'
|
||||
# 汤伟
|
||||
# VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
||||
VITE_APP_BASE_URL = 'http://10.84.111.235:8093'
|
||||
# 李林
|
||||
VITE_APP_BASE_URL = 'http://10.84.111.25:8093'
|
||||
# VITE_APP_BASE_URL = 'http://10.84.111.25:8093'
|
||||
|
||||
## 开发环境 附件服务地址
|
||||
VITE_APP_ATTACHMENT_URL = 'https://211.99.26.225:12125'
|
||||
|
||||
@ -51,6 +51,14 @@ export function assignmentPer (queryParams:any){
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取分配权限(改动之后)
|
||||
export function permissionAssignmentGrouped (queryParams:any){
|
||||
return request({
|
||||
url:'/system/menu/permissionAssignmentGrouped' ,
|
||||
method: 'post',
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//发出分配权限
|
||||
export function setMenuById (queryParams:any){
|
||||
return request({
|
||||
|
||||
@ -33,6 +33,14 @@ export function getRvcdDropdown(params: any) {
|
||||
params: params
|
||||
});
|
||||
}
|
||||
// /、鱼类资源
|
||||
export function selectForDropdown(data:any) {
|
||||
return request({
|
||||
url: '/env/fishDictory/list',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
//电站下拉列表
|
||||
export function getEngInfoDropdown(data: any) {
|
||||
return request({
|
||||
|
||||
@ -57,6 +57,14 @@ export function getRole (queryParams:any) {
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取角色
|
||||
export function listGroupedByTenant (queryParams:any) {
|
||||
return request({
|
||||
url: '/system/role/listGroupedByTenant',
|
||||
method: 'POST',
|
||||
data: queryParams
|
||||
});
|
||||
}
|
||||
//新建用户
|
||||
export function addUsers (queryParams:any,roleids:any) {
|
||||
return request({
|
||||
|
||||
@ -105,6 +105,7 @@
|
||||
</a-select> -->
|
||||
<!-- 流域下拉框 -->
|
||||
<a-select
|
||||
:key="`rvcd-ly-${shuJuTianBaoStore.lyOption.length}`"
|
||||
:value="formData.rvcd"
|
||||
placeholder="请选择"
|
||||
@change="lyChange"
|
||||
|
||||
@ -359,6 +359,7 @@ const getData = async () => {
|
||||
try {
|
||||
if (props.url && modelStore.params.stcd) {
|
||||
let res: any = await getStcdDetail(props.url, modelStore.params.stcd);
|
||||
// debugger
|
||||
if (res && res.code) {
|
||||
let data = res.data;
|
||||
data2.value = data;
|
||||
|
||||
@ -19,7 +19,18 @@ service.interceptors.request.use(
|
||||
`Expected 'config' and 'config.headers' not to be undefined`
|
||||
);
|
||||
}
|
||||
const menuPaths = [
|
||||
'/system/menu/getMenuButtonTree',
|
||||
'/system/menu/addMenu',
|
||||
'/system/menu/updateById',
|
||||
'/system/menu/deleteById',
|
||||
'/system/menu/changeMenuOrder',
|
||||
'/system/menu/uploadIcon',
|
||||
'/system/menu/deleteIcon'
|
||||
];
|
||||
if (!menuPaths.some(p => config.url.includes(p))) {
|
||||
config.headers.tenant_id = '2';
|
||||
}
|
||||
if (
|
||||
config.url.includes('/dec-lygk-base-server') ||
|
||||
config.url.includes('/wmp-env-server') ||
|
||||
|
||||
@ -129,7 +129,7 @@ const dvtp = ref([]);
|
||||
const initSearchData = {
|
||||
rvcd: 'all',
|
||||
rstcd: null,
|
||||
topHynm: null,
|
||||
topHycd: null,
|
||||
hycd: null,
|
||||
baseId: null,
|
||||
hbrvcd: null,
|
||||
@ -157,7 +157,7 @@ const searchList: any = computed(() => [
|
||||
},
|
||||
{
|
||||
type: 'Select',
|
||||
name: 'topHynm',
|
||||
name: 'topHycd',
|
||||
label: '所属集团',
|
||||
width: 140,
|
||||
fieldProps: {
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
@ok="handleDataSourceConfirm"
|
||||
>
|
||||
<div>
|
||||
<p style="color: red; margin-bottom: 8px">请输入修改依据以继续删除操作</p>
|
||||
<p style="color: red; margin-bottom: 8px">请输入删除依据以继续删除操作</p>
|
||||
<a-textarea
|
||||
v-model:value="dataSource"
|
||||
placeholder="请输入修改依据"
|
||||
placeholder="请输入删除依据"
|
||||
:rows="4"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -1131,6 +1131,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const formRules = computed(() => ({
|
||||
stcd: props.isAdd
|
||||
? [{ required: true, message: '请输入电站编码', trigger: 'blur' }]
|
||||
@ -1196,7 +1197,7 @@ const bldsttCodeOptions = ref<any[]>([
|
||||
{ label: '已建', value: 2 }
|
||||
]); // TODO: 建设状态接口
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter(item => item.wbsCode !== 'all') // 过滤掉"当前全部"
|
||||
.map(item => ({
|
||||
@ -1263,7 +1264,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -1300,6 +1301,14 @@ watch(
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveSelectLabel(key, converted[key]);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
||||
@ -93,10 +93,12 @@ import { getEngInfoById } from '@/api/select';
|
||||
import { calcTableScrollY } from '@/utils/index';
|
||||
import { useModelStore } from '@/store/modules/model';
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { useShuJuTianBaoStore } from '@/store/modules/shuJuTianBao';
|
||||
|
||||
|
||||
const modelStore = useModelStore();
|
||||
const userStore = useUserStore();
|
||||
const shuJuTianBaoStore = useShuJuTianBaoStore();
|
||||
|
||||
const sort = ref<any>([
|
||||
{
|
||||
@ -360,12 +362,12 @@ const buildSearchParams = (values: any) => {
|
||||
value: values.hycd
|
||||
}
|
||||
: null,
|
||||
values.topHynm
|
||||
values.topHycd
|
||||
? {
|
||||
field: 'topHynm',
|
||||
field: 'topHycd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.topHynm
|
||||
value: values.topHycd
|
||||
}
|
||||
: null,
|
||||
values.ttpwr && values.ttpwr.min
|
||||
@ -472,6 +474,8 @@ const handleEdit = (record: any) => {
|
||||
|
||||
// 编辑成功回调
|
||||
const handleEditSuccess = () => {
|
||||
const rvcd = searchRef.value?.searchData?.rvcd ?? 'all';
|
||||
shuJuTianBaoStore.getEngOption(rvcd, 'rvcd');
|
||||
initTable(currentSearchParams.value);
|
||||
};
|
||||
|
||||
|
||||
@ -290,6 +290,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.shapedesc"
|
||||
placeholder="请输入形态描述"
|
||||
:maxlength="500"
|
||||
show-count
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -299,6 +301,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.description"
|
||||
placeholder="请输入内容"
|
||||
:maxlength="100"
|
||||
show-count
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -337,7 +341,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message, Upload } from 'ant-design-vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { addFishDictoryInfo, updateFishDictoryInfo } from '@/api/DataQueryMenuModule';
|
||||
@ -366,6 +370,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
// 图片上传相关
|
||||
@ -489,6 +494,11 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:优先用预解析快照,不依赖实时选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
return resolveSelectLabel(field, originalRecord.value[field]);
|
||||
};
|
||||
|
||||
// 监听 formData 变化
|
||||
watch(
|
||||
() => formData.value,
|
||||
@ -516,7 +526,7 @@ watch(
|
||||
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -588,9 +598,23 @@ watch(
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免控件显示异常
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 处理已有图片
|
||||
if (converted.inffile) {
|
||||
const ids = converted.inffile.split(',').filter(Boolean);
|
||||
@ -609,6 +633,22 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 流域选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
() => shuJuTianBaoStore.lyOption,
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
|
||||
@ -222,6 +222,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -231,6 +233,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -249,7 +253,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addAiboxInfo, updateAiboxInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -276,23 +280,22 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
stcd: [{ required: true, message: '请输入站码', trigger: 'blur' }],
|
||||
stnm: [{ required: true, message: '请输入站名', trigger: 'blur' }]
|
||||
stnm: [{ required: true, message: '请输入站名', trigger: 'blur' }],
|
||||
sttp: [{ required: true, message: '请输入站类', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
// 下拉选项
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}))
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
const engLoading = ref(false);
|
||||
@ -355,6 +358,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -387,7 +400,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -416,17 +429,51 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
@ -442,17 +489,11 @@ const loadEngOptions = async (baseId?: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载下拉数据
|
||||
const loadDropdownData = () => {
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
@ -461,7 +502,6 @@ watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) {
|
||||
loadDropdownData();
|
||||
if (props.isAdd) {
|
||||
formData.value = {};
|
||||
originalRecord.value = {};
|
||||
|
||||
@ -187,6 +187,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -196,6 +198,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -214,7 +218,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addOtweInfo, updateOtweInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -242,6 +246,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -253,13 +258,10 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}))
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
const engLoading = ref(false);
|
||||
@ -322,6 +324,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -353,7 +365,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -381,17 +393,52 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
@ -426,15 +473,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -231,6 +231,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -240,6 +242,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -258,7 +262,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addAiInfo, updateAiInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -286,6 +290,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -298,13 +303,10 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}))
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
const engLoading = ref(false);
|
||||
@ -368,6 +370,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -399,11 +411,7 @@ watch(
|
||||
)
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect
|
||||
? resolveSelectLabel(key, newNorm)
|
||||
: newNorm === null
|
||||
@ -429,17 +437,51 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
@ -476,16 +518,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
// 从 store 获取水电基地数据
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -55,12 +55,12 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="开工日期" name="swdt">
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开工日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled-date="disabledSwdtDate" placeholder="请选择开工日期" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="建成日期" name="jcdt">
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled-date="disabledJcdtDate" placeholder="请选择建成日期" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -114,7 +114,9 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="过鱼月份" name="fpssmn">
|
||||
<a-input v-model:value="formData.fpssmn" placeholder="多个月份用,隔开" style="width: 100%" />
|
||||
<a-select :key="visible" v-model:value="formData.fpssmn" mode="multiple" placeholder="请选择过鱼月份" allow-clear>
|
||||
<a-select-option v-for="item in fpssmnOptions" :key="item.value" :label="item.label" :value="item.value">{{ item.label }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -138,7 +140,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addFpInfo, updateFpInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -156,8 +159,9 @@ useDraggable(visible, { boundary: true, resetOnOpen: true });
|
||||
|
||||
const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const formData = ref<any>({ fpssmn: [] });
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -168,12 +172,15 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
const engLoading = ref(false);
|
||||
|
||||
// 过鱼月份静态选项 1月-12月
|
||||
const fpssmnOptions = ref(Array.from({ length: 12 }, (_, i) => ({ label: `${i + 1}月`, value: `${i + 1}` })));
|
||||
|
||||
const fieldLabelMap: Record<string, string> = {
|
||||
stcd: '设施编码', stnm: '设施名称', sttp: '设施类型', stlc: '站址/位置',
|
||||
baseId: '水电基地', rstcd: '所属电站', lgtd: '经度(°)', lttd: '纬度(°)',
|
||||
@ -196,7 +203,8 @@ const selectOptionsMap: Record<string, () => any[]> = {
|
||||
mway: () => [
|
||||
{ label: '人工', value: 1 },
|
||||
{ label: '自动', value: 2 }
|
||||
]
|
||||
],
|
||||
fpssmn: () => fpssmnOptions.value
|
||||
};
|
||||
|
||||
const changeOrder = ref<{ field: string; label: string; oldValue: string; newValue: string }[]>([]);
|
||||
@ -204,6 +212,16 @@ const diffList = changeOrder;
|
||||
|
||||
const resolveSelectLabel = (field: string, value: any): string => {
|
||||
if (value === null || value === undefined || value === '') return '空';
|
||||
// fpssmn 多选:按逗号分隔,分别解析 label 再合并
|
||||
if (field === 'fpssmn') {
|
||||
const arr = Array.isArray(value) ? value : String(value).split(',');
|
||||
return arr.map((v: any) => {
|
||||
const trimmed = String(v).trim();
|
||||
if (!trimmed) return '';
|
||||
const opt = fpssmnOptions.value.find((o) => String(o.value) === trimmed);
|
||||
return opt ? opt.label : trimmed;
|
||||
}).filter(Boolean).join('、');
|
||||
}
|
||||
const getOptions = selectOptionsMap[field];
|
||||
if (getOptions) {
|
||||
const opt = getOptions().find((o: any) => String(o.value) === String(value));
|
||||
@ -212,24 +230,55 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
};
|
||||
|
||||
// 开工日期不能晚于建成日期
|
||||
const disabledSwdtDate = (current: any) => {
|
||||
if (!formData.value.jcdt) return false;
|
||||
return current && current > dayjs(formData.value.jcdt).endOf('day');
|
||||
};
|
||||
|
||||
// 建成日期不能早于开工日期
|
||||
const disabledJcdtDate = (current: any) => {
|
||||
if (!formData.value.swdt) return false;
|
||||
return current && current < dayjs(formData.value.swdt).startOf('day');
|
||||
};
|
||||
|
||||
watch(() => formData.value, newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
const oldVal = original[key];
|
||||
const newVal = newData[key];
|
||||
if (oldVal !== newVal) {
|
||||
// fpssmn 多选:数组 vs 字符串比较,需标准化
|
||||
if (key === 'fpssmn') {
|
||||
const normalize = (v: any) => {
|
||||
if (!v) return '';
|
||||
const arr = Array.isArray(v) ? v : String(v).split(',');
|
||||
return arr.map((s: string) => s.trim()).filter(Boolean).sort().join(',');
|
||||
};
|
||||
if (normalize(oldVal) === normalize(newVal)) continue;
|
||||
}
|
||||
const existingIdx = changeOrder.value.findIndex(c => c.field === key);
|
||||
const oldNorm = oldVal === null || oldVal === undefined || oldVal === '-' ? null : oldVal;
|
||||
const newNorm = newVal === null || newVal === undefined ? null : newVal;
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
@ -240,15 +289,56 @@ watch(() => formData.value, newData => {
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
// fpssmn 多选回显:逗号分隔字符串 → 数组
|
||||
const fpssmnArr = converted.fpssmn ? String(converted.fpssmn).split(',').map((s: string) => s.trim()).filter(Boolean) : [];
|
||||
formData.value = { ...converted, fpssmn: fpssmnArr.length > 0 ? fpssmnArr : undefined };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -268,11 +358,15 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
@ -280,7 +374,7 @@ watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
watch(() => props.open, val => {
|
||||
if (val) {
|
||||
if (props.isAdd) {
|
||||
formData.value = {};
|
||||
formData.value = { fpssmn: [] };
|
||||
originalRecord.value = {};
|
||||
changeOrder.value = [];
|
||||
loadEngOptions();
|
||||
@ -304,10 +398,14 @@ const handleConfirmSubmit = async (source: string) => {
|
||||
let res: any;
|
||||
if (props.isAdd) {
|
||||
Object.assign(engInfo, formData.value);
|
||||
// fpssmn 多选:数组 → 逗号分隔字符串
|
||||
if (Array.isArray(engInfo.fpssmn)) engInfo.fpssmn = engInfo.fpssmn.join(',');
|
||||
res = await addFpInfo({ engInfo, source: source.trim() || '新增' });
|
||||
} else {
|
||||
engInfo.stcd = formData.value.stcd;
|
||||
changeOrder.value.forEach(item => { engInfo[item.field] = formData.value[item.field]; });
|
||||
// fpssmn 多选:数组 → 逗号分隔字符串
|
||||
if (Array.isArray(engInfo.fpssmn)) engInfo.fpssmn = engInfo.fpssmn.join(',');
|
||||
res = await updateFpInfo({ engInfo, source: source.trim() || '编辑' });
|
||||
}
|
||||
if (res?.code == 0 || res?.success) {
|
||||
|
||||
@ -125,6 +125,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -134,6 +136,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -152,7 +156,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addTeInfo, updateTeInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -180,6 +184,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -192,13 +197,10 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}))
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
const engLoading = ref(false);
|
||||
|
||||
@ -242,6 +244,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -273,11 +285,7 @@ watch(
|
||||
)
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect
|
||||
? resolveSelectLabel(key, newNorm)
|
||||
: newNorm === null
|
||||
@ -303,17 +311,51 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 加载电站下拉(支持按 baseId 筛选)
|
||||
@ -351,17 +393,15 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
// 从 store 获取水电基地数据
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -18,81 +18,174 @@
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="栖息地站码" name="stcd">
|
||||
<a-input v-model:value="formData.stcd" placeholder="请输入栖息地站码" :disabled="!isAdd" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.stcd"
|
||||
placeholder="请输入栖息地站码"
|
||||
:disabled="!isAdd"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="栖息地名称" name="stnm">
|
||||
<a-input v-model:value="formData.stnm" placeholder="请输入栖息地名称" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.stnm"
|
||||
placeholder="请输入栖息地名称"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="站址" name="stlc">
|
||||
<a-input v-model:value="formData.stlc" placeholder="请输入站址" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.stlc"
|
||||
placeholder="请输入站址"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="经度(°)" name="lgtd">
|
||||
<a-input-number v-model:value="formData.lgtd" placeholder="请输入" :precision="6" style="width: 100%" />
|
||||
<a-input-number
|
||||
v-model:value="formData.lgtd"
|
||||
placeholder="请输入"
|
||||
:precision="6"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="纬度(°)" name="lttd">
|
||||
<a-input-number v-model:value="formData.lttd" placeholder="请输入" :precision="6" style="width: 100%" />
|
||||
<a-input-number
|
||||
v-model:value="formData.lttd"
|
||||
placeholder="请输入"
|
||||
:precision="6"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="水电基地" name="baseId">
|
||||
<a-select v-model:value="formData.baseId" placeholder="请选择水电基地" allow-clear show-search :filter-option="filterOption">
|
||||
<a-select-option v-for="item in baseNameOptions" :key="item.value" :label="item.label" :value="item.value">{{ item.label }}</a-select-option>
|
||||
<a-select
|
||||
v-model:value="formData.baseId"
|
||||
placeholder="请选择水电基地"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in baseNameOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>{{ item.label }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="所属电站" name="rstcd">
|
||||
<a-select v-model:value="formData.rstcd" placeholder="请选择所属电站" allow-clear show-search :loading="engLoading" :filter-option="filterOption">
|
||||
<a-select-option v-for="item in engInfoOptions" :key="item.value" :label="item.label" :value="item.value">{{ item.label }}</a-select-option>
|
||||
<a-select
|
||||
v-model:value="formData.rstcd"
|
||||
placeholder="请选择所属电站"
|
||||
allow-clear
|
||||
show-search
|
||||
:loading="engLoading"
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in engInfoOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>{{ item.label }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护对象" name="bhdx">
|
||||
<a-input v-model:value="formData.bhdx" placeholder="请输入保护对象" style="width: 100%" />
|
||||
<a-select
|
||||
v-model:value="formData.bhdx"
|
||||
mode="multiple"
|
||||
placeholder="请选择保护对象"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in fishOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>{{ item.label }}</a-select-option
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护范围" name="bhfw">
|
||||
<a-input v-model:value="formData.bhfw" placeholder="请输入保护范围" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.bhfw"
|
||||
placeholder="请输入保护范围"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护核心长度(km)" name="bhhxcd">
|
||||
<a-input-number v-model:value="formData.bhhxcd" placeholder="请输入" :precision="2" style="width: 100%" />
|
||||
<a-input-number
|
||||
v-model:value="formData.bhhxcd"
|
||||
placeholder="请输入"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护河流" name="bhhl">
|
||||
<a-input v-model:value="formData.bhhl" placeholder="请输入保护河流" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.bhhl"
|
||||
placeholder="请输入保护河流"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护河段" name="bhhd">
|
||||
<a-input v-model:value="formData.bhhd" placeholder="请输入保护河段" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.bhhd"
|
||||
placeholder="请输入保护河段"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护措施" name="bhcs">
|
||||
<a-input v-model:value="formData.bhcs" placeholder="请输入保护措施" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.bhcs"
|
||||
placeholder="请输入保护措施"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="保护方式" name="bhfs">
|
||||
<a-input v-model:value="formData.bhfs" placeholder="请输入保护方式" style="width: 100%" />
|
||||
<a-input
|
||||
v-model:value="formData.bhfs"
|
||||
placeholder="请输入保护方式"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="投资(亿元)" name="inv">
|
||||
<a-input-number v-model:value="formData.inv" placeholder="请输入" :precision="3" style="width: 100%" />
|
||||
<a-input-number
|
||||
v-model:value="formData.inv"
|
||||
placeholder="请输入"
|
||||
:precision="3"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -109,10 +202,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addFhInfo, updateFhInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
import { getEngInfoDropdown, selectForDropdown } from '@/api/select';
|
||||
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
||||
import ConfirmModal from '@/components/ConfirmModal/index.vue';
|
||||
import { useDraggable } from '@/utils/drag';
|
||||
@ -121,13 +214,17 @@ const props = defineProps<{ open: boolean; record?: any; isAdd?: boolean }>();
|
||||
const emit = defineEmits(['update:open', 'success']);
|
||||
const jidiSelectEventStore = useJidiSelectEventStore();
|
||||
|
||||
const visible = computed({ get: () => props.open, set: val => emit('update:open', val) });
|
||||
const visible = computed({
|
||||
get: () => props.open,
|
||||
set: val => emit('update:open', val)
|
||||
});
|
||||
useDraggable(visible, { boundary: true, resetOnOpen: true });
|
||||
|
||||
const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -137,7 +234,7 @@ const formRules = ref<any>({
|
||||
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
@ -146,73 +243,221 @@ const baseNameOptions = ref<any[]>(
|
||||
const engLoading = ref(false);
|
||||
|
||||
const fieldLabelMap: Record<string, string> = {
|
||||
stcd: '栖息地站码', stnm: '栖息地名称', stlc: '站址', baseId: '水电基地',
|
||||
rstcd: '所属电站', bhdx: '保护对象', bhfw: '保护范围',
|
||||
stcd: '栖息地站码',
|
||||
stnm: '栖息地名称',
|
||||
stlc: '站址',
|
||||
baseId: '水电基地',
|
||||
rstcd: '所属电站',
|
||||
bhdx: '保护对象',
|
||||
bhfw: '保护范围',
|
||||
bhhxcd: '保护核心长度(km)',
|
||||
bhhl: '保护河流', bhhd: '保护河段', bhcs: '保护措施', bhfs: '保护方式', inv: '投资(亿元)', lgtd: '经度(°)', lttd: '纬度(°)'
|
||||
bhhl: '保护河流',
|
||||
bhhd: '保护河段',
|
||||
bhcs: '保护措施',
|
||||
bhfs: '保护方式',
|
||||
inv: '投资(亿元)',
|
||||
lgtd: '经度(°)',
|
||||
lttd: '纬度(°)'
|
||||
};
|
||||
|
||||
const selectOptionsMap: Record<string, () => any[]> = {
|
||||
baseId: () => baseNameOptions.value,
|
||||
rstcd: () => engInfoOptions.value
|
||||
rstcd: () => engInfoOptions.value,
|
||||
bhdx: () => fishOptions.value
|
||||
};
|
||||
|
||||
const changeOrder = ref<{ field: string; label: string; oldValue: string; newValue: string }[]>([]);
|
||||
const changeOrder = ref<
|
||||
{ field: string; label: string; oldValue: string; newValue: string }[]
|
||||
>([]);
|
||||
const diffList = changeOrder;
|
||||
|
||||
const resolveSelectLabel = (field: string, value: any): string => {
|
||||
if (value === null || value === undefined || value === '') return '空';
|
||||
// bhdx 多选:按逗号分隔,分别解析 label 再合并
|
||||
if (field === 'bhdx') {
|
||||
const arr = Array.isArray(value) ? value : String(value).split(',');
|
||||
return arr
|
||||
.map((v: any) => {
|
||||
const trimmed = String(v).trim();
|
||||
if (!trimmed) return '';
|
||||
const opt = fishOptions.value.find(
|
||||
(o: any) => String(o.value) === trimmed
|
||||
);
|
||||
return opt ? opt.label : trimmed;
|
||||
})
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
}
|
||||
const getOptions = selectOptionsMap[field];
|
||||
if (getOptions) {
|
||||
const opt = getOptions().find((o: any) => String(o.value) === String(value));
|
||||
const opt = getOptions().find(
|
||||
(o: any) => String(o.value) === String(value)
|
||||
);
|
||||
if (opt) return opt.label;
|
||||
}
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
};
|
||||
const fishOptions = ref<any[]>([]);
|
||||
const getFishzy = async () => {
|
||||
try {
|
||||
const res = await selectForDropdown({
|
||||
"select": ["name","id"],
|
||||
"filter": {"logic": "and","filters": []}});
|
||||
fishOptions.value = (res.data || []).map((item: any) => ({
|
||||
label: item.name ,
|
||||
value: item.id
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取保护对象列表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
watch(() => formData.value, newData => {
|
||||
watch(
|
||||
() => formData.value,
|
||||
newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
const oldVal = original[key];
|
||||
const newVal = newData[key];
|
||||
if (oldVal !== newVal) {
|
||||
// bhdx 多选:数组 vs 字符串比较,需标准化
|
||||
if (key === 'bhdx') {
|
||||
const normalize = (v: any) => {
|
||||
if (!v) return '';
|
||||
const arr = Array.isArray(v) ? v : String(v).split(',');
|
||||
return arr
|
||||
.map((s: string) => s.trim())
|
||||
.filter(Boolean)
|
||||
.sort()
|
||||
.join(',');
|
||||
};
|
||||
if (normalize(oldVal) === normalize(newVal)) continue;
|
||||
}
|
||||
const existingIdx = changeOrder.value.findIndex(c => c.field === key);
|
||||
const oldNorm = oldVal === null || oldVal === undefined || oldVal === '-' ? null : oldVal;
|
||||
const oldNorm =
|
||||
oldVal === null || oldVal === undefined || oldVal === '-'
|
||||
? null
|
||||
: oldVal;
|
||||
const newNorm = newVal === null || newVal === undefined ? null : newVal;
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
if (
|
||||
oldNorm !== null &&
|
||||
newNorm !== null &&
|
||||
!isNaN(Number(oldNorm)) &&
|
||||
!isNaN(Number(newNorm)) &&
|
||||
Number(oldNorm) === Number(newNorm)
|
||||
)
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
const oldDisplay = isSelect
|
||||
? originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
const newDisplay = isSelect
|
||||
? resolveSelectLabel(key, newNorm)
|
||||
: newNorm === null
|
||||
? '空'
|
||||
: String(newNorm);
|
||||
const entry = {
|
||||
field: key,
|
||||
label: fieldLabelMap[key] || key,
|
||||
oldValue: oldDisplay,
|
||||
newValue: newDisplay
|
||||
};
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
else changeOrder.value.push(entry);
|
||||
} else {
|
||||
changeOrder.value = changeOrder.value.filter(c => c.field !== key);
|
||||
}
|
||||
}
|
||||
}, { deep: true });
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(() => props.record, newRecord => {
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}, { deep: true });
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
// bhdx 多选回显:逗号分隔字符串 → 数组
|
||||
const bhdxArr = converted.bhdx
|
||||
? String(converted.bhdx)
|
||||
.split(',')
|
||||
.map((s: string) => s.trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
formData.value = {
|
||||
...converted,
|
||||
bhdx: bhdxArr.length > 0 ? bhdxArr : undefined
|
||||
};
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch([baseNameOptions, engInfoOptions, fishOptions], () => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
});
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
const params = baseId ? { baseId } : {};
|
||||
const res = await getEngInfoDropdown(params);
|
||||
engInfoOptions.value = (res.data || []).map((item: any) => ({ label: item.ennm, value: item.stcd }));
|
||||
engInfoOptions.value = (res.data || []).map((item: any) => ({
|
||||
label: item.ennm,
|
||||
value: item.stcd
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取电站列表失败:', error);
|
||||
} finally {
|
||||
@ -220,30 +465,44 @@ const loadEngOptions = async (baseId?: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadDropdownData = () => {
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
watch(
|
||||
() => formData.value?.baseId,
|
||||
newBaseId => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
watch(() => props.open, val => {
|
||||
if (val) {
|
||||
loadDropdownData();
|
||||
if (props.isAdd) { formData.value = {}; originalRecord.value = {}; changeOrder.value = []; loadEngOptions(); }
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) {
|
||||
if (props.isAdd) {
|
||||
formData.value = {};
|
||||
originalRecord.value = {};
|
||||
changeOrder.value = [];
|
||||
loadEngOptions();
|
||||
}
|
||||
getFishzy();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const handleOk = async () => {
|
||||
try {
|
||||
await formRef.value?.validateFields();
|
||||
if (!props.isAdd && changeOrder.value.length === 0) { message.info('未检测到任何修改'); return; }
|
||||
if (!props.isAdd && changeOrder.value.length === 0) {
|
||||
message.info('未检测到任何修改');
|
||||
return;
|
||||
}
|
||||
confirmModalVisible.value = true;
|
||||
} catch (error) { console.error('验证失败:', error); }
|
||||
} catch (error) {
|
||||
console.error('验证失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirmSubmit = async (source: string) => {
|
||||
@ -253,10 +512,16 @@ const handleConfirmSubmit = async (source: string) => {
|
||||
let res: any;
|
||||
if (props.isAdd) {
|
||||
Object.assign(engInfo, formData.value);
|
||||
// bhdx 多选:数组 → 逗号分隔字符串
|
||||
if (Array.isArray(engInfo.bhdx)) engInfo.bhdx = engInfo.bhdx.join(',');
|
||||
res = await addFhInfo({ engInfo, source: source.trim() || '新增' });
|
||||
} else {
|
||||
engInfo.stcd = formData.value.stcd;
|
||||
changeOrder.value.forEach(item => { engInfo[item.field] = formData.value[item.field]; });
|
||||
changeOrder.value.forEach(item => {
|
||||
engInfo[item.field] = formData.value[item.field];
|
||||
});
|
||||
// bhdx 多选:数组 → 逗号分隔字符串
|
||||
if (Array.isArray(engInfo.bhdx)) engInfo.bhdx = engInfo.bhdx.join(',');
|
||||
res = await updateFhInfo({ engInfo, source: source.trim() || '编辑' });
|
||||
}
|
||||
if (res?.code == 0 || res?.success) {
|
||||
@ -264,11 +529,22 @@ const handleConfirmSubmit = async (source: string) => {
|
||||
confirmModalVisible.value = false;
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
} else { message.error(res?.msg || (props.isAdd ? '新增失败' : '编辑失败')); }
|
||||
} catch (error) { message.error('提交失败,请重试'); }
|
||||
finally { confirmLoading.value = false; }
|
||||
} else {
|
||||
message.error(res?.msg || (props.isAdd ? '新增失败' : '编辑失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('提交失败,请重试');
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirmCancel = () => { confirmModalVisible.value = false; };
|
||||
const handleCancel = () => { visible.value = false; confirmModalVisible.value = false; formRef.value?.resetFields(); };
|
||||
const handleConfirmCancel = () => {
|
||||
confirmModalVisible.value = false;
|
||||
};
|
||||
const handleCancel = () => {
|
||||
visible.value = false;
|
||||
confirmModalVisible.value = false;
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -62,7 +62,7 @@ const columns = ref<any[]>([
|
||||
{ key: 'stcd', title: '栖息地站码', dataIndex: 'stcd', visible: true, width: 320, fixed: 'left', ellipsis: true },
|
||||
{ key: 'baseName', title: '水电基地', dataIndex: 'baseName', visible: true, width: 120, ellipsis: true },
|
||||
{ key: 'ennm', title: '所属电站', dataIndex: 'ennm', visible: true, width: 150, ellipsis: true },
|
||||
{ key: 'bhdx', title: '保护对象', dataIndex: 'bhdx', visible: true, width: 120, ellipsis: true },
|
||||
{ key: 'bhdxName', title: '保护对象', dataIndex: 'bhdxName', visible: true, width: 240, ellipsis: true },
|
||||
{ key: 'bhhl', title: '保护河流', dataIndex: 'bhhl', visible: true, width: 120, ellipsis: true },
|
||||
{ key: 'bhhd', title: '保护河段', dataIndex: 'bhhd', visible: true, width: 240, ellipsis: true },
|
||||
{ key: 'bhfw', title: '保护范围', dataIndex: 'bhfw', visible: true, width: 120, ellipsis: true },
|
||||
|
||||
@ -188,6 +188,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -197,6 +199,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -215,7 +219,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addVaInfo, updateVaInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -243,6 +247,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -254,7 +259,7 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -270,18 +275,16 @@ const fieldLabelMap: Record<string, string> = {
|
||||
stnm: '救助站名称',
|
||||
sttp: '测站类型',
|
||||
stlc: '站址',
|
||||
lgtd: '经度(°)',
|
||||
lttd: '纬度(°)',
|
||||
baseId: '水电基地',
|
||||
rstcd: '所属电站',
|
||||
place: '地点',
|
||||
area: '面积',
|
||||
area: '面积(km²)',
|
||||
bhfs: '保护方式',
|
||||
bhyy: '保护原因',
|
||||
bhdx: '保护对象',
|
||||
usfl: '是否启用',
|
||||
jcdt: '建成日期',
|
||||
inv: '投资',
|
||||
inv: '投资(亿元)',
|
||||
introduce: '简介',
|
||||
remark: '备注'
|
||||
};
|
||||
@ -317,6 +320,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -337,8 +350,16 @@ watch(
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const oldDisplay = isSelect
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
const newDisplay = isSelect
|
||||
? resolveSelectLabel(key, newNorm)
|
||||
: newNorm === null
|
||||
? '空'
|
||||
: String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
else changeOrder.value.push(entry);
|
||||
@ -350,14 +371,56 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(() => props.record, newRecord => {
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}, { deep: true });
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
@ -381,23 +444,27 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// baseNameOptions 已改为 computed,无需手动赋值
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
watch(() => props.open, val => {
|
||||
if (val) {
|
||||
loadDropdownData();
|
||||
if (props.isAdd) {
|
||||
formData.value = {};
|
||||
originalRecord.value = {};
|
||||
changeOrder.value = [];
|
||||
loadEngOptions();
|
||||
}
|
||||
loadDropdownData();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -55,12 +55,12 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="开工日期" name="swdt">
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开工日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled-date="disabledSwdtDate" placeholder="请选择开工日期" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="建成日期" name="jcdt">
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled-date="disabledJcdtDate" placeholder="请选择建成日期" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -110,7 +110,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addEqInfo, updateEqInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -130,6 +131,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -142,7 +144,7 @@ const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
const engLoading = ref(false);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
@ -178,11 +180,33 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
};
|
||||
|
||||
// 开工日期不能晚于建成日期
|
||||
const disabledSwdtDate = (current: any) => {
|
||||
if (!formData.value.jcdt) return false;
|
||||
return current && current > dayjs(formData.value.jcdt).endOf('day');
|
||||
};
|
||||
|
||||
// 建成日期不能早于开工日期
|
||||
const disabledJcdtDate = (current: any) => {
|
||||
if (!formData.value.swdt) return false;
|
||||
return current && current < dayjs(formData.value.swdt).startOf('day');
|
||||
};
|
||||
|
||||
watch(() => formData.value, newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
@ -195,7 +219,7 @@ watch(() => formData.value, newData => {
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
@ -206,15 +230,54 @@ watch(() => formData.value, newData => {
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
// 加载电站下拉(支持按 baseId 筛选)
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
@ -235,11 +298,15 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addVdInfo, updateVdInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -71,6 +71,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -82,8 +83,10 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
const engLoading = ref(false);
|
||||
|
||||
@ -113,6 +116,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
@ -130,7 +143,7 @@ watch(() => formData.value, newData => {
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
@ -141,15 +154,54 @@ watch(() => formData.value, newData => {
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
// 加载电站下拉(支持按 baseId 筛选)
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
@ -170,11 +222,15 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -125,6 +125,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -134,6 +136,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -152,7 +156,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addWeInfo, updateWeInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -180,6 +184,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -192,7 +197,7 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -242,6 +247,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -274,7 +289,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -303,19 +318,57 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
// 加载电站下拉(支持按 baseId 筛选)
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
@ -351,17 +404,15 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
// 从 store 获取水电基地数据
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addWtInfo, updateWtInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -175,6 +175,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -187,7 +188,7 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -241,6 +242,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -273,7 +284,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -302,19 +313,57 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -349,16 +398,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
// 从 store 获取水电基地数据
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -177,7 +177,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addWqInfo, updateWqInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -206,6 +206,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -219,7 +220,7 @@ const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
const wwqtgOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -282,6 +283,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -314,7 +325,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -343,19 +354,57 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions, wwqtgOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -399,15 +448,14 @@ const loadDropdownData = () => {
|
||||
}));
|
||||
}
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -176,6 +176,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -185,6 +187,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -203,7 +207,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addSonarInfo, updateSonarInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -231,18 +235,20 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
stcd: [{ required: true, message: '请输入站码', trigger: 'blur' }],
|
||||
stnm: [{ required: true, message: '请输入站名', trigger: 'blur' }],
|
||||
sttp: [{ required: true, message: '请选择监控类别', trigger: 'change' }]
|
||||
sttp: [{ required: true, message: '请选择监控类别', trigger: 'change' }],
|
||||
mntp: [{ required: true, message: '请输入监控类型', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -304,6 +310,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -335,7 +351,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -363,17 +379,52 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
@ -408,15 +459,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// baseNameOptions 已改为 computed,无需手动赋值
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -179,6 +179,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -188,6 +190,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -206,7 +210,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addDwInfo, updateDwInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -234,6 +238,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -246,7 +251,7 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
@ -310,6 +315,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -342,7 +357,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -371,19 +386,57 @@ watch(
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -418,15 +471,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -187,6 +187,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.introduce"
|
||||
placeholder="请输入简介"
|
||||
:maxlength="1000"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -196,6 +198,8 @@
|
||||
<a-textarea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:maxlength="150"
|
||||
show-count
|
||||
:rows="2"
|
||||
/>
|
||||
</a-form-item>
|
||||
@ -214,7 +218,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addOtteInfo, updateOtteInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -242,6 +246,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -254,13 +259,10 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}))
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
const engLoading = ref(false);
|
||||
@ -325,6 +327,16 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
const keyword = inputValue || '';
|
||||
@ -356,7 +368,7 @@ watch(
|
||||
continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect
|
||||
? resolveSelectLabel(key, oldNorm)
|
||||
? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm))
|
||||
: oldNorm === null
|
||||
? '空'
|
||||
: String(oldNorm);
|
||||
@ -384,19 +396,58 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -429,15 +480,14 @@ const loadDropdownData = () => {
|
||||
value: item.sttpCode
|
||||
}));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({
|
||||
label: item.wbsName,
|
||||
value: item.wbsCode
|
||||
}));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -57,12 +57,12 @@
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="开工日期" name="swdt">
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开工日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开工日期" :disabled-date="disabledSwdtDate" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="建成日期" name="jcdt">
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" :disabled-date="disabledJcdtDate" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -123,7 +123,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addFbInfo, updateFbInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -143,6 +144,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -154,7 +156,7 @@ const formRules = ref<any>({
|
||||
const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
@ -189,11 +191,32 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
};
|
||||
|
||||
// 开工日期不能晚于建成日期
|
||||
const disabledSwdtDate = (current: any) => {
|
||||
if (!formData.value.jcdt) return false;
|
||||
return current && current > dayjs(formData.value.jcdt).endOf('day');
|
||||
};
|
||||
// 建成日期不能早于开工日期
|
||||
const disabledJcdtDate = (current: any) => {
|
||||
if (!formData.value.swdt) return false;
|
||||
return current && current < dayjs(formData.value.swdt).startOf('day');
|
||||
};
|
||||
|
||||
watch(() => formData.value, newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
@ -206,7 +229,7 @@ watch(() => formData.value, newData => {
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
@ -217,15 +240,54 @@ watch(() => formData.value, newData => {
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -245,13 +307,15 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData
|
||||
.filter((item: any) => item.wbsCode !== 'all')
|
||||
.map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -50,12 +50,12 @@
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="开工日期" name="swdt">
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开工日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.swdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled-date="disabledSwdtDate" placeholder="请选择开工日期" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="建成日期" name="jcdt">
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" style="width: 100%" />
|
||||
<a-date-picker v-model:value="formData.jcdt" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择建成日期" style="width: 100%" :disabled-date="disabledJcdtDate" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
@ -81,7 +81,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addVpInfo, updateVpInfo } from '@/api/DataQueryMenuModule';
|
||||
import { getEngInfoDropdown } from '@/api/select';
|
||||
@ -101,6 +102,7 @@ const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
const originalLabels = ref<Record<string, string>>({});
|
||||
const confirmModalVisible = ref(false);
|
||||
|
||||
const formRules = ref<any>({
|
||||
@ -113,7 +115,7 @@ const engInfoOptions = ref<any[]>([]);
|
||||
const sttpOptions = ref<any[]>([]);
|
||||
const engLoading = ref(false);
|
||||
|
||||
const baseNameOptions = ref<any[]>(
|
||||
const baseNameOptions = computed(() =>
|
||||
jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }))
|
||||
);
|
||||
|
||||
@ -143,11 +145,33 @@ const resolveSelectLabel = (field: string, value: any): string => {
|
||||
return String(value);
|
||||
};
|
||||
|
||||
// 解析原始值的显示名:rstcd 直接用 record 自带的电站名称 ennm,不依赖异步选项
|
||||
const resolveOriginalLabel = (field: string): string => {
|
||||
const original = originalRecord.value;
|
||||
if (field === 'rstcd') {
|
||||
const ennm = original.ennm || original.rstcdName;
|
||||
if (ennm) return String(ennm);
|
||||
}
|
||||
return resolveSelectLabel(field, original[field]);
|
||||
};
|
||||
|
||||
const filterOption = (inputValue: string, option: any) => {
|
||||
const label = option.label || option.value;
|
||||
return label.includes(inputValue || '');
|
||||
};
|
||||
|
||||
// 开工日期不能晚于建成日期
|
||||
const disabledSwdtDate = (current: any) => {
|
||||
if (!formData.value.jcdt) return false;
|
||||
return current && current > dayjs(formData.value.jcdt).endOf('day');
|
||||
};
|
||||
|
||||
// 建成日期不能早于开工日期
|
||||
const disabledJcdtDate = (current: any) => {
|
||||
if (!formData.value.swdt) return false;
|
||||
return current && current < dayjs(formData.value.swdt).startOf('day');
|
||||
};
|
||||
|
||||
watch(() => formData.value, newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
@ -160,7 +184,7 @@ watch(() => formData.value, newData => {
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (oldNorm !== null && newNorm !== null && !isNaN(Number(oldNorm)) && !isNaN(Number(newNorm)) && Number(oldNorm) === Number(newNorm)) continue;
|
||||
const isSelect = !!selectOptionsMap[key];
|
||||
const oldDisplay = isSelect ? resolveSelectLabel(key, oldNorm) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const oldDisplay = isSelect ? (originalLabels.value[key] ?? resolveSelectLabel(key, oldNorm)) : oldNorm === null ? '空' : String(oldNorm);
|
||||
const newDisplay = isSelect ? resolveSelectLabel(key, newNorm) : newNorm === null ? '空' : String(newNorm);
|
||||
const entry = { field: key, label: fieldLabelMap[key] || key, oldValue: oldDisplay, newValue: newDisplay };
|
||||
if (existingIdx >= 0) changeOrder.value[existingIdx] = entry;
|
||||
@ -171,15 +195,54 @@ watch(() => formData.value, newData => {
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听 record 变化
|
||||
const isInitLoading = ref(false);
|
||||
watch(() => props.record, newRecord => {
|
||||
if (newRecord) {
|
||||
isInitLoading.value = true;
|
||||
const converted = { ...newRecord };
|
||||
// 将 "-" 还原为 null,避免 date-picker 显示 Invalid Date
|
||||
for (const key in converted) {
|
||||
if (converted[key] === '-') {
|
||||
converted[key] = null;
|
||||
}
|
||||
}
|
||||
originalRecord.value = { ...converted };
|
||||
formData.value = { ...converted };
|
||||
changeOrder.value = [];
|
||||
// 编辑时必定加载电站选项,保证 rstcd 回显与 diff 解析
|
||||
loadEngOptions(converted.baseId || undefined);
|
||||
// 提前解析 select 字段的原始显示名,防止联动刷新选项后丢失 label
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in converted) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
// 表单填充完成后自动复位标志,避免残留 true 导致后续切换流域不清空电站
|
||||
nextTick(() => {
|
||||
isInitLoading.value = false;
|
||||
});
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 选项加载完成后重新解析原始显示名,避免 record 加载时选项未就绪导致存成 code
|
||||
watch(
|
||||
[baseNameOptions, engInfoOptions, sttpOptions],
|
||||
() => {
|
||||
const original = originalRecord.value;
|
||||
if (!original || Object.keys(original).length === 0) return;
|
||||
const labels: Record<string, string> = {};
|
||||
for (const key in original) {
|
||||
if (selectOptionsMap[key]) {
|
||||
labels[key] = resolveOriginalLabel(key);
|
||||
}
|
||||
}
|
||||
originalLabels.value = labels;
|
||||
}
|
||||
);
|
||||
|
||||
const loadEngOptions = async (baseId?: string) => {
|
||||
engLoading.value = true;
|
||||
try {
|
||||
@ -199,11 +262,15 @@ const loadDropdownData = () => {
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
baseNameOptions.value = jidiSelectEventStore.jidiData.filter((item: any) => item.wbsCode !== 'all').map((item: any) => ({ label: item.wbsName, value: item.wbsCode }));
|
||||
// 从 store 获取水电基地数据(computed 已自动响应,无需手动赋值)
|
||||
};
|
||||
|
||||
// 水电基地变化时联动电站
|
||||
watch(() => formData.value?.baseId, (newBaseId) => {
|
||||
// record 加载时已在 record watch 中加载过电站选项,这里仅跳过清空
|
||||
if (isInitLoading.value) {
|
||||
return;
|
||||
}
|
||||
formData.value.rstcd = undefined;
|
||||
loadEngOptions(newBaseId || undefined);
|
||||
});
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="起始时间"
|
||||
:allow-clear="false"
|
||||
:showToday="false"
|
||||
>
|
||||
<template #renderExtraFooter>
|
||||
@ -33,6 +34,7 @@
|
||||
<a-form-item-rest>
|
||||
<a-date-picker
|
||||
class="w-[120px]"
|
||||
:allow-clear="false"
|
||||
v-model:value="jcdt.max"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
|
||||
@ -119,7 +119,7 @@ const tableScrollX = computed(() =>
|
||||
// 人工列
|
||||
const columnsManual: any[] = [
|
||||
{
|
||||
key: 'stnm',
|
||||
key: 'ennm',
|
||||
title: '电站名称',
|
||||
dataIndex: 'stnm',
|
||||
visible: true,
|
||||
@ -261,9 +261,9 @@ const columnsManual: any[] = [
|
||||
// 自动列
|
||||
const columnsAuto: any[] = [
|
||||
{
|
||||
key: 'stnm',
|
||||
key: 'ennm',
|
||||
title: '电站名称',
|
||||
dataIndex: 'stnm',
|
||||
dataIndex: 'ennm',
|
||||
visible: true,
|
||||
width: 200,
|
||||
sort: true,
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
v-model:value="jcdt.min"
|
||||
:format="timeFormat"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:allow-clear="false"
|
||||
:picker="timePicker"
|
||||
:showTime="timeShowTime"
|
||||
placeholder="起始时间"
|
||||
@ -40,6 +41,7 @@
|
||||
:format="timeFormat"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:picker="timePicker"
|
||||
:allow-clear="false"
|
||||
:showTime="timeShowTime"
|
||||
:disabledDate="disabledEndDate"
|
||||
placeholder="结束时间"
|
||||
|
||||
@ -363,6 +363,7 @@ const displayColumns = computed(() => {
|
||||
});
|
||||
|
||||
const onSearchFinish = async (values: any) => {
|
||||
// debugger
|
||||
currentSearchParams.value = values;
|
||||
await nextTick();
|
||||
initTable(values);
|
||||
@ -438,7 +439,7 @@ const initTable = (values: any) => {
|
||||
: null,
|
||||
values.rstcd
|
||||
? {
|
||||
field: 'rstcd',
|
||||
field: 'stcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:picker="timePicker"
|
||||
:showTime="timeShowTime"
|
||||
:allow-clear="false"
|
||||
placeholder="起始时间"
|
||||
:showToday="false"
|
||||
:showNow="false"
|
||||
@ -42,6 +43,7 @@
|
||||
:picker="timePicker"
|
||||
:showTime="timeShowTime"
|
||||
:disabledDate="disabledEndDate"
|
||||
:allow-clear="false"
|
||||
placeholder="结束时间"
|
||||
:showToday="false"
|
||||
:showNow="false"
|
||||
|
||||
@ -593,8 +593,7 @@ const transformData = (data: any) => {
|
||||
})
|
||||
.reverse();
|
||||
|
||||
const total = data?.data?.data?.[0]?.total || 0;
|
||||
|
||||
const total = data?.data?.total || 0;
|
||||
tableData.value = formattedData;
|
||||
|
||||
// 初始化图表:默认选中第一条
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
:picker="timePicker"
|
||||
:showTime="timeShowTime"
|
||||
placeholder="起始时间"
|
||||
:allow-clear="false"
|
||||
:showToday="false"
|
||||
:showNow="false"
|
||||
>
|
||||
@ -43,6 +44,7 @@
|
||||
:showTime="timeShowTime"
|
||||
:disabledDate="disabledEndDate"
|
||||
placeholder="结束时间"
|
||||
:allow-clear="false"
|
||||
:showToday="false"
|
||||
:showNow="false"
|
||||
>
|
||||
|
||||
@ -5,7 +5,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, nextTick } from 'vue';
|
||||
import { onMounted, reactive, ref, nextTick, watch } from 'vue';
|
||||
import { ElMessage, ElMessageBox, FormRules } from 'element-plus';
|
||||
import Sortable from 'sortablejs';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
@ -31,6 +31,17 @@ const treedata: any = ref([]);
|
||||
const treeRef = ref();
|
||||
const treeId = ref('');
|
||||
const defaultProps = { label: 'dictName' };
|
||||
// 树搜索
|
||||
const treeFilterText = ref('');
|
||||
|
||||
function filterNode(value: string, data: any) {
|
||||
if (!value) return true;
|
||||
return data.dictName?.includes(value);
|
||||
}
|
||||
|
||||
watch(treeFilterText, (val) => {
|
||||
treeRef.value?.filter(val);
|
||||
});
|
||||
// 字典弹框
|
||||
const title = ref('');
|
||||
const dialogdict = ref(false);
|
||||
@ -432,6 +443,12 @@ const total = ref();
|
||||
/>
|
||||
新增字典</el-button
|
||||
>
|
||||
<el-input
|
||||
v-model="treeFilterText"
|
||||
placeholder="请输入关键字过滤"
|
||||
clearable
|
||||
style="margin-bottom: 10px"
|
||||
/>
|
||||
<el-tree
|
||||
v-loading="treeloading"
|
||||
ref="treeRef"
|
||||
@ -446,9 +463,10 @@ const total = ref();
|
||||
draggable
|
||||
:highlight-current="true"
|
||||
:props="defaultProps"
|
||||
:filter-node-method="filterNode"
|
||||
@node-click="handleNodeClick"
|
||||
@node-drop="treenodeDrop"
|
||||
style="height: calc(100vh - 254px); overflow: auto"
|
||||
style="height: calc(100vh - 304px); overflow: auto"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span class="custom-tree-node">
|
||||
|
||||
@ -34,8 +34,8 @@ const menuInfoRef = ref();
|
||||
const btnInfoRef = ref();
|
||||
const loading = ref(false);
|
||||
//定义tabbar
|
||||
const systemcode = ref('2');
|
||||
const activeIndex = ref('2');
|
||||
const systemcode = ref('1');
|
||||
const activeIndex = ref('1');
|
||||
function handleSelect(key: string) {
|
||||
if (key == '1') {
|
||||
systemcode.value = '1';
|
||||
@ -585,9 +585,9 @@ onMounted(() => {
|
||||
mode="horizontal"
|
||||
@select="handleSelect"
|
||||
>
|
||||
<!-- <el-menu-item index="1">全过程数据管理子系统</el-menu-item> -->
|
||||
<el-menu-item index="1">水电水利建设项目全过程环境管理信息平台</el-menu-item>
|
||||
<el-menu-item index="2">全过程数据管理子系统</el-menu-item>
|
||||
<!-- <el-menu-item index="4">填报管理子系统</el-menu-item> -->
|
||||
<el-menu-item index="4">填报管理子系统</el-menu-item>
|
||||
</el-menu>
|
||||
<div
|
||||
style="
|
||||
@ -679,7 +679,7 @@ onMounted(() => {
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.systemcode == '1'">全过程数据管理子系统</span>
|
||||
<span v-if="scope.row.systemcode == '1'">水电水利建设项目全过程环境管理信息平台</span>
|
||||
<span v-else-if="scope.row.systemcode == '2'">全过程数据管理子系统</span>
|
||||
<span v-else>填报管理子系统</span>
|
||||
</template>
|
||||
|
||||
@ -247,6 +247,7 @@ function handleClose() {
|
||||
:before-close="handleClose"
|
||||
top="30px"
|
||||
draggable
|
||||
style="pointer-events: all;"
|
||||
:destroy-on-close="false"
|
||||
>
|
||||
<el-table
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "review",
|
||||
name: 'review'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, nextTick, watch } from "vue";
|
||||
import { ref, onMounted, nextTick, watch } from 'vue';
|
||||
import {
|
||||
queryPendingAuditUsers,
|
||||
deltableData,
|
||||
getRole,
|
||||
listGroupedByTenant,
|
||||
addUsers,
|
||||
updataUser,
|
||||
setpass,
|
||||
@ -17,20 +17,20 @@ import {
|
||||
getFishtree,
|
||||
saveFishqvan,
|
||||
getuserdata,
|
||||
auditUser,
|
||||
} from "@/api/user";
|
||||
import { getDictItemsByCode } from "@/api/dict";
|
||||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import Page from "@/components/Pagination/page.vue";
|
||||
import { Search } from "@element-plus/icons-vue";
|
||||
auditUser
|
||||
} from '@/api/user';
|
||||
import { getDictItemsByCode } from '@/api/dict';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import Page from '@/components/Pagination/page.vue';
|
||||
import { Search } from '@element-plus/icons-vue';
|
||||
// 表格加载
|
||||
const loading = ref(false);
|
||||
// 搜索框
|
||||
const queryParams = ref({
|
||||
current: 1,
|
||||
size: 10,
|
||||
querystr: "",
|
||||
regStatus: "",
|
||||
querystr: '',
|
||||
regStatus: ''
|
||||
});
|
||||
//分页 总条数
|
||||
const total = ref();
|
||||
@ -39,25 +39,25 @@ const infoForm = ref();
|
||||
|
||||
//新建
|
||||
const dialogVisible = ref(false);
|
||||
const title = ref("");
|
||||
const title = ref('');
|
||||
function addClick() {
|
||||
title.value = "新增用户";
|
||||
title.value = '新增用户';
|
||||
dialogVisible.value = true;
|
||||
info.value = {
|
||||
id: "",
|
||||
username: "",
|
||||
nickname: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
belongingUnit: "",
|
||||
roleinfo: [],
|
||||
id: '',
|
||||
username: '',
|
||||
nickname: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
belongingUnit: '',
|
||||
roleinfo: []
|
||||
};
|
||||
getrole();
|
||||
}
|
||||
//用户列表
|
||||
const multipleSelection = ref([]);
|
||||
const tableData = ref([]);
|
||||
const orgId = ref("");
|
||||
const orgId = ref('');
|
||||
//获取用户列表信息
|
||||
function getdata() {
|
||||
const params = {
|
||||
@ -65,11 +65,11 @@ function getdata() {
|
||||
size: queryParams.value.size,
|
||||
// orgid: orgId.value,
|
||||
name: queryParams.value.querystr,
|
||||
regStatus: queryParams.value.regStatus,
|
||||
regStatus: queryParams.value.regStatus
|
||||
};
|
||||
loading.value = true;
|
||||
queryPendingAuditUsers(params)
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
total.value = res.data.total;
|
||||
tableData.value = res.data.records;
|
||||
queryParams.value.size = res.data.size;
|
||||
@ -83,13 +83,13 @@ function getdata() {
|
||||
|
||||
//新建用户弹窗
|
||||
const info = ref({
|
||||
id: "",
|
||||
username: "",
|
||||
nickname: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
belongingUnit: "",
|
||||
roleinfo: [] as any[],
|
||||
id: '',
|
||||
username: '',
|
||||
nickname: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
belongingUnit: '',
|
||||
roleinfo: [] as any[]
|
||||
});
|
||||
//修改-用户
|
||||
function editdepartment(row: any) {
|
||||
@ -103,7 +103,7 @@ function editdepartment(row: any) {
|
||||
info.value = JSON.parse(JSON.stringify(row));
|
||||
info.value.roleinfo = selectID;
|
||||
rolesdata.value = row.roles;
|
||||
title.value = "修改用户";
|
||||
title.value = '修改用户';
|
||||
dialogVisible.value = true;
|
||||
getrole();
|
||||
}
|
||||
@ -120,15 +120,15 @@ function confirmClick(formEl: any) {
|
||||
nickname: info.value.nickname,
|
||||
email: info.value.email,
|
||||
phone: info.value.phone,
|
||||
belongingUnit: info.value.belongingUnit,
|
||||
belongingUnit: info.value.belongingUnit
|
||||
};
|
||||
const roleids = String(info.value.roleinfo);
|
||||
updataUser(params, roleids).then(() => {
|
||||
getdata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "修改成功",
|
||||
type: 'success',
|
||||
message: '修改成功'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@ -138,15 +138,15 @@ function confirmClick(formEl: any) {
|
||||
email: info.value.email,
|
||||
phone: info.value.phone,
|
||||
belongingUnit: info.value.belongingUnit,
|
||||
orgid: orgId.value,
|
||||
orgid: orgId.value
|
||||
};
|
||||
const roleids = info.value.roleinfo;
|
||||
addUsers(params, roleids).then((res) => {
|
||||
addUsers(params, roleids).then(res => {
|
||||
getdata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: res.data.msg,
|
||||
type: 'success',
|
||||
message: res.data.msg
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -155,8 +155,8 @@ function confirmClick(formEl: any) {
|
||||
}
|
||||
//用户弹窗规则定义
|
||||
const moderules = ref({
|
||||
username: [{ required: true, message: "请输入用户账号", trigger: "blur" }],
|
||||
nickname: [{ required: true, message: "请输入用户名称", trigger: "blur" }],
|
||||
username: [{ required: true, message: '请输入用户账号', trigger: 'blur' }],
|
||||
nickname: [{ required: true, message: '请输入用户名称', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
//弹窗关闭
|
||||
@ -166,17 +166,17 @@ function handleClose() {
|
||||
}
|
||||
|
||||
//重置密码
|
||||
const userid = ref("");
|
||||
const userid = ref('');
|
||||
const resultPawss = ref(false);
|
||||
const msgText = ref("");
|
||||
const msgText = ref('');
|
||||
function setpassword(row: any) {
|
||||
ElMessageBox.confirm("确定要重置此账号密码吗?", "重置密码", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定要重置此账号密码吗?', '重置密码', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
id: userid.value,
|
||||
id: userid.value
|
||||
};
|
||||
setpass(params).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
@ -196,7 +196,7 @@ function closeResult() {
|
||||
}
|
||||
//过去设施权限维护
|
||||
const fishway = ref(false);
|
||||
const userId = ref("");
|
||||
const userId = ref('');
|
||||
// 回显的权限ID数组
|
||||
const fishhui = ref<any[]>([]);
|
||||
const fishTreeDialog = ref(false);
|
||||
@ -207,7 +207,7 @@ const isFishDataLoaded = ref(false);
|
||||
async function openFishway(row: any) {
|
||||
fishway.value = true;
|
||||
userId.value = row.id;
|
||||
treeInput.value = "";
|
||||
treeInput.value = '';
|
||||
// 重置状态
|
||||
fishhui.value = [];
|
||||
tableDatafish.value = [];
|
||||
@ -218,7 +218,7 @@ async function openFishway(row: any) {
|
||||
await Promise.all([
|
||||
getFishTree(), // 获取树形数据
|
||||
getuserdata({ userId: userId.value }).then((res: any) => {
|
||||
console.log("用户权限数据:", res);
|
||||
console.log('用户权限数据:', res);
|
||||
if (res.code == 0) {
|
||||
res.data.forEach((item: any) => {
|
||||
fishhui.value.push(item.orgId);
|
||||
@ -231,19 +231,19 @@ async function openFishway(row: any) {
|
||||
userId: item.userId,
|
||||
parentId: item.parentId,
|
||||
orgLevel: item.orgLevel,
|
||||
permissionType: item.permissionType,
|
||||
permissionType: item.permissionType
|
||||
});
|
||||
});
|
||||
}
|
||||
}),
|
||||
})
|
||||
]);
|
||||
|
||||
// 两个请求都完成后,标记数据已加载
|
||||
isFishDataLoaded.value = true;
|
||||
console.log("所有数据加载完成,准备回显");
|
||||
console.log('所有数据加载完成,准备回显');
|
||||
} catch (error) {
|
||||
console.error("加载数据失败:", error);
|
||||
ElMessage.error("加载数据失败,请重试");
|
||||
console.error('加载数据失败:', error);
|
||||
ElMessage.error('加载数据失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,9 +251,9 @@ async function openFishway(row: any) {
|
||||
watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
||||
if (newFishway && newDataLoaded) {
|
||||
// 确保两个数据都已加载完成后再执行回显
|
||||
console.log("开始回显, fishTreeRef:", fishTreeRef.value);
|
||||
console.log("回显ID:", fishhui.value);
|
||||
console.log("树数据:", fishData.value);
|
||||
console.log('开始回显, fishTreeRef:', fishTreeRef.value);
|
||||
console.log('回显ID:', fishhui.value);
|
||||
console.log('树数据:', fishData.value);
|
||||
|
||||
// 使用 nextTick 确保 DOM 已更新
|
||||
nextTick(() => {
|
||||
@ -270,7 +270,7 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
||||
fishhui.value,
|
||||
fishData.value
|
||||
);
|
||||
console.log("需要展开的父节点codes:", parentCodesToExpand);
|
||||
console.log('需要展开的父节点codes:', parentCodesToExpand);
|
||||
|
||||
// 控制展开/折叠状态
|
||||
setTreeExpandState(parentCodesToExpand);
|
||||
@ -278,8 +278,8 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
||||
// 验证回显结果
|
||||
const checkedKeys = fishTreeRef.value.getCheckedKeys();
|
||||
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
||||
console.log("回显完成 - 全选节点:", checkedKeys);
|
||||
console.log("回显完成 - 半选节点:", halfCheckedKeys);
|
||||
console.log('回显完成 - 全选节点:', checkedKeys);
|
||||
console.log('回显完成 - 半选节点:', halfCheckedKeys);
|
||||
|
||||
// 同步表格数据
|
||||
fishTableData.value = tableDatafish.value;
|
||||
@ -294,7 +294,7 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
||||
});
|
||||
} else if (!newFishway) {
|
||||
// 关闭时清空回显数据
|
||||
console.log("关闭对话框,清理数据");
|
||||
console.log('关闭对话框,清理数据');
|
||||
fishhui.value = [];
|
||||
isFishDataLoaded.value = false;
|
||||
// 清除tree选中状态
|
||||
@ -314,12 +314,12 @@ function fishHandleClose() {
|
||||
fishData.value = [];
|
||||
}
|
||||
//获取过鱼设施权限
|
||||
const treeInput = ref("");
|
||||
const treeInput = ref('');
|
||||
const fishProps = {
|
||||
children: "children",
|
||||
label: "name",
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
};
|
||||
watch(treeInput, (val) => {
|
||||
watch(treeInput, val => {
|
||||
fishTreeRef.value!.filter(val);
|
||||
});
|
||||
function filterNode(value: string, data: any) {
|
||||
@ -364,13 +364,16 @@ function getAllChildrenIds(node: any): number[] {
|
||||
}
|
||||
|
||||
// 过鱼设施权限维护 - 检查父节点下所有子节点是否都被选中
|
||||
function areAllChildrenChecked(parentNode: any, checkedKeysArray: any[]): boolean {
|
||||
function areAllChildrenChecked(
|
||||
parentNode: any,
|
||||
checkedKeysArray: any[]
|
||||
): boolean {
|
||||
const allChildrenIds = getAllChildrenIds(parentNode);
|
||||
if (allChildrenIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// 检查所有子节点ID是否都在已选中的keys中
|
||||
return allChildrenIds.every((code) => checkedKeysArray.includes(code));
|
||||
return allChildrenIds.every(code => checkedKeysArray.includes(code));
|
||||
}
|
||||
|
||||
// 过鱼设施权限维护 - 检查节点是否被其他父节点包含
|
||||
@ -394,7 +397,10 @@ function isNodeContainedByOtherParent(
|
||||
}
|
||||
|
||||
// 统一处理选中IDs的过滤逻辑:如果父节点的所有子节点都被选中,只保留父节点ID
|
||||
function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]): number[] {
|
||||
function filterSelectedIds(
|
||||
checkedKeysArray: number[],
|
||||
allCheckedNodes: any[]
|
||||
): number[] {
|
||||
const resultIds: number[] = [];
|
||||
const fullySelectedParentIds: number[] = [];
|
||||
const filteredNodeIds = new Set<number>();
|
||||
@ -405,7 +411,7 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
||||
if (areAllChildrenChecked(node, checkedKeysArray)) {
|
||||
fullySelectedParentIds.push(node.code);
|
||||
const childrenIds = getAllChildrenIds(node);
|
||||
childrenIds.forEach((childId) => {
|
||||
childrenIds.forEach(childId => {
|
||||
filteredNodeIds.add(childId);
|
||||
});
|
||||
}
|
||||
@ -414,9 +420,13 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
||||
|
||||
// 第二阶段:添加结果
|
||||
// 1. 先添加所有"全选"的父节点(但要排除被其他父节点包含的)
|
||||
fullySelectedParentIds.forEach((parentId) => {
|
||||
fullySelectedParentIds.forEach(parentId => {
|
||||
if (
|
||||
!isNodeContainedByOtherParent(parentId, fullySelectedParentIds, allCheckedNodes)
|
||||
!isNodeContainedByOtherParent(
|
||||
parentId,
|
||||
fullySelectedParentIds,
|
||||
allCheckedNodes
|
||||
)
|
||||
) {
|
||||
resultIds.push(parentId);
|
||||
}
|
||||
@ -426,14 +436,18 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
||||
allCheckedNodes.forEach((node: any) => {
|
||||
if (!filteredNodeIds.has(node.code) && !resultIds.includes(node.code)) {
|
||||
if (
|
||||
!isNodeContainedByOtherParent(node.code, fullySelectedParentIds, allCheckedNodes)
|
||||
!isNodeContainedByOtherParent(
|
||||
node.code,
|
||||
fullySelectedParentIds,
|
||||
allCheckedNodes
|
||||
)
|
||||
) {
|
||||
resultIds.push(node.code);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log("过滤后的IDs:", resultIds);
|
||||
console.log('过滤后的IDs:', resultIds);
|
||||
return resultIds;
|
||||
}
|
||||
|
||||
@ -491,7 +505,7 @@ function handleFishCheckChange(checkedNode: any, checkedInfo: any) {
|
||||
// 使用统一的过滤逻辑处理IDs
|
||||
const resultIds = filterSelectedIds(checkedKeysArray, allCheckedNodes);
|
||||
|
||||
console.log("最终获取的IDs:", resultIds);
|
||||
console.log('最终获取的IDs:', resultIds);
|
||||
|
||||
// 更新表格数据
|
||||
getFishTableData(resultIds);
|
||||
@ -519,7 +533,7 @@ function getFishTableData(ids: any[]) {
|
||||
userId: userId.value,
|
||||
parentId: node.parentId,
|
||||
orgLevel: node.orgLevel,
|
||||
permissionType: "READ", // 默认选择读权限
|
||||
permissionType: 'READ' // 默认选择读权限
|
||||
});
|
||||
}
|
||||
|
||||
@ -537,16 +551,16 @@ function getFishTableData(ids: any[]) {
|
||||
const tableids: any = ref([]);
|
||||
//选中的过鱼权限
|
||||
function fishDataHandleSelectionChange(val: any) {
|
||||
console.log("选中的行数据:", val);
|
||||
console.log('选中的行数据:', val);
|
||||
fishTableSelection.value = val;
|
||||
}
|
||||
|
||||
//移除权限
|
||||
function delFishTable() {
|
||||
ElMessageBox.confirm("确定移除选中权限吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定移除选中权限吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
// 获取选中的ID数组
|
||||
@ -579,8 +593,8 @@ function delFishTable() {
|
||||
}
|
||||
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "删除成功",
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
});
|
||||
|
||||
// 清空选中状态
|
||||
@ -622,34 +636,36 @@ function fishSure() {
|
||||
parentId: item.parentId,
|
||||
orgLevel: item.orgLevel,
|
||||
path: item.path,
|
||||
permissionType: item.permissionType,
|
||||
permissionType: item.permissionType
|
||||
});
|
||||
});
|
||||
saveFishqvan({ userId: userId.value, dataScopeList: params }).then((res: any) => {
|
||||
saveFishqvan({ userId: userId.value, dataScopeList: params }).then(
|
||||
(res: any) => {
|
||||
console.log(res);
|
||||
if (res.code == 0) {
|
||||
ElMessage({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
message: '保存成功',
|
||||
type: 'success'
|
||||
});
|
||||
fishHandleClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
//删除用户
|
||||
function delclick(row: any) {
|
||||
ElMessageBox.confirm("确定删除此用户吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定删除此用户吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
id: row.id,
|
||||
id: row.id
|
||||
};
|
||||
deltableData(params).then(() => {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "删除成功",
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
});
|
||||
getdata();
|
||||
});
|
||||
@ -658,9 +674,9 @@ function delclick(row: any) {
|
||||
//获取角色
|
||||
function getrole() {
|
||||
const params = {
|
||||
rolename: "",
|
||||
rolename: ''
|
||||
};
|
||||
getRole(params).then((res) => {
|
||||
listGroupedByTenant(params).then(res => {
|
||||
rolesdata.value = res;
|
||||
});
|
||||
}
|
||||
@ -676,18 +692,18 @@ function delchoice() {
|
||||
ids.value.forEach((item: any) => {
|
||||
choice.push(item.id);
|
||||
});
|
||||
ElMessageBox.confirm("确定删除此用户吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定删除此用户吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
id: String(choice),
|
||||
id: String(choice)
|
||||
};
|
||||
delChoise(params).then(() => {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "删除成功",
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
});
|
||||
getdata();
|
||||
});
|
||||
@ -700,14 +716,32 @@ function dateFormat(row: any) {
|
||||
var date = new Date(daterc);
|
||||
var year = date.getFullYear();
|
||||
var month =
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||
var minutes =
|
||||
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||
var seconds =
|
||||
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
return (
|
||||
year +
|
||||
'-' +
|
||||
month +
|
||||
'-' +
|
||||
day +
|
||||
' ' +
|
||||
hours +
|
||||
':' +
|
||||
minutes +
|
||||
':' +
|
||||
seconds
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -715,11 +749,11 @@ function dateFormat(row: any) {
|
||||
//分类名字
|
||||
function getName(arr: any[], type: any): string {
|
||||
if (!arr || !Array.isArray(arr) || type === undefined || type === null) {
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
const items = arr.find((item: any) => item?.itemCode == type);
|
||||
console.log(items);
|
||||
return items?.dictName || "";
|
||||
return items?.dictName || '';
|
||||
}
|
||||
|
||||
// 获取审核状态对应的Tag颜色类型
|
||||
@ -730,60 +764,60 @@ function getRegStatusColor(type: any): string {
|
||||
type === undefined ||
|
||||
type === null
|
||||
) {
|
||||
return "info";
|
||||
return 'info';
|
||||
}
|
||||
const items = regStatusArr.value.find((item: any) => item?.itemCode == type);
|
||||
const color = items?.custom1 || "info";
|
||||
const color = items?.custom1 || 'info';
|
||||
|
||||
// 映射字典custom1到Element Plus Tag类型
|
||||
const colorMap: Record<string, string> = {
|
||||
blue: "primary", // 待审核 - 蓝色
|
||||
green: "success", // 已通过 - 绿色
|
||||
red: "danger", // 已驳回 - 红色
|
||||
blue: 'primary', // 待审核 - 蓝色
|
||||
green: 'success', // 已通过 - 绿色
|
||||
red: 'danger' // 已驳回 - 红色
|
||||
};
|
||||
|
||||
return colorMap[color] || "info";
|
||||
return colorMap[color] || 'info';
|
||||
}
|
||||
|
||||
// ==================== 审批相关功能 ====================
|
||||
// 审批对话框显示状态
|
||||
const auditDialogVisible = ref(false);
|
||||
// 审批类型:1-通过,2-驳回
|
||||
const auditType = ref("");
|
||||
const auditType = ref('');
|
||||
// 当前审批的用户ID
|
||||
const currentAuditUserId = ref("");
|
||||
const currentAuditUserId = ref('');
|
||||
// 审批意见表单
|
||||
const auditForm = ref({
|
||||
commentInfo: "",
|
||||
commentInfo: ''
|
||||
});
|
||||
// 审批意见表单引用
|
||||
const auditFormRef = ref();
|
||||
|
||||
// 审批意见表单验证规则
|
||||
const auditRules = ref({
|
||||
commentInfo: [{ required: true, message: "请输入审批意见", trigger: "blur" }],
|
||||
commentInfo: [{ required: true, message: '请输入审批意见', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 打开审批通过对话框
|
||||
function handleAuditPass(row: any) {
|
||||
currentAuditUserId.value = row.id;
|
||||
auditType.value = "APPROVED";
|
||||
auditForm.value.commentInfo = "";
|
||||
auditType.value = 'APPROVED';
|
||||
auditForm.value.commentInfo = '';
|
||||
auditDialogVisible.value = true;
|
||||
}
|
||||
|
||||
// 打开审批驳回对话框
|
||||
function handleAuditReject(row: any) {
|
||||
currentAuditUserId.value = row.id;
|
||||
auditType.value = "REJECTED";
|
||||
auditForm.value.commentInfo = "";
|
||||
auditType.value = 'REJECTED';
|
||||
auditForm.value.commentInfo = '';
|
||||
auditDialogVisible.value = true;
|
||||
}
|
||||
|
||||
// 关闭审批对话框
|
||||
function handleAuditClose() {
|
||||
auditDialogVisible.value = false;
|
||||
auditForm.value.commentInfo = "";
|
||||
auditForm.value.commentInfo = '';
|
||||
if (auditFormRef.value) {
|
||||
auditFormRef.value.resetFields();
|
||||
}
|
||||
@ -796,22 +830,23 @@ function submitAudit(formEl: any) {
|
||||
const params = {
|
||||
userId: currentAuditUserId.value,
|
||||
regStatus: auditType.value,
|
||||
commentInfo: auditForm.value.commentInfo,
|
||||
commentInfo: auditForm.value.commentInfo
|
||||
};
|
||||
|
||||
auditUser(params)
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: auditType.value === "APPROVED" ? "审批通过成功" : "审批驳回成功",
|
||||
type: 'success',
|
||||
message:
|
||||
auditType.value === 'APPROVED' ? '审批通过成功' : '审批驳回成功'
|
||||
});
|
||||
handleAuditClose();
|
||||
getdata(); // 刷新列表
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "审批操作失败,请重试",
|
||||
type: 'error',
|
||||
message: '审批操作失败,请重试'
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -825,10 +860,10 @@ onMounted(() => {
|
||||
const dictData = ref([]);
|
||||
const regStatusArr = ref([]);
|
||||
function getdictdata() {
|
||||
getDictItemsByCode({ dictCode: "resourceType" }).then((res) => {
|
||||
getDictItemsByCode({ dictCode: 'resourceType' }).then(res => {
|
||||
dictData.value = res.data;
|
||||
});
|
||||
getDictItemsByCode({ dictCode: "approvalStatus" }).then((res) => {
|
||||
getDictItemsByCode({ dictCode: 'approvalStatus' }).then(res => {
|
||||
regStatusArr.value = res.data;
|
||||
});
|
||||
}
|
||||
@ -836,18 +871,18 @@ const vMove = {
|
||||
mounted(el: any) {
|
||||
el.onmousedown = function (e: any) {
|
||||
var init = e.clientX;
|
||||
var parent: any = document.getElementById("silderLeft");
|
||||
var parent: any = document.getElementById('silderLeft');
|
||||
const initWidth: any = parent.offsetWidth;
|
||||
document.onmousemove = function (e) {
|
||||
var end = e.clientX;
|
||||
var newWidth = end - init + initWidth;
|
||||
parent.style.width = newWidth + "px";
|
||||
parent.style.width = newWidth + 'px';
|
||||
};
|
||||
document.onmouseup = function () {
|
||||
document.onmousemove = document.onmouseup = null;
|
||||
};
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
// 递归获取树形数据中所有节点的code
|
||||
function getAllNodeCodes(nodes: any[]): number[] {
|
||||
@ -864,11 +899,11 @@ function getAllNodeCodes(nodes: any[]): number[] {
|
||||
// 全选:选中树中所有节点
|
||||
function handleSelectAll() {
|
||||
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
||||
ElMessage.warning("暂无数据可全选");
|
||||
ElMessage.warning('暂无数据可全选');
|
||||
return;
|
||||
}
|
||||
const allCodes = getAllNodeCodes(fishData.value);
|
||||
console.log("全选 - 所有节点codes:", allCodes);
|
||||
console.log('全选 - 所有节点codes:', allCodes);
|
||||
fishTreeRef.value.setCheckedKeys(allCodes, true);
|
||||
|
||||
// 手动更新表格数据(使用统一过滤逻辑)
|
||||
@ -882,16 +917,16 @@ function handleSelectAll() {
|
||||
|
||||
getFishTableData(filteredIds);
|
||||
tableids.value = filteredIds;
|
||||
console.log("全选 - 表格数据已更新,过滤后IDs:", filteredIds);
|
||||
console.log('全选 - 表格数据已更新,过滤后IDs:', filteredIds);
|
||||
}, 100);
|
||||
|
||||
ElMessage.success("已全选所有节点");
|
||||
ElMessage.success('已全选所有节点');
|
||||
}
|
||||
|
||||
// 反选:反转当前选中状态
|
||||
function handleInvertSelection() {
|
||||
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
||||
ElMessage.warning("暂无数据可操作");
|
||||
ElMessage.warning('暂无数据可操作');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -900,19 +935,23 @@ function handleInvertSelection() {
|
||||
// 获取当前半选的节点keys(父节点部分子节点被选中)
|
||||
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
||||
|
||||
console.log("反选前 - 已选中codes:", checkedKeys);
|
||||
console.log("反选前 - 半选codes:", halfCheckedKeys);
|
||||
console.log('反选前 - 已选中codes:', checkedKeys);
|
||||
console.log('反选前 - 半选codes:', halfCheckedKeys);
|
||||
|
||||
// 合并完全选中和半选的节点,这些是需要取消选中的
|
||||
const currentSelectedKeys = [...new Set([...checkedKeys, ...halfCheckedKeys])];
|
||||
console.log("反选前 - 当前有效选中状态:", currentSelectedKeys);
|
||||
const currentSelectedKeys = [
|
||||
...new Set([...checkedKeys, ...halfCheckedKeys])
|
||||
];
|
||||
console.log('反选前 - 当前有效选中状态:', currentSelectedKeys);
|
||||
|
||||
// 获取所有节点codes
|
||||
const allCodes = getAllNodeCodes(fishData.value);
|
||||
|
||||
// 计算需要选中的节点:所有节点 - 当前有效选中状态
|
||||
const invertedCodes = allCodes.filter((code) => !currentSelectedKeys.includes(code));
|
||||
console.log("反选后 - 新的选中codes:", invertedCodes);
|
||||
const invertedCodes = allCodes.filter(
|
||||
code => !currentSelectedKeys.includes(code)
|
||||
);
|
||||
console.log('反选后 - 新的选中codes:', invertedCodes);
|
||||
|
||||
// 先清空所有选中状态,避免级联影响
|
||||
fishTreeRef.value.setCheckedKeys([], false);
|
||||
@ -932,11 +971,11 @@ function handleInvertSelection() {
|
||||
|
||||
getFishTableData(filteredIds);
|
||||
tableids.value = filteredIds;
|
||||
console.log("反选 - 表格数据已更新,过滤后IDs:", filteredIds);
|
||||
console.log('反选 - 表格数据已更新,过滤后IDs:', filteredIds);
|
||||
}, 100);
|
||||
}, 50);
|
||||
|
||||
ElMessage.success("已反选操作");
|
||||
ElMessage.success('已反选操作');
|
||||
}
|
||||
|
||||
// 取消选中:清空所有选中状态
|
||||
@ -944,17 +983,17 @@ function handleClearSelection() {
|
||||
if (!fishTreeRef.value) {
|
||||
return;
|
||||
}
|
||||
console.log("取消选中 - 清空所有选中");
|
||||
console.log('取消选中 - 清空所有选中');
|
||||
fishTreeRef.value.setCheckedKeys([], true);
|
||||
|
||||
// 手动清空表格数据
|
||||
setTimeout(() => {
|
||||
getFishTableData([]);
|
||||
tableids.value = [];
|
||||
console.log("取消选中 - 表格数据已清空");
|
||||
console.log('取消选中 - 表格数据已清空');
|
||||
}, 100);
|
||||
|
||||
ElMessage.success("已取消所有选中");
|
||||
ElMessage.success('已取消所有选中');
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -994,7 +1033,10 @@ function handleClearSelection() {
|
||||
:value="item.itemCode"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="getdata"
|
||||
<el-button
|
||||
type="primary"
|
||||
style="margin-left: 10px"
|
||||
@click="getdata"
|
||||
>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@ -1022,7 +1064,7 @@ function handleClearSelection() {
|
||||
:header-cell-style="{
|
||||
background: 'rgb(250 250 250)',
|
||||
color: ' #383838',
|
||||
height: '50px',
|
||||
height: '50px'
|
||||
}"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="50" align="center" /> -->
|
||||
@ -1040,8 +1082,8 @@ function handleClearSelection() {
|
||||
>
|
||||
<span>
|
||||
{{
|
||||
scope.row.basinNames.split(",").slice(0, 6).join(",") +
|
||||
(scope.row.basinNames.split(",").length > 6 ? "..." : "")
|
||||
scope.row.basinNames.split(',').slice(0, 6).join(',') +
|
||||
(scope.row.basinNames.split(',').length > 6 ? '...' : '')
|
||||
}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
@ -1060,17 +1102,25 @@ function handleClearSelection() {
|
||||
>
|
||||
<span>
|
||||
{{
|
||||
scope.row.stationNames.split(",").slice(0, 6).join(",") +
|
||||
(scope.row.stationNames.split(",").length > 6 ? "..." : "")
|
||||
scope.row.stationNames.split(',').slice(0, 6).join(',') +
|
||||
(scope.row.stationNames.split(',').length > 6 ? '...' : '')
|
||||
}}
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="nickname" label="用户姓名" width="140"></el-table-column>
|
||||
<el-table-column
|
||||
prop="nickname"
|
||||
label="用户姓名"
|
||||
width="140"
|
||||
></el-table-column>
|
||||
<!-- <el-table-column prop="avatar" label="头像"></el-table-column> -->
|
||||
<!-- <el-table-column prop="email" label="邮箱"></el-table-column> -->
|
||||
<el-table-column prop="phone" label="手机号" width="160"></el-table-column>
|
||||
<el-table-column
|
||||
prop="phone"
|
||||
label="手机号"
|
||||
width="160"
|
||||
></el-table-column>
|
||||
<el-table-column prop="username" label="登录账号"></el-table-column>
|
||||
<!-- <el-table-column prop="custom1" label="登录账号"></el-table-column> -->
|
||||
<!-- <el-table-column prop="rolename" label="所属角色" >
|
||||
@ -1079,7 +1129,12 @@ function handleClearSelection() {
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="regStatus" label="审核状态" width="90" align="center">
|
||||
<el-table-column
|
||||
prop="regStatus"
|
||||
label="审核状态"
|
||||
width="90"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-tag :type="getRegStatusColor(scope.row.regStatus)" size="small">
|
||||
{{ getName(regStatusArr, scope.row.regStatus) }}
|
||||
@ -1166,7 +1221,12 @@ function handleClearSelection() {
|
||||
width="620px"
|
||||
draggable
|
||||
>
|
||||
<el-form ref="infoForm" :model="info" :rules="moderules" label-width="90px">
|
||||
<el-form
|
||||
ref="infoForm"
|
||||
:model="info"
|
||||
:rules="moderules"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="用户姓名" prop="nickname">
|
||||
<el-input
|
||||
v-model="info.nickname"
|
||||
@ -1203,13 +1263,25 @@ function handleClearSelection() {
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属角色">
|
||||
<el-select v-model="info.roleinfo" placeholder=" " style="width: 100%" multiple>
|
||||
<el-select
|
||||
v-model="info.roleinfo"
|
||||
placeholder=" "
|
||||
style="width: 100%"
|
||||
multiple
|
||||
filterable
|
||||
>
|
||||
<el-option-group
|
||||
v-for="group in rolesdata"
|
||||
:key="group.tenantName"
|
||||
:label="group.tenantName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rolesdata"
|
||||
v-for="item in group.roles"
|
||||
:key="item.id"
|
||||
:label="item.rolename"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -1223,7 +1295,9 @@ function handleClearSelection() {
|
||||
"
|
||||
>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmClick(infoForm)">保存</el-button>
|
||||
<el-button type="primary" @click="confirmClick(infoForm)"
|
||||
>保存</el-button
|
||||
>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 过鱼设施权限维护 -->
|
||||
@ -1256,9 +1330,15 @@ function handleClearSelection() {
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="button_div">
|
||||
<el-button type="primary" @click="handleSelectAll">全选</el-button>
|
||||
<el-button type="primary" @click="handleInvertSelection">反选</el-button>
|
||||
<el-button type="primary" @click="handleClearSelection">取消选中</el-button>
|
||||
<el-button type="primary" @click="handleSelectAll"
|
||||
>全选</el-button
|
||||
>
|
||||
<el-button type="primary" @click="handleInvertSelection"
|
||||
>反选</el-button
|
||||
>
|
||||
<el-button type="primary" @click="handleClearSelection"
|
||||
>取消选中</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1298,13 +1378,23 @@ function handleClearSelection() {
|
||||
:header-cell-style="{
|
||||
background: 'rgb(250 250 250)',
|
||||
color: ' #383838',
|
||||
height: '50px',
|
||||
height: '50px'
|
||||
}"
|
||||
>
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
width="70"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="name" label="名称"></el-table-column>
|
||||
<el-table-column prop="type" label="类型" width="200" align="center">
|
||||
<el-table-column
|
||||
prop="type"
|
||||
label="类型"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ getName(dictData, scope.row.type) }}</span>
|
||||
</template>
|
||||
@ -1365,7 +1455,9 @@ function handleClearSelection() {
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleAuditClose">取消</el-button>
|
||||
<el-button type="primary" @click="submitAudit(auditFormRef)">确定</el-button>
|
||||
<el-button type="primary" @click="submitAudit(auditFormRef)"
|
||||
>确定</el-button
|
||||
>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -1378,7 +1470,9 @@ function handleClearSelection() {
|
||||
append-to-body
|
||||
:before-close="closeResult"
|
||||
>
|
||||
已将密码重置为:<span style="color: #409eff; font-size: 16px">{{ msgText }}</span>
|
||||
已将密码重置为:<span style="color: #409eff; font-size: 16px">{{
|
||||
msgText
|
||||
}}</span>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="closeResult">取消</el-button>
|
||||
@ -1526,4 +1620,7 @@ function handleClearSelection() {
|
||||
.el-message-box {
|
||||
width: 300px !important;
|
||||
}
|
||||
:deep(.el-select-group__title){
|
||||
font-size: 16px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -13,11 +13,12 @@ import {
|
||||
addDept,
|
||||
renewDept,
|
||||
deleDept,
|
||||
assignmentPer,
|
||||
permissionAssignmentGrouped,
|
||||
setMenuById,
|
||||
setOrgscope,
|
||||
postOrgscope
|
||||
} from '@/api/role';
|
||||
import { getDictItemsByCode } from '@/api/dict';
|
||||
//定义表格数据
|
||||
const tableData: any = ref([]);
|
||||
const multipleSelection = ref([]);
|
||||
@ -28,7 +29,8 @@ const tree = ref();
|
||||
const loading = ref(false);
|
||||
function gettableData() {
|
||||
let params = {
|
||||
rolename: input.value
|
||||
rolename: input.value,
|
||||
tenantId:tenValue.value,
|
||||
};
|
||||
loading.value = true;
|
||||
listRolePages(params)
|
||||
@ -115,7 +117,8 @@ function confirmClick(formEl: any) {
|
||||
const params = {
|
||||
rolename: info.value.rolename,
|
||||
level: info.value.level,
|
||||
description: info.value.description
|
||||
description: info.value.description,
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
addDept(params).then(() => {
|
||||
gettableData();
|
||||
@ -126,7 +129,8 @@ function confirmClick(formEl: any) {
|
||||
rolename: info.value.rolename,
|
||||
level: info.value.level,
|
||||
description: info.value.description,
|
||||
id: info.value.id
|
||||
id: info.value.id,
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
renewDept(params).then(() => {
|
||||
gettableData();
|
||||
@ -274,12 +278,13 @@ function assignment(row: any) {
|
||||
rowid.value = row.id;
|
||||
accessVisible.value = true;
|
||||
const params = {
|
||||
roleId: rowid.value
|
||||
roleId: rowid.value,
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
assignmentPer(params).then((res: any) => {
|
||||
accessdata.value = res;
|
||||
permissionAssignmentGrouped(params).then((res: any) => {
|
||||
accessdata.value = res[0]?.menus || [];
|
||||
let ids: any = [];
|
||||
menuChange(res, ids);
|
||||
menuChange(res[0]?.menus, ids);
|
||||
nextTick(() => {
|
||||
tree.value.setCheckedKeys(ids);
|
||||
});
|
||||
@ -364,9 +369,13 @@ function dateFormat(row: any) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let tenValue = ref('1')
|
||||
let tenOption = ref([])
|
||||
onMounted(() => {
|
||||
gettableData();
|
||||
getDictItemsByCode({ dictCode: 'PLATFORM_TENANT' }).then(res => {
|
||||
tenOption.value = res.data;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -390,6 +399,15 @@ onMounted(() => {
|
||||
style="width: 200px"
|
||||
clearable
|
||||
/>
|
||||
<el-select v-model="tenValue" placeholder=" " style="width: 320px;margin-left: 10px">
|
||||
<el-option
|
||||
v-for="item in tenOption"
|
||||
:key="item.itemCode"
|
||||
:label="item.dictName"
|
||||
:value="item.itemCode"
|
||||
/>
|
||||
<!-- PLATFORM_TENANT -->
|
||||
</el-select>
|
||||
<el-button
|
||||
type="primary"
|
||||
style="margin-left: 10px"
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
gettableData,
|
||||
DataStatus,
|
||||
deltableData,
|
||||
getRole,
|
||||
listGroupedByTenant,
|
||||
addUsers,
|
||||
updataUser,
|
||||
setpass,
|
||||
@ -786,7 +786,7 @@ function getrole() {
|
||||
const params = {
|
||||
rolename: ''
|
||||
};
|
||||
getRole(params).then(res => {
|
||||
listGroupedByTenant(params).then(res => {
|
||||
rolesdata.value = res;
|
||||
});
|
||||
}
|
||||
@ -1250,19 +1250,27 @@ function handleClearSelection() {
|
||||
placeholder="请输入登录账号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属角色">
|
||||
<el-select
|
||||
v-model="info.roleinfo"
|
||||
placeholder=" "
|
||||
style="width: 100%"
|
||||
multiple
|
||||
filterable
|
||||
>
|
||||
<el-option-group
|
||||
v-for="group in rolesdata"
|
||||
:key="group.tenantName"
|
||||
:label="group.tenantName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rolesdata"
|
||||
v-for="item in group.roles"
|
||||
:key="item.id"
|
||||
:label="item.rolename"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -1565,4 +1573,7 @@ function handleClearSelection() {
|
||||
.el-message-box {
|
||||
width: 300px !important;
|
||||
}
|
||||
:deep(.el-select-group__title){
|
||||
font-size: 16px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -51,6 +51,14 @@ export function assignmentPer (queryParams:any){
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取分配权限(改动之后)
|
||||
export function permissionAssignmentGrouped (queryParams:any){
|
||||
return request({
|
||||
url:'/system/menu/permissionAssignmentGrouped' ,
|
||||
method: 'post',
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//发出分配权限
|
||||
export function setMenuById (queryParams:any){
|
||||
return request({
|
||||
|
||||
@ -57,6 +57,14 @@ export function getRole (queryParams:any) {
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取角色
|
||||
export function listGroupedByTenant (queryParams:any) {
|
||||
return request({
|
||||
url: '/system/role/listGroupedByTenant',
|
||||
method: 'POST',
|
||||
data: queryParams
|
||||
});
|
||||
}
|
||||
//新建用户
|
||||
export function addUsers (queryParams:any,roleids:any) {
|
||||
return request({
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
</a-select> -->
|
||||
<!-- 流域下拉框 -->
|
||||
<a-select
|
||||
:value="formData.rvcd"
|
||||
:value="formData.reachcd"
|
||||
placeholder="请选择"
|
||||
@change="lyChange"
|
||||
show-search
|
||||
@ -330,7 +330,7 @@ const initForm = () => {
|
||||
// 下拉菜单
|
||||
// shuJuTianBaoStore.getBaseOption();
|
||||
shuJuTianBaoStore.getSelectForOption();
|
||||
shuJuTianBaoStore.getEngOption(formData.rvcd);
|
||||
shuJuTianBaoStore.getEngOption(formData.reachcd);
|
||||
}
|
||||
if (item.fieldProps?.required) {
|
||||
rules[item.name] = [
|
||||
@ -363,23 +363,23 @@ const triggerManualValuesChange = (changedKey: string, newValue: any) => {
|
||||
// };
|
||||
|
||||
const lyChange = (value: any) => {
|
||||
formData.rvcd = value;
|
||||
formData.reachcd = value;
|
||||
formData.rstcd = "";
|
||||
shuJuTianBaoStore.getEngOption(formData.rvcd);
|
||||
|
||||
shuJuTianBaoStore.getEngOption(formData.reachcd);
|
||||
// debugger
|
||||
// 【关键修改】手动触发 valuesChange,因为 a-form-item-rest 阻断了自动监听
|
||||
triggerManualValuesChange("rvcd", formData.rvcd);
|
||||
triggerManualValuesChange("reachcd", formData.reachcd);
|
||||
};
|
||||
|
||||
const stcdIdChange = (value: any) => {
|
||||
if (props.zhujianfujian == "fu") {
|
||||
formData.rstcd = value;
|
||||
shuJuTianBaoStore.getFpssOption(formData.rvcd, value);
|
||||
shuJuTianBaoStore.getFpssOption(formData.reachcd, value);
|
||||
// 【关键修改】手动触发 valuesChange
|
||||
triggerManualValuesChange("rstcd", formData.rstcd);
|
||||
} else {
|
||||
formData.stcd = value;
|
||||
shuJuTianBaoStore.getFpssOption(formData.rvcd, value);
|
||||
shuJuTianBaoStore.getFpssOption(formData.reachcd, value);
|
||||
// 【关键修改】手动触发 valuesChange
|
||||
triggerManualValuesChange("stcd", formData.stcd);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
const getEngOption = async (rvcd: string) => {
|
||||
try {
|
||||
engLoading.value = true;
|
||||
const param = rvcd === 'all' ? {} : { rvcd };
|
||||
const param = rvcd === 'all' ? {} : { reachcd: rvcd };
|
||||
const res = await getEngInfoDropdown(param);
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
// 直接赋值给 ref
|
||||
@ -78,7 +78,7 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
const getFpssOption = async (rvcd: string, rstcd: string) => {
|
||||
try {
|
||||
fpssLoading.value = true;
|
||||
const param = rvcd === 'all' ? {} : { rvcd };
|
||||
const param = rvcd === 'all' ? {} : { reachcd:rvcd };
|
||||
const res = await getFpssDropdown({...param, rstcd: rstcd});
|
||||
fpssOption.value = res.data;
|
||||
} catch (error) {
|
||||
|
||||
@ -19,7 +19,18 @@ service.interceptors.request.use(
|
||||
`Expected 'config' and 'config.headers' not to be undefined`
|
||||
);
|
||||
}
|
||||
const menuPaths = [
|
||||
'/system/menu/getMenuButtonTree',
|
||||
'/system/menu/addMenu',
|
||||
'/system/menu/updateById',
|
||||
'/system/menu/deleteById',
|
||||
'/system/menu/changeMenuOrder',
|
||||
'/system/menu/uploadIcon',
|
||||
'/system/menu/deleteIcon'
|
||||
];
|
||||
if (!menuPaths.some(p => config.url.includes(p))) {
|
||||
config.headers.tenant_id = '4';
|
||||
}
|
||||
const user = useUserStoreHook();
|
||||
if (user.Token) {
|
||||
config.headers.token = getToken();
|
||||
|
||||
@ -47,7 +47,7 @@ const basicSearchRef = ref<any>();
|
||||
const btnLoading = ref<boolean>(false);
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: 'all',
|
||||
reachcd: 'all',
|
||||
stcd: null,
|
||||
reportMonth: dayjs().subtract(1, 'month').format('YYYY-MM')
|
||||
};
|
||||
@ -57,7 +57,7 @@ const searchData = ref<any>({ ...initSearchData });
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: 'waterStation',
|
||||
name: 'rvcd',
|
||||
name: 'reachcd',
|
||||
label: '流域',
|
||||
fieldProps: {
|
||||
allowClear: true
|
||||
@ -86,7 +86,7 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
||||
searchData.value = { ...searchData.value, ...allValues };
|
||||
if (
|
||||
Object.keys(changedValues)[0] == 'rstcd' ||
|
||||
Object.keys(changedValues)[0] == 'rvcd'
|
||||
Object.keys(changedValues)[0] == 'reachcd'
|
||||
) {
|
||||
const formInstance = basicSearchRef.value?.formData;
|
||||
formInstance.stcd = null;
|
||||
|
||||
@ -353,11 +353,11 @@ const handleDetailSearchFinish = (values: any) => {
|
||||
dataType: 'date',
|
||||
value: values.strdt[1] + ' 23:59:59'
|
||||
},
|
||||
values.rvcd !== 'all' && {
|
||||
values.reachcd !== 'all' && {
|
||||
field: 'basinCode',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
value: values.reachcd
|
||||
},
|
||||
values.rstcd && {
|
||||
field: 'stationCode',
|
||||
|
||||
@ -35,7 +35,7 @@ const localTypeDate = ref<string>(null);
|
||||
const basicSearchRef = ref<any>();
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: "all",
|
||||
reachcd: "all",
|
||||
stcd: null,
|
||||
rstcd: null,
|
||||
ftp: null,
|
||||
@ -52,7 +52,7 @@ const searchData = ref<any>({ ...initSearchData });
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: "waterStation",
|
||||
name: "rvcd",
|
||||
name: "reachcd",
|
||||
label: "流域",
|
||||
fieldProps: {
|
||||
allowClear: true,
|
||||
@ -121,7 +121,7 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
||||
if (
|
||||
Object.keys(changedValues)[0] == "rstcd" ||
|
||||
Object.keys(changedValues)[0] == "baseId" ||
|
||||
Object.keys(changedValues)[0] == "rvcd"
|
||||
Object.keys(changedValues)[0] == "reachcd"
|
||||
) {
|
||||
const formInstance = basicSearchRef.value?.formData;
|
||||
formInstance.stcd = null;
|
||||
|
||||
@ -315,11 +315,11 @@ const handleSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
},
|
||||
values.rvcd !== 'all' && {
|
||||
values.reachcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
value: values.reachcd
|
||||
}
|
||||
].filter(Boolean);
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="流域" name="rvcd">
|
||||
<a-form-item label="流域" name="reachcd">
|
||||
<a-select
|
||||
v-model:value="formData.rvcd"
|
||||
v-model:value="formData.reachcd"
|
||||
:loading="hbrvcdLoading"
|
||||
placeholder="请选择流域"
|
||||
:disabled="isView"
|
||||
@ -67,7 +67,7 @@
|
||||
v-model:value="formData.rstcd"
|
||||
:loading="engLoading"
|
||||
placeholder="请选择电站名称"
|
||||
:disabled="isView || !formData.rvcd"
|
||||
:disabled="isView || !formData.reachcd"
|
||||
show-search
|
||||
allowClear
|
||||
:filter-option="filterOption"
|
||||
@ -395,16 +395,16 @@ const getHbrvcdDropdownSelect = async () => {
|
||||
// await getEngInfoDropdownSelect(baseId);
|
||||
// await getFpssDropdownSelect(formData.rstcd, baseId);
|
||||
// };
|
||||
const hbrvcdChange = async (rvcd: string) => {
|
||||
const hbrvcdChange = async (reachcd: string) => {
|
||||
formData.rstcd = undefined;
|
||||
formData.stcd = undefined;
|
||||
await getEngInfoDropdownSelect(rvcd);
|
||||
await getEngInfoDropdownSelect(reachcd);
|
||||
// await getFpssDropdownSelect(formData.rstcd, rvcd);
|
||||
};
|
||||
const getEngInfoDropdownSelect = async (rvcd: string) => {
|
||||
const getEngInfoDropdownSelect = async (reachcd: string) => {
|
||||
try {
|
||||
engLoading.value = true;
|
||||
const res = await getEngInfoDropdown({ rvcd });
|
||||
const res = await getEngInfoDropdown({ reachcd });
|
||||
engOption.value = res.data;
|
||||
} catch (error) {
|
||||
console.error('获取电站列表失败', error);
|
||||
@ -414,12 +414,12 @@ const getEngInfoDropdownSelect = async (rvcd: string) => {
|
||||
};
|
||||
const engChange = async (rstcd: string) => {
|
||||
formData.stcd = undefined;
|
||||
await getFpssDropdownSelect(rstcd, formData.rvcd);
|
||||
await getFpssDropdownSelect(rstcd, formData.reachcd);
|
||||
};
|
||||
const getFpssDropdownSelect = async (rstcd: string, rvcd: string) => {
|
||||
const getFpssDropdownSelect = async (rstcd: string, reachcd: string) => {
|
||||
try {
|
||||
fpssLoading.value = true;
|
||||
const res = await getFpssDropdown({ rstcd, rvcd });
|
||||
const res = await getFpssDropdown({ rstcd, reachcd });
|
||||
fpssOption.value = res.data;
|
||||
} catch (error) {
|
||||
console.error('获取流量列表失败', error);
|
||||
@ -454,7 +454,7 @@ const weightError = ref<string>('');
|
||||
// 表单数据模型
|
||||
const defaultFormData = reactive({
|
||||
id: undefined,
|
||||
rvcd: undefined,
|
||||
reachcd: undefined,
|
||||
stcd: undefined,
|
||||
rstcd: undefined,
|
||||
strdt: undefined,
|
||||
@ -479,7 +479,7 @@ const filterOption = (inputValue: string, option: any) => {
|
||||
};
|
||||
// 验证规则
|
||||
const rules: Record<string, Rule[]> = {
|
||||
rvcd: [{ required: true, message: '请选择流域', trigger: 'change' }],
|
||||
reachcd: [{ required: true, message: '请选择流域', trigger: 'change' }],
|
||||
rstcd: [{ required: true, message: '请选择电站', trigger: 'change' }],
|
||||
stcd: [{ required: true, message: '请选择过鱼设施', trigger: 'change' }],
|
||||
strdt: [{ required: true, message: '请选择过鱼时间', trigger: 'change' }],
|
||||
@ -858,8 +858,8 @@ watch(
|
||||
// 弹窗打开时,初始化数据
|
||||
// getBaseDropdownSelect();// 基地
|
||||
getHbrvcdDropdownSelect(); // 流域
|
||||
getEngInfoDropdownSelect(formData.rvcd);
|
||||
getFpssDropdownSelect(formData.rstcd, formData.rvcd);
|
||||
getEngInfoDropdownSelect(formData.reachcd);
|
||||
getFpssDropdownSelect(formData.rstcd, formData.reachcd);
|
||||
initForm();
|
||||
}
|
||||
},
|
||||
|
||||
@ -133,7 +133,7 @@ const localTypeDate = ref<string>(null);
|
||||
const basicSearchRef = ref<any>();
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: "all",
|
||||
reachcd: "all",
|
||||
// baseId: "all",
|
||||
stcd: null,
|
||||
rstcd: null,
|
||||
@ -150,7 +150,7 @@ const searchData = ref<any>({ ...initSearchData });
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: "waterStation",
|
||||
name: "rvcd",
|
||||
name: "reachcd",
|
||||
label: "流域",
|
||||
fieldProps: {
|
||||
allowClear: true
|
||||
@ -222,7 +222,7 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
||||
if (
|
||||
Object.keys(changedValues)[0] == "rstcd" ||
|
||||
Object.keys(changedValues)[0] == "baseId" ||
|
||||
Object.keys(changedValues)[0] == "rvcd"
|
||||
Object.keys(changedValues)[0] == "reachcd"
|
||||
) {
|
||||
const formInstance = basicSearchRef.value?.formData;
|
||||
formInstance.stcd = null;
|
||||
|
||||
@ -885,12 +885,18 @@ const handleSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
},
|
||||
values.rvcd !== 'all' && {
|
||||
values.reachcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
}
|
||||
value: values.reachcd
|
||||
},
|
||||
// values.rvcd !== 'all' && {
|
||||
// field: 'reachcd',
|
||||
// operator: 'eq',
|
||||
// dataType: 'string',
|
||||
// value: values.reachcd
|
||||
// }
|
||||
// values.baseId !== "all" && {
|
||||
// field: "baseId",
|
||||
// operator: "eq",
|
||||
|
||||
@ -30,7 +30,7 @@ const localTypeDate = ref<string>(null);
|
||||
const basicSearchRef = ref<any>();
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: 'all',
|
||||
reachcd: 'all',
|
||||
stcd: null,
|
||||
rstcd: null
|
||||
// strdt: [
|
||||
@ -44,7 +44,7 @@ const searchData = ref<any>({ ...initSearchData });
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: 'waterStation',
|
||||
name: 'rvcd',
|
||||
name: 'reachcd',
|
||||
label: '流域',
|
||||
fieldProps: {
|
||||
allowClear: true
|
||||
@ -74,7 +74,7 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
||||
searchData.value = { ...searchData.value, ...allValues };
|
||||
if (
|
||||
Object.keys(changedValues)[0] == 'rstcd' ||
|
||||
Object.keys(changedValues)[0] == 'rvcd'
|
||||
Object.keys(changedValues)[0] == 'reachcd'
|
||||
) {
|
||||
const formInstance = basicSearchRef.value?.formData;
|
||||
formInstance.stcd = null;
|
||||
|
||||
@ -361,11 +361,11 @@ const handleSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.status
|
||||
},
|
||||
values.rvcd !== 'all' && {
|
||||
values.reachcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
value: values.reachcd
|
||||
},
|
||||
values.stcd && {
|
||||
field: 'stcd',
|
||||
@ -605,11 +605,11 @@ const handleDetailSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
},
|
||||
values.rvcd !== 'all' && {
|
||||
values.reachcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
value: values.reachcd
|
||||
},
|
||||
approvalId.value && {
|
||||
field: 'approvalId', // 字段名
|
||||
|
||||
@ -61,7 +61,7 @@ const emit = defineEmits<{
|
||||
|
||||
// 模拟 initSearchData
|
||||
const initSearchData = {
|
||||
rvcd: "all",
|
||||
reachcd: "all",
|
||||
stcd: "",
|
||||
status: "",
|
||||
};
|
||||
@ -71,7 +71,7 @@ const searchData = ref<any>({ ...initSearchData });
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: "waterStation",
|
||||
name: "rvcd",
|
||||
name: "reachcd",
|
||||
label: "流域",
|
||||
fieldProps: {
|
||||
allowClear: true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElForm, ElMessageBox, ElMessage } from "element-plus";
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ElForm, ElMessageBox, ElMessage } from 'element-plus';
|
||||
import {
|
||||
getdata,
|
||||
addmenu,
|
||||
@ -8,20 +8,20 @@ import {
|
||||
deltmenu,
|
||||
moveOrderno,
|
||||
uploadIcon,
|
||||
moveIcon,
|
||||
} from "@/api/menu";
|
||||
import Sortable from "sortablejs";
|
||||
moveIcon
|
||||
} from '@/api/menu';
|
||||
import Sortable from 'sortablejs';
|
||||
//定义表格数据
|
||||
const url = import.meta.env.VITE_APP_BASE_API;
|
||||
const tableData: any = ref([]);
|
||||
function gteTabledata() {
|
||||
const params = {
|
||||
systemcode: systemcode.value,
|
||||
name: "",
|
||||
name: ''
|
||||
};
|
||||
loading.value = true;
|
||||
getdata(params)
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
tableData.value = res;
|
||||
loading.value = false;
|
||||
})
|
||||
@ -34,56 +34,54 @@ const menuInfoRef = ref();
|
||||
const btnInfoRef = ref();
|
||||
const loading = ref(false);
|
||||
//定义tabbar
|
||||
const systemcode = ref("4");
|
||||
const activeIndex = ref("4");
|
||||
const systemcode = ref('1');
|
||||
const activeIndex = ref('1');
|
||||
function handleSelect(key: string) {
|
||||
if (key == "1") {
|
||||
systemcode.value = "1";
|
||||
} else if (key == "2") {
|
||||
systemcode.value = "2";
|
||||
} else if (key == "3") {
|
||||
systemcode.value = "3";
|
||||
} else if (key == "4") {
|
||||
systemcode.value = "4";
|
||||
if (key == '1') {
|
||||
systemcode.value = '1';
|
||||
} else if (key == '2') {
|
||||
systemcode.value = '2';
|
||||
} else if (key == '4') {
|
||||
systemcode.value = '4';
|
||||
}
|
||||
gteTabledata();
|
||||
}
|
||||
//定义搜索框文本
|
||||
const menuname = ref("");
|
||||
const menuname = ref('');
|
||||
//点击搜索
|
||||
function search() {
|
||||
menuname.value = menuname.value.replace(/\s+/g, "");
|
||||
menuname.value = menuname.value.replace(/\s+/g, '');
|
||||
let params = {
|
||||
systemcode: systemcode.value,
|
||||
name: menuname.value,
|
||||
isdisplay: "",
|
||||
isdisplay: ''
|
||||
};
|
||||
getdata(params).then((res) => {
|
||||
getdata(params).then(res => {
|
||||
tableData.value = res;
|
||||
});
|
||||
}
|
||||
//目录添加
|
||||
const title = ref("");
|
||||
const title = ref('');
|
||||
const expertInfo: any = ref({
|
||||
name: "",
|
||||
type: "0",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
name: '',
|
||||
type: '0',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
isdisplay: true,
|
||||
systemcode: "",
|
||||
icon: "",
|
||||
code: "",
|
||||
systemcode: '',
|
||||
icon: '',
|
||||
code: ''
|
||||
});
|
||||
const dialogVisible = ref(false);
|
||||
function addClick() {
|
||||
title.value = "新增目录";
|
||||
title.value = '新增目录';
|
||||
const orgnamemage = ref({
|
||||
name: "",
|
||||
type: "3",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
name: '',
|
||||
type: '3',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
orderno: 1,
|
||||
isdisplay: "1",
|
||||
isdisplay: '1'
|
||||
});
|
||||
expertInfo.value = orgnamemage.value;
|
||||
dialogVisible.value = true;
|
||||
@ -99,35 +97,37 @@ function handleClose() {
|
||||
}
|
||||
//表格规则定义
|
||||
const rules = ref({
|
||||
name: [{ required: true, message: "请输入目录名称", trigger: "blur" }],
|
||||
opturl: [{ required: true, message: "请输入操作URL", trigger: "blur" }],
|
||||
permission: [{ required: true, message: "请输入目录权限标识", trigger: "blur" }],
|
||||
name: [{ required: true, message: '请输入目录名称', trigger: 'blur' }],
|
||||
opturl: [{ required: true, message: '请输入操作URL', trigger: 'blur' }],
|
||||
permission: [
|
||||
{ required: true, message: '请输入目录权限标识', trigger: 'blur' }
|
||||
]
|
||||
});
|
||||
//添加子目录
|
||||
const parentID = ref("");
|
||||
const parentID = ref('');
|
||||
function addchilder(row: any) {
|
||||
title.value = "新增子目录";
|
||||
title.value = '新增子目录';
|
||||
|
||||
const orgnamemage = ref({
|
||||
name: "",
|
||||
type: "3",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
name: '',
|
||||
type: '3',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
orderno: 1,
|
||||
isdisplay: "1",
|
||||
isdisplay: '1'
|
||||
});
|
||||
parentID.value = row.id;
|
||||
expertInfo.value = orgnamemage.value;
|
||||
dialogVisible.value = true;
|
||||
iconall.value = "";
|
||||
iconall.value = '';
|
||||
getid.value = row.id;
|
||||
}
|
||||
//新增目录-确认按钮
|
||||
function expertsubmit() {
|
||||
if (expertInfo.value.name == "") {
|
||||
if (expertInfo.value.name == '') {
|
||||
ElMessage({
|
||||
message: "请填写目录名称",
|
||||
type: "error",
|
||||
message: '请填写目录名称',
|
||||
type: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@ -135,116 +135,120 @@ function expertsubmit() {
|
||||
let params = {
|
||||
name: expertInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "0",
|
||||
parentid: "0",
|
||||
type: '0',
|
||||
parentid: '0',
|
||||
id: expertInfo.value.id,
|
||||
icon: iconall.value,
|
||||
opturl: expertInfo.value.opturl,
|
||||
isdisplay: expertInfo.value.isdisplay,
|
||||
isdisplay: expertInfo.value.isdisplay
|
||||
};
|
||||
editmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
} else if (title.value == "新增子目录") {
|
||||
} else if (title.value == '新增子目录') {
|
||||
let params = {
|
||||
name: expertInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "0",
|
||||
type: '0',
|
||||
opturl: expertInfo.value.opturl,
|
||||
isdisplay: expertInfo.value.isdisplay,
|
||||
parentid: parentID.value,
|
||||
icon: iconall.value,
|
||||
icon: iconall.value
|
||||
};
|
||||
addmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
message: "新建成功",
|
||||
type: "success",
|
||||
message: '新建成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
name: expertInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "0",
|
||||
type: '0',
|
||||
opturl: expertInfo.value.opturl,
|
||||
isdisplay: expertInfo.value.isdisplay,
|
||||
parentid: "0",
|
||||
parentid: '0',
|
||||
id: expertInfo.value.id,
|
||||
icon: iconall.value,
|
||||
icon: iconall.value
|
||||
};
|
||||
addmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
message: "新建成功",
|
||||
type: "success",
|
||||
message: '新建成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
//菜单目录
|
||||
const menurules = ref({
|
||||
name: [{ required: true, message: "请输入菜单名称", trigger: "blur" }],
|
||||
opturl: [{ required: true, message: "请输入操作URL", trigger: "blur" }],
|
||||
permission: [{ required: true, message: "请输入菜单权限标识", trigger: "blur" }],
|
||||
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
|
||||
opturl: [{ required: true, message: '请输入操作URL', trigger: 'blur' }],
|
||||
permission: [
|
||||
{ required: true, message: '请输入菜单权限标识', trigger: 'blur' }
|
||||
]
|
||||
});
|
||||
const menuVisible = ref(false);
|
||||
const menutitle = ref("");
|
||||
const menutitle = ref('');
|
||||
//定义按钮弹窗数据
|
||||
const btnInfo: any = ref({
|
||||
name: " ",
|
||||
orderno: " ",
|
||||
islink: " ",
|
||||
opturl: " ",
|
||||
permission: " ",
|
||||
isdisplay: " ",
|
||||
icon: "",
|
||||
name: ' ',
|
||||
orderno: ' ',
|
||||
islink: ' ',
|
||||
opturl: ' ',
|
||||
permission: ' ',
|
||||
isdisplay: ' ',
|
||||
icon: ''
|
||||
});
|
||||
const btnVisible = ref(false);
|
||||
const btnrules = ref({
|
||||
name: [{ required: true, message: "请输入按钮名称", trigger: "blur" }],
|
||||
permission: [{ required: true, message: "请输入按钮权限标识", trigger: "blur" }],
|
||||
name: [{ required: true, message: '请输入按钮名称', trigger: 'blur' }],
|
||||
permission: [
|
||||
{ required: true, message: '请输入按钮权限标识', trigger: 'blur' }
|
||||
]
|
||||
});
|
||||
//定义菜单弹窗数据
|
||||
const menuInfo: any = ref({
|
||||
name: "",
|
||||
orderno: "",
|
||||
islink: "",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
isdisplay: "",
|
||||
icon: "",
|
||||
name: '',
|
||||
orderno: '',
|
||||
islink: '',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
isdisplay: '',
|
||||
icon: ''
|
||||
});
|
||||
//修改目录
|
||||
const btntitle = ref("");
|
||||
const getid = ref("");
|
||||
const allId = ref("");
|
||||
const btntitle = ref('');
|
||||
const getid = ref('');
|
||||
const allId = ref('');
|
||||
function handleEdit(row: any) {
|
||||
iconall.value = row.icon;
|
||||
const Row = JSON.parse(JSON.stringify(row));
|
||||
getid.value = row.id;
|
||||
btnparentid.value = row.parentid;
|
||||
if (row.type == "2") {
|
||||
btntitle.value = "修改按钮";
|
||||
if (row.type == '2') {
|
||||
btntitle.value = '修改按钮';
|
||||
let newInfo = ref({});
|
||||
newInfo.value = Row;
|
||||
btnInfo.value = newInfo.value;
|
||||
btnVisible.value = true;
|
||||
} else if (row.type == "1") {
|
||||
menutitle.value = "修改菜单";
|
||||
} else if (row.type == '1') {
|
||||
menutitle.value = '修改菜单';
|
||||
let newInfo = ref({});
|
||||
newInfo.value = Row;
|
||||
menuInfo.value = newInfo.value;
|
||||
menuVisible.value = true;
|
||||
} else {
|
||||
title.value = "修改目录";
|
||||
title.value = '修改目录';
|
||||
let newInfo = ref({});
|
||||
newInfo.value = Row;
|
||||
expertInfo.value = newInfo.value;
|
||||
@ -252,39 +256,39 @@ function handleEdit(row: any) {
|
||||
}
|
||||
}
|
||||
//新增菜单
|
||||
const btnparentid = ref("");
|
||||
const btnparentid = ref('');
|
||||
function menuclick(row: any) {
|
||||
if (row.id == undefined) {
|
||||
btnparentid.value = "0";
|
||||
btnparentid.value = '0';
|
||||
} else {
|
||||
btnparentid.value = row.id;
|
||||
}
|
||||
menutitle.value = "添加菜单";
|
||||
menutitle.value = '添加菜单';
|
||||
(menuInfo.value = {
|
||||
name: "",
|
||||
type: "1",
|
||||
islink: "0",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
name: '',
|
||||
type: '1',
|
||||
islink: '0',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
orderno: 1,
|
||||
isdisplay: "1",
|
||||
isdisplay: '1'
|
||||
}),
|
||||
(menuVisible.value = true);
|
||||
iconall.value = "";
|
||||
iconall.value = '';
|
||||
getid.value = row.id;
|
||||
}
|
||||
//添加按钮
|
||||
function btnclick(row: any) {
|
||||
getid.value = row.id;
|
||||
btntitle.value = "添加按钮";
|
||||
btntitle.value = '添加按钮';
|
||||
(btnInfo.value = {
|
||||
name: "",
|
||||
type: "2",
|
||||
islink: "0",
|
||||
opturl: "",
|
||||
permission: "",
|
||||
name: '',
|
||||
type: '2',
|
||||
islink: '0',
|
||||
opturl: '',
|
||||
permission: '',
|
||||
orderno: 1,
|
||||
isdisplay: "1",
|
||||
isdisplay: '1'
|
||||
}),
|
||||
(btnVisible.value = true);
|
||||
btnparentid.value = row.id;
|
||||
@ -292,36 +296,36 @@ function btnclick(row: any) {
|
||||
//删除
|
||||
function handleDelete(row: any) {
|
||||
const message = ref();
|
||||
if (row.type == "0") {
|
||||
message.value = "确定删除此目录及此目录下的所有菜单吗?";
|
||||
} else if (row.type == "1") {
|
||||
message.value = "确定删除此菜单及此菜单下的所有按钮吗?";
|
||||
} else if (row.type == "2") {
|
||||
message.value = "确定删除此按钮吗?";
|
||||
if (row.type == '0') {
|
||||
message.value = '确定删除此目录及此目录下的所有菜单吗?';
|
||||
} else if (row.type == '1') {
|
||||
message.value = '确定删除此菜单及此菜单下的所有按钮吗?';
|
||||
} else if (row.type == '2') {
|
||||
message.value = '确定删除此按钮吗?';
|
||||
}
|
||||
ElMessageBox.confirm(message.value, "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm(message.value, '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
id: row.id,
|
||||
id: row.id
|
||||
};
|
||||
deltmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
ElMessage({
|
||||
message: "删除成功",
|
||||
type: "success",
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//菜单目录-确定
|
||||
function menusubmit() {
|
||||
if (menuInfo.value.name == "") {
|
||||
if (menuInfo.value.name == '') {
|
||||
ElMessage({
|
||||
message: "请填写菜单名称",
|
||||
type: "error",
|
||||
message: '请填写菜单名称',
|
||||
type: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@ -329,41 +333,41 @@ function menusubmit() {
|
||||
let params = {
|
||||
name: menuInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "1",
|
||||
type: '1',
|
||||
opturl: menuInfo.value.opturl,
|
||||
permission: menuInfo.value.permission,
|
||||
islink: menuInfo.value.islink,
|
||||
isdisplay: menuInfo.value.isdisplay,
|
||||
// parentid: '',
|
||||
id: getid.value,
|
||||
icon: iconall.value,
|
||||
icon: iconall.value
|
||||
};
|
||||
editmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
menuVisible.value = false;
|
||||
ElMessage({
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
name: menuInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "1",
|
||||
type: '1',
|
||||
opturl: menuInfo.value.opturl,
|
||||
islink: menuInfo.value.islink,
|
||||
isdisplay: menuInfo.value.isdisplay,
|
||||
parentid: btnparentid.value,
|
||||
id: expertInfo.value.id,
|
||||
icon: iconall.value,
|
||||
icon: iconall.value
|
||||
};
|
||||
addmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
menuVisible.value = false;
|
||||
ElMessage({
|
||||
message: "新建成功",
|
||||
type: "success",
|
||||
message: '新建成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -371,10 +375,10 @@ function menusubmit() {
|
||||
//按钮目录-确定
|
||||
|
||||
function btnsubmit() {
|
||||
if (btnInfo.value.name == "" || btnInfo.value.permission == "") {
|
||||
if (btnInfo.value.name == '' || btnInfo.value.permission == '') {
|
||||
ElMessage({
|
||||
message: "请填写按钮名称和权限标识",
|
||||
type: "error",
|
||||
message: '请填写按钮名称和权限标识',
|
||||
type: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@ -383,19 +387,19 @@ function btnsubmit() {
|
||||
code: btnInfo.value.code,
|
||||
name: btnInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "2",
|
||||
type: '2',
|
||||
opturl: btnInfo.value.opturl,
|
||||
permission: btnInfo.value.permission,
|
||||
islink: btnInfo.value.islink,
|
||||
// isdisplay: btnInfo.value.isdisplay,
|
||||
id: getid.value,
|
||||
id: getid.value
|
||||
};
|
||||
editmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
message: "修改成功",
|
||||
type: "success",
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
btnVisible.value = false;
|
||||
});
|
||||
@ -403,19 +407,19 @@ function btnsubmit() {
|
||||
let params = {
|
||||
name: btnInfo.value.name,
|
||||
systemcode: systemcode.value,
|
||||
type: "2",
|
||||
type: '2',
|
||||
opturl: btnInfo.value.opturl,
|
||||
permission: btnInfo.value.permission,
|
||||
islink: btnInfo.value.islink,
|
||||
isdisplay: btnInfo.value.isdisplay,
|
||||
parentid: btnparentid.value,
|
||||
parentid: btnparentid.value
|
||||
};
|
||||
addmenu(params).then(() => {
|
||||
gteTabledata();
|
||||
dialogVisible.value = false;
|
||||
ElMessage({
|
||||
message: "新建成功",
|
||||
type: "success",
|
||||
message: '新建成功',
|
||||
type: 'success'
|
||||
});
|
||||
btnVisible.value = false;
|
||||
});
|
||||
@ -427,70 +431,88 @@ function dateFormat(row: any) {
|
||||
var date = new Date(daterc);
|
||||
var year = date.getFullYear();
|
||||
var month =
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||
var minutes =
|
||||
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||
var seconds =
|
||||
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
return (
|
||||
year +
|
||||
'-' +
|
||||
month +
|
||||
'-' +
|
||||
day +
|
||||
' ' +
|
||||
hours +
|
||||
':' +
|
||||
minutes +
|
||||
':' +
|
||||
seconds
|
||||
);
|
||||
}
|
||||
}
|
||||
//上传图标
|
||||
function fileClick(val: any) {
|
||||
allId.value = val;
|
||||
const avatar = document.getElementById("avatar");
|
||||
const avatar = document.getElementById('avatar');
|
||||
avatar?.click();
|
||||
}
|
||||
const iconall = ref("");
|
||||
const iconall = ref('');
|
||||
function changeFile(e: any) {
|
||||
const files = new FormData();
|
||||
files.append("icon", e.target.files[0]);
|
||||
files.append("menuId", allId.value);
|
||||
files.append('icon', e.target.files[0]);
|
||||
files.append('menuId', allId.value);
|
||||
uploadIcon(files)
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
iconall.value = res.data;
|
||||
gteTabledata();
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "上传成功",
|
||||
type: 'success',
|
||||
message: '上传成功'
|
||||
});
|
||||
// location.reload()
|
||||
var file: any = document.getElementById("avatar");
|
||||
file.value = "";
|
||||
var file: any = document.getElementById('avatar');
|
||||
file.value = '';
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "上传失败",
|
||||
type: 'error',
|
||||
message: '上传失败'
|
||||
});
|
||||
var file: any = document.getElementById("avatar");
|
||||
file.value = "";
|
||||
var file: any = document.getElementById('avatar');
|
||||
file.value = '';
|
||||
});
|
||||
}
|
||||
//图标删除事件
|
||||
function delectIcon(id: any) {
|
||||
ElMessageBox.confirm("确定删除此图标吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定删除此图标吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
id: id,
|
||||
id: id
|
||||
};
|
||||
moveIcon(params).then(() => {
|
||||
iconall.value = "";
|
||||
iconall.value = '';
|
||||
gteTabledata();
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "删除成功",
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
// Icon选择器显示状态
|
||||
function treeToTile(treeData: any, childKey = "children") {
|
||||
function treeToTile(treeData: any, childKey = 'children') {
|
||||
const arr = [] as any[];
|
||||
const expanded = (data: any) => {
|
||||
if (data && data.length > 0) {
|
||||
@ -507,9 +529,11 @@ function treeToTile(treeData: any, childKey = "children") {
|
||||
}
|
||||
const activeRows: any = ref([]);
|
||||
function rowDrop() {
|
||||
const tbody = document.querySelector(".draggable .el-table__body-wrapper tbody");
|
||||
const tbody = document.querySelector(
|
||||
'.draggable .el-table__body-wrapper tbody'
|
||||
);
|
||||
Sortable.create(tbody, {
|
||||
draggable: ".draggable .el-table__row",
|
||||
draggable: '.draggable .el-table__row',
|
||||
onMove: () => {
|
||||
activeRows.value = treeToTile(tableData.value); // 把树形的结构转为列表再进行拖拽
|
||||
},
|
||||
@ -519,8 +543,8 @@ function rowDrop() {
|
||||
|
||||
if (oldRow.type != newRow.type) {
|
||||
ElMessage({
|
||||
message: "拖拽同级目录排序",
|
||||
type: "warning",
|
||||
message: '拖拽同级目录排序',
|
||||
type: 'warning'
|
||||
});
|
||||
tableData.value = [];
|
||||
gteTabledata();
|
||||
@ -528,22 +552,22 @@ function rowDrop() {
|
||||
}
|
||||
const params = {
|
||||
fromId: oldRow.id,
|
||||
toId: newRow.id,
|
||||
toId: newRow.id
|
||||
};
|
||||
moveOrderno(params).then((res: any) => {
|
||||
if (res.code == 1) {
|
||||
tableData.value = [];
|
||||
gteTabledata();
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "修改失败",
|
||||
type: 'error',
|
||||
message: '修改失败'
|
||||
});
|
||||
} else {
|
||||
tableData.value = [];
|
||||
gteTabledata();
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
@ -561,10 +585,9 @@ onMounted(() => {
|
||||
mode="horizontal"
|
||||
@select="handleSelect"
|
||||
>
|
||||
<!-- <el-menu-item index="1">Web端</el-menu-item>
|
||||
<el-menu-item index="2">手机App</el-menu-item>
|
||||
<el-menu-item index="3">Pad端</el-menu-item> -->
|
||||
<el-menu-item index="4">数据填报</el-menu-item>
|
||||
<el-menu-item index="1">水电水利建设项目全过程环境管理信息平台</el-menu-item>
|
||||
<el-menu-item index="2">全过程数据管理子系统</el-menu-item>
|
||||
<el-menu-item index="4">填报管理子系统</el-menu-item>
|
||||
</el-menu>
|
||||
<div
|
||||
style="
|
||||
@ -615,10 +638,15 @@ onMounted(() => {
|
||||
:header-cell-style="{
|
||||
background: 'rgb(250 250 250)',
|
||||
color: '#383838',
|
||||
height: '50px',
|
||||
height: '50px'
|
||||
}"
|
||||
>
|
||||
<el-table-column label="菜单标题" width="250" prop="name" show-overflow-tooltip>
|
||||
<el-table-column
|
||||
label="菜单标题"
|
||||
width="250"
|
||||
prop="name"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope">
|
||||
<div style="position: absolute; left: 15px">
|
||||
<img src="@/assets/MenuIcon/lbcz_td.png" alt="" />
|
||||
@ -626,7 +654,12 @@ onMounted(() => {
|
||||
<div style="margin-left: 20px">{{ scope.row.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="菜单类型" width="100" align="center" prop="type">
|
||||
<el-table-column
|
||||
label="菜单类型"
|
||||
width="100"
|
||||
align="center"
|
||||
prop="type"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.type == '2'">按钮</span>
|
||||
<span v-else-if="scope.row.type == '1'">菜单</span>
|
||||
@ -639,12 +672,16 @@ onMounted(() => {
|
||||
width="100"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="系统类型" width="120" prop="systemcode" align="center">
|
||||
<el-table-column
|
||||
label="系统类型"
|
||||
width="170"
|
||||
prop="systemcode"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.systemcode == '1'">Web端</span>
|
||||
<span v-else-if="scope.row.systemcode == '2'">手机App</span>
|
||||
<span v-else-if="scope.row.systemcode == '3'">Pad端</span>
|
||||
<span v-else-if="scope.row.systemcode == '4'">数据填报</span>
|
||||
<span v-if="scope.row.systemcode == '1'">水电水利建设项目全过程环境管理信息平台</span>
|
||||
<span v-else-if="scope.row.systemcode == '2'">全过程数据管理子系统</span>
|
||||
<span v-else>填报管理子系统</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="图标" width="100" prop="icon" align="center">
|
||||
@ -706,15 +743,21 @@ onMounted(() => {
|
||||
@change="changeFile"
|
||||
/>
|
||||
</div>
|
||||
<img :src="url + '/menu/' + scope.row.icon" alt="">
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="是否外链" width="100" prop="islink" align="center">
|
||||
<el-table-column
|
||||
label="是否外链"
|
||||
width="100"
|
||||
prop="islink"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.islink == '1'">是</span>
|
||||
<span v-else>否</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作URL"
|
||||
min-width="100"
|
||||
@ -732,7 +775,12 @@ onMounted(() => {
|
||||
prop="permission"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="是否显示" width="100" prop="isdisplay" align="center">
|
||||
<el-table-column
|
||||
label="是否显示"
|
||||
width="100"
|
||||
prop="isdisplay"
|
||||
align="center"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.isdisplay == '1'">是</span>
|
||||
<span v-else>否</span>
|
||||
@ -743,7 +791,11 @@ onMounted(() => {
|
||||
label="最近修改者"
|
||||
width="120"
|
||||
></el-table-column>
|
||||
<el-table-column prop="lastmodifydate" label="最近修改日期" width="170">
|
||||
<el-table-column
|
||||
prop="lastmodifydate"
|
||||
label="最近修改日期"
|
||||
width="170"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ dateFormat(scope.row.lastmodifydate) }}
|
||||
</template>
|
||||
@ -866,7 +918,12 @@ onMounted(() => {
|
||||
width="620px"
|
||||
class="dialogClass"
|
||||
>
|
||||
<el-form ref="expertInfoRef" :model="expertInfo" :rules="rules" label-width="90px">
|
||||
<el-form
|
||||
ref="expertInfoRef"
|
||||
:model="expertInfo"
|
||||
:rules="rules"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="目录编号" prop="name">
|
||||
<el-input
|
||||
v-model="expertInfo.code"
|
||||
@ -913,7 +970,12 @@ onMounted(() => {
|
||||
width="620px"
|
||||
class="dialogClass"
|
||||
>
|
||||
<el-form ref="menuInfoRef" :model="menuInfo" :rules="menurules" label-width="90px">
|
||||
<el-form
|
||||
ref="menuInfoRef"
|
||||
:model="menuInfo"
|
||||
:rules="menurules"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="菜单编号">
|
||||
<el-input
|
||||
v-model="menuInfo.code"
|
||||
@ -923,15 +985,19 @@ onMounted(() => {
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单名称" prop="name">
|
||||
<el-input v-model="menuInfo.name" placeholder="" style="width: 100%"></el-input>
|
||||
<el-input
|
||||
v-model="menuInfo.name"
|
||||
placeholder=""
|
||||
style="width: 100%"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="是否外链" prop="islink">
|
||||
<el-form-item label="是否外链" prop="islink">
|
||||
<el-radio-group v-model="menuInfo.islink">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="操作URL" prop="opturl">
|
||||
<el-input
|
||||
v-model="menuInfo.opturl"
|
||||
@ -970,7 +1036,12 @@ onMounted(() => {
|
||||
class="dialogClass"
|
||||
draggable
|
||||
>
|
||||
<el-form ref="btnInfoRef" :model="btnInfo" :rules="btnrules" label-width="90px">
|
||||
<el-form
|
||||
ref="btnInfoRef"
|
||||
:model="btnInfo"
|
||||
:rules="btnrules"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="按钮编号">
|
||||
<el-input
|
||||
v-model="btnInfo.code"
|
||||
@ -980,7 +1051,11 @@ onMounted(() => {
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="按钮名称" prop="name">
|
||||
<el-input v-model="btnInfo.name" placeholder="" style="width: 100%"></el-input>
|
||||
<el-input
|
||||
v-model="btnInfo.name"
|
||||
placeholder=""
|
||||
style="width: 100%"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权限标识" prop="permission">
|
||||
<el-input
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "record",
|
||||
name: 'record'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { getLogList, exportExcel } from "@/api/record";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
import Page from "@/components/Pagination/page.vue";
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getLogList, exportExcel } from '@/api/record';
|
||||
import { downloadFile } from '@/utils/index';
|
||||
import Page from '@/components/Pagination/page.vue';
|
||||
// import { VueDevToolsTimelineColors } from "@intlify/vue-devtools";
|
||||
|
||||
//定义表格数据
|
||||
@ -18,7 +18,7 @@ const tableData: any = ref([]);
|
||||
const queryParams = ref({
|
||||
current: 1,
|
||||
size: 20,
|
||||
opttype: "",
|
||||
opttype: ''
|
||||
});
|
||||
// 日期查询
|
||||
const operationTime: any = ref();
|
||||
@ -26,12 +26,12 @@ const operationTime: any = ref();
|
||||
const total = ref(0);
|
||||
// 日志类型
|
||||
const type: any = ref([
|
||||
{ name: "登录(login)", value: "00" },
|
||||
{ name: "添加(insert)", value: "01" },
|
||||
{ name: "修改(update)", value: "02" },
|
||||
{ name: "删除(delete)", value: "03" },
|
||||
{ name: "查询(select)", value: "04" },
|
||||
{ name: "其他(other)", value: "05" },
|
||||
{ name: '登录(login)', value: '00' },
|
||||
{ name: '添加(insert)', value: '01' },
|
||||
{ name: '修改(update)', value: '02' },
|
||||
{ name: '删除(delete)', value: '03' },
|
||||
{ name: '查询(select)', value: '04' },
|
||||
{ name: '其他(other)', value: '05' }
|
||||
]);
|
||||
// 表格加载
|
||||
const loading = ref(false);
|
||||
@ -43,8 +43,8 @@ function init() {
|
||||
optType: queryParams.value.opttype,
|
||||
current: queryParams.value.current,
|
||||
size: queryParams.value.size,
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
};
|
||||
if (operationTime.value != null) {
|
||||
params.startDate = operationTime.value[0];
|
||||
@ -71,14 +71,32 @@ function dateFormat(row: any) {
|
||||
var date = new Date(daterc);
|
||||
var year = date.getFullYear();
|
||||
var month =
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||
var minutes =
|
||||
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||
var seconds =
|
||||
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
return (
|
||||
year +
|
||||
'-' +
|
||||
month +
|
||||
'-' +
|
||||
day +
|
||||
' ' +
|
||||
hours +
|
||||
':' +
|
||||
minutes +
|
||||
':' +
|
||||
seconds
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,15 +106,15 @@ function leadingOut() {
|
||||
optType: queryParams.value.opttype,
|
||||
current: queryParams.value.current,
|
||||
size: queryParams.value.size,
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
};
|
||||
if (operationTime.value != null) {
|
||||
params.startDate = operationTime.value[0];
|
||||
params.endDate = operationTime.value[1];
|
||||
}
|
||||
exportExcel(params).then((response: any) => {
|
||||
downloadFile(response, "日志", "xlsx");
|
||||
downloadFile(response, '日志', 'xlsx');
|
||||
});
|
||||
}
|
||||
//分页
|
||||
@ -158,7 +176,9 @@ function handleClose() {
|
||||
@change="init"
|
||||
/>
|
||||
</div>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="init">搜索</el-button>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="init"
|
||||
>搜索</el-button
|
||||
>
|
||||
<div
|
||||
style="
|
||||
width: 100%;
|
||||
@ -190,17 +210,37 @@ function handleClose() {
|
||||
width="70"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="usercode" label="操作账户" width="100"></el-table-column>
|
||||
<el-table-column prop="username" label="用户姓名" width="180"></el-table-column>
|
||||
<el-table-column prop="requestip" label="IP地址" width="140"></el-table-column>
|
||||
<el-table-column prop="browser" label="浏览器" width="130"></el-table-column>
|
||||
<el-table-column
|
||||
prop="usercode"
|
||||
label="操作账户"
|
||||
width="100"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="username"
|
||||
label="用户姓名"
|
||||
width="180"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="requestip"
|
||||
label="IP地址"
|
||||
width="140"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="browser"
|
||||
label="浏览器"
|
||||
width="130"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="opttype"
|
||||
label="日志类型"
|
||||
width="130"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="module" label="模块名称" width="170"></el-table-column>
|
||||
<el-table-column
|
||||
prop="module"
|
||||
label="模块名称"
|
||||
width="170"
|
||||
></el-table-column>
|
||||
<el-table-column prop="description" label="日志描述" min-width="100">
|
||||
<template #default="scope">
|
||||
<div
|
||||
@ -248,6 +288,7 @@ function handleClose() {
|
||||
top="30px"
|
||||
draggable
|
||||
:destroy-on-close="false"
|
||||
style="pointer-events: all"
|
||||
>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
@ -262,8 +303,16 @@ function handleClose() {
|
||||
width="70"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column prop="username" label="用户姓名" width="110"></el-table-column>
|
||||
<el-table-column prop="module" label="模块名称" width="120"></el-table-column>
|
||||
<el-table-column
|
||||
prop="username"
|
||||
label="用户姓名"
|
||||
width="110"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="module"
|
||||
label="模块名称"
|
||||
width="120"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="description"
|
||||
label="日志描述"
|
||||
|
||||
@ -9,7 +9,7 @@ import { ref, onMounted, nextTick, watch } from "vue";
|
||||
import {
|
||||
queryPendingAuditUsers,
|
||||
deltableData,
|
||||
getRole,
|
||||
listGroupedByTenant,
|
||||
addUsers,
|
||||
updataUser,
|
||||
setpass,
|
||||
@ -660,7 +660,7 @@ function getrole() {
|
||||
const params = {
|
||||
rolename: "",
|
||||
};
|
||||
getRole(params).then((res) => {
|
||||
listGroupedByTenant(params).then((res) => {
|
||||
rolesdata.value = res;
|
||||
});
|
||||
}
|
||||
@ -1203,13 +1203,25 @@ function handleClearSelection() {
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属角色">
|
||||
<el-select v-model="info.roleinfo" placeholder=" " style="width: 100%" multiple>
|
||||
<el-select
|
||||
v-model="info.roleinfo"
|
||||
placeholder=" "
|
||||
style="width: 100%"
|
||||
multiple
|
||||
filterable
|
||||
>
|
||||
<el-option-group
|
||||
v-for="group in rolesdata"
|
||||
:key="group.tenantName"
|
||||
:label="group.tenantName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rolesdata"
|
||||
v-for="item in group.roles"
|
||||
:key="item.id"
|
||||
:label="item.rolename"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -1526,4 +1538,7 @@ function handleClearSelection() {
|
||||
.el-message-box {
|
||||
width: 300px !important;
|
||||
}
|
||||
:deep(.el-select-group__title){
|
||||
font-size: 16px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "role",
|
||||
name: 'role'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, nextTick } from "vue";
|
||||
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
|
||||
import { onMounted, ref, nextTick } from 'vue';
|
||||
import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
|
||||
import {
|
||||
listRolePages,
|
||||
isvaildTo,
|
||||
addDept,
|
||||
renewDept,
|
||||
deleDept,
|
||||
assignmentPer,
|
||||
permissionAssignmentGrouped,
|
||||
setMenuById,
|
||||
setOrgscope,
|
||||
postOrgscope,
|
||||
} from "@/api/role";
|
||||
postOrgscope
|
||||
} from '@/api/role';
|
||||
import { getDictItemsByCode } from '@/api/dict';
|
||||
//定义表格数据
|
||||
const tableData: any = ref([]);
|
||||
const multipleSelection = ref([]);
|
||||
@ -29,10 +30,11 @@ const loading = ref(false);
|
||||
function gettableData() {
|
||||
let params = {
|
||||
rolename: input.value,
|
||||
tenantId:tenValue.value,
|
||||
};
|
||||
loading.value = true;
|
||||
listRolePages(params)
|
||||
.then((result) => {
|
||||
.then(result => {
|
||||
tableData.value = result;
|
||||
loading.value = false;
|
||||
})
|
||||
@ -46,26 +48,26 @@ function handleSelectionChange(val: any) {
|
||||
}
|
||||
function switchChange(row: any) {
|
||||
const elMessage = ref();
|
||||
if (row.isvaild == "0") {
|
||||
elMessage.value = "确定设置该角色为无效吗?";
|
||||
} else if (row.isvaild == "1") {
|
||||
elMessage.value = "确定设置该角色为有效吗?";
|
||||
if (row.isvaild == '0') {
|
||||
elMessage.value = '确定设置该角色为无效吗?';
|
||||
} else if (row.isvaild == '1') {
|
||||
elMessage.value = '确定设置该角色为有效吗?';
|
||||
}
|
||||
ElMessageBox.confirm(elMessage.value, "提示信息", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm(elMessage.value, '提示信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
let params = {
|
||||
isvaild: row.isvaild,
|
||||
id: row.id,
|
||||
id: row.id
|
||||
};
|
||||
isvaildTo(params).then(() => {
|
||||
gettableData();
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "改变成功",
|
||||
type: 'success',
|
||||
message: '改变成功'
|
||||
});
|
||||
});
|
||||
})
|
||||
@ -75,35 +77,35 @@ function switchChange(row: any) {
|
||||
}
|
||||
const infoForm = ref();
|
||||
//搜索内容及点击搜索按钮
|
||||
const input = ref("");
|
||||
const input = ref('');
|
||||
//新建角色
|
||||
const title = ref("");
|
||||
const title = ref('');
|
||||
const info: any = ref({
|
||||
rolename: "",
|
||||
level: "2",
|
||||
description: "",
|
||||
rolename: '',
|
||||
level: '2',
|
||||
description: ''
|
||||
});
|
||||
const faultList: any = [
|
||||
{
|
||||
value: "1",
|
||||
label: "超级管理员",
|
||||
value: '1',
|
||||
label: '超级管理员'
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "系统管理员",
|
||||
value: '2',
|
||||
label: '系统管理员'
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "一般用户",
|
||||
},
|
||||
value: '3',
|
||||
label: '一般用户'
|
||||
}
|
||||
];
|
||||
const dialogVisible = ref(false);
|
||||
function addClick() {
|
||||
title.value = "新增角色";
|
||||
title.value = '新增角色';
|
||||
info.value = {
|
||||
rolename: "",
|
||||
level: "2",
|
||||
description: "",
|
||||
rolename: '',
|
||||
level: '2',
|
||||
description: ''
|
||||
};
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
@ -116,6 +118,7 @@ function confirmClick(formEl: any) {
|
||||
rolename: info.value.rolename,
|
||||
level: info.value.level,
|
||||
description: info.value.description,
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
addDept(params).then(() => {
|
||||
gettableData();
|
||||
@ -127,6 +130,7 @@ function confirmClick(formEl: any) {
|
||||
level: info.value.level,
|
||||
description: info.value.description,
|
||||
id: info.value.id,
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
renewDept(params).then(() => {
|
||||
gettableData();
|
||||
@ -150,12 +154,12 @@ function handleClose() {
|
||||
}
|
||||
//新建角色-rules
|
||||
const rules = ref({
|
||||
rolename: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
|
||||
level: [{ required: true, message: "请选择角色级别", trigger: "change" }],
|
||||
rolename: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
|
||||
level: [{ required: true, message: '请选择角色级别', trigger: 'change' }]
|
||||
});
|
||||
//修改角色
|
||||
function editrole(row: any) {
|
||||
title.value = "修改角色";
|
||||
title.value = '修改角色';
|
||||
info.value = JSON.parse(JSON.stringify(row));
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
@ -163,9 +167,9 @@ function editrole(row: any) {
|
||||
const businessVisible = ref(false);
|
||||
function businessclick() {
|
||||
// businessVisible.value = true;
|
||||
ElMessageBox.confirm("此模块允许用户进行定制。", "提示信息", {
|
||||
confirmButtonText: "确定",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('此模块允许用户进行定制。', '提示信息', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
businessVisible.value = false;
|
||||
});
|
||||
@ -178,14 +182,14 @@ function businessclick() {
|
||||
//组织范围修改
|
||||
const organizeVisible = ref(false);
|
||||
const deptdata = ref();
|
||||
const roleIda = ref("");
|
||||
const roleIda = ref('');
|
||||
function organizeclick(row: any) {
|
||||
organizeVisible.value = true;
|
||||
roleIda.value = row.id;
|
||||
const params = {
|
||||
roleId: row.id,
|
||||
roleId: row.id
|
||||
};
|
||||
setOrgscope(params).then((res) => {
|
||||
setOrgscope(params).then(res => {
|
||||
deptdata.value = res;
|
||||
});
|
||||
}
|
||||
@ -194,7 +198,9 @@ function accessCheckAllChange(indexone: any) {
|
||||
for (var j = 0; j < deptdata.value[indexone].children.length; j++) {
|
||||
Arrayall.value.push(deptdata.value[indexone].children[j].orgname);
|
||||
}
|
||||
deptdata.value[indexone].array = deptdata.value[indexone].checkinfo ? Arrayall : [];
|
||||
deptdata.value[indexone].array = deptdata.value[indexone].checkinfo
|
||||
? Arrayall
|
||||
: [];
|
||||
deptdata.value[indexone].bool = false;
|
||||
}
|
||||
function accessCheckedCitiesChanges(indexone: any) {
|
||||
@ -216,31 +222,31 @@ function organizesubmit() {
|
||||
});
|
||||
const params = {
|
||||
id: roleIda.value,
|
||||
orgscope: allid.value.toString(),
|
||||
orgscope: allid.value.toString()
|
||||
};
|
||||
postOrgscope(params).then(() => {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "组织范围修改成功",
|
||||
type: 'success',
|
||||
message: '组织范围修改成功'
|
||||
});
|
||||
organizeVisible.value = false;
|
||||
});
|
||||
}
|
||||
//删除角色
|
||||
function delrole(row: any) {
|
||||
ElMessageBox.confirm("确定删除此角色吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定删除此角色吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let params = {
|
||||
id: row.id,
|
||||
id: row.id
|
||||
};
|
||||
deleDept(params).then(() => {
|
||||
gettableData();
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "删除成功",
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -253,8 +259,8 @@ const DefaultDeployment: any = ref([]);
|
||||
//传参id
|
||||
const Passparameter: any = ref([]);
|
||||
const defaultProps = {
|
||||
children: "children",
|
||||
label: "name",
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
};
|
||||
const rowid = ref();
|
||||
function menuChange(data: any, ids: any) {
|
||||
@ -273,12 +279,12 @@ function assignment(row: any) {
|
||||
accessVisible.value = true;
|
||||
const params = {
|
||||
roleId: rowid.value,
|
||||
code: '4'
|
||||
tenantId:tenValue.value
|
||||
};
|
||||
assignmentPer(params).then((res: any) => {
|
||||
accessdata.value = res;
|
||||
permissionAssignmentGrouped(params).then((res: any) => {
|
||||
accessdata.value = res[0]?.menus || [];
|
||||
let ids: any = [];
|
||||
menuChange(res, ids);
|
||||
menuChange(res[0]?.menus, ids);
|
||||
nextTick(() => {
|
||||
tree.value.setCheckedKeys(ids);
|
||||
});
|
||||
@ -287,42 +293,44 @@ function assignment(row: any) {
|
||||
|
||||
// 树形选择器
|
||||
function currentChecked(_nodeObj: any, SelectedObj: any) {
|
||||
Passparameter.value = SelectedObj.checkedKeys.concat(SelectedObj.halfCheckedKeys);
|
||||
Passparameter.value = SelectedObj.checkedKeys.concat(
|
||||
SelectedObj.halfCheckedKeys
|
||||
);
|
||||
}
|
||||
// 权限范围-权限范围-确定
|
||||
function accesssubmit() {
|
||||
const parans = {
|
||||
id: rowid.value,
|
||||
menuIds: Passparameter.value.toString(),
|
||||
menuIds: Passparameter.value.toString()
|
||||
};
|
||||
setMenuById(parans).then(() => {
|
||||
accessVisible.value = false;
|
||||
gettableData();
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "修改成功",
|
||||
type: 'success',
|
||||
message: '修改成功'
|
||||
});
|
||||
});
|
||||
}
|
||||
// 多选删除?
|
||||
function delClick() {
|
||||
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
ElMessageBox.confirm('确定删除已选择角色吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let id = [] as any[];
|
||||
multipleSelection.value.forEach((item: any) => {
|
||||
id.push(item.id);
|
||||
});
|
||||
let params = {
|
||||
id: id.join(","),
|
||||
id: id.join(',')
|
||||
};
|
||||
deleDept(params).then(() => {
|
||||
gettableData();
|
||||
ElMessage({
|
||||
message: "删除成功",
|
||||
type: "success",
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -333,19 +341,41 @@ function dateFormat(row: any) {
|
||||
var date = new Date(daterc);
|
||||
var year = date.getFullYear();
|
||||
var month =
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
date.getMonth() + 1 < 10
|
||||
? '0' + (date.getMonth() + 1)
|
||||
: date.getMonth() + 1;
|
||||
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||
var minutes =
|
||||
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||
var seconds =
|
||||
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
return (
|
||||
year +
|
||||
'-' +
|
||||
month +
|
||||
'-' +
|
||||
day +
|
||||
' ' +
|
||||
hours +
|
||||
':' +
|
||||
minutes +
|
||||
':' +
|
||||
seconds
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let tenValue = ref('1')
|
||||
let tenOption = ref([])
|
||||
onMounted(() => {
|
||||
gettableData();
|
||||
getDictItemsByCode({ dictCode: 'PLATFORM_TENANT' }).then(res => {
|
||||
tenOption.value = res.data;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -369,13 +399,29 @@ onMounted(() => {
|
||||
style="width: 200px"
|
||||
clearable
|
||||
/>
|
||||
<el-button type="primary" style="margin-left: 10px" @click="gettableData"
|
||||
<el-select v-model="tenValue" placeholder=" " style="width: 320px;margin-left: 10px">
|
||||
<el-option
|
||||
v-for="item in tenOption"
|
||||
:key="item.itemCode"
|
||||
:label="item.dictName"
|
||||
:value="item.itemCode"
|
||||
/>
|
||||
<!-- PLATFORM_TENANT -->
|
||||
</el-select>
|
||||
<el-button
|
||||
type="primary"
|
||||
style="margin-left: 10px"
|
||||
@click="gettableData"
|
||||
>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button v-hasPerm="['add:role']" type="primary" @click="addClick">
|
||||
<img src="@/assets/MenuIcon/jscz_xz.png" alt="" style="margin-right: 3px" />
|
||||
<img
|
||||
src="@/assets/MenuIcon/jscz_xz.png"
|
||||
alt=""
|
||||
style="margin-right: 3px"
|
||||
/>
|
||||
新增</el-button
|
||||
>
|
||||
<el-button
|
||||
@ -399,12 +445,24 @@ onMounted(() => {
|
||||
:header-cell-style="{
|
||||
background: 'rgb(250 250 250)',
|
||||
color: '#383838',
|
||||
height: '50px',
|
||||
height: '50px'
|
||||
}"
|
||||
>
|
||||
<el-table-column type="selection" width="50" align="center"></el-table-column>
|
||||
<el-table-column prop="rolecode" label="角色编号" width="100"></el-table-column>
|
||||
<el-table-column prop="rolename" label="角色名称" width="180"></el-table-column>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="50"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="rolecode"
|
||||
label="角色编号"
|
||||
width="100"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="rolename"
|
||||
label="角色名称"
|
||||
width="180"
|
||||
></el-table-column>
|
||||
<el-table-column prop="level" label="角色级别" width="116">
|
||||
<template #default="scope">
|
||||
<span v-show="scope.row.level == '1'">超级管理员</span>
|
||||
@ -417,7 +475,12 @@ onMounted(() => {
|
||||
label="角色描述"
|
||||
min-width="100"
|
||||
></el-table-column>
|
||||
<el-table-column prop="isvaild" label="是否有效" align="center" width="120">
|
||||
<el-table-column
|
||||
prop="isvaild"
|
||||
label="是否有效"
|
||||
align="center"
|
||||
width="120"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.isvaild"
|
||||
@ -426,7 +489,9 @@ onMounted(() => {
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
></el-switch>
|
||||
<span v-if="scope.row.isvaild == 1" style="color: #0099ff">有效</span>
|
||||
<span v-if="scope.row.isvaild == 1" style="color: #0099ff"
|
||||
>有效</span
|
||||
>
|
||||
<span v-else style="color: #d7d7d7">无效</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -538,7 +603,9 @@ onMounted(() => {
|
||||
"
|
||||
>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="confirmClick(infoForm)">确 定</el-button>
|
||||
<el-button type="primary" @click="confirmClick(infoForm)"
|
||||
>确 定</el-button
|
||||
>
|
||||
</span>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
@ -586,9 +653,12 @@ onMounted(() => {
|
||||
@change="accessCheckedCitiesChanges(indexone)"
|
||||
style="margin-left: 20px"
|
||||
>
|
||||
<el-checkbox v-for="k in item.children" :key="k.id" :label="k.orgname">{{
|
||||
k.orgname
|
||||
}}</el-checkbox>
|
||||
<el-checkbox
|
||||
v-for="k in item.children"
|
||||
:key="k.id"
|
||||
:label="k.orgname"
|
||||
>{{ k.orgname }}</el-checkbox
|
||||
>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
@ -682,7 +752,7 @@ onMounted(() => {
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
font-size: 14px;
|
||||
font-family: "微软雅黑";
|
||||
font-family: '微软雅黑';
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
color: #787878;
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
gettableData,
|
||||
DataStatus,
|
||||
deltableData,
|
||||
getRole,
|
||||
listGroupedByTenant,
|
||||
addUsers,
|
||||
updataUser,
|
||||
setpass,
|
||||
@ -786,7 +786,7 @@ function getrole() {
|
||||
const params = {
|
||||
rolename: ''
|
||||
};
|
||||
getRole(params).then(res => {
|
||||
listGroupedByTenant(params).then(res => {
|
||||
rolesdata.value = res;
|
||||
});
|
||||
}
|
||||
@ -1256,13 +1256,20 @@ function handleClearSelection() {
|
||||
placeholder=" "
|
||||
style="width: 100%"
|
||||
multiple
|
||||
filterable
|
||||
>
|
||||
<el-option-group
|
||||
v-for="group in rolesdata"
|
||||
:key="group.tenantName"
|
||||
:label="group.tenantName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rolesdata"
|
||||
v-for="item in group.roles"
|
||||
:key="item.id"
|
||||
:label="item.rolename"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -1565,4 +1572,7 @@ function handleClearSelection() {
|
||||
.el-message-box {
|
||||
width: 300px !important;
|
||||
}
|
||||
:deep(.el-select-group__title){
|
||||
font-size: 16px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -51,6 +51,14 @@ export function assignmentPer (queryParams:any){
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取分配权限(改动之后)
|
||||
export function permissionAssignmentGrouped (queryParams:any){
|
||||
return request({
|
||||
url:'/system/menu/permissionAssignmentGrouped' ,
|
||||
method: 'post',
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//发出分配权限
|
||||
export function setMenuById (queryParams:any){
|
||||
return request({
|
||||
|
||||
@ -57,6 +57,14 @@ export function getRole (queryParams:any) {
|
||||
params: queryParams
|
||||
});
|
||||
}
|
||||
//获取角色
|
||||
export function listGroupedByTenant (queryParams:any) {
|
||||
return request({
|
||||
url: '/system/role/listGroupedByTenant',
|
||||
method: 'POST',
|
||||
data: queryParams
|
||||
});
|
||||
}
|
||||
//新建用户
|
||||
export function addUsers (queryParams:any,roleids:any) {
|
||||
return request({
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user