This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
<div class="device-list-page" id="table-full-screen">
|
||||
<!-- 搜索栏 -->
|
||||
<ArtSearchBar
|
||||
v-model:filter="searchForm"
|
||||
:filter="searchForm"
|
||||
@update:filter="(value) => Object.assign(searchForm, value)"
|
||||
:items="searchFormItems"
|
||||
:show-expand="searchFormItems.length >= 4"
|
||||
@reset="handleReset"
|
||||
@search="handleSearch"
|
||||
></ArtSearchBar>
|
||||
@@ -17,6 +19,15 @@
|
||||
@refresh="handleRefresh"
|
||||
>
|
||||
<template #left>
|
||||
<ElButton
|
||||
v-if="
|
||||
canPollingBatch(userStore.info.user_type) &&
|
||||
hasAuth(SCHEDULER_PERMISSIONS.deviceBatch)
|
||||
"
|
||||
:disabled="!selectedDevices.length"
|
||||
@click="openPollingBatch"
|
||||
>批量开关轮询</ElButton
|
||||
>
|
||||
<ElButton
|
||||
type="primary"
|
||||
@click="handleBatchAllocate"
|
||||
@@ -966,10 +977,18 @@
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
<PollingBatchDialog
|
||||
v-if="pollingBatchIds"
|
||||
target="device"
|
||||
:ids="pollingBatchIds"
|
||||
:permission="SCHEDULER_PERMISSIONS.deviceBatch"
|
||||
@close="pollingBatchIds = null"
|
||||
@done="getTableData"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h } from 'vue'
|
||||
import { computed, h, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
@@ -1001,6 +1020,9 @@
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import PollingBatchDialog from '@/components/business/polling/PollingBatchDialog.vue'
|
||||
import { SCHEDULER_PERMISSIONS } from '@/config/constants/pollingScheduler'
|
||||
import { canPollingBatch, pollingScope } from '@/utils/business/pollingScheduler'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import {
|
||||
getExpiryEstimateText,
|
||||
@@ -1044,6 +1066,12 @@
|
||||
const allocateDialogVisible = ref(false)
|
||||
const recallDialogVisible = ref(false)
|
||||
const selectedDevices = ref<Device[]>([])
|
||||
const pollingBatchIds = ref<number[] | null>(null)
|
||||
function openPollingBatch() {
|
||||
if (!canPollingBatch(userStore.info.user_type) || !hasAuth(SCHEDULER_PERMISSIONS.deviceBatch))
|
||||
return
|
||||
pollingBatchIds.value = selectedDevices.value.map((row) => row.id)
|
||||
}
|
||||
const batchRealnamePolicyDialogVisible = ref(false)
|
||||
const batchRealnamePolicyLoading = ref(false)
|
||||
const batchRealnamePolicyError = ref('')
|
||||
@@ -1342,6 +1370,7 @@
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
enable_polling: undefined as boolean | undefined,
|
||||
virtual_no: '',
|
||||
imei: '',
|
||||
device_name: '',
|
||||
@@ -1363,6 +1392,13 @@
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive<Record<string, any>>({ ...initialSearchState })
|
||||
watch(
|
||||
() => JSON.stringify([searchForm, pollingScope(userStore)]),
|
||||
() => {
|
||||
pollingBatchIds.value = null
|
||||
selectedDevices.value = []
|
||||
}
|
||||
)
|
||||
|
||||
// 批次号仅在用户切换至筛选条件或输入批次号搜索时加载。
|
||||
const loadSearchBatchNoOptions = async (batchNo?: string) => {
|
||||
@@ -1614,6 +1650,7 @@
|
||||
|
||||
// 列配置
|
||||
const columnOptions = [
|
||||
{ label: '是否轮询', prop: 'enable_polling' },
|
||||
{ label: '设备号', prop: 'virtual_no' },
|
||||
{ label: 'IMEI', prop: 'imei' },
|
||||
{ label: '设备名称', prop: 'device_name' },
|
||||
@@ -1647,6 +1684,16 @@
|
||||
]
|
||||
|
||||
const deviceList = ref<Device[]>([])
|
||||
searchFormItems.push({
|
||||
label: '是否轮询',
|
||||
prop: 'enable_polling',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '轮询中', value: true },
|
||||
{ label: '已关闭', value: false }
|
||||
],
|
||||
config: { clearable: true }
|
||||
})
|
||||
|
||||
// 分配表单
|
||||
const allocateForm = reactive({
|
||||
@@ -1867,7 +1914,7 @@
|
||||
prop: 'virtual_no',
|
||||
label: '设备号',
|
||||
minWidth: 170,
|
||||
fixed:true,
|
||||
fixed: true,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Device) => {
|
||||
return h(
|
||||
@@ -1990,6 +2037,13 @@
|
||||
return h(ElTag, { type: status.type }, () => status.text)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'enable_polling',
|
||||
label: '是否轮询',
|
||||
width: 110,
|
||||
formatter: (row: Device) =>
|
||||
row.enable_polling == null ? '-' : row.enable_polling ? '轮询中' : '已关闭'
|
||||
},
|
||||
{
|
||||
prop: 'activation_status_name',
|
||||
label: '激活状态',
|
||||
@@ -2193,6 +2247,7 @@
|
||||
imei: searchForm.imei || undefined,
|
||||
device_name: searchForm.device_name || undefined,
|
||||
status: searchForm.status,
|
||||
enable_polling: searchForm.enable_polling ?? undefined,
|
||||
activation_status: searchForm.activation_status ?? undefined,
|
||||
real_name_status: searchForm.real_name_status ?? undefined,
|
||||
batch_no: searchForm.batch_no || undefined,
|
||||
@@ -2224,6 +2279,7 @@
|
||||
imei: searchForm.imei || undefined,
|
||||
device_name: searchForm.device_name || undefined,
|
||||
status: searchForm.status,
|
||||
enable_polling: searchForm.enable_polling ?? undefined,
|
||||
activation_status: searchForm.activation_status ?? undefined,
|
||||
real_name_status: searchForm.real_name_status ?? undefined,
|
||||
batch_no: searchForm.batch_no || undefined,
|
||||
@@ -2546,10 +2602,7 @@
|
||||
|
||||
const showEnterpriseDeviceAuthorizeDialog = async () => {
|
||||
resetEnterpriseDeviceAuthorizeForm()
|
||||
await Promise.all([
|
||||
handleSearchEnterprise(),
|
||||
loadTopLevelShopCascadeOptions()
|
||||
])
|
||||
await Promise.all([handleSearchEnterprise(), loadTopLevelShopCascadeOptions()])
|
||||
enterpriseDeviceAuthorizeDialogVisible.value = true
|
||||
enterpriseDeviceAuthorizeFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user