Compare commits
2
Commits
52ce2258c3
...
012131c7c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
012131c7c5 | ||
|
|
683c799838 |
@@ -26,3 +26,12 @@ export function disableDeviceDispatch(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新设备工作状态
|
||||
export function updateDeviceWorkStatus(data) {
|
||||
return request({
|
||||
url: '/af/device/work/status',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -14,11 +14,3 @@ export function saveDispatchPolicy(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function triggerDispatch(data) {
|
||||
return request({
|
||||
url: '/af/dispatch/trigger',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
+12
-12
@@ -26,15 +26,6 @@ export function manualDispatchOrder(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 自动分发订单
|
||||
export function autoDispatchOrder(data) {
|
||||
return request({
|
||||
url: '/af/order/dispatch/auto',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 取消订单
|
||||
export function cancelOrder(data) {
|
||||
return request({
|
||||
@@ -44,10 +35,19 @@ export function cancelOrder(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 重试订单
|
||||
export function retryOrder(data) {
|
||||
// 手动标记订单完成
|
||||
export function completeOrder(data) {
|
||||
return request({
|
||||
url: '/af/order/retry',
|
||||
url: '/af/order/complete',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 手动重置订单状态
|
||||
export function resetOrder(data) {
|
||||
return request({
|
||||
url: '/af/order/reset',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
||||
@@ -34,7 +34,8 @@ function getBreadcrumb() {
|
||||
}
|
||||
// 判断是否为首页
|
||||
if (!isDashboard(matched[0])) {
|
||||
matched = [{ path: "/index", meta: { title: "首页" } }].concat(matched)
|
||||
// 默认首页已切换到订单页,面包屑首页入口同步指向订单列表。
|
||||
matched = [{ path: "/af/order", meta: { title: "首页" } }].concat(matched)
|
||||
}
|
||||
levelList.value = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
|
||||
}
|
||||
|
||||
@@ -116,7 +116,8 @@ function logout() {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index'
|
||||
// 注销后统一走订单首页入口,和系统默认落地页保持一致。
|
||||
location.href = '/af/order'
|
||||
})
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
@@ -156,7 +156,8 @@ function isAffix(tag) {
|
||||
function isFirstView() {
|
||||
try {
|
||||
const tag = selectedTag.value && selectedTag.value.fullPath ? selectedTag.value : selectedDropdownTag.value
|
||||
return tag.fullPath === '/index' || tag.fullPath === visitedViews.value[1].fullPath
|
||||
// 订单页已经替代默认首页,首个标签页按首页处理。
|
||||
return tag.fullPath === '/af/order' || tag.fullPath === visitedViews.value[1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
|
||||
+3
-11
@@ -58,17 +58,9 @@ export const constantRoutes = [
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: Layout,
|
||||
redirect: '/index',
|
||||
children: [
|
||||
{
|
||||
path: '/index',
|
||||
component: () => import('@/views/index'),
|
||||
name: 'Index',
|
||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
||||
}
|
||||
]
|
||||
path: '/',
|
||||
redirect: '/af/order',
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/lock',
|
||||
|
||||
@@ -4,12 +4,12 @@ const LOCK_PATH_KEY = 'screen-lock-path'
|
||||
export const useLockStore = defineStore('lock', {
|
||||
state: () => ({
|
||||
isLock: JSON.parse(localStorage.getItem(LOCK_KEY) || 'false'),
|
||||
lockPath: localStorage.getItem(LOCK_PATH_KEY) || '/index'
|
||||
lockPath: localStorage.getItem(LOCK_PATH_KEY) || '/af/order'
|
||||
}),
|
||||
actions: {
|
||||
// 锁定屏幕,同时记录当前路径
|
||||
lockScreen(currentPath) {
|
||||
this.lockPath = currentPath || '/index'
|
||||
this.lockPath = currentPath || '/af/order'
|
||||
localStorage.setItem(LOCK_PATH_KEY, this.lockPath)
|
||||
this.isLock = true
|
||||
localStorage.setItem(LOCK_KEY, 'true')
|
||||
@@ -18,8 +18,8 @@ export const useLockStore = defineStore('lock', {
|
||||
unlockScreen() {
|
||||
this.isLock = false
|
||||
localStorage.setItem(LOCK_KEY, 'false')
|
||||
this.lockPath = '/index'
|
||||
localStorage.setItem(LOCK_PATH_KEY, '/index')
|
||||
this.lockPath = '/af/order'
|
||||
localStorage.setItem(LOCK_PATH_KEY, '/af/order')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -88,7 +88,8 @@ service.interceptors.response.use(res => {
|
||||
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
isRelogin.show = false
|
||||
useUserStore().logOut().then(() => {
|
||||
location.href = '/index'
|
||||
// 会话失效后统一回到订单首页入口,避免再进入默认首页。
|
||||
location.href = '/af/order'
|
||||
})
|
||||
}).catch(() => {
|
||||
isRelogin.show = false
|
||||
|
||||
@@ -109,6 +109,20 @@
|
||||
<el-table-column label="维护原因" align="center" prop="maintainReason" min-width="180" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="VideoPlay"
|
||||
@click="handleUpdateWorkStatus(scope.row, 'READY')"
|
||||
v-hasPermi="['af:device:edit']"
|
||||
>开始接单</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="VideoPause"
|
||||
@click="handleUpdateWorkStatus(scope.row, 'NOT_READY')"
|
||||
v-hasPermi="['af:device:edit']"
|
||||
>暂停接单</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@@ -138,7 +152,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="AfDevice">
|
||||
import { listDevice, enableDeviceDispatch, disableDeviceDispatch } from '@/api/af/device'
|
||||
import { listDevice, enableDeviceDispatch, disableDeviceDispatch, updateDeviceWorkStatus } from '@/api/af/device'
|
||||
import { onlineStatusOptions, deviceTaskStatusOptions, dispatchEnabledOptions, workStatusOptions } from '@/views/af/constants'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -154,7 +168,7 @@ const data = reactive({
|
||||
pageSize: 10,
|
||||
userName: undefined,
|
||||
deviceCode: undefined,
|
||||
onlineStatus: undefined,
|
||||
onlineStatus: 'ONLINE',
|
||||
taskStatus: undefined,
|
||||
dispatchEnabled: undefined,
|
||||
workStatus: undefined
|
||||
@@ -213,5 +227,20 @@ function handleDisableDispatch(row) {
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 调整设备工作状态 */
|
||||
function handleUpdateWorkStatus(row, workStatus) {
|
||||
const actionText = workStatus === 'READY' ? '开始接单' : '暂停接单'
|
||||
proxy.$modal.confirm(`是否确认将该设备设置为${actionText}状态?`).then(() => {
|
||||
return updateDeviceWorkStatus({
|
||||
userName: row.userName,
|
||||
deviceCode: row.deviceCode,
|
||||
workStatus
|
||||
})
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('操作成功')
|
||||
getList()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -36,33 +36,16 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm" v-hasPermi="['af:order:dispatch']">保存配置</el-button>
|
||||
<el-button type="warning" @click="handleTrigger" v-hasPermi="['af:order:dispatch']">手动触发一轮补派</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-alert
|
||||
v-if="lastTrigger.msg"
|
||||
:title="lastTrigger.msg"
|
||||
type="success"
|
||||
show-icon
|
||||
:closable="false"
|
||||
class="mt16"
|
||||
>
|
||||
<template #default>
|
||||
<div>触发类型:{{ lastTrigger.triggerType || '-' }}</div>
|
||||
<div>成功分发:{{ lastTrigger.dispatchedCount || 0 }}</div>
|
||||
<div>跳过数量:{{ lastTrigger.skippedCount || 0 }}</div>
|
||||
</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AfDispatchPolicy">
|
||||
import { getDispatchPolicy, saveDispatchPolicy, triggerDispatch } from '@/api/af/dispatchPolicy'
|
||||
import { getDispatchPolicy, saveDispatchPolicy } from '@/api/af/dispatchPolicy'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const policyRef = ref()
|
||||
const lastTrigger = ref({})
|
||||
const policyMeta = reactive({
|
||||
updateBy: '',
|
||||
updateTime: ''
|
||||
@@ -113,17 +96,5 @@ function submitForm() {
|
||||
})
|
||||
}
|
||||
|
||||
function handleTrigger() {
|
||||
proxy.$modal.confirm('是否确认手动触发一轮补派?').then(() => {
|
||||
return triggerDispatch({
|
||||
limit: form.maxScanCount,
|
||||
triggerType: 'MANUAL'
|
||||
})
|
||||
}).then(response => {
|
||||
lastTrigger.value = response
|
||||
proxy.$modal.msgSuccess(`本轮成功分发 ${response.dispatchedCount || 0} 单`)
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
loadPolicy()
|
||||
</script>
|
||||
|
||||
@@ -84,15 +84,6 @@
|
||||
v-hasPermi="['af:order:dispatch']"
|
||||
>手动分发</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="RefreshRight"
|
||||
@click="handleAutoDispatch()"
|
||||
v-hasPermi="['af:order:dispatch']"
|
||||
>手动触发补派</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
@@ -116,11 +107,21 @@
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="CircleCheck"
|
||||
:disabled="single"
|
||||
@click="handleCompleteOrder()"
|
||||
v-hasPermi="['af:order:complete']"
|
||||
>标记完成</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Refresh"
|
||||
:disabled="single"
|
||||
@click="handleRetryOrder()"
|
||||
v-hasPermi="['af:order:retry']"
|
||||
>重试订单</el-button>
|
||||
@click="handleResetOrder()"
|
||||
v-hasPermi="['af:order:reset']"
|
||||
>重置状态</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
@@ -149,13 +150,14 @@
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="360">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="View" @click="handleViewDetail(scope.row)" v-hasPermi="['af:order:query']">查看详情</el-button>
|
||||
<el-button link type="primary" icon="Position" @click="handleManualDispatch(scope.row)" v-hasPermi="['af:order:dispatch']">手动分发</el-button>
|
||||
<el-button link type="primary" icon="Document" @click="handleViewLogs(scope.row)" v-hasPermi="['af:task:logs']">查看日志</el-button>
|
||||
<el-button link type="primary" icon="CircleClose" @click="handleCancelOrder(scope.row)" v-hasPermi="['af:order:cancel']">取消</el-button>
|
||||
<el-button link type="primary" icon="Refresh" @click="handleRetryOrder(scope.row)" v-hasPermi="['af:order:retry']">重试</el-button>
|
||||
<el-button link type="primary" icon="CircleCheck" @click="handleCompleteOrder(scope.row)" v-hasPermi="['af:order:complete']">完成</el-button>
|
||||
<el-button link type="primary" icon="Refresh" @click="handleResetOrder(scope.row)" v-hasPermi="['af:order:reset']">重置</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -236,7 +238,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="AfOrder">
|
||||
import { listOrder, getOrder, manualDispatchOrder, autoDispatchOrder, cancelOrder, retryOrder } from '@/api/af/order'
|
||||
import { listOrder, getOrder, manualDispatchOrder, cancelOrder, completeOrder, resetOrder } from '@/api/af/order'
|
||||
import { getDispatchPolicy } from '@/api/af/dispatchPolicy'
|
||||
import { listDevice } from '@/api/af/device'
|
||||
import { listTaskLogs } from '@/api/af/task'
|
||||
@@ -419,16 +421,6 @@ function handleOpenPolicy() {
|
||||
proxy.$router.push('/af/dispatchPolicy')
|
||||
}
|
||||
|
||||
function handleAutoDispatch() {
|
||||
proxy.$modal.confirm('是否确认手动触发一轮补派?').then(() => {
|
||||
return autoDispatchOrder({ triggerType: 'MANUAL' })
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('补派已触发')
|
||||
loadPolicySummary()
|
||||
getList()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 取消订单 */
|
||||
function handleCancelOrder(row) {
|
||||
const currentRow = resolveRow(row)
|
||||
@@ -445,18 +437,34 @@ function handleCancelOrder(row) {
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 重试订单 */
|
||||
function handleRetryOrder(row) {
|
||||
/** 手动标记订单完成 */
|
||||
function handleCompleteOrder(row) {
|
||||
const currentRow = resolveRow(row)
|
||||
if (!currentRow) {
|
||||
proxy.$modal.msgWarning('请选择订单')
|
||||
return
|
||||
}
|
||||
const orderId = currentRow.id || currentRow.orderId
|
||||
proxy.$modal.confirm('是否确认重试该订单?').then(() => {
|
||||
return retryOrder({ orderId })
|
||||
proxy.$modal.confirm('是否确认手动标记该订单为完成?').then(() => {
|
||||
return completeOrder({ orderId })
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('重试已触发')
|
||||
proxy.$modal.msgSuccess('订单已标记完成')
|
||||
getList()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 手动重置订单状态 */
|
||||
function handleResetOrder(row) {
|
||||
const currentRow = resolveRow(row)
|
||||
if (!currentRow) {
|
||||
proxy.$modal.msgWarning('请选择订单')
|
||||
return
|
||||
}
|
||||
const orderId = currentRow.id || currentRow.orderId
|
||||
proxy.$modal.confirm('是否确认将该订单重置为待分发状态?').then(() => {
|
||||
return resetOrder({ orderId })
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('订单状态已重置')
|
||||
getList()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div class="bullshit__info">
|
||||
对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
|
||||
</div>
|
||||
<router-link to="/index" class="bullshit__return-home">
|
||||
<router-link to="/af/order" class="bullshit__return-home">
|
||||
返回首页
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user