feat:多项功能优化
This commit is contained in:
@@ -1,18 +1,37 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<!-- 预警中心:不设「规则设置」Tab。预警全部由系统内置触发源自动产生,人工无需配置规则。 -->
|
||||
<el-form inline>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="statusFilter">
|
||||
<el-radio-button label="all">全部</el-radio-button>
|
||||
<el-radio-button label="UNREAD">未读</el-radio-button>
|
||||
<el-radio-button label="READ">已读</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="预警类型">
|
||||
<el-select v-model="typeFilter" clearable style="width:150px" placeholder="全部">
|
||||
<el-option v-for="t in types" :key="t.value" :label="t.label" :value="t.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间">
|
||||
<el-date-picker v-model="startDate" type="date" value-format="YYYY-MM-DD" placeholder="开始时间" style="width:150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间">
|
||||
<el-date-picker v-model="endDate" type="date" value-format="YYYY-MM-DD" placeholder="结束时间" style="width:150px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search">查询</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin-bottom:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<el-radio-group v-model="statusFilter" @change="loadAlerts">
|
||||
<el-radio-button label="all">全部</el-radio-button>
|
||||
<el-radio-button label="UNREAD">未读</el-radio-button>
|
||||
<el-radio-button label="READ">已读</el-radio-button>
|
||||
</el-radio-group>
|
||||
<span style="color:#888">未读:{{ unread }}</span>
|
||||
<span style="color:#aaa;font-size:12px">
|
||||
系统内置触发源自动产生预警(扭紧不合格 / 检验不合格 / 备料未齐套 / 库存偏低 / 工单超时 / 缓存位满 / 数量不符 / 应急呼叫),无需人工配置
|
||||
</span>
|
||||
</div>
|
||||
<el-table :data="alerts" border size="small">
|
||||
<el-table :data="alerts" border size="small" v-loading="loading">
|
||||
<el-table-column label="状态" width="90">
|
||||
<template #default="{row}"><el-tag :type="row.status==='UNREAD' ? 'danger' : 'info'">{{ row.status==='UNREAD' ? '未读' : '已读' }}</el-tag></template>
|
||||
</el-table-column>
|
||||
@@ -22,13 +41,18 @@
|
||||
<el-table-column prop="title" label="标题" min-width="140" />
|
||||
<el-table-column prop="content" label="内容" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="refId" label="关联ID" width="120" />
|
||||
<el-table-column prop="createdAt" label="时间" min-width="170" />
|
||||
<el-table-column prop="createdAt" label="时间" min-width="170">
|
||||
<template #default="{row}">{{ fmtTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" fixed="right">
|
||||
<template #default="{row}">
|
||||
<el-button size="small" :disabled="row.status==='READ'" @click="markRead(row)">标记已读</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="margin-top:12px;justify-content:flex-end" background layout="total, prev, pager, next, sizes"
|
||||
:total="total" v-model:current-page="page" v-model:page-size="pageSize"
|
||||
:page-sizes="[20, 50, 100]" @current-change="loadAlerts" @size-change="search" />
|
||||
</el-card>
|
||||
<PageHelp :data="helpAlertCenter" page="AlertCenter" />
|
||||
</template>
|
||||
@@ -39,8 +63,28 @@ import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpAlertCenter } from '../help'
|
||||
|
||||
const alerts = ref([])
|
||||
const total = ref(0)
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const loading = ref(false)
|
||||
const unread = ref(0)
|
||||
const statusFilter = ref('all')
|
||||
const typeFilter = ref('')
|
||||
const startDate = ref(todayStr()) // 开始时间默认当天
|
||||
const endDate = ref('') // 结束时间默认空
|
||||
|
||||
function todayStr() {
|
||||
const d = new Date()
|
||||
const p = (n) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`
|
||||
}
|
||||
function fmtTime(v) {
|
||||
if (!v) return '-'
|
||||
const d = new Date(v)
|
||||
if (Number.isNaN(d.getTime())) return String(v)
|
||||
const p = (n) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
|
||||
}
|
||||
|
||||
// 内置触发源类型(仅用于展示文案,不在前端配置)
|
||||
const types = [
|
||||
@@ -59,10 +103,37 @@ function typeLabel(v) {
|
||||
}
|
||||
|
||||
async function loadAlerts() {
|
||||
const status = statusFilter.value === 'all' ? '' : statusFilter.value
|
||||
alerts.value = (await request.get('/alerts', { params: { status } })) || []
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {
|
||||
status: statusFilter.value === 'all' ? '' : statusFilter.value,
|
||||
type: typeFilter.value,
|
||||
from: startDate.value,
|
||||
to: endDate.value,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value
|
||||
}
|
||||
const data = await request.get('/alerts', { params })
|
||||
alerts.value = data?.list || []
|
||||
total.value = data?.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
// 未读数不带时间/类型筛选,始终反映全局未读,与右上角铃铛一致
|
||||
unread.value = (await request.get('/alerts', { params: { status: 'UNREAD' } }))?.length || 0
|
||||
}
|
||||
function search() {
|
||||
page.value = 1
|
||||
loadAlerts()
|
||||
}
|
||||
function reset() {
|
||||
statusFilter.value = 'all'
|
||||
typeFilter.value = ''
|
||||
startDate.value = todayStr()
|
||||
endDate.value = ''
|
||||
page.value = 1
|
||||
loadAlerts()
|
||||
}
|
||||
async function markRead(row) {
|
||||
await request.post('/alert/read', { id: row.id })
|
||||
loadAlerts()
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<!-- 附件中心:仅作集中查阅(只读)。新增/删除在各业务页面内完成(如检验页、工序步骤行)。
|
||||
本页展示文件路径,点击路径可直接下载查看。 -->
|
||||
<el-alert type="info" :closable="false" show-icon style="margin-bottom:12px"
|
||||
title="附件中心为只读查阅页:新增/删除附件请在各自业务页面(如质量检验、工序步骤)内操作" />
|
||||
<el-form inline style="margin-bottom:12px">
|
||||
<el-form-item label="业务类型">
|
||||
<el-select v-model="form.bizType" style="width:160px">
|
||||
<el-select v-model="form.bizType" clearable style="width:160px" placeholder="全部">
|
||||
<el-option label="工单" value="work_order" />
|
||||
<el-option label="物料" value="material" />
|
||||
<el-option label="工艺流程" value="process_flow" />
|
||||
<el-option label="检验" value="inspection" />
|
||||
<el-option label="质量" value="quality" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务ID">
|
||||
<el-input v-model="form.bizId" placeholder="如 工单号 / 图号" style="width:220px" />
|
||||
<el-input v-model="form.bizId" placeholder="如 工单号 / 图号" style="width:220px" @keyup.enter="load" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-upload action="#" :show-file-list="false" :http-request="doUpload">
|
||||
<el-button type="primary">选择文件上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item><el-button @click="load">查询</el-button></el-form-item>
|
||||
<el-form-item><el-button type="primary" @click="load">查询</el-button></el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="list" border size="small">
|
||||
<el-table-column prop="fileName" label="文件名" min-width="180" />
|
||||
<el-table-column label="文件路径" min-width="260">
|
||||
<template #default="{row}">
|
||||
<el-link type="primary" :underline="false" @click="download(row)">{{ row.filePath || '-' }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="fileSize" label="大小" width="110">
|
||||
<template #default="{row}">{{ fmtSize(row.fileSize) }}</template>
|
||||
</el-table-column>
|
||||
@@ -28,22 +33,16 @@
|
||||
<el-table-column prop="bizId" label="业务ID" width="140" />
|
||||
<el-table-column prop="uploader" label="上传人" width="100" />
|
||||
<el-table-column prop="createdAt" label="上传时间" min-width="170" />
|
||||
<el-table-column label="操作" width="160" fixed="right">
|
||||
<template #default="{row}">
|
||||
<el-button size="small" type="primary" @click="download(row)">下载</el-button>
|
||||
<el-button size="small" type="danger" @click="remove(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import request from '../utils/request'
|
||||
import { getToken } from '../utils/auth'
|
||||
|
||||
const form = reactive({ bizType: 'work_order', bizId: '' })
|
||||
const form = reactive({ bizType: '', bizId: '' })
|
||||
const list = ref([])
|
||||
|
||||
async function load() {
|
||||
@@ -55,25 +54,8 @@ function fmtSize(n) {
|
||||
if (n < 1024 * 1024) return (n / 1024).toFixed(1) + ' KB'
|
||||
return (n / 1024 / 1024).toFixed(1) + ' MB'
|
||||
}
|
||||
async function doUpload(option) {
|
||||
if (!form.bizId) {
|
||||
ElMessage.warning('请先填写业务ID再上传')
|
||||
return
|
||||
}
|
||||
const fd = new FormData()
|
||||
fd.append('file', option.file)
|
||||
fd.append('bizType', form.bizType)
|
||||
fd.append('bizId', form.bizId)
|
||||
try {
|
||||
await request.post('/attachment/upload', fd)
|
||||
ElMessage.success('上传成功')
|
||||
if (option.onSuccess) option.onSuccess()
|
||||
load()
|
||||
} catch (e) {
|
||||
if (option.onError) option.onError(e)
|
||||
}
|
||||
}
|
||||
async function download(row) {
|
||||
if (!row.filePath) return
|
||||
const token = getToken()
|
||||
const resp = await fetch('/api/v1/attachment/download?name=' + encodeURIComponent(row.filePath), { headers: { Authorization: 'Bearer ' + token } })
|
||||
if (!resp.ok) { ElMessage.error('下载失败'); return }
|
||||
@@ -85,11 +67,5 @@ async function download(row) {
|
||||
a.click()
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
async function remove(row) {
|
||||
await ElMessageBox.confirm('确认删除该附件?', '提示', { type: 'warning' })
|
||||
await request.post('/attachment/delete', { id: row.id })
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
}
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
<el-table-column label="事件类型" min-width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="familyTag(row.eventType)" size="small">{{ familyName(row.eventType) }}</el-tag>
|
||||
<span class="evt-code">{{ row.eventType }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="workOrderNo" label="工单号" min-width="140">
|
||||
@@ -161,11 +160,3 @@ function onReset() {
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.evt-code {
|
||||
margin-left: 6px;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<el-form-item label="结束时间"><el-date-picker v-model="filters.endDate" type="date" value-format="YYYY-MM-DD" style="width:140px" /></el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search">查询</el-button>
|
||||
<el-button v-if="can('produce.product:add')" type="primary" plain @click="openAdd">新增产品型号</el-button>
|
||||
<el-button v-if="can('produce.product:add')" type="primary" plain @click="openAdd">新增物料档案</el-button>
|
||||
<el-button @click="exportXlsx">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -47,7 +47,7 @@
|
||||
:total="total" v-model:current-page="page" v-model:page-size="pageSize"
|
||||
:page-sizes="[20, 50, 100]" @current-change="load" @size-change="search" />
|
||||
|
||||
<el-dialog v-model="dialog.show" :title="dialog.id?'编辑产品型号':'新增产品型号'" width="460px">
|
||||
<el-dialog v-model="dialog.show" :title="dialog.id?'编辑物料档案':'新增物料档案'" width="460px">
|
||||
<el-form :model="dialog" label-width="80px">
|
||||
<el-form-item label="名称"><el-input v-model="dialog.name" /></el-form-item>
|
||||
<el-form-item label="编码">
|
||||
@@ -75,7 +75,7 @@ import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpProductType } from '../help'
|
||||
import { fmtTime } from '../utils/format'
|
||||
|
||||
// 数据源说明:产品型号档案已并入 WMS 物料主数据(item_type=3,品类=成品),
|
||||
// 数据源说明:物料档案已并入 WMS 物料主数据(item_type=3,品类=成品),
|
||||
// 本页经 MES 后端实时代理 WMS;WMS 不可达时降级为本地只读缓存(wmsOnline=false)。
|
||||
const list = ref([])
|
||||
const total = ref(0)
|
||||
@@ -148,7 +148,7 @@ async function exportXlsx() {
|
||||
const blob = await request.get('/product-types/export', { params, responseType: 'blob' })
|
||||
const a = document.createElement('a')
|
||||
a.href = URL.createObjectURL(blob)
|
||||
a.download = '产品型号.xlsx'
|
||||
a.download = '物料档案.xlsx'
|
||||
a.click()
|
||||
URL.revokeObjectURL(a.href)
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<el-alert type="info" :closable="false" style="margin-bottom:12px"
|
||||
title="数量不符上报:工位收料时发现「实收数量」与备料单「应发数量」不一致,由工位终端或本页上报。系统自动算出差异并落预警,供生产/仓库核实处理。" />
|
||||
|
||||
<el-form inline>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="query.status" clearable placeholder="全部" style="width:130px" @change="load">
|
||||
<el-option label="待处理" value="PENDING" />
|
||||
<el-option label="已处理" value="RESOLVED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单号"><el-input v-model="query.orderNo" clearable style="width:160px" @keyup.enter="load" /></el-form-item>
|
||||
<el-form-item label="图号"><el-input v-model="query.materialCode" clearable style="width:150px" placeholder="不区分大小写" @keyup.enter="load" /></el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="load">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table :data="list" border size="small">
|
||||
<el-table-column prop="stationNo" label="工位" width="70" align="center" />
|
||||
<el-table-column prop="orderNo" label="工单号" min-width="130" />
|
||||
<el-table-column prop="sn" label="产品序列号" min-width="140" />
|
||||
<el-table-column prop="materialCode" label="图号" min-width="110" />
|
||||
<el-table-column prop="materialName" label="物料名称" min-width="110" />
|
||||
<el-table-column prop="planQty" label="应发" width="70" align="center" />
|
||||
<el-table-column prop="actualQty" label="实收" width="70" align="center" />
|
||||
<el-table-column label="差异" width="80" align="center">
|
||||
<template #default="{row}">
|
||||
<span :style="{ color: row.diffQty === 0 ? '#909399' : (row.diffQty > 0 ? '#67c23a' : '#f56c6c'), fontWeight: 600 }">
|
||||
{{ row.diffQty > 0 ? '+' + row.diffQty : row.diffQty }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cause" label="原因" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template #default="{row}">
|
||||
<el-tag :type="row.status === 'RESOLVED' ? 'success' : 'warning'" size="small">
|
||||
{{ row.status === 'RESOLVED' ? '已处理' : '待处理' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operator" label="上报人" width="90" />
|
||||
<el-table-column label="上报时间" width="160">
|
||||
<template #default="{row}">{{ fmtTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<PageHelp :data="helpQtyReport" page="QtyReport" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import request from '../utils/request'
|
||||
import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpQtyReport } from '../help'
|
||||
|
||||
const query = reactive({ status: '', orderNo: '', materialCode: '' })
|
||||
const list = ref([])
|
||||
|
||||
function fmtTime(t) {
|
||||
if (!t) return '-'
|
||||
const d = new Date(t)
|
||||
if (isNaN(d.getTime())) return t
|
||||
const p = (n) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
|
||||
}
|
||||
|
||||
async function load() {
|
||||
list.value = (await request.get('/qty-reports', { params: query })) || []
|
||||
}
|
||||
onMounted(() => { load() })
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<el-alert type="info" :closable="false" style="margin-bottom:12px"
|
||||
title="工位数量以数据库为准。本页可新增工位(工位号自定义,可扩展到 14、15…)与改名;每个工位的工艺流程在「关联工位」页维护:在下拉选择启用的工艺流程即绑定到该工位;一个工位只能有一个启用的工艺流程。" />
|
||||
title="工位数量以数据库为准。本页可新增工位(工位号自定义,可扩展到 14、15…)与改名;每个工位的工艺流程在「关联工位」页维护:在下拉选择启用的工艺流程即绑定到该工位;一个工位只能有一个启用的工艺流程。内置工位由种子/初始化数据产生,需与 PLC 通讯、必须按工位号顺序流转,不允许修改工位类型、不允许删除;「是否有接驳台」对应实体位置,由内置数据给定,不可手动更改。页面点击「新增工位」创建的是非内置工位,可改类型、可删除。" />
|
||||
|
||||
<div style="margin-bottom:12px">
|
||||
<el-button v-if="can('produce.station:add')" type="primary" @click="openAdd">新增工位</el-button>
|
||||
@@ -18,6 +18,18 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="来源" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="row.isBuiltin ? 'warning' : 'info'">
|
||||
{{ row.isBuiltin ? '内置' : '自定义' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接驳台" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="row.hasDock ? 'success' : 'info'">{{ row.hasDock ? '有' : '无' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="绑定工艺流程" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<el-select :model-value="row.flowId" size="small" placeholder="未绑定" @change="(v) => bindFlow(row, v)" style="width:100%">
|
||||
@@ -26,9 +38,10 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="170" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="can('produce.station:edit')" size="small" @click="openName(row)">改名</el-button>
|
||||
<el-button v-if="can('produce.station:delete') && !row.isBuiltin" size="small" type="danger" @click="remove(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -45,10 +58,13 @@
|
||||
<el-input v-model="dlg.name" placeholder="如 一号装配工位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工位类型">
|
||||
<el-radio-group v-model="dlg.stationType">
|
||||
<el-radio-group v-model="dlg.stationType" :disabled="dlg.isBuiltin">
|
||||
<el-radio label="LINE">线上位(连 PLC)</el-radio>
|
||||
<el-radio label="OFFLINE">线下位(虚拟,不连 PLC)</el-radio>
|
||||
</el-radio-group>
|
||||
<div v-if="dlg.isBuiltin" style="color:#909399;font-size:12px;line-height:1.5;margin-top:4px">
|
||||
内置工位需与 PLC 通讯并按顺序流转,工位类型不可修改。
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -62,7 +78,7 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '../utils/request'
|
||||
import { can } from '../utils/perm'
|
||||
import PageHelp from '../components/PageHelp.vue'
|
||||
@@ -74,10 +90,10 @@ const flows = ref([])
|
||||
const rows = computed(() => {
|
||||
return [...stations.value]
|
||||
.sort((a, b) => (a.stationNo || 0) - (b.stationNo || 0))
|
||||
.map((s) => ({ id: s.id, stationNo: s.stationNo, name: s.name, flowId: s.flowId, flowName: s.flowName, stationType: s.stationType }))
|
||||
.map((s) => ({ id: s.id, stationNo: s.stationNo, name: s.name, flowId: s.flowId, flowName: s.flowName, stationType: s.stationType, isBuiltin: !!s.isBuiltin, hasDock: !!s.hasDock }))
|
||||
})
|
||||
|
||||
const dlg = reactive({ show: false, isAdd: false, title: '', id: 0, stationNo: 1, name: '', stationType: 'LINE' })
|
||||
const dlg = reactive({ show: false, isAdd: false, title: '', id: 0, stationNo: 1, name: '', stationType: 'LINE', isBuiltin: false })
|
||||
|
||||
async function load() {
|
||||
stations.value = (await request.get('/stations')) || []
|
||||
@@ -87,11 +103,11 @@ function openAdd() {
|
||||
const used = new Set(stations.value.map((s) => s.stationNo))
|
||||
let next = 14
|
||||
while (used.has(next)) next++
|
||||
Object.assign(dlg, { show: true, isAdd: true, title: '新增工位', id: 0, stationNo: next, name: '', stationType: 'LINE' })
|
||||
Object.assign(dlg, { show: true, isAdd: true, title: '新增工位', id: 0, stationNo: next, name: '', stationType: 'LINE', isBuiltin: false })
|
||||
}
|
||||
|
||||
function openName(row) {
|
||||
Object.assign(dlg, { show: true, isAdd: false, title: `工位${row.stationNo} - 修改`, id: row.id, stationNo: row.stationNo, name: row.name, stationType: row.stationType || 'LINE' })
|
||||
Object.assign(dlg, { show: true, isAdd: false, title: `工位${row.stationNo} - 修改`, id: row.id, stationNo: row.stationNo, name: row.name, stationType: row.stationType || 'LINE', isBuiltin: !!row.isBuiltin })
|
||||
}
|
||||
|
||||
async function save() {
|
||||
@@ -118,6 +134,22 @@ async function bindFlow(row, fid) {
|
||||
}
|
||||
}
|
||||
|
||||
async function remove(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除工位${row.stationNo}「${row.name}」?`, '删除工位', { type: 'warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await request.delete(`/stations/${row.id}`)
|
||||
ElMessage.success('工位已删除')
|
||||
} catch {
|
||||
// 拦截器已提示(如内置工位不允许删除)
|
||||
} finally {
|
||||
await load()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await load()
|
||||
flows.value = (await request.get('/process-flows', { params: { pageSize: 1000, page: 1 } }))?.list || []
|
||||
|
||||
Reference in New Issue
Block a user