refactor: site_submissions 重命名为 site_change_log,更通用的变更记录表
This commit is contained in:
@@ -266,34 +266,34 @@ public class AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/sites/pending")
|
@GetMapping("/sites/pending")
|
||||||
public ApiResponse<List<com.par.core.dto.SiteSubmissionDTO>> listPendingSubmissions(HttpServletRequest request) {
|
public ApiResponse<List<com.par.core.dto.SiteChangeLogDTO>> listPendingChanges(HttpServletRequest request) {
|
||||||
checkAdmin(request);
|
checkAdmin(request);
|
||||||
return ApiResponse.success(siteService.listPendingSubmissions());
|
return ApiResponse.success(siteService.listPendingChanges());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/submissions/{id}/approve")
|
@PostMapping("/changes/{id}/approve")
|
||||||
public ApiResponse<Void> approveSubmission(@PathVariable Long id, HttpServletRequest request) {
|
public ApiResponse<Void> approveChange(@PathVariable Long id, HttpServletRequest request) {
|
||||||
checkAdmin(request);
|
checkAdmin(request);
|
||||||
Long reviewerId = (Long) request.getAttribute("accountId");
|
Long reviewerId = (Long) request.getAttribute("accountId");
|
||||||
siteService.approveSubmission(id, reviewerId);
|
siteService.approveChange(id, reviewerId);
|
||||||
log.info("Submission approved: id={}, reviewer={}", id, reviewerId);
|
log.info("Change approved: id={}, reviewer={}", id, reviewerId);
|
||||||
return ApiResponse.success();
|
return ApiResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/submissions/{id}/reject")
|
@PostMapping("/changes/{id}/reject")
|
||||||
public ApiResponse<Void> rejectSubmission(@PathVariable Long id, HttpServletRequest request) {
|
public ApiResponse<Void> rejectChange(@PathVariable Long id, HttpServletRequest request) {
|
||||||
checkAdmin(request);
|
checkAdmin(request);
|
||||||
Long reviewerId = (Long) request.getAttribute("accountId");
|
Long reviewerId = (Long) request.getAttribute("accountId");
|
||||||
siteService.rejectSubmission(id, reviewerId);
|
siteService.rejectChange(id, reviewerId);
|
||||||
log.info("Submission rejected: id={}", id);
|
log.info("Change rejected: id={}", id);
|
||||||
return ApiResponse.success();
|
return ApiResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/sites/{siteId}/submissions")
|
@GetMapping("/sites/{siteId}/changes")
|
||||||
public ApiResponse<List<com.par.core.dto.SiteSubmissionDTO>> listSiteSubmissions(
|
public ApiResponse<List<com.par.core.dto.SiteChangeLogDTO>> listSiteChanges(
|
||||||
@PathVariable("siteId") String siteId, HttpServletRequest request) {
|
@PathVariable("siteId") String siteId, HttpServletRequest request) {
|
||||||
checkAdmin(request);
|
checkAdmin(request);
|
||||||
return ApiResponse.success(siteService.listSubmissionsBySite(siteId));
|
return ApiResponse.success(siteService.listChangeLogBySite(siteId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAdmin(HttpServletRequest request) {
|
private void checkAdmin(HttpServletRequest request) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SiteSubmissionDTO {
|
public class SiteChangeLogDTO {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String siteId;
|
private String siteId;
|
||||||
private Long submitterId;
|
private Long submitterId;
|
||||||
@@ -6,8 +6,8 @@ import lombok.Data;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("site_submissions")
|
@TableName("site_change_log")
|
||||||
public class SiteSubmission {
|
public class SiteChangeLog {
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.par.core.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.par.core.entity.SiteChangeLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SiteChangeLogMapper extends BaseMapper<SiteChangeLog> {
|
||||||
|
|
||||||
|
@Select("SELECT * FROM site_change_log WHERE status = #{status} ORDER BY created_at DESC")
|
||||||
|
List<SiteChangeLog> selectByStatus(@Param("status") String status);
|
||||||
|
|
||||||
|
@Select("SELECT * FROM site_change_log WHERE site_id = #{siteId} ORDER BY created_at DESC")
|
||||||
|
List<SiteChangeLog> selectBySiteId(@Param("siteId") String siteId);
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.par.core.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.par.core.entity.SiteSubmission;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SiteSubmissionMapper extends BaseMapper<SiteSubmission> {
|
|
||||||
|
|
||||||
@Select("SELECT * FROM site_submissions WHERE status = #{status} ORDER BY created_at DESC")
|
|
||||||
List<SiteSubmission> selectByStatus(@Param("status") String status);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM site_submissions WHERE site_id = #{siteId} ORDER BY created_at DESC")
|
|
||||||
List<SiteSubmission> selectBySiteId(@Param("siteId") String siteId);
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.par.core.service;
|
package com.par.core.service;
|
||||||
|
|
||||||
|
import com.par.core.dto.SiteChangeLogDTO;
|
||||||
import com.par.core.dto.SiteDTO;
|
import com.par.core.dto.SiteDTO;
|
||||||
import com.par.core.dto.SiteSubmissionDTO;
|
|
||||||
import com.par.core.entity.Site;
|
import com.par.core.entity.Site;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -47,15 +47,15 @@ public interface SiteService {
|
|||||||
/** 所有站点列表(管理员用) */
|
/** 所有站点列表(管理员用) */
|
||||||
List<Site> listAllSites();
|
List<Site> listAllSites();
|
||||||
|
|
||||||
/** 待审核提交列表 */
|
/** 待审核变更列表 */
|
||||||
List<SiteSubmissionDTO> listPendingSubmissions();
|
List<SiteChangeLogDTO> listPendingChanges();
|
||||||
|
|
||||||
/** 审核通过 → 写入 sites 表 */
|
/** 审核通过 → 写入 sites 表 */
|
||||||
Site approveSubmission(Long submissionId, Long reviewerId);
|
Site approveChange(Long changeId, Long reviewerId);
|
||||||
|
|
||||||
/** 拒绝提交 */
|
/** 拒绝变更 */
|
||||||
void rejectSubmission(Long submissionId, Long reviewerId);
|
void rejectChange(Long changeId, Long reviewerId);
|
||||||
|
|
||||||
/** 查看站点的变更(审核)记录 */
|
/** 查看站点的变更记录 */
|
||||||
List<SiteSubmissionDTO> listSubmissionsBySite(String siteId);
|
List<SiteChangeLogDTO> listChangeLogBySite(String siteId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package com.par.core.service.impl;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.par.core.dto.SiteChangeLogDTO;
|
||||||
import com.par.core.dto.SiteDTO;
|
import com.par.core.dto.SiteDTO;
|
||||||
import com.par.core.dto.SiteSubmissionDTO;
|
|
||||||
import com.par.core.entity.Site;
|
import com.par.core.entity.Site;
|
||||||
import com.par.core.entity.SiteSubmission;
|
import com.par.core.entity.SiteChangeLog;
|
||||||
import com.par.core.enums.SiteStatus;
|
import com.par.core.enums.SiteStatus;
|
||||||
import com.par.core.enums.SiteType;
|
import com.par.core.enums.SiteType;
|
||||||
|
import com.par.core.mapper.SiteChangeLogMapper;
|
||||||
import com.par.core.mapper.SiteMapper;
|
import com.par.core.mapper.SiteMapper;
|
||||||
import com.par.core.mapper.SiteSubmissionMapper;
|
|
||||||
import com.par.core.service.SiteService;
|
import com.par.core.service.SiteService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
|||||||
public class SiteServiceImpl implements SiteService {
|
public class SiteServiceImpl implements SiteService {
|
||||||
|
|
||||||
private final SiteMapper siteMapper;
|
private final SiteMapper siteMapper;
|
||||||
private final SiteSubmissionMapper submissionMapper;
|
private final SiteChangeLogMapper changeLogMapper;
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
// ==================== 工具方法 ====================
|
// ==================== 工具方法 ====================
|
||||||
@@ -132,17 +132,17 @@ public class SiteServiceImpl implements SiteService {
|
|||||||
raw.put("notes", notes != null ? notes : "");
|
raw.put("notes", notes != null ? notes : "");
|
||||||
raw.put("siteStatus", status != null ? status : "正常");
|
raw.put("siteStatus", status != null ? status : "正常");
|
||||||
|
|
||||||
SiteSubmission sub = new SiteSubmission();
|
SiteChangeLog entry = new SiteChangeLog();
|
||||||
sub.setSiteId(siteId);
|
entry.setSiteId(siteId);
|
||||||
sub.setSubmitterId(submitterId);
|
entry.setSubmitterId(submitterId);
|
||||||
sub.setStatus("pending");
|
entry.setStatus("pending");
|
||||||
try {
|
try {
|
||||||
sub.setRawData(objectMapper.writeValueAsString(raw));
|
entry.setRawData(objectMapper.writeValueAsString(raw));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RuntimeException("序列化提交数据失败", e);
|
throw new RuntimeException("序列化变更数据失败", e);
|
||||||
}
|
}
|
||||||
submissionMapper.insert(sub);
|
changeLogMapper.insert(entry);
|
||||||
log.info("站点信息提交审核: siteId={} submissionId={}", siteId, sub.getId());
|
log.info("站点变更提交: siteId={} changeLogId={}", siteId, entry.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -181,23 +181,22 @@ public class SiteServiceImpl implements SiteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiteSubmissionDTO> listPendingSubmissions() {
|
public List<SiteChangeLogDTO> listPendingChanges() {
|
||||||
return submissionMapper.selectByStatus("pending").stream()
|
return changeLogMapper.selectByStatus("pending").stream()
|
||||||
.map(this::toSubmissionDTO).collect(Collectors.toList());
|
.map(this::toChangeLogDTO).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Site approveSubmission(Long submissionId, Long reviewerId) {
|
public Site approveChange(Long changeId, Long reviewerId) {
|
||||||
SiteSubmission sub = submissionMapper.selectById(submissionId);
|
SiteChangeLog entry = changeLogMapper.selectById(changeId);
|
||||||
if (sub == null) throw new IllegalArgumentException("提交记录不存在");
|
if (entry == null) throw new IllegalArgumentException("变更记录不存在");
|
||||||
if (!"pending".equals(sub.getStatus())) throw new IllegalArgumentException("该提交已处理");
|
if (!"pending".equals(entry.getStatus())) throw new IllegalArgumentException("该变更已处理");
|
||||||
|
|
||||||
// 解析提交数据
|
|
||||||
Map<String, Object> raw;
|
Map<String, Object> raw;
|
||||||
try {
|
try {
|
||||||
raw = objectMapper.readValue(sub.getRawData(), new TypeReference<Map<String, Object>>() {});
|
raw = objectMapper.readValue(entry.getRawData(), new TypeReference<Map<String, Object>>() {});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("解析提交数据失败", e);
|
throw new RuntimeException("解析变更数据失败", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -206,8 +205,7 @@ public class SiteServiceImpl implements SiteService {
|
|||||||
List<String> urls = (List<String>) raw.getOrDefault("urls", List.of());
|
List<String> urls = (List<String>) raw.getOrDefault("urls", List.of());
|
||||||
String notes = (String) raw.getOrDefault("notes", "");
|
String notes = (String) raw.getOrDefault("notes", "");
|
||||||
|
|
||||||
// 写入 sites 表
|
Site existing = siteMapper.selectBySiteId(entry.getSiteId());
|
||||||
Site existing = siteMapper.selectBySiteId(sub.getSiteId());
|
|
||||||
Site site;
|
Site site;
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
existing.setNamesJson(toJsonArray(names));
|
existing.setNamesJson(toJsonArray(names));
|
||||||
@@ -218,58 +216,57 @@ public class SiteServiceImpl implements SiteService {
|
|||||||
site = existing;
|
site = existing;
|
||||||
} else {
|
} else {
|
||||||
site = new Site();
|
site = new Site();
|
||||||
site.setSiteId(sub.getSiteId());
|
site.setSiteId(entry.getSiteId());
|
||||||
site.setNamesJson(toJsonArray(names));
|
site.setNamesJson(toJsonArray(names));
|
||||||
site.setUrlsJson(toJsonArray(urls));
|
site.setUrlsJson(toJsonArray(urls));
|
||||||
site.setNotes(notes);
|
site.setNotes(notes);
|
||||||
site.setSiteType(SiteType.UNKNOWN);
|
site.setSiteType(SiteType.UNKNOWN);
|
||||||
site.setSchemaVersion("1.0.0");
|
site.setSchemaVersion("1.0.0");
|
||||||
site.setStatus(SiteStatus.ACTIVE);
|
site.setStatus(SiteStatus.ACTIVE);
|
||||||
site.setSubmitterId(sub.getSubmitterId());
|
site.setSubmitterId(entry.getSubmitterId());
|
||||||
siteMapper.insert(site);
|
siteMapper.insert(site);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新提交状态
|
entry.setStatus("approved");
|
||||||
sub.setStatus("approved");
|
entry.setReviewerId(reviewerId);
|
||||||
sub.setReviewerId(reviewerId);
|
entry.setReviewedAt(java.time.LocalDateTime.now());
|
||||||
sub.setReviewedAt(java.time.LocalDateTime.now());
|
entry.setSiteRecordId(site.getId());
|
||||||
sub.setSiteRecordId(site.getId());
|
changeLogMapper.updateById(entry);
|
||||||
submissionMapper.updateById(sub);
|
log.info("站点变更通过: siteId={} changeLogId={}", entry.getSiteId(), changeId);
|
||||||
log.info("站点审核通过: siteId={} submissionId={}", sub.getSiteId(), submissionId);
|
|
||||||
return site;
|
return site;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rejectSubmission(Long submissionId, Long reviewerId) {
|
public void rejectChange(Long changeId, Long reviewerId) {
|
||||||
SiteSubmission sub = submissionMapper.selectById(submissionId);
|
SiteChangeLog entry = changeLogMapper.selectById(changeId);
|
||||||
if (sub == null) throw new IllegalArgumentException("提交记录不存在");
|
if (entry == null) throw new IllegalArgumentException("变更记录不存在");
|
||||||
if (!"pending".equals(sub.getStatus())) throw new IllegalArgumentException("该提交已处理");
|
if (!"pending".equals(entry.getStatus())) throw new IllegalArgumentException("该变更已处理");
|
||||||
sub.setStatus("rejected");
|
entry.setStatus("rejected");
|
||||||
sub.setReviewerId(reviewerId);
|
entry.setReviewerId(reviewerId);
|
||||||
sub.setReviewedAt(java.time.LocalDateTime.now());
|
entry.setReviewedAt(java.time.LocalDateTime.now());
|
||||||
submissionMapper.updateById(sub);
|
changeLogMapper.updateById(entry);
|
||||||
log.info("站点审核拒绝: siteId={} submissionId={}", sub.getSiteId(), submissionId);
|
log.info("站点变更拒绝: siteId={} changeLogId={}", entry.getSiteId(), changeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiteSubmissionDTO> listSubmissionsBySite(String siteId) {
|
public List<SiteChangeLogDTO> listChangeLogBySite(String siteId) {
|
||||||
return submissionMapper.selectBySiteId(siteId).stream()
|
return changeLogMapper.selectBySiteId(siteId).stream()
|
||||||
.map(this::toSubmissionDTO).collect(Collectors.toList());
|
.map(this::toChangeLogDTO).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private SiteSubmissionDTO toSubmissionDTO(SiteSubmission sub) {
|
private SiteChangeLogDTO toChangeLogDTO(SiteChangeLog entry) {
|
||||||
SiteSubmissionDTO dto = new SiteSubmissionDTO();
|
SiteChangeLogDTO dto = new SiteChangeLogDTO();
|
||||||
dto.setId(sub.getId());
|
dto.setId(entry.getId());
|
||||||
dto.setSiteId(sub.getSiteId());
|
dto.setSiteId(entry.getSiteId());
|
||||||
dto.setSubmitterId(sub.getSubmitterId());
|
dto.setSubmitterId(entry.getSubmitterId());
|
||||||
dto.setStatus(sub.getStatus());
|
dto.setStatus(entry.getStatus());
|
||||||
dto.setReviewerId(sub.getReviewerId());
|
dto.setReviewerId(entry.getReviewerId());
|
||||||
dto.setReviewComment(sub.getReviewComment());
|
dto.setReviewComment(entry.getReviewComment());
|
||||||
dto.setReviewedAt(sub.getReviewedAt());
|
dto.setReviewedAt(entry.getReviewedAt());
|
||||||
dto.setCreatedAt(sub.getCreatedAt());
|
dto.setCreatedAt(entry.getCreatedAt());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> raw = objectMapper.readValue(sub.getRawData(), new TypeReference<Map<String, Object>>() {});
|
Map<String, Object> raw = objectMapper.readValue(entry.getRawData(), new TypeReference<Map<String, Object>>() {});
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> names = (List<String>) raw.getOrDefault("names", List.of());
|
List<String> names = (List<String>) raw.getOrDefault("names", List.of());
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
CREATE TABLE site_submissions (
|
CREATE TABLE site_change_log (
|
||||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
site_id VARCHAR(64) NOT NULL COMMENT '站点标识',
|
site_id VARCHAR(64) NOT NULL COMMENT '站点标识',
|
||||||
submitter_id BIGINT UNSIGNED COMMENT '提交者账户ID',
|
submitter_id BIGINT UNSIGNED COMMENT '提交者账户ID',
|
||||||
@@ -36,10 +36,10 @@ export default {
|
|||||||
get: (id) => api.get(`/sites/${id}`),
|
get: (id) => api.get(`/sites/${id}`),
|
||||||
create: (data) => api.post('/sites', data),
|
create: (data) => api.post('/sites', data),
|
||||||
update: (id, data) => api.put(`/sites/${id}`, data),
|
update: (id, data) => api.put(`/sites/${id}`, data),
|
||||||
pendingSubmissions: () => api.get('/admin/sites/pending'),
|
pendingChanges: () => api.get('/admin/sites/pending'),
|
||||||
approveSubmission: (id) => api.post(`/admin/submissions/${id}/approve`),
|
approveChange: (id) => api.post(`/admin/changes/${id}/approve`),
|
||||||
rejectSubmission: (id) => api.post(`/admin/submissions/${id}/reject`),
|
rejectChange: (id) => api.post(`/admin/changes/${id}/reject`),
|
||||||
submissionsBySite: (siteId) => api.get(`/admin/sites/${siteId}/submissions`),
|
changesBySite: (siteId) => api.get(`/admin/sites/${siteId}/changes`),
|
||||||
},
|
},
|
||||||
configs: {
|
configs: {
|
||||||
list: () => api.get('/configs'),
|
list: () => api.get('/configs'),
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ const handleViewHistory = async (row) => {
|
|||||||
historyVisible.value = true
|
historyVisible.value = true
|
||||||
historyLoading.value = true
|
historyLoading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await api.sites.submissionsBySite(row.siteId)
|
const res = await api.sites.changesBySite(row.siteId)
|
||||||
historyList.value = res.data || []
|
historyList.value = res.data || []
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error('获取变更记录失败')
|
ElMessage.error('获取变更记录失败')
|
||||||
@@ -262,7 +262,7 @@ const fetchAll = async () => {
|
|||||||
try {
|
try {
|
||||||
const [siteRes, subRes] = await Promise.all([
|
const [siteRes, subRes] = await Promise.all([
|
||||||
api.sites.adminList(),
|
api.sites.adminList(),
|
||||||
api.sites.pendingSubmissions(),
|
api.sites.pendingChanges(),
|
||||||
])
|
])
|
||||||
sites.value = siteRes.data || []
|
sites.value = siteRes.data || []
|
||||||
submissions.value = subRes.data || []
|
submissions.value = subRes.data || []
|
||||||
@@ -275,7 +275,7 @@ const fetchAll = async () => {
|
|||||||
|
|
||||||
const handleApprove = async (row) => {
|
const handleApprove = async (row) => {
|
||||||
try {
|
try {
|
||||||
await api.sites.approveSubmission(row.id)
|
await api.sites.approveChange(row.id)
|
||||||
ElMessage.success('已通过')
|
ElMessage.success('已通过')
|
||||||
fetchAll()
|
fetchAll()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -287,7 +287,7 @@ const handleReject = async (row) => {
|
|||||||
try {
|
try {
|
||||||
const name = (row.names || [])[0] || row.siteId
|
const name = (row.names || [])[0] || row.siteId
|
||||||
await ElMessageBox.confirm(`确认拒绝 "${name}" 的提交?`, '警告', { type: 'warning' })
|
await ElMessageBox.confirm(`确认拒绝 "${name}" 的提交?`, '警告', { type: 'warning' })
|
||||||
await api.sites.rejectSubmission(row.id)
|
await api.sites.rejectChange(row.id)
|
||||||
ElMessage.success('已拒绝')
|
ElMessage.success('已拒绝')
|
||||||
fetchAll()
|
fetchAll()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user