fix: 回调配置, 调整信用位置, 套餐
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m55s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m55s
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<ElFormItem label="固定档位" prop="code">
|
||||
<ElSelect
|
||||
v-model="form.code"
|
||||
placeholder="请选择限速档位"
|
||||
style="width: 100%"
|
||||
:teleported="true"
|
||||
append-to="body"
|
||||
@@ -50,9 +51,11 @@
|
||||
confirmLoading?: boolean
|
||||
}
|
||||
|
||||
type SpeedTierCode = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', value: boolean): void
|
||||
(e: 'confirm', data: { code: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 }): void
|
||||
(e: 'confirm', data: { code: SpeedTierCode }): void
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -74,7 +77,7 @@
|
||||
{ code: 8, label: '100Mbps' }
|
||||
] as const
|
||||
|
||||
const form = reactive({ code: 3 as (typeof speedTiers)[number]['code'] })
|
||||
const form = reactive<{ code: SpeedTierCode | undefined }>({ code: undefined })
|
||||
|
||||
const rules: FormRules = {
|
||||
code: [{ required: true, message: '请选择限速档位', trigger: 'change' }]
|
||||
@@ -97,7 +100,7 @@
|
||||
(newVal) => {
|
||||
setLayoutScrollLock(newVal)
|
||||
if (newVal) {
|
||||
form.code = 3
|
||||
form.code = undefined
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -117,6 +120,7 @@
|
||||
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (form.code === undefined) return
|
||||
emit('confirm', {
|
||||
code: form.code
|
||||
})
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
>
|
||||
批量回收
|
||||
</ElButton>
|
||||
<ElButton
|
||||
type="info"
|
||||
:disabled="!selectedDevices.length"
|
||||
@click="handleBatchSetSeries"
|
||||
v-permission="'device:batch_set_series'"
|
||||
>
|
||||
批量设置套餐系列
|
||||
</ElButton>
|
||||
<ElButton
|
||||
type="primary"
|
||||
:disabled="!selectedDevices.length"
|
||||
@@ -2656,6 +2664,18 @@
|
||||
await loadPackageSeriesList(query || undefined)
|
||||
}
|
||||
|
||||
// 显示批量设置套餐系列对话框
|
||||
const handleBatchSetSeries = async () => {
|
||||
seriesBindingResult.value = null
|
||||
Object.assign(seriesBindingForm, createInitialSeriesBindingState(), {
|
||||
selection_type:
|
||||
selectedDevices.value.length > 0 ? DeviceSelectionType.LIST : DeviceSelectionType.FILTER
|
||||
})
|
||||
await Promise.all([loadPackageSeriesList(), loadSearchBatchNoOptions()])
|
||||
seriesBindingDialogVisible.value = true
|
||||
seriesBindingFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const buildSeriesBindingRequest = (): BatchSetDeviceSeriesBindingRequest | null => {
|
||||
const request: BatchSetDeviceSeriesBindingRequest = {
|
||||
selection_type: seriesBindingForm.selection_type,
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@change="handleOldIdentifierChange"
|
||||
@focus="handleOldIotCardsFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="card in oldIotCardOptions"
|
||||
@@ -151,6 +152,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="oldIotCardEmptyMessage" class="exchange-field-error">
|
||||
{{ oldIotCardEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem
|
||||
v-if="createForm.old_asset_type === 'device'"
|
||||
@@ -169,6 +173,7 @@
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@change="handleOldIdentifierChange"
|
||||
@focus="handleOldDevicesFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="device in oldDeviceOptions"
|
||||
@@ -184,6 +189,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="oldDeviceEmptyMessage" class="exchange-field-error">
|
||||
{{ oldDeviceEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="createOldAssetShopDisplay" label="旧资产所属店铺">
|
||||
<ElInput :model-value="createOldAssetShopDisplay" readonly disabled />
|
||||
@@ -204,6 +212,7 @@
|
||||
no-data-text="暂无同店铺可用的新资产"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@focus="handleCreateNewIotCardsFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="card in newIotCardOptions"
|
||||
@@ -219,6 +228,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="createNewIotCardEmptyMessage" class="exchange-field-error">
|
||||
{{ createNewIotCardEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem
|
||||
v-if="createForm.flow_type === 'direct' && createForm.old_asset_type === 'device'"
|
||||
@@ -236,6 +248,7 @@
|
||||
no-data-text="暂无同店铺可用的新资产"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@focus="handleCreateNewDevicesFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="device in newDeviceOptions"
|
||||
@@ -251,6 +264,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="createNewDeviceEmptyMessage" class="exchange-field-error">
|
||||
{{ createNewDeviceEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="createDirectInheritedShopHint" label="归属提示">
|
||||
<div class="exchange-shop-hint">{{ createDirectInheritedShopHint }}</div>
|
||||
@@ -308,6 +324,8 @@
|
||||
no-data-text="暂无可用的新资产"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@change="handleShipNewIdentifierChange"
|
||||
@focus="handleShipNewIotCardsFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="card in newIotCardOptions"
|
||||
@@ -323,6 +341,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="shipNewIotCardEmptyMessage" class="exchange-field-error">
|
||||
{{ shipNewIotCardEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem
|
||||
v-else-if="shipAssetType === 'device'"
|
||||
@@ -340,6 +361,8 @@
|
||||
no-data-text="暂无可用的新资产"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
@change="handleShipNewIdentifierChange"
|
||||
@focus="handleShipNewDevicesFocus"
|
||||
>
|
||||
<ElOption
|
||||
v-for="device in newDeviceOptions"
|
||||
@@ -355,6 +378,9 @@
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div v-if="shipNewDeviceEmptyMessage" class="exchange-field-error">
|
||||
{{ shipNewDeviceEmptyMessage }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="shipInheritedShopDisplayText" label="归属提示">
|
||||
<div class="exchange-shop-hint">{{ shipInheritedShopDisplayText }}</div>
|
||||
@@ -534,6 +560,42 @@
|
||||
const newDeviceSearchLoading = ref(false)
|
||||
const completeLoadingId = ref<number | null>(null)
|
||||
|
||||
type AssetFilterOption = {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
const oldAssetFilterOptions = ref<AssetFilterOption[]>([])
|
||||
const newAssetFilterOptions = ref<AssetFilterOption[]>([])
|
||||
const oldAssetFilterLoading = ref(false)
|
||||
const newAssetFilterLoading = ref(false)
|
||||
|
||||
const oldIotCardEmptyMessage = computed(() =>
|
||||
oldCardSearchLoading.value || oldIotCardOptions.value.length > 0 ? '' : '暂无可用的旧资产'
|
||||
)
|
||||
|
||||
const oldDeviceEmptyMessage = computed(() =>
|
||||
oldDeviceSearchLoading.value || oldDeviceOptions.value.length > 0 ? '' : '暂无可用的旧资产'
|
||||
)
|
||||
|
||||
const createNewIotCardEmptyMessage = computed(() => {
|
||||
if (newCardSearchLoading.value || newIotCardOptions.value.length > 0) return ''
|
||||
return createForm.old_identifier ? '暂无同店铺可用的新资产' : '请先选择旧资产'
|
||||
})
|
||||
|
||||
const createNewDeviceEmptyMessage = computed(() => {
|
||||
if (newDeviceSearchLoading.value || newDeviceOptions.value.length > 0) return ''
|
||||
return createForm.old_identifier ? '暂无同店铺可用的新资产' : '请先选择旧资产'
|
||||
})
|
||||
|
||||
const shipNewIotCardEmptyMessage = computed(() =>
|
||||
newCardSearchLoading.value || newIotCardOptions.value.length > 0 ? '' : '暂无可用的新资产'
|
||||
)
|
||||
|
||||
const shipNewDeviceEmptyMessage = computed(() =>
|
||||
newDeviceSearchLoading.value || newDeviceOptions.value.length > 0 ? '' : '暂无可用的新资产'
|
||||
)
|
||||
|
||||
// 发货表单
|
||||
const shipForm = reactive({
|
||||
new_identifier: '',
|
||||
@@ -543,11 +605,90 @@
|
||||
})
|
||||
|
||||
const shipRules = reactive<FormRules>({
|
||||
new_identifier: [{ required: true, message: '请输入新资产标识符', trigger: 'blur' }],
|
||||
new_identifier: [{ required: true, message: '请选择新资产标识符', trigger: 'change' }],
|
||||
express_company: [{ required: true, message: '请输入快递公司', trigger: 'blur' }],
|
||||
express_no: [{ required: true, message: '请输入快递单号', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const handleShipNewIdentifierChange = () => {
|
||||
shipFormRef.value?.clearValidate('new_identifier')
|
||||
}
|
||||
|
||||
const handleShipNewIotCardsFocus = async () => {
|
||||
if (newCardSearchLoading.value || newIotCardOptions.value.length > 0) return
|
||||
await loadDefaultShipNewIotCards()
|
||||
}
|
||||
|
||||
const handleShipNewDevicesFocus = async () => {
|
||||
if (newDeviceSearchLoading.value || newDeviceOptions.value.length > 0) return
|
||||
await loadDefaultShipNewDevices()
|
||||
}
|
||||
|
||||
const handleOldIotCardsFocus = async () => {
|
||||
if (oldCardSearchLoading.value || oldIotCardOptions.value.length > 0) return
|
||||
await loadDefaultIotCards()
|
||||
}
|
||||
|
||||
const handleOldDevicesFocus = async () => {
|
||||
if (oldDeviceSearchLoading.value || oldDeviceOptions.value.length > 0) return
|
||||
await loadDefaultDevices()
|
||||
}
|
||||
|
||||
const handleCreateNewIotCardsFocus = async () => {
|
||||
if (newCardSearchLoading.value || newIotCardOptions.value.length > 0) return
|
||||
await loadDefaultNewIotCards()
|
||||
}
|
||||
|
||||
const handleCreateNewDevicesFocus = async () => {
|
||||
if (newDeviceSearchLoading.value || newDeviceOptions.value.length > 0) return
|
||||
await loadDefaultNewDevices()
|
||||
}
|
||||
|
||||
const searchFilterAssets = async (query: string, target: 'old' | 'new') => {
|
||||
const options = target === 'old' ? oldAssetFilterOptions : newAssetFilterOptions
|
||||
const loading = target === 'old' ? oldAssetFilterLoading : newAssetFilterLoading
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const keyword = query.trim() || undefined
|
||||
const [cardRes, deviceRes] = await Promise.all([
|
||||
CardService.getStandaloneIotCards({
|
||||
is_standalone: true,
|
||||
keyword,
|
||||
page: 1,
|
||||
page_size: 10
|
||||
}),
|
||||
DeviceService.getDevices({
|
||||
keyword,
|
||||
page: 1,
|
||||
page_size: 10
|
||||
})
|
||||
])
|
||||
|
||||
const cardOptions: AssetFilterOption[] =
|
||||
cardRes.code === 0
|
||||
? (cardRes.data?.items || []).map((card) => ({
|
||||
label: `${card.iccid} (IoT卡)`,
|
||||
value: card.iccid
|
||||
}))
|
||||
: []
|
||||
const deviceOptions: AssetFilterOption[] =
|
||||
deviceRes.code === 0
|
||||
? (deviceRes.data?.items || []).map((device) => ({
|
||||
label: `${device.virtual_no} (设备)`,
|
||||
value: device.virtual_no
|
||||
}))
|
||||
: []
|
||||
|
||||
options.value = [...cardOptions, ...deviceOptions]
|
||||
} catch (error) {
|
||||
console.error('加载资产筛选选项失败:', error)
|
||||
options.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
type ShopSelectableOption = {
|
||||
shop_id?: number | null
|
||||
shop_name?: string | null
|
||||
@@ -644,7 +785,7 @@
|
||||
})
|
||||
|
||||
// 搜索表单配置
|
||||
const searchFormItems: SearchFormItem[] = [
|
||||
const searchFormItems = computed<SearchFormItem[]>(() => [
|
||||
{
|
||||
label: '换货状态',
|
||||
prop: 'status',
|
||||
@@ -677,19 +818,31 @@
|
||||
{
|
||||
label: '旧资产',
|
||||
prop: 'old_asset_keyword',
|
||||
type: 'input',
|
||||
type: 'select',
|
||||
options: () => oldAssetFilterOptions.value,
|
||||
config: {
|
||||
placeholder: '请输入旧资产标识',
|
||||
clearable: true
|
||||
placeholder: '请选择或搜索旧资产标识',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
reserveKeyword: true,
|
||||
loading: oldAssetFilterLoading.value,
|
||||
remoteMethod: (query: string) => searchFilterAssets(query, 'old')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '新资产',
|
||||
prop: 'new_asset_keyword',
|
||||
type: 'input',
|
||||
type: 'select',
|
||||
options: () => newAssetFilterOptions.value,
|
||||
config: {
|
||||
placeholder: '请输入新资产标识',
|
||||
clearable: true
|
||||
placeholder: '请选择或搜索新资产标识',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
reserveKeyword: true,
|
||||
loading: newAssetFilterLoading.value,
|
||||
remoteMethod: (query: string) => searchFilterAssets(query, 'new')
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -704,7 +857,7 @@
|
||||
valueFormat: 'YYYY-MM-DD'
|
||||
}
|
||||
}
|
||||
]
|
||||
])
|
||||
|
||||
// 动态列配置
|
||||
const { columnChecks, columns } = useCheckedColumns(() => [
|
||||
@@ -1037,9 +1190,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
oldIotCardOptions.value = res.data.items || []
|
||||
if (oldIotCardOptions.value.length === 0) {
|
||||
ElMessage.info('暂无可用的IoT卡')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载IoT卡列表失败:', error)
|
||||
@@ -1059,9 +1209,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
oldDeviceOptions.value = res.data.items || []
|
||||
if (oldDeviceOptions.value.length === 0) {
|
||||
ElMessage.info('暂无可用的设备')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载设备列表失败:', error)
|
||||
@@ -1089,9 +1236,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
oldIotCardOptions.value = res.data.items || []
|
||||
if (oldIotCardOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的IoT卡')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索IoT卡失败:', error)
|
||||
@@ -1118,9 +1262,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
oldDeviceOptions.value = res.data.items || []
|
||||
if (oldDeviceOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的设备')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索设备失败:', error)
|
||||
@@ -1141,7 +1282,6 @@
|
||||
const shopId = getCreateOldAssetShopId()
|
||||
if (shopId === undefined) {
|
||||
newIotCardOptions.value = []
|
||||
ElMessage.warning('请先选择旧资产')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1155,9 +1295,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newIotCardOptions.value = res.data.items || []
|
||||
if (newIotCardOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的IoT卡')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索IoT卡失败:', error)
|
||||
@@ -1184,9 +1321,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newIotCardOptions.value = res.data.items || []
|
||||
if (newIotCardOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的IoT卡')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索IoT卡失败:', error)
|
||||
@@ -1213,9 +1347,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newIotCardOptions.value = res.data.items || []
|
||||
if (newIotCardOptions.value.length === 0) {
|
||||
ElMessage.info('暂无同店铺可用的新资产')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载IoT卡列表失败:', error)
|
||||
@@ -1234,8 +1365,8 @@
|
||||
page: 1,
|
||||
page_size: 10
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newIotCardOptions.value = res.data.items || []
|
||||
if (res.code === 0) {
|
||||
newIotCardOptions.value = res.data?.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载IoT卡列表失败:', error)
|
||||
@@ -1256,7 +1387,6 @@
|
||||
const shopId = getCreateOldAssetShopId()
|
||||
if (shopId === undefined) {
|
||||
newDeviceOptions.value = []
|
||||
ElMessage.warning('请先选择旧资产')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1269,9 +1399,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newDeviceOptions.value = res.data.items || []
|
||||
if (newDeviceOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的设备')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索设备失败:', error)
|
||||
@@ -1297,9 +1424,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newDeviceOptions.value = res.data.items || []
|
||||
if (newDeviceOptions.value.length === 0) {
|
||||
ElMessage.info('未找到匹配的设备')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索设备失败:', error)
|
||||
@@ -1325,9 +1449,6 @@
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newDeviceOptions.value = res.data.items || []
|
||||
if (newDeviceOptions.value.length === 0) {
|
||||
ElMessage.info('暂无同店铺可用的新资产')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载设备列表失败:', error)
|
||||
@@ -1345,8 +1466,8 @@
|
||||
page: 1,
|
||||
page_size: 10
|
||||
})
|
||||
if (res.code === 0 && res.data) {
|
||||
newDeviceOptions.value = res.data.items || []
|
||||
if (res.code === 0) {
|
||||
newDeviceOptions.value = res.data?.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载设备列表失败:', error)
|
||||
@@ -1641,6 +1762,8 @@
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
loadExchangeList()
|
||||
searchFilterAssets('', 'old')
|
||||
searchFilterAssets('', 'new')
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1657,5 +1780,13 @@
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.exchange-field-error {
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
color: var(--el-color-danger);
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
<template>
|
||||
<div class="authorization-record-detail">
|
||||
<ElCard shadow="never">
|
||||
<!-- 页面头部 -->
|
||||
<div class="detail-header">
|
||||
<ElButton @click="handleBack">
|
||||
<template #icon>
|
||||
<ElIcon><ArrowLeft /></ElIcon>
|
||||
</template>
|
||||
返回
|
||||
</ElButton>
|
||||
<h2 class="detail-title">授权记录详情</h2>
|
||||
</div>
|
||||
|
||||
<!-- 详情内容 -->
|
||||
<DetailPage v-if="detailData" :sections="detailSections" :data="detailData" />
|
||||
|
||||
<!-- 加载中 -->
|
||||
<div v-if="loading" class="loading-container">
|
||||
<ElIcon class="is-loading"><Loading /></ElIcon>
|
||||
<span>加载中...</span>
|
||||
</div>
|
||||
</ElCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElCard, ElButton, ElIcon, ElMessage } from 'element-plus'
|
||||
import { ArrowLeft, Loading } from '@element-plus/icons-vue'
|
||||
import DetailPage from '@/components/common/DetailPage.vue'
|
||||
import type { DetailSection } from '@/components/common/DetailPage.vue'
|
||||
import { AuthorizationService } from '@/api/modules'
|
||||
import type { AuthorizationItem } from '@/types/api/authorization'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
|
||||
defineOptions({ name: 'AuthorizationRecordDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
const detailData = ref<AuthorizationItem | null>(null)
|
||||
|
||||
// 详情页配置
|
||||
const detailSections: DetailSection[] = [
|
||||
{
|
||||
title: '基本信息',
|
||||
fields: [
|
||||
{ label: '企业ID', prop: 'enterprise_id' },
|
||||
{ label: '企业名称', prop: 'enterprise_name' },
|
||||
{ label: '卡ID', prop: 'card_id' },
|
||||
{ label: 'ICCID', prop: 'iccid' },
|
||||
{ label: '手机号', prop: 'msisdn', formatter: (value) => value || '-' },
|
||||
{ label: '授权人ID', prop: 'authorized_by' },
|
||||
{ label: '授权人', prop: 'authorizer_name' },
|
||||
{
|
||||
label: '授权人类型',
|
||||
formatter: (_, data) => {
|
||||
return data.authorizer_type === 2 ? '平台' : '代理'
|
||||
}
|
||||
},
|
||||
{ label: '授权时间', prop: 'authorized_at', formatter: (value) => formatDateTime(value) },
|
||||
{
|
||||
label: '状态',
|
||||
formatter: (_, data) => {
|
||||
return data.status === 1 ? '有效' : '已回收'
|
||||
}
|
||||
},
|
||||
{ label: '备注', prop: 'remark', formatter: (value) => value || '-' }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// 返回上一页
|
||||
const handleBack = () => {
|
||||
router.back()
|
||||
}
|
||||
|
||||
// 获取详情数据
|
||||
const fetchDetail = async () => {
|
||||
const id = Number(route.params.id)
|
||||
if (!id) {
|
||||
ElMessage.error('缺少ID参数')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await AuthorizationService.getAuthorizationDetail(id)
|
||||
if (res.code === 0) {
|
||||
detailData.value = res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.log('获取授权记录详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchDetail()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.authorization-record-detail {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
padding-bottom: 16px;
|
||||
|
||||
.detail-title {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60px 20px;
|
||||
color: var(--el-text-color-secondary);
|
||||
|
||||
.el-icon {
|
||||
font-size: 32px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -28,29 +28,16 @@
|
||||
:pageSize="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:row-class-name="getRowClassName"
|
||||
:actions="getActions"
|
||||
:actionsWidth="100"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@row-contextmenu="handleRowContextMenu"
|
||||
@cell-mouse-enter="handleCellMouseEnter"
|
||||
@cell-mouse-leave="handleCellMouseLeave"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn v-for="col in columns" :key="col.prop || col.type" v-bind="col" />
|
||||
</template>
|
||||
</ArtTable>
|
||||
|
||||
<!-- 鼠标悬浮提示 -->
|
||||
<TableContextMenuHint :visible="showContextMenuHint" :position="hintPosition" />
|
||||
|
||||
<!-- 右键菜单 -->
|
||||
<ArtMenuRight
|
||||
ref="contextMenuRef"
|
||||
:menu-items="contextMenuItems"
|
||||
:menu-width="120"
|
||||
@select="handleContextMenuSelect"
|
||||
/>
|
||||
|
||||
<!-- 修改备注对话框 -->
|
||||
<ElDialog v-model="remarkDialogVisible" title="修改备注" width="500px">
|
||||
<ElForm ref="remarkFormRef" :model="remarkForm" :rules="remarkRules" label-width="80px">
|
||||
@@ -81,40 +68,22 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { h } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { AuthorizationService, EnterpriseService } from '@/api/modules'
|
||||
import { ElMessage, ElTag } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useTableContextMenu } from '@/composables/useTableContextMenu'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
|
||||
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
|
||||
import TableContextMenuHint from '@/components/core/others/TableContextMenuHint.vue'
|
||||
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
|
||||
import type {
|
||||
AuthorizationItem,
|
||||
AuthorizationStatus,
|
||||
AuthorizerType
|
||||
} from '@/types/api/authorization'
|
||||
import { CommonStatus } from '@/config/constants'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
|
||||
defineOptions({ name: 'AuthorizationRecords' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
// 使用表格右键菜单功能
|
||||
const {
|
||||
showContextMenuHint,
|
||||
hintPosition,
|
||||
getRowClassName,
|
||||
handleCellMouseEnter,
|
||||
handleCellMouseLeave
|
||||
} = useTableContextMenu()
|
||||
|
||||
const loading = ref(false)
|
||||
const remarkDialogVisible = ref(false)
|
||||
@@ -122,8 +91,6 @@
|
||||
const tableRef = ref()
|
||||
const remarkFormRef = ref<FormInstance>()
|
||||
const currentRecordId = ref<number>(0)
|
||||
const contextMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
|
||||
const currentRow = ref<AuthorizationItem | null>(null)
|
||||
|
||||
// 企业搜索选项
|
||||
const enterpriseOptions = ref<any[]>([])
|
||||
@@ -252,7 +219,8 @@
|
||||
{ label: '授权人类型', prop: 'authorizer_type' },
|
||||
{ label: '授权时间', prop: 'authorized_at' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
{ label: '备注', prop: 'remark' }
|
||||
{ label: '备注', prop: 'remark' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
]
|
||||
|
||||
const authorizationList = ref<AuthorizationItem[]>([])
|
||||
@@ -284,17 +252,7 @@
|
||||
label: 'ICCID',
|
||||
width: 200,
|
||||
formatter: (row: AuthorizationItem) => {
|
||||
return h(
|
||||
'span',
|
||||
{
|
||||
style: 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;',
|
||||
onClick: (e: MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
handleNameClick(row)
|
||||
}
|
||||
},
|
||||
row.iccid
|
||||
)
|
||||
return row.iccid || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -346,6 +304,21 @@
|
||||
}
|
||||
])
|
||||
|
||||
// 操作列配置,样式与店铺列表保持一致
|
||||
const getActions = (row: AuthorizationItem) => {
|
||||
const actions: any[] = []
|
||||
|
||||
if (hasAuth('authorization_records:update_remark')) {
|
||||
actions.push({
|
||||
label: '编辑',
|
||||
handler: () => showRemarkDialog(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
searchEnterprises('')
|
||||
@@ -417,22 +390,6 @@
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const viewDetail = (row: AuthorizationItem) => {
|
||||
router.push({
|
||||
path: `${RoutesAlias.AuthorizationRecords}/detail/${row.id}`
|
||||
})
|
||||
}
|
||||
|
||||
// 处理名称点击
|
||||
const handleNameClick = (row: AuthorizationItem) => {
|
||||
if (hasAuth('authorization_records:view_detail')) {
|
||||
viewDetail(row)
|
||||
} else {
|
||||
ElMessage.warning('您没有查看详情的权限')
|
||||
}
|
||||
}
|
||||
|
||||
// 显示修改备注对话框
|
||||
const showRemarkDialog = (row: AuthorizationItem) => {
|
||||
currentRecordId.value = row.id
|
||||
@@ -462,44 +419,10 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 右键菜单项配置
|
||||
const contextMenuItems = computed((): MenuItemType[] => {
|
||||
const items: MenuItemType[] = []
|
||||
|
||||
if (hasAuth('authorization_records:update_remark')) {
|
||||
items.push({ key: 'edit', label: '编辑' })
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
// 处理表格行右键菜单
|
||||
const handleRowContextMenu = (row: AuthorizationItem, column: any, event: MouseEvent) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
currentRow.value = row
|
||||
contextMenuRef.value?.show(event)
|
||||
}
|
||||
|
||||
// 处理右键菜单选择
|
||||
const handleContextMenuSelect = (item: MenuItemType) => {
|
||||
if (!currentRow.value) return
|
||||
|
||||
switch (item.key) {
|
||||
case 'edit':
|
||||
showRemarkDialog(currentRow.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.authorization-records-page {
|
||||
// Authorization records page styles
|
||||
}
|
||||
|
||||
:deep(.el-table__row.table-row-with-context-menu) {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
v-model="createDrawerVisible"
|
||||
title="批量订购套餐"
|
||||
direction="rtl"
|
||||
size="520px"
|
||||
size="40%"
|
||||
:close-on-click-modal="!createDrawerBusy"
|
||||
:close-on-press-escape="!createDrawerBusy"
|
||||
@closed="handleCreateDrawerClosed"
|
||||
>
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="90px" class="create-form">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="100px" class="create-form">
|
||||
<ElFormItem label="套餐系列" prop="series_id">
|
||||
<ElSelect
|
||||
v-model="form.series_id"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
v-model="createDrawerVisible"
|
||||
title="设备批量任务"
|
||||
direction="rtl"
|
||||
size="520px"
|
||||
size="40%"
|
||||
:close-on-click-modal="!createDrawerBusy"
|
||||
:close-on-press-escape="!createDrawerBusy"
|
||||
@closed="handleCreateDrawerClosed"
|
||||
>
|
||||
<ElForm ref="formRef" :model="form" label-width="110px" class="create-form">
|
||||
<ElForm ref="formRef" :model="form" label-width="80px" class="create-form">
|
||||
<ElFormItem label="操作类型" prop="operation_type">
|
||||
<ElSelect
|
||||
v-model="form.operation_type"
|
||||
|
||||
Reference in New Issue
Block a user