@@ -265,6 +264,7 @@
@change="handleCardBatchSelectionTypeChange"
>
ICCID列表
+ 一行一个ICCID
号段范围
筛选条件
@@ -277,6 +277,19 @@
已选择 {{ selectedCards.length }} 张卡
+
+
+
+
>({
+ const recallForm = reactive<
+ Omit, '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({
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,
@@ -2594,23 +2631,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()
}
@@ -2626,6 +2659,7 @@
if (recallFormRef.value) {
recallFormRef.value.resetFields()
}
+ recallForm.iccids_text = ''
}
// 执行批量分配
@@ -2692,11 +2726,16 @@
if (valid) {
// 根据选卡方式构建请求参数
const params: Partial = {
- 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('请先选择要回收的卡')