diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/views/business/lab/certificateReportRetrieval/reportList.vue b/src/views/business/lab/certificateReportRetrieval/reportList.vue index e792799..93f007a 100644 --- a/src/views/business/lab/certificateReportRetrieval/reportList.vue +++ b/src/views/business/lab/certificateReportRetrieval/reportList.vue @@ -11,7 +11,7 @@ import { download } from '@/utils/download' import { UploadFile } from '@/api/measure/file' -import { certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' +import { batchImport, certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' import { getUserList } from '@/api/system/user' import { exportFile } from '@/utils/exportUtils' const { proxy } = getCurrentInstance() as any @@ -132,16 +132,22 @@ } // 点击下载 -const downloadFile = (row: any) => { - if (row.printFileName) { +const downloadFile = (row: any, type: 'cert' | 'scanPdf') => { + let fileUrl = '' + let fileName = '' + if (type === 'cert' && row.printFileName) { fileUrl = row.printFileName } + if (type === 'scanPdf' && row.certificateReportPdf) { fileUrl = row.certificateReportPdf } + if (fileUrl) { const loading = ElLoading.service({ lock: true, text: '下载中,请稍后...', background: 'rgba(255, 255, 255, 0.6)', }) - getPhotoUrl(row.printFileName).then((res) => { + getPhotoUrl(fileUrl).then((res) => { const fileType = res.data.split('.')[res.data.split('.').length - 1] - download(res.data, `${row.certificateName}.${fileType}` as string) + if (type === 'cert') { fileName = `${row.certificateName}.${fileType}` } + if (type === 'scanPdf') { fileName = row.certificateReportPdf } + download(res.data, fileName) loading.close() }).catch(() => { ElMessage.error('下载失败') @@ -178,48 +184,73 @@ // -----------------------------------------更换证书------------------------------------------- const fileRef = ref() // 文件上传input +const importFileType = ref('changeCert') const changeCertificateReportId = ref('') const onFileChange = (event: any) => { // 原生上传 - console.log(event.target.files) - const files = event.target.files - if (files.length !== 0) { + if (importFileType.value === 'changeCert') { + const files = event.target.files + if (files.length !== 0) { // 创建formdata对象 - const fd = new FormData() - for (var i = 0; i < files.length; i++) { - fd.append('multipartFile', files[i]) - } - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.6)', - }) - UploadFile(fd).then((res) => { - if (res.code === 200) { + const fd = new FormData() + for (var i = 0; i < files.length; i++) { + fd.append('multipartFile', files[i]) + } + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.6)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { // ElMessage.success('文件上传成功') - event.target.value = '' - const params = { - minioFileName: res.data[0], - certificatePrintId: changeCertificateReportId.value, + event.target.value = '' + const params = { + minioFileName: res.data[0], + certificatePrintId: changeCertificateReportId.value, + } + changeCert(params).then(() => { + ElMessage.success('更换证书成功') + loading.close() + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) } - changeCert(params).then(() => { - ElMessage.success('更换证书成功') + else { + ElMessage.error(res.message) + } + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) + } + } + else if (importFileType.value === 'batchImport') { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('file', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + batchImport(fd).then((res) => { + if (res.code === 200) { + ElMessage.success('批量导入成功') + fetchData(false) loading.close() - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) - } - else { - ElMessage.error(res.message) - } - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) + event.target.value = '' + } + else { + ElMessage.error(res.message) + } + }) + } } } const upload = () => { + importFileType.value = 'changeCert' fileRef.value.click() } // 点击更换证书 @@ -227,6 +258,12 @@ changeCertificateReportId.value = row.id upload() } + +// 批量导入 +const handleBatchImport = () => { + importFileType.value = 'batchImport' + fileRef.value.click() +} // ------------------------------------------------------------------------------------------------- @@ -316,6 +353,9 @@ + - + - + diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/views/business/lab/certificateReportRetrieval/reportList.vue b/src/views/business/lab/certificateReportRetrieval/reportList.vue index e792799..93f007a 100644 --- a/src/views/business/lab/certificateReportRetrieval/reportList.vue +++ b/src/views/business/lab/certificateReportRetrieval/reportList.vue @@ -11,7 +11,7 @@ import { download } from '@/utils/download' import { UploadFile } from '@/api/measure/file' -import { certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' +import { batchImport, certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' import { getUserList } from '@/api/system/user' import { exportFile } from '@/utils/exportUtils' const { proxy } = getCurrentInstance() as any @@ -132,16 +132,22 @@ } // 点击下载 -const downloadFile = (row: any) => { - if (row.printFileName) { +const downloadFile = (row: any, type: 'cert' | 'scanPdf') => { + let fileUrl = '' + let fileName = '' + if (type === 'cert' && row.printFileName) { fileUrl = row.printFileName } + if (type === 'scanPdf' && row.certificateReportPdf) { fileUrl = row.certificateReportPdf } + if (fileUrl) { const loading = ElLoading.service({ lock: true, text: '下载中,请稍后...', background: 'rgba(255, 255, 255, 0.6)', }) - getPhotoUrl(row.printFileName).then((res) => { + getPhotoUrl(fileUrl).then((res) => { const fileType = res.data.split('.')[res.data.split('.').length - 1] - download(res.data, `${row.certificateName}.${fileType}` as string) + if (type === 'cert') { fileName = `${row.certificateName}.${fileType}` } + if (type === 'scanPdf') { fileName = row.certificateReportPdf } + download(res.data, fileName) loading.close() }).catch(() => { ElMessage.error('下载失败') @@ -178,48 +184,73 @@ // -----------------------------------------更换证书------------------------------------------- const fileRef = ref() // 文件上传input +const importFileType = ref('changeCert') const changeCertificateReportId = ref('') const onFileChange = (event: any) => { // 原生上传 - console.log(event.target.files) - const files = event.target.files - if (files.length !== 0) { + if (importFileType.value === 'changeCert') { + const files = event.target.files + if (files.length !== 0) { // 创建formdata对象 - const fd = new FormData() - for (var i = 0; i < files.length; i++) { - fd.append('multipartFile', files[i]) - } - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.6)', - }) - UploadFile(fd).then((res) => { - if (res.code === 200) { + const fd = new FormData() + for (var i = 0; i < files.length; i++) { + fd.append('multipartFile', files[i]) + } + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.6)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { // ElMessage.success('文件上传成功') - event.target.value = '' - const params = { - minioFileName: res.data[0], - certificatePrintId: changeCertificateReportId.value, + event.target.value = '' + const params = { + minioFileName: res.data[0], + certificatePrintId: changeCertificateReportId.value, + } + changeCert(params).then(() => { + ElMessage.success('更换证书成功') + loading.close() + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) } - changeCert(params).then(() => { - ElMessage.success('更换证书成功') + else { + ElMessage.error(res.message) + } + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) + } + } + else if (importFileType.value === 'batchImport') { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('file', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + batchImport(fd).then((res) => { + if (res.code === 200) { + ElMessage.success('批量导入成功') + fetchData(false) loading.close() - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) - } - else { - ElMessage.error(res.message) - } - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) + event.target.value = '' + } + else { + ElMessage.error(res.message) + } + }) + } } } const upload = () => { + importFileType.value = 'changeCert' fileRef.value.click() } // 点击更换证书 @@ -227,6 +258,12 @@ changeCertificateReportId.value = row.id upload() } + +// 批量导入 +const handleBatchImport = () => { + importFileType.value = 'batchImport' + fileRef.value.click() +} // ------------------------------------------------------------------------------------------------- @@ -316,6 +353,9 @@ + - + diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index 824f0f8..f047365 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -31,6 +31,7 @@ const mesureCategoryList = ref([]) // 校检类别 const measureTypeList = ref([]) // 检定方式 const measureWayList = ref([]) // 检测方式 +const sampleBelongList = ref([]) // 样品属性列表 const powerVoltageList = ref([]) // 电源电压 const userList = ref([]) // 人员列表 const ABCList = ref([]) // ABC @@ -67,6 +68,7 @@ busPersonId: '', // 业务员id busPersonName: '', // 业务员名字 + sampleBelong: '1', // 样品属性 })// 表单 const ruleFormRef = ref() @@ -98,6 +100,7 @@ measurePeriod: [{ validator: validateMesurePeriod, trigger: 'blur' }], // busPersonId: [{ required: true, message: '业务员必填', trigger: 'change' }], // powerVoltage: [{ required: true, message: '电源电压必填', trigger: 'change' }], + sampleBelong: [{ required: true, message: '样品属性必填', trigger: 'change' }], }) // 表单验证规则 // 其他关联数据列表 @@ -108,6 +111,10 @@ // 获取字典值 function getDict() { + // 获取样品属性 + getDictByCode('sampleBelong').then((response) => { + sampleBelongList.value = response.data + }) // 校检类别 getDictByCode('measureCategory').then((response) => { mesureCategoryList.value = response.data @@ -697,6 +704,18 @@ + + + + + + + @@ -755,7 +774,7 @@ - + diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/views/business/lab/certificateReportRetrieval/reportList.vue b/src/views/business/lab/certificateReportRetrieval/reportList.vue index e792799..93f007a 100644 --- a/src/views/business/lab/certificateReportRetrieval/reportList.vue +++ b/src/views/business/lab/certificateReportRetrieval/reportList.vue @@ -11,7 +11,7 @@ import { download } from '@/utils/download' import { UploadFile } from '@/api/measure/file' -import { certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' +import { batchImport, certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' import { getUserList } from '@/api/system/user' import { exportFile } from '@/utils/exportUtils' const { proxy } = getCurrentInstance() as any @@ -132,16 +132,22 @@ } // 点击下载 -const downloadFile = (row: any) => { - if (row.printFileName) { +const downloadFile = (row: any, type: 'cert' | 'scanPdf') => { + let fileUrl = '' + let fileName = '' + if (type === 'cert' && row.printFileName) { fileUrl = row.printFileName } + if (type === 'scanPdf' && row.certificateReportPdf) { fileUrl = row.certificateReportPdf } + if (fileUrl) { const loading = ElLoading.service({ lock: true, text: '下载中,请稍后...', background: 'rgba(255, 255, 255, 0.6)', }) - getPhotoUrl(row.printFileName).then((res) => { + getPhotoUrl(fileUrl).then((res) => { const fileType = res.data.split('.')[res.data.split('.').length - 1] - download(res.data, `${row.certificateName}.${fileType}` as string) + if (type === 'cert') { fileName = `${row.certificateName}.${fileType}` } + if (type === 'scanPdf') { fileName = row.certificateReportPdf } + download(res.data, fileName) loading.close() }).catch(() => { ElMessage.error('下载失败') @@ -178,48 +184,73 @@ // -----------------------------------------更换证书------------------------------------------- const fileRef = ref() // 文件上传input +const importFileType = ref('changeCert') const changeCertificateReportId = ref('') const onFileChange = (event: any) => { // 原生上传 - console.log(event.target.files) - const files = event.target.files - if (files.length !== 0) { + if (importFileType.value === 'changeCert') { + const files = event.target.files + if (files.length !== 0) { // 创建formdata对象 - const fd = new FormData() - for (var i = 0; i < files.length; i++) { - fd.append('multipartFile', files[i]) - } - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.6)', - }) - UploadFile(fd).then((res) => { - if (res.code === 200) { + const fd = new FormData() + for (var i = 0; i < files.length; i++) { + fd.append('multipartFile', files[i]) + } + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.6)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { // ElMessage.success('文件上传成功') - event.target.value = '' - const params = { - minioFileName: res.data[0], - certificatePrintId: changeCertificateReportId.value, + event.target.value = '' + const params = { + minioFileName: res.data[0], + certificatePrintId: changeCertificateReportId.value, + } + changeCert(params).then(() => { + ElMessage.success('更换证书成功') + loading.close() + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) } - changeCert(params).then(() => { - ElMessage.success('更换证书成功') + else { + ElMessage.error(res.message) + } + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) + } + } + else if (importFileType.value === 'batchImport') { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('file', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + batchImport(fd).then((res) => { + if (res.code === 200) { + ElMessage.success('批量导入成功') + fetchData(false) loading.close() - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) - } - else { - ElMessage.error(res.message) - } - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) + event.target.value = '' + } + else { + ElMessage.error(res.message) + } + }) + } } } const upload = () => { + importFileType.value = 'changeCert' fileRef.value.click() } // 点击更换证书 @@ -227,6 +258,12 @@ changeCertificateReportId.value = row.id upload() } + +// 批量导入 +const handleBatchImport = () => { + importFileType.value = 'batchImport' + fileRef.value.click() +} // ------------------------------------------------------------------------------------------------- @@ -316,6 +353,9 @@ + - + diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index 824f0f8..f047365 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -31,6 +31,7 @@ const mesureCategoryList = ref([]) // 校检类别 const measureTypeList = ref([]) // 检定方式 const measureWayList = ref([]) // 检测方式 +const sampleBelongList = ref([]) // 样品属性列表 const powerVoltageList = ref([]) // 电源电压 const userList = ref([]) // 人员列表 const ABCList = ref([]) // ABC @@ -67,6 +68,7 @@ busPersonId: '', // 业务员id busPersonName: '', // 业务员名字 + sampleBelong: '1', // 样品属性 })// 表单 const ruleFormRef = ref() @@ -98,6 +100,7 @@ measurePeriod: [{ validator: validateMesurePeriod, trigger: 'blur' }], // busPersonId: [{ required: true, message: '业务员必填', trigger: 'change' }], // powerVoltage: [{ required: true, message: '电源电压必填', trigger: 'change' }], + sampleBelong: [{ required: true, message: '样品属性必填', trigger: 'change' }], }) // 表单验证规则 // 其他关联数据列表 @@ -108,6 +111,10 @@ // 获取字典值 function getDict() { + // 获取样品属性 + getDictByCode('sampleBelong').then((response) => { + sampleBelongList.value = response.data + }) // 校检类别 getDictByCode('measureCategory').then((response) => { mesureCategoryList.value = response.data @@ -697,6 +704,18 @@ + + + + + + + @@ -755,7 +774,7 @@ - + diff --git a/src/views/customer/sample/list/sample_list_interface.ts b/src/views/customer/sample/list/sample_list_interface.ts index 09b103b..3b0dccb 100644 --- a/src/views/customer/sample/list/sample_list_interface.ts +++ b/src/views/customer/sample/list/sample_list_interface.ts @@ -62,6 +62,8 @@ busPersonId: string // 业务员id busPersonName: string // 业务员名字 + + sampleBelong?: string // 样品属性 } // 检定记录 diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/views/business/lab/certificateReportRetrieval/reportList.vue b/src/views/business/lab/certificateReportRetrieval/reportList.vue index e792799..93f007a 100644 --- a/src/views/business/lab/certificateReportRetrieval/reportList.vue +++ b/src/views/business/lab/certificateReportRetrieval/reportList.vue @@ -11,7 +11,7 @@ import { download } from '@/utils/download' import { UploadFile } from '@/api/measure/file' -import { certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' +import { batchImport, certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' import { getUserList } from '@/api/system/user' import { exportFile } from '@/utils/exportUtils' const { proxy } = getCurrentInstance() as any @@ -132,16 +132,22 @@ } // 点击下载 -const downloadFile = (row: any) => { - if (row.printFileName) { +const downloadFile = (row: any, type: 'cert' | 'scanPdf') => { + let fileUrl = '' + let fileName = '' + if (type === 'cert' && row.printFileName) { fileUrl = row.printFileName } + if (type === 'scanPdf' && row.certificateReportPdf) { fileUrl = row.certificateReportPdf } + if (fileUrl) { const loading = ElLoading.service({ lock: true, text: '下载中,请稍后...', background: 'rgba(255, 255, 255, 0.6)', }) - getPhotoUrl(row.printFileName).then((res) => { + getPhotoUrl(fileUrl).then((res) => { const fileType = res.data.split('.')[res.data.split('.').length - 1] - download(res.data, `${row.certificateName}.${fileType}` as string) + if (type === 'cert') { fileName = `${row.certificateName}.${fileType}` } + if (type === 'scanPdf') { fileName = row.certificateReportPdf } + download(res.data, fileName) loading.close() }).catch(() => { ElMessage.error('下载失败') @@ -178,48 +184,73 @@ // -----------------------------------------更换证书------------------------------------------- const fileRef = ref() // 文件上传input +const importFileType = ref('changeCert') const changeCertificateReportId = ref('') const onFileChange = (event: any) => { // 原生上传 - console.log(event.target.files) - const files = event.target.files - if (files.length !== 0) { + if (importFileType.value === 'changeCert') { + const files = event.target.files + if (files.length !== 0) { // 创建formdata对象 - const fd = new FormData() - for (var i = 0; i < files.length; i++) { - fd.append('multipartFile', files[i]) - } - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.6)', - }) - UploadFile(fd).then((res) => { - if (res.code === 200) { + const fd = new FormData() + for (var i = 0; i < files.length; i++) { + fd.append('multipartFile', files[i]) + } + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.6)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { // ElMessage.success('文件上传成功') - event.target.value = '' - const params = { - minioFileName: res.data[0], - certificatePrintId: changeCertificateReportId.value, + event.target.value = '' + const params = { + minioFileName: res.data[0], + certificatePrintId: changeCertificateReportId.value, + } + changeCert(params).then(() => { + ElMessage.success('更换证书成功') + loading.close() + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) } - changeCert(params).then(() => { - ElMessage.success('更换证书成功') + else { + ElMessage.error(res.message) + } + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) + } + } + else if (importFileType.value === 'batchImport') { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('file', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + batchImport(fd).then((res) => { + if (res.code === 200) { + ElMessage.success('批量导入成功') + fetchData(false) loading.close() - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) - } - else { - ElMessage.error(res.message) - } - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) + event.target.value = '' + } + else { + ElMessage.error(res.message) + } + }) + } } } const upload = () => { + importFileType.value = 'changeCert' fileRef.value.click() } // 点击更换证书 @@ -227,6 +258,12 @@ changeCertificateReportId.value = row.id upload() } + +// 批量导入 +const handleBatchImport = () => { + importFileType.value = 'batchImport' + fileRef.value.click() +} // ------------------------------------------------------------------------------------------------- @@ -316,6 +353,9 @@ + - + diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index 824f0f8..f047365 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -31,6 +31,7 @@ const mesureCategoryList = ref([]) // 校检类别 const measureTypeList = ref([]) // 检定方式 const measureWayList = ref([]) // 检测方式 +const sampleBelongList = ref([]) // 样品属性列表 const powerVoltageList = ref([]) // 电源电压 const userList = ref([]) // 人员列表 const ABCList = ref([]) // ABC @@ -67,6 +68,7 @@ busPersonId: '', // 业务员id busPersonName: '', // 业务员名字 + sampleBelong: '1', // 样品属性 })// 表单 const ruleFormRef = ref() @@ -98,6 +100,7 @@ measurePeriod: [{ validator: validateMesurePeriod, trigger: 'blur' }], // busPersonId: [{ required: true, message: '业务员必填', trigger: 'change' }], // powerVoltage: [{ required: true, message: '电源电压必填', trigger: 'change' }], + sampleBelong: [{ required: true, message: '样品属性必填', trigger: 'change' }], }) // 表单验证规则 // 其他关联数据列表 @@ -108,6 +111,10 @@ // 获取字典值 function getDict() { + // 获取样品属性 + getDictByCode('sampleBelong').then((response) => { + sampleBelongList.value = response.data + }) // 校检类别 getDictByCode('measureCategory').then((response) => { mesureCategoryList.value = response.data @@ -697,6 +704,18 @@ + + + + + + + @@ -755,7 +774,7 @@ - + diff --git a/src/views/customer/sample/list/sample_list_interface.ts b/src/views/customer/sample/list/sample_list_interface.ts index 09b103b..3b0dccb 100644 --- a/src/views/customer/sample/list/sample_list_interface.ts +++ b/src/views/customer/sample/list/sample_list_interface.ts @@ -62,6 +62,8 @@ busPersonId: string // 业务员id busPersonName: string // 业务员名字 + + sampleBelong?: string // 样品属性 } // 检定记录 diff --git a/src/views/system/tool/certTempate/list.vue b/src/views/system/tool/certTempate/list.vue index 350c8a8..b732767 100644 --- a/src/views/system/tool/certTempate/list.vue +++ b/src/views/system/tool/certTempate/list.vue @@ -14,6 +14,7 @@ templateNo: '', // 编号 templateName: '', // 名称 templateCreator: '', // 负责人 + templateDesc: '', // 模板描述 createStartTime: '', createEndTime: '', limit: 20, @@ -124,6 +125,7 @@ searchQuery.templateCreator = '' searchQuery.templateName = '' searchQuery.templateNo = '' + searchQuery.templateDesc = '' getList() } @@ -209,6 +211,9 @@ + + + diff --git a/src/api/business/lab/cert.ts b/src/api/business/lab/cert.ts index 32b5cd5..9b1c4a9 100644 --- a/src/api/business/lab/cert.ts +++ b/src/api/business/lab/cert.ts @@ -78,3 +78,12 @@ }, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/certificatePrint/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/certificate.ts b/src/api/business/subpackage/certificate.ts index 9e3ce0a..fc72918 100644 --- a/src/api/business/subpackage/certificate.ts +++ b/src/api/business/subpackage/certificate.ts @@ -57,3 +57,12 @@ data, }) } + +// 批量导入 +export function batchImport(data: FormData) { + return request({ + url: '/business/outsourceCertificate/batchImport', + method: 'post', + data, + }) +} diff --git a/src/api/business/subpackage/record.ts b/src/api/business/subpackage/record.ts index bf4fb0e..88b318e 100644 --- a/src/api/business/subpackage/record.ts +++ b/src/api/business/subpackage/record.ts @@ -95,3 +95,11 @@ }) } +// 列表-分包档案删除 +export function deleteList(data: { ids: string[] }) { + return request({ + url: '/business/outsourcer/batchDelete', + method: 'post', + data, + }) +} diff --git a/src/views/business/lab/certificateReportRetrieval/reportList.vue b/src/views/business/lab/certificateReportRetrieval/reportList.vue index e792799..93f007a 100644 --- a/src/views/business/lab/certificateReportRetrieval/reportList.vue +++ b/src/views/business/lab/certificateReportRetrieval/reportList.vue @@ -11,7 +11,7 @@ import { download } from '@/utils/download' import { UploadFile } from '@/api/measure/file' -import { certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' +import { batchImport, certificatePrintDetail, certificatePrintInvalid } from '@/api/business/lab/cert' import { getUserList } from '@/api/system/user' import { exportFile } from '@/utils/exportUtils' const { proxy } = getCurrentInstance() as any @@ -132,16 +132,22 @@ } // 点击下载 -const downloadFile = (row: any) => { - if (row.printFileName) { +const downloadFile = (row: any, type: 'cert' | 'scanPdf') => { + let fileUrl = '' + let fileName = '' + if (type === 'cert' && row.printFileName) { fileUrl = row.printFileName } + if (type === 'scanPdf' && row.certificateReportPdf) { fileUrl = row.certificateReportPdf } + if (fileUrl) { const loading = ElLoading.service({ lock: true, text: '下载中,请稍后...', background: 'rgba(255, 255, 255, 0.6)', }) - getPhotoUrl(row.printFileName).then((res) => { + getPhotoUrl(fileUrl).then((res) => { const fileType = res.data.split('.')[res.data.split('.').length - 1] - download(res.data, `${row.certificateName}.${fileType}` as string) + if (type === 'cert') { fileName = `${row.certificateName}.${fileType}` } + if (type === 'scanPdf') { fileName = row.certificateReportPdf } + download(res.data, fileName) loading.close() }).catch(() => { ElMessage.error('下载失败') @@ -178,48 +184,73 @@ // -----------------------------------------更换证书------------------------------------------- const fileRef = ref() // 文件上传input +const importFileType = ref('changeCert') const changeCertificateReportId = ref('') const onFileChange = (event: any) => { // 原生上传 - console.log(event.target.files) - const files = event.target.files - if (files.length !== 0) { + if (importFileType.value === 'changeCert') { + const files = event.target.files + if (files.length !== 0) { // 创建formdata对象 - const fd = new FormData() - for (var i = 0; i < files.length; i++) { - fd.append('multipartFile', files[i]) - } - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.6)', - }) - UploadFile(fd).then((res) => { - if (res.code === 200) { + const fd = new FormData() + for (var i = 0; i < files.length; i++) { + fd.append('multipartFile', files[i]) + } + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.6)', + }) + UploadFile(fd).then((res) => { + if (res.code === 200) { // ElMessage.success('文件上传成功') - event.target.value = '' - const params = { - minioFileName: res.data[0], - certificatePrintId: changeCertificateReportId.value, + event.target.value = '' + const params = { + minioFileName: res.data[0], + certificatePrintId: changeCertificateReportId.value, + } + changeCert(params).then(() => { + ElMessage.success('更换证书成功') + loading.close() + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) } - changeCert(params).then(() => { - ElMessage.success('更换证书成功') + else { + ElMessage.error(res.message) + } + }).catch(() => { + ElMessage.warning('文件上传失败') + loading.close() + }) + } + } + else if (importFileType.value === 'batchImport') { + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('file', event.target.files[0]) + const loading = ElLoading.service({ + lock: true, + background: 'rgba(255, 255, 255, 0.8)', + }) + batchImport(fd).then((res) => { + if (res.code === 200) { + ElMessage.success('批量导入成功') + fetchData(false) loading.close() - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) - } - else { - ElMessage.error(res.message) - } - }).catch(() => { - ElMessage.warning('文件上传失败') - loading.close() - }) + event.target.value = '' + } + else { + ElMessage.error(res.message) + } + }) + } } } const upload = () => { + importFileType.value = 'changeCert' fileRef.value.click() } // 点击更换证书 @@ -227,6 +258,12 @@ changeCertificateReportId.value = row.id upload() } + +// 批量导入 +const handleBatchImport = () => { + importFileType.value = 'batchImport' + fileRef.value.click() +} // ------------------------------------------------------------------------------------------------- @@ -316,6 +353,9 @@ + - + diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index 824f0f8..f047365 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -31,6 +31,7 @@ const mesureCategoryList = ref([]) // 校检类别 const measureTypeList = ref([]) // 检定方式 const measureWayList = ref([]) // 检测方式 +const sampleBelongList = ref([]) // 样品属性列表 const powerVoltageList = ref([]) // 电源电压 const userList = ref([]) // 人员列表 const ABCList = ref([]) // ABC @@ -67,6 +68,7 @@ busPersonId: '', // 业务员id busPersonName: '', // 业务员名字 + sampleBelong: '1', // 样品属性 })// 表单 const ruleFormRef = ref() @@ -98,6 +100,7 @@ measurePeriod: [{ validator: validateMesurePeriod, trigger: 'blur' }], // busPersonId: [{ required: true, message: '业务员必填', trigger: 'change' }], // powerVoltage: [{ required: true, message: '电源电压必填', trigger: 'change' }], + sampleBelong: [{ required: true, message: '样品属性必填', trigger: 'change' }], }) // 表单验证规则 // 其他关联数据列表 @@ -108,6 +111,10 @@ // 获取字典值 function getDict() { + // 获取样品属性 + getDictByCode('sampleBelong').then((response) => { + sampleBelongList.value = response.data + }) // 校检类别 getDictByCode('measureCategory').then((response) => { mesureCategoryList.value = response.data @@ -697,6 +704,18 @@ + + + + + + + @@ -755,7 +774,7 @@ - + diff --git a/src/views/customer/sample/list/sample_list_interface.ts b/src/views/customer/sample/list/sample_list_interface.ts index 09b103b..3b0dccb 100644 --- a/src/views/customer/sample/list/sample_list_interface.ts +++ b/src/views/customer/sample/list/sample_list_interface.ts @@ -62,6 +62,8 @@ busPersonId: string // 业务员id busPersonName: string // 业务员名字 + + sampleBelong?: string // 样品属性 } // 检定记录 diff --git a/src/views/system/tool/certTempate/list.vue b/src/views/system/tool/certTempate/list.vue index 350c8a8..b732767 100644 --- a/src/views/system/tool/certTempate/list.vue +++ b/src/views/system/tool/certTempate/list.vue @@ -14,6 +14,7 @@ templateNo: '', // 编号 templateName: '', // 名称 templateCreator: '', // 负责人 + templateDesc: '', // 模板描述 createStartTime: '', createEndTime: '', limit: 20, @@ -124,6 +125,7 @@ searchQuery.templateCreator = '' searchQuery.templateName = '' searchQuery.templateNo = '' + searchQuery.templateDesc = '' getList() } @@ -209,6 +211,9 @@ + + + diff --git a/src/views/system/tool/fileTemplate/list.vue b/src/views/system/tool/fileTemplate/list.vue index a7a6290..359523d 100644 --- a/src/views/system/tool/fileTemplate/list.vue +++ b/src/views/system/tool/fileTemplate/list.vue @@ -14,6 +14,7 @@ templateNo: '', // 编号 templateName: '', // 名称 templateCreator: '', // 负责人 + templateDesc: '', // 模板描述 createStartTime: '', createEndTime: '', limit: 20, @@ -122,6 +123,7 @@ searchQuery.templateCreator = '' searchQuery.templateName = '' searchQuery.templateNo = '' + searchQuery.templateDesc = '' getList() } @@ -207,6 +209,9 @@ + + +