diff --git a/src/views/business/lab/components/selectMeasureDevice.vue b/src/views/business/lab/components/selectMeasureDevice.vue index f879817..a192a02 100644 --- a/src/views/business/lab/components/selectMeasureDevice.vue +++ b/src/views/business/lab/components/selectMeasureDevice.vue @@ -118,6 +118,7 @@ abc: '', limit: 5, offset: 1, + modelNo: '', // 型号 // ids: [] as string[], } fetchData(true) diff --git a/src/views/business/lab/components/selectMeasureDevice.vue b/src/views/business/lab/components/selectMeasureDevice.vue index f879817..a192a02 100644 --- a/src/views/business/lab/components/selectMeasureDevice.vue +++ b/src/views/business/lab/components/selectMeasureDevice.vue @@ -118,6 +118,7 @@ abc: '', limit: 5, offset: 1, + modelNo: '', // 型号 // ids: [] as string[], } fetchData(true) diff --git a/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue b/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue index f6f1a5a..91127a8 100644 --- a/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue +++ b/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue @@ -32,6 +32,7 @@ const checkoutList = ref([]) // 多选表格 const total = ref(0) const fileClass = ref('0') // 文件分类 +const disabledFileType = ref(false) // 文件分类 const columns = ref([ { text: '文件编号', value: 'fileNo', align: 'center', width: '160' }, { text: '文件号', value: 'fileCode', align: 'center' }, @@ -77,7 +78,7 @@ // 查询列表 const fetchData = () => { loadingTable.value = true - SelectTechFiles({ ...listQuery.value, fileType: listQuery.value.fileType === '' ? '0' : listQuery.value.fileType }).then((res) => { + SelectTechFiles({ ...listQuery.value, fileType: fileClass.value === '' ? '0' : fileClass.value }).then((res) => { if (res.code === 200) { list.value = res.data.rows.map((item: { fileName: string; publishTime: string;effectiveTime: string }) => { return { @@ -156,9 +157,15 @@ // fetchData() } -// 初始化 -const initDialog = () => { +/** + * 初始化弹窗 + * @param fileType 文件类型 + * @param disabledFileTypeParam 是否禁止修改文件类型 + */ +const initDialog = (fileType = '0', disabledFileTypeParam = false) => { dialogFormVisible.value = true + fileClass.value = fileType || '' + disabledFileType.value = disabledFileTypeParam fetchData() } defineExpose({ initDialog }) @@ -175,7 +182,7 @@ - + ([ { text: '文件编号', value: 'fileNo', align: 'center', width: '160' }, { text: '文件号', value: 'fileCode', align: 'center' }, @@ -77,7 +78,7 @@ // 查询列表 const fetchData = () => { loadingTable.value = true - SelectTechFiles({ ...listQuery.value, fileType: listQuery.value.fileType === '' ? '0' : listQuery.value.fileType }).then((res) => { + SelectTechFiles({ ...listQuery.value, fileType: fileClass.value === '' ? '0' : fileClass.value }).then((res) => { if (res.code === 200) { list.value = res.data.rows.map((item: { fileName: string; publishTime: string;effectiveTime: string }) => { return { @@ -156,9 +157,15 @@ // fetchData() } -// 初始化 -const initDialog = () => { +/** + * 初始化弹窗 + * @param fileType 文件类型 + * @param disabledFileTypeParam 是否禁止修改文件类型 + */ +const initDialog = (fileType = '0', disabledFileTypeParam = false) => { dialogFormVisible.value = true + fileClass.value = fileType || '' + disabledFileType.value = disabledFileTypeParam fetchData() } defineExpose({ initDialog }) @@ -175,7 +182,7 @@ - + { - selectTechFilesRef.value.initDialog() + selectTechFilesRef.value.initDialog('10', true) } // 选好依据的技术文件 const selectTechFilesConfirm = (val: any) => { @@ -306,11 +308,57 @@ // sampleList.value.push(item) // } // }) - if (type === 'order') { + if (type === 'order') { // 先选委托方,再选样品(样品室委托方下面的样品) sampleList.value = [{ ...val[0], id: val[0].sampleId, remark: val[0].sampleRemark }] } - else { + else { // 没选委托方,直接选择样品库中的样品 sampleList.value = [{ ...val[0] }] + if (val[0].orderId) { // 如果有委托单 + // 请求委托单详情 + getOrderDetail({ id: val[0].orderId }).then((res) => { + form.value.orderId = val[0].orderId // 委托单id + form.value.orderCode = res.data.orderCode // 委托单 + form.value.customerId = res.data.customerId// 委托方id + form.value.customerName = res.data.customerName// 委托方名称 + form.value.customerAddress = res.data.customerAddress// 委托方地址 + form.value.certificationCompany = res.data.certificationCompany// 证书单位名称 + form.value.certificationCompanyAddress = res.data.certificationCompanyAddress// 证书单位地址 + form.value.certificationCompanyAddress = res.data.certificationCompanyAddress// 证书单位地址 + form.value.busPersonId = res.data.busPersonId// 业务员id + form.value.busPersonName = res.data.busPersonName// 业务员名字 + }) + } + else { // 没有委托单 + // 没有委托单去请求委托方的信息把委托方填上 + if (val[0].customerNo) { + const params = { + businessSize: '', // 业务规模 + customerName: '', // 公司名称 + customerNo: val[0].customerNo, // 客户编号 + grade: '', // 履约评级 + offset: 1, + limit: 20, + } + getCustomerList(params).then((res) => { + if (res && res.data && res.data.rows && res.data.rows.length) { + form.value.customerId = res.data.rows[0].id// 委托方id + form.value.customerName = res.data.rows[0].customerName// 委托方名称 + // 处理委托方地址 + if (res.data.rows[0].addressProvinceName && res.data.rows[0].addressCityName && (res.data.rows[0].addressProvinceName === res.data.rows[0].addressCityName)) { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressAreaName + res.data.rows[0].fullAddress + } + else { + if (res.data.rows[0].addressAreaName) { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressCityName + res.data.rows[0].addressAreaName + res.data.rows[0].fullAddress + } + else { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressCityName + res.data.rows[0].fullAddress + } + } + } + }) + } + } } } @@ -469,7 +517,7 @@ background: 'rgba(255, 255, 255, 0.8)', }) downLoadTemplate(params).then((res) => { - exportFile(res.data, `${form.value.certificateReportName}${form.value.templateName}.xls`) + exportFile(res.data, `${form.value.certificateReportName}${form.value.templateName}.xlsx`) loading.close() }).catch(() => { loading.close() @@ -713,9 +761,9 @@ if (index !== -1) { form.value.certificateReportCategoryName = certificationTypeMap.value[index].name } - console.log(form.value.certificateReportCategoryName) + console.log(form.value.certificateReportCategoryName, val) - if (val === '3') { // 如果是校准报告,电子签章自动选择校准专用章 + if (val === '3' || val === '1') { // 如果是校准报告\检测报告,电子签章自动选择校准专用章、检测专用章 const params = { signNo: '', // 编号 signName: '', // 名称 @@ -731,13 +779,19 @@ listPageApi(params).then((res) => { if (res.code === 200) { const resultList = res.data.rows - const index = resultList.findIndex((item: { signName: string }) => item.signName === '校准专用章') + let index = -1 + if (val === '3') { + index = resultList.findIndex((item: { signName: string }) => item.signName === '校准专用章') + } + if (val === '1') { + index = resultList.findIndex((item: { signName: string }) => item.signName === '检测专用章') + } if (index !== -1) { - form.value.signId = resultList[0].id // 电子签章id - form.value.signName = resultList[0].signName // 电子签章名称 + form.value.signId = resultList[index].id // 电子签章id + form.value.signName = resultList[index].signName // 电子签章名称 } else { - console.log('未获取到校准专用章') + console.log('未获取到校准专用章、检测专用章') } } }) diff --git a/src/views/business/lab/components/selectMeasureDevice.vue b/src/views/business/lab/components/selectMeasureDevice.vue index f879817..a192a02 100644 --- a/src/views/business/lab/components/selectMeasureDevice.vue +++ b/src/views/business/lab/components/selectMeasureDevice.vue @@ -118,6 +118,7 @@ abc: '', limit: 5, offset: 1, + modelNo: '', // 型号 // ids: [] as string[], } fetchData(true) diff --git a/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue b/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue index f6f1a5a..91127a8 100644 --- a/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue +++ b/src/views/business/lab/measureData/dialog/selectTechFilesDialog.vue @@ -32,6 +32,7 @@ const checkoutList = ref([]) // 多选表格 const total = ref(0) const fileClass = ref('0') // 文件分类 +const disabledFileType = ref(false) // 文件分类 const columns = ref([ { text: '文件编号', value: 'fileNo', align: 'center', width: '160' }, { text: '文件号', value: 'fileCode', align: 'center' }, @@ -77,7 +78,7 @@ // 查询列表 const fetchData = () => { loadingTable.value = true - SelectTechFiles({ ...listQuery.value, fileType: listQuery.value.fileType === '' ? '0' : listQuery.value.fileType }).then((res) => { + SelectTechFiles({ ...listQuery.value, fileType: fileClass.value === '' ? '0' : fileClass.value }).then((res) => { if (res.code === 200) { list.value = res.data.rows.map((item: { fileName: string; publishTime: string;effectiveTime: string }) => { return { @@ -156,9 +157,15 @@ // fetchData() } -// 初始化 -const initDialog = () => { +/** + * 初始化弹窗 + * @param fileType 文件类型 + * @param disabledFileTypeParam 是否禁止修改文件类型 + */ +const initDialog = (fileType = '0', disabledFileTypeParam = false) => { dialogFormVisible.value = true + fileClass.value = fileType || '' + disabledFileType.value = disabledFileTypeParam fetchData() } defineExpose({ initDialog }) @@ -175,7 +182,7 @@ - + { - selectTechFilesRef.value.initDialog() + selectTechFilesRef.value.initDialog('10', true) } // 选好依据的技术文件 const selectTechFilesConfirm = (val: any) => { @@ -306,11 +308,57 @@ // sampleList.value.push(item) // } // }) - if (type === 'order') { + if (type === 'order') { // 先选委托方,再选样品(样品室委托方下面的样品) sampleList.value = [{ ...val[0], id: val[0].sampleId, remark: val[0].sampleRemark }] } - else { + else { // 没选委托方,直接选择样品库中的样品 sampleList.value = [{ ...val[0] }] + if (val[0].orderId) { // 如果有委托单 + // 请求委托单详情 + getOrderDetail({ id: val[0].orderId }).then((res) => { + form.value.orderId = val[0].orderId // 委托单id + form.value.orderCode = res.data.orderCode // 委托单 + form.value.customerId = res.data.customerId// 委托方id + form.value.customerName = res.data.customerName// 委托方名称 + form.value.customerAddress = res.data.customerAddress// 委托方地址 + form.value.certificationCompany = res.data.certificationCompany// 证书单位名称 + form.value.certificationCompanyAddress = res.data.certificationCompanyAddress// 证书单位地址 + form.value.certificationCompanyAddress = res.data.certificationCompanyAddress// 证书单位地址 + form.value.busPersonId = res.data.busPersonId// 业务员id + form.value.busPersonName = res.data.busPersonName// 业务员名字 + }) + } + else { // 没有委托单 + // 没有委托单去请求委托方的信息把委托方填上 + if (val[0].customerNo) { + const params = { + businessSize: '', // 业务规模 + customerName: '', // 公司名称 + customerNo: val[0].customerNo, // 客户编号 + grade: '', // 履约评级 + offset: 1, + limit: 20, + } + getCustomerList(params).then((res) => { + if (res && res.data && res.data.rows && res.data.rows.length) { + form.value.customerId = res.data.rows[0].id// 委托方id + form.value.customerName = res.data.rows[0].customerName// 委托方名称 + // 处理委托方地址 + if (res.data.rows[0].addressProvinceName && res.data.rows[0].addressCityName && (res.data.rows[0].addressProvinceName === res.data.rows[0].addressCityName)) { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressAreaName + res.data.rows[0].fullAddress + } + else { + if (res.data.rows[0].addressAreaName) { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressCityName + res.data.rows[0].addressAreaName + res.data.rows[0].fullAddress + } + else { + form.value.customerAddress = res.data.rows[0].addressCountryName + res.data.rows[0].addressProvinceName + res.data.rows[0].addressCityName + res.data.rows[0].fullAddress + } + } + } + }) + } + } } } @@ -469,7 +517,7 @@ background: 'rgba(255, 255, 255, 0.8)', }) downLoadTemplate(params).then((res) => { - exportFile(res.data, `${form.value.certificateReportName}${form.value.templateName}.xls`) + exportFile(res.data, `${form.value.certificateReportName}${form.value.templateName}.xlsx`) loading.close() }).catch(() => { loading.close() @@ -713,9 +761,9 @@ if (index !== -1) { form.value.certificateReportCategoryName = certificationTypeMap.value[index].name } - console.log(form.value.certificateReportCategoryName) + console.log(form.value.certificateReportCategoryName, val) - if (val === '3') { // 如果是校准报告,电子签章自动选择校准专用章 + if (val === '3' || val === '1') { // 如果是校准报告\检测报告,电子签章自动选择校准专用章、检测专用章 const params = { signNo: '', // 编号 signName: '', // 名称 @@ -731,13 +779,19 @@ listPageApi(params).then((res) => { if (res.code === 200) { const resultList = res.data.rows - const index = resultList.findIndex((item: { signName: string }) => item.signName === '校准专用章') + let index = -1 + if (val === '3') { + index = resultList.findIndex((item: { signName: string }) => item.signName === '校准专用章') + } + if (val === '1') { + index = resultList.findIndex((item: { signName: string }) => item.signName === '检测专用章') + } if (index !== -1) { - form.value.signId = resultList[0].id // 电子签章id - form.value.signName = resultList[0].signName // 电子签章名称 + form.value.signId = resultList[index].id // 电子签章id + form.value.signName = resultList[index].signName // 电子签章名称 } else { - console.log('未获取到校准专用章') + console.log('未获取到校准专用章、检测专用章') } } }) diff --git a/src/views/measure/person/components/addPerson.vue b/src/views/measure/person/components/addPerson.vue index 63ed0e3..f8dc3dd 100644 --- a/src/views/measure/person/components/addPerson.vue +++ b/src/views/measure/person/components/addPerson.vue @@ -779,7 +779,7 @@ /> - +