diff --git a/README.md b/README.md index df9d5ba..4e29077 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -

xc-business-system

西昌计量子系统--计量业务管理系统

## 简要说明 +

本项目基于Fantastic-admin改造而来 Fatastic-admin官网 @@ -12,7 +12,7 @@ ## 特点 -- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容PC、平板和移动端 +- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容 PC、平板和移动端 - 提供系统配置文件,轻松实现个性化定制 - 精心设计的动效,让每一处的动画都干净利落 - 根据路由配置自动生成导航栏 @@ -28,7 +28,6 @@ ## 预览 - @@ -43,6 +42,7 @@
## 开发环境 + 使用本模板前,需要在本地依次安装好 Node.js, pnpm, Git 和 Visual Studio Code。 > 注意: @@ -67,7 +67,8 @@ 在 Visual Studio Code 里打开源码的文件夹,右下角会自动提示需要安装的依赖,直接点击安装即可。 -## pnpm指令 +## pnpm 指令 + ``` #安装全部依赖 pnpm install @@ -83,6 +84,7 @@ ``` ## 技术栈 + 了解并熟悉框架使用到的技术栈,能让你使用本框架更得心应手。 - Vite @@ -93,12 +95,12 @@ ## 浏览器支持情况 -主流浏览器和,不支持IE。 +主流浏览器和,不支持 IE。 -| Edge | Firefox |Chrome | Safari | -|--------- | --------- | --------- |------| -| 90+ | 80+ | 90+ |14+| +| Edge | Firefox | Chrome | Safari | +| ---- | ------- | ------ | ------ | +| 90+ | 80+ | 90+ | 14+ | -## License +## 开发所用环境\依赖版本 -Copyright (c) 2022-present WangXiaoying +- node 16.18.1 diff --git a/README.md b/README.md index df9d5ba..4e29077 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -

xc-business-system

西昌计量子系统--计量业务管理系统

## 简要说明 +

本项目基于Fantastic-admin改造而来 Fatastic-admin官网 @@ -12,7 +12,7 @@ ## 特点 -- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容PC、平板和移动端 +- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容 PC、平板和移动端 - 提供系统配置文件,轻松实现个性化定制 - 精心设计的动效,让每一处的动画都干净利落 - 根据路由配置自动生成导航栏 @@ -28,7 +28,6 @@ ## 预览 - @@ -43,6 +42,7 @@
## 开发环境 + 使用本模板前,需要在本地依次安装好 Node.js, pnpm, Git 和 Visual Studio Code。 > 注意: @@ -67,7 +67,8 @@ 在 Visual Studio Code 里打开源码的文件夹,右下角会自动提示需要安装的依赖,直接点击安装即可。 -## pnpm指令 +## pnpm 指令 + ``` #安装全部依赖 pnpm install @@ -83,6 +84,7 @@ ``` ## 技术栈 + 了解并熟悉框架使用到的技术栈,能让你使用本框架更得心应手。 - Vite @@ -93,12 +95,12 @@ ## 浏览器支持情况 -主流浏览器和,不支持IE。 +主流浏览器和,不支持 IE。 -| Edge | Firefox |Chrome | Safari | -|--------- | --------- | --------- |------| -| 90+ | 80+ | 90+ |14+| +| Edge | Firefox | Chrome | Safari | +| ---- | ------- | ------ | ------ | +| 90+ | 80+ | 90+ | 14+ | -## License +## 开发所用环境\依赖版本 -Copyright (c) 2022-present WangXiaoying +- node 16.18.1 diff --git a/src/views/equipement/source/change/change-interface.ts b/src/views/equipement/source/change/change-interface.ts index b2ba352..cd76ecb 100644 --- a/src/views/equipement/source/change/change-interface.ts +++ b/src/views/equipement/source/change/change-interface.ts @@ -45,4 +45,14 @@ changeTraceCompany: string // 拟变更溯源单位 changeTraceIllustrate: string // 拟变更溯源单位说明 changeReason: string // 变更原因 + + standardQuantityPdfFile: string // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: string // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: string // 量值溯源与传递等级word(minio文件名) + labCode: string // 实验室 + labCodeName: string // 实验室名称 + groupCode: string // 部门 + groupCodeName: string // 部门名称 + + [key: string]: string | undefined } diff --git a/README.md b/README.md index df9d5ba..4e29077 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -

