mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:49:19 +08:00
feat: 订单状态表新增颜色字段
- 新增 sql/ec_design.sql 表设计文档
- ec_order_status 表新增 color 字段
- 后端 PO/DTO/VO 同步新增 color 字段
- 前端表单支持颜色选择(预设12色+自定义输入)
- 前端列表页状态名称显示颜色标签
⚠️ 数据库需执行 ALTER TABLE 语句
This commit is contained in:
@@ -9,6 +9,8 @@ export namespace OrderStatusDTO {
|
||||
statusName: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 状态颜色(十六进制,如 #1890ff) */
|
||||
color?: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
@@ -23,6 +25,8 @@ export namespace OrderStatusDTO {
|
||||
statusName: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 状态颜色(十六进制,如 #1890ff) */
|
||||
color?: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
|
||||
@@ -13,6 +13,8 @@ export namespace OrderStatusVO {
|
||||
statusName: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 状态颜色(十六进制,如 #1890ff) */
|
||||
color?: string;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
|
||||
+36
@@ -37,10 +37,18 @@ const loading = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const currentRecord = ref<null | OrderStatusVO.Info>(null);
|
||||
|
||||
// 预设颜色列表
|
||||
const colorPresets = [
|
||||
'#1890ff', '#52c41a', '#faad14', '#f5222d',
|
||||
'#722ed1', '#13c2c2', '#eb2f96', '#fa8c16',
|
||||
'#a0d911', '#2f54eb', '#531dab', '#d9d9d9',
|
||||
];
|
||||
|
||||
// 表单数据
|
||||
const formData = ref<Partial<OrderStatusDTO.Create>>({
|
||||
statusName: '',
|
||||
description: '',
|
||||
color: '',
|
||||
autoStatistics: 1,
|
||||
sortOrder: 0,
|
||||
isRefund: 0,
|
||||
@@ -67,6 +75,7 @@ function open(edit: boolean, record?: OrderStatusVO.Info) {
|
||||
? {
|
||||
statusName: record.statusName,
|
||||
description: record.description || '',
|
||||
color: record.color || '',
|
||||
autoStatistics: record.autoStatistics,
|
||||
sortOrder: record.sortOrder || 0,
|
||||
isRefund: record.isRefund || 0,
|
||||
@@ -74,6 +83,7 @@ function open(edit: boolean, record?: OrderStatusVO.Info) {
|
||||
: {
|
||||
statusName: '',
|
||||
description: '',
|
||||
color: '',
|
||||
autoStatistics: 1,
|
||||
sortOrder: 0,
|
||||
isRefund: 0,
|
||||
@@ -87,6 +97,11 @@ function close() {
|
||||
emit('cancel');
|
||||
}
|
||||
|
||||
// 选择颜色
|
||||
function selectColor(color: string) {
|
||||
formData.value.color = color;
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
@@ -98,6 +113,7 @@ async function handleSubmit() {
|
||||
const updateData: OrderStatusDTO.Update = {
|
||||
statusName: formData.value.statusName!,
|
||||
description: formData.value.description,
|
||||
color: formData.value.color,
|
||||
autoStatistics: formData.value.autoStatistics!,
|
||||
sortOrder: formData.value.sortOrder,
|
||||
isRefund: formData.value.isRefund,
|
||||
@@ -109,6 +125,7 @@ async function handleSubmit() {
|
||||
const createData: OrderStatusDTO.Create = {
|
||||
statusName: formData.value.statusName!,
|
||||
description: formData.value.description,
|
||||
color: formData.value.color,
|
||||
autoStatistics: formData.value.autoStatistics!,
|
||||
sortOrder: formData.value.sortOrder,
|
||||
isRefund: formData.value.isRefund,
|
||||
@@ -161,6 +178,25 @@ defineExpose({
|
||||
placeholder="请输入状态名称"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="状态颜色" name="color">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex gap-1 flex-wrap">
|
||||
<div
|
||||
v-for="c in colorPresets"
|
||||
:key="c"
|
||||
class="h-6 w-6 cursor-pointer rounded border-2 transition-transform hover:scale-110"
|
||||
:style="{ backgroundColor: c, borderColor: formData.color === c ? '#000' : 'transparent' }"
|
||||
@click="selectColor(c)"
|
||||
></div>
|
||||
</div>
|
||||
<Input
|
||||
v-model:value="formData.color"
|
||||
placeholder="#1890ff"
|
||||
class="!w-24"
|
||||
/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<Form.Item label="状态描述" name="description">
|
||||
|
||||
+13
-2
@@ -35,10 +35,9 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'statusName',
|
||||
title: '状态名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'statusName' },
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
@@ -207,6 +206,18 @@ function handleModalSuccess() {
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 状态名称列(带颜色) -->
|
||||
<template #statusName="{ row }: { row: OrderStatusVO.Info }">
|
||||
<Tag
|
||||
v-if="row.color"
|
||||
:color="row.color"
|
||||
class="font-bold"
|
||||
>
|
||||
{{ row.statusName }}
|
||||
</Tag>
|
||||
<span v-else>{{ row.statusName }}</span>
|
||||
</template>
|
||||
|
||||
<!-- 自动统计列 -->
|
||||
<template #autoStatistics="{ row }: { row: OrderStatusVO.Info }">
|
||||
<Tag :color="row.autoStatistics === 1 ? 'green' : 'default'">
|
||||
|
||||
Reference in New Issue
Block a user