diff --git a/src/views/business/board/overdueReminder/detail.vue b/src/views/business/board/overdueReminder/detail.vue index 6e72218..50aa545 100644 --- a/src/views/business/board/overdueReminder/detail.vue +++ b/src/views/business/board/overdueReminder/detail.vue @@ -3,19 +3,18 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import ProcessConfig from '@/views/business/schedule/task/components/processConfig.vue' import type { ISampleMeasure, ITaskDetail } from '@/views/business/schedule/task/task-interface' -import type { SimpleCertification, SimpleMeasureRecord } from '@/views/customer/sample/list/sample_list_interface' +import type { Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import showPhoto from '@/views/system/tool/showPhoto.vue' import { getTaskDetail } from '@/api/business/schedule/task' import countries from '@/components/AddressSelect/country-code.json' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' -interface dictType { - id: string - name: string - value: string -} +import type { IRecord } from '@/views/business/schedule/interchange/interchange_interface' +import { getCertification, getMesureRecords } from '@/api/customer/sampleList' +import TemplateTable from '@/views/customer/customerInfo/templateTable.vue' const roleType = ref('distribute') // 角色类型: distribute待分发(分发人员), dispatch待分配(实验室分配工作人员), const countryList = ref(countries) // 国家列表 const loading = ref(false) // 表单加载状态 @@ -107,32 +106,55 @@ certificationRecords: [] as SimpleCertification[], }) +// ----------------------------------检定证书、检定记录----------------------------- +const listQuery = ref({ + sampleId: sampleId.value, // 样品id + customerId: '', // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 -const fetchMeasureRecords = function (query = null) { - dataList.value.measureRecords = [] +const fetchMeasureRecords = (query = null) => { + getMesureRecords(listQuery.value).then((res) => { + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) + totalRecords.value = parseInt(res.data.total) + }) } + // 获取检定证书 -const fetchCertifications = function (query = null) { - dataList.value.certificationRecords = [] +const fetchCertifications = (query = null) => { + getCertification(listQuery.value).then((res) => { + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) + totalCertifications.value = parseInt(res.data.total) + }) } -interface Menu { - name: string - columns: TableColumn[] - pagination: boolean - list: 'measureRecords' | 'certificationRecords' - searchFunc: Function -} + // 菜单 const menu: Menu[] = [ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode' }, - { text: '委托单日期', value: 'orderTime' }, - { text: '委托方代码', value: 'customerCode' }, - { text: '委托方名称', value: 'customerName' }, - { text: '送检人', value: 'deliverer' }, - { text: '送检日期', value: 'deliverTime' }, + { text: '委托单编号', value: 'orderCode', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: 120 }, + { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托方名称', value: 'customerName', align: 'center' }, + { text: '送检人', value: 'deliverer', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: 120 }, ], list: 'measureRecords', pagination: true, @@ -141,11 +163,11 @@ { name: '检定证书', columns: [ - { text: '证书编号', value: 'certificationCode' }, - { text: '证书名称', value: 'certificationName' }, - { text: '证书类型', value: 'certificationType' }, - { text: '证书出具日期', value: 'effectiveDate' }, - { text: '证书有效期', value: 'expirationDate' }, + { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书名称', value: 'certificationName', align: 'center' }, + { text: '证书类型', value: 'certificationClassName', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: 120 }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: 120 }, ], list: 'certificationRecords', pagination: true, @@ -157,6 +179,25 @@ const currentMenuObj = computed(() => { return menu.find(item => item.name === currentMenu.value) }) +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + currentMenuObj.value?.searchFunc() +}, +{ + deep: true, + immediate: true, +}) + +// 监听检定记录和证书报告页数变化 +const changePage = (val: any) => { + if (val.value && currentMenuObj) { + listQuery.value.offset = val.value.offset + listQuery.value.limit = val.value.limit + currentMenuObj.value?.searchFunc() + } +} + +// -------------------------------底------------------------------------------------ const $router = useRouter() // 关闭新增页面的回调 @@ -164,16 +205,6 @@ $router.back() } -// 打印表单 -const printObj = ref({ - id: 'form', // 需要打印元素的id - popTitle: '样品详情', // 打印配置页上方的标题 - extraHead: '

