| | |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | > |
| | | <template #validUntilSlot="{ row }"> |
| | | <span>{{ row.validUntil ? row.validUntil.split(' ')[0] : '' }}</span> |
| | | <el-tag v-if="isWarning(row.validUntil)" type="warning" class="ml10">即将到期</el-tag> |
| | | <el-tag v-else-if="isOverdue(row.validUntil)" type="danger" class="ml10">已逾期</el-tag> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <calibration-dia ref="calibrationDia" @close="handleQuery"></calibration-dia> |
| | | </div> |
| | |
| | | <script setup> |
| | | import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue"; |
| | | import {ElMessageBox, ElMessage} from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue"; |
| | | import {ledgerRecordListPage, ledgerRecordDelete} from "@/api/equipmentManagement/calibration.js"; |
| | |
| | | width:200 |
| | | }, |
| | | { |
| | | label: "有效期", |
| | | label: "有效期(天)", |
| | | prop: "valid", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "有效期至", |
| | | prop: "validUntil", |
| | | dataType: "slot", |
| | | slot: "validUntilSlot", |
| | | width: 160, |
| | | }, |
| | | { |
| | | label: "溯源/核查类型", |
| | | prop: "traceabilityType", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "实施机构", |
| | | prop: "implementingAgency", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "证书编号", |
| | | prop: "certificateNumber", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "核心结果", |
| | | prop: "coreResult", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "结果确认", |
| | | prop: "resultConfirmation", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "确认人", |
| | | prop: "confirmerName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "录入人", |
| | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | ledgerRecordListPage({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }).catch((err) => { |
| | | tableLoading.value = false; |
| | | }) |
| | | }); |
| | | }; |
| | | |
| | | const isWarning = (validUntil) => { |
| | | if (!validUntil) return false; |
| | | const now = dayjs().startOf('day'); |
| | | const until = dayjs(validUntil).startOf('day'); |
| | | const diffDays = until.diff(now, 'day'); |
| | | return diffDays >= 0 && diffDays <= 30; |
| | | }; |
| | | |
| | | const isOverdue = (validUntil) => { |
| | | if (!validUntil) return false; |
| | | const now = dayjs().startOf('day'); |
| | | const until = dayjs(validUntil).startOf('day'); |
| | | return until.isBefore(now); |
| | | }; |
| | | |
| | | // 打开检定校准弹框 |