This commit is contained in:
9
src/types/components.d.ts
vendored
9
src/types/components.d.ts
vendored
@@ -95,11 +95,8 @@ declare module 'vue' {
|
||||
ElAlert: typeof import('element-plus/es')['ElAlert']
|
||||
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCalendar: typeof import('element-plus/es')['ElCalendar']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCascader: typeof import('element-plus/es')['ElCascader']
|
||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
||||
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||
@@ -125,21 +122,15 @@ declare module 'vue' {
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||
ElPopover: typeof import('element-plus/es')['ElPopover']
|
||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
|
||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||
ElResult: typeof import('element-plus/es')['ElResult']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
|
||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||
ElTag: typeof import('element-plus/es')['ElTag']
|
||||
ElTimeline: typeof import('element-plus/es')['ElTimeline']
|
||||
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
</ElButton>
|
||||
<ElButton
|
||||
type="warning"
|
||||
:disabled="selectedCards.length === 0"
|
||||
@click="showRecallDialog"
|
||||
v-permission="'iot_card:batch_recycle'"
|
||||
>
|
||||
@@ -254,6 +253,7 @@
|
||||
@change="handleCardBatchSelectionTypeChange"
|
||||
>
|
||||
<ElRadio label="list">ICCID列表</ElRadio>
|
||||
<ElRadio label="lines">一行一个ICCID</ElRadio>
|
||||
<ElRadio label="range">号段范围</ElRadio>
|
||||
<ElRadio label="filter">筛选条件</ElRadio>
|
||||
</ElRadioGroup>
|
||||
@@ -266,6 +266,19 @@
|
||||
<div>已选择 {{ selectedCards.length }} 张卡</div>
|
||||
</ElFormItem>
|
||||
|
||||
<ElFormItem
|
||||
v-if="recallForm.selection_type === 'lines'"
|
||||
label="ICCID"
|
||||
prop="iccids_text"
|
||||
>
|
||||
<ElInput
|
||||
v-model="recallForm.iccids_text"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
placeholder="请输入ICCID,一行一个"
|
||||
/>
|
||||
</ElFormItem>
|
||||
|
||||
<ElFormItem
|
||||
v-if="recallForm.selection_type === CardSelectionType.RANGE"
|
||||
label="起始ICCID"
|
||||
@@ -1654,19 +1667,43 @@
|
||||
})
|
||||
|
||||
// 批量回收表单
|
||||
const recallForm = reactive<Partial<RecallStandaloneCardsRequest>>({
|
||||
const recallForm = reactive<
|
||||
Omit<Partial<RecallStandaloneCardsRequest>, 'selection_type'> & {
|
||||
selection_type: CardSelectionType | 'lines'
|
||||
iccids_text: string
|
||||
}
|
||||
>({
|
||||
selection_type: CardSelectionType.LIST,
|
||||
iccids: [],
|
||||
iccids_text: '',
|
||||
iccid_start: '',
|
||||
iccid_end: '',
|
||||
carrier_id: undefined,
|
||||
batch_no: '',
|
||||
remark: ''
|
||||
})
|
||||
const recallInputIccids = computed(() =>
|
||||
recallForm.iccids_text
|
||||
.split(/\r?\n/)
|
||||
.map((iccid) => iccid.trim())
|
||||
.filter(Boolean)
|
||||
)
|
||||
|
||||
// 批量回收表单验证规则
|
||||
const recallRules = reactive<FormRules>({
|
||||
selection_type: [{ required: true, message: '请选择选卡方式', trigger: 'change' }],
|
||||
iccids_text: [
|
||||
{
|
||||
validator: (_rule, _value, callback) => {
|
||||
if (recallForm.selection_type === 'lines' && recallInputIccids.value.length === 0) {
|
||||
callback(new Error('请输入ICCID,一行一个'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
iccid_start: [
|
||||
{
|
||||
required: true,
|
||||
@@ -2068,7 +2105,7 @@
|
||||
prop: 'iccid',
|
||||
label: 'ICCID',
|
||||
minWidth: 200,
|
||||
fixed:true,
|
||||
fixed: true,
|
||||
formatter: (row: StandaloneIotCard) => {
|
||||
return h(
|
||||
'span',
|
||||
@@ -2523,23 +2560,19 @@
|
||||
|
||||
// 显示批量回收对话框
|
||||
const showRecallDialog = () => {
|
||||
if (selectedCards.value.length === 0) {
|
||||
ElMessage.warning('请先选择要回收的卡')
|
||||
return
|
||||
}
|
||||
recallDialogVisible.value = true
|
||||
recallFormRef.value?.resetFields()
|
||||
Object.assign(recallForm, {
|
||||
selection_type: CardSelectionType.LIST,
|
||||
selection_type: selectedCards.value.length > 0 ? CardSelectionType.LIST : 'lines',
|
||||
iccids: selectedCards.value.map((card) => card.iccid),
|
||||
iccids_text: '',
|
||||
iccid_start: '',
|
||||
iccid_end: '',
|
||||
carrier_id: undefined,
|
||||
batch_no: '',
|
||||
remark: ''
|
||||
})
|
||||
if (recallFormRef.value) {
|
||||
recallFormRef.value.resetFields()
|
||||
}
|
||||
recallFormRef.value?.clearValidate()
|
||||
recallDialogVisible.value = true
|
||||
loadAllocateCarrierOptions()
|
||||
}
|
||||
|
||||
@@ -2555,6 +2588,7 @@
|
||||
if (recallFormRef.value) {
|
||||
recallFormRef.value.resetFields()
|
||||
}
|
||||
recallForm.iccids_text = ''
|
||||
}
|
||||
|
||||
// 执行批量分配
|
||||
@@ -2621,11 +2655,16 @@
|
||||
if (valid) {
|
||||
// 根据选卡方式构建请求参数
|
||||
const params: Partial<RecallStandaloneCardsRequest> = {
|
||||
selection_type: recallForm.selection_type!,
|
||||
selection_type:
|
||||
recallForm.selection_type === 'lines'
|
||||
? CardSelectionType.LIST
|
||||
: recallForm.selection_type,
|
||||
remark: recallForm.remark
|
||||
}
|
||||
|
||||
if (recallForm.selection_type === CardSelectionType.LIST) {
|
||||
if (recallForm.selection_type === 'lines') {
|
||||
params.iccids = recallInputIccids.value
|
||||
} else if (recallForm.selection_type === CardSelectionType.LIST) {
|
||||
params.iccids = selectedCards.value.map((card) => card.iccid)
|
||||
if (params.iccids.length === 0) {
|
||||
ElMessage.warning('请先选择要回收的卡')
|
||||
@@ -2718,10 +2757,7 @@
|
||||
|
||||
const showEnterpriseCardRecallDialog = async () => {
|
||||
resetEnterpriseCardRecallForm()
|
||||
await Promise.all([
|
||||
handleSearchEnterprise(),
|
||||
loadAllocateCarrierOptions()
|
||||
])
|
||||
await Promise.all([handleSearchEnterprise(), loadAllocateCarrierOptions()])
|
||||
enterpriseCardRecallDialogVisible.value = true
|
||||
enterpriseCardRecallFormRef.value?.clearValidate()
|
||||
}
|
||||
@@ -2841,10 +2877,7 @@
|
||||
selection_type:
|
||||
selectedCards.value.length > 0 ? CardSelectionType.LIST : CardSelectionType.FILTER
|
||||
})
|
||||
await Promise.all([
|
||||
loadPackageSeriesList(),
|
||||
loadAllocateCarrierOptions()
|
||||
])
|
||||
await Promise.all([loadPackageSeriesList(), loadAllocateCarrierOptions()])
|
||||
seriesBindingDialogVisible.value = true
|
||||
seriesBindingFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user