列表修改

This commit is contained in:
JenniferW 2025-06-04 14:41:56 +08:00
parent b84a50a40a
commit d502020fa0
16 changed files with 619 additions and 1373 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -0,0 +1,5 @@
export const statusOptions = [
{ value: "0", label: "待处理" },
{ value: "1", label: "已确认" },
{ value: "2", label: "已取消" }
];

View File

@ -0,0 +1,19 @@
export const defaultOrderForm = {
customerName: "",
customerAddress: "",
zip: "",
linkman: "",
linkway: "",
selectedCarType: "其他",
planCount: "",
modelInput: "",
modelDesc: "",
selectedPartInfo: null,
status: "0", // Default status for a new order/intention
remark: "",
workPlan: [], // New orders start with an empty work plan
orderName: "",
type: "意向单", // Default type for a new entry
deliveryTime: "",
currentStatus: "待处理", // Default current status
};

68
src/data/stepMockData.js Normal file
View File

@ -0,0 +1,68 @@
export const customerOptions = {
customerName: [
{ label: "广州铁路局", value: "广州铁路局" },
{ label: "深圳地铁", value: "深圳地铁" },
],
customerAddress: [
{ label: "广州市天河区", value: "广州市天河区" },
{ label: "深圳市福田区", value: "深圳市福田区" },
{ label: "广州市越秀区", value: "广州市越秀区" },
],
linkman: [
{ label: "张三", value: "张三" },
{ label: "李四", value: "李四" },
],
linkway: [
{ label: "13921000000", value: "13921000000" },
{ label: "13921000001", value: "13921000001" },
],
};
export const carTypeOptions = [
{
label: "最近常选",
options: [
{ label: "CR400AF", value: "CR400AF" },
],
},
{
label: "全部车型",
options: [
{ label: "CR400AF", value: "CR400AF" },
{ label: "JR800AF", value: "JR800AF" },
{ label: "其他", value: "其他" },
],
},
];
export const treeData = [
{
id: 1,
label: "D310000000032,动力轮对轴箱组装(带联轴节)",
children: [
{
id: 2,
label: "D311000000013,动力轮对(带轴承+联轴节)",
children: [
{ id: 3, label: "D311001000011,动力轮对" },
{ id: 4, label: "D325000000013,左轴箱组装" },
{ id: 5, label: "D326000000037,左轴端装置" },
{ id: 6, label: "D325000000014,右轴箱组装" },
{ id: 7, label: "D326000000038,右轴端装置" },
],
},
],
},
];
export const partInfoMap = {
1: { id: 1, name: "动力轮对轴箱组装", spec: "组装件", desc: "包含轮对、轴箱等" },
2: { id: 2, name: "动力轮对", spec: "带轴承+联轴节", desc: "动力传递部件" },
3: { id: 3, name: "动力轮对", spec: "标准型", desc: "主驱动部件" },
4: { id: 4, name: "左轴箱组装", spec: "组装件", desc: "左侧支撑" },
5: { id: 5, name: "左轴端装置", spec: "端装置", desc: "左端保护" },
6: { id: 6, name: "右轴箱组装", spec: "组装件", desc: "右侧支撑" },
7: { id: 7, name: "右轴端装置", spec: "端装置", desc: "右端保护" },
};
export const defaultPaymentTerms = "货物出厂验收合格前,买方需将所提货物全额货款支付给卖方。";

View File

