feat:设备台账-筛选框优化

master
黄伟杰 2 days ago
parent 0bcd9bb579
commit 0c0b1ee648

@ -865,7 +865,9 @@ export default {
deviceStatus: 'Device Status',
lineFilter: 'Line',
allFilter: 'All Filters',
moreFilter: 'More Filters',
categoryStatus: 'Category & Status',
categoryInfo: 'Category Info',
dateFilter: 'Date Filter',
deviceBrand: 'Device Brand',
sn: 'Serial No.',
@ -907,6 +909,8 @@ export default {
placeholderDataCollectionCapacity: 'Enter data collection capacity',
placeholderProductionDate: 'Select production date',
placeholderOutgoingTime: 'Select outgoing date',
placeholderOutgoingStartTime: 'Start date',
placeholderOutgoingEndTime: 'End date',
placeholderFactoryEntryDate: 'Select factory entry date',
placeholderDeviceLocation: 'Enter device location',
placeholderRemark: 'Enter remark',

@ -864,11 +864,13 @@ export default {
deviceType: '设备类型',
deviceStatus: '设备状态',
lineFilter: '产线',
allFilter: '\u5168\u90e8\u7b5b\u9009',
categoryStatus: '\u5206\u7c7b\u72b6\u6001',
dateFilter: '\u65e5\u671f\u7b5b\u9009',
deviceBrand: '\u8bbe\u5907\u54c1\u724c',
sn: '\u5e8f\u5217\u53f7',
allFilter: '全部筛选',
moreFilter: '更多筛选',
categoryStatus: '分类状态',
categoryInfo: '分类信息',
dateFilter: '日期筛选',
deviceBrand: '设备品牌',
sn: '序列号',
scanUnrecognized: '未识别二维码内容',
scanTypeMismatch: '二维码类型不匹配',
scanFailed: '扫码失败',
@ -898,8 +900,8 @@ export default {
loadFailed: '加载设备详情失败',
placeholderDeviceCode: '请输入设备编码',
placeholderDeviceName: '请输入设备名称',
placeholderDeviceBrand: '\u8bf7\u8f93\u5165\u8bbe\u5907\u54c1\u724c',
placeholderSn: '\u8bf7\u8f93\u5165\u5e8f\u5217\u53f7',
placeholderDeviceBrand: '请输入设备品牌',
placeholderSn: '请输入序列号',
placeholderDeviceType: '请选择设备类型',
placeholderDeviceSpec: '请输入设备规格',
placeholderRatedCapacity: '请输入额定产能',
@ -907,6 +909,8 @@ export default {
placeholderDataCollectionCapacity: '请输入数据采集产能',
placeholderProductionDate: '请选择生产日期',
placeholderOutgoingTime: '请选择出厂日期',
placeholderOutgoingStartTime: '开始日期',
placeholderOutgoingEndTime: '结束日期',
placeholderFactoryEntryDate: '请选择入厂日期',
placeholderDeviceLocation: '请输入设备位置',
placeholderRemark: '请输入备注',
@ -1540,7 +1544,7 @@ export default {
moduleName: '产品盘点执行',
createTitle: '新增产品盘点',
executeTitle: '执行盘点',
detailTitle: '\u4ea7\u54c1\u76d8\u70b9\u8be6\u60c5',
detailTitle: '产品盘点详情',
selectProductTitle: '选择产品',
selectItemTitle: '选择盘点项',
selectWarehouseTitle: '选择仓库',

@ -26,7 +26,7 @@
<input id="equipment-ledger-keyword-input" v-model="searchKeyword" class="keyword-input" type="text"
:placeholder="t('equipmentLedger.searchPlaceholder')" confirm-type="search" @confirm="handleSearch" />
</view>
<view class="icon-filter-btn" @click="refreshList">
<view class="icon-filter-btn" @click="resetFilters">
<uni-icons type="refresh" size="24" color="#7b8491"></uni-icons>
</view>
<view class="icon-filter-btn" @click="openFilterDrawer">
@ -75,10 +75,11 @@
<uni-icons type="top" size="22" color="#ffffff"></uni-icons>
</view>
<uni-popup ref="filterPopupRef" type="right" background-color="#ffffff">
<uni-popup ref="filterPopupRef" class="equipment-filter-popup" type="right" background-color="#ffffff"
:animation="false">
<view class="filter-drawer">
<view class="drawer-header">
<text class="drawer-title">{{ t('equipmentLedger.allFilter') }}</text>
<text class="drawer-title">{{ t('equipmentLedger.moreFilter') }}</text>
</view>
<scroll-view scroll-y class="drawer-body">
<view class="drawer-section">
@ -86,16 +87,6 @@
<text class="drawer-section-title">{{ t('equipmentLedger.basicInfo') }}</text>
</view>
<view class="drawer-grid">
<view class="drawer-field">
<text class="drawer-label">{{ t('equipmentLedger.deviceCode') }}</text>
<input v-model="deviceCodeFilter" class="drawer-input" type="text"
:placeholder="t('equipmentLedger.placeholderDeviceCode')" />
</view>
<view class="drawer-field">
<text class="drawer-label">{{ t('equipmentLedger.deviceName') }}</text>
<input v-model="deviceNameFilter" class="drawer-input" type="text"
:placeholder="t('equipmentLedger.placeholderDeviceName')" />
</view>
<view class="drawer-field">
<text class="drawer-label">{{ t('equipmentLedger.deviceBrand') }}</text>
<input v-model="deviceBrandFilter" class="drawer-input" type="text"
@ -111,21 +102,9 @@
<view class="drawer-section">
<view class="drawer-section-head">
<text class="drawer-section-title">{{ t('equipmentLedger.categoryStatus') }}</text>
<text class="drawer-section-title">{{ t('equipmentLedger.categoryInfo') }}</text>
</view>
<view class="drawer-grid">
<view class="drawer-field">
<text class="drawer-label">{{ t('equipmentLedger.deviceStatus') }}</text>
<picker :range="statusPickerLabels" :value="statusPickerIndex" @change="onDrawerStatusFilterChange">
<view class="drawer-picker">
<text :class="[
'drawer-picker-text',
selectedStatus === '' ? 'placeholder' : '',
]">{{ selectedStatusLabel }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons>
</view>
</picker>
</view>
<view class="drawer-field drawer-field-wide">
<text class="drawer-label">{{ t('equipmentLedger.deviceType') }}</text>
<view class="drawer-picker" @click="toggleDrawerDeviceTypePanel">
@ -145,24 +124,6 @@
</view>
</scroll-view>
</view>
<view class="drawer-field drawer-field-wide">
<text class="drawer-label">{{ t('equipmentLedger.lineFilter') }}</text>
<view class="drawer-picker" @click="toggleDrawerLinePanel">
<text :class="[
'drawer-picker-text',
selectedLineId === '' ? 'placeholder' : '',
]">{{ selectedLineLabel }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons>
</view>
<scroll-view v-if="drawerLinePanelOpen" scroll-y class="drawer-option-panel">
<view v-for="option in drawerLineOptions" :key="`line-${option.id}`" :class="[
'drawer-option-item',
String(selectedLineId) === String(option.id) ? 'active' : '',
]" :style="{ paddingLeft: `${24 + option.level * 24}rpx` }" @click="selectDrawerLine(option)">
<text class="drawer-option-text">{{ option.name }}</text>
</view>
</scroll-view>
</view>
</view>
</view>
@ -173,8 +134,9 @@
<view class="drawer-field drawer-field-wide">
<text class="drawer-label">{{ t('equipmentLedger.outgoingTime') }}</text>
<view class="drawer-date">
<uni-datetime-picker v-model="outgoingTimeFilter" type="date" :clear-icon="true"
:placeholder="t('equipmentLedger.placeholderOutgoingTime')" />
<uni-datetime-picker v-model="outgoingTimeFilter" type="daterange" :clear-icon="true"
:start-placeholder="t('equipmentLedger.placeholderOutgoingStartTime')"
:end-placeholder="t('equipmentLedger.placeholderOutgoingEndTime')" />
</view>
</view>
</view>
@ -222,13 +184,10 @@ const searchKeyword = ref('');
const selectedStatus = ref('');
const selectedLineId = ref('');
const selectedDeviceTypeId = ref('');
const deviceCodeFilter = ref('');
const deviceNameFilter = ref('');
const deviceBrandFilter = ref('');
const snFilter = ref('');
const outgoingTimeFilter = ref('');
const outgoingTimeFilter = ref([]);
const drawerDeviceTypePanelOpen = ref(false);
const drawerLinePanelOpen = ref(false);
const filterPopupRef = ref(null);
const lineTree = ref([]);
const deviceTypeTree = ref([]);
@ -294,10 +253,6 @@ const selectedLineLabel = computed(() => {
);
return found?.name || t('equipmentLedger.lineFilter');
});
const drawerLineOptions = computed(() => [
{ id: '', name: t('functionCommon.all'), level: 0 },
...lineOptions.value,
]);
const deviceTypeOptions = computed(() => flattenLineTree(deviceTypeTree.value));
const deviceTypeCascaderOptions = computed(() => [
{ label: t('functionCommon.all'), value: '' },
@ -449,15 +404,14 @@ async function fetchList(reset) {
}
try {
const keyword = searchKeyword.value.trim();
const deviceCode = deviceCodeFilter.value.trim();
const deviceName = deviceNameFilter.value.trim();
const deviceBrand = deviceBrandFilter.value.trim();
const sn = snFilter.value.trim();
const outgoingTimeRange = Array.isArray(outgoingTimeFilter.value) ? outgoingTimeFilter.value : [];
const params = {
pageNo: pageNo.value,
pageSize: pageSize.value,
deviceCode: deviceCode || keyword || undefined,
deviceName: deviceName || keyword || undefined,
deviceCode: keyword || undefined,
deviceName: keyword || undefined,
deviceStatus:
selectedStatus.value === '' ? undefined : selectedStatus.value,
deviceLine:
@ -466,7 +420,8 @@ async function fetchList(reset) {
selectedDeviceTypeId.value === '' ? undefined : selectedDeviceTypeId.value,
deviceBrand: deviceBrand || undefined,
sn: sn || undefined,
outgoingTime: outgoingTimeFilter.value || undefined,
'outgoingTime[0]': outgoingTimeRange[0] || undefined,
'outgoingTime[1]': outgoingTimeRange[1] || undefined,
};
const res = await getDeviceLedgerPage(params);
const page = normalizePageData(res);
@ -509,38 +464,26 @@ function onStatusFilterChange(e) {
fetchList(true);
}
function onDrawerStatusFilterChange(e) {
const idx = Number(e?.detail?.value || 0);
selectedStatus.value = statusOptions.value[idx]?.value ?? '';
}
function openFilterDrawer() {
filterPopupRef.value?.open();
}
function closeFilterDrawer() {
filterPopupRef.value?.close();
}
async function confirmFilterDrawer() {
drawerDeviceTypePanelOpen.value = false;
drawerLinePanelOpen.value = false;
closeFilterDrawer();
await fetchList(true);
}
async function refreshList() {
await fetchList(true);
}
function toggleDrawerDeviceTypePanel() {
drawerDeviceTypePanelOpen.value = !drawerDeviceTypePanelOpen.value;
if (drawerDeviceTypePanelOpen.value) drawerLinePanelOpen.value = false;
}
function toggleDrawerLinePanel() {
drawerLinePanelOpen.value = !drawerLinePanelOpen.value;
if (drawerLinePanelOpen.value) drawerDeviceTypePanelOpen.value = false;
}
function selectDrawerDeviceType(option) {
selectedDeviceTypeId.value = option?.id === '' ? '' : String(option?.id ?? '');
@ -550,13 +493,6 @@ function selectDrawerDeviceType(option) {
drawerDeviceTypePanelOpen.value = false;
}
function selectDrawerLine(option) {
selectedLineId.value = option?.id === '' ? '' : String(option?.id ?? '');
lineCascaderValue.value = selectedLineId.value
? findLinePath(lineTree.value, selectedLineId.value)
: [];
drawerLinePanelOpen.value = false;
}
function openDeviceTypeCascader() {
deviceTypeCascaderShow.value = true;
}
@ -585,16 +521,13 @@ function onLineCascaderConfirm(values) {
}
async function resetFilters() {
searchKeyword.value = '';
deviceCodeFilter.value = '';
deviceNameFilter.value = '';
deviceBrandFilter.value = '';
snFilter.value = '';
outgoingTimeFilter.value = '';
outgoingTimeFilter.value = [];
selectedStatus.value = '';
selectedLineId.value = '';
selectedDeviceTypeId.value = '';
drawerDeviceTypePanelOpen.value = false;
drawerLinePanelOpen.value = false;
lineCascaderValue.value = [];
deviceTypeCascaderValue.value = [];
lineCascaderShow.value = false;
@ -852,6 +785,10 @@ function formatDateValue(value) {
border-radius: 28rpx 0 0 28rpx;
}
:deep(.equipment-filter-popup.right .uni-popup__content-transition) {
transform: none !important;
}
.drawer-header {
height: 104rpx;
padding: 18rpx 34rpx 0;
@ -1017,17 +954,31 @@ function formatDateValue(value) {
color: #1f2937;
}
.drawer-date :deep(.uni-date) {
.drawer-date :deep(.uni-date),
.drawer-date :deep(.uni-date-editor),
.drawer-date :deep(.uni-date-editor--x),
.drawer-date :deep(.uni-date-x) {
width: 100%;
}
.drawer-date :deep(.uni-date-editor),
.drawer-date :deep(.uni-date-editor--x),
.drawer-date :deep(.uni-date-x) {
min-height: 74rpx;
}
.drawer-date :deep(.uni-date-editor--x),
.drawer-date :deep(.uni-date-x) {
border: 0;
padding: 0;
background: transparent;
}
.drawer-date :deep(.uni-date-range) {
display: flex;
align-items: center;
}
.drawer-date :deep(.uni-date__x-input) {
text-align: center;
font-size: 26rpx;

@ -3,7 +3,7 @@
<view @touchstart="touchstart">
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
:duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"
<uni-transition key="2" :mode-class="ani" name="content" custom-class="uni-popup__content-transition" :styles="transClass" :duration="duration"
:show="showTrans" @click="onTap">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<slot />

Loading…
Cancel
Save