样品详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) - // 获取分发详情 const getInfo = () => { // 获取任务详情 @@ -214,12 +245,6 @@ diff --git a/src/views/business/board/overdueReminder/detail.vue b/src/views/business/board/overdueReminder/detail.vue index 6e72218..50aa545 100644 --- a/src/views/business/board/overdueReminder/detail.vue +++ b/src/views/business/board/overdueReminder/detail.vue @@ -3,19 +3,18 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import ProcessConfig from '@/views/business/schedule/task/components/processConfig.vue' import type { ISampleMeasure, ITaskDetail } from '@/views/business/schedule/task/task-interface' -import type { SimpleCertification, SimpleMeasureRecord } from '@/views/customer/sample/list/sample_list_interface' +import type { Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import showPhoto from '@/views/system/tool/showPhoto.vue' import { getTaskDetail } from '@/api/business/schedule/task' import countries from '@/components/AddressSelect/country-code.json' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' -interface dictType { - id: string - name: string - value: string -} +import type { IRecord } from '@/views/business/schedule/interchange/interchange_interface' +import { getCertification, getMesureRecords } from '@/api/customer/sampleList' +import TemplateTable from '@/views/customer/customerInfo/templateTable.vue' const roleType = ref('distribute') // 角色类型: distribute待分发(分发人员), dispatch待分配(实验室分配工作人员), const countryList = ref(countries) // 国家列表 const loading = ref(false) // 表单加载状态 @@ -107,32 +106,55 @@ certificationRecords: [] as SimpleCertification[], }) +// ----------------------------------检定证书、检定记录----------------------------- +const listQuery = ref({ + sampleId: sampleId.value, // 样品id + customerId: '', // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 -const fetchMeasureRecords = function (query = null) { - dataList.value.measureRecords = [] +const fetchMeasureRecords = (query = null) => { + getMesureRecords(listQuery.value).then((res) => { + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) + totalRecords.value = parseInt(res.data.total) + }) } + // 获取检定证书 -const fetchCertifications = function (query = null) { - dataList.value.certificationRecords = [] +const fetchCertifications = (query = null) => { + getCertification(listQuery.value).then((res) => { + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) + totalCertifications.value = parseInt(res.data.total) + }) } -interface Menu { - name: string - columns: TableColumn[] - pagination: boolean - list: 'measureRecords' | 'certificationRecords' - searchFunc: Function -} + // 菜单 const menu: Menu[] = [ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode' }, - { text: '委托单日期', value: 'orderTime' }, - { text: '委托方代码', value: 'customerCode' }, - { text: '委托方名称', value: 'customerName' }, - { text: '送检人', value: 'deliverer' }, - { text: '送检日期', value: 'deliverTime' }, + { text: '委托单编号', value: 'orderCode', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: 120 }, + { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托方名称', value: 'customerName', align: 'center' }, + { text: '送检人', value: 'deliverer', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: 120 }, ], list: 'measureRecords', pagination: true, @@ -141,11 +163,11 @@ { name: '检定证书', columns: [ - { text: '证书编号', value: 'certificationCode' }, - { text: '证书名称', value: 'certificationName' }, - { text: '证书类型', value: 'certificationType' }, - { text: '证书出具日期', value: 'effectiveDate' }, - { text: '证书有效期', value: 'expirationDate' }, + { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书名称', value: 'certificationName', align: 'center' }, + { text: '证书类型', value: 'certificationClassName', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: 120 }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: 120 }, ], list: 'certificationRecords', pagination: true, @@ -157,6 +179,25 @@ const currentMenuObj = computed(() => { return menu.find(item => item.name === currentMenu.value) }) +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + currentMenuObj.value?.searchFunc() +}, +{ + deep: true, + immediate: true, +}) + +// 监听检定记录和证书报告页数变化 +const changePage = (val: any) => { + if (val.value && currentMenuObj) { + listQuery.value.offset = val.value.offset + listQuery.value.limit = val.value.limit + currentMenuObj.value?.searchFunc() + } +} + +// -------------------------------底------------------------------------------------ const $router = useRouter() // 关闭新增页面的回调 @@ -164,16 +205,6 @@ $router.back() } -// 打印表单 -const printObj = ref({ - id: 'form', // 需要打印元素的id - popTitle: '样品详情', // 打印配置页上方的标题 - extraHead: '