xc-business-system

西昌计量子系统--计量业务管理系统

## 简要说明 +

本项目基于Fantastic-admin改造而来 Fatastic-admin官网 @@ -12,7 +12,7 @@ ## 特点 -- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容PC、平板和移动端 +- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容 PC、平板和移动端 - 提供系统配置文件,轻松实现个性化定制 - 精心设计的动效,让每一处的动画都干净利落 - 根据路由配置自动生成导航栏 @@ -28,7 +28,6 @@ ## 预览 - @@ -43,6 +42,7 @@
## 开发环境 + 使用本模板前,需要在本地依次安装好 Node.js, pnpm, Git 和 Visual Studio Code。 > 注意: @@ -67,7 +67,8 @@ 在 Visual Studio Code 里打开源码的文件夹,右下角会自动提示需要安装的依赖,直接点击安装即可。 -## pnpm指令 +## pnpm 指令 + ``` #安装全部依赖 pnpm install @@ -83,6 +84,7 @@ ``` ## 技术栈 + 了解并熟悉框架使用到的技术栈,能让你使用本框架更得心应手。 - Vite @@ -93,12 +95,12 @@ ## 浏览器支持情况 -主流浏览器和,不支持IE。 +主流浏览器和,不支持 IE。 -| Edge | Firefox |Chrome | Safari | -|--------- | --------- | --------- |------| -| 90+ | 80+ | 90+ |14+| +| Edge | Firefox | Chrome | Safari | +| ---- | ------- | ------ | ------ | +| 90+ | 80+ | 90+ | 14+ | -## License +## 开发所用环境\依赖版本 -Copyright (c) 2022-present WangXiaoying +- node 16.18.1 diff --git a/src/views/equipement/source/change/change-interface.ts b/src/views/equipement/source/change/change-interface.ts index b2ba352..cd76ecb 100644 --- a/src/views/equipement/source/change/change-interface.ts +++ b/src/views/equipement/source/change/change-interface.ts @@ -45,4 +45,14 @@ changeTraceCompany: string // 拟变更溯源单位 changeTraceIllustrate: string // 拟变更溯源单位说明 changeReason: string // 变更原因 + + standardQuantityPdfFile: string // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: string // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: string // 量值溯源与传递等级word(minio文件名) + labCode: string // 实验室 + labCodeName: string // 实验室名称 + groupCode: string // 部门 + groupCodeName: string // 部门名称 + + [key: string]: string | undefined } diff --git a/src/views/equipement/source/change/components/basic.vue b/src/views/equipement/source/change/components/basic.vue index 1b15810..b82a4f3 100644 --- a/src/views/equipement/source/change/components/basic.vue +++ b/src/views/equipement/source/change/components/basic.vue @@ -5,6 +5,7 @@ import type { FormRules } from 'element-plus' import dayjs from 'dayjs' import type { IForm } from '../change-interface' +import { UploadFile, getPhotoUrl } from '@/api/file' import type { deptType, dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' import { SCHEDULE } from '@/utils/scheduleDict' @@ -14,6 +15,7 @@ import { toTreeList } from '@/utils/structure' import { getStaffList } from '@/api/resource/register' import selectStandardDialog from '@/views/equipement/standardStateMaintenance/dialog/selectStandardDialog.vue' +import { getGradeForm } from '@/api/equipment/standard/book' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addChangeList, failUpdateChangeList, getInfo, submit, updateChangeList } from '@/api/equipment/source/change' const props = defineProps({ @@ -57,6 +59,14 @@ changeTraceCompany: '', // 拟变更溯源单位 changeTraceIllustrate: '', // 拟变更溯源单位说明 changeReason: '', // 变更原因 + + standardQuantityPdfFile: '', // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: '', // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: '', // 量值溯源与传递等级word(minio文件名) + labCode: '', // 实验室 + labCodeName: '', // 实验室名称 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 }) const ruleFormRef = ref() // 表单ref @@ -67,6 +77,7 @@ const infoId = ref('') // id const rules = ref({ // 校验规则 standardNo: [{ required: true, message: '标准代码不能为空', trigger: ['blur', 'change'] }], + standardName: [{ required: true, message: '标准装置名称不能为空', trigger: ['blur', 'change'] }], changeTraceCompany: [{ required: true, message: '拟变更溯源单位不能为空', trigger: ['blur', 'change'] }], changeTraceIllustrate: [{ required: true, message: '拟变更溯源单位说明不能为空', trigger: ['blur', 'change'] }], changeReason: [{ required: true, message: '变更原因不能为空', trigger: ['blur', 'change'] }], @@ -125,6 +136,17 @@ form.value.certificateDate = val[0].lastReviewDate // 检定日期 form.value.certificateExpireDate = val[0].certificateExpireDate // 证书有效期 form.value.manageStatus = val[0].manageStatus // 管理状态 + + form.value.labCode = val[0].labCode // 实验室 + form.value.labCodeName = val[0].labCodeName // 实验室名称 + form.value.groupCode = val[0].groupCode // 部门 + form.value.groupCodeName = val[0].groupCodeName // 部门名称 + + getGradeForm({ id: form.value.standardId }).then((res) => { + if (res.data) { + form.value.standardQuantityPdfFile = res.data.quantityPdfFile + } + }) } } @@ -222,6 +244,64 @@ form.value = res.data }) } + +// -------------------------------------------文件上传-------------------------------------- +// 文件上传 +const fileRefWord = ref() // 建标报告ref-word +const fileRefPdf = ref() // 建标报告ref-pdf +const previewPdfUrl = ref('') // 要预览的pdfurl + +// word上传文件,在 Input 值改变时触发 +const onQuantityWordFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/msword' && event.target.files[0].type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { + ElMessage.warning('请上传doc、docx文件格式') + return + } + UploadFileFn(event, 'quantityWordFile', '文件上传成功') +} +// pdf上传文件,在 Input 值改变时触发 +const onQuantityPdfFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/pdf') { + ElMessage.warning('请上传pdf格式') + return + } + UploadFileFn(event, 'quantityPdfFile', '文件上传成功') +} +// 上传文件操作 +function UploadFileFn(event: any, prop: string, message: string) { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { + form.value[prop] = res.data[0] + if (prop === 'quantityPdfFile') { + getPhotoUrl(res.data[0]).then((res: any) => { + previewPdfUrl.value = res.data + }) + } + event.target.value = null + // 重置当前验证 + ElMessage.success(message) + loading.close() + } + else { + ElMessage.error(res.message) + loading.close() + } + }) + } +} + +const upload = (fileRef: any) => { + fileRef.click() +} + // ---------------------------------------------钩子---------------------------------------------- watch(() => props.id, (newValue) => { infoId.value = newValue! @@ -404,9 +484,9 @@ - - - + + + @@ -449,14 +529,36 @@ - -

