diff --git a/public/favicon.ico b/public/favicon.ico index e263760..68fd556 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/assets/images/login-background.jpg b/src/assets/images/login-background.jpg index 8a89eb8..0f605f5 100644 Binary files a/src/assets/images/login-background.jpg and b/src/assets/images/login-background.jpg differ diff --git a/src/assets/logo/logo.png b/src/assets/logo/logo.png index e263760..68fd556 100644 Binary files a/src/assets/logo/logo.png and b/src/assets/logo/logo.png differ diff --git a/src/data/commonMockData.js b/src/data/commonMockData.js new file mode 100644 index 0000000..d18f60e --- /dev/null +++ b/src/data/commonMockData.js @@ -0,0 +1,5 @@ +export const statusOptions = [ + { value: "0", label: "待处理" }, + { value: "1", label: "已确认" }, + { value: "2", label: "已取消" } +]; \ No newline at end of file diff --git a/src/data/defaultOrderForm.js b/src/data/defaultOrderForm.js new file mode 100644 index 0000000..3784e14 --- /dev/null +++ b/src/data/defaultOrderForm.js @@ -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 +}; \ No newline at end of file diff --git a/src/data/stepMockData.js b/src/data/stepMockData.js new file mode 100644 index 0000000..80b1cad --- /dev/null +++ b/src/data/stepMockData.js @@ -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 = "货物出厂验收合格前,买方需将所提货物全额货款支付给卖方。"; \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 35a6ee6..1c61428 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -1,11 +1,24 @@ diff --git a/src/views/order/intention/create.vue b/src/views/order/intention/create.vue index 94dfd92..9aaa5a1 100644 --- a/src/views/order/intention/create.vue +++ b/src/views/order/intention/create.vue @@ -1,7 +1,7 @@ @@ -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"); +}