From 8ba79292b0a1b6a8f93ca00432c6f2db827b1a93 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 19 三月 2026 17:32:29 +0800
Subject: [PATCH] 。
---
src/views/productionManagement/productionOrder/index.vue | 336 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 224 insertions(+), 112 deletions(-)
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 761139e..a306bff 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,24 +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"
+ <el-input v-model="searchForm.productName"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@@ -28,21 +12,34 @@
@change="handleQuery" />
</el-form-item>
<el-form-item label="瑙勬牸:">
- <el-input v-model="searchForm.specificationModel"
+ <el-input v-model="searchForm.model"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
style="width: 160px;"
@change="handleQuery" />
</el-form-item>
+ <el-form-item label="鐘舵��:">
+ <el-select v-model="searchForm.status"
+ placeholder="璇烽�夋嫨"
+ style="width: 160px;"
+ @change="handleQuery">
+ <el-option v-for="item in statusOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
<el-form-item>
<el-button type="primary"
@click="handleQuery">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="handleReset">閲嶇疆</el-button>
</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 type="danger"
+ @click="handleDelete">閫�鍥�</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
</div>
</div>
@@ -54,14 +51,13 @@
:tableLoading="tableLoading"
:row-class-name="tableRowClassName"
:isSelection="true"
+ :selectable="row => row.status != 4"
@selection-change="handleSelectionChange"
@pagination="pagination">
<template #completionStatus="{ row }">
- <el-progress
- :percentage="toProgressPercentage(row?.completionStatus)"
- :color="progressColor(toProgressPercentage(row?.completionStatus))"
- :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"
- />
+ <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
+ :color="progressColor(toProgressPercentage(row?.completionStatus))"
+ :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
</template>
</PIMTable>
</div>
@@ -90,10 +86,9 @@
</span>
</template>
</el-dialog>
-
<new-product-order v-if="isShowNewModal"
- v-model:visible="isShowNewModal"
- @completed="handleQuery" />
+ v-model:visible="isShowNewModal"
+ @completed="handleQuery" />
</div>
</template>
@@ -102,16 +97,21 @@
import { ElMessageBox } from "element-plus";
import dayjs from "dayjs";
import { useRouter } from "vue-router";
+ import { getDicts } from "@/api/system/dict/data";
import {
productOrderListPage,
listProcessRoute,
bindingRoute,
- listProcessBom, delProductOrder,
+ listProcessBom,
+ delProductOrder,
} from "@/api/productionManagement/productionOrder.js";
+ import { listPage } from "@/api/productionManagement/processRoute.js";
import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
- import {fileDel} from "@/api/financialManagement/revenueManagement.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 NewProductOrder = defineAsyncComponent(() =>
+ import("@/views/productionManagement/productionOrder/New.vue")
+ );
const { proxy } = getCurrentInstance();
@@ -120,34 +120,54 @@
const tableColumn = ref([
{
+ label: "鐘舵��",
+ prop: "status",
+ dataType: "tag",
+
+ formatData: val => {
+ const statusMap = {
+ 1: "寰呭紑濮�",
+ 2: "杩涜涓�",
+ 3: "宸插畬鎴�",
+ 4: "宸插彇娑�",
+ };
+ return statusMap[val] || "";
+ },
+ formatType: val => {
+ const statusMap = {
+ 1: "error",
+ 2: "warning",
+ 3: "success",
+ 4: "info",
+ };
+ return statusMap[val] || "info";
+ },
+ width: 100,
+ },
+ {
label: "鐢熶骇璁㈠崟鍙�",
prop: "npsNo",
- width: '120px',
- },
- {
- label: "閿�鍞悎鍚屽彿",
- prop: "salesContractNo",
- width: '150px',
- },
- {
- label: "瀹㈡埛鍚嶇О",
- prop: "customerName",
- width: '200px',
+ width: "120px",
},
{
label: "浜у搧鍚嶇О",
- prop: "productCategory",
- width: '120px',
+ prop: "productName",
+ width: "120px",
},
{
label: "瑙勬牸",
- prop: "specificationModel",
- width: '120px',
+ prop: "model",
+ width: "120px",
+ },
+ {
+ label: "鐗╂枡缂栫爜",
+ prop: "materialCode",
+ width: "120px",
},
{
label: "宸ヨ壓璺嚎缂栧彿",
prop: "processRouteCode",
- width: '200px',
+ width: "200px",
},
{
label: "闇�姹傛暟閲�",
@@ -178,17 +198,25 @@
},
{
label: "浜や粯鏃ユ湡",
- prop: "deliveryDate",
+ prop: "planCompleteTime",
formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
width: 120,
},
+
{
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 200,
+ width: 300,
operation: [
+ {
+ name: "鏉ユ簮",
+ type: "text",
+ clickFun: row => {
+ showSourceData(row);
+ },
+ },
{
name: "宸ヨ壓璺嚎",
type: "text",
@@ -199,18 +227,26 @@
{
name: "缁戝畾宸ヨ壓璺嚎",
type: "text",
- showHide: row => !row.processRouteCode,
+ showHide: row => !row.routeId,
clickFun: row => {
openBindRouteDialog(row);
},
},
{
- name: "浜у搧缁撴瀯",
+ name: "鍒犻櫎",
type: "text",
+ showHide: row => row.status == 4,
clickFun: row => {
- showProductStructure(row);
+ handleDeleteSolo(row);
},
},
+ // {
+ // name: "浜у搧缁撴瀯",
+ // type: "text",
+ // clickFun: row => {
+ // showProductStructure(row);
+ // },
+ // },
],
},
]);
@@ -228,8 +264,8 @@
customerName: "",
salesContractNo: "",
projectName: "",
- productCategory: "",
- specificationModel: "",
+ productName: "",
+ model: "",
},
});
const { searchForm } = toRefs(data);
@@ -253,19 +289,18 @@
// 娣诲姞琛ㄨ绫诲悕鏂规硶
const tableRowClassName = ({ row }) => {
- if (!row.deliveryDate) return '';
- if (row.isFh) return '';
-
- const diff = row.deliveryDaysDiff;
- if (diff === 15) {
- return 'yellow';
- } else if (diff === 10) {
- return 'pink';
- } else if (diff === 2) {
- return 'purple';
- } else if (diff < 2) {
- return 'red';
- }
+ // if (!row.planCompleteTime) return "";
+ // if (row.isFh) return "";
+ // const diff = row.deliveryDaysDiff;
+ // if (diff === 15) {
+ // return "yellow";
+ // } else if (diff === 10) {
+ // return "pink";
+ // } else if (diff === 2) {
+ // return "purple";
+ // } else if (diff < 2) {
+ // return "red";
+ // }
};
// 缁戝畾宸ヨ壓璺嚎寮规
@@ -273,6 +308,7 @@
const bindRouteLoading = ref(false);
const bindRouteSaving = ref(false);
const routeOptions = ref([]);
+ const productTypeOptions = ref([]);
const bindForm = reactive({
orderId: null,
routeId: null,
@@ -283,15 +319,32 @@
bindForm.routeId = null;
bindRouteDialogVisible.value = true;
routeOptions.value = [];
- if (!row.productModelId) {
+ if (!row.model) {
proxy.$modal.msgWarning("褰撳墠璁㈠崟缂哄皯浜у搧鍨嬪彿锛屾棤娉曟煡璇㈠伐鑹鸿矾绾�");
bindRouteDialogVisible.value = false;
return;
}
bindRouteLoading.value = true;
+ const distName =
+ row.productName == "鏉挎潗"
+ ? row.productName
+ : row.productName + "-" + row.strength;
+
try {
- const res = await listProcessRoute({ productModelId: row.productModelId });
- routeOptions.value = res.data || [];
+ // 鑾峰彇浜у搧绫诲瀷瀛楀吀
+ const dictRes = await getDicts("product_type");
+ if (dictRes.code === 200) {
+ productTypeOptions.value = dictRes.data;
+ // 鐢╠istName鍖归厤dictLabel锛岃幏鍙杁ictCode
+ const matchedType = productTypeOptions.value.find(
+ item => item.dictLabel === distName
+ );
+ const dictCode = matchedType ? matchedType.dictCode : row.productType;
+
+ // 浣跨敤dictCode鏌ヨ宸ヨ壓璺嚎鍒楄〃
+ const res = await listPage({ dictCode, status: true });
+ routeOptions.value = res.data.records || [];
+ }
} catch (e) {
console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触");
@@ -321,7 +374,23 @@
bindRouteSaving.value = false;
}
};
-
+ const statusOptions = ref([
+ { value: 1, label: "寰呭紑濮�" },
+ { value: 2, label: "杩涜涓�" },
+ { value: 3, label: "宸插畬鎴�" },
+ { value: 4, label: "宸插彇娑�" },
+ ]);
+ const handleReset = () => {
+ searchForm.value = {
+ customerName: "",
+ salesContractNo: "",
+ projectName: "",
+ productName: "",
+ model: "",
+ status: "",
+ };
+ handleQuery();
+ };
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
@@ -362,23 +431,23 @@
const showRouteItemModal = async row => {
const orderId = row.id;
try {
- const res = await getOrderProcessRouteMain(orderId);
- const data = res.data || {};
- if (!data || !data.id) {
- proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
- return;
- }
router.push({
path: "/productionManagement/processRouteItem",
query: {
- id: data.id,
- processRouteCode: data.processRouteCode || "",
- productName: data.productName || "",
- model: data.model || "",
- bomNo: data.bomNo || "",
- description: data.description || "",
- orderId,
+ id: row.routeId,
+ processRouteCode: row.processRouteCode || "",
+ productName: row.productName || "",
+ model: row.model || "",
+ bomNo: row.bomNo || "",
+ bomId: row.bomId || "",
+ description: row.description || "",
+ dictLabel:
+ row.productName == "鏉挎潗"
+ ? row.productName
+ : row.productName + "-" + row.strength,
+ orderId: row.id,
type: "order",
+ editable: true,
},
});
} catch (e) {
@@ -388,44 +457,83 @@
};
const showProductStructure = row => {
+ if (!row.processRouteCode) {
+ proxy.$modal.msgWarning("璇峰厛缁戝畾宸ヨ壓璺嚎");
+ return;
+ }
router.push({
path: "/productionManagement/productStructureDetail",
query: {
id: row.id,
bomNo: row.bomNo || "",
- productName: row.productCategory || "",
- productModelName: row.specificationModel || "",
+ productName: row.productName || "",
+ productModelName: row.model || "",
orderId: row.id,
type: "order",
},
});
};
+ // 鏌ョ湅鏉ユ簮鐢熶骇璁″垝鏁版嵁
+ const showSourceData = row => {
+ // 杩欓噷闇�瑕佹牴鎹疄闄呯殑API鍜岃矾鐢辫繘琛岃皟鏁�
+ // 鍋囪鐢熶骇璁㈠崟涓湁鐢熶骇璁″垝ID瀛楁锛屾瘮濡俻roductionPlanId
+ if (row.productionPlanId) {
+ // 璺宠浆鍒扮敓浜ц鍒掕鎯呴〉闈�
+ router.push({
+ path: "/productionManagement/productionPlan",
+ query: {
+ id: row.productionPlanId,
+ },
+ });
+ } else {
+ proxy.$modal.msgWarning("褰撳墠璁㈠崟娌℃湁鍏宠仈鐨勭敓浜ц鍒�");
+ }
+ };
+
// 琛ㄦ牸閫夋嫨鏁版嵁
- const handleSelectionChange = (selection) => {
+ const handleSelectionChange = selection => {
selectedRows.value = selection;
+ };
+ const handleDeleteSolo = row => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚��鍥烇紝鏄惁纭閫�鍥烇紵", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delProductOrder([row.id]).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
};
const handleDelete = () => {
let ids = [];
if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map((item) => item.id);
+ ids = selectedRows.value.map(item => item.id);
} else {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚��鍥烇紝鏄惁纭閫�鍥烇紵", "瀵煎嚭", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
- }).then(() => {
- delProductOrder(ids).then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
+ })
+ .then(() => {
+ delProductOrder(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
};
// 瀵煎嚭
@@ -436,7 +544,11 @@
type: "warning",
})
.then(() => {
- proxy.download("/productOrder/export", {...searchForm.value}, "鐢熶骇璁㈠崟.xlsx");
+ proxy.download(
+ "/productOrder/export",
+ { ...searchForm.value },
+ "鐢熶骇璁㈠崟.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -451,23 +563,23 @@
</script>
<style scoped lang="scss">
-.search_form{
- align-items: start;
-}
+ .search_form {
+ align-items: start;
+ }
-::v-deep .yellow {
- background-color: #FAF0DE;
-}
+ ::v-deep .yellow {
+ background-color: #faf0de;
+ }
-::v-deep .pink {
- background-color: #FAE1DE;
-}
+ ::v-deep .pink {
+ background-color: #fae1de;
+ }
-::v-deep .red {
- background-color: #f80202;
-}
+ ::v-deep .red {
+ background-color: #f80202;
+ }
-::v-deep .purple{
- background-color: #F4DEFA;
-}
+ ::v-deep .purple {
+ background-color: #f4defa;
+ }
</style>
--
Gitblit v1.9.3