|
|
@@ -388,7 +388,7 @@
|
|
|
<SelectDeviceDialog
|
|
|
v-model:visible="showSelectDeviceDialog"
|
|
|
@confirm="onDeviceSelected"
|
|
|
- :device-ids="returnDeviceList.map(item => item.device_no)"
|
|
|
+ :device-ids="unreturnedDeviceIds"
|
|
|
:return-mode="activeName === 'third'"
|
|
|
:device-status-map="deviceStatusMap"
|
|
|
/>
|
|
|
@@ -629,6 +629,25 @@ const returnAccessoryInfo = ref('');
|
|
|
const returnRemark = ref('');
|
|
|
const selectedDevices = ref<DeviceListItem[]>([]); // 添加选中设备列表
|
|
|
|
|
|
+// 统一判定设备是否已归还
|
|
|
+const isDeviceReturned = (device: any) => {
|
|
|
+ if (device?.is_return === true) return true;
|
|
|
+ const rs = device?.return_status;
|
|
|
+ if (rs && (rs.value === 2 || rs.label === '已归还')) return true;
|
|
|
+ if (device?.status === '已归还') return true;
|
|
|
+ return false;
|
|
|
+};
|
|
|
+
|
|
|
+// 过滤未归还设备的 device_no 列表,用于设备选择弹窗的排除
|
|
|
+const unreturnedDeviceIds = computed(() =>
|
|
|
+ returnDeviceList.value
|
|
|
+ .filter((d) => !isDeviceReturned(d))
|
|
|
+ .map((d) => d.device_no)
|
|
|
+);
|
|
|
+
|
|
|
+// 是否全部已归还(仅在归还页签生效)
|
|
|
+const allReturned = computed(() => unreturnedDeviceIds.value.length === 0);
|
|
|
+
|
|
|
//审批步骤
|
|
|
const steps = ref<any[]>([]);
|
|
|
// 仓库映射(id -> name)
|
|
|
@@ -771,6 +790,7 @@ const onAbnormalConfirm = (data: { condition: string; photos: any[] }) => {
|
|
|
device.damage_type = data.damage_type;
|
|
|
ElMessage.success('异常信息已保存');
|
|
|
}
|
|
|
+ console.log("returnDeviceList.value:::",returnDeviceList.value);
|
|
|
};
|
|
|
|
|
|
// 处理查看异常
|
|
|
@@ -780,7 +800,7 @@ const handleViewAbnormal = (index: number) => {
|
|
|
if (device) {
|
|
|
if(device.problem_records?.length){
|
|
|
currentAbnormalData.value = {
|
|
|
- damage_type:device.problem_records?.[0].damage_type ||'',
|
|
|
+ damage_type:device.problem_records?.[0].damage_type ||device.damage_type ||'',
|
|
|
condition: device.problem_records?.[0].device_condition_after ||'',
|
|
|
photos: device.problem_records?.[0].returned_images.map((item:any)=>item.image_url) ||[]
|
|
|
};
|
|
|
@@ -924,6 +944,10 @@ const handleView = (row: any) => {
|
|
|
|
|
|
// 借用列表相关方法
|
|
|
const handleAdd = () => {
|
|
|
+ if (activeName.value === 'third' && allReturned.value) {
|
|
|
+ ElMessage.info('当前列表设备均已归还,无可选择设备');
|
|
|
+ return;
|
|
|
+ }
|
|
|
showSelectDeviceDialog.value = true;
|
|
|
};
|
|
|
|
|
|
@@ -1311,7 +1335,11 @@ watch(() => form.value.app_user_borrower, (newValue) => {
|
|
|
}
|
|
|
});
|
|
|
function addItem() {
|
|
|
- showSelectDeviceDialog.value = true;
|
|
|
+ if (activeName.value === 'third' && allReturned.value) {
|
|
|
+ ElMessage.info('当前列表设备均已归还,无可选择设备');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ showSelectDeviceDialog.value = true;
|
|
|
}
|
|
|
function removeItem(index: number) {
|
|
|
form.value.items.splice(index, 1);
|