添加文件

This commit is contained in:
junge
2026-02-03 14:20:17 +08:00
parent d8668ac1d3
commit 57e7d9b385
12 changed files with 1708 additions and 0 deletions

View File

@@ -29,6 +29,13 @@ export default [
description: 'View key performance indicators and analytics.',
icon: 'DataLine',
path: '/data-dashboard'
},
{
id: 4,
title: 'Study Task',
description: 'Manage study tasks and track completion status.',
icon: 'List',
path: '/study-task'
}
]
}

86
mock/store-inspection.ts Normal file
View File

@@ -0,0 +1,86 @@
import { MockMethod } from 'vite-plugin-mock'
const inspections = [
{
id: 1,
storeName: '百年神厨 (格林店)',
templateName: '2023 Q4 标准巡检模板',
inspectors: ['陈经理', '张欣欣', '李雷', '韩梅梅'],
date: '2023-10-20 13:00 至 2023-10-20 15:00',
totalScore: 400.0,
scoreRate: 50.5,
rating: '非常的优秀',
score: 200.0,
totalDeduction: 199.0,
naScore: 1,
totalItems: 999,
status: 'completed',
modules: [
{ name: '01 产品', rating: '非常的优秀', score: 20, deduction: 10, rate: 33.33 },
{ name: '02 服务', rating: '优秀', score: 10, deduction: 100, rate: 50.00 },
{ name: '03 安全', rating: 'B', score: 5, deduction: 10, rate: 33.33 },
{ name: '04 生产生产', rating: 'C', score: 1, deduction: 5, rate: 83.41 },
{ name: '05 内容显示', rating: 'D', score: 0, deduction: 10, rate: 100.00 },
],
redLine: {
deduction: 12,
total: 20
},
recheck: {
lastIssues: 3,
recurringIssues: 4,
rate: 30
},
na: {
count: 1,
totalCount: 20,
score: 5,
totalScore: 100
},
additional: {
suddenIssues: 18,
highlights: 24
}
},
{
id: 2,
storeName: '百年神厨 (万达店)',
templateName: '2023 Q4 标准巡检模板',
inspectors: ['王督导'],
date: '2023-10-21 09:00 至 2023-10-21 11:00',
totalScore: 95.0,
scoreRate: 95.0,
rating: '优秀',
status: 'pending'
}
]
export default [
{
url: '/api/inspections',
method: 'get',
response: () => {
return {
code: 0,
message: 'ok',
data: inspections
}
}
},
{
url: '/api/inspections/detail',
method: 'get',
response: ({ query }: { query: any }) => {
const id = Number(query.id)
const item = inspections.find(i => i.id === id)
if (!item) {
return { code: 1, message: 'Inspection not found' }
}
return {
code: 0,
message: 'ok',
data: item
}
}
}
] as MockMethod[]

135
mock/study-task.ts Normal file
View File

@@ -0,0 +1,135 @@
import { MockMethod } from 'vite-plugin-mock'
let tasks = [
{
id: 1,
title: 'Learn Vue 3',
description: 'Study Composition API and script setup',
dueDate: '2023-12-31',
status: 'pending'
},
{
id: 2,
title: 'Master TypeScript',
description: 'Understand generics and utility types',
dueDate: '2023-11-30',
status: 'completed'
},
{
id: 3,
title: 'Element Plus Basics',
description: 'Learn grid system and basic components',
dueDate: '2024-01-15',
status: 'pending'
}
]
export default [
{
url: '/api/study-tasks',
method: 'get',
response: () => {
return {
code: 0,
message: 'ok',
data: tasks
}
}
},
{
url: '/api/study-tasks/detail',
method: 'get',
response: ({ query }: { query: any }) => {
const id = Number(query.id)
const task = tasks.find(t => t.id === id)
if (!task) {
return {
code: 1,
message: 'Task not found'
}
}
// Enrich with detail data
return {
code: 0,
message: 'ok',
data: {
...task,
// Extra fields for detail view
videoUrl: 'https://media.w3.org/2010/05/sintel/trailer.mp4',
tag: '服务岗位',
longDescription: '争吵打架争吵打架争吵打架争吵打架争吵打架争吵打架争吵打架争吵打架争吵打架\n\n员工和员工之间发生吵架、打架与顾客发生争吵、打架。员工和员工之间发生吵架、打架与顾客发生争吵。',
evaluationContent: '争吵打架争吵打架争吵打架争吵打架争吵打架',
standardImages: [
'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg'
],
livePhotos: [
'https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg',
'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg'
],
lastDeduction: {
photos: [
'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg'
],
suggestion: '工作期间应该注重仪容仪表工作期间应该注重仪容仪表',
score: -3
},
score: 999,
rule: '一次性扣除',
deduction: -999
}
}
}
},
{
url: '/api/study-tasks',
method: 'post',
response: ({ body }: { body: any }) => {
const newTask = {
id: tasks.length > 0 ? Math.max(...tasks.map(t => t.id)) + 1 : 1,
...body
}
tasks.push(newTask)
return {
code: 0,
message: 'ok',
data: newTask
}
}
},
{
url: '/api/study-tasks',
method: 'put',
response: ({ body }: { body: any }) => {
const index = tasks.findIndex(t => t.id === body.id)
if (index !== -1) {
tasks[index] = { ...tasks[index], ...body }
return {
code: 0,
message: 'ok',
data: tasks[index]
}
}
return {
code: 1,
message: 'Task not found'
}
}
},
{
url: '/api/study-tasks',
method: 'delete',
response: ({ query }: { query: any }) => {
const id = Number(query.id)
tasks = tasks.filter(t => t.id !== id)
return {
code: 0,
message: 'ok'
}
}
}
] as MockMethod[]