Browse Source

pms 瑞恒日报 施工设备 同时根据 设备编码 设备名称过滤

zhangcl 2 weeks ago
parent
commit
9d53cef8a7
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/views/pms/iotprojecttask/IotProjectTaskForm.vue

+ 13 - 0
src/views/pms/iotprojecttask/IotProjectTaskForm.vue

@@ -562,6 +562,7 @@
         :titles="['可选设备', '已选设备']"
         :props="{ key: 'id', label: 'deviceCode' }"
         filterable
+        :filter-method="filterDeviceMethod"
         class="transfer-component"
         @change="handleTransferChange"
       >
@@ -1708,6 +1709,18 @@ const handleRowClick = (row, index) => {
   }
 };
 
+// 设备过滤方法
+const filterDeviceMethod = (query: string, item: IotDeviceVO) => {
+  if (!query) return true;
+
+  const searchText = query.toLowerCase();
+  const deviceCode = (item.deviceCode || '').toLowerCase();
+  const deviceName = (item.deviceName || '').toLowerCase();
+
+  // 同时匹配设备编码和设备名称
+  return deviceCode.includes(searchText) || deviceName.includes(searchText);
+};
+
 // 根据责任人ID获取责任人名称
 const getResponsiblePersonNames = (responsiblePersonIds: number[]) => {
   if (!responsiblePersonIds || responsiblePersonIds.length === 0) return '';