Compare commits
No commits in common. "master" and "lm/feat/outputfile" have entirely different histories.
master
...
lm/feat/ou
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,4 +7,3 @@ pnpm-debug
|
||||
auto-*.d.ts
|
||||
.idea
|
||||
.history
|
||||
.omc/
|
||||
|
||||
@ -34,8 +34,6 @@ const include = [
|
||||
'markmap-toolbar',
|
||||
'highlight.js',
|
||||
'element-plus',
|
||||
'html-docx-js-typescript',
|
||||
'file-saver',
|
||||
'element-plus/es',
|
||||
'element-plus/es/locale/lang/zh-cn',
|
||||
'element-plus/es/locale/lang/en',
|
||||
|
||||
@ -50,8 +50,10 @@
|
||||
"echarts-wordcloud": "^2.1.0",
|
||||
"element-plus": "2.11.1",
|
||||
"fast-xml-parser": "^4.3.2",
|
||||
"file-saver": "^2.0.5",
|
||||
"highlight.js": "^11.9.0",
|
||||
"html-docx-js": "^0.3.1",
|
||||
"html-docx-js-typescript": "^0.1.5",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"jsoneditor": "^10.1.3",
|
||||
"lodash-es": "^4.17.21",
|
||||
@ -113,8 +115,6 @@
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-vue": "^9.22.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"html-docx-js-typescript": "^0.1.5",
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8.4.35",
|
||||
"postcss-html": "^1.6.0",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@ -83,12 +83,18 @@ importers:
|
||||
fast-xml-parser:
|
||||
specifier: ^4.3.2
|
||||
version: 4.5.0
|
||||
file-saver:
|
||||
specifier: ^2.0.5
|
||||
version: 2.0.5
|
||||
highlight.js:
|
||||
specifier: ^11.9.0
|
||||
version: 11.10.0
|
||||
html-docx-js:
|
||||
specifier: ^0.3.1
|
||||
version: 0.3.1
|
||||
html-docx-js-typescript:
|
||||
specifier: ^0.1.5
|
||||
version: 0.1.5
|
||||
jsencrypt:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
@ -267,12 +273,6 @@ importers:
|
||||
eslint-plugin-vue:
|
||||
specifier: ^9.22.0
|
||||
version: 9.31.0(eslint@8.57.1)
|
||||
file-saver:
|
||||
specifier: ^2.0.5
|
||||
version: 2.0.5
|
||||
html-docx-js-typescript:
|
||||
specifier: ^0.1.5
|
||||
version: 0.1.5
|
||||
lint-staged:
|
||||
specifier: ^15.2.2
|
||||
version: 15.2.10
|
||||
|
||||
@ -108,7 +108,7 @@ export const AreaApi = {
|
||||
|
||||
/** 批量删除监区信息 */
|
||||
deleteAreaList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/area/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/area/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出监区信息 Excel
|
||||
|
||||
@ -74,7 +74,7 @@ export const CellApi = {
|
||||
|
||||
// 批量删除监室信息
|
||||
deleteCellList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/cell/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/cell/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
// 导出监室信息 Excel
|
||||
|
||||
@ -79,7 +79,7 @@ export const ConsumptionApi = {
|
||||
|
||||
/** 批量删除消费订单 */
|
||||
deleteConsumptionList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/consumption/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/consumption/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 查询消费明细列表
|
||||
|
||||
@ -231,13 +231,6 @@ export interface PrisonerDashboardStatsRespVO {
|
||||
riskScore: number // 风险评估分
|
||||
riskLevel: number // 风险等级
|
||||
|
||||
// 累计数据
|
||||
violationCount: number // 累计违规次数
|
||||
praiseDays: string // 累计表扬天数
|
||||
praiseCount: number // 累计表扬次数
|
||||
penaltyCount: number // 累计扣分次数
|
||||
rewardCount: number // 累计加分次数
|
||||
|
||||
// 中心数据
|
||||
centerLeftData: CenterLeftData
|
||||
centerRightData: CenterRightData
|
||||
|
||||
@ -182,7 +182,7 @@ export const TemplateApi = {
|
||||
},
|
||||
|
||||
deleteTemplateList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/template/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/template/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
getEnabledTemplateList: async () => {
|
||||
@ -220,7 +220,7 @@ export const DimensionApi = {
|
||||
},
|
||||
|
||||
deleteDimensionList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/dimension/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/dimension/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
getDimensionsByTemplateId: async (templateId: number) => {
|
||||
@ -262,7 +262,7 @@ export const ReportApi = {
|
||||
},
|
||||
|
||||
deleteReportList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/report/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/report/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
submitReport: async (id: number) => {
|
||||
@ -383,7 +383,7 @@ export const CommentApi = {
|
||||
},
|
||||
|
||||
deleteCommentList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/comment/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/comment/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
getCommentsByTypeAndLevel: async (commentType: number, level?: number) => {
|
||||
|
||||
@ -162,7 +162,7 @@ export const EvaluationTemplateApi = {
|
||||
|
||||
// 批量删除模板
|
||||
deleteTemplateList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/template/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/template/delete-list?ids=' + ids.join(',') })
|
||||
},
|
||||
|
||||
// 获取启用的模板列表
|
||||
@ -216,7 +216,7 @@ export const EvaluationDimensionApi = {
|
||||
|
||||
// 批量删除维度
|
||||
deleteDimensionList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/dimension/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/dimension/delete-list?ids=' + ids.join(',') })
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ export const EvaluationReportApi = {
|
||||
|
||||
// 批量删除报告
|
||||
deleteReportList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/report/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/report/delete-list?ids=' + ids.join(',') })
|
||||
},
|
||||
|
||||
// 提交审核
|
||||
@ -324,7 +324,7 @@ export const ReportCommentApi = {
|
||||
|
||||
// 批量删除评语
|
||||
deleteCommentList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/evaluation-report/comment/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/evaluation-report/comment/delete-list?ids=' + ids.join(',') })
|
||||
},
|
||||
|
||||
// 获取评语详情
|
||||
|
||||
@ -89,18 +89,10 @@ export const PrisonerApi = {
|
||||
getPage: (params: PageParam) => {
|
||||
return request.get({ url: '/prison/prisoner/page', params })
|
||||
},
|
||||
// 分页查询(别名,用于选择犯人弹窗)
|
||||
getPrisonerPage: (params: PageParam) => {
|
||||
return request.get({ url: '/prison/prisoner/page', params })
|
||||
},
|
||||
// 获取详情
|
||||
get: (id: number) => {
|
||||
return request.get({ url: '/prison/prisoner/get', params: { id } })
|
||||
},
|
||||
// 获取详情(别名,与其他模块保持一致)
|
||||
getPrisoner: (id: number) => {
|
||||
return request.get({ url: '/prison/prisoner/get', params: { id } })
|
||||
},
|
||||
// 创建
|
||||
create: (data: PrisonerCreateVO) => {
|
||||
return request.post({ url: '/prison/prisoner/create', data })
|
||||
@ -115,7 +107,7 @@ export const PrisonerApi = {
|
||||
},
|
||||
// 批量删除
|
||||
deleteList: (ids: number[]) => {
|
||||
return request.post({ url: '/prison/prisoner/delete-list', data: ids })
|
||||
return request.delete({ url: '/prison/prisoner/delete-list', params: { ids: ids.join(',') } })
|
||||
},
|
||||
// 导出
|
||||
export: (params: PageParam) => {
|
||||
|
||||
@ -73,7 +73,7 @@ export const QuestionApi = {
|
||||
|
||||
/** 批量删除问卷问题 */
|
||||
deleteQuestionList: async (ids: number[]) => {
|
||||
return await request.post<boolean>({ url: `/prison/question/delete-list`, data: ids })
|
||||
return await request.delete<boolean>({ url: `/prison/question/delete-list`, params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
// 批量更新问卷问题(使用POST方法,与后端一致)
|
||||
|
||||
@ -108,8 +108,6 @@ export interface TaskAreaStatistics {
|
||||
|
||||
/** 人员填写进度 */
|
||||
export interface PrisonerProgress {
|
||||
questionnaireId: number
|
||||
questionnaireName?: string
|
||||
id: number
|
||||
prisonerId: number
|
||||
prisonerNo: string
|
||||
@ -164,7 +162,7 @@ export const QuestionnaireTaskApi = {
|
||||
|
||||
// 批量删除问卷任务
|
||||
deleteQuestionnaireTaskList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/questionnaire-task/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/questionnaire-task/delete-list`, params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
// 导出问卷任务 Excel
|
||||
|
||||
@ -65,7 +65,7 @@ export const QuestionnaireApi = {
|
||||
|
||||
/** 批量删除问卷模板 */
|
||||
deleteQuestionnaireList: async (ids: number[]) => {
|
||||
return await request.post<boolean>({ url: `/prison/questionnaire/delete-list`, data: ids })
|
||||
return await request.delete<boolean>({ url: `/prison/questionnaire/delete-list`, params: { ids: ids.join(',') } })
|
||||
},
|
||||
|
||||
// 导出问卷模板 Excel
|
||||
|
||||
@ -92,7 +92,7 @@ export const QuickCommentApi = {
|
||||
|
||||
// 批量删除评语
|
||||
deleteList: async (ids: number[]) => {
|
||||
return await request.post({ url: '/prison/quick-comment/delete-list', data: ids })
|
||||
return await request.delete({ url: '/prison/quick-comment/delete-list?ids=' + ids.join(',') })
|
||||
},
|
||||
|
||||
// 导入评语
|
||||
|
||||
@ -67,7 +67,7 @@ export const ReleaseApi = {
|
||||
return request.delete({ url: `/prison/release/delete?id=${id}` })
|
||||
},
|
||||
deleteReleaseList: (ids: number[]) => {
|
||||
return request.post({ url: '/prison/release/delete-list', data: ids })
|
||||
return request.delete({ url: `/prison/release/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
doRelease: (id: number) => {
|
||||
return request.post({ url: `/prison/release/do-release?id=${id}` })
|
||||
|
||||
@ -113,7 +113,7 @@ export const RiskApi = {
|
||||
|
||||
/** 批量删除风险评估 */
|
||||
deleteRiskList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/risk/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/risk/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出风险评估 Excel
|
||||
|
||||
@ -20,7 +20,7 @@ export interface RiskAssessment {
|
||||
id: number // 评估ID
|
||||
prisonerId?: number // 罪犯ID
|
||||
prisonerNo?: string // 罪犯编号
|
||||
prisonerName?: string // 罪犯姓名(用于回显)
|
||||
prisonerName?: string // 罪犯姓名
|
||||
assessmentType?: number // 评估类型:1-入狱评估 2-定期评估 3-专项评估
|
||||
assessmentDate?: string // 评估日期
|
||||
violenceScore: number // 暴力倾向得分
|
||||
@ -31,7 +31,7 @@ export interface RiskAssessment {
|
||||
riskFactors: string // 风险因素
|
||||
suggestions: string // 管控建议
|
||||
// assessorId 和 assessorName 由后端自动从登录上下文获取,不需要前端传递
|
||||
nextAssessmentDate?: string // 下次评估日期
|
||||
nextAssessmentDate: string // 下次评估日期
|
||||
status?: number // 状态:1-待审核 2-已通过
|
||||
remark: string // 备注
|
||||
createTime?: string // 创建时间
|
||||
@ -66,7 +66,7 @@ export const RiskAssessmentApi = {
|
||||
|
||||
/** 批量删除危险评估 */
|
||||
deleteRiskAssessmentList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/risk-assessment/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/risk-assessment/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出危险评估 Excel
|
||||
|
||||
@ -58,7 +58,7 @@ export const ScoreDetailApi = {
|
||||
return request.delete({ url: `/prison/score-detail/delete?id=${id}` })
|
||||
},
|
||||
deleteList: (ids: number[]) => {
|
||||
return request.post({ url: '/prison/score-detail/delete-list', data: ids })
|
||||
return request.delete({ url: `/prison/score-detail/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
export: (params: ScoreDetailPageReqVO) => {
|
||||
return request.download({ url: '/prison/score-detail/export-excel', params })
|
||||
|
||||
@ -56,7 +56,7 @@ export const ScoreRuleApi = {
|
||||
return request.delete({ url: `/prison/score-rule/delete?id=${id}` })
|
||||
},
|
||||
deleteRuleList: (ids: number[]) => {
|
||||
return request.post({ url: '/prison/score-rule/delete-list', data: ids })
|
||||
return request.delete({ url: `/prison/score-rule/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
getRuleByCategory: (category: number) => {
|
||||
return request.get({ url: `/prison/score-rule/list-by-category?category=${category}` })
|
||||
|
||||
@ -68,7 +68,7 @@ export const ScoreApi = {
|
||||
|
||||
/** 批量删除计分考核 */
|
||||
deleteScoreList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/score/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/score/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出计分考核 Excel
|
||||
|
||||
@ -106,7 +106,7 @@ export const SituationApi = {
|
||||
|
||||
/** 批量删除狱情收集 */
|
||||
deleteSituationList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/situation/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/situation/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出狱情收集 Excel
|
||||
|
||||
@ -161,7 +161,7 @@ export const WarningApi = {
|
||||
|
||||
/** 批量删除预警 */
|
||||
deleteWarningList: async (ids: number[]) => {
|
||||
return await request.post({ url: `/prison/warning/delete-list`, data: ids })
|
||||
return await request.delete({ url: `/prison/warning/delete-list?ids=${ids.join(',')}` })
|
||||
},
|
||||
|
||||
// 导出预警 Excel
|
||||
|
||||
@ -70,9 +70,10 @@ service.interceptors.request.use(
|
||||
}
|
||||
}
|
||||
// 监狱系统:即使 tenantEnable 为 false,也尝试获取并设置租户 ID
|
||||
// 如果缓存中没有租户 ID,使用默认值 1
|
||||
const tenantId = getTenantId() || 1
|
||||
config.headers['tenant-id'] = tenantId
|
||||
const tenantId = getTenantId()
|
||||
if (tenantId) {
|
||||
config.headers['tenant-id'] = tenantId
|
||||
}
|
||||
const method = config.method?.toUpperCase()
|
||||
// 防止 GET 请求缓存
|
||||
if (method === 'GET') {
|
||||
|
||||
@ -55,15 +55,7 @@ const whiteList = [
|
||||
'/register',
|
||||
'/oauthLogin/gitee',
|
||||
'/prisoner/prisoner/dashboard', // Dashboard 页面
|
||||
'/ai-dash-entry', // DashEntry 页面
|
||||
// 监狱模块路由(解决SPA路由重定向问题)
|
||||
'/prison/template', // 问卷模版管理
|
||||
'/prison/questionnaire', // 问卷任务管理
|
||||
'/prison/guard', // 狱警管理
|
||||
// AI指导建议路由(evaluation-mgmt)
|
||||
'/prison/evaluation-mgmt/template', // 评估模板管理
|
||||
'/prison/evaluation-mgmt/dimension', // 评估维度管理
|
||||
'/prison/evaluation-mgmt/report', // 评估报告管理
|
||||
'/ai-dash-entry' // DashEntry 页面
|
||||
]
|
||||
|
||||
// 路由加载前
|
||||
|
||||
@ -10,19 +10,20 @@
|
||||
<div class="dashboard-content-top-center">
|
||||
<div class="gauge-container">
|
||||
<div class="dashboard-content-top-center-data">
|
||||
<!-- 左侧区域:上1下2排列 -->
|
||||
<div class="info-field-item top-field">
|
||||
<div class="field-label">累计服刑天数</div>
|
||||
<div class="field-value">{{ servedDays }}</div>
|
||||
<!-- 左侧第一个卡片 -->
|
||||
<div class="info-card-item">
|
||||
<div class="card-number">{{ centerLeftData.top.value }}</div>
|
||||
<div class="card-label">{{ centerLeftData.top.label }}</div>
|
||||
</div>
|
||||
<!-- 左侧第二个卡片 -->
|
||||
<div class="card-row">
|
||||
<div class="info-field-item">
|
||||
<div class="field-label">累计违规次数</div>
|
||||
<div class="field-value">{{ violationCount }}</div>
|
||||
<div class="info-card-item center-right-card-item">
|
||||
<div class="card-number">{{ centerLeftData.middle.left.value }}</div>
|
||||
<div class="card-label">{{ centerLeftData.middle.left.label }}</div>
|
||||
</div>
|
||||
<div class="info-field-item">
|
||||
<div class="field-label">累计表扬次数</div>
|
||||
<div class="field-value">{{ praiseCount }}</div>
|
||||
<div class="info-card-item center-right-card-item">
|
||||
<div class="card-number">{{ centerLeftData.middle.right.value }}</div>
|
||||
<div class="card-label">{{ centerLeftData.middle.right.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -30,19 +31,20 @@
|
||||
<GaugeChart :height="'240px'" :value="gaugeValue" :name="gaugeName" />
|
||||
</div>
|
||||
<div class="dashboard-content-top-center-data">
|
||||
<!-- 右侧区域:上1下2排列 -->
|
||||
<div class="info-field-item top-field">
|
||||
<div class="field-label">剩余刑期天数</div>
|
||||
<div class="field-value">{{ remainingDays }}</div>
|
||||
<!-- 右侧第一个卡片 -->
|
||||
<div class="info-card-item">
|
||||
<div class="card-number">{{ centerRightData.top.value }}</div>
|
||||
<div class="card-label">{{ centerRightData.top.label }}</div>
|
||||
</div>
|
||||
<!-- 右侧第二个卡片 -->
|
||||
<div class="card-row">
|
||||
<div class="info-field-item">
|
||||
<div class="field-label">累计扣分次数</div>
|
||||
<div class="field-value">{{ penaltyCount }}</div>
|
||||
<div class="info-card-item center-right-card-item">
|
||||
<div class="card-number">{{ centerRightData.middle.left.value }}</div>
|
||||
<div class="card-label">{{ centerRightData.middle.left.label }}</div>
|
||||
</div>
|
||||
<div class="info-field-item">
|
||||
<div class="field-label">累计加分次数</div>
|
||||
<div class="field-value">{{ rewardCount }}</div>
|
||||
<div class="info-card-item center-right-card-item">
|
||||
<div class="card-number">{{ centerRightData.middle.right.value }}</div>
|
||||
<div class="card-label">{{ centerRightData.middle.right.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -83,7 +85,7 @@
|
||||
</div>
|
||||
<div class="dashboard-content-bottom-right">
|
||||
<div class="dashboard-content-bottom-right-title">大帐统计</div>
|
||||
<BarChart :data="barChartData" :balance="balance" />
|
||||
<BarChart :height="'200px'" :data="barChartData" :card-data="barCardData" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -169,8 +171,12 @@ const centerRightData = ref({
|
||||
// 柱状图数据
|
||||
const barChartData = ref<{ category: string; monthlyStandard: number; perCapita: number }[]>([])
|
||||
|
||||
// 账户余额
|
||||
const balance = ref(0)
|
||||
// 卡片数据
|
||||
const barCardData = ref({
|
||||
inProgress: 0,
|
||||
toWarehouse: 0,
|
||||
outWarehouse: 0
|
||||
})
|
||||
|
||||
// 基本信息数据
|
||||
const basicInfo = ref({
|
||||
@ -240,16 +246,6 @@ const rewardsPunishments = ref<{
|
||||
const currentTime = ref('')
|
||||
const prisonerName = ref('加载中...')
|
||||
|
||||
// 左侧区域三个字段数据
|
||||
const servedDays = ref(0)
|
||||
const violationCount = ref(0)
|
||||
const praiseCount = ref(0)
|
||||
|
||||
// 右侧区域三个字段数据
|
||||
const remainingDays = ref(0)
|
||||
const penaltyCount = ref(0)
|
||||
const rewardCount = ref(0)
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = () => {
|
||||
const now = new Date()
|
||||
@ -283,14 +279,13 @@ const loadData = async (prisonerId: number) => {
|
||||
gaugeName.value = ''
|
||||
|
||||
// 计算累计服刑天数和剩余刑期天数
|
||||
const servedDaysValue = res.servedDays || 0;
|
||||
servedDays.value = servedDaysValue
|
||||
remainingDays.value = 0;
|
||||
const servedDays = res.servedDays || 0;
|
||||
let remainingDays = 0;
|
||||
if (res.imprisonmentDate && res.releaseDate) {
|
||||
const startDate = new Date(res.imprisonmentDate);
|
||||
const endDate = new Date(res.releaseDate);
|
||||
const totalDays = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
|
||||
remainingDays.value = Math.max(0, totalDays - servedDaysValue);
|
||||
remainingDays = Math.max(0, totalDays - servedDays);
|
||||
}
|
||||
|
||||
// 获取计分考核数据 - 累计扣分次数和累计加分次数
|
||||
@ -310,10 +305,6 @@ const loadData = async (prisonerId: number) => {
|
||||
console.error('获取计分考核数据失败:', error)
|
||||
}
|
||||
|
||||
// 更新右侧区域三个字段数据
|
||||
penaltyCount.value = totalPenaltyCount
|
||||
rewardCount.value = totalRewardCount
|
||||
|
||||
// 获取狱情收集数据 - 累计违规次数
|
||||
let totalViolationCount = 0
|
||||
try {
|
||||
@ -328,10 +319,6 @@ const loadData = async (prisonerId: number) => {
|
||||
console.error('获取狱情收集数据失败:', error)
|
||||
}
|
||||
|
||||
// 更新左侧区域三个字段数据
|
||||
violationCount.value = totalViolationCount
|
||||
praiseCount.value = res.praiseCount || 0
|
||||
|
||||
// 更新中心左侧数据
|
||||
if (res.centerLeftData) {
|
||||
centerLeftData.value = {
|
||||
@ -387,8 +374,14 @@ const loadData = async (prisonerId: number) => {
|
||||
// 更新柱状图数据
|
||||
barChartData.value = res.consumptionMonthlyData || []
|
||||
|
||||
// 更新账户余额
|
||||
balance.value = res.balance || 0
|
||||
// 更新消费汇总
|
||||
if (res.consumptionSummary) {
|
||||
barCardData.value = {
|
||||
inProgress: res.consumptionSummary.inProgress || 0,
|
||||
toWarehouse: res.consumptionSummary.toWarehouse || 0,
|
||||
outWarehouse: res.consumptionSummary.outWarehouse || 0
|
||||
}
|
||||
}
|
||||
|
||||
// 更新基本信息
|
||||
basicInfo.value = {
|
||||
@ -396,7 +389,7 @@ const loadData = async (prisonerId: number) => {
|
||||
prisonNumber: res.prisonerNo || '',
|
||||
sentenceStart: res.imprisonmentDate || '',
|
||||
sentenceEnd: res.releaseDate || '',
|
||||
sentenceDays: res.sentenceDays || 0,
|
||||
sentenceDays: res.servedDays || 0,
|
||||
age: res.age || 0,
|
||||
hometown: res.nativePlace || '',
|
||||
education: res.education || '',
|
||||
@ -557,7 +550,7 @@ onUnmounted(() => {
|
||||
.list-card-item {
|
||||
width: 25%;
|
||||
height: 90%;
|
||||
background: rgba(45, 65, 131, 0.6);
|
||||
background: #2d3d5f;
|
||||
border: 1px solid rgba(56, 102, 141, 0.5);
|
||||
display: flex;
|
||||
padding-left: 15px;
|
||||
@ -600,55 +593,6 @@ onUnmounted(() => {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
// 纵向字段项样式
|
||||
.info-field-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px 16px;
|
||||
background: rgba(45, 65, 131, 0.6);
|
||||
border: 1px solid rgba(56, 102, 141, 0.5);
|
||||
border-radius: 6px;
|
||||
box-shadow: inset 0 0 10px 0 rgba(43, 65, 131, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: rgba(56, 102, 141, 0.8);
|
||||
box-shadow: inset 0 0 15px 0 rgba(43, 65, 131, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
// 顶部字段样式(用于上1下2布局中的顶部字段)
|
||||
.top-field {
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// 字段标签样式
|
||||
.field-label {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
// 字段数值样式
|
||||
.field-value {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dashboard-content-top-center-center {
|
||||
width: 40%;
|
||||
height: 220px;
|
||||
|
||||
@ -1,7 +1,22 @@
|
||||
<template>
|
||||
<div class="supply-chart-container" ref="containerRef">
|
||||
<div class="supply-chart-container">
|
||||
<!-- 卡片统计 -->
|
||||
<div class="chart-cards">
|
||||
<div class="chart-card-item">
|
||||
<div class="card-value">{{ cardData.inProgress }}</div>
|
||||
<div class="card-label">进行中</div>
|
||||
</div>
|
||||
<div class="chart-card-item">
|
||||
<div class="card-value">{{ cardData.toWarehouse }}</div>
|
||||
<div class="card-label">待入库</div>
|
||||
</div>
|
||||
<div class="chart-card-item">
|
||||
<div class="card-value">{{ cardData.outWarehouse }}</div>
|
||||
<div class="card-label">已出库</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 柱状图 -->
|
||||
<EChart ref="chartRef" :options="barOption" :height="height" />
|
||||
<EChart :options="barOption" :height="height" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -9,7 +24,7 @@
|
||||
import type { EChartsOption } from 'echarts'
|
||||
// @ts-ignore
|
||||
import EChart from '@/components/Echart/src/Echart.vue'
|
||||
import { computed, ref, onMounted, watch } from 'vue'
|
||||
import { computed, watch } from 'vue'
|
||||
|
||||
defineOptions({ name: 'BarChart' })
|
||||
|
||||
@ -19,45 +34,49 @@ interface ChartDataItem {
|
||||
perCapita: number
|
||||
}
|
||||
|
||||
interface CardData {
|
||||
inProgress: number
|
||||
toWarehouse: number
|
||||
outWarehouse: number
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
width?: number | string
|
||||
width?: number
|
||||
height?: string
|
||||
data?: ChartDataItem[]
|
||||
balance?: number
|
||||
cardData?: CardData
|
||||
}>(),
|
||||
{
|
||||
width: '100%',
|
||||
width: 400,
|
||||
height: '300px',
|
||||
data: () => [],
|
||||
balance: () => 0
|
||||
cardData: () => ({
|
||||
inProgress: 5,
|
||||
toWarehouse: 5,
|
||||
outWarehouse: 5
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
const containerRef = ref<HTMLElement>()
|
||||
const chartRef = ref()
|
||||
|
||||
// 创建图表配置
|
||||
const createChartOption = (): EChartsOption => {
|
||||
const categories = props.data.map((item) => item.category)
|
||||
const monthlyStandardData = props.data.map((item) => item.monthlyStandard ?? 0)
|
||||
const perCapitaData = props.data.map((item) => item.perCapita ?? 0)
|
||||
|
||||
// 动态计算最大值,确保能够显示所有数据
|
||||
const maxDataValue = Math.max(...monthlyStandardData, ...perCapitaData, 100)
|
||||
// 向上取整到百位,并留出 20% 空间
|
||||
const maxValue = Math.ceil(maxDataValue * 1.2 / 100) * 100
|
||||
|
||||
// 创建底色数据(填充到 maxValue)
|
||||
const monthlyStandardBgData = categories.map((_, index) => Math.max(0, maxValue - monthlyStandardData[index]))
|
||||
const perCapitaBgData = categories.map((_, index) => Math.max(0, maxValue - perCapitaData[index]))
|
||||
// 创建底色数据(最大值50)
|
||||
const maxValue = 50
|
||||
const monthlyStandardBgData = categories.map((_, index) => maxValue - monthlyStandardData[index])
|
||||
const perCapitaBgData = categories.map((_, index) => maxValue - perCapitaData[index])
|
||||
|
||||
return {
|
||||
backgroundColor: 'transparent',
|
||||
grid: {
|
||||
left: '8%',
|
||||
right: '8%',
|
||||
top: '25%',
|
||||
bottom: '18%',
|
||||
left: '10%',
|
||||
right: '15%',
|
||||
top: '20%',
|
||||
bottom: '15%',
|
||||
containLabel: false
|
||||
},
|
||||
xAxis: {
|
||||
@ -81,8 +100,8 @@ const createChartOption = (): EChartsOption => {
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: 0,
|
||||
max: maxValue,
|
||||
interval: Math.ceil(maxValue / 5 / 100) * 100,
|
||||
max: 50,
|
||||
interval: 10,
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
@ -91,8 +110,7 @@ const createChartOption = (): EChartsOption => {
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#D8F0FF',
|
||||
fontSize: 10,
|
||||
formatter: (value: number) => value.toString()
|
||||
fontSize: 10
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
@ -101,33 +119,17 @@ const createChartOption = (): EChartsOption => {
|
||||
}
|
||||
}
|
||||
},
|
||||
// 图例和余额放在同一行
|
||||
legend: {
|
||||
data: [
|
||||
{ name: '支出', icon: 'rect' },
|
||||
{ name: '收入', icon: 'rect' }
|
||||
],
|
||||
top: '3%',
|
||||
left: '8%',
|
||||
data: ['支出', '收入'],
|
||||
top: '5%',
|
||||
right: '10%',
|
||||
textStyle: {
|
||||
color: '#6D869A',
|
||||
fontSize: 10
|
||||
fontSize: 9
|
||||
},
|
||||
itemWidth: 12,
|
||||
itemHeight: 8,
|
||||
itemGap: 15
|
||||
},
|
||||
// 使用 title 显示余额,放在图例右侧
|
||||
title: {
|
||||
text: `账户余额: ${props.balance}元`,
|
||||
left: 'auto',
|
||||
right: '8%',
|
||||
top: '3%',
|
||||
textStyle: {
|
||||
color: '#00d4ff',
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
itemWidth: 9,
|
||||
itemHeight: 9,
|
||||
itemGap: 25
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@ -142,6 +144,7 @@ const createChartOption = (): EChartsOption => {
|
||||
},
|
||||
formatter: function (params: any) {
|
||||
let result = params[0].name + '<br/>'
|
||||
// 只显示数据系列,不显示底色系列
|
||||
params.forEach((param: any) => {
|
||||
if (param.seriesName === '支出' || param.seriesName === '收入') {
|
||||
result += param.marker + param.seriesName + ': ' + param.value + '<br/>'
|
||||
@ -151,7 +154,7 @@ const createChartOption = (): EChartsOption => {
|
||||
}
|
||||
},
|
||||
series: [
|
||||
// 支出数据
|
||||
// 支出数据(渐变)- 先绘制,作为底层
|
||||
{
|
||||
name: '支出',
|
||||
type: 'bar',
|
||||
@ -162,36 +165,40 @@ const createChartOption = (): EChartsOption => {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 1,
|
||||
y2: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: '#10A0F2' },
|
||||
{ offset: 0.5, color: '#0D8BD9' },
|
||||
{ offset: 1, color: '#0A6EB0' }
|
||||
{
|
||||
offset: 0,
|
||||
color: '#10A0F2'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(0, 82, 184, 0)'
|
||||
}
|
||||
]
|
||||
},
|
||||
borderRadius: [2, 2, 0, 0]
|
||||
}
|
||||
},
|
||||
barWidth: '25%',
|
||||
barGap: '30%'
|
||||
barWidth: '20%',
|
||||
barGap: '20%'
|
||||
},
|
||||
// 支出底色
|
||||
// 支出底色 - 后绘制,堆叠在数据上方
|
||||
{
|
||||
name: '支出底色',
|
||||
type: 'bar',
|
||||
stack: 'monthly',
|
||||
data: monthlyStandardBgData,
|
||||
itemStyle: {
|
||||
color: 'rgba(56, 102, 141, 0.3)'
|
||||
color: '#38668D70'
|
||||
},
|
||||
barWidth: '25%',
|
||||
barGap: '30%',
|
||||
barWidth: '20%',
|
||||
barGap: '20%',
|
||||
silent: true,
|
||||
tooltip: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
// 收入数据
|
||||
// 收入数据(渐变)
|
||||
{
|
||||
name: '收入',
|
||||
type: 'bar',
|
||||
@ -202,30 +209,33 @@ const createChartOption = (): EChartsOption => {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 1,
|
||||
y2: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: '#FFA58D' },
|
||||
{ offset: 0.5, color: '#E88F5A' },
|
||||
{ offset: 1, color: '#D07530' }
|
||||
{
|
||||
offset: 0,
|
||||
color: '#FFA58D'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(87, 140, 205, 0)'
|
||||
}
|
||||
]
|
||||
},
|
||||
borderRadius: [2, 2, 0, 0]
|
||||
}
|
||||
},
|
||||
barWidth: '25%',
|
||||
barGap: '30%'
|
||||
barWidth: '20%',
|
||||
barGap: '80%'
|
||||
},
|
||||
// 收入底色
|
||||
{
|
||||
name: '收入底色',
|
||||
type: 'bar',
|
||||
stack: 'perCapita',
|
||||
data: perCapitaBgData,
|
||||
itemStyle: {
|
||||
color: 'rgba(56, 102, 141, 0.3)'
|
||||
color: '#38668D70'
|
||||
},
|
||||
barWidth: '25%',
|
||||
barGap: '30%',
|
||||
barWidth: '20%',
|
||||
barGap: '80%',
|
||||
silent: true,
|
||||
tooltip: {
|
||||
show: false
|
||||
@ -237,6 +247,15 @@ const createChartOption = (): EChartsOption => {
|
||||
|
||||
// 柱状图配置
|
||||
const barOption = computed(() => createChartOption())
|
||||
|
||||
// 监听数据变化,更新图表
|
||||
watch(
|
||||
() => [props.data, props.cardData],
|
||||
() => {
|
||||
// 数据变化时,computed 会自动更新
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -246,4 +265,30 @@ const barOption = computed(() => createChartOption())
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chart-cards {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.chart-card-item {
|
||||
text-align: center;
|
||||
padding: 4px;
|
||||
background: rgba(56, 102, 141, 0.3);
|
||||
border-radius: 8px;
|
||||
min-width: 100px;
|
||||
|
||||
.card-value {
|
||||
font-size: 1.6vh;
|
||||
font-weight: bold;
|
||||
color: #00d4ff;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-label {
|
||||
font-size: 1.5vh;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<div class="info-tag">{{ basicInfo.district }}</div>
|
||||
<div class="info-tag">狱政编号: {{ basicInfo.prisonNumber }}</div>
|
||||
<div class="info-tag">
|
||||
刑期:{{ basicInfo.sentenceStart }} --- {{ basicInfo.sentenceEnd }} (总天数:{{
|
||||
刑期起/止日:{{ basicInfo.sentenceStart }}---{{ basicInfo.sentenceEnd }} ({{
|
||||
basicInfo.sentenceDays
|
||||
}}天)
|
||||
</div>
|
||||
|
||||
@ -2,7 +2,18 @@
|
||||
<div class="rewards-punishments-container">
|
||||
<!-- 标题栏 -->
|
||||
<div class="rewards-header">
|
||||
<span class="header-title">风险评估</span>
|
||||
<span class="header-title">近期奖惩</span>
|
||||
<div class="filter-tabs">
|
||||
<div
|
||||
v-for="tab in filterTabs"
|
||||
:key="tab.value"
|
||||
class="filter-tab"
|
||||
:class="{ active: activeFilter === tab.value }"
|
||||
@click="activeFilter = tab.value"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间线列表 -->
|
||||
@ -10,7 +21,7 @@
|
||||
<div class="timeline-content">
|
||||
<div class="timeline-line"></div>
|
||||
<div class="timeline-items">
|
||||
<div v-for="(item, index) in listData" :key="index" class="timeline-item">
|
||||
<div v-for="(item, index) in filteredList" :key="index" class="timeline-item">
|
||||
<div class="timeline-dot" :class="item.type"></div>
|
||||
<div class="timeline-card">
|
||||
<div class="card-type" :class="item.type">{{ item.typeText }}</div>
|
||||
@ -24,7 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, computed, watch } from 'vue'
|
||||
|
||||
defineOptions({ name: 'RecentRewardsPunishments' })
|
||||
|
||||
@ -35,9 +46,29 @@ interface RewardPunishmentItem {
|
||||
content: string // 内容
|
||||
}
|
||||
|
||||
// 过滤标签
|
||||
const filterTabs = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '奖励记录', value: 'reward' },
|
||||
{ label: '惩罚记录', value: 'punishment' }
|
||||
]
|
||||
|
||||
const activeFilter = ref<string>('all')
|
||||
|
||||
// 数据列表 - 使用 ref 存储
|
||||
const listData = ref<RewardPunishmentItem[]>([])
|
||||
|
||||
// 过滤后的列表
|
||||
const filteredList = computed(() => {
|
||||
if (activeFilter.value === 'all') {
|
||||
return listData.value
|
||||
} else if (activeFilter.value === 'reward') {
|
||||
return listData.value.filter((item) => item.type === 'reward')
|
||||
} else {
|
||||
return listData.value.filter((item) => item.type === 'danger')
|
||||
}
|
||||
})
|
||||
|
||||
// 可以通过 props 接收外部数据
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -87,6 +118,24 @@ watch(
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.filter-tabs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.filter-tab {
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
background: rgba(56, 102, 141, 0.2);
|
||||
border-radius: 4px;
|
||||
|
||||
&.active {
|
||||
background: #37599d;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
// 时间线容器
|
||||
.timeline-container {
|
||||
flex: 1 1 0;
|
||||
|
||||
@ -351,10 +351,6 @@ watch(
|
||||
onMounted(() => {
|
||||
getLoginFormCache()
|
||||
getTenantByWebsite()
|
||||
// 初始化租户 ID - 确保登录前缓存中有租户 ID
|
||||
if (!authUtil.getTenantId()) {
|
||||
authUtil.setTenantId(Number(loginData.loginForm.tenantName) || 1)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,16 +1,8 @@
|
||||
<template>
|
||||
<Dialog title="消费明细" v-model="dialogVisible" width="600px">
|
||||
<el-table :data="detailList" v-loading="loading">
|
||||
<el-table-column label="商品名称" prop="goodsName" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.goodsName || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" prop="goodsCode" align="center" width="120">
|
||||
<template #default="{ row }">
|
||||
{{ row.goodsCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" prop="goodsName" align="center" />
|
||||
<el-table-column label="商品编码" prop="goodsCode" align="center" width="120" />
|
||||
<el-table-column label="单价" prop="goodsPrice" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
¥{{ row.goodsPrice?.toFixed(2) }}
|
||||
|
||||
@ -9,13 +9,13 @@
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="服刑人员">
|
||||
<el-input v-model="formData.prisonerName" placeholder="服刑人员姓名" disabled />
|
||||
<el-form-item label="罪犯ID" prop="prisonerId">
|
||||
<el-input v-model="formData.prisonerId" placeholder="请输入罪犯ID" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="罪犯编号" prop="prisonerNo">
|
||||
<el-input v-model="formData.prisonerNo" placeholder="罪犯编号" disabled />
|
||||
<el-input v-model="formData.prisonerNo" placeholder="请输入罪犯编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -135,7 +135,6 @@ const formType = ref('')
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
prisonerId: undefined,
|
||||
prisonerName: undefined,
|
||||
prisonerNo: undefined,
|
||||
orderNo: undefined,
|
||||
type: undefined,
|
||||
@ -229,7 +228,6 @@ const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
prisonerId: undefined,
|
||||
prisonerName: undefined,
|
||||
prisonerNo: undefined,
|
||||
orderNo: undefined,
|
||||
type: undefined,
|
||||
|
||||
@ -77,14 +77,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { EvaluationTemplateApi } from '@/api/prison/evaluation'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
|
||||
defineOptions({ name: 'EvaluationTemplateForm' })
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
// 保存当前编辑的模板ID,用于刷新数据
|
||||
const currentTemplateId = ref<number | undefined>(undefined)
|
||||
|
||||
|
||||
@ -1,41 +1,20 @@
|
||||
<template>
|
||||
<Dialog style="display: none" :title="'评估报告'" v-model="dialogVisible" width="900px">
|
||||
<Dialog style="display: none;" :title="'评估报告'" v-model="dialogVisible" width="900px">
|
||||
<div v-loading="loading" class="report-edit-container" ref="previewRef">
|
||||
<template v-if="selectedReport">
|
||||
<div class="basic-info-title">{{ selectedReport.templateName }}</div>
|
||||
<!-- 基本信息区 -->
|
||||
<div class="basic-info-section">
|
||||
<div class="basic-info-item"
|
||||
>服刑人员:{{ selectedReport.prisonerName }} ({{ selectedReport.prisonerNo }})</div
|
||||
>
|
||||
<div class="basic-info-item">服刑人员:{{ selectedReport.prisonerName }} ({{ selectedReport.prisonerNo }})</div>
|
||||
<div class="basic-info-item">监区:{{ selectedReport.areaName || '-' }}</div>
|
||||
<div class="basic-info-item"
|
||||
>评估日期:{{ formatDateTime(selectedReport.evaluationDate, 'YYYY-MM-DD') }}</div
|
||||
>
|
||||
<div class="basic-info-item"
|
||||
>风险等级:{{
|
||||
getDictLabel(DICT_TYPE.PRISON_RISK_LEVEL, selectedReport.riskLevel)
|
||||
}}</div
|
||||
>
|
||||
<div class="basic-info-item"
|
||||
>状态:{{ getDictLabel(DICT_TYPE.PRISON_REPORT_STATUS, selectedReport.status) }}</div
|
||||
>
|
||||
<div class="basic-info-item">评估日期:{{ formatDateTime(selectedReport.evaluationDate, 'YYYY-MM-DD') }}</div>
|
||||
<div class="basic-info-item">风险等级:{{ getDictLabel(DICT_TYPE.PRISON_RISK_LEVEL, selectedReport.riskLevel) }}</div>
|
||||
<div class="basic-info-item">状态:{{ getDictLabel(DICT_TYPE.PRISON_REPORT_STATUS, selectedReport.status) }}</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="(item, index) in dimensionAnalysisPanelRef"
|
||||
:key="item.id"
|
||||
class="dimension-item"
|
||||
>
|
||||
<div class="dimension-item-title"
|
||||
>{{ ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'][index] }}、{{
|
||||
item.name
|
||||
}}</div
|
||||
>
|
||||
<div style="white-space: pre-line; line-height: 1.5">{{
|
||||
// 移除所有以 '##' 开头、并以两个连续换行结尾的标题块,兼容 CRLF/LF
|
||||
item.aiAnalysis?.replace(/(^|\r?\n)##.*?\r?\n\r?\n/gm, '$1')
|
||||
}}</div>
|
||||
<div v-for="item in dimensionAnalysisPanelRef" :key="item.id" class="dimension-item">
|
||||
<div class="dimension-item-title">{{ item.name }}</div>
|
||||
<div style="white-space: pre-line; line-height: 1.5;">{{ item.aiAnalysis?.replace(/## 综合分析建议\n\n/g, '') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -53,14 +32,7 @@
|
||||
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
||||
import { formatDateTime } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import {
|
||||
ReportApi,
|
||||
ReportVO,
|
||||
DimensionDataApi,
|
||||
DimensionDataVO,
|
||||
DimensionApi,
|
||||
DimensionVO
|
||||
} from '@/api/prison/evaluation-report'
|
||||
import { ReportApi, ReportVO, DimensionDataApi, DimensionDataVO, DimensionApi, DimensionVO } from '@/api/prison/evaluation-report'
|
||||
import { PrisonerApi } from '@/api/prison/prisoner'
|
||||
import { asBlob } from 'html-docx-js-typescript'
|
||||
import { saveAs } from 'file-saver'
|
||||
@ -92,10 +64,8 @@ const open = async (id: number, prisonerId?: number) => {
|
||||
reportId.value = id
|
||||
dialogVisible.value = true
|
||||
await loadReportDetail(id)
|
||||
// 等待视图渲染完成,避免导出时 DOM 仍为空
|
||||
await nextTick()
|
||||
try {
|
||||
await exportToWord()
|
||||
exportToWord()
|
||||
} catch {
|
||||
} finally {
|
||||
handleClose()
|
||||
@ -108,8 +78,7 @@ const loadReportDetail = async (id: number) => {
|
||||
try {
|
||||
selectedReport.value = await ReportApi.getReport(id)
|
||||
dimensionDataList.value = await DimensionDataApi.getDimensionDataListByReportId(id)
|
||||
drawerTitle.value =
|
||||
selectedReport.value?.title || `${selectedReport.value?.prisonerName} - 评估报告`
|
||||
drawerTitle.value = selectedReport.value?.title || `${selectedReport.value?.prisonerName} - 评估报告`
|
||||
|
||||
// 监区信息兜底(报告未返回监区时,从罪犯档案补齐)
|
||||
if (selectedReport.value?.prisonerId && !selectedReport.value.areaName) {
|
||||
@ -123,16 +92,15 @@ const loadReportDetail = async (id: number) => {
|
||||
// 加载维度配置
|
||||
if (selectedReport.value?.templateId) {
|
||||
try {
|
||||
const dimensionList = await DimensionApi.getDimensionsByTemplateId(
|
||||
selectedReport.value.templateId
|
||||
)
|
||||
const dimensionList = await DimensionApi.getDimensionsByTemplateId(selectedReport.value.templateId)
|
||||
if (dimensionList && dimensionList.length > 0) {
|
||||
console.log(dimensionList)
|
||||
console.log(dimensionList);
|
||||
dimensions.value = dimensionList
|
||||
} else {
|
||||
// 使用默认维度配置
|
||||
dimensions.value = getDefaultDimensions(selectedReport.value.templateId)
|
||||
}
|
||||
|
||||
} catch {
|
||||
dimensions.value = getDefaultDimensions(selectedReport.value.templateId)
|
||||
}
|
||||
@ -140,11 +108,11 @@ const loadReportDetail = async (id: number) => {
|
||||
|
||||
if (selectedReport.value?.id && dimensions.value.length > 0) {
|
||||
const list = await DimensionDataApi.getDimensionDataListByReportId(selectedReport.value.id)
|
||||
console.log(list, dimensions.value)
|
||||
dimensionAnalysisPanelRef.value = dimensions.value.map((item) => {
|
||||
console.log(list, dimensions.value);
|
||||
dimensionAnalysisPanelRef.value = dimensions.value.map(item => {
|
||||
return {
|
||||
...item,
|
||||
aiAnalysis: list.find((analys) => analys.dimensionId === item.id)?.aiAnalysis
|
||||
aiAnalysis: list.find(analys => analys.dimensionId === item.id)?.aiAnalysis
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -159,51 +127,11 @@ const loadReportDetail = async (id: number) => {
|
||||
/** 获取默认维度配置 */
|
||||
const getDefaultDimensions = (templateId: number): DimensionVO[] => {
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
templateId,
|
||||
name: '基本信息',
|
||||
dimensionType: 1,
|
||||
aiEnabled: 0,
|
||||
status: 0,
|
||||
dataSources: ['prisoner']
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
templateId,
|
||||
name: '犯罪情况分析',
|
||||
dimensionType: 1,
|
||||
aiEnabled: 1,
|
||||
status: 0,
|
||||
dataSources: ['prisoner', 'risk']
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
templateId,
|
||||
name: '服刑表现评估',
|
||||
dimensionType: 1,
|
||||
aiEnabled: 1,
|
||||
status: 0,
|
||||
dataSources: ['score', 'violation', 'reward']
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
templateId,
|
||||
name: '消费行为分析',
|
||||
dimensionType: 1,
|
||||
aiEnabled: 1,
|
||||
status: 0,
|
||||
dataSources: ['consumption']
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
templateId,
|
||||
name: '综合评估结论',
|
||||
dimensionType: 1,
|
||||
aiEnabled: 1,
|
||||
status: 0,
|
||||
dataSources: ['prisoner', 'psychology']
|
||||
}
|
||||
{ id: 1, templateId, name: '基本信息', dimensionType: 1, aiEnabled: 0, status: 0, dataSources: ['prisoner'] },
|
||||
{ id: 2, templateId, name: '犯罪情况分析', dimensionType: 1, aiEnabled: 1, status: 0, dataSources: ['prisoner', 'risk'] },
|
||||
{ id: 3, templateId, name: '服刑表现评估', dimensionType: 1, aiEnabled: 1, status: 0, dataSources: ['score', 'violation', 'reward'] },
|
||||
{ id: 4, templateId, name: '消费行为分析', dimensionType: 1, aiEnabled: 1, status: 0, dataSources: ['consumption'] },
|
||||
{ id: 5, templateId, name: '综合评估结论', dimensionType: 1, aiEnabled: 1, status: 0, dataSources: ['prisoner', 'psychology'] }
|
||||
]
|
||||
}
|
||||
|
||||
@ -261,36 +189,40 @@ const exportToWord = async () => {
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
/* 使用 pt 单位以避免 Word/WPS 在 px->pt 换算时产生差异 */
|
||||
body {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
font-size: 11pt;
|
||||
line-height: 1.5;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
.basic-info-title{
|
||||
font-size: 18pt;
|
||||
font-family: '黑体', 'Microsoft YaHei', SimSun, Arial, sans-serif;
|
||||
font-size: 21px;
|
||||
font-weight: 700;
|
||||
color: black;
|
||||
text-align: center;
|
||||
margin-bottom: 15pt;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.basic-info-section {
|
||||
padding: 15px 20px;
|
||||
color: black;
|
||||
font-size: 11pt;
|
||||
font-size: 12px;
|
||||
}
|
||||
.basic-info-item{
|
||||
margin-right: 25pt;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
.dimension-item {
|
||||
font-size: 11pt;
|
||||
padding: 0 40px;
|
||||
font-size: 12px;
|
||||
color: black;
|
||||
}
|
||||
.dimension-item-title {
|
||||
font-size: 15pt;
|
||||
font-size: 21px;
|
||||
padding: 15px 0;
|
||||
font-weight: 500;
|
||||
color: black;
|
||||
margin-top: 15pt;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -337,7 +269,7 @@ defineExpose({ open })
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
}
|
||||
.basic-info-item {
|
||||
.basic-info-item{
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
|
||||
@ -163,13 +163,12 @@ const open = async (type: string, templateId: number, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
formData.value.templateId = templateId
|
||||
resetForm()
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
const existingDimension = await DimensionApi.getDimension(id)
|
||||
formData.value = { ...existingDimension, templateId }
|
||||
formData.value = await DimensionApi.getDimension(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
<!-- 维度配置 Tab -->
|
||||
<el-tab-pane label="维度配置" name="dimension">
|
||||
<div class="dimension-header mb-15px">
|
||||
<el-button type="primary" @click="openDimensionForm(selectedTemplate.id!)" v-hasPermi="['prison:evaluation-report:template:update']">
|
||||
<el-button type="primary" @click="openDimensionForm(selectedTemplate.id!)" v-hasPermi="['prison:evaluation-report:dimension:create']">
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增维度
|
||||
</el-button>
|
||||
</div>
|
||||
@ -111,7 +111,7 @@
|
||||
<el-button type="primary" link size="small" @click="openDimensionForm(selectedTemplate.id!, dimension.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link size="small" @click="handleDeleteDimension(dimension.id!)" v-hasPermi="['prison:evaluation-report:template:update']">
|
||||
<el-button type="danger" link size="small" @click="handleDeleteDimension(dimension.id!)" v-hasPermi="['prison:evaluation-report:dimension:delete']">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
@ -32,21 +32,13 @@
|
||||
<div class="options-container">
|
||||
<el-radio-group v-model="answers[question.id]" :disabled="disabled">
|
||||
<el-radio
|
||||
v-for="(opt, optIdx) in parseOptions(question.options)"
|
||||
:key="optIdx"
|
||||
:value="optIdx"
|
||||
v-for="(opt, index) in parseOptions(question.options)"
|
||||
:key="index"
|
||||
:value="index"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<!-- 其他选项输入框 -->
|
||||
<div v-if="getOtherOptionIndex(question) !== undefined && answers[question.id] === getOtherOptionIndex(question)" class="other-input">
|
||||
<el-input
|
||||
v-model="otherAnswers[question.id]"
|
||||
placeholder="请输入其他选项内容"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -55,25 +47,14 @@
|
||||
<div class="options-container">
|
||||
<el-checkbox-group v-model="multiAnswers[question.id]">
|
||||
<el-checkbox
|
||||
v-for="(opt, optIdx) in parseOptions(question.options)"
|
||||
:key="optIdx"
|
||||
:value="optIdx"
|
||||
v-for="(opt, index) in parseOptions(question.options)"
|
||||
:key="index"
|
||||
:value="index"
|
||||
:disabled="disabled"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<!-- 其他选项输入框 -->
|
||||
<div
|
||||
v-if="isOtherOptionSelected(question, multiAnswers[question.id])"
|
||||
class="other-input"
|
||||
>
|
||||
<el-input
|
||||
v-model="otherAnswers[question.id]"
|
||||
placeholder="请输入其他选项内容"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -126,6 +107,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { QuestionnaireApi } from '@/api/prison/questionnaire'
|
||||
import { QuestionApi } from '@/api/prison/question'
|
||||
import { QuestionnaireRecordApi } from '@/api/prison/questionnairerecord'
|
||||
|
||||
@ -146,7 +128,6 @@ const questions = ref<any[]>([])
|
||||
// 答案
|
||||
const answers = reactive<Record<number, any>>({})
|
||||
const multiAnswers = reactive<Record<number, number[]>>({})
|
||||
const otherAnswers = reactive<Record<number, string>>({}) // 其他选项输入框的答案
|
||||
|
||||
// 是否禁用
|
||||
const disabled = computed(() => submitLoading.value)
|
||||
@ -161,51 +142,24 @@ const parseOptions = (optionsStr: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取其他选项的索引 */
|
||||
const getOtherOptionIndex = (question: any): number | undefined => {
|
||||
const options = parseOptions(question.options)
|
||||
return options.findIndex((opt: any) => opt.isOther === true)
|
||||
}
|
||||
|
||||
/** 检查多选题的其他选项是否被选中 */
|
||||
const isOtherOptionSelected = (question: any, selectedIndices: number[] | undefined): boolean => {
|
||||
const otherIdx = getOtherOptionIndex(question)
|
||||
if (otherIdx === undefined || otherIdx === -1) return false
|
||||
return selectedIndices?.includes(otherIdx) ?? false
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (record: any) => {
|
||||
console.log('=== 代填弹窗打开 ===')
|
||||
console.log('传入的record:', record)
|
||||
console.log('record.questionnaireId:', record.questionnaireId)
|
||||
|
||||
dialogVisible.value = true
|
||||
recordId.value = record.id
|
||||
prisonerInfo.value = record
|
||||
questionnaireId.value = record.questionnaireId
|
||||
|
||||
console.log('设置的questionnaireId.value:', questionnaireId.value)
|
||||
|
||||
// 重置答案
|
||||
Object.keys(answers).forEach(key => delete answers[key])
|
||||
Object.keys(multiAnswers).forEach(key => delete multiAnswers[key])
|
||||
Object.keys(otherAnswers).forEach(key => delete otherAnswers[key])
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
// 从后端重新获取最新的记录信息,确保状态是最新的
|
||||
const latestRecord = await QuestionnaireRecordApi.getQuestionnaireRecord(record.id)
|
||||
console.log('获取的最新记录状态:', latestRecord.status)
|
||||
prisonerInfo.value = { ...record, ...latestRecord }
|
||||
|
||||
// 先获取问卷题目总数
|
||||
const countData = await QuestionApi.getQuestionnaireQuestionList(
|
||||
{ questionnaireId: questionnaireId.value, pageNo: 1, pageSize: 1 }
|
||||
)
|
||||
console.log('获取的countData:', countData)
|
||||
const totalCount = countData.total || 0
|
||||
console.log('题目总数:', totalCount)
|
||||
|
||||
// 根据总数获取所有题目(后端限制每页最大200条)
|
||||
const maxPageSize = 200
|
||||
@ -214,8 +168,6 @@ const open = async (record: any) => {
|
||||
const questionData = await QuestionApi.getQuestionnaireQuestionList(
|
||||
{ questionnaireId: questionnaireId.value, pageNo: 1, pageSize: pageSize }
|
||||
)
|
||||
console.log('获取的questionData:', questionData)
|
||||
console.log('实际获取到的题目数量:', questionData.list?.length || 0)
|
||||
questions.value = questionData.list || []
|
||||
|
||||
// 初始化答案结构
|
||||
@ -256,68 +208,11 @@ const handleSubmit = async () => {
|
||||
questionId: q.id
|
||||
}
|
||||
|
||||
const options = parseOptions(q.options)
|
||||
const otherIndex = getOtherOptionIndex(q)
|
||||
const hasOtherSelected = otherIndex !== undefined && (
|
||||
(q.type === 1 && answers[q.id] === otherIndex) ||
|
||||
(q.type === 2 && multiAnswers[q.id]?.includes(otherIndex))
|
||||
)
|
||||
|
||||
if (q.type === 2) {
|
||||
// 多选题:直接使用选项索引作为 optionIds(纯数字)
|
||||
// 多选题
|
||||
answerItem.optionIds = multiAnswers[q.id] || []
|
||||
// 拼接所有选中的选项文字到 answer 字段
|
||||
const selectedIndices = multiAnswers[q.id] || []
|
||||
const selectedLabels = selectedIndices.map((idx: number) => {
|
||||
const opt = options[idx]
|
||||
return opt ? (opt.value !== undefined ? opt.value : opt.label) : String(idx)
|
||||
})
|
||||
if (selectedLabels.length > 0) {
|
||||
answerItem.answer = selectedLabels.join('、')
|
||||
}
|
||||
} else if (q.type === 1) {
|
||||
// 单选题:检查是否选择了"其他"选项
|
||||
const selectedIndex = answers[q.id]
|
||||
const otherIndex = getOtherOptionIndex(q)
|
||||
const isOtherSelected = otherIndex !== undefined && selectedIndex === otherIndex
|
||||
|
||||
if (isOtherSelected) {
|
||||
// 选择了"其他"选项,需要发送 optionIds
|
||||
answerItem.optionIds = [selectedIndex]
|
||||
}
|
||||
// 普通单选题不发送 optionIds
|
||||
}
|
||||
// 填空题、评分题、日期题、数字题不发送 optionIds
|
||||
|
||||
// 如果选中了其他选项,将其他输入框的内容通过 answerText 传递
|
||||
if (hasOtherSelected && otherAnswers[q.id]) {
|
||||
const otherOptValue = options[otherIndex] ? (options[otherIndex].value !== undefined ? options[otherIndex].value : options[otherIndex].label) : '其他'
|
||||
const otherText = `${otherOptValue}:${otherAnswers[q.id]}`
|
||||
if (q.type === 2) {
|
||||
// 多选题:追加其他选项的文字(前面已经有选中选项的文字了)
|
||||
answerItem.answer = answerItem.answer
|
||||
? `${answerItem.answer}、${otherText}`
|
||||
: otherText
|
||||
} else {
|
||||
// 单选题:直接设置其他选项的文字
|
||||
answerItem.answer = otherText
|
||||
}
|
||||
} else if (q.type === 2 && answerItem.answer) {
|
||||
// 多选题选中了"其他"选项但没有输入文字,也要显示"其他"选项的文字
|
||||
if (hasOtherSelected) {
|
||||
const otherOptValue = options[otherIndex] ? (options[otherIndex].value !== undefined ? options[otherIndex].value : options[otherIndex].label) : '其他'
|
||||
answerItem.answer = `${answerItem.answer}、${otherOptValue}`
|
||||
}
|
||||
} else if (q.type === 3 || q.type === 4 || q.type === 5 || q.type === 6) {
|
||||
// 填空题、评分题、日期题、数字题直接使用 answerText
|
||||
} else {
|
||||
answerItem.answer = answers[q.id] !== undefined ? String(answers[q.id]) : ''
|
||||
} else if (q.type === 1 && !hasOtherSelected) {
|
||||
// 单选题没有选择其他选项时,将选项值设置为 answerText
|
||||
const selectedIndex = answers[q.id]
|
||||
if (selectedIndex !== undefined && selectedIndex !== null) {
|
||||
const opt = options[selectedIndex]
|
||||
answerItem.answer = opt ? (opt.value !== undefined ? opt.value : opt.label) : String(selectedIndex)
|
||||
}
|
||||
}
|
||||
|
||||
return answerItem
|
||||
@ -432,11 +327,5 @@ defineExpose({ open })
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.other-input {
|
||||
margin-top: 12px;
|
||||
margin-left: 24px;
|
||||
width: 300px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -271,7 +271,7 @@
|
||||
{{ scope.row.finishTime ? formatDateTime(scope.row.finishTime) : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="400" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="320" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status === 3"
|
||||
@ -319,15 +319,6 @@
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleViewPrisoner(scope.row)"
|
||||
v-hasPermi="['prison:prisoner:query']"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -347,8 +338,6 @@
|
||||
<!-- 代填弹窗 -->
|
||||
<AgentFillDialog ref="agentFillDialogRef" @success="loadPrisonerProgress" />
|
||||
|
||||
<!-- 服刑人员详情弹窗 -->
|
||||
<PrisonerDetail ref="prisonerDetailRef" />
|
||||
<!-- 问卷导出弹窗 -->
|
||||
<QuestionnaireOutput ref="outputDialogRef" />
|
||||
</template>
|
||||
@ -359,7 +348,6 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { formatDateTime } from '@/utils/formatTime'
|
||||
import AnswerDetailDialog from '@/views/prison/questionnairerecord/AnswerDetailDialog.vue'
|
||||
import AgentFillDialog from './AgentFillDialog.vue'
|
||||
import PrisonerDetail from '@/views/prison/prisoner/PrisonerDetail.vue'
|
||||
import { QuestionnaireTaskApi } from '@/api/prison/questionnaire-task'
|
||||
import QuestionnaireOutput from '@/views/prison/questionnairerecord/QuestionnaireOutputfile.vue'
|
||||
|
||||
@ -378,9 +366,6 @@ const answerDetailDialogRef = ref()
|
||||
// 代填弹窗
|
||||
const agentFillDialogRef = ref()
|
||||
|
||||
// 服刑人员详情弹窗
|
||||
const prisonerDetailRef = ref()
|
||||
|
||||
// 任务详情
|
||||
const taskDetail = ref<any>(null)
|
||||
|
||||
@ -492,9 +477,6 @@ const open = async (id: number) => {
|
||||
taskId.value = id
|
||||
activeTab.value = 'overview'
|
||||
loading.value = true
|
||||
|
||||
// 清空之前的任务数据
|
||||
prisonerProgressList.value = []
|
||||
|
||||
try {
|
||||
// 并行加载数据
|
||||
@ -617,11 +599,6 @@ const handleAgentFill = (row: any) => {
|
||||
agentFillDialogRef.value?.open(row)
|
||||
}
|
||||
|
||||
/** 查看服刑人员详情 */
|
||||
const handleViewPrisoner = (row: any) => {
|
||||
prisonerDetailRef.value?.open(row.prisonerId)
|
||||
}
|
||||
|
||||
/** 提醒未完成人员 */
|
||||
const handleRemind = async () => {
|
||||
if (!taskId.value) return
|
||||
|
||||
@ -117,35 +117,29 @@ const open = async (type: string, id?: number) => {
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求:将 coverImage 数组转换为字符串(取第一个元素或null)
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = { ...formData.value } as unknown as Questionnaire
|
||||
// 处理 coverImage 数组转换为字符串
|
||||
if (Array.isArray(data.coverImage) && data.coverImage.length > 0) {
|
||||
data.coverImage = data.coverImage[0] as unknown as string
|
||||
} else {
|
||||
data.coverImage = undefined as unknown as string
|
||||
}
|
||||
if (formType.value === 'create') {
|
||||
await QuestionnaireApi.createQuestionnaire(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await QuestionnaireApi.updateQuestionnaire(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as Questionnaire
|
||||
if (formType.value === 'create') {
|
||||
await QuestionnaireApi.createQuestionnaire(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await QuestionnaireApi.updateQuestionnaire(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['prison:question:create', 'prison:questionnaire:update']"
|
||||
v-hasPermi="['prison:question:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新建问题
|
||||
</el-button>
|
||||
@ -15,7 +15,7 @@
|
||||
type="success"
|
||||
plain
|
||||
@click="openPartDialog"
|
||||
v-hasPermi="['prison:question:create', 'prison:questionnaire:update']"
|
||||
v-hasPermi="['prison:question:create']"
|
||||
>
|
||||
<Icon icon="ep:folder" class="mr-5px" /> 分区管理
|
||||
</el-button>
|
||||
@ -24,7 +24,7 @@
|
||||
plain
|
||||
:disabled="checkedIds.length === 0"
|
||||
@click="handleDeleteBatch"
|
||||
v-hasPermi="['prison:question:delete', 'prison:questionnaire:update']"
|
||||
v-hasPermi="['prison:question:delete']"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||
</el-button>
|
||||
@ -135,7 +135,7 @@
|
||||
link
|
||||
size="small"
|
||||
@click="openForm('update', question.id)"
|
||||
v-hasPermi="['prison:question:update', 'prison:questionnaire:update']"
|
||||
v-hasPermi="['prison:question:update']"
|
||||
>
|
||||
<Icon icon="ep:edit" /> 修改
|
||||
</el-button>
|
||||
@ -144,7 +144,7 @@
|
||||
link
|
||||
size="small"
|
||||
@click="handleDelete(question.id)"
|
||||
v-hasPermi="['prison:question:delete', 'prison:questionnaire:update']"
|
||||
v-hasPermi="['prison:question:delete']"
|
||||
>
|
||||
<Icon icon="ep:delete" /> 删除
|
||||
</el-button>
|
||||
@ -192,10 +192,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain :icon="Plus" @click="addPartition" v-hasPermi="['prison:question:create']">添加分区</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="savePartitions" type="primary" v-hasPermi="['prison:question:update', 'prison:questionnaire:update']">保存设置</el-button>
|
||||
<el-button @click="partDialogVisible = false">关闭</el-button>
|
||||
<el-button @click="savePartitions" type="primary" v-hasPermi="['prison:question:update']">保存设置</el-button>
|
||||
<el-button @click="partDialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
@ -483,39 +486,26 @@ const savePartitions = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 收集所有需要更新的问题(包括默认分区)
|
||||
// 收集所有需要更新的问题
|
||||
const updates: Array<{ id: number; partName?: string; partSort?: number; sort?: number }> = []
|
||||
for (let i = 0; i < allPartList.value.length; i++) {
|
||||
const part = allPartList.value[i]
|
||||
for (const p of partitions.value) {
|
||||
// 匹配分区:两个 name 相等,或者两个都是空(默认分区)
|
||||
if ((p.name === part.name) || (p.name === '' && part.name === '')) {
|
||||
p.questions.forEach((q, sortIndex) => {
|
||||
updates.push({
|
||||
id: q.id!,
|
||||
partName: part.name || undefined,
|
||||
partSort: i,
|
||||
sort: sortIndex
|
||||
if (!part.isDefault && part.name) {
|
||||
for (const p of partitions.value) {
|
||||
if (p.name === part.name) {
|
||||
p.questions.forEach((q, sortIndex) => {
|
||||
updates.push({
|
||||
id: q.id!,
|
||||
partName: part.name,
|
||||
partSort: i,
|
||||
sort: sortIndex
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 没有需要更新的问题(可能是添加了空分区)
|
||||
if (updates.length === 0) {
|
||||
// 检查是否有新建的空分区
|
||||
const hasNewPartition = allPartList.value.some(p => !p.isDefault && p.id?.toString().startsWith('part_'))
|
||||
if (hasNewPartition) {
|
||||
message.error('请先在该分区下添加问题后再保存')
|
||||
return
|
||||
}
|
||||
// 如果确实没有变化,直接关闭弹窗
|
||||
partDialogVisible.value = false
|
||||
message.success('保存成功')
|
||||
return
|
||||
}
|
||||
|
||||
// 批量更新
|
||||
await QuestionApi.batchUpdate({ questions: updates })
|
||||
await getList()
|
||||
@ -528,22 +518,20 @@ const savePartitions = async () => {
|
||||
|
||||
/** 分区拖拽排序完成 */
|
||||
const onPartitionDragEnd = async () => {
|
||||
// 收集所有需要更新的问题(包括默认分区)
|
||||
// 收集所有需要更新的问题
|
||||
const updates: Array<{ id: number; partName?: string; partSort?: number; sort?: number }> = []
|
||||
for (let i = 0; i < partitions.value.length; i++) {
|
||||
const part = partitions.value[i]
|
||||
part.questions.forEach((q, sortIndex) => {
|
||||
updates.push({
|
||||
id: q.id!,
|
||||
partName: part.name || undefined,
|
||||
partSort: i,
|
||||
sort: sortIndex
|
||||
if (part.name) {
|
||||
part.questions.forEach((q, sortIndex) => {
|
||||
updates.push({
|
||||
id: q.id!,
|
||||
partName: part.name,
|
||||
partSort: i,
|
||||
sort: sortIndex
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
// 空数组无需调用后端
|
||||
if (updates.length === 0) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// 批量更新
|
||||
await QuestionApi.batchUpdate({ questions: updates })
|
||||
|
||||
@ -101,11 +101,7 @@
|
||||
<dict-tag :type="DICT_TYPE.PRISON_QUESTIONNAIRE_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="问卷说明" align="center" prop="description" width="200">
|
||||
<template #default="scope">
|
||||
<div v-html="scope.row.description"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="问卷说明" align="center" prop="description" width="200" />
|
||||
<el-table-column label="总分" align="center" prop="totalScore" width="80" />
|
||||
<el-table-column label="及格分" align="center" prop="passScore" width="80" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
|
||||
@ -1,118 +1,210 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="`答题详情 - ${recordInfo.prisonerName || ''}`"
|
||||
width="800px"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
>
|
||||
<Dialog v-model="dialogVisible" :title="title" width="1000px" :fullscreen="false">
|
||||
<div v-loading="loading" class="answer-detail-dialog">
|
||||
<!-- 记录基本信息 -->
|
||||
<el-descriptions :column="3" border class="mb-20px">
|
||||
<el-descriptions-item label="问卷名称">{{ recordInfo.questionnaireName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="罪犯编号">{{ recordInfo.prisonerNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="完成时间">{{ formatDateTime(recordInfo.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客观分">{{ recordInfo.objectiveScore || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="主观分">{{ recordInfo.subjectiveScore || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总分">{{ recordInfo.totalScore || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="答题用时">{{ formatDuration(recordInfo.duration) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="及格状态">
|
||||
<el-tag :type="getPassStatusTag(recordInfo.passStatus)" size="small">
|
||||
{{ getPassStatusText(recordInfo.passStatus) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 问卷题目 -->
|
||||
<div v-if="questions.length > 0" class="questionnaire-content">
|
||||
<div
|
||||
v-for="(item, index) in questions"
|
||||
:key="item.id"
|
||||
class="question-item"
|
||||
>
|
||||
<div class="question-header">
|
||||
<span class="question-index">{{ index + 1 }}</span>
|
||||
<span class="question-title">{{ item.title }}</span>
|
||||
<el-tag v-if="item.isRequired" type="danger" size="small" class="required-tag">必填</el-tag>
|
||||
<el-tag v-if="item.score" type="info" size="small">{{ item.score }}分</el-tag>
|
||||
<div class="record-header">
|
||||
<div class="header-info">
|
||||
<h3 class="title">{{ recordInfo.questionnaireName }}</h3>
|
||||
<div class="meta-info">
|
||||
<span class="info-item">
|
||||
<Icon icon="ep:user" />
|
||||
{{ recordInfo.prisonerName || recordInfo.prisonerNo }}
|
||||
</span>
|
||||
<span class="info-item">
|
||||
<Icon icon="ep:clock" />
|
||||
{{ formatDateTime(recordInfo.createTime) }}
|
||||
</span>
|
||||
<span class="info-item" v-if="recordInfo.duration">
|
||||
<Icon icon="ep:timer" />
|
||||
用时:{{ formatDuration(recordInfo.duration) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 答案展示 -->
|
||||
<div class="answer-area">
|
||||
<!-- 单选题 -->
|
||||
<div v-if="item.type === 1" class="options-container">
|
||||
<span v-if="getAnswerText(item.id)" class="answer-text">
|
||||
{{ getAnswerText(item.id) }}
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
|
||||
<!-- 多选题 -->
|
||||
<div v-else-if="item.type === 2" class="options-container">
|
||||
<span v-if="getMultiAnswerText(item.id)" class="answer-text">
|
||||
{{ getMultiAnswerText(item.id) }}
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
|
||||
<!-- 填空题 -->
|
||||
<div v-else-if="item.type === 3" class="options-container">
|
||||
<span v-if="getAnswerText(item.id)" class="answer-text">
|
||||
{{ getAnswerText(item.id) }}
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
|
||||
<!-- 评分题 -->
|
||||
<div v-else-if="item.type === 4" class="options-container">
|
||||
<span v-if="getAnswerText(item.id)" class="answer-text">
|
||||
{{ getAnswerText(item.id) }} 分
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
|
||||
<!-- 日期题 -->
|
||||
<div v-else-if="item.type === 5" class="options-container">
|
||||
<span v-if="getAnswerText(item.id)" class="answer-text">
|
||||
{{ getAnswerText(item.id) }}
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
|
||||
<!-- 数字题 -->
|
||||
<div v-else-if="item.type === 6" class="options-container">
|
||||
<span v-if="getAnswerText(item.id)" class="answer-text">
|
||||
{{ getAnswerText(item.id) }}
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="score-info">
|
||||
<div class="score-item">
|
||||
<span class="label">客观分</span>
|
||||
<span class="value objective">{{ recordInfo.objectiveScore || 0 }}</span>
|
||||
</div>
|
||||
<div class="score-item">
|
||||
<span class="label">主观分</span>
|
||||
<span class="value subjective">{{ recordInfo.subjectiveScore || 0 }}</span>
|
||||
</div>
|
||||
<div class="score-item total">
|
||||
<span class="label">总分</span>
|
||||
<span class="value">{{ recordInfo.totalScore || 0 }}</span>
|
||||
</div>
|
||||
<div class="score-item" :class="getPassStatusClass(recordInfo.passStatus)">
|
||||
<span class="label">状态</span>
|
||||
<span class="value">{{ getPassStatusText(recordInfo.passStatus) }}</span>
|
||||
</div>
|
||||
<el-button type="primary" link @click="handlePreviewQuestionnaire">
|
||||
<Icon icon="ep:view" class="mr-3px" />查看问卷
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-empty v-else description="暂无答题记录" />
|
||||
<!-- 问题列表(按分区显示) -->
|
||||
<div class="questions-container">
|
||||
<template v-for="partition in partitions" :key="partition.name || 'default'">
|
||||
<!-- 分区标题 -->
|
||||
<div v-if="partition.name" class="partition-title">
|
||||
<Icon icon="ep:folder" />
|
||||
{{ partition.name }}
|
||||
<span class="question-count">({{ partition.questions.length }} 道题)</span>
|
||||
</div>
|
||||
|
||||
<!-- 问题列表 -->
|
||||
<div class="questions-list">
|
||||
<div
|
||||
v-for="item in partition.questions"
|
||||
:key="item.question.id"
|
||||
class="question-item"
|
||||
>
|
||||
<!-- 问题标题 -->
|
||||
<div class="question-header">
|
||||
<span class="question-index">{{ item.index }}.</span>
|
||||
<span class="question-title">
|
||||
{{ item.question.title }}
|
||||
<el-tag v-if="item.question.isRequired" type="danger" size="small" class="required-tag">
|
||||
必填
|
||||
</el-tag>
|
||||
<el-tag v-if="item.question.score" type="info" size="small">
|
||||
{{ item.question.score }}分
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-if="item.answer"
|
||||
:type="item.answer.isCorrect ? 'success' : 'danger'"
|
||||
size="small"
|
||||
>
|
||||
{{ item.answer.isCorrect ? '正确' : '错误' }}
|
||||
</el-tag>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 用户答案 -->
|
||||
<div class="answer-section">
|
||||
<div class="answer-label">
|
||||
<Icon icon="ep:edit" />
|
||||
用户答案:
|
||||
</div>
|
||||
<div class="answer-content">
|
||||
<!-- 单选/多选题 -->
|
||||
<template v-if="item.question.type === 1 || item.question.type === 2">
|
||||
<div v-if="item.answer?.answerText" class="selected-options">
|
||||
<el-tag
|
||||
v-for="(opt, idx) in parseAnswerOptions(item.answer.answerText)"
|
||||
:key="idx"
|
||||
type="primary"
|
||||
size="small"
|
||||
class="option-tag"
|
||||
>
|
||||
{{ opt }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</template>
|
||||
|
||||
<!-- 填空题 -->
|
||||
<template v-else-if="item.question.type === 3">
|
||||
<span v-if="item.answer?.answerText" class="text-answer">{{ item.answer.answerText }}</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</template>
|
||||
|
||||
<!-- 评分题 -->
|
||||
<template v-else-if="item.question.type === 4">
|
||||
<span v-if="item.answer?.answerText" class="score-answer">
|
||||
<el-tag type="warning">{{ item.answer.answerText }} 分</el-tag>
|
||||
</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</template>
|
||||
|
||||
<!-- 日期题 -->
|
||||
<template v-else-if="item.question.type === 5">
|
||||
<span v-if="item.answer?.answerText" class="date-answer">{{ item.answer.answerText }}</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</template>
|
||||
|
||||
<!-- 数字题 -->
|
||||
<template v-else-if="item.question.type === 6">
|
||||
<span v-if="item.answer?.answerText" class="number-answer">{{ item.answer.answerText }}</span>
|
||||
<span v-else class="empty-answer">未作答</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 得分信息 -->
|
||||
<div v-if="item.answer?.score !== undefined" class="score-section">
|
||||
<span class="score-label">
|
||||
<Icon icon="ep:coin" />
|
||||
得分:
|
||||
</span>
|
||||
<span class="score-value" :class="{ 'full-score': item.answer.score === item.question.score }">
|
||||
{{ item.answer.score }} / {{ item.question.score || 0 }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 正确答案(客观题) -->
|
||||
<div v-if="showCorrectAnswer(item.question, item.answer)" class="correct-answer-section">
|
||||
<span class="correct-label">
|
||||
<Icon icon="ep:check" />
|
||||
正确答案:
|
||||
</span>
|
||||
<span class="correct-content">{{ getCorrectAnswer(item.question) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 答题用时 -->
|
||||
<div v-if="item.answer?.duration" class="duration-section">
|
||||
<Icon icon="ep:timer" />
|
||||
答题用时:{{ formatDuration(item.answer.duration) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<el-empty v-if="partitions.length === 0 && !loading" description="暂无答题记录" />
|
||||
</div>
|
||||
|
||||
<!-- 问卷预览弹窗 -->
|
||||
<el-dialog
|
||||
v-model="previewVisible"
|
||||
title="问卷预览"
|
||||
width="800px"
|
||||
destroy-on-close
|
||||
>
|
||||
<QuestionnairePreview :id="previewQuestionnaireId" />
|
||||
<template #footer>
|
||||
<el-button @click="previewVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button @click="dialogVisible = false">关 闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { formatDateTime } from '@/utils/formatTime'
|
||||
import { QuestionnaireRecordApi, type QuestionnaireRecord } from '@/api/prison/questionnairerecord'
|
||||
import { QuestionApi, type Question } from '@/api/prison/question'
|
||||
import { AnswerApi, type Answer } from '@/api/prison/answer'
|
||||
import QuestionnairePreview from '@/views/prison/questionnaire/components/QuestionnairePreview.vue'
|
||||
import { getIntDictOptions } from '@/utils/dict'
|
||||
|
||||
defineOptions({ name: 'AnswerDetailDialog' })
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('答题详情')
|
||||
const loading = ref(false)
|
||||
|
||||
// 预览相关
|
||||
const previewVisible = ref(false)
|
||||
const previewQuestionnaireId = ref<number>()
|
||||
|
||||
// 记录信息
|
||||
const recordInfo = ref<QuestionnaireRecord>({
|
||||
id: undefined,
|
||||
@ -133,19 +225,69 @@ const questions = ref<Question[]>([])
|
||||
// 答案列表
|
||||
const answers = ref<Answer[]>([])
|
||||
|
||||
/** 格式化时长 */
|
||||
const formatDuration = (seconds: number | undefined): string => {
|
||||
if (!seconds) return '-'
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
const minutes = Math.floor((seconds % 3600) / 60)
|
||||
const secs = seconds % 60
|
||||
if (hours > 0) {
|
||||
return `${hours}时${minutes}分${secs}秒`
|
||||
} else if (minutes > 0) {
|
||||
return `${minutes}分${secs}秒`
|
||||
} else {
|
||||
return `${secs}秒`
|
||||
// 分区列表(带答案)
|
||||
interface QuestionWithAnswer {
|
||||
question: Question
|
||||
answer?: Answer
|
||||
index: number
|
||||
}
|
||||
|
||||
const partitions = computed(() => {
|
||||
const partMap = new Map<string, QuestionWithAnswer[]>()
|
||||
|
||||
questions.value.forEach((q, index) => {
|
||||
const partName = q.partName || ''
|
||||
const answer = answers.value.find(a => a.questionId === q.id)
|
||||
|
||||
if (!partMap.has(partName)) {
|
||||
partMap.set(partName, [])
|
||||
}
|
||||
partMap.get(partName)!.push({
|
||||
question: q,
|
||||
answer,
|
||||
index: index + 1
|
||||
})
|
||||
})
|
||||
|
||||
// 按分区排序
|
||||
const sortedParts = Array.from(partMap.entries())
|
||||
.sort((a, b) => {
|
||||
const sortA = a[1][0]?.question.partSort ?? 0
|
||||
const sortB = b[1][0]?.question.partSort ?? 0
|
||||
return sortA - sortB
|
||||
})
|
||||
|
||||
// 构建分区列表
|
||||
const result: Array<{ name: string; questions: QuestionWithAnswer[] }> = []
|
||||
|
||||
// 添加默认分区
|
||||
const defaultQuestions = sortedParts.find(([name]) => !name)
|
||||
if (defaultQuestions) {
|
||||
result.push({
|
||||
name: '',
|
||||
questions: defaultQuestions[1]
|
||||
})
|
||||
}
|
||||
|
||||
// 添加其他分区
|
||||
sortedParts
|
||||
.filter(([name]) => name)
|
||||
.forEach(([name, qs]) => {
|
||||
result.push({
|
||||
name,
|
||||
questions: qs
|
||||
})
|
||||
})
|
||||
|
||||
return result
|
||||
})
|
||||
|
||||
/** 格式化时长 */
|
||||
const formatDuration = (seconds: number): string => {
|
||||
if (!seconds) return '-'
|
||||
const minutes = Math.floor(seconds / 60)
|
||||
const secs = seconds % 60
|
||||
return minutes > 0 ? `${minutes}分${secs}秒` : `${secs}秒`
|
||||
}
|
||||
|
||||
/** 获取及格状态文本 */
|
||||
@ -154,55 +296,52 @@ const getPassStatusText = (status: number | undefined) => {
|
||||
return options.find(o => o.value === status)?.label || '-'
|
||||
}
|
||||
|
||||
/** 获取及格状态标签类型 */
|
||||
const getPassStatusTag = (status: number | undefined): 'success' | 'danger' | 'warning' | 'info' => {
|
||||
const tagMap: Record<number, 'success' | 'danger' | 'warning' | 'info'> = {
|
||||
1: 'success',
|
||||
2: 'danger',
|
||||
3: 'warning'
|
||||
/** 获取及格状态样式 */
|
||||
const getPassStatusClass = (status: number | undefined) => {
|
||||
const classMap: Record<number, string> = {
|
||||
1: 'pass',
|
||||
2: 'fail',
|
||||
3: 'pending'
|
||||
}
|
||||
return tagMap[status || 0] || 'info'
|
||||
return classMap[status || 0] || ''
|
||||
}
|
||||
|
||||
/** 获取单选/填空/评分/日期/数字题的答案文本 */
|
||||
const getAnswerText = (questionId: number | undefined): string | null => {
|
||||
if (questionId === undefined) return null
|
||||
const answer = answers.value.find(a => a.questionId === questionId)
|
||||
return answer?.answerText || null
|
||||
/** 解析答案选项(单选/多选) */
|
||||
const parseAnswerOptions = (answerText: string): string[] => {
|
||||
if (!answerText) return []
|
||||
// 假设答案用逗号分隔(多选)或单个值(单选)
|
||||
return answerText.split(',').filter(s => s.trim())
|
||||
}
|
||||
|
||||
/** 获取多选题的答案文本 */
|
||||
const getMultiAnswerText = (questionId: number | undefined): string | null => {
|
||||
if (questionId === undefined) return null
|
||||
const answer = answers.value.find(a => a.questionId === questionId)
|
||||
if (!answer?.optionIds || !Array.isArray(answer.optionIds) || answer.optionIds.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
// 找到对应的问题
|
||||
const question = questions.value.find(q => q.id === questionId)
|
||||
if (!question?.options) return null
|
||||
/** 判断是否显示正确答案 */
|
||||
const showCorrectAnswer = (question: Question, answer?: Answer): boolean => {
|
||||
// 仅客观题显示正确答案
|
||||
if (question.type !== 1 && question.type !== 2) return false
|
||||
// 必须有答案记录
|
||||
if (!answer) return false
|
||||
return true
|
||||
}
|
||||
|
||||
/** 获取正确答案 */
|
||||
const getCorrectAnswer = (question: Question): string => {
|
||||
if (!question.options) return '-'
|
||||
try {
|
||||
// 解析选项
|
||||
const options = JSON.parse(question.options) as Array<{ label: string; value?: string; isOther?: boolean }>
|
||||
const options = JSON.parse(question.options)
|
||||
// 找到分值最高的选项作为正确答案
|
||||
const correctOptions = options
|
||||
.filter((o: any) => o.score > 0)
|
||||
.map((o: any) => o.label)
|
||||
|
||||
// 根据 optionIds(索引数组)获取对应的选项文字
|
||||
const selectedLabels = answer.optionIds
|
||||
.map((idx: number) => options[idx])
|
||||
.filter((opt): opt is { label: string } => !!opt)
|
||||
.map(opt => opt.label)
|
||||
|
||||
return selectedLabels.length > 0 ? selectedLabels.join('、') : null
|
||||
} catch (e) {
|
||||
console.error('解析选项失败:', e)
|
||||
return null
|
||||
return correctOptions.length > 0 ? correctOptions.join('、') : '-'
|
||||
} catch {
|
||||
return '-'
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (recordId: number) => {
|
||||
dialogVisible.value = true
|
||||
title.value = '答题详情'
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
@ -231,89 +370,296 @@ const open = async (recordId: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 预览问卷 */
|
||||
const handlePreviewQuestionnaire = () => {
|
||||
if (!recordInfo.value.questionnaireId) {
|
||||
return
|
||||
}
|
||||
previewQuestionnaireId.value = recordInfo.value.questionnaireId
|
||||
previewVisible.value = true
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.answer-detail-dialog {
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
max-height: 55vh;
|
||||
padding-right: 8px;
|
||||
padding: 20px;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
.record-header {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.header-info {
|
||||
margin-bottom: 16px;
|
||||
|
||||
.title {
|
||||
margin: 0 0 12px 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.meta-info {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: #e4e7ed;
|
||||
border-radius: 4px;
|
||||
.score-info {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
|
||||
.score-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.value {
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
|
||||
&.objective {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
&.subjective {
|
||||
color: #e6a23c;
|
||||
}
|
||||
}
|
||||
|
||||
&.total {
|
||||
.value {
|
||||
color: #409eff;
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
&.pass .value {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
&.fail .value {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
&.pending .value {
|
||||
color: #e6a23c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.questionnaire-content {
|
||||
overflow-y: auto;
|
||||
max-height: 50vh;
|
||||
padding-right: 8px;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: #e4e7ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.question-item {
|
||||
margin-bottom: 24px;
|
||||
|
||||
.question-header {
|
||||
.questions-container {
|
||||
.partition-title {
|
||||
background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
margin-top: 24px;
|
||||
font-weight: 600;
|
||||
color: #1a5cb8;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.question-index {
|
||||
flex-shrink: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.question-title {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
.question-count {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
font-weight: normal;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.answer-area {
|
||||
padding-left: 32px;
|
||||
.questions-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.options-container {
|
||||
.question-item {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.question-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
.question-index {
|
||||
flex-shrink: 0;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: #409eff;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.question-title {
|
||||
flex: 1;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.answer-section {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
background: #f4f4f5;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.answer-label {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.answer-content {
|
||||
flex: 1;
|
||||
|
||||
.selected-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
|
||||
.option-tag {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.text-answer,
|
||||
.date-answer,
|
||||
.number-answer {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.score-answer {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.empty-answer {
|
||||
color: #c0c4cc;
|
||||
font-size: 14px;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.answer-text {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
.score-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 16px;
|
||||
background: #ecf5ff;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.score-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.score-value {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #409eff;
|
||||
|
||||
&.full-score {
|
||||
color: #67c23a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty-answer {
|
||||
color: #c0c4cc;
|
||||
font-size: 14px;
|
||||
font-style: italic;
|
||||
.correct-answer-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 16px;
|
||||
background: #f0f9eb;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.correct-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: #67c23a;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.correct-content {
|
||||
font-size: 14px;
|
||||
color: #67c23a;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.duration-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
padding: 4px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,60 +283,12 @@ const handleSubmit = async () => {
|
||||
// 构建答案列表
|
||||
const answerList = questions.value.map(q => {
|
||||
const answer = answers.value[q.id!]
|
||||
|
||||
// 处理多选题(type === 2)
|
||||
if (q.type === 2 && Array.isArray(answer)) {
|
||||
// 解析选项获取文字
|
||||
let optionLabels: string[] = []
|
||||
try {
|
||||
const options = JSON.parse(q.options || '[]') as Array<{ label: string }>
|
||||
optionLabels = answer
|
||||
.map((idx: string) => options[parseInt(idx)]?.label)
|
||||
.filter((label): label is string => !!label)
|
||||
} catch (e) {
|
||||
console.error('解析选项失败:', e)
|
||||
}
|
||||
|
||||
return {
|
||||
questionId: q.id!,
|
||||
answer: optionLabels.join('、') || '',
|
||||
optionIds: answer.map((idx: string) => parseInt(idx, 10))
|
||||
}
|
||||
}
|
||||
|
||||
// 单选题(type === 1):如果选择了"其他"选项,需要发送 optionIds
|
||||
if (q.type === 1 && answer) {
|
||||
const answerIndex = parseInt(answer as string, 10)
|
||||
let isOtherOption = false
|
||||
|
||||
try {
|
||||
const options = JSON.parse(q.options || '[]') as Array<{ isOther?: boolean }>
|
||||
isOtherOption = options[answerIndex]?.isOther === true
|
||||
} catch (e) {
|
||||
console.error('解析选项失败:', e)
|
||||
}
|
||||
|
||||
// 解析选项获取文字
|
||||
let answerText = answer as string
|
||||
try {
|
||||
const options = JSON.parse(q.options || '[]') as Array<{ label: string }>
|
||||
answerText = options[answerIndex]?.label || answer as string
|
||||
} catch (e) {
|
||||
console.error('解析选项失败:', e)
|
||||
}
|
||||
|
||||
return {
|
||||
questionId: q.id!,
|
||||
answer: answerText,
|
||||
optionIds: isOtherOption ? [answerIndex] : undefined
|
||||
}
|
||||
}
|
||||
|
||||
// 填空题、评分题、日期题、数字题(type 3/4/5/6)
|
||||
// 多选时用逗号分隔
|
||||
const answerStr = Array.isArray(answer) ? answer.join(',') : answer
|
||||
return {
|
||||
questionId: q.id!,
|
||||
answer: String(answer || ''),
|
||||
optionIds: undefined
|
||||
answer: answerStr || '',
|
||||
optionIds: undefined as number[] | undefined
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
<template>
|
||||
<Dialog
|
||||
style="display: none"
|
||||
title="问卷预览"
|
||||
v-model="dialogVisible"
|
||||
width="900px"
|
||||
:fullscreen="false"
|
||||
>
|
||||
<Dialog style="display: none;" title="问卷预览" v-model="dialogVisible" width="900px" :fullscreen="false">
|
||||
<div ref="previewRef" class="questionnaire-preview" v-loading="loading">
|
||||
<!-- 问卷头部信息 -->
|
||||
<h1 class="preview-header">{{ recordInfo?.questionnaireName }}</h1>
|
||||
@ -24,23 +18,22 @@
|
||||
|
||||
<!-- 问题列表(按分区显示) -->
|
||||
<div class="preview-questions">
|
||||
<template v-for="(partition, index) in partitions" :key="partition.name || 'default'">
|
||||
<template v-for="partition in partitions" :key="partition.name || 'default'">
|
||||
<!-- 分区标题 -->
|
||||
<div v-if="partition.name" class="partition-title">
|
||||
{{ ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'][index] }}、
|
||||
{{ partition.name }}
|
||||
<span class="question-count">({{ partition.questions.length }} 道题)</span>
|
||||
</div>
|
||||
|
||||
<!-- 问题列表 -->
|
||||
<div class="question-items">
|
||||
<!-- 问题列表 -->
|
||||
<div class="question-items">
|
||||
<div
|
||||
v-for="(questionWithAnswer, index) in partition.questions"
|
||||
:key="questionWithAnswer.question.id"
|
||||
class="question-item"
|
||||
>
|
||||
<span class="question-index">{{ index + 1 }}.</span>
|
||||
<span class="question-title">{{ questionWithAnswer.question.title }}:</span>
|
||||
<span class="question-title">{{ questionWithAnswer.question.title }}</span>
|
||||
|
||||
<!-- 帮助说明 -->
|
||||
<span v-if="questionWithAnswer.question.helpText" class="question-help-inline">
|
||||
@ -48,50 +41,25 @@
|
||||
</span>
|
||||
|
||||
<!-- 单选/多选题 -->
|
||||
<span
|
||||
v-if="
|
||||
questionWithAnswer.question.type === 1 || questionWithAnswer.question.type === 2
|
||||
"
|
||||
class="question-options-inline"
|
||||
>
|
||||
<span v-if="questionWithAnswer.question.type === 1 || questionWithAnswer.question.type === 2" class="question-options-inline">
|
||||
<span
|
||||
v-for="option in getQuestionOptions(questionWithAnswer.question)"
|
||||
:key="option.label"
|
||||
class="option-item"
|
||||
>
|
||||
<span
|
||||
v-if="
|
||||
questionWithAnswer.question.type === 1 &&
|
||||
questionWithAnswer.answer?.answerText?.trim() === option.label
|
||||
"
|
||||
>
|
||||
<span v-if="questionWithAnswer.question.type === 1 && questionWithAnswer.answer?.answerText?.trim() === option.label">
|
||||
☑
|
||||
{{ option.label }}
|
||||
</span>
|
||||
<span
|
||||
v-if="
|
||||
questionWithAnswer.question.type === 1 &&
|
||||
questionWithAnswer.answer?.answerText?.trim() !== option.label
|
||||
"
|
||||
>
|
||||
<span v-if="questionWithAnswer.question.type === 1 && questionWithAnswer.answer?.answerText?.trim() !== option.label">
|
||||
☐
|
||||
{{ option.label }}
|
||||
</span>
|
||||
<span
|
||||
v-if="
|
||||
questionWithAnswer.question.type === 2 &&
|
||||
getSelectedLabels(questionWithAnswer.answer).includes(option.label)
|
||||
"
|
||||
>
|
||||
<span v-if="questionWithAnswer.question.type === 2 && getSelectedLabels(questionWithAnswer.answer).includes(option.label)">
|
||||
☑
|
||||
{{ option.label }}
|
||||
</span>
|
||||
<span
|
||||
v-if="
|
||||
questionWithAnswer.question.type === 2 &&
|
||||
!getSelectedLabels(questionWithAnswer.answer).includes(option.label)
|
||||
"
|
||||
>
|
||||
<span v-if="questionWithAnswer.question.type === 2 && !getSelectedLabels(questionWithAnswer.answer).includes(option.label)">
|
||||
☐
|
||||
{{ option.label }}
|
||||
</span>
|
||||
@ -99,48 +67,26 @@
|
||||
</span>
|
||||
|
||||
<!-- 填空题 -->
|
||||
<span
|
||||
v-else-if="questionWithAnswer.question.type === 3"
|
||||
class="question-input-inline"
|
||||
>
|
||||
<span v-else-if="questionWithAnswer.question.type === 3" class="question-input-inline">
|
||||
{{ getAnswerDisplayValue(questionWithAnswer.answer) }}
|
||||
</span>
|
||||
|
||||
<!-- 评分题 -->
|
||||
<span
|
||||
v-else-if="questionWithAnswer.question.type === 4"
|
||||
class="question-rating-inline"
|
||||
>
|
||||
<span class="question-input-inline">{{
|
||||
getAnswerDisplayValue(questionWithAnswer.answer)
|
||||
}}</span>
|
||||
<span v-else-if="questionWithAnswer.question.type === 4" class="question-rating-inline">
|
||||
<span class="question-input-inline">{{ getAnswerDisplayValue(questionWithAnswer.answer) }}</span>
|
||||
</span>
|
||||
|
||||
<!-- 日期题 -->
|
||||
<span v-else-if="questionWithAnswer.question.type === 5" class="question-date-inline">
|
||||
<span
|
||||
class="date-info"
|
||||
v-if="
|
||||
getRangeValue(questionWithAnswer.question, 'min') ||
|
||||
getRangeValue(questionWithAnswer.question, 'max')
|
||||
"
|
||||
>
|
||||
日期范围:{{ getRangeValue(questionWithAnswer.question, 'min') || '无限制' }} ~
|
||||
{{ getRangeValue(questionWithAnswer.question, 'max') || '无限制' }}
|
||||
<span class="date-info" v-if="getRangeValue(questionWithAnswer.question, 'min') || getRangeValue(questionWithAnswer.question, 'max')">
|
||||
日期范围:{{ getRangeValue(questionWithAnswer.question, 'min') || '无限制' }} ~ {{ getRangeValue(questionWithAnswer.question, 'max') || '无限制' }}
|
||||
</span>
|
||||
<span class="question-input-inline">{{
|
||||
getAnswerDisplayValue(questionWithAnswer.answer)
|
||||
}}</span>
|
||||
<span class="question-input-inline">{{ getAnswerDisplayValue(questionWithAnswer.answer) }}</span>
|
||||
</span>
|
||||
|
||||
<!-- 数字题 -->
|
||||
<span
|
||||
v-else-if="questionWithAnswer.question.type === 6"
|
||||
class="question-number-inline"
|
||||
>
|
||||
<span class="question-input-inline">{{
|
||||
getAnswerDisplayValue(questionWithAnswer.answer)
|
||||
}}</span>
|
||||
<span v-else-if="questionWithAnswer.question.type === 6" class="question-number-inline">
|
||||
<span class="question-input-inline">{{ getAnswerDisplayValue(questionWithAnswer.answer) }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -191,7 +137,7 @@ const partitions = computed(() => {
|
||||
|
||||
questions.value.forEach((q, index) => {
|
||||
const partName = q.partName || ''
|
||||
const answer = answers.value.find((a) => a.questionId === q.id)
|
||||
const answer = answers.value.find(a => a.questionId === q.id)
|
||||
|
||||
if (!partMap.has(partName)) {
|
||||
partMap.set(partName, [])
|
||||
@ -204,11 +150,12 @@ const partitions = computed(() => {
|
||||
})
|
||||
|
||||
// 按分区排序
|
||||
const sortedParts = Array.from(partMap.entries()).sort((a, b) => {
|
||||
const sortA = a[1][0]?.question.partSort ?? 0
|
||||
const sortB = b[1][0]?.question.partSort ?? 0
|
||||
return sortA - sortB
|
||||
})
|
||||
const sortedParts = Array.from(partMap.entries())
|
||||
.sort((a, b) => {
|
||||
const sortA = a[1][0]?.question.partSort ?? 0
|
||||
const sortB = b[1][0]?.question.partSort ?? 0
|
||||
return sortA - sortB
|
||||
})
|
||||
|
||||
// 构建分区列表
|
||||
const result: Array<{ name: string; questions: QuestionWithAnswer[] }> = []
|
||||
@ -237,21 +184,20 @@ const partitions = computed(() => {
|
||||
|
||||
/** 根据问题ID获取答案 */
|
||||
const getAnswerByQuestionId = (questionId: number): Answer | undefined => {
|
||||
return answers.value.find((a) => a.questionId === questionId)
|
||||
return answers.value.find(a => a.questionId === questionId)
|
||||
}
|
||||
|
||||
/** 获取答案显示值(兼容不同字段名) */
|
||||
const getAnswerDisplayValue = (answer?: Answer): string => {
|
||||
if (!answer) return ''
|
||||
// 优先使用 answerText,其次使用 optionIds,并去除前后空格和特殊字符
|
||||
const value = answer.answerText || answer.optionIds || ''
|
||||
return String(value).trim().replace(/^["']|["']$/g, '')
|
||||
// 优先使用 answerText,其次使用 optionIds
|
||||
return answer.answerText || answer.optionIds || '-'
|
||||
}
|
||||
|
||||
/** 问卷类型标签 */
|
||||
const getTypeLabel = (type: number) => {
|
||||
const options = getIntDictOptions(DICT_TYPE.PRISON_QUESTIONNAIRE_TYPE)
|
||||
return options.find((o) => o.value === type)?.label || '未知'
|
||||
return options.find(o => o.value === type)?.label || '未知'
|
||||
}
|
||||
|
||||
/** 获取问题选项 */
|
||||
@ -287,16 +233,11 @@ const getRangeValue = (question: Question, key: 'min' | 'max') => {
|
||||
/** 安全获取多选答案的标签数组 */
|
||||
const getSelectedLabels = (answer?: Answer): string[] => {
|
||||
if (!answer?.answerText) return []
|
||||
return answer.answerText.split(',').map((s) => s.trim())
|
||||
return answer.answerText.split(',').map(s => s.trim())
|
||||
}
|
||||
|
||||
/** 判断选项是否被选中(支持单选和多选)- 已废弃,改用模板直接绑定 */
|
||||
const isOptionSelected = (
|
||||
answer?: Answer,
|
||||
optionValue?: string,
|
||||
optionLabel?: string,
|
||||
questionType?: number
|
||||
): boolean => {
|
||||
const isOptionSelected = (answer?: Answer, optionValue?: string, optionLabel?: string, questionType?: number): boolean => {
|
||||
if (!answer || !optionValue || !optionLabel) {
|
||||
return false
|
||||
}
|
||||
@ -304,7 +245,7 @@ const isOptionSelected = (
|
||||
// 多选(type === 2):answerText 是逗号分隔的标签列表
|
||||
if (questionType === 2 && answer.answerText && answer.answerText.includes(',')) {
|
||||
const answerText = answer.answerText
|
||||
const selectedLabels = answerText.split(',').map((s) => s.trim())
|
||||
const selectedLabels = answerText.split(',').map(s => s.trim())
|
||||
return selectedLabels.includes(optionLabel)
|
||||
}
|
||||
|
||||
@ -316,7 +257,7 @@ const isOptionSelected = (
|
||||
// 兼容:没有 questionType 时,根据是否有逗号判断
|
||||
if (answer.answerText && answer.answerText.includes(',')) {
|
||||
const answerText = answer.answerText
|
||||
const selectedLabels = answerText.split(',').map((s) => s.trim())
|
||||
const selectedLabels = answerText.split(',').map(s => s.trim())
|
||||
return selectedLabels.includes(optionLabel)
|
||||
}
|
||||
|
||||
@ -325,6 +266,7 @@ const isOptionSelected = (
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (recordId: number) => {
|
||||
dialogVisible.value = true
|
||||
@ -354,9 +296,7 @@ const open = async (recordId: number) => {
|
||||
if (recordData.questionnaireId) {
|
||||
try {
|
||||
const { QuestionnaireApi } = await import('@/api/prison/questionnaire')
|
||||
questionnaireInfo.value = await QuestionnaireApi.getQuestionnaire(
|
||||
recordData.questionnaireId
|
||||
)
|
||||
questionnaireInfo.value = await QuestionnaireApi.getQuestionnaire(recordData.questionnaireId)
|
||||
} catch (error) {
|
||||
console.warn('加载问卷详细信息失败:', error)
|
||||
}
|
||||
@ -387,11 +327,7 @@ const exportToWord = async () => {
|
||||
}
|
||||
|
||||
// 获取预览容器的HTML内容
|
||||
let previewHTML = previewRef.value.innerHTML
|
||||
|
||||
// 清理可能导致WPS显示引号的特殊字符
|
||||
previewHTML = previewHTML.replace(/[\u201C\u201D\u2018\u2019]/g, '') // 移除中文引号
|
||||
previewHTML = previewHTML.replace(/^["']|["']$/gm, '') // 移除行首尾的引号
|
||||
const previewHTML = previewRef.value.innerHTML
|
||||
|
||||
// 构建完整的HTML文档,使用与预览页面一致的样式
|
||||
const fullHTML = `
|
||||
@ -400,110 +336,108 @@ const exportToWord = async () => {
|
||||
<meta charset="utf-8">
|
||||
<title>${recordInfo.value?.questionnaireName || '问卷'}</title>
|
||||
<style>
|
||||
/* 使用 pt 单位以避免 Word/WPS 在 px->pt 换算时产生差异 */
|
||||
body {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
font-size: 11pt;
|
||||
margin: 15pt;
|
||||
padding: 15pt;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
h1 {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
font-size: 18pt;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
}
|
||||
.section-title {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
margin-bottom: 15pt;
|
||||
font-size: 18pt;
|
||||
font-weight: 700;
|
||||
margin: 15px 0;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
}
|
||||
.description-content {
|
||||
color: #000;
|
||||
font-size: 11pt;
|
||||
margin-bottom: 6pt;
|
||||
line-height: 1.5;
|
||||
line-height: 1.8;
|
||||
font-size: 16px;
|
||||
}
|
||||
.instruction-content {
|
||||
color: #000;
|
||||
font-size: 11pt;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 6pt;
|
||||
line-height: 1.5;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.partition-title {
|
||||
margin-top: 15pt;
|
||||
margin-bottom: 16px;
|
||||
margin-top: 24px;
|
||||
color: #000;
|
||||
font-size: 15pt;
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.partition-title:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.question-count {
|
||||
font-size: 11pt;
|
||||
font-size: 14px;
|
||||
color: #909399;
|
||||
font-weight: normal;
|
||||
margin-left: 2pt;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.question-item {
|
||||
font-size: 11pt;
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
margin-bottom: 8pt;
|
||||
line-height: 1.5;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 16px;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.question-index {
|
||||
margin-right: 2pt;
|
||||
margin-right: 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.question-title {
|
||||
margin-right: 4pt;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.question-help-inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3pt;
|
||||
gap: 6px;
|
||||
color: #909399;
|
||||
font-size: 11pt;
|
||||
font-size: 15px;
|
||||
padding: 4px 8px;
|
||||
background: #f4f4f5;
|
||||
border-radius: 2pt;
|
||||
margin-right: 6pt;
|
||||
border-radius: 4px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.question-options-inline {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8pt;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.option-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3pt;
|
||||
gap: 8px;
|
||||
}
|
||||
.question-rating-inline,
|
||||
.question-date-inline,
|
||||
.question-number-inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8pt;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-left: 3pt;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.rating-info,
|
||||
.date-info,
|
||||
.number-info {
|
||||
display: inline-flex;
|
||||
gap: 11pt;
|
||||
gap: 16px;
|
||||
color: #909399;
|
||||
font-size: 11pt;
|
||||
font-size: 13px;
|
||||
}
|
||||
.question-input-inline {
|
||||
color: #000;
|
||||
font-size: 11pt;
|
||||
line-height: 1.5;
|
||||
font-size: 16px;
|
||||
line-height: 2.2;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
@ -541,99 +475,100 @@ defineExpose({ open, exportToWord })
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
font-size: 18pt;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
}
|
||||
.section-title {
|
||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||
margin-bottom: 15pt;
|
||||
font-size: 18pt;
|
||||
font-weight: 700;
|
||||
margin: 15px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
}
|
||||
.description-content {
|
||||
color: #000;
|
||||
line-height: 3;
|
||||
font-size: 11pt;
|
||||
line-height: 1.8;
|
||||
font-size: 14px;
|
||||
}
|
||||
.instruction-content {
|
||||
color: #000;
|
||||
font-size: 11pt;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 3;
|
||||
line-height: 1.8;
|
||||
}
|
||||
.partition-title {
|
||||
margin-top: 15pt;
|
||||
margin-bottom: 16px;
|
||||
margin-top: 24px;
|
||||
color: #000;
|
||||
font-size: 15pt;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.partition-title:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.question-count {
|
||||
font-size: 11pt;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
font-weight: normal;
|
||||
margin-left: 2pt;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.question-item {
|
||||
font-size: 11pt;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
line-height: 3;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 16px;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.question-index {
|
||||
margin-right: 2pt;
|
||||
margin-right: 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.question-title {
|
||||
margin-right: 4pt;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.question-help-inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3pt;
|
||||
gap: 6px;
|
||||
color: #909399;
|
||||
font-size: 11pt;
|
||||
font-size: 13px;
|
||||
padding: 4px 8px;
|
||||
background: #f4f4f5;
|
||||
border-radius: 2pt;
|
||||
margin-right: 6pt;
|
||||
border-radius: 4px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.question-options-inline {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8pt;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.option-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3pt;
|
||||
gap: 8px;
|
||||
}
|
||||
.question-rating-inline,
|
||||
.question-date-inline,
|
||||
.question-number-inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8pt;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-left: 3pt;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.rating-info,
|
||||
.date-info,
|
||||
.number-info {
|
||||
display: inline-flex;
|
||||
gap: 11pt;
|
||||
gap: 16px;
|
||||
color: #909399;
|
||||
font-size: 11pt;
|
||||
font-size: 13px;
|
||||
}
|
||||
.question-input-inline {
|
||||
color: #000;
|
||||
font-size: 11pt;
|
||||
line-height: 3;
|
||||
font-size: 14px;
|
||||
line-height: 2.2;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<el-date-picker
|
||||
v-model="formData.assessmentDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
value-format="x"
|
||||
placeholder="选择评估日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -72,12 +72,17 @@
|
||||
<el-form-item label="管控建议" prop="suggestions">
|
||||
<el-input v-model="formData.suggestions" placeholder="请输入管控建议" />
|
||||
</el-form-item>
|
||||
<!-- 评估人信息由后端自动从登录上下文获取,不在前端显示 -->
|
||||
<el-form-item label="评估人ID" prop="assessorId">
|
||||
<el-input v-model="formData.assessorId" placeholder="请输入评估人ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="评估人姓名" prop="assessorName">
|
||||
<el-input v-model="formData.assessorName" placeholder="请输入评估人姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下次评估日期" prop="nextAssessmentDate">
|
||||
<el-date-picker
|
||||
v-model="formData.nextAssessmentDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
value-format="x"
|
||||
placeholder="选择下次评估日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -124,9 +129,8 @@ const formData = ref({
|
||||
id: undefined,
|
||||
prisonerId: undefined as number | undefined,
|
||||
prisonerNo: undefined as string | undefined,
|
||||
prisonerName: undefined as string | undefined, // 罪犯姓名(用于显示)
|
||||
assessmentType: undefined as number | undefined,
|
||||
assessmentDate: undefined as string | undefined,
|
||||
assessmentDate: undefined as number | undefined,
|
||||
violenceScore: undefined as number | undefined,
|
||||
escapeScore: undefined as number | undefined,
|
||||
suicideScore: undefined as number | undefined,
|
||||
@ -134,8 +138,9 @@ const formData = ref({
|
||||
riskLevel: undefined as number | undefined,
|
||||
riskFactors: undefined as string | undefined,
|
||||
suggestions: undefined as string | undefined,
|
||||
// assessorId 和 assessorName 由后端自动从登录上下文获取,不从前端传递
|
||||
nextAssessmentDate: undefined as string | undefined,
|
||||
assessorId: undefined as number | undefined,
|
||||
assessorName: undefined as string | undefined,
|
||||
nextAssessmentDate: undefined as number | undefined,
|
||||
status: 1 as number | undefined,
|
||||
remark: undefined as string | undefined
|
||||
})
|
||||
@ -148,7 +153,7 @@ const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 搜索罪犯 - 支持编号和姓名双条件搜索 */
|
||||
/** 搜索罪犯 */
|
||||
const searchPrisoner = async (query: string) => {
|
||||
if (!query) {
|
||||
prisonerList.value = []
|
||||
@ -159,7 +164,6 @@ const searchPrisoner = async (query: string) => {
|
||||
const data = await PrisonerApi.getPage({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
prisonerNo: query, // 按罪犯编号搜索
|
||||
name: query // 按姓名搜索
|
||||
} as any)
|
||||
prisonerList.value = data.list || []
|
||||
@ -232,7 +236,6 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
prisonerId: undefined,
|
||||
prisonerNo: undefined,
|
||||
prisonerName: undefined,
|
||||
assessmentType: undefined,
|
||||
assessmentDate: undefined,
|
||||
violenceScore: undefined,
|
||||
@ -242,7 +245,8 @@ const resetForm = () => {
|
||||
riskLevel: undefined,
|
||||
riskFactors: undefined,
|
||||
suggestions: undefined,
|
||||
// assessorId 和 assessorName 由后端自动从登录上下文获取,不从前端传递
|
||||
assessorId: undefined,
|
||||
assessorName: undefined,
|
||||
nextAssessmentDate: undefined,
|
||||
status: 1,
|
||||
remark: undefined
|
||||
|
||||
@ -290,21 +290,9 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
// 格式化时间,保持中国时区
|
||||
const formatDateTime = (timestamp: number) => {
|
||||
if (!timestamp) return undefined
|
||||
const date = new Date(timestamp)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
const data = {
|
||||
...formData.value,
|
||||
occurTime: formatDateTime(formData.value.occurTime)
|
||||
occurTime: formData.value.occurTime ? new Date(formData.value.occurTime).toISOString() : undefined
|
||||
} as unknown as SituationSaveReqVO
|
||||
if (formType.value === 'create') {
|
||||
await SituationApi.createSituation(data)
|
||||
|
||||
@ -385,8 +385,8 @@ const submitForm = async () => {
|
||||
try {
|
||||
const data = {
|
||||
...formData.value,
|
||||
alertTime: formData.value.alertTime ? new Date(formData.value.alertTime).toISOString().slice(0, 19).replace('T', ' ') : undefined,
|
||||
occurTime: formData.value.occurTime ? new Date(formData.value.occurTime).toISOString().slice(0, 19).replace('T', ' ') : undefined
|
||||
alertTime: formData.value.alertTime ? new Date(formData.value.alertTime).toISOString() : undefined,
|
||||
occurTime: formData.value.occurTime ? new Date(formData.value.occurTime).toISOString() : undefined
|
||||
} as unknown as WarningSaveReqVO
|
||||
if (formType.value === 'create') {
|
||||
await WarningApi.createWarning(data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user