列表修改

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>
<div class="navbar">
<hamburger id="hamburger-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" />
<hamburger
id="hamburger-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">
<template v-if="appStore.device !== 'mobile'">
<!-- <template v-if="appStore.device !== 'mobile'">
<header-search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
@ -28,9 +41,13 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
</template> -->
<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">
<img :src="userStore.avatar" class="user-avatar" />
<el-icon><caret-bottom /></el-icon>
@ -40,7 +57,10 @@
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
<el-dropdown-item
command="setLayout"
v-if="settingsStore.showSettings"
>
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided command="logout">
@ -55,25 +75,25 @@
</template>
<script setup>
import { ElMessageBox } from 'element-plus'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import HeaderSearch from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import useAppStore from '@/store/modules/app'
import useUserStore from '@/store/modules/user'
import useSettingsStore from '@/store/modules/settings'
import { ElMessageBox } from "element-plus";
import Breadcrumb from "@/components/Breadcrumb";
import TopNav from "@/components/TopNav";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import HeaderSearch from "@/components/HeaderSearch";
import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from "@/components/RuoYi/Doc";
import useAppStore from "@/store/modules/app";
import useUserStore from "@/store/modules/user";
import useSettingsStore from "@/store/modules/settings";
const appStore = useAppStore()
const userStore = useUserStore()
const settingsStore = useSettingsStore()
const appStore = useAppStore();
const userStore = useUserStore();
const settingsStore = useSettingsStore();
function toggleSideBar() {
appStore.toggleSideBar()
appStore.toggleSideBar();
}
function handleCommand(command) {
@ -90,24 +110,26 @@ function handleCommand(command) {
}
function logout() {
ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
userStore.logOut().then(() => {
location.href = '/index';
ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
userStore.logOut().then(() => {
location.href = "/index";
});
})
}).catch(() => { });
.catch(() => {});
}
const emits = defineEmits(['setLayout'])
const emits = defineEmits(["setLayout"]);
function setLayout() {
emits('setLayout');
emits("setLayout");
}
function toggleTheme() {
settingsStore.toggleTheme()
settingsStore.toggleTheme();
}
</script>
@ -179,7 +201,7 @@ function toggleTheme() {
svg {
transition: transform 0.3s;
&:hover {
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: '',
component: Layout,
redirect: '/index',
redirect: '/order/intention',
children: [
{
path: '/index',
@ -97,13 +97,13 @@ export const constantRoutes = [
path: 'intention',
component: () => import('@/views/order/intention/index.vue'),
name: 'Intention',
meta: { title: '意向单', icon: 'form' }
meta: { title: '订单/意向单', icon: 'form' }
},
{
path: 'create',
component: () => import('@/views/order/intention/create.vue'),
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-select v-model="form.customerName" placeholder="请选择客户名称">
<el-option label="广州铁路局" value="广州铁路局" />
<el-option label="深圳地铁" value="深圳地铁" />
<el-option
v-for="option in customerOptions.customerName"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="客户地址" required>
<el-select v-model="form.customerAddress" placeholder="请选择客户地址">
<el-option label="广州市天河区" value="广州市天河区" />
<el-option label="深圳市福田区" value="深圳市福田区" />
<el-option label="广州市越秀区" value="广州市越秀区" />
<el-option
v-for="option in customerOptions.customerAddress"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="邮编">
@ -22,14 +29,22 @@
</el-form-item>
<el-form-item label="联系人">
<el-select v-model="form.linkman" placeholder="请选择联系人">
<el-option label="张三" value="张三" />
<el-option label="李四" value="李四" />
<el-option
v-for="option in customerOptions.linkman"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="联系方式">
<el-select v-model="form.linkway" placeholder="请选择联系方式">
<el-option label="13921000000" value="13921000000" />
<el-option label="13921000001" value="13921000001" />
<el-option
v-for="option in customerOptions.linkway"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<div class="btn-row">
@ -39,6 +54,8 @@
</template>
<script setup>
import { customerOptions } from '@/data/stepMockData';
const props = defineProps({
form: {
type: Object,

View File

@ -24,13 +24,17 @@
placeholder="请选择车型"
filterable
>
<el-option-group label="最近常选">
<el-option label="CR400AF" value="CR400AF" />
</el-option-group>
<el-option-group label="全部车型">
<el-option label="CR400AF" value="CR400AF" />
<el-option label="JR800AF" value="JR800AF" />
<el-option label="其他" value="其他" />
<el-option-group
v-for="group in carTypeOptions"
:key="group.label"
:label="group.label"
>
<el-option
v-for="option in group.options"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-option-group>
</el-select>
</el-form-item>
@ -62,13 +66,17 @@
placeholder="请选择车型"
filterable
>
<el-option-group label="最近常选">
<el-option label="CR400AF" value="CR400AF" />
</el-option-group>
<el-option-group label="全部车型">
<el-option label="CR400AF" value="CR400AF" />
<el-option label="JR800AF" value="JR800AF" />
<el-option label="其他" value="其他" />
<el-option-group
v-for="group in carTypeOptions"
:key="group.label"
:label="group.label"
>
<el-option
v-for="option in group.options"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-option-group>
</el-select>
</el-form-item>
@ -120,6 +128,8 @@
<script setup>
import { ref, computed, watch } from "vue";
import { carTypeOptions, treeData, partInfoMap } from '@/data/stepMockData';
const props = defineProps({
form: Object,
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 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) {
if (node && node.id && partInfoMap[node.id]) {
selectedPartInfo.value = partInfoMap[node.id];

View File

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

View File

@ -14,21 +14,29 @@
/>
</svg>
</div>
<div class="success-text">{{ selectedCarType === '其他' ? '意向单生成,我们会尽快安排研发' : '订单生成,我们会尽快安排生产' }}</div>
<div class="success-text">
{{
selectedCarType === "其他"
? "意向单生成,我们会尽快安排研发"
: "订单生成,我们会尽快安排生产"
}}
</div>
</div>
<div class="btn-row">
<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>
</template>
<script setup>
const emit = defineEmits(["view-list"]);
const props = defineProps({
selectedCarType: {
type: String,
required: true
}
required: true,
},
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<div class="header">
<h2>创建订单/意向</h2>
<h2>{{ orderId ? "修改订单/单" : "创建订单/意向单" }}</h2>
<div class="price-box" v-if="shouldShowPrice">
<span>预计总价</span>
<span class="price">{{ currentPrice }}</span>
@ -27,6 +27,7 @@
@update:form="handleFormUpdate"
@next-step="handleNextStep"
@prev-step="handlePrevStep"
@view-list="goToListView"
/>
</div>
</template>
@ -37,20 +38,33 @@ import Step1 from "./Step1.vue";
import Step2 from "./Step2.vue";
import Step3 from "./Step3.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 form = ref({
customerName: "",
customerAddress: "",
zip: "",
linkman: "",
linkway: "",
selectedCarType: "其他",
planCount: "",
modelInput: "",
modelDesc: "",
selectedPartInfo: null,
});
const form = ref({ ...defaultOrderForm });
const route = useRoute();
const router = useRouter();
const orderId = computed(() => route.query.id);
// Load data if editing
if (orderId.value) {
const orderToEdit = mockData.value.find(
(item) => item.id === parseInt(orderId.value)
);
if (orderToEdit) {
form.value = { ...orderToEdit };
//
if (form.value.selectedCarType === "其他") {
step.value = 4;
} else {
step.value = 1; // 1
}
}
}
//
watch(
@ -176,8 +190,10 @@ const step3Status = computed(() => {
});
function handleNextStep() {
// step4
if (step.value === 2 && selectedCarType.value === "其他") {
if (step.value === 4) {
// This is the final step, save the data
saveOrder();
} else if (step.value === 2 && selectedCarType.value === "其他") {
step.value = 4;
} else if (step.value < 4) {
step.value++;
@ -201,6 +217,35 @@ function handlePrevStep() {
function handleFormUpdate(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>
<style scoped lang="scss">

View File

@ -1,36 +1,49 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="订单编号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入订单编号"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="客户名称" prop="customerName">
<el-input
<el-select
v-model="queryParams.customerName"
placeholder="请输入客户名称"
placeholder="请选择客户名称"
clearable
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
v-for="dict in statusOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="option in customerOptions.customerName"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</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-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-form-item>
</el-form>
@ -43,7 +56,8 @@
icon="Plus"
@click="handleAdd"
v-hasPermi="['order:intention:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -53,7 +67,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['order:intention:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -63,20 +78,36 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['order:intention:remove']"
>删除</el-button>
>删除</el-button
>
</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-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="expand">
<template #default="props">
<div style="padding: 20px; border-left: 4px solid #409EFF;">
<p style="margin-top: 0; margin-bottom: 10px; font-weight: bold;">订单整体作业计划:</p>
<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>
<div style="padding: 20px; border-left: 4px solid #409eff">
<p style="margin-top: 0; margin-bottom: 10px; font-weight: bold">
订单整体作业计划:
</p>
<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 }}
</li>
</ul>
@ -86,33 +117,49 @@
<el-table-column label="订单商机名称" align="center" prop="orderName" />
<el-table-column label="客户名称" align="center" prop="customerName" />
<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="createTime" width="180">
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</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">
<el-button
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['order:intention:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['order:intention:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@ -121,7 +168,12 @@
<!-- 添加或修改意向订单对话框 -->
<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-input v-model="form.customerName" placeholder="请输入客户名称" />
</el-form-item>
@ -145,7 +197,11 @@
</el-select>
</el-form-item>
<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>
<template #footer>
@ -159,174 +215,79 @@
</template>
<script setup name="Intention">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { parseTime } from '@/utils/ruoyi'
import { ref, reactive, onMounted, watch } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
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 statusOptions = ref([
{ value: "0", label: "待处理" },
{ value: "1", label: "已确认" },
{ value: "2", label: "已取消" }
])
const router = useRouter();
const route = useRoute();
//
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orderNo: undefined,
customerName: undefined,
status: 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
}
]
createTime: undefined,
handler: undefined,
});
/** 查询意向订单列表 */
function getList() {
loading.value = true
loading.value = true;
//
const start = (queryParams.value.pageNum - 1) * queryParams.value.pageSize
const end = start + queryParams.value.pageSize
const filteredData = mockData.filter(item => {
if (queryParams.value.orderNo && !item.orderNo.includes(queryParams.value.orderNo)) return false
if (queryParams.value.customerName && !item.customerName.includes(queryParams.value.customerName)) return false
if (queryParams.value.status && item.status !== queryParams.value.status) return false
return true
})
intentionList.value = filteredData.slice(start, end)
total.value = filteredData.length
loading.value = false
const start = (queryParams.value.pageNum - 1) * queryParams.value.pageSize;
const end = start + queryParams.value.pageSize;
const filteredData = mockData.value.filter((item) => {
if (
queryParams.value.createTime &&
!item.createTime.includes(queryParams.value.createTime)
)
return false;
if (
queryParams.value.handler &&
!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() {
queryParams.value.pageNum = 1
getList()
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
@ -334,76 +295,116 @@ function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10,
orderNo: undefined,
customerName: undefined,
status: undefined
}
handleQuery()
createTime: undefined,
handler: undefined,
};
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length !== 1
multiple.value = !selection.length
ids.value = selection.map((item) => item.id);
single.value = selection.length !== 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
form.value = {
status: "0"
}
open.value = true
title.value = "添加意向订单"
// form.value = {
// status: "0"
// }
// open.value = true
// title.value = ""
router.push("/order/create");
}
/** 修改按钮操作 */
function handleUpdate(row) {
const id = row.id || ids.value[0]
const intention = mockData.find(item => item.id === id)
if (intention) {
form.value = { ...intention }
open.value = true
title.value = "修改意向订单"
}
const id = row.id || ids.value[0];
// const intention = mockData.value.find(item => item.id === id)
// if (intention) {
// form.value = { ...intention }
// open.value = true
// title.value = ""
// }
router.push({ path: "/order/create", query: { id: id } });
}
/** 提交按钮 */
function submitForm() {
//
ElMessage.success("操作成功")
open.value = false
getList()
}
// function submitForm() {
// this.$refs["intentionRef"].validate(valid => {
// if (valid) {
// if (form.value.id != null) {
// // 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) {
const intentionIds = row.id || ids.value
ElMessageBox.confirm('是否确认删除意向订单编号为"' + intentionIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
//
ElMessage.success("删除成功")
getList()
})
const intentionIds = row.id ? [row.id] : ids.value;
ElMessageBox.confirm(
'是否确认删除意向订单编号为"' + intentionIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.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() {
open.value = false
reset()
}
// function cancel() {
// open.value = false
// reset()
// }
/** 表单重置 */
function reset() {
form.value = {
status: "0"
}
}
// function reset() {
// form.value = {
// status: "0"
// }
// }
onMounted(() => {
getList()
})
getList();
});
// Watch for route changes to refresh list
watch(
() => route.path,
(newPath) => {
if (newPath === "/order/intention") {
getList();
}
}
);
</script>