fix: 取消关联,居左,店铺列表
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m53s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m53s
This commit is contained in:
@@ -94,24 +94,15 @@
|
||||
label-width="120px"
|
||||
>
|
||||
<ElFormItem label="店铺" prop="to_shop_id">
|
||||
<ElSelect
|
||||
<ElCascader
|
||||
v-model="allocateForm.to_shop_id"
|
||||
placeholder="请选择或搜索目标店铺"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:remote-method="searchTargetShops"
|
||||
:loading="targetShopLoading"
|
||||
:options="shopCascadeOptions"
|
||||
:props="shopCascadeProps"
|
||||
placeholder="请选择目标店铺"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="shop in targetShopList"
|
||||
:key="shop.id"
|
||||
:label="shop.shop_name"
|
||||
:value="shop.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="选卡方式" prop="selection_type">
|
||||
<ElRadioGroup v-model="allocateForm.selection_type">
|
||||
@@ -342,7 +333,6 @@
|
||||
:loading="seriesLoading"
|
||||
clearable
|
||||
>
|
||||
<ElOption label="清除关联" :value="0" />
|
||||
<ElOption
|
||||
v-for="series in packageSeriesList"
|
||||
:key="series.id"
|
||||
@@ -650,8 +640,35 @@
|
||||
const moreMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
|
||||
|
||||
// 店铺相关
|
||||
const targetShopLoading = ref(false)
|
||||
const targetShopList = ref<any[]>([])
|
||||
const shopCascadeOptions = ref<any[]>([])
|
||||
const shopCascadeProps = {
|
||||
lazy: true,
|
||||
checkStrictly: true,
|
||||
lazyLoad: async (node: any, resolve: any) => {
|
||||
const { level, value } = node
|
||||
const parentId = level === 0 ? undefined : value
|
||||
|
||||
try {
|
||||
const res = await ShopService.getShopsCascade({ parent_id: parentId })
|
||||
if (res.code === 0) {
|
||||
const nodes = (res.data || []).map((item: any) => ({
|
||||
value: item.id,
|
||||
label: item.shop_name,
|
||||
leaf: !item.has_children
|
||||
}))
|
||||
resolve(nodes)
|
||||
} else {
|
||||
resolve([])
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载店铺级联数据失败:', error)
|
||||
resolve([])
|
||||
}
|
||||
},
|
||||
value: 'value',
|
||||
label: 'label',
|
||||
children: 'children'
|
||||
}
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState: {
|
||||
@@ -1213,33 +1230,6 @@
|
||||
selectedCards.value = selection
|
||||
}
|
||||
|
||||
// 加载目标店铺列表
|
||||
const loadTargetShops = async (shopName?: string) => {
|
||||
targetShopLoading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
}
|
||||
if (shopName) {
|
||||
params.shop_name = shopName
|
||||
}
|
||||
const res = await ShopService.getShops(params)
|
||||
if (res.code === 0) {
|
||||
targetShopList.value = res.data.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取目标店铺列表失败:', error)
|
||||
} finally {
|
||||
targetShopLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索目标店铺
|
||||
const searchTargetShops = async (query: string) => {
|
||||
await loadTargetShops(query || undefined)
|
||||
}
|
||||
|
||||
// 显示批量分配对话框
|
||||
const showAllocateDialog = () => {
|
||||
if (selectedCards.value.length === 0) {
|
||||
@@ -1258,8 +1248,6 @@
|
||||
batch_no: '',
|
||||
remark: ''
|
||||
})
|
||||
// 加载默认店铺列表
|
||||
loadTargetShops()
|
||||
if (allocateFormRef.value) {
|
||||
allocateFormRef.value.resetFields()
|
||||
}
|
||||
@@ -1536,6 +1524,13 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('iot_card:clear_series')) {
|
||||
items.push({
|
||||
key: 'clearSeries',
|
||||
label: '清除关联'
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
@@ -1565,9 +1560,52 @@
|
||||
case 'changePackage':
|
||||
changePackage()
|
||||
break
|
||||
case 'clearSeries':
|
||||
handleClearCardSeries()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 清除卡套餐系列绑定
|
||||
const handleClearCardSeries = async () => {
|
||||
if (selectedCards.value.length === 0) {
|
||||
ElMessage.warning('请先选择要清除关联的卡')
|
||||
return
|
||||
}
|
||||
|
||||
ElMessageBox.confirm(
|
||||
`确定要清除所选 ${selectedCards.value.length} 张卡的套餐系列关联吗?`,
|
||||
'确认清除',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
try {
|
||||
const res = await CardService.batchSetCardSeriesBinding({
|
||||
iccids: selectedCards.value.map((card) => card.iccid),
|
||||
series_id: 0
|
||||
})
|
||||
if (res.code === 0) {
|
||||
if (res.data.fail_count === 0) {
|
||||
ElMessage.success('清除关联成功')
|
||||
} else {
|
||||
ElMessage.warning(`部分失败:${res.data.failed_items?.[0]?.reason || '未知原因'}`)
|
||||
}
|
||||
selectedCards.value = []
|
||||
await getTableData()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('清除关联失败:', error)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户取消
|
||||
})
|
||||
}
|
||||
|
||||
// 网卡分销 - 正在开发中
|
||||
const cardDistribution = () => {
|
||||
ElMessage.info('功能正在开发中')
|
||||
|
||||
Reference in New Issue
Block a user