样品详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) - // 获取分发详情 const getInfo = () => { // 获取任务详情 @@ -214,12 +245,6 @@ diff --git a/src/views/business/schedule/interchange/interchangeDetail.vue b/src/views/business/schedule/interchange/interchangeDetail.vue index 3ce754d..5244f44 100644 --- a/src/views/business/schedule/interchange/interchangeDetail.vue +++ b/src/views/business/schedule/interchange/interchangeDetail.vue @@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadUserFile } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import type { IRecord } from './interchange_interface' import type { ISampleEdit, Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import selectCustomer from '@/views/customer/sample/list/selectCustomer.vue' @@ -14,7 +15,6 @@ import { UploadFile } from '@/api/measure/file' import type { ICustomer } from '@/views/customer/customerInfo/customer_interface' import { getDictByCode } from '@/api/system/dict' - const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', @@ -88,12 +88,6 @@ powerVoltage: [{ required: true, message: '要求电源电压不能为空', trigger: 'change' }], }) // 表单验证规则 -// 其他关联数据列表 -const dataList = ref({ - measureRecords: [] as SimpleMeasureRecord[], - certificationRecords: [] as SimpleCertification[], -}) - // 获取字典值 function getDict() { // 校检类别 @@ -112,19 +106,31 @@ getDict() // --------------------------检定记录、检定证书----------------------------------------- +// 其他关联数据列表 +const dataList = ref({ + measureRecords: [] as SimpleMeasureRecord[], + certificationRecords: [] as SimpleCertification[], +}) + const listQuery = ref({ sampleId: infoId.value, // 样品id customerId: '', // 客户id offset: 1, limit: 10, }) -const totalRecords = ref(0) // 检定记录 -const totalCertifications = ref(0) // 检定证书 +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -134,7 +140,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -146,11 +159,11 @@ name: '检定记录', columns: [ { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, { text: '委托方代码', value: 'customerCode', align: 'center' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], list: 'measureRecords', pagination: true, @@ -162,8 +175,8 @@ { text: '证书编号', value: 'certificationCode', align: 'center' }, { text: '证书名称', value: 'certificationName', align: 'center' }, { text: '证书类型', value: 'certificationClassName', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: '120' }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: '120' }, ], list: 'certificationRecords', pagination: true, @@ -193,6 +206,8 @@ } } +// -------------------------------------底部-------------------------------------- + // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { diff --git a/src/views/business/board/overdueReminder/detail.vue b/src/views/business/board/overdueReminder/detail.vue index 6e72218..50aa545 100644 --- a/src/views/business/board/overdueReminder/detail.vue +++ b/src/views/business/board/overdueReminder/detail.vue @@ -3,19 +3,18 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import ProcessConfig from '@/views/business/schedule/task/components/processConfig.vue' import type { ISampleMeasure, ITaskDetail } from '@/views/business/schedule/task/task-interface' -import type { SimpleCertification, SimpleMeasureRecord } from '@/views/customer/sample/list/sample_list_interface' +import type { Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import showPhoto from '@/views/system/tool/showPhoto.vue' import { getTaskDetail } from '@/api/business/schedule/task' import countries from '@/components/AddressSelect/country-code.json' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' -interface dictType { - id: string - name: string - value: string -} +import type { IRecord } from '@/views/business/schedule/interchange/interchange_interface' +import { getCertification, getMesureRecords } from '@/api/customer/sampleList' +import TemplateTable from '@/views/customer/customerInfo/templateTable.vue' const roleType = ref('distribute') // 角色类型: distribute待分发(分发人员), dispatch待分配(实验室分配工作人员), const countryList = ref(countries) // 国家列表 const loading = ref(false) // 表单加载状态 @@ -107,32 +106,55 @@ certificationRecords: [] as SimpleCertification[], }) +// ----------------------------------检定证书、检定记录----------------------------- +const listQuery = ref({ + sampleId: sampleId.value, // 样品id + customerId: '', // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 -const fetchMeasureRecords = function (query = null) { - dataList.value.measureRecords = [] +const fetchMeasureRecords = (query = null) => { + getMesureRecords(listQuery.value).then((res) => { + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) + totalRecords.value = parseInt(res.data.total) + }) } + // 获取检定证书 -const fetchCertifications = function (query = null) { - dataList.value.certificationRecords = [] +const fetchCertifications = (query = null) => { + getCertification(listQuery.value).then((res) => { + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) + totalCertifications.value = parseInt(res.data.total) + }) } -interface Menu { - name: string - columns: TableColumn[] - pagination: boolean - list: 'measureRecords' | 'certificationRecords' - searchFunc: Function -} + // 菜单 const menu: Menu[] = [ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode' }, - { text: '委托单日期', value: 'orderTime' }, - { text: '委托方代码', value: 'customerCode' }, - { text: '委托方名称', value: 'customerName' }, - { text: '送检人', value: 'deliverer' }, - { text: '送检日期', value: 'deliverTime' }, + { text: '委托单编号', value: 'orderCode', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: 120 }, + { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托方名称', value: 'customerName', align: 'center' }, + { text: '送检人', value: 'deliverer', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: 120 }, ], list: 'measureRecords', pagination: true, @@ -141,11 +163,11 @@ { name: '检定证书', columns: [ - { text: '证书编号', value: 'certificationCode' }, - { text: '证书名称', value: 'certificationName' }, - { text: '证书类型', value: 'certificationType' }, - { text: '证书出具日期', value: 'effectiveDate' }, - { text: '证书有效期', value: 'expirationDate' }, + { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书名称', value: 'certificationName', align: 'center' }, + { text: '证书类型', value: 'certificationClassName', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: 120 }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: 120 }, ], list: 'certificationRecords', pagination: true, @@ -157,6 +179,25 @@ const currentMenuObj = computed(() => { return menu.find(item => item.name === currentMenu.value) }) +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + currentMenuObj.value?.searchFunc() +}, +{ + deep: true, + immediate: true, +}) + +// 监听检定记录和证书报告页数变化 +const changePage = (val: any) => { + if (val.value && currentMenuObj) { + listQuery.value.offset = val.value.offset + listQuery.value.limit = val.value.limit + currentMenuObj.value?.searchFunc() + } +} + +// -------------------------------底------------------------------------------------ const $router = useRouter() // 关闭新增页面的回调 @@ -164,16 +205,6 @@ $router.back() } -// 打印表单 -const printObj = ref({ - id: 'form', // 需要打印元素的id - popTitle: '样品详情', // 打印配置页上方的标题 - extraHead: '

