|
|
@@ -2,7 +2,7 @@
|
|
|
<PagingTable url="/task" :where="where" ref="table">
|
|
|
<template #filter>
|
|
|
<ElButton :icon="Refresh" @click="table.refresh()"></ElButton>
|
|
|
- <ElButton :icon="Plus" @click="onEdit(), getPhoneList()"> 添加 </ElButton>
|
|
|
+ <ElButton :icon="Plus" @click="onEdit(), getPhoneList()"> 添加</ElButton>
|
|
|
</template>
|
|
|
<ElTableColumn prop="id" label="#" width="80" />
|
|
|
<ElTableColumn prop="name" label="名称" min-width="120" />
|
|
|
@@ -62,6 +62,12 @@
|
|
|
<ElOption v-for="item in phoneList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</ElSelect>
|
|
|
</ElFormItem>
|
|
|
+ <ElFormItem prop="listId" label="渠道列表">
|
|
|
+ <ElSelect v-model="model.channelId" placeholder="请选择渠道列表">
|
|
|
+ <ElOption v-for="item in operatorList" :key="item.id"
|
|
|
+ :label="item.mcc+'-'+item.mnc+'-'+item.country+'-'+item.operator" :value="item.id" />
|
|
|
+ </ElSelect>
|
|
|
+ </ElFormItem>
|
|
|
<ElFormItem prop="message" label="内容">
|
|
|
<ElInput v-model="model.message" placeholder="请输入内容" type="textarea" />
|
|
|
</ElFormItem>
|
|
|
@@ -130,6 +136,7 @@ const model = ref({})
|
|
|
const rules = {
|
|
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
|
listId: [{ required: true, message: '请选择发送列表', trigger: 'blur' }],
|
|
|
+ channelId: [{ required: true, message: '请选择渠道列表', trigger: 'blur' }],
|
|
|
message: [{ required: true, message: '请输入内容', trigger: 'blur' }],
|
|
|
rcsWait: [{ required: true, message: '请输入RCS等待时间', trigger: 'blur' }],
|
|
|
rcsInterval: [{ required: true, message: '请输入RCS发送间隔', trigger: 'blur' }],
|
|
|
@@ -137,19 +144,32 @@ const rules = {
|
|
|
requestNumberInterval: [{ required: true, message: '请输入请求号码间隔', trigger: 'blur' }]
|
|
|
}
|
|
|
const { showEditDialog, onEdit } = setupEditDialog(model)
|
|
|
+
|
|
|
async function submit() {
|
|
|
model.value.userId = user.id
|
|
|
await http.put('/task', model.value)
|
|
|
ElMessage.success('保存成功')
|
|
|
}
|
|
|
+
|
|
|
const phoneList = ref([])
|
|
|
+
|
|
|
async function getPhoneList() {
|
|
|
phoneList.value = (await http.post('/phone-list')).items
|
|
|
}
|
|
|
+
|
|
|
getPhoneList()
|
|
|
+const operatorList = ref([])
|
|
|
+
|
|
|
+async function getOperatorList() {
|
|
|
+ operatorList.value = (await http.post('/channel')).items
|
|
|
+}
|
|
|
+
|
|
|
+getOperatorList()
|
|
|
+
|
|
|
function phoneListFormatter(row, column, cellValue, index) {
|
|
|
return phoneList.value.find((item) => item.id === cellValue)?.name
|
|
|
}
|
|
|
+
|
|
|
function del(row) {
|
|
|
ElMessageBox.confirm('确定删除吗?', '提示', {
|
|
|
type: 'warning'
|
|
|
@@ -164,6 +184,7 @@ function del(row) {
|
|
|
const selectedRow = ref(null)
|
|
|
const showDetailDialog = ref(false)
|
|
|
const phoneTable = ref(null)
|
|
|
+
|
|
|
function detail(row) {
|
|
|
selectedRow.value = row
|
|
|
showDetailDialog.value = true
|
|
|
@@ -174,6 +195,7 @@ const phoneRules = {
|
|
|
number: [{ required: true, message: '请输入号码', trigger: 'blur' }]
|
|
|
}
|
|
|
const { showEditDialog: showPhoneEditDialog, onEdit: onPhoneEdit } = setupEditDialog(phoneModel)
|
|
|
+
|
|
|
function taskStatusFormatter(row, column, cellValue, index) {
|
|
|
switch (cellValue) {
|
|
|
case 'idle':
|
|
|
@@ -188,6 +210,7 @@ function taskStatusFormatter(row, column, cellValue, index) {
|
|
|
return '未知'
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
function taskItemStatusFormatter(row, column, cellValue, index) {
|
|
|
switch (cellValue) {
|
|
|
case 'idle':
|
|
|
@@ -202,6 +225,7 @@ function taskItemStatusFormatter(row, column, cellValue, index) {
|
|
|
return '未知'
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
async function start(row) {
|
|
|
await ElMessageBox.confirm('确定开始发送吗?', '提示', {
|
|
|
type: 'warning'
|
|
|
@@ -209,6 +233,7 @@ async function start(row) {
|
|
|
await http.post(`/task/${row.id}/start`)
|
|
|
table.value.refresh()
|
|
|
}
|
|
|
+
|
|
|
async function pause(row) {
|
|
|
await ElMessageBox.confirm('确定暂停发送吗?', '提示', {
|
|
|
type: 'warning'
|