|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<PagingTable url="/rcs/task" :where="where" ref="table">
|
|
|
<template #filter>
|
|
|
+ <ElButton :icon="Refresh" @click="table.refresh()"></ElButton>
|
|
|
<ElButton :icon="Plus" @click="onEdit(), getPhoneList()">添加</ElButton>
|
|
|
</template>
|
|
|
<ElTableColumn prop="id" label="#" width="80" />
|
|
|
@@ -8,13 +9,21 @@
|
|
|
<ElTableColumn prop="remark" label="备注" show-overflow-tooltip />
|
|
|
<ElTableColumn prop="message" label="内容" show-overflow-tooltip />
|
|
|
<ElTableColumn prop="listId" label="发送列表" :formatter="phoneListFormatter" />
|
|
|
- <ElTableColumn prop="status" label="状态" :formatter="statusFormatter" />
|
|
|
+ <ElTableColumn prop="status" label="状态" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <ElTag v-if="row.status === 'idle'" type="info">未发送</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'pending'" type="warning">发送中</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'completed'" type="success">已完成</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'error'" type="danger">错误</ElTag>
|
|
|
+ <ElTag v-else>未知</ElTag>
|
|
|
+ </template>
|
|
|
+ </ElTableColumn>
|
|
|
<ElTableColumn prop="createdAt" label="创建时间" :formatter="timeFormatter" width="150" />
|
|
|
<ElTableColumn label="操作" align="center" width="200">
|
|
|
<template #default="{ row }">
|
|
|
<ElButton type="primary" size="small" @click="detail(row)">详情</ElButton>
|
|
|
- <ElButton type="primary" size="small" @click="start(row)" v-if="row.status==='idle'">开始</ElButton>
|
|
|
- <ElButton type="danger" size="small" @click="del(row)" v-if="row.status==='idle'">删除</ElButton>
|
|
|
+ <ElButton type="primary" size="small" @click="start(row)" v-if="row.status === 'idle'">开始</ElButton>
|
|
|
+ <ElButton type="danger" size="small" @click="del(row)" v-if="row.status === 'idle'">删除</ElButton>
|
|
|
</template>
|
|
|
</ElTableColumn>
|
|
|
</PagingTable>
|
|
|
@@ -39,7 +48,14 @@
|
|
|
<PagingTable url="/rcs/task-item" :where="{ taskId: (selectedRow || {}).id }" ref="phoneTable" height="50vh">
|
|
|
<ElTableColumn prop="id" label="#" width="80" />
|
|
|
<ElTableColumn prop="number" label="号码" min-width="120" />
|
|
|
- <ElTableColumn prop="status" label="状态" :formatter="statusFormatter" />
|
|
|
+ <ElTableColumn prop="status" label="状态" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <ElTag v-if="row.status === 'success'" type="success">成功</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'fail'" type="danger">失败</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'pending'" type="warning">发送中</ElTag>
|
|
|
+ <ElTag v-else-if="row.status === 'idle'" type="info">待发送</ElTag>
|
|
|
+ </template>
|
|
|
+ </ElTableColumn>
|
|
|
</PagingTable>
|
|
|
</ElDialog>
|
|
|
|
|
|
@@ -59,7 +75,7 @@
|
|
|
import { ref } from 'vue'
|
|
|
import PagingTable from '@/components/PagingTable.vue'
|
|
|
import { useTimeFormatter } from '@/utils/formatter'
|
|
|
-import { Plus } from '@vicons/tabler'
|
|
|
+import { Plus, Refresh } from '@vicons/tabler'
|
|
|
import EditDialog from '@/components/EditDialog.vue'
|
|
|
import { setupEditDialog } from '@/utils/editDialog'
|
|
|
import EnumSelect from '@/components/EnumSelect.vue'
|
|
|
@@ -114,7 +130,7 @@ const phoneRules = {
|
|
|
number: [{ required: true, message: '请输入号码', trigger: 'blur' }]
|
|
|
}
|
|
|
const { showEditDialog: showPhoneEditDialog, onEdit: onPhoneEdit } = setupEditDialog(phoneModel)
|
|
|
-function statusFormatter(row, column, cellValue, index) {
|
|
|
+function taskStatusFormatter(row, column, cellValue, index) {
|
|
|
switch (cellValue) {
|
|
|
case 'idle':
|
|
|
return '未发送'
|
|
|
@@ -128,6 +144,20 @@ function statusFormatter(row, column, cellValue, index) {
|
|
|
return '未知'
|
|
|
}
|
|
|
}
|
|
|
+function taskItemStatusFormatter(row, column, cellValue, index) {
|
|
|
+ switch (cellValue) {
|
|
|
+ case 'idle':
|
|
|
+ return '未发送'
|
|
|
+ case 'pending':
|
|
|
+ return '发送中'
|
|
|
+ case 'success':
|
|
|
+ return '成功'
|
|
|
+ case 'fail':
|
|
|
+ return '失败'
|
|
|
+ default:
|
|
|
+ return '未知'
|
|
|
+ }
|
|
|
+}
|
|
|
async function start(row) {
|
|
|
await ElMessageBox.confirm('确定开始发送吗?', '提示', {
|
|
|
type: 'warning'
|