|
|
|
|
@ -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;
|
|
|
|
|
|