|
|
@@ -2,8 +2,8 @@
|
|
|
<PagingTable url="/rcs-number" :where="where" ref="table">
|
|
|
<template #filter>
|
|
|
<ElButton :icon="Search" @click="table.refresh()"></ElButton>
|
|
|
- <ElSelect v-model="channel" placeholder="渠道" clearable @change="updateWhereAndRefresh">
|
|
|
- <ElOption v-for="channel in channels" :key="channel.id" :label="channel.country" :value="channel.country" />
|
|
|
+ <ElSelect v-model="channel" placeholder="渠道" clearable value-key="id">
|
|
|
+ <ElOption v-for="channel in channels" :key="channel.id" :label="channel.country" :value="channel" />
|
|
|
</ElSelect>
|
|
|
<ElButton :icon="Plus" @click="getNumber()">取号</ElButton>
|
|
|
</template>
|
|
|
@@ -28,7 +28,7 @@
|
|
|
</PagingTable>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { onMounted, ref } from 'vue'
|
|
|
+import { computed, onMounted, ref } from 'vue'
|
|
|
import PagingTable from '@/components/PagingTable.vue'
|
|
|
import { useTimeFormatter } from '@/utils/formatter'
|
|
|
import { Plus, Search } from '@vicons/tabler'
|
|
|
@@ -40,7 +40,7 @@ import { http } from '@/plugins/http'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import { useClipboard } from '@vueuse/core'
|
|
|
|
|
|
-const where = ref({})
|
|
|
+const where = computed(() => ({ country: channel.value?.country }))
|
|
|
const timeFormatter = useTimeFormatter()
|
|
|
const table = ref(null)
|
|
|
const model = ref({})
|
|
|
@@ -58,7 +58,7 @@ async function getNumber() {
|
|
|
await ElMessageBox.confirm('确定取号吗?')
|
|
|
try {
|
|
|
await http.put('/rcs-number', {
|
|
|
- channel: channel.value
|
|
|
+ channelId: channel.value?.id
|
|
|
})
|
|
|
ElMessage.success('取号成功')
|
|
|
table.value.refresh()
|
|
|
@@ -68,13 +68,6 @@ async function getNumber() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function updateWhereAndRefresh() {
|
|
|
- where.value = {}
|
|
|
- if (channel.value) {
|
|
|
- where.value.country = channel.value
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
onMounted(() => {
|
|
|
http.post('/channel').then((res) => {
|
|
|
channels.value = res.items
|