- -
+ + + + + + + + + + {{ form.quantityWordFile === '' ? '上传' : '更换附件' }} + + + + + + + + + + + + {{ form.quantityPdfFile === '' ? '上传' : '更换附件' }} + + + + +
+ +
diff --git a/README.md b/README.md index df9d5ba..4e29077 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -

xc-business-system

西昌计量子系统--计量业务管理系统

## 简要说明 +

本项目基于Fantastic-admin改造而来 Fatastic-admin官网 @@ -12,7 +12,7 @@ ## 特点 -- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容PC、平板和移动端 +- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容 PC、平板和移动端 - 提供系统配置文件,轻松实现个性化定制 - 精心设计的动效,让每一处的动画都干净利落 - 根据路由配置自动生成导航栏 @@ -28,7 +28,6 @@ ## 预览 - @@ -43,6 +42,7 @@
## 开发环境 + 使用本模板前,需要在本地依次安装好 Node.js, pnpm, Git 和 Visual Studio Code。 > 注意: @@ -67,7 +67,8 @@ 在 Visual Studio Code 里打开源码的文件夹,右下角会自动提示需要安装的依赖,直接点击安装即可。 -## pnpm指令 +## pnpm 指令 + ``` #安装全部依赖 pnpm install @@ -83,6 +84,7 @@ ``` ## 技术栈 + 了解并熟悉框架使用到的技术栈,能让你使用本框架更得心应手。 - Vite @@ -93,12 +95,12 @@ ## 浏览器支持情况 -主流浏览器和,不支持IE。 +主流浏览器和,不支持 IE。 -| Edge | Firefox |Chrome | Safari | -|--------- | --------- | --------- |------| -| 90+ | 80+ | 90+ |14+| +| Edge | Firefox | Chrome | Safari | +| ---- | ------- | ------ | ------ | +| 90+ | 80+ | 90+ | 14+ | -## License +## 开发所用环境\依赖版本 -Copyright (c) 2022-present WangXiaoying +- node 16.18.1 diff --git a/src/views/equipement/source/change/change-interface.ts b/src/views/equipement/source/change/change-interface.ts index b2ba352..cd76ecb 100644 --- a/src/views/equipement/source/change/change-interface.ts +++ b/src/views/equipement/source/change/change-interface.ts @@ -45,4 +45,14 @@ changeTraceCompany: string // 拟变更溯源单位 changeTraceIllustrate: string // 拟变更溯源单位说明 changeReason: string // 变更原因 + + standardQuantityPdfFile: string // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: string // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: string // 量值溯源与传递等级word(minio文件名) + labCode: string // 实验室 + labCodeName: string // 实验室名称 + groupCode: string // 部门 + groupCodeName: string // 部门名称 + + [key: string]: string | undefined } diff --git a/src/views/equipement/source/change/components/basic.vue b/src/views/equipement/source/change/components/basic.vue index 1b15810..b82a4f3 100644 --- a/src/views/equipement/source/change/components/basic.vue +++ b/src/views/equipement/source/change/components/basic.vue @@ -5,6 +5,7 @@ import type { FormRules } from 'element-plus' import dayjs from 'dayjs' import type { IForm } from '../change-interface' +import { UploadFile, getPhotoUrl } from '@/api/file' import type { deptType, dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' import { SCHEDULE } from '@/utils/scheduleDict' @@ -14,6 +15,7 @@ import { toTreeList } from '@/utils/structure' import { getStaffList } from '@/api/resource/register' import selectStandardDialog from '@/views/equipement/standardStateMaintenance/dialog/selectStandardDialog.vue' +import { getGradeForm } from '@/api/equipment/standard/book' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addChangeList, failUpdateChangeList, getInfo, submit, updateChangeList } from '@/api/equipment/source/change' const props = defineProps({ @@ -57,6 +59,14 @@ changeTraceCompany: '', // 拟变更溯源单位 changeTraceIllustrate: '', // 拟变更溯源单位说明 changeReason: '', // 变更原因 + + standardQuantityPdfFile: '', // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: '', // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: '', // 量值溯源与传递等级word(minio文件名) + labCode: '', // 实验室 + labCodeName: '', // 实验室名称 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 }) const ruleFormRef = ref() // 表单ref @@ -67,6 +77,7 @@ const infoId = ref('') // id const rules = ref({ // 校验规则 standardNo: [{ required: true, message: '标准代码不能为空', trigger: ['blur', 'change'] }], + standardName: [{ required: true, message: '标准装置名称不能为空', trigger: ['blur', 'change'] }], changeTraceCompany: [{ required: true, message: '拟变更溯源单位不能为空', trigger: ['blur', 'change'] }], changeTraceIllustrate: [{ required: true, message: '拟变更溯源单位说明不能为空', trigger: ['blur', 'change'] }], changeReason: [{ required: true, message: '变更原因不能为空', trigger: ['blur', 'change'] }], @@ -125,6 +136,17 @@ form.value.certificateDate = val[0].lastReviewDate // 检定日期 form.value.certificateExpireDate = val[0].certificateExpireDate // 证书有效期 form.value.manageStatus = val[0].manageStatus // 管理状态 + + form.value.labCode = val[0].labCode // 实验室 + form.value.labCodeName = val[0].labCodeName // 实验室名称 + form.value.groupCode = val[0].groupCode // 部门 + form.value.groupCodeName = val[0].groupCodeName // 部门名称 + + getGradeForm({ id: form.value.standardId }).then((res) => { + if (res.data) { + form.value.standardQuantityPdfFile = res.data.quantityPdfFile + } + }) } } @@ -222,6 +244,64 @@ form.value = res.data }) } + +// -------------------------------------------文件上传-------------------------------------- +// 文件上传 +const fileRefWord = ref() // 建标报告ref-word +const fileRefPdf = ref() // 建标报告ref-pdf +const previewPdfUrl = ref('') // 要预览的pdfurl + +// word上传文件,在 Input 值改变时触发 +const onQuantityWordFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/msword' && event.target.files[0].type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { + ElMessage.warning('请上传doc、docx文件格式') + return + } + UploadFileFn(event, 'quantityWordFile', '文件上传成功') +} +// pdf上传文件,在 Input 值改变时触发 +const onQuantityPdfFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/pdf') { + ElMessage.warning('请上传pdf格式') + return + } + UploadFileFn(event, 'quantityPdfFile', '文件上传成功') +} +// 上传文件操作 +function UploadFileFn(event: any, prop: string, message: string) { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { + form.value[prop] = res.data[0] + if (prop === 'quantityPdfFile') { + getPhotoUrl(res.data[0]).then((res: any) => { + previewPdfUrl.value = res.data + }) + } + event.target.value = null + // 重置当前验证 + ElMessage.success(message) + loading.close() + } + else { + ElMessage.error(res.message) + loading.close() + } + }) + } +} + +const upload = (fileRef: any) => { + fileRef.click() +} + // ---------------------------------------------钩子---------------------------------------------- watch(() => props.id, (newValue) => { infoId.value = newValue! @@ -404,9 +484,9 @@ - - - + + + @@ -449,14 +529,36 @@ - -

