This commit is contained in:
@@ -562,7 +562,7 @@
|
||||
import { h } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { CardService, ShopService, PackageSeriesService, AssetService } from '@/api/modules'
|
||||
import { CardService, ShopService, PackageSeriesService, AssetService, CarrierService } from '@/api/modules'
|
||||
import { ElMessage, ElTag, ElIcon, ElMessageBox } from 'element-plus'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
import RealnamePolicyDialog from '@/components/device/RealnamePolicyDialog.vue'
|
||||
@@ -627,6 +627,38 @@
|
||||
failed_items: null
|
||||
})
|
||||
|
||||
// 运营商搜索相关
|
||||
const carrierLoading = ref(false)
|
||||
const searchCarrierOptions = ref<any[]>([])
|
||||
|
||||
// 加载搜索栏运营商选项(默认加载10条)
|
||||
const loadSearchCarrierOptions = async (carrierName?: string) => {
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
page_size: 10
|
||||
}
|
||||
if (carrierName) {
|
||||
params.carrier_name = carrierName
|
||||
}
|
||||
const res = await CarrierService.getCarriers(params)
|
||||
if (res.code === 0) {
|
||||
searchCarrierOptions.value = res.data.items
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载运营商选项失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索运营商(用于搜索栏)
|
||||
const handleSearchCarrier = (query: string) => {
|
||||
if (query) {
|
||||
loadSearchCarrierOptions(query)
|
||||
} else {
|
||||
loadSearchCarrierOptions()
|
||||
}
|
||||
}
|
||||
|
||||
// 卡详情弹窗相关
|
||||
const cardDetailDialogVisible = ref(false)
|
||||
const cardDetailLoading = ref(false)
|
||||
@@ -730,8 +762,8 @@
|
||||
// 搜索表单初始值
|
||||
const initialSearchState: {
|
||||
status: undefined | number
|
||||
carrier_id: undefined | number
|
||||
iccid: string
|
||||
carrier_name: string
|
||||
msisdn: string
|
||||
virtual_no: string
|
||||
device_virtual_no: string
|
||||
@@ -740,8 +772,8 @@
|
||||
[key: string]: any
|
||||
} = {
|
||||
status: undefined,
|
||||
carrier_id: undefined,
|
||||
iccid: '',
|
||||
carrier_name: '',
|
||||
msisdn: '',
|
||||
virtual_no: '',
|
||||
device_virtual_no: '',
|
||||
@@ -863,20 +895,6 @@
|
||||
{ label: '已停用', value: 4 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '运营商',
|
||||
prop: 'carrier_id',
|
||||
type: 'select',
|
||||
config: {
|
||||
clearable: true,
|
||||
placeholder: '全部'
|
||||
},
|
||||
options: () => [
|
||||
{ label: '中国移动', value: 1 },
|
||||
{ label: '中国联通', value: 2 },
|
||||
{ label: '中国电信', value: 3 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'ICCID',
|
||||
prop: 'iccid',
|
||||
@@ -886,6 +904,24 @@
|
||||
placeholder: '请输入ICCID'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '运营商名称',
|
||||
prop: 'carrier_name',
|
||||
type: 'select',
|
||||
config: {
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
remoteMethod: handleSearchCarrier,
|
||||
loading: carrierLoading.value,
|
||||
placeholder: '请选择或搜索运营商名称'
|
||||
},
|
||||
options: () =>
|
||||
searchCarrierOptions.value.map((c) => ({
|
||||
label: c.carrier_name,
|
||||
value: c.carrier_name
|
||||
}))
|
||||
},
|
||||
{
|
||||
label: '卡接入号',
|
||||
prop: 'msisdn',
|
||||
@@ -1180,20 +1216,22 @@
|
||||
const getActions = (row: StandaloneIotCard) => {
|
||||
const actions: any[] = []
|
||||
|
||||
if (hasAuth('iot_card:start_card')) {
|
||||
actions.push({
|
||||
label: '启用此卡',
|
||||
handler: () => handleCardOperation('start-card', row.iccid),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('iot_card:stop_card')) {
|
||||
actions.push({
|
||||
label: '停用此卡',
|
||||
handler: () => handleCardOperation('stop-card', row.iccid),
|
||||
type: 'primary'
|
||||
})
|
||||
if (row.network_status === 1) {
|
||||
if (hasAuth('iot_card:stop_card')) {
|
||||
actions.push({
|
||||
label: '停用此卡',
|
||||
handler: () => handleCardOperation('stop-card', row.iccid),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (hasAuth('iot_card:start_card')) {
|
||||
actions.push({
|
||||
label: '启用此卡',
|
||||
handler: () => handleCardOperation('start-card', row.iccid),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAuth('iot_card:realname_policy')) {
|
||||
@@ -1216,6 +1254,7 @@
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadSearchCarrierOptions()
|
||||
getTableData()
|
||||
})
|
||||
|
||||
@@ -1228,7 +1267,6 @@
|
||||
page_size: pagination.pageSize,
|
||||
...formFilters
|
||||
}
|
||||
// 清理空值
|
||||
Object.keys(params).forEach((key) => {
|
||||
if (params[key] === '' || params[key] === undefined) {
|
||||
delete params[key]
|
||||
|
||||
Reference in New Issue
Block a user