diff --git a/src/api/customer/customer.ts b/src/api/customer/customer.ts index c7bf1be..dfae297 100644 --- a/src/api/customer/customer.ts +++ b/src/api/customer/customer.ts @@ -68,36 +68,36 @@ } // 根据客户查样品id -export function getSampleByCustomer(data: { id: string }) { +export function getSampleByCustomer(data: { id: string ; offset: number; limit: number }) { return request({ - url: '/customer/sampleRecords', - method: 'post', - data, - }) -} - -// 根据客户查合同记录 -export function getContractByCustomer(data: { id: string }) { - return request({ - url: '/customer/contractRecords', + url: `/customer/sampleRecords?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 根据客户查检定记录 -export function getOrderByCustomer(data: { sampleId: string; customeId: string }) { +export function getOrderByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/customer/sample/measureRecordsById', + url: `/customer/sample/measureRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 检定证书 -export function getCertificationByCustomer(data: { sampleId: string; customeId: string }) { +export function getCertificationByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/business/certificateReport/certificateRecordsById', + url: `/business/certificateReport/certificateRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } +// 合同列表 +export function getContractByCustomer(data: { offset: number; limit: number }) { + return request({ + url: `/finance/agreement/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/customer/customer.ts b/src/api/customer/customer.ts index c7bf1be..dfae297 100644 --- a/src/api/customer/customer.ts +++ b/src/api/customer/customer.ts @@ -68,36 +68,36 @@ } // 根据客户查样品id -export function getSampleByCustomer(data: { id: string }) { +export function getSampleByCustomer(data: { id: string ; offset: number; limit: number }) { return request({ - url: '/customer/sampleRecords', - method: 'post', - data, - }) -} - -// 根据客户查合同记录 -export function getContractByCustomer(data: { id: string }) { - return request({ - url: '/customer/contractRecords', + url: `/customer/sampleRecords?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 根据客户查检定记录 -export function getOrderByCustomer(data: { sampleId: string; customeId: string }) { +export function getOrderByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/customer/sample/measureRecordsById', + url: `/customer/sample/measureRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 检定证书 -export function getCertificationByCustomer(data: { sampleId: string; customeId: string }) { +export function getCertificationByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/business/certificateReport/certificateRecordsById', + url: `/business/certificateReport/certificateRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } +// 合同列表 +export function getContractByCustomer(data: { offset: number; limit: number }) { + return request({ + url: `/finance/agreement/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/views/business/schedule/interchangeReceipt/selectOrder.vue b/src/views/business/schedule/interchangeReceipt/selectOrder.vue index 3bb9312..51b68aa 100644 --- a/src/views/business/schedule/interchangeReceipt/selectOrder.vue +++ b/src/views/business/schedule/interchangeReceipt/selectOrder.vue @@ -33,11 +33,11 @@ } }) // 在已有的字典的基础上增加一个全部0进去 - isUrgentMap.value.push({ - id: '', - name: '全部', - value: 2, // 是否加急全部后端定为2 - }) + // isUrgentMap.value.push({ + // id: '', + // name: '全部', + // value: 2, // 是否加急全部后端定为2 + // }) }) // 接收状态 getDictByCode('orderStatus').then((response) => { @@ -64,7 +64,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 2全部 1是 0否 + isUrgent: '', // 是否加急 2全部 1是 0否 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, @@ -120,7 +120,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 + isUrgent: '', // 是否加急 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, diff --git a/src/api/customer/customer.ts b/src/api/customer/customer.ts index c7bf1be..dfae297 100644 --- a/src/api/customer/customer.ts +++ b/src/api/customer/customer.ts @@ -68,36 +68,36 @@ } // 根据客户查样品id -export function getSampleByCustomer(data: { id: string }) { +export function getSampleByCustomer(data: { id: string ; offset: number; limit: number }) { return request({ - url: '/customer/sampleRecords', - method: 'post', - data, - }) -} - -// 根据客户查合同记录 -export function getContractByCustomer(data: { id: string }) { - return request({ - url: '/customer/contractRecords', + url: `/customer/sampleRecords?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 根据客户查检定记录 -export function getOrderByCustomer(data: { sampleId: string; customeId: string }) { +export function getOrderByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/customer/sample/measureRecordsById', + url: `/customer/sample/measureRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 检定证书 -export function getCertificationByCustomer(data: { sampleId: string; customeId: string }) { +export function getCertificationByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/business/certificateReport/certificateRecordsById', + url: `/business/certificateReport/certificateRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } +// 合同列表 +export function getContractByCustomer(data: { offset: number; limit: number }) { + return request({ + url: `/finance/agreement/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/views/business/schedule/interchangeReceipt/selectOrder.vue b/src/views/business/schedule/interchangeReceipt/selectOrder.vue index 3bb9312..51b68aa 100644 --- a/src/views/business/schedule/interchangeReceipt/selectOrder.vue +++ b/src/views/business/schedule/interchangeReceipt/selectOrder.vue @@ -33,11 +33,11 @@ } }) // 在已有的字典的基础上增加一个全部0进去 - isUrgentMap.value.push({ - id: '', - name: '全部', - value: 2, // 是否加急全部后端定为2 - }) + // isUrgentMap.value.push({ + // id: '', + // name: '全部', + // value: 2, // 是否加急全部后端定为2 + // }) }) // 接收状态 getDictByCode('orderStatus').then((response) => { @@ -64,7 +64,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 2全部 1是 0否 + isUrgent: '', // 是否加急 2全部 1是 0否 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, @@ -120,7 +120,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 + isUrgent: '', // 是否加急 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, diff --git a/src/views/business/schedule/order/orderList_interface.ts b/src/views/business/schedule/order/orderList_interface.ts index d7033d8..2d92da9 100644 --- a/src/views/business/schedule/order/orderList_interface.ts +++ b/src/views/business/schedule/order/orderList_interface.ts @@ -5,7 +5,7 @@ customerNo: string // 委托方代码 customerName: string // 委托方名称 deliverer: string // 送样人 - isUrgent: number // 是否加急 + isUrgent: number | string // 是否加急 status: number // 接收状态 offset: number limit: number diff --git a/src/api/customer/customer.ts b/src/api/customer/customer.ts index c7bf1be..dfae297 100644 --- a/src/api/customer/customer.ts +++ b/src/api/customer/customer.ts @@ -68,36 +68,36 @@ } // 根据客户查样品id -export function getSampleByCustomer(data: { id: string }) { +export function getSampleByCustomer(data: { id: string ; offset: number; limit: number }) { return request({ - url: '/customer/sampleRecords', - method: 'post', - data, - }) -} - -// 根据客户查合同记录 -export function getContractByCustomer(data: { id: string }) { - return request({ - url: '/customer/contractRecords', + url: `/customer/sampleRecords?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 根据客户查检定记录 -export function getOrderByCustomer(data: { sampleId: string; customeId: string }) { +export function getOrderByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/customer/sample/measureRecordsById', + url: `/customer/sample/measureRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 检定证书 -export function getCertificationByCustomer(data: { sampleId: string; customeId: string }) { +export function getCertificationByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/business/certificateReport/certificateRecordsById', + url: `/business/certificateReport/certificateRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } +// 合同列表 +export function getContractByCustomer(data: { offset: number; limit: number }) { + return request({ + url: `/finance/agreement/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/views/business/schedule/interchangeReceipt/selectOrder.vue b/src/views/business/schedule/interchangeReceipt/selectOrder.vue index 3bb9312..51b68aa 100644 --- a/src/views/business/schedule/interchangeReceipt/selectOrder.vue +++ b/src/views/business/schedule/interchangeReceipt/selectOrder.vue @@ -33,11 +33,11 @@ } }) // 在已有的字典的基础上增加一个全部0进去 - isUrgentMap.value.push({ - id: '', - name: '全部', - value: 2, // 是否加急全部后端定为2 - }) + // isUrgentMap.value.push({ + // id: '', + // name: '全部', + // value: 2, // 是否加急全部后端定为2 + // }) }) // 接收状态 getDictByCode('orderStatus').then((response) => { @@ -64,7 +64,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 2全部 1是 0否 + isUrgent: '', // 是否加急 2全部 1是 0否 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, @@ -120,7 +120,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 + isUrgent: '', // 是否加急 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, diff --git a/src/views/business/schedule/order/orderList_interface.ts b/src/views/business/schedule/order/orderList_interface.ts index d7033d8..2d92da9 100644 --- a/src/views/business/schedule/order/orderList_interface.ts +++ b/src/views/business/schedule/order/orderList_interface.ts @@ -5,7 +5,7 @@ customerNo: string // 委托方代码 customerName: string // 委托方名称 deliverer: string // 送样人 - isUrgent: number // 是否加急 + isUrgent: number | string // 是否加急 status: number // 接收状态 offset: number limit: number diff --git a/src/views/customer/advice/adviceList.vue b/src/views/customer/advice/adviceList.vue index d0fabb0..98f4a39 100644 --- a/src/views/customer/advice/adviceList.vue +++ b/src/views/customer/advice/adviceList.vue @@ -23,9 +23,9 @@ const timeRange = ref<[DateModelType, DateModelType]>(['', '']) // 表头 const columns = ref([ - { text: '投诉建议编号', value: 'adviceNo', width: '155', align: 'center' }, - { text: '客户编号', value: 'customerNo', width: '155', align: 'center' }, - { text: '客户名称', value: 'customerName', align: 'center', width: '180' }, + { text: '投诉建议编号', value: 'adviceNo', width: '160', align: 'center' }, + { text: '客户编号', value: 'customerNo', width: '160', align: 'center' }, + { text: '客户名称', value: 'customerName', align: 'center' }, { text: '整体评价', value: 'evaluationName', align: 'center', width: '90' }, { text: '投诉/建议内容', value: 'content', align: 'center' }, { text: '投诉人', value: 'advicePerson', align: 'center', width: '90' }, @@ -121,28 +121,6 @@ fetchData(true) } -// 上传文件/批量导入 -const onFileChange = (event: any) => { - // todo: 校验文件类型,调用上传接口 - if (event.target.files[0].type === 'application/pdf') { - if (event.target.files?.length !== 0) { - // 创建formdata对象 - // const fd = new FormData() - // fd.append('multipartFile', event.target.files[0]) - // uploadApi(fd).then((res) => { - // if (res.code === 200) { - // ElMessage.success('上传成功') - // } - // else { - // ElMessage.error(res.message) - // } - // }) - } - } - else { - ElMessage.error('请上传pdf格式') - } -} // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { @@ -262,7 +240,6 @@ - { @@ -64,7 +64,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 2全部 1是 0否 + isUrgent: '', // 是否加急 2全部 1是 0否 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, @@ -120,7 +120,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 + isUrgent: '', // 是否加急 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, diff --git a/src/views/business/schedule/order/orderList_interface.ts b/src/views/business/schedule/order/orderList_interface.ts index d7033d8..2d92da9 100644 --- a/src/views/business/schedule/order/orderList_interface.ts +++ b/src/views/business/schedule/order/orderList_interface.ts @@ -5,7 +5,7 @@ customerNo: string // 委托方代码 customerName: string // 委托方名称 deliverer: string // 送样人 - isUrgent: number // 是否加急 + isUrgent: number | string // 是否加急 status: number // 接收状态 offset: number limit: number diff --git a/src/views/customer/advice/adviceList.vue b/src/views/customer/advice/adviceList.vue index d0fabb0..98f4a39 100644 --- a/src/views/customer/advice/adviceList.vue +++ b/src/views/customer/advice/adviceList.vue @@ -23,9 +23,9 @@ const timeRange = ref<[DateModelType, DateModelType]>(['', '']) // 表头 const columns = ref([ - { text: '投诉建议编号', value: 'adviceNo', width: '155', align: 'center' }, - { text: '客户编号', value: 'customerNo', width: '155', align: 'center' }, - { text: '客户名称', value: 'customerName', align: 'center', width: '180' }, + { text: '投诉建议编号', value: 'adviceNo', width: '160', align: 'center' }, + { text: '客户编号', value: 'customerNo', width: '160', align: 'center' }, + { text: '客户名称', value: 'customerName', align: 'center' }, { text: '整体评价', value: 'evaluationName', align: 'center', width: '90' }, { text: '投诉/建议内容', value: 'content', align: 'center' }, { text: '投诉人', value: 'advicePerson', align: 'center', width: '90' }, @@ -121,28 +121,6 @@ fetchData(true) } -// 上传文件/批量导入 -const onFileChange = (event: any) => { - // todo: 校验文件类型,调用上传接口 - if (event.target.files[0].type === 'application/pdf') { - if (event.target.files?.length !== 0) { - // 创建formdata对象 - // const fd = new FormData() - // fd.append('multipartFile', event.target.files[0]) - // uploadApi(fd).then((res) => { - // if (res.code === 200) { - // ElMessage.success('上传成功') - // } - // else { - // ElMessage.error(res.message) - // } - // }) - } - } - else { - ElMessage.error('请上传pdf格式') - } -} // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { @@ -262,7 +240,6 @@ - ({ + sampleId: '', // 样品id + customerId: infoId.value, // 客户id + offset: 1, + limit: 10, +}) +// 合同记录请求参数 +const contractListQuery = ref({ + agreementKind: '1', // 合同种类-收入合同1 + agreementName: '', // 合同名字 + agreementNo: '', // 合同编号 + agreementType: '', // 合同类型-采购合同/业务合同等-字典code + customerId: infoId.value, // 单位id(客户id)(收入合同该字段为甲方单位,支出合同该字段为乙方单位) + estimateSignEndDate: '', // 预计签订/实际签订结束日期 + estimateSignStartDate: '', // 预计签订/实际签订开始日期 + firstParty: '', // 单位名字(收入合同该字段为甲方单位,支出合同该字段为乙方单位) + formId: SCHEDULE.BUSINESS_FINANCE_CONTRACT_APPROVE, // 表单id + ids: [], // 导出ids + status: '', // 合同完成状态-字典code + offset: 1, + limit: 10, +}) +// 样品记录查询条件 +const sampleListQuery = ref({ + id: infoId.value, // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录 +const totalCertifications = ref(0) // 检定证书 +const totalContract = ref(0) // 合同记录 +const totalSample = ref(0) // 样品记录 +// 获取样品列表 const fetchSampleList = function () { - // getSampleByCustomer({ id: dataForm.value.id }).then((res) => { - // dataList.value.sampleRecords = res.data.rows - // }) -} -// 获取合同记录 200 -const fetchContractRecords = function () { - getContractByCustomer({ id: dataForm.value.id }).then((res) => { - dataList.value.contractRecords = res.data.rows + getSampleByCustomer(sampleListQuery.value).then((res) => { + dataList.value.sampleRecords = res.data.rows + totalSample.value = res.data.total }) } -// 获取检定记录 待测试 +// 获取合同记录 +const fetchContractRecords = function () { + getContractByCustomer(contractListQuery.value).then((response) => { + dataList.value.contractRecords = response.data.rows.map((item: { estimateSignDate: string; agreementAmount: number }) => { + return { + ...item, + estimateSignDate: item.estimateSignDate ? dayjs(item.estimateSignDate).format('YYYY-MM-DD') : item.estimateSignDate, + agreementAmount: calc(Number(item.agreementAmount), 100, '/'), + } + }) + totalContract.value = parseInt(response.data.total) + }) +} +// 获取检定记录 const fetchMeasureRecords = function () { - const postData = { - sampleId: '', - customeId: dataForm.value.id, - } - getOrderByCustomer(postData).then((res) => { - dataList.value.measureRecords = res.data.rows + getOrderByCustomer(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 () { - const postData = { - sampleId: '', - customeId: dataForm.value.id, - } - // getCertificationByCustomer(postData).then((res) => { - // dataList.value.certificationRecords = res.data.rows - // }) + getCertificationByCustomer(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 - query?: { id: string; limit: number; offset: number } - list: 'personList' | 'sampleRecords' | 'contractRecords' | 'measureRecords' | 'certificationRecords' - searchFunc: Function | null -} + // 菜单 const menu = ref([ { @@ -160,12 +201,12 @@ offset: 1, }, columns: [ - { text: '样品编号', value: 'sampleCode', align: 'center' }, + { text: '样品编号', value: 'sampleNo', align: 'center', width: '160' }, { text: '样品名称', value: 'sampleName', align: 'center' }, { text: '型号', value: 'sampleModel', align: 'center' }, { text: '出厂编号', value: 'manufacturingNo', align: 'center' }, - { text: '上次检定时间', value: 'mesureTime', align: 'center' }, - { text: '检定周期', value: 'mesurePeriod', align: 'center' }, + { text: '上次检定时间', value: 'measureLastTime', align: 'center', width: '180' }, + { text: '检定周期(月)', value: 'measurePeriod', align: 'center' }, ], pagination: true, list: 'sampleRecords', @@ -174,12 +215,11 @@ { name: '合同记录', columns: [ - { text: '合同编号', value: 'contractCode', align: 'center' }, - { text: '合同名称', value: 'contractName', align: 'center' }, - { text: '合同金额', value: 'contractPrice', align: 'center' }, - { text: '合同状态', value: 'contractStatus', align: 'center' }, - { text: '合同时间', value: 'contractTime', align: 'center' }, - { text: '负责人', value: 'aCompanyDutyman', align: 'center' }, + { text: '合同编号', value: 'agreementNo', align: 'center', width: '160' }, + { text: '合同名称', value: 'agreementName', align: 'center' }, + { text: '合同金额', value: 'agreementAmount', align: 'center' }, + { text: '签订日期', value: 'estimateSignDate', align: 'center', width: '160' }, + { text: '负责人', value: 'director', align: 'center' }, ], query: { id: '', @@ -193,12 +233,12 @@ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, - { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托单编号', value: 'orderCode', align: 'center', width: '160' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, + { text: '委托方代码', value: 'customerCode', align: 'center', width: '160' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], query: { id: '', @@ -217,11 +257,11 @@ offset: 1, }, columns: [ - { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书编号', value: 'certificationCode', align: 'center', width: '160' }, { text: '证书名称', value: 'certificationName', align: 'center' }, - { text: '证书类型', value: 'certificationType', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', 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, @@ -232,6 +272,33 @@ const currentMenuObj = computed(() => { return menu.value.find(item => item.name === currentMenu.value) }) + +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + if (currentMenuObj.value?.searchFunc) { + 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 // 检定记录和检定证书 + contractListQuery.value.offset = val.value.offset // 合同记录 + contractListQuery.value.limit = val.value.limit // 合同记录 + sampleListQuery.value.offset = val.value.offset // 样品记录 + sampleListQuery.value.limit = val.value.limit // 样品记录 + if (currentMenuObj.value?.searchFunc) { + currentMenuObj.value?.searchFunc() + } + } +} + const ruleFormRef = ref() // 人员对象 const addPersonObj: CustomerPerson = { @@ -248,8 +315,8 @@ const SelectionList: Ref = ref([]) // 校验规则 const rules = ref({ - customerName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], - businessContent: [{ required: true, message: '业务内容不能为空', trigger: 'blur' }], + customerName: [{ required: true, message: '公司名称必填', trigger: 'blur' }], + businessContent: [{ required: true, message: '业务内容必填', trigger: 'blur' }], }) // 表单验证规则 // 初始化router const $router = useRouter() @@ -447,13 +514,19 @@ // 创建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) { dataForm.value.minioFileName = res.data[0] // 重置当前验证 ElMessage.success('文件上传成功') + loading.close() } else { + loading.close() ElMessage.error(res.message) } }) @@ -743,6 +816,7 @@ - + diff --git a/src/api/customer/customer.ts b/src/api/customer/customer.ts index c7bf1be..dfae297 100644 --- a/src/api/customer/customer.ts +++ b/src/api/customer/customer.ts @@ -68,36 +68,36 @@ } // 根据客户查样品id -export function getSampleByCustomer(data: { id: string }) { +export function getSampleByCustomer(data: { id: string ; offset: number; limit: number }) { return request({ - url: '/customer/sampleRecords', - method: 'post', - data, - }) -} - -// 根据客户查合同记录 -export function getContractByCustomer(data: { id: string }) { - return request({ - url: '/customer/contractRecords', + url: `/customer/sampleRecords?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 根据客户查检定记录 -export function getOrderByCustomer(data: { sampleId: string; customeId: string }) { +export function getOrderByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/customer/sample/measureRecordsById', + url: `/customer/sample/measureRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } // 检定证书 -export function getCertificationByCustomer(data: { sampleId: string; customeId: string }) { +export function getCertificationByCustomer(data: { customerId?: string; sampleId?: string; offset: number; limit: number }) { return request({ - url: '/business/certificateReport/certificateRecordsById', + url: `/business/certificateReport/certificateRecordsById?offset=${data.offset}&limit=${data.limit}`, method: 'post', data, }) } +// 合同列表 +export function getContractByCustomer(data: { offset: number; limit: number }) { + return request({ + url: `/finance/agreement/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/views/business/schedule/interchangeReceipt/selectOrder.vue b/src/views/business/schedule/interchangeReceipt/selectOrder.vue index 3bb9312..51b68aa 100644 --- a/src/views/business/schedule/interchangeReceipt/selectOrder.vue +++ b/src/views/business/schedule/interchangeReceipt/selectOrder.vue @@ -33,11 +33,11 @@ } }) // 在已有的字典的基础上增加一个全部0进去 - isUrgentMap.value.push({ - id: '', - name: '全部', - value: 2, // 是否加急全部后端定为2 - }) + // isUrgentMap.value.push({ + // id: '', + // name: '全部', + // value: 2, // 是否加急全部后端定为2 + // }) }) // 接收状态 getDictByCode('orderStatus').then((response) => { @@ -64,7 +64,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 2全部 1是 0否 + isUrgent: '', // 是否加急 2全部 1是 0否 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, @@ -120,7 +120,7 @@ customerNo: '', // 委托方代码 customerName: '', // 委托方名称 deliverer: '', // 送样人 - isUrgent: 2, // 是否加急 + isUrgent: '', // 是否加急 status: 2, // 接收状态 2已接收 offset: 1, limit: 5, diff --git a/src/views/business/schedule/order/orderList_interface.ts b/src/views/business/schedule/order/orderList_interface.ts index d7033d8..2d92da9 100644 --- a/src/views/business/schedule/order/orderList_interface.ts +++ b/src/views/business/schedule/order/orderList_interface.ts @@ -5,7 +5,7 @@ customerNo: string // 委托方代码 customerName: string // 委托方名称 deliverer: string // 送样人 - isUrgent: number // 是否加急 + isUrgent: number | string // 是否加急 status: number // 接收状态 offset: number limit: number diff --git a/src/views/customer/advice/adviceList.vue b/src/views/customer/advice/adviceList.vue index d0fabb0..98f4a39 100644 --- a/src/views/customer/advice/adviceList.vue +++ b/src/views/customer/advice/adviceList.vue @@ -23,9 +23,9 @@ const timeRange = ref<[DateModelType, DateModelType]>(['', '']) // 表头 const columns = ref([ - { text: '投诉建议编号', value: 'adviceNo', width: '155', align: 'center' }, - { text: '客户编号', value: 'customerNo', width: '155', align: 'center' }, - { text: '客户名称', value: 'customerName', align: 'center', width: '180' }, + { text: '投诉建议编号', value: 'adviceNo', width: '160', align: 'center' }, + { text: '客户编号', value: 'customerNo', width: '160', align: 'center' }, + { text: '客户名称', value: 'customerName', align: 'center' }, { text: '整体评价', value: 'evaluationName', align: 'center', width: '90' }, { text: '投诉/建议内容', value: 'content', align: 'center' }, { text: '投诉人', value: 'advicePerson', align: 'center', width: '90' }, @@ -121,28 +121,6 @@ fetchData(true) } -// 上传文件/批量导入 -const onFileChange = (event: any) => { - // todo: 校验文件类型,调用上传接口 - if (event.target.files[0].type === 'application/pdf') { - if (event.target.files?.length !== 0) { - // 创建formdata对象 - // const fd = new FormData() - // fd.append('multipartFile', event.target.files[0]) - // uploadApi(fd).then((res) => { - // if (res.code === 200) { - // ElMessage.success('上传成功') - // } - // else { - // ElMessage.error(res.message) - // } - // }) - } - } - else { - ElMessage.error('请上传pdf格式') - } -} // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { @@ -262,7 +240,6 @@ - ({ + sampleId: '', // 样品id + customerId: infoId.value, // 客户id + offset: 1, + limit: 10, +}) +// 合同记录请求参数 +const contractListQuery = ref({ + agreementKind: '1', // 合同种类-收入合同1 + agreementName: '', // 合同名字 + agreementNo: '', // 合同编号 + agreementType: '', // 合同类型-采购合同/业务合同等-字典code + customerId: infoId.value, // 单位id(客户id)(收入合同该字段为甲方单位,支出合同该字段为乙方单位) + estimateSignEndDate: '', // 预计签订/实际签订结束日期 + estimateSignStartDate: '', // 预计签订/实际签订开始日期 + firstParty: '', // 单位名字(收入合同该字段为甲方单位,支出合同该字段为乙方单位) + formId: SCHEDULE.BUSINESS_FINANCE_CONTRACT_APPROVE, // 表单id + ids: [], // 导出ids + status: '', // 合同完成状态-字典code + offset: 1, + limit: 10, +}) +// 样品记录查询条件 +const sampleListQuery = ref({ + id: infoId.value, // 客户id + offset: 1, + limit: 10, +}) +const totalRecords = ref(0) // 检定记录 +const totalCertifications = ref(0) // 检定证书 +const totalContract = ref(0) // 合同记录 +const totalSample = ref(0) // 样品记录 +// 获取样品列表 const fetchSampleList = function () { - // getSampleByCustomer({ id: dataForm.value.id }).then((res) => { - // dataList.value.sampleRecords = res.data.rows - // }) -} -// 获取合同记录 200 -const fetchContractRecords = function () { - getContractByCustomer({ id: dataForm.value.id }).then((res) => { - dataList.value.contractRecords = res.data.rows + getSampleByCustomer(sampleListQuery.value).then((res) => { + dataList.value.sampleRecords = res.data.rows + totalSample.value = res.data.total }) } -// 获取检定记录 待测试 +// 获取合同记录 +const fetchContractRecords = function () { + getContractByCustomer(contractListQuery.value).then((response) => { + dataList.value.contractRecords = response.data.rows.map((item: { estimateSignDate: string; agreementAmount: number }) => { + return { + ...item, + estimateSignDate: item.estimateSignDate ? dayjs(item.estimateSignDate).format('YYYY-MM-DD') : item.estimateSignDate, + agreementAmount: calc(Number(item.agreementAmount), 100, '/'), + } + }) + totalContract.value = parseInt(response.data.total) + }) +} +// 获取检定记录 const fetchMeasureRecords = function () { - const postData = { - sampleId: '', - customeId: dataForm.value.id, - } - getOrderByCustomer(postData).then((res) => { - dataList.value.measureRecords = res.data.rows + getOrderByCustomer(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 () { - const postData = { - sampleId: '', - customeId: dataForm.value.id, - } - // getCertificationByCustomer(postData).then((res) => { - // dataList.value.certificationRecords = res.data.rows - // }) + getCertificationByCustomer(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 - query?: { id: string; limit: number; offset: number } - list: 'personList' | 'sampleRecords' | 'contractRecords' | 'measureRecords' | 'certificationRecords' - searchFunc: Function | null -} + // 菜单 const menu = ref([ { @@ -160,12 +201,12 @@ offset: 1, }, columns: [ - { text: '样品编号', value: 'sampleCode', align: 'center' }, + { text: '样品编号', value: 'sampleNo', align: 'center', width: '160' }, { text: '样品名称', value: 'sampleName', align: 'center' }, { text: '型号', value: 'sampleModel', align: 'center' }, { text: '出厂编号', value: 'manufacturingNo', align: 'center' }, - { text: '上次检定时间', value: 'mesureTime', align: 'center' }, - { text: '检定周期', value: 'mesurePeriod', align: 'center' }, + { text: '上次检定时间', value: 'measureLastTime', align: 'center', width: '180' }, + { text: '检定周期(月)', value: 'measurePeriod', align: 'center' }, ], pagination: true, list: 'sampleRecords', @@ -174,12 +215,11 @@ { name: '合同记录', columns: [ - { text: '合同编号', value: 'contractCode', align: 'center' }, - { text: '合同名称', value: 'contractName', align: 'center' }, - { text: '合同金额', value: 'contractPrice', align: 'center' }, - { text: '合同状态', value: 'contractStatus', align: 'center' }, - { text: '合同时间', value: 'contractTime', align: 'center' }, - { text: '负责人', value: 'aCompanyDutyman', align: 'center' }, + { text: '合同编号', value: 'agreementNo', align: 'center', width: '160' }, + { text: '合同名称', value: 'agreementName', align: 'center' }, + { text: '合同金额', value: 'agreementAmount', align: 'center' }, + { text: '签订日期', value: 'estimateSignDate', align: 'center', width: '160' }, + { text: '负责人', value: 'director', align: 'center' }, ], query: { id: '', @@ -193,12 +233,12 @@ { name: '检定记录', columns: [ - { text: '委托单编号', value: 'orderCode', align: 'center' }, - { text: '委托单日期', value: 'orderTime', align: 'center' }, - { text: '委托方代码', value: 'customerCode', align: 'center' }, + { text: '委托单编号', value: 'orderCode', align: 'center', width: '160' }, + { text: '委托单日期', value: 'orderTime', align: 'center', width: '120' }, + { text: '委托方代码', value: 'customerCode', align: 'center', width: '160' }, { text: '委托方名称', value: 'customerName', align: 'center' }, { text: '送检人', value: 'deliverer', align: 'center' }, - { text: '送检日期', value: 'deliverTime', align: 'center' }, + { text: '送检日期', value: 'deliverTime', align: 'center', width: '120' }, ], query: { id: '', @@ -217,11 +257,11 @@ offset: 1, }, columns: [ - { text: '证书编号', value: 'certificationCode', align: 'center' }, + { text: '证书编号', value: 'certificationCode', align: 'center', width: '160' }, { text: '证书名称', value: 'certificationName', align: 'center' }, - { text: '证书类型', value: 'certificationType', align: 'center' }, - { text: '证书出具日期', value: 'effectiveDate', align: 'center' }, - { text: '证书有效期', value: 'expirationDate', 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, @@ -232,6 +272,33 @@ const currentMenuObj = computed(() => { return menu.value.find(item => item.name === currentMenu.value) }) + +watch(currentMenuObj, () => { + listQuery.value.offset = 1 + if (currentMenuObj.value?.searchFunc) { + 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 // 检定记录和检定证书 + contractListQuery.value.offset = val.value.offset // 合同记录 + contractListQuery.value.limit = val.value.limit // 合同记录 + sampleListQuery.value.offset = val.value.offset // 样品记录 + sampleListQuery.value.limit = val.value.limit // 样品记录 + if (currentMenuObj.value?.searchFunc) { + currentMenuObj.value?.searchFunc() + } + } +} + const ruleFormRef = ref() // 人员对象 const addPersonObj: CustomerPerson = { @@ -248,8 +315,8 @@ const SelectionList: Ref = ref([]) // 校验规则 const rules = ref({ - customerName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], - businessContent: [{ required: true, message: '业务内容不能为空', trigger: 'blur' }], + customerName: [{ required: true, message: '公司名称必填', trigger: 'blur' }], + businessContent: [{ required: true, message: '业务内容必填', trigger: 'blur' }], }) // 表单验证规则 // 初始化router const $router = useRouter() @@ -447,13 +514,19 @@ // 创建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) { dataForm.value.minioFileName = res.data[0] // 重置当前验证 ElMessage.success('文件上传成功') + loading.close() } else { + loading.close() ElMessage.error(res.message) } }) @@ -743,6 +816,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@ - + diff --git a/src/views/customer/customerInfo/customerList.vue b/src/views/customer/customerInfo/customerList.vue index 2ce3c37..dc0a3c0 100644 --- a/src/views/customer/customerInfo/customerList.vue +++ b/src/views/customer/customerInfo/customerList.vue @@ -286,7 +286,7 @@