diff --git a/klp-ui/src/assets/styles/element-ui.scss b/klp-ui/src/assets/styles/element-ui.scss index 70ecb4b0..c5dc147d 100644 --- a/klp-ui/src/assets/styles/element-ui.scss +++ b/klp-ui/src/assets/styles/element-ui.scss @@ -41,7 +41,7 @@ body { /* 按钮样式优化 */ .el-button { - padding: 6px 12px; + padding: 8px 16px; border-radius: 2px; font-size: 13px; transition: all 0.2s ease; @@ -58,7 +58,7 @@ body { } .el-button--mini { - padding: 2px 4px; + padding: 4px 8px; font-size: 12px; } diff --git a/klp-ui/src/views/wms/order/components/PSpecSelect.vue b/klp-ui/src/views/wms/order/components/PSpecSelect.vue index 30b4c57e..ad9acbfb 100644 --- a/klp-ui/src/views/wms/order/components/PSpecSelect.vue +++ b/klp-ui/src/views/wms/order/components/PSpecSelect.vue @@ -31,7 +31,7 @@ diff --git a/klp-ui/src/views/wms/order/panels/orderPage.vue b/klp-ui/src/views/wms/order/panels/orderPage.vue index 21e28910..3586391f 100644 --- a/klp-ui/src/views/wms/order/panels/orderPage.vue +++ b/klp-ui/src/views/wms/order/panels/orderPage.vue @@ -1,169 +1,200 @@ - - - - - - - - - - - - 搜索 - 重置 - - + + + + + + + + + + + + 新增订单 + + + - - - 新增 + + + + + + + + + + + + 订单编号: + {{ item.orderCode }} + + + + + + + + + + + + + + + + + + + + - - 修改 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更新订单信息 + + + + + + + + + + + + + - - 删除 - - - 导出 - - - - - - - - - - - - - - - - - - - - - - 修改 - 删除 - 明细 - 复制订单ID - - 确认订单 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - @@ -194,24 +225,26 @@ export default { EOrderStatus, // 按钮loading buttonLoading: false, - // 遮罩层 + // 列表加载遮罩 loading: true, - // 选中数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 + // 选中的订单ID集合(用于批量操作) + selectedIds: {}, + // 非多个禁用(批量删除用) multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, - // 订单主表格数据 + // 订单列表数据 orderList: [], - // 弹出层标题 + // 新增弹窗标题 title: "", - // 是否显示弹出层 + // 新增弹窗显示状态 open: false, + // 当前选中的订单ID(控制右侧详情显示) + selectedOrderId: null, + // 右侧激活的Tab + activeTab: "orderDetail", // 查询参数 queryParams: { pageNum: 1, @@ -219,50 +252,10 @@ export default { orderCode: undefined, customerId: undefined, salesManager: undefined, - orderStatus: this.orderQueryStatus, + orderStatus: undefined, }, // 表单参数 - form: {}, - // 表单校验 - rules: { - }, - detailDialogVisible: false, - detailOrderId: null, - clacDialogVisible: false, - clacOrderId: null, - }; - }, - created() { - this.getList(); - }, - methods: { - /** 查询订单主列表 */ - getList() { - this.loading = true; - listByStatus(this.queryParams).then(response => { - this.orderList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - goDashboard() { - this.$router.push('/shop/order/dashboard'); - }, - handleOrderStatusChange(row) { - // console.log(row); - updateOrder(row).then(response => { - this.$modal.msgSuccess("修改成功"); - this.getList(); - }); - }, - // 取消按钮 - cancel() { - this.open = false; - this.reset(); - }, - // 表单重置 - reset() { - this.form = { + form: { orderId: undefined, orderCode: undefined, customerId: undefined, @@ -274,118 +267,354 @@ export default { createBy: undefined, updateTime: undefined, updateBy: undefined, - taxAmount: undefined, - noTaxAmount: undefined, - }; - this.resetForm("form"); + taxAmount: 0, + noTaxAmount: 0, + }, + // 表单校验规则 + rules: { + orderCode: [ + { required: true, message: "请输入订单编号", trigger: "blur" } + ], + customerId: [ + { required: true, message: "请选择客户名称", trigger: "change" } + ], + salesManager: [ + { required: true, message: "请输入销售经理", trigger: "blur" } + ], + taxAmount: [ + { required: true, message: "请输入含税金额", trigger: "blur" } + ], + noTaxAmount: [ + { required: true, message: "请输入无税金额", trigger: "blur" } + ] + } + }; + }, + created() { + this.queryParams.orderStatus = this.orderQueryStatus; + this.getList(); + }, + methods: { + /** 查询订单列表 */ + getList() { + this.loading = true; + listByStatus(this.queryParams).then(response => { + this.orderList = response.rows; + this.total = response.total; + + // 重置选中状态 + this.selectedIds = {}; + this.checkMultipleStatus(); + + // 如果之前选中的订单不在列表中了,清空选中状态 + if (this.selectedOrderId && !this.orderList.some(item => item.orderId === this.selectedOrderId)) { + this.selectedOrderId = null; + } + + this.loading = false; + }).catch(() => { + this.loading = false; + }); }, - /** 搜索按钮操作 */ + + /** 点击列表项加载详情 */ + handleRowClick(item) { + this.selectedOrderId = item.orderId; + this.loadOrderDetail(item.orderId); + }, + + /** 加载订单详情 */ + loadOrderDetail(orderId) { + this.buttonLoading = true; + getOrder(orderId).then(response => { + this.form = { ...response.data }; + this.form.taxAmount = this.form.taxAmount || 0; + this.form.noTaxAmount = this.form.noTaxAmount || 0; + }).catch(() => { + this.$modal.msgError("加载订单详情失败"); + }).finally(() => { + this.buttonLoading = false; + }); + }, + + /** 处理复选框变化 */ + handleCheckboxChange(item, checked) { + this.selectedIds[item.orderId] = checked; + this.checkMultipleStatus(); + }, + + /** 检查批量操作状态 */ + checkMultipleStatus() { + const selectedCount = Object.values(this.selectedIds).filter(checked => checked).length; + this.multiple = selectedCount === 0; + }, + + /** 订单状态变更 */ + handleOrderStatusChange() { + updateOrder(this.form).then(response => { + this.$modal.msgSuccess("修改成功"); + this.getList(); + }).catch(() => { + this.$modal.msgError("修改失败"); + this.loadOrderDetail(this.selectedOrderId); // 失败后重新加载原数据 + }); + }, + + /** 取消新增 */ + cancel() { + this.open = false; + this.resetForm("addForm"); + this.form = { + orderId: undefined, + orderCode: undefined, + customerId: undefined, + salesManager: undefined, + orderStatus: this.orderQueryStatus, + remark: undefined, + taxAmount: 0, + noTaxAmount: 0, + }; + }, + + /** 搜索 */ handleQuery() { this.queryParams.pageNum = 1; this.getList(); }, - /** 重置按钮操作 */ + + /** 重置搜索 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.orderStatus = this.orderQueryStatus; this.handleQuery(); }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.orderId) - this.single = selection.length!==1 - this.multiple = !selection.length + + /** 重置表单 */ + resetForm(formRef) { + if (this.$refs[formRef]) { + this.$refs[formRef].resetFields(); + } }, - copyOrderId(row) { - // 获取浏览器剪切板对象并复制row.orderId - // 先检查是否支持 + + /** 复制订单ID */ + copyOrderId(orderId) { if (navigator.clipboard) { - navigator.clipboard.writeText(row.orderId); - this.$modal.msgSuccess("复制成功"); + navigator.clipboard.writeText(orderId).then(() => { + this.$modal.msgSuccess("复制成功"); + }).catch(() => { + this.$modal.msgError("复制失败,请手动复制"); + }); } else { this.$modal.msgError("浏览器不支持复制功能"); } }, - /** 新增按钮操作 */ + + /** 新增订单 */ handleAdd() { - this.reset(); + this.resetForm("addForm"); + this.form = { + orderId: undefined, + orderCode: undefined, + customerId: undefined, + salesManager: undefined, + orderStatus: this.orderQueryStatus, + remark: undefined, + taxAmount: 0, + noTaxAmount: 0, + }; this.open = true; - this.title = "添加订单主"; + this.title = "添加订单"; }, - /** 修改按钮操作 */ - handleUpdate(row) { - this.loading = true; - this.reset(); - const orderId = row.orderId || this.ids - getOrder(orderId).then(response => { - this.loading = false; - this.form = response.data; - this.open = true; - this.title = "修改订单主"; - }); - }, - /** 提交按钮 */ - submitForm() { - this.$refs["form"].validate(valid => { + + /** 提交新增表单 */ + submitAddForm() { + this.$refs["addForm"].validate(valid => { if (valid) { this.buttonLoading = true; - if (this.form.orderId != null) { - updateOrder(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } else { - addOrder(this.form).then(response => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } + addOrder(this.form).then(response => { + this.$modal.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }).catch(() => { + this.$modal.msgError("新增失败"); + }).finally(() => { + this.buttonLoading = false; + }); } }); }, - /** 删除按钮操作 */ + + /** 提交详情更新表单 */ + submitDetailForm() { + this.$refs["detailForm"].validate(valid => { + if (valid) { + this.buttonLoading = true; + updateOrder(this.form).then(response => { + this.$modal.msgSuccess("更新成功"); + this.getList(); + }).catch(() => { + this.$modal.msgError("更新失败"); + }).finally(() => { + this.buttonLoading = false; + }); + } + }); + }, + + /** 删除订单 */ handleDelete(row) { - const orderIds = row.orderId || this.ids; - this.$modal.confirm('是否确认删除订单主编号为"' + orderIds + '"的数据项?').then(() => { + // 获取要删除的订单ID + let orderIds; + if (row) { + // 单条删除 + orderIds = [row.orderId]; + } else { + // 批量删除 + orderIds = Object.entries(this.selectedIds) + .filter(([id, checked]) => checked) + .map(([id]) => id); + } + + if (!orderIds.length) { + this.$modal.msgWarning("请选择要删除的订单"); + return; + } + + this.$modal.confirm(`是否确认删除选中的 ${orderIds.length} 个订单?`).then(() => { this.loading = true; return delOrder(orderIds); }).then(() => { - this.loading = false; - this.getList(); this.$modal.msgSuccess("删除成功"); + // 如果删除的是当前选中的订单,清空详情 + if (row && this.selectedOrderId === row.orderId) { + this.selectedOrderId = null; + } + this.getList(); }).catch(() => { + this.$modal.msgError("删除失败"); }).finally(() => { this.loading = false; }); }, - /** 导出按钮操作 */ - handleExport() { - this.download('wms/order/export', { - ...this.queryParams - }, `order_${new Date().getTime()}.xlsx`) - }, - showDetail(row) { - this.detailOrderId = row.orderId; - this.detailDialogVisible = true; - }, - showClac(row) { - this.clacOrderId = row.orderId; - this.clacDialogVisible = true; - }, + + /** 预订单确认 */ handleStartProduction(row) { - updateOrder({ - orderId: row.orderId, - orderStatus: 1 + this.$modal.confirm(`是否确认将订单"${row.orderCode}"转为正式订单?`).then(() => { + return updateOrder({ + orderId: row.orderId, + orderStatus: 1 + }); }).then(response => { this.$modal.msgSuccess("已转化为正式订单"); + if (this.selectedOrderId === row.orderId) { + this.selectedOrderId = null; + } this.getList(); + }).catch(() => { + this.$modal.msgError("转化失败"); }); } } }; + + \ No newline at end of file diff --git a/klp-ui/src/views/work/components/MSpecSelect.vue b/klp-ui/src/views/work/components/MSpecSelect.vue index c4059d50..4f74183e 100644 --- a/klp-ui/src/views/work/components/MSpecSelect.vue +++ b/klp-ui/src/views/work/components/MSpecSelect.vue @@ -31,7 +31,7 @@ \ No newline at end of file diff --git a/klp-ui/src/views/work/line/GanttChartEcharts.vue b/klp-ui/src/views/work/line/GanttChartEcharts.vue index dd821d22..0864dbd8 100644 --- a/klp-ui/src/views/work/line/GanttChartEcharts.vue +++ b/klp-ui/src/views/work/line/GanttChartEcharts.vue @@ -54,7 +54,7 @@ export default { } // 处理数据,兼容多种字段名,保证任务名唯一 const taskData = this.tasks.map((item, idx) => { - const name = (item.remark || item.taskName || item.productName || item.name || `任务${idx+1}`) + (item.productName ? `-${item.productName}` : ''); + const name = (item.taskName || item.planName || item.remark || item.productName || item.name || `任务${idx+1}`) + (item.productName ? `-${item.productName}` : ''); const start = item.startDate || item.start_time || item.start || item.start_date; const end = item.endDate || item.end_time || item.end || item.end_date; console.log(item.lineId, item.orderId, idx, '颜色取值依据') diff --git a/klp-ui/src/views/work/mspec/index.vue b/klp-ui/src/views/work/mspec/index.vue index 872876d6..d5ecabd0 100644 --- a/klp-ui/src/views/work/mspec/index.vue +++ b/klp-ui/src/views/work/mspec/index.vue @@ -292,8 +292,8 @@ export default { processParams: undefined, scope: undefined, inspectionStandard: undefined, - status: undefined, - specType: undefined, + status: 1, + specType: 1, version: undefined, versionDate: undefined, standardHours: undefined, diff --git a/klp-ui/src/views/work/schedule/index.vue b/klp-ui/src/views/work/schedule/index.vue index 6eb62949..857b733c 100644 --- a/klp-ui/src/views/work/schedule/index.vue +++ b/klp-ui/src/views/work/schedule/index.vue @@ -9,21 +9,21 @@ :value="item.lineId" /> - + - - + + - + + end-placeholder="结束日期" style="width:100%" @change="onDateRangeChange" /> @@ -47,22 +47,28 @@ import { listProductionLine } from '@/api/wms/productionLine'; import { ganttProductionLine } from '@/api/wms/productionLine'; import { addSchedulePlanDetail, updateSchedulePlanDetail } from '@/api/wms/schedulePlanDetail'; -import { listBatch } from '@/api/wms/batch'; +import { listProductionTask } from '@/api/work/productionTask'; import GanttChartEcharts from '../line/GanttChartEcharts.vue'; +const binding = { + key: 'taskId', + label: 'planName', + api: listProductionTask, + text: '生产任务' +} + export default { components: { GanttChartEcharts }, data() { return { + binding, detailForm: { detailId: undefined, - planId: undefined, lineId: undefined, - // productId: undefined, - batchId: undefined, + [binding.key]: undefined, quantity: 0, dateRange: [], startDate: '', @@ -70,18 +76,19 @@ export default { remark: '' }, detailRules: { - batchId: [{ required: true, message: '请选择产品', trigger: 'change' }], + [binding.key]: [{ required: true, message: '请选择' + binding.text, trigger: 'change' }], lineId: [{ required: true, message: '请选择产线', trigger: 'change' }], quantity: [{ required: true, message: '请输入排产数量', trigger: 'blur' }], dateRange: [{ required: true, type: 'array', len: 2, message: '请选择计划日期区间', trigger: 'change' }] }, lineGanttTasks: [], productionLineList: [], - previewTask: null, + previewTask: {}, + taskList: [], } }, created() { - this.fetchBatchList(); + this.fetchTaskList(); this.fetchProductionLineList(); }, methods: { @@ -90,6 +97,25 @@ export default { this.productionLineList = res.rows || []; }); }, + onTaskChange(taskId) { + const task = this.taskList.find(item => item.taskId === taskId); + if (task) { + this.previewTask = { + ...this.previewTask, + taskName: task.taskName, + planName: task.planName, + }; + } + }, + onDateRangeChange(dateRange) { + if (dateRange && dateRange.length === 2) { + const startDate = this.parseTime(dateRange[0], '{y}-{m}-{d} {h}:{i}:{s}'); + const endDate = this.parseTime(dateRange[1], '{y}-{m}-{d} {h}:{i}:{s}'); + console.log(startDate, endDate); + this.previewTask.startDate = startDate; + this.previewTask.endDate = endDate; + } + }, onLineChange(lineId) { if (!lineId) { this.lineGanttTasks = []; @@ -100,23 +126,9 @@ export default { this.updatePreviewTask(); }); }, - onBatchChange(batchId) { - if (batchId) { - // 从batchList中查找 - const batch = this.batchList.find(item => item.batchId == batchId); - console.log(batch); - if (batch) { - this.detailForm.quantity = batch.totalQuantity; - this.detailForm.dateRange = [ - batch.estimatedStartTime, - batch.estimatedEndTime - ]; - } - } - }, - fetchBatchList() { - listBatch({ pageNum: 1, pageSize: 1000 }).then(res => { - this.batchList = res.rows || []; + fetchTaskList() { + listProductionTask({ pageNum: 1, pageSize: 1000 }).then(res => { + this.taskList = res.rows || []; }); }, submitDetailForm() { @@ -130,7 +142,7 @@ export default { this.detailForm.endDate = ''; } const api = this.detailForm.detailId ? updateSchedulePlanDetail : addSchedulePlanDetail; - const data = Object.assign({}, this.detailForm, { planId: this.planId }); + const data = Object.assign({}, this.detailForm, { taskId: this.detailForm.taskId }); api(data).then(() => { this.$message.success(this.detailForm.detailId ? '修改成功' : '新增成功'); this.detailDialogVisible = false; diff --git a/klp-ui/src/views/work/task/components/OrderSelect.vue b/klp-ui/src/views/work/task/components/OrderSelect.vue index 97a27066..04dc7b8e 100644 --- a/klp-ui/src/views/work/task/components/OrderSelect.vue +++ b/klp-ui/src/views/work/task/components/OrderSelect.vue @@ -41,6 +41,7 @@ export default { loading: false, queryParams: { orderCode: undefined, + orderStatus: 1, pageNum: 1, pageSize: 20 }, diff --git a/klp-ui/src/views/work/task/index.vue b/klp-ui/src/views/work/task/index.vue index aae819ca..fc6033c3 100644 --- a/klp-ui/src/views/work/task/index.vue +++ b/klp-ui/src/views/work/task/index.vue @@ -100,14 +100,22 @@ - - - - - + + + + + + + + + + + + + - + @@ -139,10 +147,10 @@ - + - +