1
This commit is contained in:
parent
68f7990373
commit
216d23ef5f
@ -2,7 +2,9 @@
|
|||||||
更多设置表单
|
更多设置表单
|
||||||
- 由 UpperTable「字段设置」中的「更多设置」按钮打开
|
- 由 UpperTable「字段设置」中的「更多设置」按钮打开
|
||||||
- 表格工作模式(原字段设置工具栏内嵌的 radio,迁移至此)
|
- 表格工作模式(原字段设置工具栏内嵌的 radio,迁移至此)
|
||||||
|
- 界面显示(浏览器 localStorage 持久化选项:Scan-box 模式 / 工具栏按钮模式 / 快捷键区域 / 页面布局)
|
||||||
- 页面缓存 / tab 缓存分类(开关 / 最大缓存数量 / 应用范围)
|
- 页面缓存 / tab 缓存分类(开关 / 最大缓存数量 / 应用范围)
|
||||||
|
- 存储:experimental_{userId}_{roleId}(experimental store)、settings_{userId}_{roleId}(settings store)
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@ -27,6 +29,49 @@
|
|||||||
|
|
||||||
<el-divider />
|
<el-divider />
|
||||||
|
|
||||||
|
<!-- ===== 界面显示(浏览器持久化选项) ===== -->
|
||||||
|
<div class="more-section">
|
||||||
|
<div class="more-section-title">界面显示</div>
|
||||||
|
<div class="more-section-desc">
|
||||||
|
以下选项保存在当前浏览器(按账号 + 角色隔离),仅影响本机显示,换电脑需重新设置。
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="more-setting-row">
|
||||||
|
<span class="setting-label">Scan-box 显示模式</span>
|
||||||
|
<el-radio-group v-model="scanBoxMode" size="small">
|
||||||
|
<el-radio-button value="compact">紧凑(默认)</el-radio-button>
|
||||||
|
<el-radio-button value="standard">标准</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<span class="setting-hint">紧凑模式行高更小,一屏显示更多筛选条件</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="more-setting-row">
|
||||||
|
<span class="setting-label">工具栏按钮模式</span>
|
||||||
|
<el-radio-group v-model="toolbarMode" size="small">
|
||||||
|
<el-radio-button value="tile">平铺(默认)</el-radio-button>
|
||||||
|
<el-radio-button value="collapse">折叠</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<span class="setting-hint">订单工具栏按钮组的排列方式</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="more-setting-row">
|
||||||
|
<span class="setting-label">快捷键区域</span>
|
||||||
|
<el-switch v-model="shortcutExpanded" />
|
||||||
|
<span class="setting-hint">展开顶部快捷键面板(默认收起)</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="more-setting-row">
|
||||||
|
<span class="setting-label">页面布局</span>
|
||||||
|
<el-radio-group v-model="layoutMode" size="small">
|
||||||
|
<el-radio-button value="top-bottom">顶部导航</el-radio-button>
|
||||||
|
<el-radio-button value="sidebar">侧边导航</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<span class="setting-hint">顶部导航 = 菜单在顶部横向排列</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-divider />
|
||||||
|
|
||||||
<!-- ===== 页面缓存分类 ===== -->
|
<!-- ===== 页面缓存分类 ===== -->
|
||||||
<div class="more-section">
|
<div class="more-section">
|
||||||
<div class="more-section-title">页面缓存</div>
|
<div class="more-section-title">页面缓存</div>
|
||||||
@ -102,6 +147,7 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { useExperimentalStore } from '@/stores/modules/experimental'
|
import { useExperimentalStore } from '@/stores/modules/experimental'
|
||||||
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
|
|
||||||
const visible = defineModel<boolean>('visible', { default: false })
|
const visible = defineModel<boolean>('visible', { default: false })
|
||||||
|
|
||||||
@ -113,6 +159,7 @@ const dialogVisible = computed({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const experimentalStore = useExperimentalStore()
|
const experimentalStore = useExperimentalStore()
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
|
||||||
const tableMode = computed({
|
const tableMode = computed({
|
||||||
get: () => experimentalStore.tableMode,
|
get: () => experimentalStore.tableMode,
|
||||||
@ -121,6 +168,40 @@ const tableMode = computed({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/* ===== 界面显示(浏览器持久化:settings store → localStorage settings_{userId}_{roleId}) ===== */
|
||||||
|
|
||||||
|
/** Scan-box 显示模式:standard=标准 / compact=紧凑 */
|
||||||
|
const scanBoxMode = computed({
|
||||||
|
get: () => settingsStore.scanBoxMode,
|
||||||
|
set: (mode: 'standard' | 'compact') => {
|
||||||
|
settingsStore.changeSetting({ key: 'scanBoxMode', value: mode })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 工具栏按钮组显示模式:tile=平铺 / collapse=折叠 */
|
||||||
|
const toolbarMode = computed({
|
||||||
|
get: () => settingsStore.toolbarMode,
|
||||||
|
set: (mode: 'tile' | 'collapse') => {
|
||||||
|
settingsStore.changeSetting({ key: 'toolbarMode', value: mode })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 顶部快捷键区域是否展开 */
|
||||||
|
const shortcutExpanded = computed({
|
||||||
|
get: () => settingsStore.shortcutExpanded,
|
||||||
|
set: (expanded: boolean) => {
|
||||||
|
settingsStore.changeSetting({ key: 'shortcutExpanded', value: expanded })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 页面布局:top-bottom=顶部导航 / sidebar=侧边导航 */
|
||||||
|
const layoutMode = computed({
|
||||||
|
get: () => settingsStore.layoutMode,
|
||||||
|
set: (mode: 'sidebar' | 'top-bottom') => {
|
||||||
|
settingsStore.changeSetting({ key: 'layoutMode', value: mode })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const tabCacheEnabled = computed({
|
const tabCacheEnabled = computed({
|
||||||
get: () => experimentalStore.tabCacheEnabled,
|
get: () => experimentalStore.tabCacheEnabled,
|
||||||
set: (val: boolean) => {
|
set: (val: boolean) => {
|
||||||
@ -169,15 +250,20 @@ function handlePageCacheMaxChange(val: number | undefined) {
|
|||||||
experimentalStore.setPageCacheMax(Number(val ?? 1))
|
experimentalStore.setPageCacheMax(Number(val ?? 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 恢复全部设置为默认配置(表格工作模式 / 页面缓存 / tab 缓存) */
|
/** 恢复全部设置为默认配置(表格工作模式 / 界面显示 / 页面缓存 / tab 缓存) */
|
||||||
function handleResetDefaults() {
|
function handleResetDefaults() {
|
||||||
ElMessageBox.confirm('确定恢复全部设置为默认配置吗?', '恢复默认', {
|
ElMessageBox.confirm(
|
||||||
|
'确定恢复全部设置为默认配置吗?表格工作模式、界面显示(Scan-box 模式 / 工具栏按钮模式 / 快捷键区域 / 页面布局)、页面缓存、tab 缓存都将恢复默认。',
|
||||||
|
'恢复默认',
|
||||||
|
{
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
confirmButtonText: '恢复',
|
confirmButtonText: '恢复',
|
||||||
cancelButtonText: '取消'
|
cancelButtonText: '取消'
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
experimentalStore.resetToDefaults()
|
experimentalStore.resetToDefaults()
|
||||||
|
settingsStore.resetDisplaySettings()
|
||||||
ElMessage.success('已恢复默认配置')
|
ElMessage.success('已恢复默认配置')
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
|||||||
@ -34,12 +34,14 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* @type {'tile' | 'collapse'}
|
* @type {'tile' | 'collapse'}
|
||||||
* @description Toolbar button display mode: tile (平铺) or collapse (折叠)
|
* @description Toolbar button display mode: tile (平铺) or collapse (折叠)
|
||||||
|
* 默认:tile(平铺)
|
||||||
*/
|
*/
|
||||||
toolbarMode: 'tile',
|
toolbarMode: 'tile',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {'standard' | 'compact'}
|
* @type {'standard' | 'compact'}
|
||||||
* @description ScanBox display mode: standard (标准) or compact (紧凑)
|
* @description ScanBox display mode: standard (标准) or compact (紧凑)
|
||||||
|
* 默认:compact(紧凑);可在「字段设置 → 更多设置 → 界面显示」中修改
|
||||||
*/
|
*/
|
||||||
scanBoxMode: 'standard'
|
scanBoxMode: 'compact'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,6 +129,18 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复「界面显示」类浏览器持久化设置为默认值并写回 localStorage
|
||||||
|
* 覆盖:Scan-box 显示模式 / 工具栏按钮模式 / 快捷键区域 / 页面布局
|
||||||
|
*/
|
||||||
|
const resetDisplaySettings = () => {
|
||||||
|
scanBoxModeRef.value = (defaultScanBoxMode as 'standard' | 'compact') || 'standard'
|
||||||
|
toolbarModeRef.value = (defaultToolbarMode as 'tile' | 'collapse') || 'tile'
|
||||||
|
shortcutExpandedRef.value = shortcutExpanded
|
||||||
|
layoutMode.value = 'top-bottom'
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme,
|
theme,
|
||||||
showSettings: showSettingsRef,
|
showSettings: showSettingsRef,
|
||||||
@ -139,6 +151,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
shortcutExpanded: shortcutExpandedRef,
|
shortcutExpanded: shortcutExpandedRef,
|
||||||
toolbarMode: toolbarModeRef,
|
toolbarMode: toolbarModeRef,
|
||||||
scanBoxMode: scanBoxModeRef,
|
scanBoxMode: scanBoxModeRef,
|
||||||
changeSetting
|
changeSetting,
|
||||||
|
resetDisplaySettings
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -19,7 +19,52 @@
|
|||||||
<div class="app-error" v-if="pdaError">获取版本信息失败</div>
|
<div class="app-error" v-if="pdaError">获取版本信息失败</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="app-action">
|
<div class="app-action">
|
||||||
<el-button type="primary" size="small" :disabled="!pdaData?.downloadUrl" @click="showQrCode">
|
<el-button type="primary" size="small" :disabled="!pdaData?.downloadUrl" @click="showQrCode('扫描二维码下载 PDA', pdaData?.downloadUrl)">
|
||||||
|
下载
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-divider border-style="dashed" />
|
||||||
|
|
||||||
|
<!-- Android Worker Station(安卓工作台) -->
|
||||||
|
<div class="app-item" v-loading="loadingAndroid">
|
||||||
|
<div class="app-icon">
|
||||||
|
<el-icon :size="40" color="#e6a23c"><Iphone /></el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="app-info">
|
||||||
|
<div class="app-name">安卓工作台 (Android)</div>
|
||||||
|
<div class="app-version" v-if="androidData">V {{ androidData.version }}</div>
|
||||||
|
<div class="app-date" v-if="androidData">{{ formatDate(androidData.publishedAtUtc) }}</div>
|
||||||
|
<div class="app-error" v-if="androidError">获取版本信息失败</div>
|
||||||
|
</div>
|
||||||
|
<div class="app-action">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
size="small"
|
||||||
|
:disabled="!androidData?.url"
|
||||||
|
@click="showQrCode('扫描二维码下载 安卓工作台', androidData?.url)"
|
||||||
|
>
|
||||||
|
下载
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-divider border-style="dashed" />
|
||||||
|
|
||||||
|
<!-- Windows Worker Station(Windows工作台) -->
|
||||||
|
<div class="app-item" v-loading="loadingWindows">
|
||||||
|
<div class="app-icon">
|
||||||
|
<el-icon :size="40" color="#e6a23c"><Monitor /></el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="app-info">
|
||||||
|
<div class="app-name">Windows工作台</div>
|
||||||
|
<div class="app-version" v-if="windowsData">V {{ windowsData.version }}</div>
|
||||||
|
<div class="app-date" v-if="windowsData">{{ formatDate(windowsData.publishedAtUtc) }}</div>
|
||||||
|
<div class="app-error" v-if="windowsError">获取版本信息失败</div>
|
||||||
|
</div>
|
||||||
|
<div class="app-action">
|
||||||
|
<el-button type="warning" size="small" :disabled="!windowsData?.url" @click="download(windowsData?.url)">
|
||||||
下载
|
下载
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -46,17 +91,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 二维码下载弹窗 -->
|
<!-- 二维码下载弹窗(PDA / 安卓工作台共用) -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="qrCodeVisible"
|
v-model="qrCodeVisible"
|
||||||
title="扫描二维码下载 PDA"
|
:title="qrDialogTitle"
|
||||||
width="300px"
|
width="300px"
|
||||||
align-center
|
align-center
|
||||||
>
|
>
|
||||||
<div class="qrcode-container">
|
<div class="qrcode-container">
|
||||||
<canvas ref="qrCanvas"></canvas>
|
<canvas ref="qrCanvas"></canvas>
|
||||||
<div class="qrcode-tip">请使用 PDA 或手机扫描</div>
|
<div class="qrcode-tip">请使用手机或平板扫描</div>
|
||||||
<div class="qrcode-link" v-if="pdaData" @click="download(pdaData.downloadUrl)">
|
<div class="qrcode-link" @click="download(qrTargetUrl)">
|
||||||
无法扫描?点击直接下载
|
无法扫描?点击直接下载
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +111,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, nextTick } from 'vue'
|
import { ref, onMounted, nextTick } from 'vue'
|
||||||
import { Cellphone, Monitor } from '@element-plus/icons-vue'
|
import { Cellphone, Monitor, Iphone } from '@element-plus/icons-vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import QRCode from 'qrcode'
|
import QRCode from 'qrcode'
|
||||||
@ -87,15 +132,41 @@ interface PrintServerVersionInfo {
|
|||||||
publishedAtUtc: string
|
publishedAtUtc: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作台(散单工作台)版本信息
|
||||||
|
* 与 `worker_station`(安卓 APK)/ `worker_station_windows`(Windows EXE)的 latest.json 字段一致
|
||||||
|
*/
|
||||||
|
interface WorkerStationVersionInfo {
|
||||||
|
version: string
|
||||||
|
file: string
|
||||||
|
url: string
|
||||||
|
sha256?: string
|
||||||
|
publishedAtUtc: string
|
||||||
|
/**
|
||||||
|
* 是否允许跳过该版本:**0 或缺省 = 不可跳过(强制更新)**,1 = 可跳过。
|
||||||
|
* 注:该字段由工作台客户端自身的自更新流程使用,网页端仅作下载入口,不做拦截。
|
||||||
|
*/
|
||||||
|
canSkip?: number
|
||||||
|
}
|
||||||
|
|
||||||
const pdaData = ref<PdaVersionInfo | null>(null)
|
const pdaData = ref<PdaVersionInfo | null>(null)
|
||||||
const printData = ref<PrintServerVersionInfo | null>(null)
|
const printData = ref<PrintServerVersionInfo | null>(null)
|
||||||
|
const androidData = ref<WorkerStationVersionInfo | null>(null)
|
||||||
|
const windowsData = ref<WorkerStationVersionInfo | null>(null)
|
||||||
|
|
||||||
const loadingPda = ref(true)
|
const loadingPda = ref(true)
|
||||||
const loadingPrint = ref(true)
|
const loadingPrint = ref(true)
|
||||||
|
const loadingAndroid = ref(true)
|
||||||
|
const loadingWindows = ref(true)
|
||||||
const pdaError = ref(false)
|
const pdaError = ref(false)
|
||||||
const printError = ref(false)
|
const printError = ref(false)
|
||||||
|
const androidError = ref(false)
|
||||||
|
const windowsError = ref(false)
|
||||||
|
|
||||||
const qrCodeVisible = ref(false)
|
const qrCodeVisible = ref(false)
|
||||||
|
/** 二维码弹窗标题 / 目标地址(PDA、安卓工作台共用) */
|
||||||
|
const qrDialogTitle = ref('扫描二维码下载')
|
||||||
|
const qrTargetUrl = ref('')
|
||||||
const qrCanvas = ref<HTMLCanvasElement | null>(null)
|
const qrCanvas = ref<HTMLCanvasElement | null>(null)
|
||||||
|
|
||||||
const formatDate = (dateString: string) => {
|
const formatDate = (dateString: string) => {
|
||||||
@ -103,12 +174,14 @@ const formatDate = (dateString: string) => {
|
|||||||
return dayjs(dateString).format('YYYY-MM-DD HH:mm')
|
return dayjs(dateString).format('YYYY-MM-DD HH:mm')
|
||||||
}
|
}
|
||||||
|
|
||||||
const showQrCode = async () => {
|
const showQrCode = async (title: string, url?: string) => {
|
||||||
if (!pdaData.value?.downloadUrl) return
|
if (!url) return
|
||||||
|
qrDialogTitle.value = title
|
||||||
|
qrTargetUrl.value = url
|
||||||
qrCodeVisible.value = true
|
qrCodeVisible.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
if (qrCanvas.value) {
|
if (qrCanvas.value) {
|
||||||
QRCode.toCanvas(qrCanvas.value, pdaData.value.downloadUrl, {
|
QRCode.toCanvas(qrCanvas.value, url, {
|
||||||
width: 200,
|
width: 200,
|
||||||
margin: 2,
|
margin: 2,
|
||||||
color: {
|
color: {
|
||||||
@ -157,6 +230,44 @@ const fetchPrintServerInfo = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 安卓工作台(散单工作台 APK)版本信息 */
|
||||||
|
const fetchAndroidInfo = async () => {
|
||||||
|
try {
|
||||||
|
loadingAndroid.value = true
|
||||||
|
androidError.value = false
|
||||||
|
const response = await axios.get('https://dl.wms.gztbyc.com/worker_station/latest.json', {
|
||||||
|
params: { timestamp: new Date().getTime() }
|
||||||
|
})
|
||||||
|
if (response.data) {
|
||||||
|
androidData.value = response.data
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch Android worker station version info', error)
|
||||||
|
androidError.value = true
|
||||||
|
} finally {
|
||||||
|
loadingAndroid.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Windows 工作台(散单工作台 EXE)版本信息 */
|
||||||
|
const fetchWindowsInfo = async () => {
|
||||||
|
try {
|
||||||
|
loadingWindows.value = true
|
||||||
|
windowsError.value = false
|
||||||
|
const response = await axios.get('https://dl.wms.gztbyc.com/worker_station_windows/latest.json', {
|
||||||
|
params: { timestamp: new Date().getTime() }
|
||||||
|
})
|
||||||
|
if (response.data) {
|
||||||
|
windowsData.value = response.data
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch Windows worker station version info', error)
|
||||||
|
windowsError.value = true
|
||||||
|
} finally {
|
||||||
|
loadingWindows.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const download = (url?: string) => {
|
const download = (url?: string) => {
|
||||||
if (url) {
|
if (url) {
|
||||||
window.open(url, '_blank')
|
window.open(url, '_blank')
|
||||||
@ -166,6 +277,8 @@ const download = (url?: string) => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchPdaInfo()
|
fetchPdaInfo()
|
||||||
fetchPrintServerInfo()
|
fetchPrintServerInfo()
|
||||||
|
fetchAndroidInfo()
|
||||||
|
fetchWindowsInfo()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import type { ComboGoodsListItem } from '@/api/combogoods/combogoods'
|
import type { ComboGoodsListItem } from '@/api/combogoods/combogoods'
|
||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
|
||||||
export type ComboGoodsRecord = ComboGoodsListItem & {
|
export type ComboGoodsRecord = ComboGoodsListItem & {
|
||||||
created_at?: string
|
created_at?: string
|
||||||
@ -72,6 +73,18 @@ export const comboGoodsColumns = [
|
|||||||
{ prop: 'actions', label: '操作', width: '150', fixed: 'right' }
|
{ prop: 'actions', label: '操作', width: '150', fixed: 'right' }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合商品列表主工具栏按钮
|
||||||
|
* 样式 / 顺序对齐「商品明细」(stock/stock 的 stockToolbarButtons):
|
||||||
|
* 刷新(primary)→ 字段设置(default)→ 新增组合商品(primary)→ 快速搜索(primary + plain)
|
||||||
|
*/
|
||||||
|
export const comboGoodsToolbarButtons: ToolbarButtonConfig[] = [
|
||||||
|
{ key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadList' },
|
||||||
|
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
||||||
|
{ key: 'create', label: '新增组合商品', type: 'primary', size: 'small', action: 'openCreate' },
|
||||||
|
{ key: 'quickSearch', label: '快速搜索', type: 'primary', plain: true, size: 'small', action: 'openSearchDialog' }
|
||||||
|
]
|
||||||
|
|
||||||
export const comboGoodsScanFields = [
|
export const comboGoodsScanFields = [
|
||||||
// ===== 组合信息 =====
|
// ===== 组合信息 =====
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,9 +17,14 @@
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
|
<order-toolbar-button-group
|
||||||
<el-button type="success" size="small" @click="openCreate">新增组合商品</el-button>
|
:buttons="toolbarButtons"
|
||||||
<el-button size="small" type="primary" plain @click="searchDialogVisible = true">快速搜索</el-button>
|
:resolve-disabled="resolveButtonDisabled"
|
||||||
|
:resolve-loading="resolveButtonLoading"
|
||||||
|
:resolve-label="resolveButtonLabel"
|
||||||
|
:layout-key="toolbarLayoutKey"
|
||||||
|
@action="handleToolbarButtonClick"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-right">
|
<div class="toolbar-right">
|
||||||
|
|
||||||
@ -31,6 +36,7 @@
|
|||||||
ref="upperTable"
|
ref="upperTable"
|
||||||
title="组合商品列表"
|
title="组合商品列表"
|
||||||
default-align="center"
|
default-align="center"
|
||||||
|
:enable-column-config="true"
|
||||||
table-id="stock-combo-goods"
|
table-id="stock-combo-goods"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@ -91,10 +97,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import { comboGoodsDelete, comboGoodsList } from '@/api/combogoods/combogoods'
|
import { comboGoodsDelete, comboGoodsList } from '@/api/combogoods/combogoods'
|
||||||
import ComboGoodsFormDialog from './component/ComboGoodsFormDialog.vue'
|
import ComboGoodsFormDialog from './component/ComboGoodsFormDialog.vue'
|
||||||
import ComboGoodsSearchDialog from './component/ComboGoodsSearchDialog.vue'
|
import ComboGoodsSearchDialog from './component/ComboGoodsSearchDialog.vue'
|
||||||
@ -103,6 +111,7 @@ import {
|
|||||||
buildComboGoodsListPayload,
|
buildComboGoodsListPayload,
|
||||||
comboGoodsColumns,
|
comboGoodsColumns,
|
||||||
comboGoodsScanFields,
|
comboGoodsScanFields,
|
||||||
|
comboGoodsToolbarButtons,
|
||||||
formatComboGoodsDateTime,
|
formatComboGoodsDateTime,
|
||||||
formatComboGoodsStatus,
|
formatComboGoodsStatus,
|
||||||
isComboGoodsApiSuccess,
|
isComboGoodsApiSuccess,
|
||||||
@ -112,6 +121,7 @@ import {
|
|||||||
} from './combo-stock-config'
|
} from './combo-stock-config'
|
||||||
|
|
||||||
const scanBox = ref<any>(null)
|
const scanBox = ref<any>(null)
|
||||||
|
const upperTable = ref<any>(null)
|
||||||
|
|
||||||
const presetTree = ref<any[]>([])
|
const presetTree = ref<any[]>([])
|
||||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(comboGoodsScanFields)))
|
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(comboGoodsScanFields)))
|
||||||
@ -130,6 +140,52 @@ const formDialogMode = ref<'create' | 'edit'>('create')
|
|||||||
const editingRecord = ref<ComboGoodsRecord | null>(null)
|
const editingRecord = ref<ComboGoodsRecord | null>(null)
|
||||||
const searchDialogVisible = ref(false)
|
const searchDialogVisible = ref(false)
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 工具栏(样式 / 布局对齐「商品明细」stock/stock)
|
||||||
|
// 按钮定义见 combo-stock-config.ts 的 comboGoodsToolbarButtons
|
||||||
|
// ============================================================
|
||||||
|
const toolbarButtons: ToolbarButtonConfig[] = comboGoodsToolbarButtons
|
||||||
|
|
||||||
|
const buttonLoadingMap = computed(() => ({
|
||||||
|
loading: loading.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
/** 按钮组重新测量可见按钮的依赖(loading / 按钮集合变化时重算) */
|
||||||
|
const toolbarLayoutKey = computed(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
loading: buttonLoadingMap.value,
|
||||||
|
permissions: toolbarButtons.map((button) => button.key).join(',')
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
function resolveButtonLoading(loadingKey?: string) {
|
||||||
|
if (!loadingKey) return false
|
||||||
|
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveButtonDisabled(_disabledKey?: string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveButtonLabel(defaultLabel: string, _dynamicLabelKey?: string) {
|
||||||
|
return defaultLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolbarActionMap: Record<string, () => void> = {
|
||||||
|
loadList: () => loadList(),
|
||||||
|
openColumnConfigPanel: () => upperTable.value?.openColumnConfig?.(),
|
||||||
|
openCreate: () => openCreate(),
|
||||||
|
openSearchDialog: () => {
|
||||||
|
searchDialogVisible.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||||
|
const handler = toolbarActionMap[action]
|
||||||
|
if (!handler) return
|
||||||
|
handler()
|
||||||
|
}
|
||||||
|
|
||||||
async function loadList() {
|
async function loadList() {
|
||||||
if (loading.value) return
|
if (loading.value) return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
scanWorkflowField,
|
scanWorkflowField,
|
||||||
type ToolbarButtonConfig
|
type ToolbarButtonConfig
|
||||||
} from '@/views/order/orderManagement/config/order-common-config'
|
} from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import { formatBarcodeText } from '@/utils/barcode'
|
import { normalizeBarcodeList } from '@/utils/barcode'
|
||||||
|
|
||||||
/** ScanBox 筛选字段分组(商品模块专用,保留供其他场景复用) */
|
/** ScanBox 筛选字段分组(商品模块专用,保留供其他场景复用) */
|
||||||
export const STOCK_SCAN_FIELD_GROUPS = {
|
export const STOCK_SCAN_FIELD_GROUPS = {
|
||||||
@ -70,9 +70,10 @@ export const stockColumns = [
|
|||||||
prop: 'barcodes',
|
prop: 'barcodes',
|
||||||
label: '商品条码',
|
label: '商品条码',
|
||||||
width: '120',
|
width: '120',
|
||||||
// 超长条码(多个条码以 | 拼接)超过 30 字符时收起,提供「展开 / 收起」
|
// 多值折叠(只显示第 1 个 + 「+N」,点击 +N 展开全部),单击条码复制
|
||||||
textCollapse: 30,
|
// 表现与「外部库存」(stock/external_stock)的条码列一致
|
||||||
formatter: (row: any) => formatBarcodeText(row.barcodes)
|
copyAction: 'copy',
|
||||||
|
copyValue: (row: any) => normalizeBarcodeList(row.barcodes)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'images',
|
prop: 'images',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user