- -
+ + + + + + + + + + {{ form.quantityWordFile === '' ? '上传' : '更换附件' }} + + + + + + + + + + + + {{ form.quantityPdfFile === '' ? '上传' : '更换附件' }} + + + + +
+ +
diff --git a/src/views/equipement/standard/book/components/jobInstruction.vue b/src/views/equipement/standard/book/components/jobInstruction.vue index 33edaad..ecb00cf 100644 --- a/src/views/equipement/standard/book/components/jobInstruction.vue +++ b/src/views/equipement/standard/book/components/jobInstruction.vue @@ -59,11 +59,12 @@ listQuery.value.offset = 1 } getJobInstructionList(listQuery.value).then((response) => { - list.value = response.data.rows.map((item: { fileType: string; createTime: string }) => { + list.value = response.data.rows.map((item: { fileType: string; createTime: string; pdfUrl: string }) => { return { ...item, fileTypeName: fileTypeMap.value[item.fileType], createTime: item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD') : item.createTime, + file: item.pdfUrl, // 附件 } }) total.value = parseInt(response.data.total) @@ -241,11 +242,10 @@ #default="scope" > - + {{ scope.row[item.value] }} - - {{ scope.row[item.value] }} + {{ scope.row[item.value] }} {{ scope.row[item.value] }} xc-business-system

西昌计量子系统--计量业务管理系统

## 简要说明 +

本项目基于Fantastic-admin改造而来 Fatastic-admin官网 @@ -12,7 +12,7 @@ ## 特点 -- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容PC、平板和移动端 +- 丰富的布局与主题,覆盖市面上各种中后台应用场景,兼容 PC、平板和移动端 - 提供系统配置文件,轻松实现个性化定制 - 精心设计的动效,让每一处的动画都干净利落 - 根据路由配置自动生成导航栏 @@ -28,7 +28,6 @@ ## 预览 - @@ -43,6 +42,7 @@
## 开发环境 + 使用本模板前,需要在本地依次安装好 Node.js, pnpm, Git 和 Visual Studio Code。 > 注意: @@ -67,7 +67,8 @@ 在 Visual Studio Code 里打开源码的文件夹,右下角会自动提示需要安装的依赖,直接点击安装即可。 -## pnpm指令 +## pnpm 指令 + ``` #安装全部依赖 pnpm install @@ -83,6 +84,7 @@ ``` ## 技术栈 + 了解并熟悉框架使用到的技术栈,能让你使用本框架更得心应手。 - Vite @@ -93,12 +95,12 @@ ## 浏览器支持情况 -主流浏览器和,不支持IE。 +主流浏览器和,不支持 IE。 -| Edge | Firefox |Chrome | Safari | -|--------- | --------- | --------- |------| -| 90+ | 80+ | 90+ |14+| +| Edge | Firefox | Chrome | Safari | +| ---- | ------- | ------ | ------ | +| 90+ | 80+ | 90+ | 14+ | -## License +## 开发所用环境\依赖版本 -Copyright (c) 2022-present WangXiaoying +- node 16.18.1 diff --git a/src/views/equipement/source/change/change-interface.ts b/src/views/equipement/source/change/change-interface.ts index b2ba352..cd76ecb 100644 --- a/src/views/equipement/source/change/change-interface.ts +++ b/src/views/equipement/source/change/change-interface.ts @@ -45,4 +45,14 @@ changeTraceCompany: string // 拟变更溯源单位 changeTraceIllustrate: string // 拟变更溯源单位说明 changeReason: string // 变更原因 + + standardQuantityPdfFile: string // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: string // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: string // 量值溯源与传递等级word(minio文件名) + labCode: string // 实验室 + labCodeName: string // 实验室名称 + groupCode: string // 部门 + groupCodeName: string // 部门名称 + + [key: string]: string | undefined } diff --git a/src/views/equipement/source/change/components/basic.vue b/src/views/equipement/source/change/components/basic.vue index 1b15810..b82a4f3 100644 --- a/src/views/equipement/source/change/components/basic.vue +++ b/src/views/equipement/source/change/components/basic.vue @@ -5,6 +5,7 @@ import type { FormRules } from 'element-plus' import dayjs from 'dayjs' import type { IForm } from '../change-interface' +import { UploadFile, getPhotoUrl } from '@/api/file' import type { deptType, dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' import { SCHEDULE } from '@/utils/scheduleDict' @@ -14,6 +15,7 @@ import { toTreeList } from '@/utils/structure' import { getStaffList } from '@/api/resource/register' import selectStandardDialog from '@/views/equipement/standardStateMaintenance/dialog/selectStandardDialog.vue' +import { getGradeForm } from '@/api/equipment/standard/book' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addChangeList, failUpdateChangeList, getInfo, submit, updateChangeList } from '@/api/equipment/source/change' const props = defineProps({ @@ -57,6 +59,14 @@ changeTraceCompany: '', // 拟变更溯源单位 changeTraceIllustrate: '', // 拟变更溯源单位说明 changeReason: '', // 变更原因 + + standardQuantityPdfFile: '', // 标准装置带来的量值溯源与传递等级关系图(pdf版本) + quantityPdfFile: '', // 量值溯源与传递等级pdf(minio文件名) + quantityWordFile: '', // 量值溯源与传递等级word(minio文件名) + labCode: '', // 实验室 + labCodeName: '', // 实验室名称 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 }) const ruleFormRef = ref() // 表单ref @@ -67,6 +77,7 @@ const infoId = ref('') // id const rules = ref({ // 校验规则 standardNo: [{ required: true, message: '标准代码不能为空', trigger: ['blur', 'change'] }], + standardName: [{ required: true, message: '标准装置名称不能为空', trigger: ['blur', 'change'] }], changeTraceCompany: [{ required: true, message: '拟变更溯源单位不能为空', trigger: ['blur', 'change'] }], changeTraceIllustrate: [{ required: true, message: '拟变更溯源单位说明不能为空', trigger: ['blur', 'change'] }], changeReason: [{ required: true, message: '变更原因不能为空', trigger: ['blur', 'change'] }], @@ -125,6 +136,17 @@ form.value.certificateDate = val[0].lastReviewDate // 检定日期 form.value.certificateExpireDate = val[0].certificateExpireDate // 证书有效期 form.value.manageStatus = val[0].manageStatus // 管理状态 + + form.value.labCode = val[0].labCode // 实验室 + form.value.labCodeName = val[0].labCodeName // 实验室名称 + form.value.groupCode = val[0].groupCode // 部门 + form.value.groupCodeName = val[0].groupCodeName // 部门名称 + + getGradeForm({ id: form.value.standardId }).then((res) => { + if (res.data) { + form.value.standardQuantityPdfFile = res.data.quantityPdfFile + } + }) } } @@ -222,6 +244,64 @@ form.value = res.data }) } + +// -------------------------------------------文件上传-------------------------------------- +// 文件上传 +const fileRefWord = ref() // 建标报告ref-word +const fileRefPdf = ref() // 建标报告ref-pdf +const previewPdfUrl = ref('') // 要预览的pdfurl + +// word上传文件,在 Input 值改变时触发 +const onQuantityWordFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/msword' && event.target.files[0].type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { + ElMessage.warning('请上传doc、docx文件格式') + return + } + UploadFileFn(event, 'quantityWordFile', '文件上传成功') +} +// pdf上传文件,在 Input 值改变时触发 +const onQuantityPdfFileChange = (event: any) => { + if (event.target.files[0].type !== 'application/pdf') { + ElMessage.warning('请上传pdf格式') + return + } + UploadFileFn(event, 'quantityPdfFile', '文件上传成功') +} +// 上传文件操作 +function UploadFileFn(event: any, prop: string, message: string) { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { + form.value[prop] = res.data[0] + if (prop === 'quantityPdfFile') { + getPhotoUrl(res.data[0]).then((res: any) => { + previewPdfUrl.value = res.data + }) + } + event.target.value = null + // 重置当前验证 + ElMessage.success(message) + loading.close() + } + else { + ElMessage.error(res.message) + loading.close() + } + }) + } +} + +const upload = (fileRef: any) => { + fileRef.click() +} + // ---------------------------------------------钩子---------------------------------------------- watch(() => props.id, (newValue) => { infoId.value = newValue! @@ -404,9 +484,9 @@ - - - + + + @@ -449,14 +529,36 @@ - -

- -
+ + + + + + + + + + {{ form.quantityWordFile === '' ? '上传' : '更换附件' }} + + + + + + + + + + + + {{ form.quantityPdfFile === '' ? '上传' : '更换附件' }} + + + + +
+ +
diff --git a/src/views/equipement/standard/book/components/jobInstruction.vue b/src/views/equipement/standard/book/components/jobInstruction.vue index 33edaad..ecb00cf 100644 --- a/src/views/equipement/standard/book/components/jobInstruction.vue +++ b/src/views/equipement/standard/book/components/jobInstruction.vue @@ -59,11 +59,12 @@ listQuery.value.offset = 1 } getJobInstructionList(listQuery.value).then((response) => { - list.value = response.data.rows.map((item: { fileType: string; createTime: string }) => { + list.value = response.data.rows.map((item: { fileType: string; createTime: string; pdfUrl: string }) => { return { ...item, fileTypeName: fileTypeMap.value[item.fileType], createTime: item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD') : item.createTime, + file: item.pdfUrl, // 附件 } }) total.value = parseInt(response.data.total) @@ -241,11 +242,10 @@ #default="scope" > - + {{ scope.row[item.value] }} - - {{ scope.row[item.value] }} + {{ scope.row[item.value] }} {{ scope.row[item.value] }} >([ - { text: '实验室', value: 'labCodeName', align: 'center', required: true }, + { text: '实验室', value: 'labCodeName', align: 'center', required: false }, { text: '部门', value: 'groupCodeName', align: 'center', required: false }, - { text: '文件类型', value: 'fileCategoryName', align: 'center', width: '140', required: true }, - { text: '文件编号', value: 'fileNo', align: 'center', required: true }, - { text: '文件名称', value: 'fileName', align: 'center', required: true }, - { text: '版本号', value: 'fileVersion', align: 'center', required: true }, - { text: '发放号', value: 'fileDistributeNo', align: 'center', width: '120', required: true }, - { text: '文件附件(word版)', value: 'wordUrl', align: 'center', width: '220', required: true }, - { text: '文件附件(pdf版)', value: 'pdfUrl', align: 'center', width: '220', required: true }, + { text: '文件类型', value: 'fileCategoryName', align: 'center', width: '140', required: false }, + { text: '文件编号', value: 'fileNo', align: 'center', required: false }, + { text: '文件名称', value: 'fileName', align: 'center', required: false }, + { text: '版本号', value: 'fileVersion', align: 'center', required: false }, + { text: '发放号', value: 'fileDistributeNo', align: 'center', width: '120', required: false }, + { text: '文件附件(word版)', value: 'wordUrl', align: 'center', width: '220', required: false }, + { text: '文件附件(pdf版)', value: 'pdfUrl', align: 'center', width: '220', required: false }, { text: '备注', value: 'remark', align: 'center' }, ]) // 表头 @@ -266,7 +266,7 @@ if (!changeFormRef) { return } if (changeForm.value.fileList.length === 0) { - ElMessage.error('文件列表不能为空') + ElMessage.warning('文件列表不能为空') return }