merge: 合入 iteration/august(生产线)到 iteration/8-11
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
</ElButton>
|
||||
<ElButton
|
||||
type="warning"
|
||||
:disabled="selectedCards.length === 0"
|
||||
@click="showRecallDialog"
|
||||
v-permission="'iot_card:batch_recycle'"
|
||||
>
|
||||
@@ -265,6 +264,7 @@
|
||||
@change="handleCardBatchSelectionTypeChange"
|
||||
>
|
||||
<ElRadio label="list">ICCID列表</ElRadio>
|
||||
<ElRadio label="lines">一行一个ICCID</ElRadio>
|
||||
<ElRadio label="range">号段范围</ElRadio>
|
||||
<ElRadio label="filter">筛选条件</ElRadio>
|
||||
</ElRadioGroup>
|
||||
@@ -277,6 +277,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"
|
||||
@@ -1693,19 +1706,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,
|
||||
@@ -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<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('请先选择要回收的卡')
|
||||
|
||||
Reference in New Issue
Block a user