后台书写病历相关/前端基础目录搭建

This commit is contained in:
Zhang.YC
2025-02-24 17:16:21 +08:00
parent 2b699a8132
commit 515280f8a3
29 changed files with 943 additions and 200 deletions

View File

@@ -108,6 +108,8 @@ public class MybatisPlusConfig {
"cli_procedure_performer", "cli_procedure_performer",
"doc_emr", "doc_emr",
"doc_emr_template", "doc_emr_template",
"doc_emr_detail",
"doc_emr_dict",
"fin_claim", "fin_claim",
"fin_claim_response", "fin_claim_response",
"fin_contract", "fin_contract",

View File

@@ -0,0 +1,157 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.emr.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.document.domain.Emr;
import com.openhis.document.domain.EmrDetail;
import com.openhis.document.domain.EmrDict;
import com.openhis.document.domain.EmrTemplate;
import com.openhis.document.service.IEmrDetailService;
import com.openhis.document.service.IEmrDictService;
import com.openhis.document.service.IEmrService;
import com.openhis.document.service.IEmrTemplateService;
import com.openhis.web.emr.dto.EmrTemplateDto;
import com.openhis.web.emr.dto.PatientEmrDto;
import lombok.extern.slf4j.Slf4j;
/**
* 电子病历controller
*
* @author ZhangYC
* @date 2025-02-22
*/
@RestController
@RequestMapping("/doc-emr")
@Slf4j
public class PatientEmrController {
@Autowired
private IEmrService emrService;
@Autowired
private IEmrTemplateService emrTemplateService;
@Autowired
private IEmrDetailService emrDetailService;
@Autowired
private IEmrDictService emrDictService;
/**
* 添加病人病历信息
*
* @param patientEmrDto 电子病历信息dto
* @return 操作结果
*/
@PostMapping("/emr")
public R<?> addPatientEmr(@Validated @RequestBody PatientEmrDto patientEmrDto) {
Emr emr = new Emr();
BeanUtils.copyProperties(patientEmrDto, emr);
String contextStr = patientEmrDto.getContextJson().toString();
boolean saveSuccess = emrService.save(emr.setContextJson(contextStr));
if (!saveSuccess) {
return R.fail();
}
// 获取电子病历字典表中全部key用来判断病历JSON串中是否有需要加入到病历详情表的字段
List<String> emrDictList = emrDictService.list(new LambdaQueryWrapper<EmrDict>().select(EmrDict::getEmrKey))
.stream().map(EmrDict::getEmrKey).collect(Collectors.toList());
Map<String, String> emrContextMap =
JSONObject.parseObject(contextStr, new TypeReference<Map<String, String>>() {});
List<EmrDetail> emrDetailList = new ArrayList<>();
// 遍历病历内容map
for (Map.Entry<String, String> entry : emrContextMap.entrySet()) {
EmrDetail emrDetail = new EmrDetail();
emrDetail.setEmrId(emr.getId());
if (!emrDictList.isEmpty() && emrDictList.contains(entry.getKey())) {
emrDetail.setEmrKey(entry.getKey());
emrDetail.setEmrValue(entry.getValue());
}
emrDetailList.add(emrDetail);
}
boolean save = emrDetailService.saveBatch(emrDetailList);
return save ? R.ok() : R.fail();
}
/**
* 获取患者历史病历
*
* @param patientEmrDto 查询条件
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return 分页数据列表
*/
@GetMapping("/emr-page")
public R<?> getPatientEmrHistory(PatientEmrDto patientEmrDto,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
// 根据患者id 获取历史病历列表
Page<Emr> emrPage = emrService.page(new Page<>(pageNo, pageSize),
new LambdaQueryWrapper<Emr>().eq(Emr::getPatientId, patientEmrDto.getPatientId()));
return R.ok(emrPage);
}
/**
* 保存病历模板
*
* @param emrTemplateDto 病历模板信息
* @return 操作结果
*/
@PostMapping("emr-template")
public R<?> addEmrTemplate(@RequestBody @Validated EmrTemplateDto emrTemplateDto) {
EmrTemplate emrTemplate = new EmrTemplate();
BeanUtils.copyProperties(emrTemplateDto, emrTemplate);
return emrTemplateService.save(emrTemplate) ? R.ok() : R.fail();
}
/**
* 获取电子病历模板列表
*
* @param emrTemplateDto 查询参数
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return
*/
@GetMapping("emr-template-page")
public R<?> getEmrTemplate(EmrTemplateDto emrTemplateDto,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
LambdaQueryWrapper<EmrTemplate> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName())
.eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode())
.eq(EmrTemplate::getUserId, emrTemplateDto.getUserId());
Page<EmrTemplate> emrTemplatePage = emrTemplateService.page(new Page<>(pageNo, pageSize), queryWrapper);
return R.ok(emrTemplatePage);
}
/**
* 删除病历模板
*
* @param id 模板id
* @return 操作结果
*/
@DeleteMapping("emr-template")
public R<?> deleteEmrTemplate(@RequestParam Long id) {
return emrTemplateService.removeById(id) ? R.ok() : R.fail();
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.emr.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 病历模板Dto
*
* @author ZhangYC
* @date 2025-02-22
*/
@Data
@Accessors(chain = true)
public class EmrTemplateDto implements Serializable {
/** 模板名称 */
@NotBlank
private String templateName;
/** 模板类型 */
private String templateTypeEnum;
/** 使用范围 */
@NotBlank
private String useScopeCode;
/** 个人/科室ID */
private Long userId;
/** 病历内容 */
private String contextJson;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.emr.dto;
import javax.validation.constraints.NotNull;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 病人电子病历信息
*
* @author ZhangYC
* @date 2025-02-22
*/
@Data
@Accessors(chain = true)
public class PatientEmrDto implements Serializable {
/** 患者ID */
@NotNull
private Long patientId;
/** 就诊ID */
@NotNull
private Long encounterId;
/** 病历信息 */
private JSONObject contextJson;
/** 病历状态 */
private String emrStatus;
/** 记录人 */
@NotNull
private Long recordId;
}

View File

@@ -0,0 +1,47 @@
package com.openhis.document.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 病历信息Entity实体
*
* @author system
* @date 2025-02-21
*/
@Data
@TableName("doc_emr")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Emr extends HisBaseEntity {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 患者ID */
private Long patientId;
/** 就诊ID */
private Long encounterId;
/** 病历信息 */
private String contextJson;
/** 病历状态 */
private String emrEnum;
/** 记录人 */
private Long recordId;
}

View File

@@ -0,0 +1,40 @@
package com.openhis.document.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 电子病历详情Entity实体
*
* @author system
* @date 2025-02-22
*/
@Data
@TableName("doc_emr_detail")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class EmrDetail extends HisBaseEntity {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 病历ID */
private Long emrId;
/** 病历内容key */
private String emrKey;
/** 病历内容value */
private String emrValue;
}

View File

@@ -0,0 +1,37 @@
package com.openhis.document.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 电子病历字典Entity实体
*
* @author system
* @date 2025-02-22
*/
@Data
@TableName("doc_emr_dict")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class EmrDict extends HisBaseEntity {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 病历内容code */
private String emrKey;
/** 病历内容value */
private String emrValue;
}

View File

@@ -0,0 +1,46 @@
package com.openhis.document.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 病历模板Entity实体
*
* @author system
* @date 2025-02-21
*/
@Data
@TableName("doc_emr_template")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class EmrTemplate extends HisBaseEntity {
/** ID */
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 模板名称 */
private String templateName;
/** 模板类型 */
private String templateCode;
/** 使用范围 */
private String useScopeCode;
/** 个人/科室ID */
private Long userId;
/** 病历内容 */
private String contextJson;
}

View File

@@ -0,0 +1,17 @@
package com.openhis.document.mapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.document.domain.EmrDetail;
/**
* 电子病历详情Mapper接口
*
* @author system
* @date 2025-02-22
*/
@Repository
public interface EmrDetailMapper extends BaseMapper<EmrDetail> {
}

View File

@@ -0,0 +1,17 @@
package com.openhis.document.mapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.document.domain.EmrDict;
/**
* 电子病历字典Mapper接口
*
* @author system
* @date 2025-02-22
*/
@Repository
public interface EmrDictMapper extends BaseMapper<EmrDict> {
}

View File

@@ -0,0 +1,17 @@
package com.openhis.document.mapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.document.domain.Emr;
/**
* 病历信息Mapper接口
*
* @author system
* @date 2025-02-21
*/
@Repository
public interface EmrMapper extends BaseMapper<Emr> {
}

View File

@@ -0,0 +1,17 @@
package com.openhis.document.mapper;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.openhis.document.domain.EmrTemplate;
/**
* 病历模板Mapper接口
*
* @author system
* @date 2025-02-21
*/
@Repository
public interface EmrTemplateMapper extends BaseMapper<EmrTemplate> {
}

View File

@@ -0,0 +1,14 @@
package com.openhis.document.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.document.domain.EmrDetail;
/**
* 电子病历详情Service接口
*
* @author system
* @date 2025-02-22
*/
public interface IEmrDetailService extends IService<EmrDetail> {
}

View File

@@ -0,0 +1,14 @@
package com.openhis.document.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.document.domain.EmrDict;
/**
* 电子病历字典Service接口
*
* @author system
* @date 2025-02-22
*/
public interface IEmrDictService extends IService<EmrDict> {
}

View File

@@ -0,0 +1,14 @@
package com.openhis.document.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.document.domain.Emr;
/**
* 病历信息Service接口
*
* @author system
* @date 2025-02-21
*/
public interface IEmrService extends IService<Emr> {
}

View File

@@ -0,0 +1,14 @@
package com.openhis.document.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.document.domain.EmrTemplate;
/**
* 病历模板Service接口
*
* @author system
* @date 2025-02-21
*/
public interface IEmrTemplateService extends IService<EmrTemplate> {
}

View File

@@ -0,0 +1,19 @@
package com.openhis.document.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.document.domain.EmrDetail;
import com.openhis.document.mapper.EmrDetailMapper;
import com.openhis.document.service.IEmrDetailService;
/**
* 电子病历详情Service业务层处理
*
* @author system
* @date 2025-02-22
*/
@Service
public class EmrDetailServiceImpl extends ServiceImpl<EmrDetailMapper, EmrDetail> implements IEmrDetailService {
}

View File

@@ -0,0 +1,19 @@
package com.openhis.document.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.document.domain.EmrDict;
import com.openhis.document.mapper.EmrDictMapper;
import com.openhis.document.service.IEmrDictService;
/**
* 电子病历字典Service业务层处理
*
* @author system
* @date 2025-02-22
*/
@Service
public class EmrDictServiceImpl extends ServiceImpl<EmrDictMapper, EmrDict> implements IEmrDictService {
}

View File

@@ -0,0 +1,19 @@
package com.openhis.document.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.document.domain.Emr;
import com.openhis.document.mapper.EmrMapper;
import com.openhis.document.service.IEmrService;
/**
* 病历信息Service业务层处理
*
* @author system
* @date 2025-02-21
*/
@Service
public class EmrServiceImpl extends ServiceImpl<EmrMapper, Emr> implements IEmrService {
}

View File

@@ -0,0 +1,19 @@
package com.openhis.document.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.document.domain.EmrTemplate;
import com.openhis.document.mapper.EmrTemplateMapper;
import com.openhis.document.service.IEmrTemplateService;
/**
* 病历模板Service业务层处理
*
* @author system
* @date 2025-02-21
*/
@Service
public class EmrTemplateServiceImpl extends ServiceImpl<EmrTemplateMapper, EmrTemplate> implements IEmrTemplateService {
}

View File

@@ -0,0 +1,7 @@
<?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.openhis.document.mapper.EmrDetailMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.openhis.document.mapper.EmrDictMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.openhis.document.mapper.EmrMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?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.openhis.document.mapper.EmrTemplateMapper">
</mapper>

View File

@@ -1,6 +1,11 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> <el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
>
<el-form-item label="字典名称" prop="dictType"> <el-form-item label="字典名称" prop="dictType">
<el-select v-model="queryParams.dictType" style="width: 200px"> <el-select v-model="queryParams.dictType" style="width: 200px">
<el-option <el-option
@@ -21,7 +26,12 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="数据状态" clearable style="width: 200px"> <el-select
v-model="queryParams.status"
placeholder="数据状态"
clearable
style="width: 200px"
>
<el-option <el-option
v-for="dict in sys_normal_disable" v-for="dict in sys_normal_disable"
:key="dict.value" :key="dict.value"
@@ -31,7 +41,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">
搜索
</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -44,7 +56,9 @@
icon="Plus" icon="Plus"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dict:add']" v-hasPermi="['system:dict:add']"
>新增</el-button> >
新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@@ -54,7 +68,9 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >
修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@@ -64,7 +80,9 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >
删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@@ -73,26 +91,45 @@
icon="Download" icon="Download"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</el-button> >
导出
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" plain icon="Close" @click="handleClose">
type="warning" 关闭
plain </el-button>
icon="Close"
@click="handleClose"
>关闭</el-button>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
v-model:showSearch="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="dataList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编码" align="center" prop="dictCode" /> <el-table-column label="字典编码" align="center" prop="dictCode" />
<el-table-column label="字典标签" align="center" prop="dictLabel"> <el-table-column label="字典标签" align="center" prop="dictLabel">
<template #default="scope"> <template #default="scope">
<span v-if="(scope.row.listClass == '' || scope.row.listClass == 'default') && (scope.row.cssClass == '' || scope.row.cssClass == null)">{{ scope.row.dictLabel }}</span> <span
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass" :class="scope.row.cssClass">{{ scope.row.dictLabel }}</el-tag> v-if="
(scope.row.listClass == '' || scope.row.listClass == 'default') &&
(scope.row.cssClass == '' || scope.row.cssClass == null)
"
>
{{ scope.row.dictLabel }}
</span>
<el-tag
v-else
:type="scope.row.listClass == 'primary' ? '' : scope.row.listClass"
:class="scope.row.cssClass"
>
{{ scope.row.dictLabel }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="字典键值" align="center" prop="dictValue" /> <el-table-column label="字典键值" align="center" prop="dictValue" />
@@ -102,16 +139,47 @@
<dict-tag :options="sys_normal_disable" :value="scope.row.status" /> <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> label="备注"
align="center"
prop="remark"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
width="160"
class-name="small-padding fixed-width"
>
<template #default="scope"> <template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dict:edit']">修改</el-button> <el-button
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dict:remove']">删除</el-button> link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']"
>
修改
</el-button>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']"
>
删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -140,7 +208,11 @@
<el-input v-model="form.cssClass" placeholder="请输入样式属性" /> <el-input v-model="form.cssClass" placeholder="请输入样式属性" />
</el-form-item> </el-form-item>
<el-form-item label="显示排序" prop="dictSort"> <el-form-item label="显示排序" prop="dictSort">
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> <el-input-number
v-model="form.dictSort"
controls-position="right"
:min="0"
/>
</el-form-item> </el-form-item>
<el-form-item label="回显样式" prop="listClass"> <el-form-item label="回显样式" prop="listClass">
<el-select v-model="form.listClass"> <el-select v-model="form.listClass">
@@ -158,11 +230,17 @@
v-for="dict in sys_normal_disable" v-for="dict in sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{ dict.label }}</el-radio> >
{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@@ -176,9 +254,18 @@
</template> </template>
<script setup name="Data"> <script setup name="Data">
import useDictStore from '@/store/modules/dict' import {
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"; addData,
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; delData,
getData,
listData,
updateData,
} from "@/api/system/dict/data";
import {
optionselect as getDictOptionselect,
getType,
} from "@/api/system/dict/type";
import useDictStore from "@/store/modules/dict";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
@@ -202,7 +289,7 @@ const listClassOptions = ref([
{ value: "success", label: "成功" }, { value: "success", label: "成功" },
{ value: "info", label: "信息" }, { value: "info", label: "信息" },
{ value: "warning", label: "警告" }, { value: "warning", label: "警告" },
{ value: "danger", label: "危险" } { value: "danger", label: "危险" },
]); ]);
const data = reactive({ const data = reactive({
@@ -212,20 +299,26 @@ const data = reactive({
pageSize: 10, pageSize: 10,
dictType: undefined, dictType: undefined,
dictLabel: undefined, dictLabel: undefined,
status: undefined status: undefined,
}, },
rules: { rules: {
dictLabel: [{ required: true, message: "数据标签不能为空", trigger: "blur" }], dictLabel: [
dictValue: [{ required: true, message: "数据键值不能为空", trigger: "blur" }], { required: true, message: "数据标签不能为空", trigger: "blur" },
dictSort: [{ required: true, message: "数据顺序不能为空", trigger: "blur" }] ],
} dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" },
],
dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" },
],
},
}); });
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data);
/** 查询字典类型详细 */ /** 查询字典类型详细 */
function getTypes(dictId) { function getTypes(dictId) {
getType(dictId).then(response => { getType(dictId).then((response) => {
queryParams.value.dictType = response.data.dictType; queryParams.value.dictType = response.data.dictType;
defaultDictType.value = response.data.dictType; defaultDictType.value = response.data.dictType;
getList(); getList();
@@ -234,14 +327,14 @@ function getTypes(dictId) {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
function getTypeList() { function getTypeList() {
getDictOptionselect().then(response => { getDictOptionselect().then((response) => {
typeOptions.value = response.data; typeOptions.value = response.data;
}); });
} }
/** 查询字典数据列表 */ /** 查询字典数据列表 */
function getList() { function getList() {
loading.value = true; loading.value = true;
listData(queryParams.value).then(response => { listData(queryParams.value).then((response) => {
dataList.value = response.rows; dataList.value = response.rows;
total.value = response.total; total.value = response.total;
loading.value = false; loading.value = false;
@@ -262,7 +355,7 @@ function reset() {
listClass: "default", listClass: "default",
dictSort: 0, dictSort: 0,
status: "0", status: "0",
remark: undefined remark: undefined,
}; };
proxy.resetForm("dataRef"); proxy.resetForm("dataRef");
} }
@@ -291,7 +384,7 @@ function handleAdd() {
} }
/** 多选框选中数据 */ /** 多选框选中数据 */
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
ids.value = selection.map(item => item.dictCode); ids.value = selection.map((item) => item.dictCode);
single.value = selection.length != 1; single.value = selection.length != 1;
multiple.value = !selection.length; multiple.value = !selection.length;
} }
@@ -299,7 +392,7 @@ function handleSelectionChange(selection) {
function handleUpdate(row) { function handleUpdate(row) {
reset(); reset();
const dictCode = row.dictCode || ids.value; const dictCode = row.dictCode || ids.value;
getData(dictCode).then(response => { getData(dictCode).then((response) => {
form.value = response.data; form.value = response.data;
open.value = true; open.value = true;
title.value = "修改字典数据"; title.value = "修改字典数据";
@@ -307,17 +400,17 @@ function handleUpdate(row) {
} }
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
proxy.$refs["dataRef"].validate(valid => { proxy.$refs["dataRef"].validate((valid) => {
if (valid) { if (valid) {
if (form.value.dictCode != undefined) { if (form.value.dictCode != undefined) {
updateData(form.value).then(response => { updateData(form.value).then((response) => {
useDictStore().removeDict(queryParams.value.dictType); useDictStore().removeDict(queryParams.value.dictType);
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
open.value = false; open.value = false;
getList(); getList();
}); });
} else { } else {
addData(form.value).then(response => { addData(form.value).then((response) => {
useDictStore().removeDict(queryParams.value.dictType); useDictStore().removeDict(queryParams.value.dictType);
proxy.$modal.msgSuccess("新增成功"); proxy.$modal.msgSuccess("新增成功");
open.value = false; open.value = false;
@@ -330,19 +423,27 @@ function submitForm() {
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
const dictCodes = row.dictCode || ids.value; const dictCodes = row.dictCode || ids.value;
proxy.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() { proxy.$modal
.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?')
.then(function () {
return delData(dictCodes); return delData(dictCodes);
}).then(() => { })
.then(() => {
getList(); getList();
proxy.$modal.msgSuccess("删除成功"); proxy.$modal.msgSuccess("删除成功");
useDictStore().removeDict(queryParams.value.dictType); useDictStore().removeDict(queryParams.value.dictType);
}).catch(() => {}); })
.catch(() => {});
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
function handleExport() { function handleExport() {
proxy.download("system/dict/data/export", { proxy.download(
...queryParams.value "system/dict/data/export",
}, `dict_data_${new Date().getTime()}.xlsx`); {
...queryParams.value,
},
`dict_data_${new Date().getTime()}.xlsx`
);
} }
getTypes(route.params && route.params.dictId); getTypes(route.params && route.params.dictId);

View File

@@ -0,0 +1 @@
<p>اللغة العربية</p>