From b7ba954b4a47a659d5afb73bf94a9ddfd7f943d3 Mon Sep 17 00:00:00 2001 From: Teo <2642673902@qq.com> Date: Tue, 15 Apr 2025 18:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/project/projectTeam/types.ts | 4 +- src/api/safety/questionUserAnswer/index.ts | 12 + src/api/safety/questionUserAnswer/types.ts | 87 ++---- src/api/safety/questionsCategory/index.ts | 63 +++++ src/api/safety/questionsCategory/types.ts | 41 +++ src/api/system/oss/index.ts | 7 +- src/components/FileUpload/index.vue | 69 ++--- src/views/machinery/index.vue | 1 + src/views/project/constructionUser/index.vue | 2 +- src/views/safety/questionUserAnswer/index.vue | 255 +++++++----------- src/views/safety/questionsCategory/index.vue | 236 ++++++++++++++++ .../SafetyInspectionDetailDialog.vue | 74 ++--- src/views/safety/safetyInspection/index.vue | 42 ++- .../component/SafetyLogDetailDialog.vue | 2 +- src/views/safety/safetyLog/index.vue | 17 +- src/views/safety/safetyWeeklyReport/index.vue | 15 ++ src/views/safety/teamMeeting/index.vue | 14 + 17 files changed, 635 insertions(+), 306 deletions(-) create mode 100644 src/api/safety/questionsCategory/index.ts create mode 100644 src/api/safety/questionsCategory/types.ts create mode 100644 src/views/safety/questionsCategory/index.vue diff --git a/src/api/project/projectTeam/types.ts b/src/api/project/projectTeam/types.ts index e799699..d14b582 100644 --- a/src/api/project/projectTeam/types.ts +++ b/src/api/project/projectTeam/types.ts @@ -84,7 +84,7 @@ export interface ProjectTeamForemanResp { * 班组id */ id: string | number; - + foremanList: foremanQuery[]; /** * 班组名称 */ @@ -94,7 +94,9 @@ export interface ProjectTeamForemanResp { * 项目id */ projectId: string | number; +} +export interface foremanQuery { /** * 班组长id */ diff --git a/src/api/safety/questionUserAnswer/index.ts b/src/api/safety/questionUserAnswer/index.ts index 5ab5949..430d505 100644 --- a/src/api/safety/questionUserAnswer/index.ts +++ b/src/api/safety/questionUserAnswer/index.ts @@ -61,3 +61,15 @@ export const delQuestionUserAnswer = (id: string | number | Array { + return request({ + url: '/safety/questionUserAnswer/upload/zip', + method: 'post', + data: data + }); +}; diff --git a/src/api/safety/questionUserAnswer/types.ts b/src/api/safety/questionUserAnswer/types.ts index 66434a0..0df3cd5 100644 --- a/src/api/safety/questionUserAnswer/types.ts +++ b/src/api/safety/questionUserAnswer/types.ts @@ -1,33 +1,17 @@ export interface QuestionUserAnswerVO { - /** - * 主键id - */ - id: string | number; - - /** - * 项目id - */ - projectId: string | number; - - /** - * 用户id - */ - userId: string | number; - - /** - * 题库id列表 - */ - bankIdList: Array; - - /** - * 答案列表 - */ - answerList: Array; - /** * 得分 */ score: number; + id: string | number; + file: string; + /** + * 考试类型(1线上考试 2线下考试) + */ + /** + * 考试时间(时间戳/秒) + */ + examTime: number; /** * 用时时间(时间戳/秒) @@ -38,11 +22,6 @@ export interface QuestionUserAnswerVO { * 及格线/总分(格式:60,100) */ pass: string; - - /** - * 文件地址 - */ - file: string; } export interface QuestionUserAnswerForm extends BaseEntity { @@ -50,7 +29,7 @@ export interface QuestionUserAnswerForm extends BaseEntity { * 主键id */ id?: string | number; - + teamId?: string | number; /** * 项目id */ @@ -64,18 +43,23 @@ export interface QuestionUserAnswerForm extends BaseEntity { /** * 题库id列表 */ - bankIdList: Array; + bankId?: string | number; /** * 答案列表 */ - answerList: Array; + answer?: string; /** * 得分 */ score?: number; + /** + * 考试时间(时间戳/秒) + */ + examTime?: number; + /** * 用时时间(时间戳/秒) */ @@ -93,45 +77,16 @@ export interface QuestionUserAnswerForm extends BaseEntity { } export interface QuestionUserAnswerQuery extends PageQuery { - /** - * 项目id - */ - projectId?: string | number; - /** * 用户id */ userId?: string | number; - + teamId?: string | number; + projectId?: string | number; /** - * 题库id列表 + * 考试类型(1线上考试 2线下考试) */ - bankIdList: Array; - - /** - * 答案列表 - */ - answerList: Array; - - /** - * 得分 - */ - score?: number; - - /** - * 用时时间(时间戳/秒) - */ - takeTime?: number; - - /** - * 及格线/总分(格式:60,100) - */ - pass?: string; - - /** - * 文件地址 - */ - file?: string; + examType?: string; /** * 日期范围参数 diff --git a/src/api/safety/questionsCategory/index.ts b/src/api/safety/questionsCategory/index.ts new file mode 100644 index 0000000..a69e77d --- /dev/null +++ b/src/api/safety/questionsCategory/index.ts @@ -0,0 +1,63 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { QuestionsCategoryVO, QuestionsCategoryForm, QuestionsCategoryQuery } from '@/api/safety/questionsCategory/types'; + +/** + * 查询题库类别列表 + * @param query + * @returns {*} + */ + +export const listQuestionsCategory = (query?: QuestionsCategoryQuery): AxiosPromise => { + return request({ + url: '/safety/questionsCategory/list', + method: 'get', + params: query + }); +}; + +/** + * 查询题库类别详细 + * @param id + */ +export const getQuestionsCategory = (id: string | number): AxiosPromise => { + return request({ + url: '/safety/questionsCategory/' + id, + method: 'get' + }); +}; + +/** + * 新增题库类别 + * @param data + */ +export const addQuestionsCategory = (data: QuestionsCategoryForm) => { + return request({ + url: '/safety/questionsCategory', + method: 'post', + data: data + }); +}; + +/** + * 修改题库类别 + * @param data + */ +export const updateQuestionsCategory = (data: QuestionsCategoryForm) => { + return request({ + url: '/safety/questionsCategory', + method: 'put', + data: data + }); +}; + +/** + * 删除题库类别 + * @param id + */ +export const delQuestionsCategory = (id: string | number | Array) => { + return request({ + url: '/safety/questionsCategory/' + id, + method: 'delete' + }); +}; diff --git a/src/api/safety/questionsCategory/types.ts b/src/api/safety/questionsCategory/types.ts new file mode 100644 index 0000000..6388b41 --- /dev/null +++ b/src/api/safety/questionsCategory/types.ts @@ -0,0 +1,41 @@ +export interface QuestionsCategoryVO { + /** + * 题库类别 + */ + categoryName: string; + id: string | number; +} + +export interface QuestionsCategoryForm extends BaseEntity { + /** + * 主键id + */ + id?: string | number; + + /** + * 项目id + */ + projectId?: string | number; + + /** + * 题库类别 + */ + categoryName?: string; +} + +export interface QuestionsCategoryQuery extends PageQuery { + /** + * 项目id + */ + projectId?: string | number; + + /** + * 题库类别 + */ + categoryName?: string; + + /** + * 日期范围参数 + */ + params?: any; +} diff --git a/src/api/system/oss/index.ts b/src/api/system/oss/index.ts index 5f7284b..1141f95 100644 --- a/src/api/system/oss/index.ts +++ b/src/api/system/oss/index.ts @@ -1,4 +1,4 @@ -import request from '@/utils/request'; +import request, { download } from '@/utils/request'; import { OssQuery, OssVO } from './types'; import { AxiosPromise } from 'axios'; @@ -26,3 +26,8 @@ export function delOss(ossId: string | number | Array) { method: 'delete' }); } + +// 下载OSS对象存储 +export function downLoadOss(ossId: string | number | Array) { + return download('/safety/questionUserAnswer/exportFile', { userIdList: ossId }, '安全考试.zip'); +} diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index b869d47..d99e01f 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -16,10 +16,41 @@ :list-type="isConstruction ? 'picture-card' : 'text'" :accept="accept" :drag="isDarg" + :data="data" > - - 选取文件 - 导入员工资料 + + + 选取文件 + 导入员工资料 + +
+ 请上传 + + + 的文件 +
+ + +
  • + + {{ getFileName(file.name) }} + +
    + 删除 +
    +
  • +
    +
    + - -
    - 请上传 - - - 的文件 -
    - - -
  • - - {{ getFileName(file.name) }} - -
    - 删除 -
    -
  • -
    @@ -93,7 +97,9 @@ const props = defineProps({ //ip地址 uploadUrl: propTypes.string.def('/resource/oss/upload'), //可拖拽上传 - isDarg: propTypes.bool.def(false) + isDarg: propTypes.bool.def(false), + // 其他参数 + data: propTypes.object.def({}) }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -233,7 +239,6 @@ const uploadedSuccessfully = () => { } if (number.value > 0 && uploadList.value.length === number.value) { fileList.value = fileList.value.filter((f) => f.url !== undefined).concat(uploadList.value); - console.log('🚀 ~ uploadedSuccessfully ~ fileList.value:', fileList.value); uploadList.value = []; number.value = 0; diff --git a/src/views/machinery/index.vue b/src/views/machinery/index.vue index 1a5b2b7..11feda0 100644 --- a/src/views/machinery/index.vue +++ b/src/views/machinery/index.vue @@ -234,6 +234,7 @@ const submitForm = () => { machineryFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; + form.value.projectId = currentProject.value.id; if (form.value.id) { await updateMachinery(form.value).finally(() => (buttonLoading.value = false)); } else { diff --git a/src/views/project/constructionUser/index.vue b/src/views/project/constructionUser/index.vue index eab23cd..3df5775 100644 --- a/src/views/project/constructionUser/index.vue +++ b/src/views/project/constructionUser/index.vue @@ -12,7 +12,7 @@ - + diff --git a/src/views/safety/questionUserAnswer/index.vue b/src/views/safety/questionUserAnswer/index.vue index 0ceff89..bc78bef 100644 --- a/src/views/safety/questionUserAnswer/index.vue +++ b/src/views/safety/questionUserAnswer/index.vue @@ -4,26 +4,13 @@
    - - + + - - - - - - - - - - - - - - - - - + + + + 搜索 @@ -38,26 +25,25 @@ diff --git a/src/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue b/src/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue index 7004a8b..5d0e551 100644 --- a/src/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue +++ b/src/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue @@ -5,52 +5,56 @@ 填报人:{{ safetyInspectionDetail?.creatorName }} 填报时间:{{ safetyInspectionDetail?.createTime }} - - {{ currentProject?.name }} - + + {{ currentProject?.name }} + - + - {{ safetyInspectionDetail?.checkTime }} - {{ safetyInspectionDetail?.correctorName }} - {{ safetyInspectionDetail?.correctorName }} - + {{ safetyInspectionDetail?.checkTime }} + {{ safetyInspectionDetail?.creatorName }} + {{ safetyInspectionDetail?.correctorName }} + {{ dayjs(safetyInspectionDetail?.rectificationDeadline).format('YYYY 年 MM 月 DD 日') }} -
    巡检结果
    - - {{ safetyInspectionDetail?.hiddenDanger }} - + + + + + {{ safetyInspectionDetail?.hiddenDanger }} +
    - + {{ item.originalName }}
    - +
    -
    整改情况
    - - {{ safetyInspectionDetail?.teamName }} - {{ safetyInspectionDetail?.rectificationTime }} - + + + + + {{ safetyInspectionDetail?.teamName }} + {{ safetyInspectionDetail?.rectificationTime }} + {{ safetyInspectionDetail?.measure }} - +
    @@ -64,12 +68,14 @@
    +
    + + -
    复查结果
    - - {{ safetyInspectionDetail?.creatorName }} - {{ safetyInspectionDetail?.reviewTime }} - {{ safetyInspectionDetail?.review }} + + {{ safetyInspectionDetail?.creatorName }} + {{ safetyInspectionDetail?.reviewTime }} + {{ safetyInspectionDetail?.review }}
    @@ -134,14 +140,14 @@ watch( ); - diff --git a/src/views/safety/safetyInspection/index.vue b/src/views/safety/safetyInspection/index.vue index b949050..15e2cdd 100644 --- a/src/views/safety/safetyInspection/index.vue +++ b/src/views/safety/safetyInspection/index.vue @@ -86,7 +86,7 @@ - 修改 + 删除 @@ -117,7 +117,7 @@ - + @@ -165,11 +165,11 @@ import { SafetyInspectionForm, SafetyInspectionQuery, SafetyInspectionVO } from import { useUserStoreHook } from '@/store/modules/user'; import SafetyInspectionDetailDialog from '@/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue'; import { listProjectTeamForeman } from '@/api/project/projectTeam'; -import { ProjectTeamForemanResp } from '@/api/project/projectTeam/types'; +import { foremanQuery, ProjectTeamForemanResp } from '@/api/project/projectTeam/types'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const { safety_inspection_violation_type, review_type, reply_type, safety_inspection_type, safety_inspection_check_type } = toRefs( - proxy?.useDict('safety_inspection_violation_type', 'review_type', 'reply_type', 'safety_inspection_type', 'safety_inspection_check_type') +const { safety_inspection_violation_type, review_type, safety_inspection_type, safety_inspection_check_type } = toRefs( + proxy?.useDict('safety_inspection_violation_type', 'review_type', 'safety_inspection_type', 'safety_inspection_check_type') ); // 获取用户 store const userStore = useUserStoreHook(); @@ -252,8 +252,8 @@ const data = reactive>({ const { queryParams, form, rules } = toRefs(data); -const teamOpt = ref(); -const foremanOpt = ref(); +const teamOpt = ref([]); +const foremanOpt = ref([]); const teamList = ref(); /** 查询安全巡检工单列表 */ const getList = async () => { @@ -268,16 +268,17 @@ const getList = async () => { label: team.teamName, value: team.id })); - foremanOpt.value = teamList.value.map((team: ProjectTeamForemanResp) => ({ - label: team.foremanName, - value: team.foremanId - })); + loading.value = false; }; const changeForeman = (value: string | number) => { - const team = teamList.value.find((team) => team.id === value); - form.value.correctorId = team.foremanId; + const team = teamList.value.filter((team) => team.id === value)[0]; + foremanOpt.value = team.foremanList?.map((foreman: foremanQuery) => ({ + label: foreman.foremanName, + value: foreman.foremanId + })); + form.value.correctorId = ''; }; /** 展开安全巡检工单详情对话框操作 */ @@ -342,6 +343,7 @@ const submitForm = () => { safetyInspectionFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; + form.value.projectId = currentProject.value.id; if (form.value.id) { await updateSafetyInspection(form.value).finally(() => (buttonLoading.value = false)); } else { @@ -374,6 +376,20 @@ const handleExport = () => { ); }; +//监听项目id刷新数据 +const listeningProject = watch( + () => currentProject.value.id, + (nid, oid) => { + queryParams.value.projectId = nid; + form.value.projectId = nid; + getList(); + } +); + +onUnmounted(() => { + listeningProject(); +}); + onMounted(() => { getList(); }); diff --git a/src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue b/src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue index cadd346..ad971b4 100644 --- a/src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue +++ b/src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue @@ -42,7 +42,7 @@ - + {{ item.originalName }} diff --git a/src/views/safety/safetyLog/index.vue b/src/views/safety/safetyLog/index.vue index 64a9e5c..63607b0 100644 --- a/src/views/safety/safetyLog/index.vue +++ b/src/views/safety/safetyLog/index.vue @@ -70,7 +70,7 @@ - + @@ -283,6 +283,7 @@ const submitForm = () => { safetyLogFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; + form.value.projectId = currentProject.value.id; if (form.value.id) { await updateSafetyLog(form.value).finally(() => (buttonLoading.value = false)); } else { @@ -315,6 +316,20 @@ const handleExport = () => { ); }; +//监听项目id刷新数据 +const listeningProject = watch( + () => currentProject.value.id, + (nid, oid) => { + queryParams.value.projectId = nid; + form.value.projectId = nid; + getList(); + } +); + +onUnmounted(() => { + listeningProject(); +}); + onMounted(() => { getList(); }); diff --git a/src/views/safety/safetyWeeklyReport/index.vue b/src/views/safety/safetyWeeklyReport/index.vue index 2a2decf..59dd21c 100644 --- a/src/views/safety/safetyWeeklyReport/index.vue +++ b/src/views/safety/safetyWeeklyReport/index.vue @@ -231,6 +231,7 @@ const submitForm = () => { safetyWeeklyReportFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; + form.value.projectId = currentProject.value.id; if (form.value.id) { await updateSafetyWeeklyReport(form.value).finally(() => (buttonLoading.value = false)); } else { @@ -263,6 +264,20 @@ const handleExport = () => { ); }; +//监听项目id刷新数据 +const listeningProject = watch( + () => currentProject.value.id, + (nid, oid) => { + queryParams.value.projectId = nid; + form.value.projectId = nid; + getList(); + } +); + +onUnmounted(() => { + listeningProject(); +}); + onMounted(() => { getList(); }); diff --git a/src/views/safety/teamMeeting/index.vue b/src/views/safety/teamMeeting/index.vue index 1cad2ad..e64f1fa 100644 --- a/src/views/safety/teamMeeting/index.vue +++ b/src/views/safety/teamMeeting/index.vue @@ -268,6 +268,20 @@ const handleExport = () => { ); }; +//监听项目id刷新数据 +const listeningProject = watch( + () => currentProject.value.id, + (nid, oid) => { + queryParams.value.projectId = nid; + form.value.projectId = nid; + getList(); + } +); + +onUnmounted(() => { + listeningProject(); +}); + onMounted(() => { getList(); });