样品详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) - // 获取分发详情 const getInfo = () => { // 获取任务详情 @@ -214,12 +245,6 @@ diff --git a/src/views/business/schedule/interchange/interchangeDetail.vue b/src/views/business/schedule/interchange/interchangeDetail.vue index 3ce754d..5244f44 100644 --- a/src/views/business/schedule/interchange/interchangeDetail.vue +++ b/src/views/business/schedule/interchange/interchangeDetail.vue @@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadUserFile } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import type { IRecord } from './interchange_interface' import type { ISampleEdit, Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import selectCustomer from '@/views/customer/sample/list/selectCustomer.vue' @@ -14,7 +15,6 @@ import { UploadFile } from '@/api/measure/file' import type { ICustomer } from '@/views/customer/customerInfo/customer_interface' import { getDictByCode } from '@/api/system/dict' - const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', @@ -88,12 +88,6 @@ powerVoltage: [{ required: true, message: '要求电源电压不能为空', trigger: 'change' }], }) // 表单验证规则 -// 其他关联数据列表 -const dataList = ref({ - measureRecords: [] as SimpleMeasureRecord[], - certificationRecords: [] as SimpleCertification[], -}) - // 获取字典值 function getDict() { // 校检类别 @@ -112,19 +106,31 @@ getDict() // --------------------------检定记录、检定证书----------------------------------------- +// 其他关联数据列表 +const dataList = ref({ + measureRecords: [] as SimpleMeasureRecord[], + certificationRecords: [] as SimpleCertification[], +}) + const listQuery = ref({ sampleId: infoId.value, // 样品id customerId: '', // 客户id offset: 1, limit: 10, }) -const totalRecords = ref(0) // 检定记录 -const totalCertifications = ref(0) // 检定证书 +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -134,7 +140,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -146,11 +159,11 @@ name: '检定记录', columns: [ { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, { text: '委托方代码', value: 'customerCode', align: 'center' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], list: 'measureRecords', pagination: true, @@ -162,8 +175,8 @@ { text: '证书编号', value: 'certificationCode', align: 'center' }, { text: '证书名称', value: 'certificationName', align: 'center' }, { text: '证书类型', value: 'certificationClassName', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: '120' }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: '120' }, ], list: 'certificationRecords', pagination: true, @@ -193,6 +206,8 @@ } } +// -------------------------------------底部-------------------------------------- + // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index dd44beb..ae4f0d6 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadUserFile } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import type { ISampleEdit, Menu, SimpleCertification, SimpleMeasureRecord, dictType } from './sample_list_interface' import selectCustomer from './selectCustomer.vue' import showPhoto from '@/views/system/tool/showPhoto.vue' @@ -121,7 +122,13 @@ const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -131,7 +138,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -143,11 +157,11 @@ name: '检定记录', columns: [ { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, { text: '委托方代码', value: 'customerCode', align: 'center' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], list: 'measureRecords', pagination: true, @@ -159,8 +173,8 @@ { text: '证书编号', value: 'certificationCode', align: 'center' }, { text: '证书名称', value: 'certificationName', align: 'center' }, { text: '证书类型', value: 'certificationClassName', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: '120' }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: '120' }, ], list: 'certificationRecords', pagination: true, diff --git a/src/views/business/board/overdueReminder/detail.vue b/src/views/business/board/overdueReminder/detail.vue index 6e72218..50aa545 100644 --- a/src/views/business/board/overdueReminder/detail.vue +++ b/src/views/business/board/overdueReminder/detail.vue @@ -3,19 +3,18 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import ProcessConfig from '@/views/business/schedule/task/components/processConfig.vue' import type { ISampleMeasure, ITaskDetail } from '@/views/business/schedule/task/task-interface' -import type { SimpleCertification, SimpleMeasureRecord } from '@/views/customer/sample/list/sample_list_interface' +import type { Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import showPhoto from '@/views/system/tool/showPhoto.vue' import { getTaskDetail } from '@/api/business/schedule/task' import countries from '@/components/AddressSelect/country-code.json' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' -interface dictType { - id: string - name: string - value: string -} +import type { IRecord } from '@/views/business/schedule/interchange/interchange_interface' +import { getCertification, getMesureRecords } from '@/api/customer/sampleList' +import TemplateTable from '@/views/customer/customerInfo/templateTable.vue' const roleType = ref('distribute') // 角色类型: distribute待分发(分发人员), dispatch待分配(实验室分配工作人员), const countryList = ref(countries) // 国家列表 const loading = ref(false) // 表单加载状态 @@ -107,32 +106,55 @@ certificationRecords: [] as SimpleCertification[], }) +// ----------------------------------检定证书、检定记录----------------------------- +const listQuery = ref({ + sampleId: sampleId.value, // 样品id + customerId: '', // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 -const fetchMeasureRecords = function (query = null) { - dataList.value.measureRecords = [] +const fetchMeasureRecords = (query = null) => { + getMesureRecords(listQuery.value).then((res) => { + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) + totalRecords.value = parseInt(res.data.total) + }) } + // 获取检定证书 -const fetchCertifications = function (query = null) { - dataList.value.certificationRecords = [] +const fetchCertifications = (query = null) => { + getCertification(listQuery.value).then((res) => { + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) + totalCertifications.value = parseInt(res.data.total) + }) } -interface Menu { - name: string - columns: TableColumn[] - pagination: boolean - list: 'measureRecords' | 'certificationRecords' - searchFunc: Function -} + // 菜单 const menu: Menu[] = [ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode' }, - { text: '委托单日期', value: 'orderTime' }, - { text: '委托方代码', value: 'customerCode' }, - { text: '委托方名称', value: 'customerName' }, - { text: '送检人', value: 'deliverer' }, - { text: '送检日期', value: 'deliverTime' }, + { text: '委托单编号', value: 'orderCode', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: 120 }, + { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托方名称', value: 'customerName', align: 'center' }, + { text: '送检人', value: 'deliverer', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: 120 }, ], list: 'measureRecords', pagination: true, @@ -141,11 +163,11 @@ { name: '检定证书', columns: [ - { text: '证书编号', value: 'certificationCode' }, - { text: '证书名称', value: 'certificationName' }, - { text: '证书类型', value: 'certificationType' }, - { text: '证书出具日期', value: 'effectiveDate' }, - { text: '证书有效期', value: 'expirationDate' }, + { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书名称', value: 'certificationName', align: 'center' }, + { text: '证书类型', value: 'certificationClassName', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: 120 }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: 120 }, ], list: 'certificationRecords', pagination: true, @@ -157,6 +179,25 @@ const currentMenuObj = computed(() => { return menu.find(item => item.name === currentMenu.value) }) +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + currentMenuObj.value?.searchFunc() +}, +{ + deep: true, + immediate: true, +}) + +// 监听检定记录和证书报告页数变化 +const changePage = (val: any) => { + if (val.value && currentMenuObj) { + listQuery.value.offset = val.value.offset + listQuery.value.limit = val.value.limit + currentMenuObj.value?.searchFunc() + } +} + +// -------------------------------底------------------------------------------------ const $router = useRouter() // 关闭新增页面的回调 @@ -164,16 +205,6 @@ $router.back() } -// 打印表单 -const printObj = ref({ - id: 'form', // 需要打印元素的id - popTitle: '样品详情', // 打印配置页上方的标题 - extraHead: '

