From 36b909e117c3ccc22dd266a94479e2a02335d261 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 18:03:34 +0800
Subject: [PATCH] 军泰伟业 1.生产订单新增编辑逻辑重写
---
src/views/productionManagement/productionOrder/index.vue | 176 ++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 120 insertions(+), 56 deletions(-)
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 4c09ac7..8ba6699 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,32 +3,8 @@
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
- <el-form-item label="瀹㈡埛鍚嶇О:">
- <el-input v-model="searchForm.customerName"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 160px;"
- @change="handleQuery" />
- </el-form-item>
- <el-form-item label="鍚堝悓鍙�:">
- <el-input v-model="searchForm.salesContractNo"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 160px;"
- @change="handleQuery" />
- </el-form-item>
<el-form-item label="浜у搧鍚嶇О:">
<el-input v-model="searchForm.productCategory"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 160px;"
- @change="handleQuery" />
- </el-form-item>
- <el-form-item label="瑙勬牸:">
- <el-input v-model="searchForm.specificationModel"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@@ -41,6 +17,8 @@
</el-form-item>
</el-form>
<div>
+ <el-button type="primary" @click="isShowNewModal = true">鏂板</el-button>
+ <el-button type="danger" @click="handleDelete">鍒犻櫎</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
</div>
</div>
@@ -51,6 +29,8 @@
:page="page"
:tableLoading="tableLoading"
:row-class-name="tableRowClassName"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
@pagination="pagination">
<template #completionStatus="{ row }">
<el-progress
@@ -86,6 +66,11 @@
</span>
</template>
</el-dialog>
+
+ <new-product-order v-if="isShowNewModal"
+ v-model:visible="isShowNewModal"
+ type="qualified"
+ @completed="handleQuery" />
</div>
</template>
@@ -98,12 +83,17 @@
productOrderListPage,
listProcessRoute,
bindingRoute,
- listProcessBom,
+ listProcessBom, delProductOrder, startOrPause,
} from "@/api/productionManagement/productionOrder.js";
import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
+ import {fileDel} from "@/api/financialManagement/revenueManagement.js";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue"));
+
const { proxy } = getCurrentInstance();
const router = useRouter();
+ const isShowNewModal = ref(false);
const tableColumn = ref([
{
@@ -112,24 +102,14 @@
width: '120px',
},
{
- label: "閿�鍞悎鍚屽彿",
- prop: "salesContractNo",
- width: '150px',
- },
- {
- label: "瀹㈡埛鍚嶇О",
- prop: "customerName",
- width: '200px',
- },
- {
label: "浜у搧鍚嶇О",
prop: "productCategory",
width: '120px',
},
{
- label: "瑙勬牸",
+ label: "鍥剧焊缂栧彿",
prop: "specificationModel",
- width: '120px',
+ width: '160px',
},
{
label: "宸ヨ壓璺嚎缂栧彿",
@@ -143,6 +123,10 @@
{
label: "瀹屾垚鏁伴噺",
prop: "completeQuantity",
+ },
+ {
+ label: "搴撳瓨鏁伴噺",
+ prop: "inventoryQuantity",
},
{
dataType: "slot",
@@ -174,8 +158,24 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 200,
+ width: 240,
operation: [
+ {
+ name: "寮�濮�",
+ type: "text",
+ showHide: row => row.status === '寰呯敓浜�',
+ clickFun: row => {
+ handleStartOrPause(row);
+ },
+ },
+ {
+ name: "鏆傚仠",
+ type: "text",
+ showHide: row => row.status === '鐢熶骇涓�',
+ clickFun: row => {
+ handleStartOrPause(row);
+ },
+ },
{
name: "宸ヨ壓璺嚎",
type: "text",
@@ -192,7 +192,7 @@
},
},
{
- name: "浜у搧缁撴瀯",
+ name: "鐗╂枡娓呭崟",
type: "text",
clickFun: row => {
showProductStructure(row);
@@ -208,14 +208,12 @@
size: 100,
total: 0,
});
+ const selectedRows = ref([]);
const data = reactive({
searchForm: {
- customerName: "",
- salesContractNo: "",
projectName: "",
productCategory: "",
- specificationModel: "",
},
});
const { searchForm } = toRefs(data);
@@ -239,13 +237,20 @@
// 娣诲姞琛ㄨ绫诲悕鏂规硶
const tableRowClassName = ({ row }) => {
- switch (row.deliveryDaysDiff) {
- case 15:
- return 'yellow'
- case 10:
- return 'red'
- case 2:
- return 'purple'
+ if (!row.deliveryDate) return '';
+ if (row.isFh) return '';
+
+ const diff = row.deliveryDaysDiff;
+ if (diff === undefined || diff === null || diff === '' || diff < 0) return '';
+
+ if (diff === 15) {
+ return 'yellow';
+ } else if (diff === 10) {
+ return 'pink';
+ } else if (diff === 2) {
+ return 'purple';
+ } else if (diff < 2) {
+ return 'red';
}
};
@@ -344,17 +349,19 @@
const orderId = row.id;
try {
const res = await getOrderProcessRouteMain(orderId);
- const data = res.data || {};
- if (!data || !data.id) {
+ const dataList = res.data || [];
+ if (!dataList || dataList.length === 0 || !dataList[0].id) {
proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
return;
}
+ const data = dataList[0];
router.push({
path: "/productionManagement/processRouteItem",
query: {
id: data.id,
processRouteCode: data.processRouteCode || "",
productName: data.productName || "",
+ drawingNumber: data.drawingNumber || "",
model: data.model || "",
bomNo: data.bomNo || "",
description: data.description || "",
@@ -368,17 +375,70 @@
}
};
- const showProductStructure = row => {
+ const handleStartOrPause = async (row) => {
+ const operation = row.status === '寰呯敓浜�' ? 1 : 2;
+ const operationText = operation === 1 ? "寮�濮�" : "鏆傚仠";
+ try {
+ await startOrPause({ id: row.id, operation });
+ proxy.$modal.msgSuccess(`${operationText}鎴愬姛`);
+ getList();
+ } catch (e) {
+ console.error(`${operationText}澶辫触锛歚, e);
+ proxy.$modal.msgError(`${operationText}澶辫触`);
+ }
+ };
+
+ const showProductStructure = async row => {
+ let bomNo = row.bomNo || "";
+ if (!bomNo && row.id) {
+ try {
+ const res = await getOrderProcessRouteMain(row.id);
+ const dataList = res.data || [];
+ if (dataList && dataList.length > 0 && dataList[0].bomNo) {
+ bomNo = dataList[0].bomNo;
+ }
+ } catch (e) {
+ console.error("鑾峰彇BOM缂栧彿澶辫触锛�", e);
+ }
+ }
router.push({
path: "/productionManagement/productStructureDetail",
query: {
id: row.id,
- bomNo: row.bomNo || "",
+ bomNo: bomNo,
+ drawingNumber: row.drawingNumber || "",
productName: row.productCategory || "",
productModelName: row.specificationModel || "",
orderId: row.id,
type: "order",
},
+ });
+ };
+
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = (selection) => {
+ selectedRows.value = selection;
+ };
+
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ delProductOrder(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
};
@@ -409,15 +469,19 @@
align-items: start;
}
-::v-deep .yellow {
+:deep(.yellow) {
background-color: #FAF0DE;
}
-::v-deep .red {
+:deep(.pink) {
background-color: #FAE1DE;
}
-::v-deep .purple{
+:deep(.red) {
+ background-color: #FFCCCC;
+}
+
+:deep(.purple){
background-color: #F4DEFA;
}
</style>
--
Gitblit v1.9.3