|
@@ -314,16 +314,16 @@
|
|
|
{{ row.return_time ? dayjs(row.return_time).format('YYYY-MM-DD HH:mm:ss') : (row.return_status?.label === '已归还' ? dayjs().format('YYYY-MM-DD HH:mm:ss') : '') }}
|
|
{{ row.return_time ? dayjs(row.return_time).format('YYYY-MM-DD HH:mm:ss') : (row.return_status?.label === '已归还' ? dayjs().format('YYYY-MM-DD HH:mm:ss') : '') }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="150" align="center">
|
|
|
|
|
|
|
+ <el-table-column label="操作" width="120" align="center">
|
|
|
<template #default="{ $index,row }">
|
|
<template #default="{ $index,row }">
|
|
|
<!-- && (!returnDeviceList[$index]?.condition || returnDeviceList[$index]?.photos?.length==0)&& row.problem_records?.length ==0 -->
|
|
<!-- && (!returnDeviceList[$index]?.condition || returnDeviceList[$index]?.photos?.length==0)&& row.problem_records?.length ==0 -->
|
|
|
- <el-button :disabled="isView" type="text" style="color: red"
|
|
|
|
|
|
|
+ <el-button :disabled="isView" type="text" style="color: red;"
|
|
|
v-if="!isView"
|
|
v-if="!isView"
|
|
|
@click="handleAbnormal($index)">异常操作</el-button>
|
|
@click="handleAbnormal($index)">异常操作</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
|
|
|
type="text"
|
|
type="text"
|
|
|
- style="color: #409EFF"
|
|
|
|
|
|
|
+ style="color: #409EFF;margin-left:0"
|
|
|
@click="handleViewAbnormal($index)"
|
|
@click="handleViewAbnormal($index)"
|
|
|
v-if="row.problem_records?.length || (returnDeviceList[$index]?.condition || returnDeviceList[$index]?.photos?.length)"
|
|
v-if="row.problem_records?.length || (returnDeviceList[$index]?.condition || returnDeviceList[$index]?.photos?.length)"
|
|
|
>查看异常</el-button>
|
|
>查看异常</el-button>
|
|
@@ -388,10 +388,11 @@
|
|
|
<SelectDeviceDialog
|
|
<SelectDeviceDialog
|
|
|
v-model:visible="showSelectDeviceDialog"
|
|
v-model:visible="showSelectDeviceDialog"
|
|
|
@confirm="onDeviceSelected"
|
|
@confirm="onDeviceSelected"
|
|
|
- :device-ids="returnDeviceList.filter(item => item.return_status.label !== '已归还').map(item => item.device_no)"
|
|
|
|
|
|
|
+ :device-ids="returnDeviceList.map(item => item.device_no)"
|
|
|
:return-mode="activeName === 'third'"
|
|
:return-mode="activeName === 'third'"
|
|
|
|
|
+ :device-status-map="deviceStatusMap"
|
|
|
/>
|
|
/>
|
|
|
- <SettlementDialog v-model:visible="showSettlementDialog" :settlement-data="settlementData" />
|
|
|
|
|
|
|
+ <SettlementDialog v-model:visible="showSettlementDialog" :settlement-data="settlementData" :modelValue="borrowForm" />
|
|
|
<AbnormalDialog v-model:visible="showAbnormalDialog" @confirm="onAbnormalConfirm" />
|
|
<AbnormalDialog v-model:visible="showAbnormalDialog" @confirm="onAbnormalConfirm" />
|
|
|
<ViewAbnormalDialog
|
|
<ViewAbnormalDialog
|
|
|
v-model:visible="showViewAbnormalDialog"
|
|
v-model:visible="showViewAbnormalDialog"
|
|
@@ -571,7 +572,7 @@ const shouldHideDeviceList = computed(() => {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 强制显示:状态大于 5 或状态标签为“已借出”
|
|
|
|
|
|
|
+ // 强制显示:状态大于 5 或状态标签为"已借出"
|
|
|
if ((typeof status === 'number' && status > 5) || statusLabel === '已借出') {
|
|
if ((typeof status === 'number' && status > 5) || statusLabel === '已借出') {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -583,6 +584,17 @@ const shouldHideDeviceList = computed(() => {
|
|
|
return isPendingApproval;
|
|
return isPendingApproval;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 计算设备状态映射
|
|
|
|
|
+const deviceStatusMap = computed(() => {
|
|
|
|
|
+ const statusMap: Record<string | number, any> = {};
|
|
|
|
|
+ returnDeviceList.value.forEach(device => {
|
|
|
|
|
+ if (device.device_no && device.return_status) {
|
|
|
|
|
+ statusMap[device.device_no] = device.return_status;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return statusMap;
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const emit = defineEmits(['update:visible', 'update:modelValue', 'submit']);
|
|
const emit = defineEmits(['update:visible', 'update:modelValue', 'submit']);
|
|
|
const visible = ref(props.visible);
|
|
const visible = ref(props.visible);
|
|
|
const formRef = ref();
|
|
const formRef = ref();
|
|
@@ -646,6 +658,7 @@ function getWarehouseName(id: any) {
|
|
|
// 添加结算单相关的状态
|
|
// 添加结算单相关的状态
|
|
|
const showSettlementDialog = ref(false);
|
|
const showSettlementDialog = ref(false);
|
|
|
const settlementData = ref<any>(null);
|
|
const settlementData = ref<any>(null);
|
|
|
|
|
+const borrowForm = ref<any>(null);
|
|
|
|
|
|
|
|
// 添加异常操作相关的状态
|
|
// 添加异常操作相关的状态
|
|
|
const showAbnormalDialog = ref(false);
|
|
const showAbnormalDialog = ref(false);
|
|
@@ -926,6 +939,7 @@ function onDeviceSelected(devices: Device[]) {
|
|
|
returnDeviceList.value[existingDeviceIndex].return_status.label = '已归还';
|
|
returnDeviceList.value[existingDeviceIndex].return_status.label = '已归还';
|
|
|
returnDeviceList.value[existingDeviceIndex].is_return = true;
|
|
returnDeviceList.value[existingDeviceIndex].is_return = true;
|
|
|
returnDeviceList.value[existingDeviceIndex].return_time = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
returnDeviceList.value[existingDeviceIndex].return_time = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
+ returnDeviceList.value[existingDeviceIndex].brand = d.brand || '';
|
|
|
ElMessage.success(`设备 ${d.category_name} 状态已更新为已归还`);
|
|
ElMessage.success(`设备 ${d.category_name} 状态已更新为已归还`);
|
|
|
} else {
|
|
} else {
|
|
|
// 如果设备不存在,添加新记录
|
|
// 如果设备不存在,添加新记录
|
|
@@ -1105,7 +1119,7 @@ watch(() => props.modelValue, async (val) => {
|
|
|
device_type: item.remark,
|
|
device_type: item.remark,
|
|
|
device_name: item.device_name,
|
|
device_name: item.device_name,
|
|
|
borrow_count: item.quantity,
|
|
borrow_count: item.quantity,
|
|
|
- brand: '',
|
|
|
|
|
|
|
+ brand: item.brand || '',
|
|
|
model: item.device_specification,
|
|
model: item.device_specification,
|
|
|
warehouse: item.location,
|
|
warehouse: item.location,
|
|
|
problem_records: item.problem_records,
|
|
problem_records: item.problem_records,
|
|
@@ -1192,7 +1206,7 @@ watch(() => props.modelValue, async (val) => {
|
|
|
device_type: item.remark,
|
|
device_type: item.remark,
|
|
|
device_name: item.device_name,
|
|
device_name: item.device_name,
|
|
|
borrow_count: item.quantity,
|
|
borrow_count: item.quantity,
|
|
|
- brand: '',
|
|
|
|
|
|
|
+ brand: item.brand || '',
|
|
|
model: item.device_specification,
|
|
model: item.device_specification,
|
|
|
warehouse: item.location,
|
|
warehouse: item.location,
|
|
|
problem_records: item.problem_records,
|
|
problem_records: item.problem_records,
|
|
@@ -1375,6 +1389,7 @@ function onSubmit() {
|
|
|
|
|
|
|
|
// 使用 nextTick 确保在 DOM 更新后再显示结算单
|
|
// 使用 nextTick 确保在 DOM 更新后再显示结算单
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
|
|
+ borrowForm.value = {...settlementData.value,mode: 'settlement' };
|
|
|
showSettlementDialog.value = true;
|
|
showSettlementDialog.value = true;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|