样品详情

', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 - preview: false, // 是否启动预览模式,默认是false - standard: '', - extarCss: '', -}) - // 获取分发详情 const getInfo = () => { // 获取任务详情 @@ -214,12 +245,6 @@ diff --git a/src/views/business/schedule/interchange/interchangeDetail.vue b/src/views/business/schedule/interchange/interchangeDetail.vue index 3ce754d..5244f44 100644 --- a/src/views/business/schedule/interchange/interchangeDetail.vue +++ b/src/views/business/schedule/interchange/interchangeDetail.vue @@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadUserFile } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import type { IRecord } from './interchange_interface' import type { ISampleEdit, Menu, SimpleCertification, SimpleMeasureRecord, dictType } from '@/views/customer/sample/list/sample_list_interface' import selectCustomer from '@/views/customer/sample/list/selectCustomer.vue' @@ -14,7 +15,6 @@ import { UploadFile } from '@/api/measure/file' import type { ICustomer } from '@/views/customer/customerInfo/customer_interface' import { getDictByCode } from '@/api/system/dict' - const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', @@ -88,12 +88,6 @@ powerVoltage: [{ required: true, message: '要求电源电压不能为空', trigger: 'change' }], }) // 表单验证规则 -// 其他关联数据列表 -const dataList = ref({ - measureRecords: [] as SimpleMeasureRecord[], - certificationRecords: [] as SimpleCertification[], -}) - // 获取字典值 function getDict() { // 校检类别 @@ -112,19 +106,31 @@ getDict() // --------------------------检定记录、检定证书----------------------------------------- +// 其他关联数据列表 +const dataList = ref({ + measureRecords: [] as SimpleMeasureRecord[], + certificationRecords: [] as SimpleCertification[], +}) + const listQuery = ref({ sampleId: infoId.value, // 样品id customerId: '', // 客户id offset: 1, limit: 10, }) -const totalRecords = ref(0) // 检定记录 -const totalCertifications = ref(0) // 检定证书 +const totalRecords = ref(0) // 检定记录总条数 +const totalCertifications = ref(0) // 检定证书总条数 // 获取检定记录 const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -134,7 +140,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -146,11 +159,11 @@ name: '检定记录', columns: [ { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, { text: '委托方代码', value: 'customerCode', align: 'center' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], list: 'measureRecords', pagination: true, @@ -162,8 +175,8 @@ { text: '证书编号', value: 'certificationCode', align: 'center' }, { text: '证书名称', value: 'certificationName', align: 'center' }, { text: '证书类型', value: 'certificationClassName', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: '120' }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: '120' }, ], list: 'certificationRecords', pagination: true, @@ -193,6 +206,8 @@ } } +// -------------------------------------底部-------------------------------------- + // 从路由中获取页面类型参数 const $route = useRoute() if ($route.params && $route.params.type) { diff --git a/src/views/customer/sample/list/edit.vue b/src/views/customer/sample/list/edit.vue index dd44beb..ae4f0d6 100644 --- a/src/views/customer/sample/list/edit.vue +++ b/src/views/customer/sample/list/edit.vue @@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadUserFile } from 'element-plus' import { ref } from 'vue' +import dayjs from 'dayjs' import type { ISampleEdit, Menu, SimpleCertification, SimpleMeasureRecord, dictType } from './sample_list_interface' import selectCustomer from './selectCustomer.vue' import showPhoto from '@/views/system/tool/showPhoto.vue' @@ -121,7 +122,13 @@ const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -131,7 +138,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -143,11 +157,11 @@ name: '检定记录', columns: [ { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, { text: '委托方代码', value: 'customerCode', align: 'center' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], list: 'measureRecords', pagination: true, @@ -159,8 +173,8 @@ { text: '证书编号', value: 'certificationCode', align: 'center' }, { text: '证书名称', value: 'certificationName', align: 'center' }, { text: '证书类型', value: 'certificationClassName', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: '120' }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: '120' }, ], list: 'certificationRecords', pagination: true, diff --git a/src/views/customer/sample/overTime/detail.vue b/src/views/customer/sample/overTime/detail.vue index 137059e..68fb37b 100644 --- a/src/views/customer/sample/overTime/detail.vue +++ b/src/views/customer/sample/overTime/detail.vue @@ -3,6 +3,7 @@ import type { Ref } from 'vue' import { ref } from 'vue' import { Search } from '@element-plus/icons-vue' +import dayjs from 'dayjs' import type { ISampleDetail, SimpleCertification, SimpleMeasureRecord, dictType } from './overtime_list_interface' import showPhoto from '@/views/system/tool/showPhoto.vue' import TemplateTable from '@/views/customer/customerInfo/templateTable.vue' @@ -11,7 +12,6 @@ import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' import type { IRecord } from '@/views/business/schedule/interchange/interchange_interface' - const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', @@ -91,7 +91,13 @@ const fetchMeasureRecords = (query = null) => { if (pageType.value === 'detail') { getMesureRecords(listQuery.value).then((res) => { - dataList.value.measureRecords = res.data.rows + dataList.value.measureRecords = res.data.rows.map((item: { orderTime: string; deliverTime: string }) => { + return { + ...item, + orderTime: item.orderTime ? dayjs(item.orderTime).format('YYYY-MM-DD') : '', + deliverTime: item.deliverTime ? dayjs(item.deliverTime).format('YYYY-MM-DD') : '', + } + }) totalRecords.value = parseInt(res.data.total) }) } @@ -101,7 +107,14 @@ const fetchCertifications = (query = null) => { if (pageType.value === 'detail') { getCertification(listQuery.value).then((res) => { - dataList.value.certificationRecords = res.data.rows + dataList.value.certificationRecords = res.data.rows.map((item: { effectiveDate: string; expirationDate: string }) => { + return { + ...item, + effectiveDate: item.effectiveDate ? dayjs(item.effectiveDate).format('YYYY-MM-DD') : '', + expirationDate: item.expirationDate ? dayjs(item.expirationDate).format('YYYY-MM-DD') : '', + + } + }) totalCertifications.value = parseInt(res.data.total) }) } @@ -118,12 +131,12 @@ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode' }, - { text: '委托单日期', value: 'orderTime' }, - { text: '委托方代码', value: 'customerCode' }, - { text: '委托方名称', value: 'customerName' }, - { text: '送检人', value: 'deliverer' }, - { text: '送检日期', value: 'deliverTime' }, + { text: '委托单编号', value: 'orderCode', align: 'center' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: 120 }, + { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托方名称', value: 'customerName', align: 'center' }, + { text: '送检人', value: 'deliverer', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: 120 }, ], list: 'measureRecords', pagination: true, @@ -132,11 +145,11 @@ { name: '检定证书', columns: [ - { text: '证书编号', value: 'certificationCode' }, - { text: '证书名称', value: 'certificationName' }, - { text: '证书类型', value: 'certificationType' }, - { text: '证书出具日期', value: 'effectiveDate' }, - { text: '证书有效期', value: 'expirationDate' }, + { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书名称', value: 'certificationName', align: 'center' }, + { text: '证书类型', value: 'certificationType', align: 'center' }, + { text: '证书出具日期', value: 'effectiveDate', align: 'center', width: 120 }, + { text: '证书有效期', value: 'expirationDate', align: 'center', width: 120 }, ], list: 'certificationRecords', pagination: true,