@ -1,11 +1,24 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <hamburger
<breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" /> id="hamburger-container"
<top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" /> :is-active="appStore.sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb
v-if="!settingsStore.topNav"
id="breadcrumb-container"
class="breadcrumb-container"
/>
<top-nav
v-if="settingsStore.topNav"
id="topmenu-container"
class="topmenu-container"
/>
<div class="right-menu"> <div class="right-menu">
<template v-if="appStore.device !== 'mobile'"> <!-- <template v-if="appStore.device !== 'mobile'">
<header-search id="header-search" class="right-menu-item" /> <header-search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom"> <el-tooltip content="源码地址" effect="dark" placement="bottom">
@ -28,9 +41,13 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
</template> </template> -->
<div class="avatar-container"> <div class="avatar-container">
<el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click"> <el-dropdown
@command="handleCommand"
class="right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="userStore.avatar" class="user-avatar" /> <img :src="userStore.avatar" class="user-avatar" />
<el-icon><caret-bottom /></el-icon> <el-icon><caret-bottom /></el-icon>
@ -40,7 +57,10 @@
<router-link to="/user/profile"> <router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item> <el-dropdown-item>个人中心</el-dropdown-item>
</router-link> </router-link>
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings"> <el-dropdown-item
command="setLayout"
v-if="settingsStore.showSettings"
>
<span>布局设置</span> <span>布局设置</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item divided command="logout"> <el-dropdown-item divided command="logout">
@ -55,25 +75,25 @@
</template> </template>
<script setup> <script setup>
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from "element-plus";
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from "@/components/Breadcrumb";
import TopNav from '@/components/TopNav' import TopNav from "@/components/TopNav";
import Hamburger from '@/components/Hamburger' import Hamburger from "@/components/Hamburger";
import Screenfull from '@/components/Screenfull' import Screenfull from "@/components/Screenfull";
import SizeSelect from '@/components/SizeSelect' import SizeSelect from "@/components/SizeSelect";
import HeaderSearch from '@/components/HeaderSearch' import HeaderSearch from "@/components/HeaderSearch";
import RuoYiGit from '@/components/RuoYi/Git' import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from '@/components/RuoYi/Doc' import RuoYiDoc from "@/components/RuoYi/Doc";
import useAppStore from '@/store/modules/app' import useAppStore from "@/store/modules/app";
import useUserStore from '@/store/modules/user' import useUserStore from "@/store/modules/user";
import useSettingsStore from '@/store/modules/settings' import useSettingsStore from "@/store/modules/settings";
const appStore = useAppStore() const appStore = useAppStore();
const userStore = useUserStore() const userStore = useUserStore();
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore();
function toggleSideBar() { function toggleSideBar() {
appStore.toggleSideBar() appStore.toggleSideBar();
} }
function handleCommand(command) { function handleCommand(command) {
@ -90,24 +110,26 @@ function handleCommand(command) {
} }
function logout() { function logout() {
ElMessageBox.confirm('确定注销并退出系统吗?', '提示', { ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { })
userStore.logOut().then(() => { .then(() => {
location.href = '/index'; userStore.logOut().then(() => {
location.href = "/index";
});
}) })
}).catch(() => { }); .catch(() => {});
} }
const emits = defineEmits(['setLayout']) const emits = defineEmits(["setLayout"]);
function setLayout() { function setLayout() {
emits('setLayout'); emits("setLayout");
} }
function toggleTheme() { function toggleTheme() {
settingsStore.toggleTheme() settingsStore.toggleTheme();
} }
</script> </script>
@ -179,7 +201,7 @@ function toggleTheme() {
svg { svg {
transition: transform 0.3s; transition: transform 0.3s;
&:hover { &:hover {
transform: scale(1.15); transform: scale(1.15);
} }

111
src/mockData.js Normal file
View File

@ -0,0 +1,111 @@
import { ref } from 'vue';
export const mockData = ref([
{
id: 1,
orderNo: "INT202403150001",
customerName: "广州铁路局",
status: "0", // Maps to 待处理 initially, will change based on mock workplan status
createTime: "2025-02-25",
remark: "测试数据1",
workPlan: [
{ date: "2025-02-25", description: "订单创建时间" },
{ date: "2025-03-20", description: "排程排产确定" },
{ date: "2025-04-30", description: "原材料采购到货时" },
{ date: "2025-05-01", description: "启动生产作业时间" },
{ date: "2025-05-28", description: "已经完成生产 80%" },
{ date: "2025-06-30", description: "预计生产完成时间" },
{ date: "2025-07-30", description: "预计检测完成时间" },
{ date: "2025-08-01", description: "预计发货时间" },
],
orderName: "广州铁路局CR400AF轮对订单",
type: "订单",
deliveryTime: "2025-12-30",
currentStatus: "生产中", // Based on image
selectedCarType: "CR400AF", // Use a specific model name from carTypeOptions
planCount: 2,
modelInput: "CR400AF",
modelDesc: "高速动车组轮对",
selectedPartInfo: { id: 3, name: "动力轮对" }, // Example part info
customerAddress: "广州市天河区",
zip: "510000",
linkman: "张三",
linkway: "13921000000",
},
{
id: 2,
orderNo: "INT202403150002",
customerName: "长沙铁路局",
status: "1", // Maps to 已确认 initially
createTime: "2025-02-24 24:27:02",
remark: "测试数据2",
workPlan: [
{ date: "2025-03-01", description: "意向创建时间" },
{ date: "2025-03-10", description: "初步沟通" },
{ date: "2025-04-01", description: "方案设计" },
],
orderName: "长沙铁路局CR400BF轮对意向",
type: "意向单",
deliveryTime: "2025-10-31",
currentStatus: "设计中", // Based on image
selectedCarType: "其他", // This is already consistent with carTypeOptions
planCount: 1,
modelInput: "",
modelDesc: "",
selectedPartInfo: null,
customerAddress: "长沙市",
zip: "410000",
linkman: "李四",
linkway: "13921000001",
},
{
id: 3,
orderNo: "INT202403150003",
customerName: "唐山机车厂",
status: "0", // Maps to 待处理 initially
createTime: "2025-04-24 24:27:02",
remark: "测试数据3",
workPlan: [
{ date: "2025-03-05", description: "订单创建时间" },
{ date: "2025-03-25", description: "排程排产确定" },
],
orderName: "唐山机车厂CRH3A轮对订单",
type: "订单",
deliveryTime: "2025-07-31",
currentStatus: "订单确认中", // Based on image
selectedCarType: "JR800AF", // Use a specific model name from carTypeOptions
planCount: 3,
modelInput: "CRH3A", // Keep this as it's input, not selected
modelDesc: "动车组轮对",
selectedPartInfo: { id: 3, name: "动力轮对" }, // Example part info
customerAddress: "唐山市",
zip: "063000",
linkman: "张三",
linkway: "13921000000",
},
{
id: 4,
orderNo: "INT202403150004",
customerName: "西安铁路局",
status: "2", // Maps to 已取消 initially
createTime: "2025-04-24 24:27:02",
remark: "测试数据4",
workPlan: [
{ date: "2025-03-06", description: "订单创建时间" },
{ date: "2025-03-26", description: "订单已取消" },
],
orderName: "西安铁路局CR400AF轮对700量订单",
type: "订单",
deliveryTime: "2025-07-31",
currentStatus: "原料采购中", // Based on image
selectedCarType: "CR400AF", // Use a specific model name from carTypeOptions
planCount: 5,
modelInput: "CR400AF", // Keep this as it's input, not selected
modelDesc: "高速动车组轮对",
selectedPartInfo: { id: 3, name: "动力轮对" }, // Example part info
customerAddress: "西安市",
zip: "710000",
linkman: "李四",
linkway: "13921000001",
}
]);

View File

@ -60,7 +60,7 @@ export const constantRoutes = [
{ {
path: '', path: '',
component: Layout, component: Layout,
redirect: '/index', redirect: '/order/intention',
children: [ children: [
{ {
path: '/index', path: '/index',
@ -97,13 +97,13 @@ export const constantRoutes = [
path: 'intention', path: 'intention',
component: () => import('@/views/order/intention/index.vue'), component: () => import('@/views/order/intention/index.vue'),
name: 'Intention', name: 'Intention',
meta: { title: '意向单', icon: 'form' } meta: { title: '订单/意向单', icon: 'form' }
}, },
{ {
path: 'create', path: 'create',
component: () => import('@/views/order/intention/create.vue'), component: () => import('@/views/order/intention/create.vue'),
name: 'IntentionCreate', name: 'IntentionCreate',
meta: { title: '创建意向单', icon: 'edit', hidden: true } meta: { title: '创建订单/意向单', icon: 'edit', hidden: true }
} }
] ]
}, },

File diff suppressed because it is too large Load Diff

View File

@ -6,15 +6,22 @@
> >
<el-form-item label="客户名称" required> <el-form-item label="客户名称" required>
<el-select v-model="form.customerName" placeholder="请选择客户名称"> <el-select v-model="form.customerName" placeholder="请选择客户名称">
<el-option label="广州铁路局" value="广州铁路局" /> <el-option
<el-option label="深圳地铁" value="深圳地铁" /> v-for="option in customerOptions.customerName"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户地址" required> <el-form-item label="客户地址" required>
<el-select v-model="form.customerAddress" placeholder="请选择客户地址"> <el-select v-model="form.customerAddress" placeholder="请选择客户地址">
<el-option label="广州市天河区" value="广州市天河区" /> <el-option
<el-option label="深圳市福田区" value="深圳市福田区" /> v-for="option in customerOptions.customerAddress"
<el-option label="广州市越秀区" value="广州市越秀区" /> :key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="邮编"> <el-form-item label="邮编">
@ -22,14 +29,22 @@
</el-form-item> </el-form-item>
<el-form-item label="联系人"> <el-form-item label="联系人">
<el-select v-model="form.linkman" placeholder="请选择联系人"> <el-select v-model="form.linkman" placeholder="请选择联系人">
<el-option label="张三" value="张三" /> <el-option
<el-option label="李四" value="李四" /> v-for="option in customerOptions.linkman"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="联系方式"> <el-form-item label="联系方式">
<el-select v-model="form.linkway" placeholder="请选择联系方式"> <el-select v-model="form.linkway" placeholder="请选择联系方式">
<el-option label="13921000000" value="13921000000" /> <el-option
<el-option label="13921000001" value="13921000001" /> v-for="option in customerOptions.linkway"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div class="btn-row"> <div class="btn-row">
@ -39,6 +54,8 @@
</template> </template>
<script setup> <script setup>
import { customerOptions } from '@/data/stepMockData';
const props = defineProps({ const props = defineProps({
form: { form: {
type: Object, type: Object,

View File

@ -24,13 +24,17 @@
placeholder="请选择车型" placeholder="请选择车型"
filterable filterable
> >
<el-option-group label="最近常选"> <el-option-group
<el-option label="CR400AF" value="CR400AF" /> v-for="group in carTypeOptions"
</el-option-group> :key="group.label"
<el-option-group label="全部车型"> :label="group.label"
<el-option label="CR400AF" value="CR400AF" /> >
<el-option label="JR800AF" value="JR800AF" /> <el-option
<el-option label="其他" value="其他" /> v-for="option in group.options"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-option-group> </el-option-group>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -62,13 +66,17 @@
placeholder="请选择车型" placeholder="请选择车型"
filterable filterable
> >
<el-option-group label="最近常选"> <el-option-group
<el-option label="CR400AF" value="CR400AF" /> v-for="group in carTypeOptions"
</el-option-group> :key="group.label"
<el-option-group label="全部车型"> :label="group.label"
<el-option label="CR400AF" value="CR400AF" /> >
<el-option label="JR800AF" value="JR800AF" /> <el-option
<el-option label="其他" value="其他" /> v-for="option in group.options"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-option-group> </el-option-group>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -120,6 +128,8 @@
<script setup> <script setup>
import { ref, computed, watch } from "vue"; import { ref, computed, watch } from "vue";
import { carTypeOptions, treeData, partInfoMap } from '@/data/stepMockData';
const props = defineProps({ const props = defineProps({
form: Object, form: Object,
selectedCarType: String, selectedCarType: String,
@ -203,38 +213,8 @@ watch(selectedCarTypeProxy, (newVal, oldVal) => {
}); });
// //
const treeData = [
{
id: 1,
label: "D310000000032,动力轮对轴箱组装(带联轴节)",
children: [
{
id: 2,
label: "D311000000013,动力轮对(带轴承+联轴节)",
children: [
{ id: 3, label: "D311001000011,动力轮对" },
{ id: 4, label: "D325000000013,左轴箱组装" },
{ id: 5, label: "D326000000037,左轴端装置" },
{ id: 6, label: "D325000000014,右轴箱组装" },
{ id: 7, label: "D326000000038,右轴端装置" },
],
},
],
},
];
const treeProps = { children: "children", label: "label" }; const treeProps = { children: "children", label: "label" };
//
const partInfoMap = {
1: { id: 1, name: "动力轮对轴箱组装", spec: "组装件", desc: "包含轮对、轴箱等" },
2: { id: 2, name: "动力轮对", spec: "带轴承+联轴节", desc: "动力传递部件" },
3: { id: 3, name: "动力轮对", spec: "标准型", desc: "主驱动部件" },
4: { id: 4, name: "左轴箱组装", spec: "组装件", desc: "左侧支撑" },
5: { id: 5, name: "左轴端装置", spec: "端装置", desc: "左端保护" },
6: { id: 6, name: "右轴箱组装", spec: "组装件", desc: "右侧支撑" },
7: { id: 7, name: "右轴端装置", spec: "端装置", desc: "右端保护" },
};
function handleTreeSelect(node) { function handleTreeSelect(node) {
if (node && node.id && partInfoMap[node.id]) { if (node && node.id && partInfoMap[node.id]) {
selectedPartInfo.value = partInfoMap[node.id]; selectedPartInfo.value = partInfoMap[node.id];

View File

@ -51,8 +51,10 @@
<script setup> <script setup>
import { reactive } from "vue"; import { reactive } from "vue";
import { defaultPaymentTerms } from '@/data/stepMockData';
const form = reactive({ const form = reactive({
pay: "货物出厂验收合格前,买方需将所提货物全额货款支付给卖方。", pay: defaultPaymentTerms,
objection: "", objection: "",
force: "", force: "",
dispute: "", dispute: "",

View File

@ -14,21 +14,29 @@
/> />
</svg> </svg>
</div> </div>
<div class="success-text">{{ selectedCarType === '其他' ? '意向单生成,我们会尽快安排研发' : '订单生成,我们会尽快安排生产' }}</div> <div class="success-text">
{{
selectedCarType === "其他"
? "意向单生成,我们会尽快安排研发"
: "订单生成,我们会尽快安排生产"
}}
</div>
</div> </div>
<div class="btn-row"> <div class="btn-row">
<el-button @click="$emit('prev-step')">上一步</el-button> <el-button @click="$emit('prev-step')">上一步</el-button>
<el-button type="primary">查看列表</el-button> <el-button type="primary" @click="$emit('view-list')">查看列表</el-button>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
const emit = defineEmits(["view-list"]);
const props = defineProps({ const props = defineProps({
selectedCarType: { selectedCarType: {
type: String, type: String,
required: true required: true,
} },
}); });
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="header"> <div class="header">
<h2>创建订单/意向</h2> <h2>{{ orderId ? "修改订单/单" : "创建订单/意向单" }}</h2>
<div class="price-box" v-if="shouldShowPrice"> <div class="price-box" v-if="shouldShowPrice">
<span>预计总价</span> <span>预计总价</span>
<span class="price">{{ currentPrice }}</span> <span class="price">{{ currentPrice }}</span>
@ -27,6 +27,7 @@
@update:form="handleFormUpdate" @update:form="handleFormUpdate"
@next-step="handleNextStep" @next-step="handleNextStep"
@prev-step="handlePrevStep" @prev-step="handlePrevStep"
@view-list="goToListView"
/> />
</div> </div>
</template> </template>
@ -37,20 +38,33 @@ import Step1 from "./Step1.vue";
import Step2 from "./Step2.vue"; import Step2 from "./Step2.vue";
import Step3 from "./Step3.vue"; import Step3 from "./Step3.vue";
import Step4 from "./Step4.vue"; import Step4 from "./Step4.vue";
import { useRoute, useRouter } from "vue-router";
import { mockData } from "@/mockData";
import { ElMessage } from "element-plus";
import { defaultOrderForm } from "@/data/defaultOrderForm";
const step = ref(1); const step = ref(1);
const form = ref({ const form = ref({ ...defaultOrderForm });
customerName: "",
customerAddress: "", const route = useRoute();
zip: "", const router = useRouter();
linkman: "", const orderId = computed(() => route.query.id);
linkway: "",
selectedCarType: "其他", // Load data if editing
planCount: "", if (orderId.value) {
modelInput: "", const orderToEdit = mockData.value.find(
modelDesc: "", (item) => item.id === parseInt(orderId.value)
selectedPartInfo: null, );
}); if (orderToEdit) {
form.value = { ...orderToEdit };
//
if (form.value.selectedCarType === "其他") {
step.value = 4;
} else {
step.value = 1; // 1
}
}
}
// //
watch( watch(
@ -176,8 +190,10 @@ const step3Status = computed(() => {
}); });
function handleNextStep() { function handleNextStep() {
// step4 if (step.value === 4) {
if (step.value === 2 && selectedCarType.value === "其他") { // This is the final step, save the data
saveOrder();
} else if (step.value === 2 && selectedCarType.value === "其他") {
step.value = 4; step.value = 4;
} else if (step.value < 4) { } else if (step.value < 4) {
step.value++; step.value++;
@ -201,6 +217,35 @@ function handlePrevStep() {
function handleFormUpdate(newForm) { function handleFormUpdate(newForm) {
form.value = { ...newForm }; form.value = { ...newForm };
} }
// Add saveOrder function
function saveOrder() {
if (orderId.value) {
// Edit existing order
const index = mockData.value.findIndex(
(item) => item.id === parseInt(orderId.value)
);
if (index !== -1) {
mockData.value[index] = { ...form.value, id: parseInt(orderId.value) };
ElMessage.success("订单更新成功");
}
} else {
// Add new order
const newId =
mockData.value.length > 0
? Math.max(...mockData.value.map((item) => item.id)) + 1
: 1;
mockData.value.push({ ...form.value, id: newId });
ElMessage.success("订单创建成功");
}
// Navigate back to the list view - Remove this navigation from here
}
// Add goToListView function
function goToListView() {
console.log("Navigating to list view from Step 4");
router.push("/order/intention");
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,36 +1,49 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
<el-form-item label="订单编号" prop="orderNo"> :model="queryParams"
<el-input ref="queryForm"
v-model="queryParams.orderNo" :inline="true"
placeholder="请输入订单编号" v-show="showSearch"
clearable label-width="68px"
style="width: 240px" >
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="customerName"> <el-form-item label="客户名称" prop="customerName">
<el-input <el-select
v-model="queryParams.customerName" v-model="queryParams.customerName"
placeholder="请输入客户名称" placeholder="请选择客户名称"
clearable clearable
style="width: 240px" style="width: 240px"
@keyup.enter="handleQuery" >
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option <el-option
v-for="dict in statusOptions" v-for="option in customerOptions.customerName"
:key="dict.value" :key="option.value"
:label="dict.label" :label="option.label"
:value="dict.value" :value="option.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-input
v-model="queryParams.createTime"
placeholder="请输入创建时间"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="经办人" prop="handler">
<el-input
v-model="queryParams.handler"
placeholder="请输入经办人"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery"
>搜索</el-button
>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -43,7 +56,8 @@
icon="Plus" icon="Plus"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['order:intention:add']" v-hasPermi="['order:intention:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -53,7 +67,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['order:intention:edit']" v-hasPermi="['order:intention:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -63,20 +78,36 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['order:intention:remove']" v-hasPermi="['order:intention:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
v-model:showSearch="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="intentionList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="intentionList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="expand"> <el-table-column type="expand">
<template #default="props"> <template #default="props">
<div style="padding: 20px; border-left: 4px solid #409EFF;"> <div style="padding: 20px; border-left: 4px solid #409eff">
<p style="margin-top: 0; margin-bottom: 10px; font-weight: bold;">订单整体作业计划:</p> <p style="margin-top: 0; margin-bottom: 10px; font-weight: bold">
<ul style="list-style: none; padding: 0; margin: 0;"> 订单整体作业计划:
<li v-for="(item, index) in props.row.workPlan" :key="index" style="margin-bottom: 10px;"> </p>
<span style="font-weight: bold; margin-right: 5px;">{{ index + 1 }}{{ item.date }}:</span> <ul style="list-style: none; padding: 0; margin: 0">
<li
v-for="(item, index) in props.row.workPlan"
:key="index"
style="margin-bottom: 10px"
>
<span style="font-weight: bold; margin-right: 5px"
>{{ index + 1 }}{{ item.date }}:</span
>
{{ item.description }} {{ item.description }}
</li> </li>
</ul> </ul>
@ -86,33 +117,49 @@
<el-table-column label="订单商机名称" align="center" prop="orderName" /> <el-table-column label="订单商机名称" align="center" prop="orderName" />
<el-table-column label="客户名称" align="center" prop="customerName" /> <el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="类型" align="center" prop="type" /> <el-table-column label="类型" align="center" prop="type" />
<el-table-column label="计划交付时间" align="center" prop="deliveryTime" width="180" /> <el-table-column
label="计划交付时间"
align="center"
prop="deliveryTime"
width="180"
/>
<el-table-column label="当前状态" align="center" prop="currentStatus" /> <el-table-column label="当前状态" align="center" prop="currentStatus" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template #default="scope"> <template #default="scope">
<el-button <el-button
type="text" type="text"
icon="Edit" icon="Edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['order:intention:edit']" v-hasPermi="['order:intention:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
type="text" type="text"
icon="Delete" icon="Delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['order:intention:remove']" v-hasPermi="['order:intention:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
v-model:page="queryParams.pageNum" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
@ -121,7 +168,12 @@
<!-- 添加或修改意向订单对话框 --> <!-- 添加或修改意向订单对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body> <el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="intentionRef" :model="form" :rules="rules" label-width="80px"> <el-form
ref="intentionRef"
:model="form"
:rules="rules"
label-width="80px"
>
<el-form-item label="客户名称" prop="customerName"> <el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称" /> <el-input v-model="form.customerName" placeholder="请输入客户名称" />
</el-form-item> </el-form-item>
@ -145,7 +197,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -159,174 +215,79 @@
</template> </template>
<script setup name="Intention"> <script setup name="Intention">
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted, watch } from "vue";
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from "element-plus";
import { parseTime } from '@/utils/ruoyi' import { parseTime } from "@/utils/ruoyi";
import { useRouter, useRoute } from "vue-router";
import { mockData } from "@/mockData";
import { statusOptions } from "@/data/commonMockData";
import { customerOptions } from "@/data/stepMockData";
// //
const loading = ref(true) const loading = ref(true);
// //
const ids = ref([]) const ids = ref([]);
// //
const single = ref(true) const single = ref(true);
// //
const multiple = ref(true) const multiple = ref(true);
// //
const showSearch = ref(true) const showSearch = ref(true);
// //
const total = ref(0) const total = ref(0);
// //
const intentionList = ref([]) const intentionList = ref([]);
// //
const title = ref("") const title = ref("");
// //
const open = ref(false) const open = ref(false);
// const router = useRouter();
const statusOptions = ref([ const route = useRoute();
{ value: "0", label: "待处理" },
{ value: "1", label: "已确认" },
{ value: "2", label: "已取消" }
])
// //
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderNo: undefined,
customerName: undefined, customerName: undefined,
status: undefined createTime: undefined,
}) handler: undefined,
});
//
const form = ref({})
//
const rules = ref({
customerName: [
{ required: true, message: "客户名称不能为空", trigger: "blur" }
],
phone: [
{ required: true, message: "联系电话不能为空", trigger: "blur" }
],
product: [
{ required: true, message: "意向产品不能为空", trigger: "blur" }
],
quantity: [
{ required: true, message: "数量不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "状态不能为空", trigger: "change" }
]
})
//
const mockData = [
{
id: 1,
orderNo: "INT202403150001",
customerName: "广州铁路局",
phone: "13800138000",
product: "CR400AF轮对",
quantity: 2,
status: "0", // Maps to initially, will change based on mock workplan status
createTime: "2025-02-25",
remark: "测试数据1",
workPlan: [
{ date: "2025-02-25", description: "订单创建时间" },
{ date: "2025-03-20", description: "排程排产确定" },
{ date: "2025-04-30", description: "原材料采购到货时" },
{ date: "2025-05-01", description: "启动生产作业时间" },
{ date: "2025-05-28", description: "已经完成生产 80%" },
{ date: "2025-06-30", description: "预计生产完成时间" },
{ date: "2025-07-30", description: "预计检测完成时间" },
{ date: "2025-08-01", description: "预计发货时间" },
],
orderName: "广州铁路局CR400AF轮对订单",
type: "订单",
deliveryTime: "2025-12-30",
currentStatus: "生产中", // Based on image
},
{
id: 2,
orderNo: "INT202403150002",
customerName: "长沙铁路局",
phone: "13800138001",
product: "CR400BF轮对",
quantity: 1,
status: "1", // Maps to initially
createTime: "2025-02-24 24:27:02",
remark: "测试数据2",
workPlan: [
{ date: "2025-03-01", description: "意向创建时间" },
{ date: "2025-03-10", description: "初步沟通" },
{ date: "2025-04-01", description: "方案设计" },
],
orderName: "长沙铁路局CR400BF轮对意向",
type: "意向",
deliveryTime: "2025-10-31",
currentStatus: "设计中", // Based on image
},
{
id: 3,
orderNo: "INT202403150003",
customerName: "唐山机车厂",
phone: "13800138002",
product: "CRH3A轮对",
quantity: 3,
status: "0", // Maps to initially
createTime: "2025-04-24 24:27:02",
remark: "测试数据3",
workPlan: [
{ date: "2025-03-05", description: "订单创建时间" },
{ date: "2025-03-25", description: "排程排产确定" },
],
orderName: "唐山机车厂CRH3A轮对订单",
type: "订单",
deliveryTime: "2025-07-31",
currentStatus: "订单确认中", // Based on image
},
{
id: 4,
orderNo: "INT202403150004",
customerName: "西安铁路局",
phone: "13800138003",
product: "CR400AF轮对",
quantity: 5,
status: "2", // Maps to initially
createTime: "2025-04-24 24:27:02",
remark: "测试数据4",
workPlan: [
{ date: "2025-03-06", description: "订单创建时间" },
{ date: "2025-03-26", description: "订单已取消" },
],
orderName: "西安铁路局CR400AF轮对700量订单",
type: "订单",
deliveryTime: "2025-07-31",
currentStatus: "原料采购中", // Based on image
}
]
/** 查询意向订单列表 */ /** 查询意向订单列表 */
function getList() { function getList() {
loading.value = true loading.value = true;
// //
const start = (queryParams.value.pageNum - 1) * queryParams.value.pageSize const start = (queryParams.value.pageNum - 1) * queryParams.value.pageSize;
const end = start + queryParams.value.pageSize const end = start + queryParams.value.pageSize;
const filteredData = mockData.filter(item => { const filteredData = mockData.value.filter((item) => {
if (queryParams.value.orderNo && !item.orderNo.includes(queryParams.value.orderNo)) return false if (
if (queryParams.value.customerName && !item.customerName.includes(queryParams.value.customerName)) return false queryParams.value.createTime &&
if (queryParams.value.status && item.status !== queryParams.value.status) return false !item.createTime.includes(queryParams.value.createTime)
return true )
}) return false;
intentionList.value = filteredData.slice(start, end) if (
total.value = filteredData.length queryParams.value.handler &&
loading.value = false !item.handler.includes(queryParams.value.handler)
)
return false;
if (
queryParams.value.customerName &&
item.customerName !== queryParams.value.customerName
)
return false;
return true;
});
intentionList.value = [];
intentionList.value = filteredData.slice(start, end);
total.value = filteredData.length;
loading.value = false;
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1 queryParams.value.pageNum = 1;
getList() getList();
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -334,76 +295,116 @@ function resetQuery() {
queryParams.value = { queryParams.value = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderNo: undefined,
customerName: undefined, customerName: undefined,
status: undefined createTime: undefined,
} handler: undefined,
handleQuery() };
handleQuery();
} }
/** 多选框选中数据 */ /** 多选框选中数据 */
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id) ids.value = selection.map((item) => item.id);
single.value = selection.length !== 1 single.value = selection.length !== 1;
multiple.value = !selection.length multiple.value = !selection.length;
} }
/** 新增按钮操作 */ /** 新增按钮操作 */
function handleAdd() { function handleAdd() {
form.value = { // form.value = {
status: "0" // status: "0"
} // }
open.value = true // open.value = true
title.value = "添加意向订单" // title.value = ""
router.push("/order/create");
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
function handleUpdate(row) { function handleUpdate(row) {
const id = row.id || ids.value[0] const id = row.id || ids.value[0];
const intention = mockData.find(item => item.id === id) // const intention = mockData.value.find(item => item.id === id)
if (intention) { // if (intention) {
form.value = { ...intention } // form.value = { ...intention }
open.value = true // open.value = true
title.value = "修改意向订单" // title.value = ""
} // }
router.push({ path: "/order/create", query: { id: id } });
} }
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { // function submitForm() {
// // this.$refs["intentionRef"].validate(valid => {
ElMessage.success("操作成功") // if (valid) {
open.value = false // if (form.value.id != null) {
getList() // // Edit operation
} // const index = mockData.value.findIndex(item => item.id === form.value.id);
// if (index !== -1) {
// mockData.value[index] = { ...form.value };
// ElMessage.success("");
// }
// } else {
// // Add operation
// // Generate a simple unique ID (for static example purposes)
// const newId = mockData.value.length > 0 ? Math.max(...mockData.value.map(item => item.id)) + 1 : 1;
// mockData.value.push({ ...form.value, id: newId });
// ElMessage.success("");
// }
// open.value = false;
// getList();
// }
// });
// }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
const intentionIds = row.id || ids.value const intentionIds = row.id ? [row.id] : ids.value;
ElMessageBox.confirm('是否确认删除意向订单编号为"' + intentionIds + '"的数据项?', "警告", { ElMessageBox.confirm(
confirmButtonText: "确定", '是否确认删除意向订单编号为"' + intentionIds + '"的数据项?',
cancelButtonText: "取消", "警告",
type: "warning" {
}).then(() => { confirmButtonText: "确定",
// cancelButtonText: "取消",
ElMessage.success("删除成功") type: "warning",
getList() }
}) )
.then(() => {
//
mockData.value = mockData.value.filter(
(item) => !intentionIds.includes(item.id)
);
ids.value = []; // Clear selection after deletion
single.value = true;
multiple.value = true;
ElMessage.success("删除成功");
getList();
})
.catch(() => {}); // Catch cancel to avoid console error
} }
/** 取消按钮 */ /** 取消按钮 */
function cancel() { // function cancel() {
open.value = false // open.value = false
reset() // reset()
} // }
/** 表单重置 */ /** 表单重置 */
function reset() { // function reset() {
form.value = { // form.value = {
status: "0" // status: "0"
} // }
} // }
onMounted(() => { onMounted(() => {
getList() getList();
}) });
// Watch for route changes to refresh list
watch(
() => route.path,
(newPath) => {
if (newPath === "/order/intention") {
getList();
}
}
);
</script> </script>