From 384fb98c2d78e3ef2d37af24eb9da56a4e8be8da Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 23 三月 2026 11:17:56 +0800
Subject: [PATCH] Merge branch 'dev_银川_中盛建材' of http://114.132.189.42:9002/r/product-inventory-management into dev_银川_中盛建材
---
src/views/productionManagement/productionProcess/index.vue | 71
src/views/productionManagement/processRoute/index.vue | 86
src/views/productionManagement/productionReporting/index2.vue | 420 ++++
src/views/basicData/product/index.vue | 4
src/layout/components/Navbar.vue | 449 ++--
src/views/productionManagement/processRoute/processRouteItem/index.vue | 770 +++++++-
src/components/ProcessParamListDialog.vue | 211 +
src/api/productionManagement/productionOrder.js | 20
src/views/energyManagement/officeEnergyConsumption/index.vue | 1
src/views/productionManagement/productStructure/index.vue | 3
src/api/personnelManagement/class.js | 1
src/api/productionManagement/processRouteItem.js | 2
src/views/basicData/customerFile/index.vue | 30
src/views/productionManagement/processRoute/New.vue | 315 +-
src/api/productionManagement/productStructure.js | 19
src/views/energyManagement/productionEnergyConsumption/index.vue | 1
src/components/PIMTable/PIMTable.vue | 7
src/views/productionManagement/productStructure/StructureEdit.vue | 2
src/api/productionManagement/productProcessRoute.js | 46
src/views/productionManagement/productStructure/Detail/index.vue | 86
src/views/productionManagement/productionReporting/index.vue | 742 ++++---
src/views/personnelManagement/classsSheduling/index.vue | 2
src/views/productionManagement/productionOrder/index.vue | 979 ++++++++++-
src/views/productionPlan/productionPlan/index.vue | 142 +
src/views/productionManagement/productionReporting/components/ReportingDialog.vue | 588 ++++++
src/views/productionManagement/processRoute/Edit.vue | 174 -
src/views/productionManagement/processRoute/index2.vue | 10
27 files changed, 3,961 insertions(+), 1,220 deletions(-)
diff --git a/src/api/personnelManagement/class.js b/src/api/personnelManagement/class.js
index f5ae299..19f742f 100644
--- a/src/api/personnelManagement/class.js
+++ b/src/api/personnelManagement/class.js
@@ -71,6 +71,7 @@
url: "/personalShift/export",
method: "get",
params: query,
+ responseType: "blob",
});
}
diff --git a/src/api/productionManagement/processRouteItem.js b/src/api/productionManagement/processRouteItem.js
index e19556b..d8c16a1 100644
--- a/src/api/productionManagement/processRouteItem.js
+++ b/src/api/productionManagement/processRouteItem.js
@@ -60,7 +60,7 @@
data: data,
});
}
-// 宸ヨ壓璺嚎鍙傛暟淇敼
+// 宸ヨ壓璺嚎鍙傛暟鍒犻櫎
export function delProcessRouteItemParam(id) {
return request({
url: `/ProcessRouteItemParam/remove/${id}`,
diff --git a/src/api/productionManagement/productProcessRoute.js b/src/api/productionManagement/productProcessRoute.js
index e8d5da5..c926a28 100644
--- a/src/api/productionManagement/productProcessRoute.js
+++ b/src/api/productionManagement/productProcessRoute.js
@@ -4,16 +4,17 @@
// 鍒楄〃鏌ヨ
export function findProductProcessRouteItemList(query) {
return request({
- url: "/productProcessRoute/list",
+ url: `/productionOrderRouteItem/list/${query.orderId}`,
method: "get",
- params: query,
});
}
+
+
export function addOrUpdateProductProcessRouteItem(data) {
return request({
- url: "/productProcessRoute/updateRouteItem",
- method: "post",
+ url: "/productionOrderRouteItem/update",
+ method: "put",
data: data,
});
}
@@ -21,7 +22,7 @@
// 鐢熶骇璁㈠崟涓嬶細鏂板宸ヨ壓璺嚎椤圭洰
export function addRouteItem(data) {
return request({
- url: "/productProcessRoute/addRouteItem",
+ url: "/productionOrderRouteItem/add",
method: "post",
data,
});
@@ -39,7 +40,7 @@
// 鍒犻櫎宸ヨ壓璺嚎椤圭洰锛堣矾鐢卞悗鎷兼帴 id锛�
export function deleteRouteItem(id) {
return request({
- url: `/productProcessRoute/deleteRouteItem/${id}`,
+ url: `/productionOrderRouteItem/delete/${id}`,
method: "delete",
});
}
@@ -47,8 +48,39 @@
// 鐢熶骇璁㈠崟涓嬶細鎺掑簭宸ヨ壓璺嚎椤圭洰
export function sortRouteItem(data) {
return request({
- url: "/productProcessRoute/sortRouteItem",
+ url: "/productionOrderRouteItem/sort",
method: "post",
data,
});
}
+// 鑾峰彇宸ュ簭鍙傛暟鍒楄〃-鐢熶骇璁㈠崟
+export function findProcessParamListOrder(query) {
+ return request({
+ url: `/productionOrderRouteItemParam/list`,
+ method: "get",
+ params: query,
+ });
+}
+// 宸ヨ壓璺嚎鍙傛暟鏂板-鐢熶骇璁㈠崟
+export function addProcessRouteItemParamOrder(data) {
+ return request({
+ url: "/productionOrderRouteItemParam/add",
+ method: "post",
+ data: data,
+ });
+}
+// 宸ヨ壓璺嚎鍙傛暟淇敼-鐢熶骇璁㈠崟
+export function editProcessRouteItemParamOrder(data) {
+ return request({
+ url: "/productionOrderRouteItemParam/update",
+ method: "put",
+ data: data,
+ });
+}
+// 宸ヨ壓璺嚎鍙傛暟鍒犻櫎-鐢熶骇璁㈠崟
+export function delProcessRouteItemParamOrder(id) {
+ return request({
+ url: `/productionOrderRouteItemParam/delete/${id}`,
+ method: "delete",
+ });
+}
\ No newline at end of file
diff --git a/src/api/productionManagement/productStructure.js b/src/api/productionManagement/productStructure.js
index e69e14a..1e069de 100644
--- a/src/api/productionManagement/productStructure.js
+++ b/src/api/productionManagement/productStructure.js
@@ -11,8 +11,23 @@
export function add(data) {
return request({
- url: "/productStructure",
+ url: "/productStructure/"+data.bomId,
method: "post",
- data: data,
+ data: data.children,
+ });
+}
+// 鍒嗛〉鏌ヨ-浜у搧璁㈠崟
+export function queryList2(id) {
+ return request({
+ url: "/productionOrderStructure/getBomStructs/" + id,
+ method: "get",
+ });
+}
+
+export function add2(data) {
+ return request({
+ url: "/productionOrderStructure/addOrUpdateBomStructs/"+data.orderId,
+ method: "put",
+ data: data.children,
});
}
diff --git a/src/api/productionManagement/productionOrder.js b/src/api/productionManagement/productionOrder.js
index 6c8dbe2..89eb419 100644
--- a/src/api/productionManagement/productionOrder.js
+++ b/src/api/productionManagement/productionOrder.js
@@ -30,7 +30,7 @@
// 鐢熶骇璁㈠崟-缁戝畾宸ヨ壓璺嚎
export function bindingRoute(data) {
return request({
- url: "/productOrder/bindingRoute",
+ url: "/appendix/bindingRoute",
method: "post",
data,
});
@@ -44,14 +44,21 @@
data: data,
});
}
-
+//鐢熶骇璁㈠崟鍒犻櫎
export function delProductOrder(ids) {
return request({
url: `/productOrder/${ids}`,
method: "delete",
});
}
-
+//鐢熶骇璁㈠崟閫�鍥�
+export function revokeProductOrder(data) {
+ return request({
+ url: "/productOrder/revoke",
+ method: "post",
+ data: data,
+ });
+}
// 鐢熶骇璁㈠崟-鏌ヨ浜у搧缁撴瀯鍒楄〃
export function listProcessBom(query) {
return request({
@@ -129,4 +136,11 @@
method: "post",
data: data,
});
+}
+
+export function getProductOrderSource(id) {
+ return request({
+ url: `/productOrder/productOrderSource/${id}`,
+ method: "get",
+ });
}
\ No newline at end of file
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index 629e972..6fee5d6 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -22,7 +22,8 @@
<el-table-column align="center"
type="selection"
width="55"
- v-if="isSelection" />
+ v-if="isSelection"
+ :selectable="selectable" />
<el-table-column align="center"
label="搴忓彿"
type="index"
@@ -311,6 +312,10 @@
type: [String, Object],
default: () => ({ width: "100%" }),
},
+ selectable: {
+ type: Function,
+ default: () => true,
+ },
});
// Data
diff --git a/src/components/ProcessParamListDialog.vue b/src/components/ProcessParamListDialog.vue
index 3b9f158..16241f9 100644
--- a/src/components/ProcessParamListDialog.vue
+++ b/src/components/ProcessParamListDialog.vue
@@ -152,7 +152,9 @@
placeholder="璇疯緭鍏ユ帓搴�" />
</el-form-item>
<el-form-item label="鏄惁蹇呭~">
- <el-switch v-model="selectedParam.isRequired" />
+ <el-switch :active-value="true"
+ :inactive-value="false"
+ v-model="selectedParam.isRequired" />
</el-form-item>
</el-form>
<el-empty v-else
@@ -235,6 +237,12 @@
editProcessRouteItemParam,
addProcessRouteItemParam,
} from "@/api/productionManagement/processRouteItem.js";
+ import {
+ addProcessRouteItemParamOrder,
+ delProcessRouteItemParamOrder,
+ editProcessRouteItemParamOrder,
+ } from "@/api/productionManagement/productProcessRoute.js";
+
import { getBaseParamList } from "@/api/basicData/parameterMaintenance.js";
const props = defineProps({
@@ -261,6 +269,14 @@
editable: {
type: Boolean,
default: true,
+ },
+ orderId: {
+ type: Number,
+ default: 0,
+ },
+ pageType: {
+ type: String,
+ default: "route",
},
});
@@ -292,7 +308,7 @@
minValue: null,
maxValue: null,
sort: 1,
- isRequired: 0,
+ isRequired: false,
paramType: null,
paramFormat: "",
unit: "",
@@ -326,7 +342,7 @@
minValue: param.minValue,
maxValue: param.maxValue,
sort: param.sort || 1,
- isRequired: param.isRequired || 0,
+ isRequired: param.isRequired || false,
paramType: param.parameterType || param.paramType,
paramFormat: param.parameterFormat || param.paramFormat,
unit: param.unit || param.unit,
@@ -343,15 +359,27 @@
})
.then(() => {
// 璋冪敤API鍒犻櫎鍙傛暟
- delProcessRouteItemParam(param.id)
- .then(res => {
- ElMessage.success("鍒犻櫎鎴愬姛");
- emit("refresh");
- })
- .catch(err => {
- ElMessage.error("鍒犻櫎鍙傛暟澶辫触");
- console.error("鍒犻櫎鍙傛暟澶辫触锛�", err);
- });
+ if (props.pageType === "order") {
+ delProcessRouteItemParamOrder(param.id)
+ .then(res => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ emit("refresh");
+ })
+ .catch(err => {
+ ElMessage.error("鍒犻櫎鍙傛暟澶辫触");
+ console.error("鍒犻櫎鍙傛暟澶辫触锛�", err);
+ });
+ } else {
+ delProcessRouteItemParam(param.id)
+ .then(res => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ emit("refresh");
+ })
+ .catch(err => {
+ ElMessage.error("鍒犻櫎鍙傛暟澶辫触");
+ console.error("鍒犻櫎鍙傛暟澶辫触锛�", err);
+ });
+ }
})
.catch(() => {});
};
@@ -390,31 +418,63 @@
}
// 鍒ゆ柇鍙傛暟绫诲瀷锛屽彧鏈夋暟鍊肩被鍨嬫墠浼犳爣鍑嗗�笺�佹渶澶у�煎拰鏈�灏忓��
- const isNumericMode = selectedParam.value.valueMode === 1;
-
+ const isNumericMode = selectedParam.value.paramType == 1;
+ console.log(isNumericMode, "isNumericMode");
// 璋冪敤API鏂板鍙傛暟
- addProcessRouteItemParam({
- routeItemId: props.process.id,
- paramId: selectedParam.value.id,
- standardValue: isNumericMode ? selectedParam.value.standardValue || "" : "",
- minValue: isNumericMode ? selectedParam.value.minValue || 0 : null,
- maxValue: isNumericMode ? selectedParam.value.maxValue || 0 : null,
- isRequired: selectedParam.value.isRequired || 0,
- sort: selectedParam.value.sort || 1,
- })
- .then(res => {
- if (res.code === 200) {
- ElMessage.success("娣诲姞鍙傛暟鎴愬姛");
- selectParamDialogVisible.value = false;
- emit("refresh");
- } else {
- ElMessage.error(res.msg || "娣诲姞鍙傛暟澶辫触");
- }
+ if (props.pageType === "order") {
+ addProcessRouteItemParamOrder({
+ orderId: Number(props.orderId),
+ // processId: props.process.id,
+ routeItemId: props.process.id,
+ // routeItemId: Number(props.routeId),
+ paramId: selectedParam.value.id,
+ standardValue: isNumericMode
+ ? selectedParam.value.standardValue || ""
+ : "",
+ minValue: isNumericMode ? selectedParam.value.minValue || 0 : null,
+ maxValue: isNumericMode ? selectedParam.value.maxValue || 0 : null,
+ isRequired: selectedParam.value.isRequired || false,
+ sort: selectedParam.value.sort || 1,
})
- .catch(err => {
- ElMessage.error("娣诲姞鍙傛暟澶辫触");
- console.error("娣诲姞鍙傛暟澶辫触锛�", err);
- });
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("娣诲姞鍙傛暟鎴愬姛");
+ selectParamDialogVisible.value = false;
+ emit("refresh");
+ } else {
+ ElMessage.error(res.msg || "娣诲姞鍙傛暟澶辫触");
+ }
+ })
+ .catch(err => {
+ ElMessage.error("娣诲姞鍙傛暟澶辫触");
+ console.error("娣诲姞鍙傛暟澶辫触锛�", err);
+ });
+ } else {
+ addProcessRouteItemParam({
+ routeItemId: props.process.id,
+ paramId: selectedParam.value.id,
+ standardValue: isNumericMode
+ ? selectedParam.value.standardValue || ""
+ : "",
+ minValue: isNumericMode ? selectedParam.value.minValue || 0 : null,
+ maxValue: isNumericMode ? selectedParam.value.maxValue || 0 : null,
+ isRequired: selectedParam.value.isRequired || false,
+ sort: selectedParam.value.sort || 1,
+ })
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("娣诲姞鍙傛暟鎴愬姛");
+ selectParamDialogVisible.value = false;
+ emit("refresh");
+ } else {
+ ElMessage.error(res.msg || "娣诲姞鍙傛暟澶辫触");
+ }
+ })
+ .catch(err => {
+ ElMessage.error("娣诲姞鍙傛暟澶辫触");
+ console.error("娣诲姞鍙傛暟澶辫触锛�", err);
+ });
+ }
};
// 鎻愪氦缂栬緫鍙傛暟
@@ -423,33 +483,60 @@
editParamFormRef.value.validate(valid => {
if (valid) {
// 鍒ゆ柇鍙傛暟绫诲瀷锛屽彧鏈夋暟鍊肩被鍨嬫墠浼犳爣鍑嗗�笺�佹渶澶у�煎拰鏈�灏忓��
- const isNumericMode = editParamForm.value.valueMode == 1;
-
- // 璋冪敤API淇敼鍙傛暟
- editProcessRouteItemParam({
- id: editParamForm.value.id,
- routeItemId: props.process.id,
- paramId: editParamForm.value.paramId,
- standardValue: isNumericMode
- ? editParamForm.value.standardValue || ""
- : "",
- minValue: isNumericMode ? editParamForm.value.minValue || 0 : null,
- maxValue: isNumericMode ? editParamForm.value.maxValue || 0 : null,
- isRequired: editParamForm.value.isRequired || 0,
- })
- .then(res => {
- if (res.code === 200) {
- ElMessage.success("缂栬緫鎴愬姛");
- editParamDialogVisible.value = false;
- emit("refresh");
- } else {
- ElMessage.error(res.msg || "缂栬緫澶辫触");
- }
+ const isNumericMode = editParamForm.value.paramType == 1;
+ console.log(isNumericMode, "isNumericMode");
+ if (props.pageType === "order") {
+ editProcessRouteItemParamOrder({
+ id: editParamForm.value.id,
+ // routeItemId: props.process.id,
+ // paramId: editParamForm.value.paramId,
+ standardValue: isNumericMode
+ ? editParamForm.value.standardValue || ""
+ : "",
+ minValue: isNumericMode ? editParamForm.value.minValue || 0 : null,
+ maxValue: isNumericMode ? editParamForm.value.maxValue || 0 : null,
+ isRequired: editParamForm.value.isRequired || false,
})
- .catch(err => {
- ElMessage.error("缂栬緫鍙傛暟澶辫触");
- console.error("缂栬緫鍙傛暟澶辫触锛�", err);
- });
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("缂栬緫鎴愬姛");
+ editParamDialogVisible.value = false;
+ emit("refresh");
+ } else {
+ ElMessage.error(res.msg || "缂栬緫澶辫触");
+ }
+ })
+ .catch(err => {
+ ElMessage.error("缂栬緫鍙傛暟澶辫触");
+ console.error("缂栬緫鍙傛暟澶辫触锛�", err);
+ });
+ } else {
+ // 璋冪敤API淇敼鍙傛暟
+ editProcessRouteItemParam({
+ id: editParamForm.value.id,
+ routeItemId: props.process.id,
+ paramId: editParamForm.value.paramId,
+ standardValue: isNumericMode
+ ? editParamForm.value.standardValue || ""
+ : "",
+ minValue: isNumericMode ? editParamForm.value.minValue || 0 : null,
+ maxValue: isNumericMode ? editParamForm.value.maxValue || 0 : null,
+ isRequired: editParamForm.value.isRequired || false,
+ })
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("缂栬緫鎴愬姛");
+ editParamDialogVisible.value = false;
+ emit("refresh");
+ } else {
+ ElMessage.error(res.msg || "缂栬緫澶辫触");
+ }
+ })
+ .catch(err => {
+ ElMessage.error("缂栬緫鍙傛暟澶辫触");
+ console.error("缂栬緫鍙傛暟澶辫触锛�", err);
+ });
+ }
}
});
};
@@ -497,7 +584,7 @@
minValue: null,
maxValue: null,
sort: 1,
- isRequired: 0,
+ isRequired: false,
paramType: null,
paramFormat: "",
unit: "",
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index d4e938d..25d9432 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -1,39 +1,45 @@
<template>
<div class="navbar">
<div>
- <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" />
+ <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" />
</div>
<!-- <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />-->
<div class="right-menu">
<!-- 娑堟伅閫氱煡 -->
- <el-popover
- v-model:visible="notificationVisible"
- :width="500"
- placement="bottom-end"
- trigger="click"
- :popper-options="{ modifiers: [{ name: 'offset', options: { offset: [0, 10] } }] }"
- popper-class="notification-popover"
- >
+ <el-popover v-model:visible="notificationVisible"
+ :width="500"
+ placement="bottom-end"
+ trigger="click"
+ :popper-options="{ modifiers: [{ name: 'offset', options: { offset: [0, 10] } }] }"
+ popper-class="notification-popover">
<template #reference>
<div class="notification-container right-menu-item hover-effect">
- <el-badge :value="unreadCount" :hidden="unreadCount === 0" class="notification-badge">
- <el-icon :size="20" style="cursor: pointer;">
+ <el-badge :value="unreadCount"
+ :hidden="unreadCount === 0"
+ class="notification-badge">
+ <el-icon :size="20"
+ style="cursor: pointer;">
<Bell />
</el-icon>
</el-badge>
</div>
</template>
- <NotificationCenter
- @unreadCountChange="handleUnreadCountChange"
- ref="notificationCenterRef"
- />
+ <NotificationCenter @unreadCountChange="handleUnreadCountChange"
+ ref="notificationCenterRef" />
</el-popover>
<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" />
+ <img :src="userStore.avatar"
+ class="user-avatar" />
<el-icon><caret-bottom /></el-icon>
</div>
<template #dropdown>
@@ -41,10 +47,12 @@
<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">
+ <el-dropdown-item divided
+ command="logout">
<span>閫�鍑虹櫥褰�</span>
</el-dropdown-item>
</el-dropdown-menu>
@@ -56,237 +64,238 @@
</template>
<script setup>
-import { ElMessageBox } from 'element-plus'
-import { Bell } from '@element-plus/icons-vue'
-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 NotificationCenter from './NotificationCenter/index.vue'
-import useAppStore from '@/store/modules/app'
-import useUserStore from '@/store/modules/user'
-import useSettingsStore from '@/store/modules/settings'
+ import { ElMessageBox } from "element-plus";
+ import { Bell } from "@element-plus/icons-vue";
+ 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 NotificationCenter from "./NotificationCenter/index.vue";
+ 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 notificationVisible = ref(false)
-const notificationCenterRef = ref(null)
-const unreadCount = ref(0)
-function toggleSideBar() {
- appStore.toggleSideBar()
-}
-// const redirect = ref(undefined)
-// watch(route, (newRoute) => {
-// redirect.value = newRoute.query && newRoute.query.redirect
-// }, { immediate: true })
-
-function handleCommand(command) {
- switch (command) {
- case "setLayout":
- setLayout()
- break
- case "logout":
- logout()
- break
- default:
- break
+ const appStore = useAppStore();
+ const userStore = useUserStore();
+ const settingsStore = useSettingsStore();
+ const notificationVisible = ref(false);
+ const notificationCenterRef = ref(null);
+ const unreadCount = ref(0);
+ function toggleSideBar() {
+ appStore.toggleSideBar();
}
-}
+ // const redirect = ref(undefined)
+ // watch(route, (newRoute) => {
+ // redirect.value = newRoute.query && newRoute.query.redirect
+ // }, { immediate: true })
-function logout() {
- ElMessageBox.confirm('纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- userStore.logOut().then(() => {
- location.href = '/index'
+ function handleCommand(command) {
+ switch (command) {
+ case "setLayout":
+ setLayout();
+ break;
+ case "logout":
+ logout();
+ break;
+ default:
+ break;
+ }
+ }
+
+ function logout() {
+ ElMessageBox.confirm("纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- }).catch(() => { })
-}
+ .then(() => {
+ userStore.logOut().then(() => {
+ location.href = "/index";
+ });
+ })
+ .catch(() => {});
+ }
-const emits = defineEmits(['setLayout'])
-function setLayout() {
- emits('setLayout')
-}
+ const emits = defineEmits(["setLayout"]);
+ function setLayout() {
+ emits("setLayout");
+ }
-function toggleTheme() {
- settingsStore.toggleTheme()
-}
+ function toggleTheme() {
+ settingsStore.toggleTheme();
+ }
-// 娑堟伅閫氱煡鐩稿叧
-function handleUnreadCountChange(count) {
- unreadCount.value = count
-}
+ // 娑堟伅閫氱煡鐩稿叧
+ function handleUnreadCountChange(count) {
+ unreadCount.value = count;
+ }
-// 缁勪欢鎸傝浇鏃跺姞杞芥湭璇绘暟閲忓拰瀹氭椂鍒锋柊
-let unreadCountTimer = null
-onMounted(() => {
- // 寤惰繜鍔犺浇锛岀‘淇濈粍浠跺凡娓叉煋
- nextTick(() => {
- if (notificationCenterRef.value) {
- notificationCenterRef.value.loadUnreadCount()
- }
- })
- // 瀹氭椂鍒锋柊鏈鏁伴噺锛堟瘡30绉掞級
- unreadCountTimer = setInterval(() => {
- if (notificationCenterRef.value) {
- notificationCenterRef.value.loadUnreadCount()
- }
- }, 30000)
-})
-
-// 鐩戝惉 popover 鏄剧ず鐘舵�侊紝鎵撳紑鏃跺姞杞芥秷鎭垪琛�
-watch(notificationVisible, (val) => {
- if (val && notificationCenterRef.value) {
+ // 缁勪欢鎸傝浇鏃跺姞杞芥湭璇绘暟閲忓拰瀹氭椂鍒锋柊
+ let unreadCountTimer = null;
+ onMounted(() => {
+ // 寤惰繜鍔犺浇锛岀‘淇濈粍浠跺凡娓叉煋
nextTick(() => {
- notificationCenterRef.value.loadMessages()
- })
- }
-})
+ if (notificationCenterRef.value) {
+ notificationCenterRef.value.loadUnreadCount();
+ }
+ });
+ // 瀹氭椂鍒锋柊鏈鏁伴噺锛堟瘡30绉掞級
+ // unreadCountTimer = setInterval(() => {
+ // if (notificationCenterRef.value) {
+ // notificationCenterRef.value.loadUnreadCount()
+ // }
+ // }, 30000)
+ });
-onUnmounted(() => {
- if (unreadCountTimer) {
- clearInterval(unreadCountTimer)
- }
-})
+ // 鐩戝惉 popover 鏄剧ず鐘舵�侊紝鎵撳紑鏃跺姞杞芥秷鎭垪琛�
+ watch(notificationVisible, val => {
+ if (val && notificationCenterRef.value) {
+ nextTick(() => {
+ notificationCenterRef.value.loadMessages();
+ });
+ }
+ });
+
+ onUnmounted(() => {
+ if (unreadCountTimer) {
+ clearInterval(unreadCountTimer);
+ }
+ });
</script>
<style lang='scss' scoped>
-.navbar {
- height: 50px;
- overflow: hidden;
- position: relative;
- background: var(--navbar-bg);
- box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
+ .navbar {
+ height: 50px;
+ overflow: hidden;
+ position: relative;
+ background: var(--navbar-bg);
+ box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
- .hamburger-container {
- line-height: 46px;
- height: 100%;
- float: left;
- cursor: pointer;
- transition: background 0.3s;
- -webkit-tap-highlight-color: transparent;
-
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
-
- .breadcrumb-container {
- float: left;
- }
-
- .topmenu-container {
- position: absolute;
- left: 50px;
- }
-
- .errLog-container {
- display: inline-block;
- vertical-align: top;
- }
-
- .right-menu {
- float: right;
- height: 100%;
- line-height: 50px;
- display: flex;
-
- &:focus {
- outline: none;
- }
-
- .right-menu-item {
- display: inline-block;
- padding: 0 8px;
+ .hamburger-container {
+ line-height: 46px;
height: 100%;
- font-size: 18px;
- color: var(--navbar-text);
- vertical-align: text-bottom;
+ float: left;
+ cursor: pointer;
+ transition: background 0.3s;
+ -webkit-tap-highlight-color: transparent;
- &.hover-effect {
- cursor: pointer;
- transition: background 0.3s;
+ &:hover {
+ background: rgba(0, 0, 0, 0.025);
+ }
+ }
- &:hover {
- background: rgba(0, 0, 0, 0.025);
+ .breadcrumb-container {
+ float: left;
+ }
+
+ .topmenu-container {
+ position: absolute;
+ left: 50px;
+ }
+
+ .errLog-container {
+ display: inline-block;
+ vertical-align: top;
+ }
+
+ .right-menu {
+ float: right;
+ height: 100%;
+ line-height: 50px;
+ display: flex;
+
+ &:focus {
+ outline: none;
+ }
+
+ .right-menu-item {
+ display: inline-block;
+ padding: 0 8px;
+ height: 100%;
+ font-size: 18px;
+ color: var(--navbar-text);
+ vertical-align: text-bottom;
+
+ &.hover-effect {
+ cursor: pointer;
+ transition: background 0.3s;
+
+ &:hover {
+ background: rgba(0, 0, 0, 0.025);
+ }
+ }
+
+ &.theme-switch-wrapper {
+ display: flex;
+ align-items: center;
+
+ svg {
+ transition: transform 0.3s;
+
+ &:hover {
+ transform: scale(1.15);
+ }
+ }
}
}
- &.theme-switch-wrapper {
+ .notification-container {
+ margin-right: 20px;
display: flex;
align-items: center;
+ cursor: pointer;
- svg {
- transition: transform 0.3s;
+ .notification-badge {
+ :deep(.el-badge__content) {
+ border: none;
+ }
+ }
+ }
- &:hover {
- transform: scale(1.15);
+ .avatar-container {
+ margin-right: 40px;
+
+ .avatar-wrapper {
+ margin-top: 5px;
+ position: relative;
+
+ .user-avatar {
+ cursor: pointer;
+ width: 40px;
+ height: 40px;
+ border-radius: 50px;
+ }
+
+ i {
+ cursor: pointer;
+ position: absolute;
+ right: -20px;
+ top: 14px;
+ font-size: 12px;
}
}
}
}
-
- .notification-container {
- margin-right: 20px;
- display: flex;
- align-items: center;
- cursor: pointer;
-
- .notification-badge {
- :deep(.el-badge__content) {
- border: none;
- }
- }
- }
-
- .avatar-container {
- margin-right: 40px;
-
- .avatar-wrapper {
- margin-top: 5px;
- position: relative;
-
- .user-avatar {
- cursor: pointer;
- width: 40px;
- height: 40px;
- border-radius: 50px;
- }
-
- i {
- cursor: pointer;
- position: absolute;
- right: -20px;
- top: 14px;
- font-size: 12px;
- }
- }
- }
}
-}
-
</style>
<style lang="scss">
-.notification-popover {
- padding: 0 !important;
-
- .el-popover__title {
- display: none;
- }
-
- .el-popover__body {
+ .notification-popover {
padding: 0 !important;
+
+ .el-popover__title {
+ display: none;
+ }
+
+ .el-popover__body {
+ padding: 0 !important;
+ }
}
-}
-.el-badge__content.is-fixed{
- top: 12px;
-}
+ .el-badge__content.is-fixed {
+ top: 12px;
+ }
</style>
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 16aec98..eb0b6a7 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -784,7 +784,7 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 250,
+ width: 150,
operation: [
{
name: "缂栬緫",
@@ -800,20 +800,20 @@
openDetailDialog(row);
},
},
- {
- name: "鍥炶鎻愰啋",
- type: "text",
- clickFun: row => {
- openReminderDialog(row);
- },
- },
- {
- name: "娣诲姞娲借皥杩涘害",
- type: "text",
- clickFun: row => {
- openNegotiationDialog(row);
- },
- },
+ // {
+ // name: "鍥炶鎻愰啋",
+ // type: "text",
+ // clickFun: row => {
+ // openReminderDialog(row);
+ // },
+ // },
+ // {
+ // name: "娣诲姞娲借皥杩涘害",
+ // type: "text",
+ // clickFun: row => {
+ // openNegotiationDialog(row);
+ // },
+ // },
],
},
]);
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 45931bc..954d01e 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -913,8 +913,8 @@
gap: 20px;
}
.left {
- width: 465px;
- min-width: 465px;
+ width: 35%;
+ min-width: 35%;
background: #ffffff;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
diff --git a/src/views/energyManagement/officeEnergyConsumption/index.vue b/src/views/energyManagement/officeEnergyConsumption/index.vue
index 0def5d5..71ceb18 100644
--- a/src/views/energyManagement/officeEnergyConsumption/index.vue
+++ b/src/views/energyManagement/officeEnergyConsumption/index.vue
@@ -1049,7 +1049,6 @@
}
.search_form {
:deep(.el-form-item) {
- margin-bottom: 0px !important;
}
}
</style>
diff --git a/src/views/energyManagement/productionEnergyConsumption/index.vue b/src/views/energyManagement/productionEnergyConsumption/index.vue
index cf8784f..00f4cac 100644
--- a/src/views/energyManagement/productionEnergyConsumption/index.vue
+++ b/src/views/energyManagement/productionEnergyConsumption/index.vue
@@ -1049,7 +1049,6 @@
}
.search_form {
:deep(.el-form-item) {
- margin-bottom: 0px !important;
}
}
</style>
diff --git a/src/views/personnelManagement/classsSheduling/index.vue b/src/views/personnelManagement/classsSheduling/index.vue
index 99c19bb..49038e4 100644
--- a/src/views/personnelManagement/classsSheduling/index.vue
+++ b/src/views/personnelManagement/classsSheduling/index.vue
@@ -974,7 +974,7 @@
.user-stats {
/* display: flex; */
/* flex-wrap: wrap;
- gap: 10px; */
+ gap: 10px; */
margin-bottom: 4px;
}
diff --git a/src/views/productionManagement/processRoute/Edit.vue b/src/views/productionManagement/processRoute/Edit.vue
index 53d8395..4ce5098 100644
--- a/src/views/productionManagement/processRoute/Edit.vue
+++ b/src/views/productionManagement/processRoute/Edit.vue
@@ -8,21 +8,25 @@
:model="formState"
label-position="top"
ref="formRef">
- <el-form-item label="浜у搧鍚嶇О"
- prop="productModelId"
+ <el-form-item label="浜у搧绫诲瀷"
+ prop="dictCode"
:rules="[
{
required: true,
- message: '璇烽�夋嫨浜у搧',
+ message: '璇烽�夋嫨浜у搧绫诲瀷',
trigger: 'change',
}
]">
- <el-button type="primary"
- @click="showProductSelectDialog = true">
- {{ formState.productName && formState.productModelName
- ? `${formState.productName} - ${formState.productModelName}`
- : '閫夋嫨浜у搧' }}
- </el-button>
+ <el-select v-model="formState.dictCode"
+ placeholder="璇烽�夋嫨浜у搧绫诲瀷"
+ clearable
+ style="width: 100%"
+ @change="handleProductTypeChange">
+ <el-option v-for="item in productTypeOptions"
+ :key="item.dictCode"
+ :label="item.dictLabel"
+ :value="item.dictCode" />
+ </el-select>
</el-form-item>
<el-form-item label="BOM"
prop="bomId"
@@ -36,7 +40,7 @@
<el-select v-model="formState.bomId"
placeholder="璇烽�夋嫨BOM"
clearable
- :disabled="!formState.productModelId || bomOptions.length === 0"
+ :disabled="!formState.dictCode || bomOptions.length === 0"
style="width: 100%">
<el-option v-for="item in bomOptions"
:key="item.id"
@@ -50,10 +54,7 @@
type="textarea" />
</el-form-item>
</el-form>
- <!-- 浜у搧閫夋嫨寮圭獥 -->
- <ProductSelectDialog v-model="showProductSelectDialog"
- @confirm="handleProductSelect"
- single />
+
<template #footer>
<div class="dialog-footer">
<el-button type="primary"
@@ -75,8 +76,8 @@
watch,
} from "vue";
import { update } from "@/api/productionManagement/processRoute.js";
- import { getByModel } from "@/api/productionManagement/productBom.js";
- import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+ import { listPage } from "@/api/productionManagement/productBom.js";
+ import { getDicts } from "@/api/system/dict/data.js";
const props = defineProps({
visible: {
@@ -94,10 +95,8 @@
// 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
const formState = ref({
- productId: undefined,
- productModelId: undefined,
- productName: "",
- productModelName: "",
+ dictCode: undefined,
+ dictLabel: "",
bomId: undefined,
description: "",
});
@@ -111,10 +110,48 @@
},
});
- const showProductSelectDialog = ref(false);
+ const productTypeOptions = ref([]);
const bomOptions = ref([]);
let { proxy } = getCurrentInstance();
+
+ // 鑾峰彇浜у搧绫诲瀷瀛楀吀
+ const getProductTypeOptions = () => {
+ getDicts("product_type")
+ .then(res => {
+ if (res.code === 200) {
+ productTypeOptions.value = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇浜у搧绫诲瀷瀛楀吀澶辫触锛�", err);
+ });
+ };
+
+ // 鏍规嵁浜у搧绫诲瀷鑾峰彇BOM鍒楄〃
+ const getBomListByProductType = async dictCode => {
+ if (!dictCode) {
+ bomOptions.value = [];
+ return;
+ }
+ try {
+ // 浣跨敤listPage鎺ュ彛锛屾牴鎹甦ictCode鏌ヨBOM
+ const res = await listPage({ dictCode });
+ // 澶勭悊杩斿洖鐨凚OM鏁版嵁
+ let bomList = [];
+ if (res.data && res.data.records) {
+ bomList = res.data.records;
+ }
+ bomOptions.value = bomList;
+ if (bomList.length === 0) {
+ proxy.$modal.msgError("璇ヤ骇鍝佺被鍨嬫病鏈塀OM锛岃鍏堝垱寤築OM");
+ }
+ } catch (error) {
+ // 濡傛灉鎺ュ彛杩斿洖404鎴栧叾浠栭敊璇紝璇存槑娌℃湁BOM
+ proxy.$modal.msgError("璇ヤ骇鍝佺被鍨嬫病鏈塀OM锛岃鍏堝垱寤築OM");
+ bomOptions.value = [];
+ }
+ };
const closeModal = () => {
isShow.value = false;
@@ -125,94 +162,42 @@
if (props.record) {
formState.value = {
...props.record,
- productId: props.record.productId,
- productModelId: props.record.productModelId,
- productName: props.record.productName || "",
- // 娉ㄦ剰锛歳ecord涓殑瀛楁鏄痬odel锛岄渶瑕佹槧灏勫埌productModelName
- productModelName:
- props.record.model || props.record.productModelName || "",
+ dictCode: props.record.dictCode,
+ dictLabel: props.record.dictLabel || "",
bomId: props.record.bomId,
description: props.record.description || "",
};
- // 濡傛灉鏈変骇鍝佸瀷鍙稩D锛屽姞杞紹OM鍒楄〃
- if (props.record.productModelId) {
- loadBomList(props.record.productModelId);
+ // 濡傛灉鏈変骇鍝佺被鍨嬶紝鍔犺浇BOM鍒楄〃
+ if (props.record.dictCode) {
+ getBomListByProductType(props.record.dictCode);
}
}
};
- // 鍔犺浇BOM鍒楄〃
- const loadBomList = async productModelId => {
- if (!productModelId) {
- bomOptions.value = [];
- return;
- }
- try {
- const res = await getByModel(productModelId);
- // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
- let bomList = [];
- if (Array.isArray(res)) {
- bomList = res;
- } else if (res && res.data) {
- bomList = Array.isArray(res.data) ? res.data : [res.data];
- } else if (res && typeof res === "object") {
- bomList = [res];
+ // 浜у搧绫诲瀷閫夋嫨澶勭悊
+ const handleProductTypeChange = async dictCode => {
+ if (dictCode) {
+ const selectedType = productTypeOptions.value.find(item => item.dictCode === dictCode);
+ if (selectedType) {
+ formState.value.dictLabel = selectedType.dictLabel;
}
- bomOptions.value = bomList;
- } catch (error) {
- console.error("鍔犺浇BOM鍒楄〃澶辫触锛�", error);
+ // 濡傛灉褰撳墠閫夋嫨鐨凚OM涓嶅湪鏂板垪琛ㄤ腑锛屽垯閲嶇疆BOM閫夋嫨
+ formState.value.bomId = undefined;
+ await getBomListByProductType(dictCode);
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField("dictCode");
+ } else {
+ formState.value.dictLabel = "";
bomOptions.value = [];
- }
- };
-
- // 浜у搧閫夋嫨澶勭悊
- const handleProductSelect = async products => {
- if (products && products.length > 0) {
- const product = products[0];
- // 鍏堟煡璇OM鍒楄〃锛堝繀閫夛級
- try {
- const res = await getByModel(product.id);
- // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
- let bomList = [];
- if (Array.isArray(res)) {
- bomList = res;
- } else if (res && res.data) {
- bomList = Array.isArray(res.data) ? res.data : [res.data];
- } else if (res && typeof res === "object") {
- bomList = [res];
- }
-
- if (bomList.length > 0) {
- formState.value.productModelId = product.id;
- formState.value.productName = product.productName;
- formState.value.productModelName = product.model;
- // 濡傛灉褰撳墠閫夋嫨鐨凚OM涓嶅湪鏂板垪琛ㄤ腑锛屽垯閲嶇疆BOM閫夋嫨
- const currentBomExists = bomList.some(
- bom => bom.id === formState.value.bomId
- );
- if (!currentBomExists) {
- formState.value.bomId = undefined;
- }
- bomOptions.value = bomList;
- showProductSelectDialog.value = false;
- // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
- proxy.$refs["formRef"]?.validateField("productModelId");
- } else {
- proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
- }
- } catch (error) {
- // 濡傛灉鎺ュ彛杩斿洖404鎴栧叾浠栭敊璇紝璇存槑娌℃湁BOM
- proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
- }
}
};
const handleSubmit = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
- // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰BOM
- if (!formState.value.productModelId) {
- proxy.$modal.msgError("璇烽�夋嫨浜у搧");
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佺被鍨嬪拰BOM
+ if (!formState.value.dictCode) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧绫诲瀷");
return;
}
if (!formState.value.bomId) {
@@ -250,6 +235,7 @@
);
onMounted(() => {
+ getProductTypeOptions();
if (props.visible && props.record) {
setFormData();
}
diff --git a/src/views/productionManagement/processRoute/New.vue b/src/views/productionManagement/processRoute/New.vue
index 62c6873..981ae89 100644
--- a/src/views/productionManagement/processRoute/New.vue
+++ b/src/views/productionManagement/processRoute/New.vue
@@ -1,71 +1,67 @@
<template>
<div>
- <el-dialog
- v-model="isShow"
- title="鏂板宸ヨ壓璺嚎"
- width="400"
- @close="closeModal"
- >
- <el-form label-width="140px" :model="formState" label-position="top" ref="formRef">
- <el-form-item
- label="浜у搧鍚嶇О"
- prop="productModelId"
- :rules="[
+ <el-dialog v-model="isShow"
+ title="鏂板宸ヨ壓璺嚎"
+ width="400"
+ @close="closeModal">
+ <el-form label-width="140px"
+ :model="formState"
+ label-position="top"
+ ref="formRef">
+ <el-form-item label="浜у搧绫诲瀷"
+ prop="dictCode"
+ :rules="[
{
required: true,
- message: '璇烽�夋嫨浜у搧',
+ message: '璇烽�夋嫨浜у搧绫诲瀷',
trigger: 'change',
}
- ]"
- >
- <el-button type="primary" @click="showProductSelectDialog = true">
- {{ formState.productName && formState.productModelName
- ? `${formState.productName} - ${formState.productModelName}`
- : '閫夋嫨浜у搧' }}
- </el-button>
+ ]">
+ <el-select v-model="formState.dictCode"
+ placeholder="璇烽�夋嫨浜у搧绫诲瀷"
+ clearable
+ style="width: 100%"
+ @change="handleProductTypeChange">
+ <el-option v-for="item in productTypeOptions"
+ :key="item.dictCode"
+ :label="item.dictLabel"
+ :value="item.dictCode" />
+ </el-select>
</el-form-item>
-
- <el-form-item
- label="BOM"
- prop="bomId"
- :rules="[
+ <el-form-item label="BOM"
+ prop="bomId"
+ :rules="[
{
required: true,
message: '璇烽�夋嫨BOM',
trigger: 'change',
}
- ]"
- >
- <el-select
- v-model="formState.bomId"
- placeholder="璇烽�夋嫨BOM"
- clearable
- :disabled="!formState.productModelId || bomOptions.length === 0"
- style="width: 100%"
- >
- <el-option
- v-for="item in bomOptions"
- :key="item.id"
- :label="item.bomNo || `BOM-${item.id}`"
- :value="item.id"
- />
+ ]">
+ <el-select v-model="formState.bomId"
+ placeholder="璇烽�夋嫨BOM"
+ clearable
+ :disabled="!formState.dictCode || bomOptions.length === 0"
+ style="width: 100%">
+ <el-option v-for="item in bomOptions"
+ :key="item.id"
+ :label="item.bomNo || `BOM-${item.id}`"
+ :value="item.id" />
</el-select>
</el-form-item>
-
- <el-form-item label="澶囨敞" prop="description">
- <el-input v-model="formState.description" type="textarea" />
+ <el-form-item label="澶囨敞"
+ prop="description">
+ <el-input v-model="formState.description"
+ type="textarea" />
</el-form-item>
</el-form>
-
<!-- 浜у搧閫夋嫨寮圭獥 -->
- <ProductSelectDialog
- v-model="showProductSelectDialog"
- @confirm="handleProductSelect"
- single
- />
+ <ProductSelectDialog v-model="showProductSelectDialog"
+ @confirm="handleProductSelect"
+ single />
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="handleSubmit">纭</el-button>
+ <el-button type="primary"
+ @click="handleSubmit">纭</el-button>
<el-button @click="closeModal">鍙栨秷</el-button>
</div>
</template>
@@ -74,121 +70,142 @@
</template>
<script setup>
-import {ref, computed, getCurrentInstance} from "vue";
-import {add} from "@/api/productionManagement/processRoute.js";
-import {getByModel} from "@/api/productionManagement/productBom.js";
-import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+ import { ref, computed, getCurrentInstance, onMounted } from "vue";
+ import { add } from "@/api/productionManagement/processRoute.js";
+ import { listPage } from "@/api/productionManagement/productBom.js";
+ import { getDicts } from "@/api/system/dict/data.js";
-const props = defineProps({
- visible: {
- type: Boolean,
- required: true,
- },
-});
+ const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+ });
-const emit = defineEmits(['update:visible', 'completed']);
+ const emit = defineEmits(["update:visible", "completed"]);
-// 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
-const formState = ref({
- productId: undefined,
- productModelId: undefined,
- productName: "",
- productModelName: "",
- bomId: undefined,
- description: '',
-});
-
-const isShow = computed({
- get() {
- return props.visible;
- },
- set(val) {
- emit('update:visible', val);
- },
-});
-
-const showProductSelectDialog = ref(false);
-const bomOptions = ref([]);
-
-let { proxy } = getCurrentInstance()
-
-const closeModal = () => {
- // 閲嶇疆琛ㄥ崟鏁版嵁
- formState.value = {
- productId: undefined,
- productModelId: undefined,
- productName: "",
- productModelName: "",
+ // 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
+ const formState = ref({
+ dictCode: undefined,
+ dictLabel: "",
bomId: undefined,
- description: '',
- };
- bomOptions.value = [];
- isShow.value = false;
-};
+ description: "",
+ });
-// 浜у搧閫夋嫨澶勭悊
-const handleProductSelect = async (products) => {
- if (products && products.length > 0) {
- const product = products[0];
- // 鍏堟煡璇OM鍒楄〃锛堝繀閫夛級
+ const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit("update:visible", val);
+ },
+ });
+
+ const productTypeOptions = ref([]);
+ const bomOptions = ref([]);
+
+ let { proxy } = getCurrentInstance();
+
+ // 鑾峰彇浜у搧绫诲瀷瀛楀吀
+ const getProductTypeOptions = () => {
+ getDicts("product_type")
+ .then(res => {
+ if (res.code === 200) {
+ productTypeOptions.value = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇浜у搧绫诲瀷瀛楀吀澶辫触锛�", err);
+ });
+ };
+
+ // 鏍规嵁浜у搧绫诲瀷鑾峰彇BOM鍒楄〃
+ const getBomListByProductType = async dictCode => {
+ if (!dictCode) {
+ bomOptions.value = [];
+ return;
+ }
try {
- const res = await getByModel(product.id);
- // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
+ // 浣跨敤listPage鎺ュ彛锛屾牴鎹甦ictCode鏌ヨBOM
+ const res = await listPage({ dictCode });
+ // 澶勭悊杩斿洖鐨凚OM鏁版嵁
let bomList = [];
- if (Array.isArray(res)) {
- bomList = res;
- } else if (res && res.data) {
- bomList = Array.isArray(res.data) ? res.data : [res.data];
- } else if (res && typeof res === 'object') {
- bomList = [res];
+ if (res.data && res.data.records) {
+ bomList = res.data.records;
}
-
- if (bomList.length > 0) {
- formState.value.productModelId = product.id;
- formState.value.productName = product.productName;
- formState.value.productModelName = product.model;
- formState.value.bomId = undefined; // 閲嶇疆BOM閫夋嫨
- bomOptions.value = bomList;
- showProductSelectDialog.value = false;
- // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
- proxy.$refs["formRef"]?.validateField('productModelId');
- } else {
- proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
+ bomOptions.value = bomList;
+ if (bomList.length === 0) {
+ proxy.$modal.msgError("璇ヤ骇鍝佺被鍨嬫病鏈塀OM锛岃鍏堝垱寤築OM");
}
} catch (error) {
// 濡傛灉鎺ュ彛杩斿洖404鎴栧叾浠栭敊璇紝璇存槑娌℃湁BOM
- proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
+ proxy.$modal.msgError("璇ヤ骇鍝佺被鍨嬫病鏈塀OM锛岃鍏堝垱寤築OM");
+ bomOptions.value = [];
}
- }
-};
+ };
-const handleSubmit = () => {
- proxy.$refs["formRef"].validate(valid => {
- if (valid) {
- // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰BOM
- if (!formState.value.productModelId) {
- proxy.$modal.msgError("璇烽�夋嫨浜у搧");
- return;
+ const closeModal = () => {
+ // 閲嶇疆琛ㄥ崟鏁版嵁
+ formState.value = {
+ dictCode: undefined,
+ dictLabel: "",
+ bomId: undefined,
+ description: "",
+ };
+ bomOptions.value = [];
+ isShow.value = false;
+ };
+
+ // 浜у搧绫诲瀷閫夋嫨澶勭悊
+ const handleProductTypeChange = async dictCode => {
+ if (dictCode) {
+ const selectedType = productTypeOptions.value.find(
+ item => item.dictCode === dictCode
+ );
+ if (selectedType) {
+ formState.value.dictLabel = selectedType.dictLabel;
}
- if (!formState.value.bomId) {
- proxy.$modal.msgError("璇烽�夋嫨BOM");
- return;
- }
- add(formState.value).then(res => {
- // 鍏抽棴妯℃�佹
- isShow.value = false;
- // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
- emit('completed');
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- })
+ formState.value.bomId = undefined; // 閲嶇疆BOM閫夋嫨
+ await getBomListByProductType(dictCode);
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField("dictCode");
+ } else {
+ formState.value.dictLabel = "";
+ bomOptions.value = [];
}
- })
-};
+ };
+ const handleSubmit = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佺被鍨嬪拰BOM
+ if (!formState.value.dictCode) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧绫诲瀷");
+ return;
+ }
+ if (!formState.value.bomId) {
+ proxy.$modal.msgError("璇烽�夋嫨BOM");
+ return;
+ }
+ add(formState.value).then(res => {
+ // 鍏抽棴妯℃�佹
+ isShow.value = false;
+ // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+ emit("completed");
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ });
+ }
+ });
+ };
-defineExpose({
- closeModal,
- handleSubmit,
- isShow,
-});
+ // 缁勪欢鎸傝浇鏃惰幏鍙栦骇鍝佺被鍨嬪瓧鍏�
+ onMounted(() => {
+ getProductTypeOptions();
+ });
+
+ defineExpose({
+ closeModal,
+ handleSubmit,
+ isShow,
+ });
</script>
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 83d789e..f907915 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -3,13 +3,29 @@
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
- <el-form-item label="瑙勬牸鍚嶇О:">
- <el-input v-model="searchForm.model"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 200px;"
- @change="handleQuery" />
+ <el-form-item label="浜у搧绫诲瀷:">
+ <el-select v-model="searchForm.dictCode"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨浜у搧绫诲瀷"
+ clearable
+ @change="handleQuery">
+ <el-option v-for="option in productTypeOptions"
+ :key="option.dictCode"
+ :label="option.dictLabel"
+ :value="option.dictCode" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鐘舵��:">
+ <el-select v-model="searchForm.status"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨鐘舵��"
+ clearable
+ @change="handleQuery">
+ <el-option label="宸叉壒鍑�"
+ :value="true" />
+ <el-option label="鑽夌"
+ :value="false" />
+ </el-select>
</el-form-item>
<el-form-item>
<el-button type="primary"
@@ -63,11 +79,13 @@
} from "@/api/productionManagement/processRoute.js";
import { useRouter } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus";
+ import { getDicts } from "@/api/system/dict/data";
const router = useRouter();
const data = reactive({
searchForm: {
- model: "",
+ dictCode: "",
+ status: "",
},
});
const { searchForm } = toRefs(data);
@@ -75,14 +93,33 @@
{
label: "宸ヨ壓璺嚎缂栧彿",
prop: "processRouteCode",
+ width: "200px",
+ className: "status-cell",
},
{
- label: "浜у搧鍚嶇О",
- prop: "productName",
+ label: "鐘舵��",
+ prop: "status",
+ dataType: "tag",
+
+ formatData: params => {
+ if (params) {
+ return "宸叉壒鍑�";
+ } else {
+ return "鑽夌";
+ }
+ },
+ formatType: params => {
+ if (params) {
+ return "success";
+ } else {
+ return "info";
+ }
+ },
},
{
- label: "瑙勬牸鍚嶇О",
- prop: "model",
+ label: "浜у搧绫诲瀷",
+ prop: "dictLabel",
+ dataType: "tag",
},
{
label: "BOM缂栧彿",
@@ -145,6 +182,7 @@
const isShowEditModal = ref(false);
const isShowItemModal = ref(false);
const record = ref({});
+ const productTypeOptions = ref([]);
const page = reactive({
current: 1,
size: 100,
@@ -204,6 +242,8 @@
productName: row.productName || "",
model: row.model || "",
bomNo: row.bomNo || "",
+ dictLabel: row.dictLabel || "",
+ orderId: row.id || "",
bomId: row.bomId || null,
description: row.description || "",
type: "route",
@@ -264,9 +304,31 @@
});
};
+ // 鑾峰彇浜у搧绫诲瀷瀛楀吀
+ const getProductTypeOptions = () => {
+ getDicts("product_type")
+ .then(res => {
+ if (res.code === 200) {
+ productTypeOptions.value = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇浜у搧绫诲瀷瀛楀吀澶辫触锛�", err);
+ });
+ };
+
onMounted(() => {
+ getProductTypeOptions();
getList();
});
</script>
<style scoped></style>
+<style lang="scss">
+ .status-cell {
+ font-weight: 600;
+ color: #409eff;
+ font-family: "Courier New", monospace;
+ text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2);
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/productionManagement/processRoute/index2.vue b/src/views/productionManagement/processRoute/index2.vue
index 40ab129..71fe53c 100644
--- a/src/views/productionManagement/processRoute/index2.vue
+++ b/src/views/productionManagement/processRoute/index2.vue
@@ -397,8 +397,8 @@
</el-form-item>
<el-form-item label="鏄惁璐ㄦ">
<el-tag size="small"
- :type="selectedProcessItem.isQuality ? 'success' : 'info'">
- {{ selectedProcessItem.isQuality ? '璐ㄦ' : '闈炶川妫�' }}
+ :type="selectedProcessItem.isQuality == 1 ? 'success' : 'info'">
+ {{ selectedProcessItem.isQuality == 1 ? '璐ㄦ' : '闈炶川妫�' }}
</el-tag>
</el-form-item>
<el-form-item label="浜у搧鍚嶇О"
@@ -420,8 +420,8 @@
<el-form-item label="鏄惁璐ㄦ"
prop="isQuality">
<el-switch v-model="processForm.isQuality"
- :active-value="true"
- inactive-value="false" />
+ :active-value="1"
+ :inactive-value="0" />
</el-form-item>
</el-form>
<el-empty v-else
@@ -1366,7 +1366,7 @@
processForm.productName = "";
processForm.productModelName = "";
processForm.unit = "";
- processForm.isQuality = row.isQuality || false;
+ processForm.isQuality = row.isQuality || 0;
};
// 澶勭悊宸ュ簭閫夋嫨鏃剁殑浜у搧閫夋嫨
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index ce3ee0b..5d841e8 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -16,18 +16,10 @@
</div>
<div class="info-item">
<div class="info-label-wrapper">
- <span class="info-label">浜у搧鍚嶇О</span>
+ <span class="info-label">浜у搧绫诲瀷</span>
</div>
<div class="info-value-wrapper">
- <span class="info-value">{{ routeInfo.productName || '-' }}</span>
- </div>
- </div>
- <div class="info-item">
- <div class="info-label-wrapper">
- <span class="info-label">瑙勬牸鍚嶇О</span>
- </div>
- <div class="info-value-wrapper">
- <span class="info-value">{{ routeInfo.model || '-' }}</span>
+ <span class="info-value">{{ routeInfo.dictLabel || '-' }}</span>
</div>
</div>
<div class="info-item">
@@ -55,6 +47,7 @@
class="section-header">
<div class="section-title">宸ヨ壓璺嚎椤圭洰鍒楄〃</div>
<div class="section-actions">
+ <div class="sort-tip">鎷栨嫿琛ㄦ牸鎺掑簭</div>
<el-button icon="Grid"
@click="toggleView"
style="margin-right: 10px;">
@@ -71,7 +64,9 @@
:data="tableData"
:header-cell-style="{ background: '#F0F1F5', color: '#333333' }"
row-key="id"
+ height="350"
tooltip-effect="dark"
+ style="margin-bottom: 20px;"
class="lims-table">
<el-table-column align="center"
label="搴忓彿"
@@ -84,12 +79,6 @@
{{ getProcessName(scope.row.processId) || '-' }}
</template>
</el-table-column>
- <el-table-column label="浜у搧鍚嶇О"
- prop="productName"
- min-width="160" />
- <el-table-column label="瑙勬牸鍚嶇О"
- prop="model"
- min-width="140" />
<el-table-column label="鍙傛暟鍒楄〃"
min-width="160">
<template #default="scope">
@@ -99,14 +88,12 @@
@click="handleViewParams(scope.row)">鍙傛暟鍒楄〃</el-button>
</template>
</el-table-column>
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="100" />
<el-table-column label="鏄惁璐ㄦ"
- prop="isQuality"
- width="100">
+ prop="isQuality">
<template #default="scope">
- {{scope.row.isQuality ? "鏄�" : "鍚�"}}
+ <el-tag :type="scope.row.isQuality == 1 ? 'success' : 'danger'">
+ {{scope.row.isQuality == 1 ? '鏄�' : '鍚�' }}
+ </el-tag>
</template>
</el-table-column>
<el-table-column label="鎿嶄綔"
@@ -119,10 +106,6 @@
size="small"
@click="handleEdit(scope.row)"
:disabled="scope.row.isComplete">缂栬緫</el-button>
- <!-- <el-button type="info"
- link
- size="small"
- @click="handleViewParams(scope.row)">鍙傛暟鍒楄〃</el-button> -->
<el-button type="danger"
link
size="small"
@@ -136,6 +119,7 @@
<div class="section-header">
<div class="section-title">宸ヨ壓璺嚎椤圭洰鍒楄〃</div>
<div class="section-actions">
+ <div class="sort-tip">闀挎寜鎷栨嫿鍗$墖鎺掑簭</div>
<el-button icon="Menu"
@click="toggleView"
style="margin-right: 10px;">
@@ -159,22 +143,8 @@
<div class="card-process-name">{{ getProcessName(item.processId) || '-' }}</div>
</div>
<!-- 浜у搧淇℃伅 -->
- <div class="card-content">
- <div v-if="item.productName"
- class="product-info">
- <div class="product-name">{{ item.productName }}</div>
- <div v-if="item.model"
- class="product-model">
- {{ item.model }}
- <!-- <span v-if="item.unit" class="product-unit">{{ item.unit }}</span> -->
- </div>
- <el-tag type="primary"
- class="product-tag"
- v-if="item.isQuality">璐ㄦ</el-tag>
- </div>
- <div v-else
- class="product-info empty">鏆傛棤浜у搧淇℃伅</div>
- </div>
+ <!-- <div class="card-content">
+ </div> -->
<!-- 鎿嶄綔鎸夐挳 -->
<div class="card-footer">
<el-button type="primary"
@@ -196,6 +166,154 @@
</div>
</div>
</template>
+ <div class="section-BOM">
+ <div class="section-header">
+ <div class="section-title">BOM</div>
+ <div class="section-actions"
+ v-if="pageType === 'order'">
+ <el-button type="primary"
+ @click="toggleBomEdit">
+ {{ bomDataValue.isEdit ? '鍙栨秷' : '缂栬緫' }}
+ </el-button>
+ <el-button v-if=" bomDataValue.isEdit"
+ type="success"
+ @click="saveBomChanges">淇濆瓨</el-button>
+ </div>
+ </div>
+ <div>
+ <!-- BOM琛ㄦ牸 -->
+ <el-table :data="bomTableData"
+ border
+ :preserve-expanded-content="false"
+ :default-expand-all="true"
+ style="width: 100%">
+ <el-table-column type="expand">
+ <template #default="props">
+ <el-form ref="bomFormRef"
+ :model="bomDataValue">
+ <el-table :data="props.row.bomList"
+ row-key="tempId"
+ default-expand-all
+ :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+ style="width: 100%">
+ <el-table-column prop="productName"
+ label="浜у搧" />
+ <el-table-column prop="model"
+ label="瑙勬牸">
+ <template #default="{ row }">
+ <el-form-item v-if="bomDataValue.isEdit"
+ style="margin: 0">
+ <el-select v-model="row.model"
+ placeholder="璇烽�夋嫨瑙勬牸"
+ :disabled="!bomDataValue.isEdit"
+ style="width: 100%"
+ @visible-change="(v) => { if (v) openBomProductDialog(row.tempId) }">
+ <el-option v-if="row.model"
+ :label="row.model"
+ :value="row.model" />
+ </el-select>
+ </el-form-item>
+ <span v-else>{{ row.model }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="processName"
+ label="娑堣�楀伐搴�">
+ <template #default="{ row }">
+ <el-form-item v-if="bomDataValue.isEdit"
+ style="margin: 0">
+ <el-select v-model="row.processId"
+ placeholder="璇烽�夋嫨娑堣�楀伐搴�"
+ :disabled="!bomDataValue.isEdit"
+ style="width: 100%">
+ <el-option v-for="process in processOptions"
+ :key="process.id"
+ :label="process.name"
+ :value="process.id" />
+ </el-select>
+ </el-form-item>
+ <span v-else>{{ row.processName }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="unitQuantity"
+ label="鍗曚綅浜у嚭鎵�闇�鏁伴噺">
+ <template #default="{ row }">
+ <el-form-item v-if="bomDataValue.isEdit"
+ style="margin: 0">
+ <el-input-number v-model="row.unitQuantity"
+ :min="0"
+ :step="1"
+ controls-position="right"
+ style="width: 100%"
+ :disabled="!bomDataValue.isEdit" />
+ </el-form-item>
+ <span v-else>{{ row.unitQuantity }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="unit"
+ label="鍗曚綅">
+ <template #default="{ row }">
+ <el-form-item v-if="bomDataValue.isEdit"
+ style="margin: 0">
+ <el-input v-model="row.unit"
+ placeholder="璇疯緭鍏ュ崟浣�"
+ clearable
+ :disabled="!bomDataValue.isEdit" />
+ </el-form-item>
+ <span v-else>{{ row.unit }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ fixed="right"
+ v-if="pageType === 'order'"
+ width="180">
+ <template #default="{ row }">
+ <el-button v-if="bomDataValue.isEdit"
+ type="danger"
+ text
+ size="small"
+ @click="removeBomItem(row.tempId)">鍒犻櫎</el-button>
+ <el-button v-if="bomDataValue.isEdit"
+ type="primary"
+ text
+ size="small"
+ @click="addBomItem2(row.tempId)">娣诲姞瀛愰」</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-form>
+ </template>
+ </el-table-column>
+ <el-table-column label="BOM缂栧彿"
+ prop="bomNo" />
+ <el-table-column label="浜у搧绫诲瀷"
+ prop="dictLabel" />
+ <!-- <el-table-column label="鎿嶄綔"
+ width="150">
+ <template #default="{ row }">
+
+ </template>
+ </el-table-column> -->
+ <!-- <el-table-column label="浜у搧缂栫爜"
+ prop="productCode" />
+ <el-table-column label="浜у搧鍚嶇О"
+ prop="productName" />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="model" /> -->
+ </el-table>
+ <div v-if="bomDataValue.isEdit"
+ style="text-align: center;border: 1px solid #e4e7ed;padding: 10px;transition: all 0.3s ease;cursor: pointer;"
+ :class="{'hover-effect': bomDataValue.isEdit}">
+ <el-button type="primary"
+ text
+ @click="addBomItem">
+ <el-icon style="vertical-align: middle;margin-right: 5px;">
+ <Plus />
+ </el-icon>
+ 娣诲姞
+ </el-button>
+ </div>
+ </div>
+ </div>
<!-- 鏂板/缂栬緫寮圭獥 -->
<el-dialog v-model="dialogVisible"
:title="operationType === 'add' ? '鏂板宸ヨ壓璺嚎椤圭洰' : '缂栬緫宸ヨ壓璺嚎椤圭洰'"
@@ -217,27 +335,11 @@
:value="process.id" />
</el-select>
</el-form-item>
- <el-form-item label="浜у搧鍚嶇О"
- prop="productModelId">
- <el-button type="primary"
- @click="showProductSelectDialog = true">
- {{ form.productName && form.model
- ? `${form.productName} - ${form.model}`
- : '閫夋嫨浜у搧' }}
- </el-button>
- </el-form-item>
- <el-form-item label="鍗曚綅"
- prop="unit">
- <el-input v-model="form.unit"
- :placeholder="form.productModelId ? '鏍规嵁閫夋嫨鐨勪骇鍝佽嚜鍔ㄥ甫鍑�' : '璇峰厛閫夋嫨浜у搧'"
- clearable
- :disabled="true" />
- </el-form-item>
<el-form-item label="鏄惁璐ㄦ"
prop="isQuality">
<el-switch v-model="form.isQuality"
- :active-value="true"
- inactive-value="false" />
+ :active-value="1"
+ :inactive-value="0" />
</el-form-item>
</el-form>
<template #footer>
@@ -251,12 +353,18 @@
<ProductSelectDialog v-model="showProductSelectDialog"
@confirm="handleProductSelect"
single />
+ <!-- BOM浜у搧閫夋嫨瀵硅瘽妗� -->
+ <ProductSelectDialog v-model="bomDataValue.showProductDialog"
+ @confirm="handleBomProductSelect"
+ single />
<!-- 鍙傛暟鍒楄〃瀵硅瘽妗� -->
<ProcessParamListDialog v-model="showParamListDialog"
:title="`${currentProcess ? getProcessName(currentProcess.processId) : ''} - 鍙傛暟鍒楄〃`"
:route-id="routeId"
- :editable="false"
+ :editable="editable"
+ :order-id="orderId"
:process="currentProcess"
+ :page-type="pageType"
:param-list="paramList"
@refresh="refreshParamList" />
</div>
@@ -284,10 +392,16 @@
findProductProcessRouteItemList,
deleteRouteItem,
addRouteItem,
+ findProcessParamListOrder,
addOrUpdateProductProcessRouteItem,
sortRouteItem,
} from "@/api/productionManagement/productProcessRoute.js";
import { processList } from "@/api/productionManagement/productionProcess.js";
+ import {
+ queryList2,
+ queryList,
+ add2,
+ } from "@/api/productionManagement/productStructure.js";
import { useRoute } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus";
import Sortable from "sortablejs";
@@ -298,6 +412,7 @@
const routeId = computed(() => route.query.id);
const orderId = computed(() => route.query.orderId);
const pageType = computed(() => route.query.type);
+ const editable = computed(() => route.query.editable === "true");
const tableLoading = ref(false);
const tableData = ref([]);
@@ -313,6 +428,7 @@
productName: "",
model: "",
bomNo: "",
+ dictLabel: "",
bomId: null,
description: "",
});
@@ -322,6 +438,15 @@
const showParamListDialog = ref(false);
const currentProcess = ref(null);
const paramList = ref([]);
+ const bomTableData = ref([]);
+ const bomFormRef = ref(null);
+ const bomDataValue = ref({
+ dataList: [],
+ showProductDialog: false,
+ currentRowName: null,
+ loading: false,
+ isEdit: false,
+ });
let tableSortable = null;
let cardSortable = null;
@@ -342,14 +467,11 @@
productName: "",
model: "",
unit: "",
- isQuality: false,
+ isQuality: 0,
});
const rules = {
processId: [{ required: true, message: "璇烽�夋嫨宸ュ簭", trigger: "change" }],
- productModelId: [
- { required: true, message: "璇烽�夋嫨浜у搧", trigger: "change" },
- ],
};
// 鏍规嵁宸ュ簭ID鑾峰彇宸ュ簭鍚嶇О
@@ -401,9 +523,78 @@
productName: route.query.productName || "",
model: route.query.model || "",
bomNo: route.query.bomNo || "",
+ dictLabel: route.query.dictLabel || "",
bomId: route.query.bomId || null,
description: route.query.description || "",
};
+ if (pageType.value === "order") {
+ queryList2(route.query.orderId)
+ .then(res => {
+ if (res.data) {
+ // 涓築OM鏁版嵁璁剧疆tempId
+ const setTempIdRecursively = items => {
+ items.forEach(item => {
+ item.tempId = item.id || new Date().getTime();
+ if (item.children && item.children.length > 0) {
+ setTempIdRecursively(item.children);
+ }
+ });
+ };
+ setTempIdRecursively(res.data);
+
+ bomTableData.value = [
+ {
+ bomNo: routeInfo.value.bomNo,
+ dictLabel: routeInfo.value.dictLabel,
+ productCode: "",
+ productName: routeInfo.value.productName,
+ model: routeInfo.value.model,
+ bomList: res.data,
+ },
+ ];
+
+ // 淇濆瓨鍘熷BOM鏁版嵁
+ bomDataValue.value.dataList = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇BOM鏁版嵁澶辫触锛�", err);
+ });
+ } else {
+ queryList(Number(route.query.bomId))
+ .then(res => {
+ if (res.data) {
+ // 涓築OM鏁版嵁璁剧疆tempId
+ const setTempIdRecursively = items => {
+ items.forEach(item => {
+ item.tempId = item.id || new Date().getTime();
+ if (item.children && item.children.length > 0) {
+ setTempIdRecursively(item.children);
+ }
+ });
+ };
+ setTempIdRecursively(res.data);
+
+ bomTableData.value = [
+ {
+ bomNo: routeInfo.value.bomNo,
+ dictLabel: routeInfo.value.dictLabel,
+ productCode: "",
+ productName: routeInfo.value.productName,
+ model: routeInfo.value.model,
+ bomList: res.data,
+ },
+ ];
+
+ // 淇濆瓨鍘熷BOM鏁版嵁
+ bomDataValue.value.dataList = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇BOM鏁版嵁澶辫触锛�", err);
+ });
+ }
+ // 鑾峰彇BOM鏁版嵁锛屼娇鐢ㄦ柊鐨勬帴鍙�
};
// 鏂板
@@ -483,12 +674,10 @@
const addPromise = isOrderPage
? addRouteItem({
- productOrderId: orderId.value,
- productRouteId: routeId.value,
+ orderId: orderId.value,
+ routeId: routeId.value,
processId: form.value.processId,
- productModelId: form.value.productModelId,
isQuality: form.value.isQuality,
- dragSort,
})
: addOrUpdateProcessRouteItem({
routeId: routeId.value,
@@ -518,7 +707,6 @@
? addOrUpdateProductProcessRouteItem({
id: form.value.id,
processId: form.value.processId,
- productModelId: form.value.productModelId,
isQuality: form.value.isQuality,
})
: addOrUpdateProcessRouteItem({
@@ -564,6 +752,241 @@
const closeDialog = () => {
dialogVisible.value = false;
resetForm();
+ };
+
+ // BOM鐩稿叧鏂规硶
+ // 鍒囨崲BOM缂栬緫妯″紡
+ const toggleBomEdit = () => {
+ bomDataValue.value.isEdit = !bomDataValue.value.isEdit;
+ if (!bomDataValue.value.isEdit) {
+ // 鍙栨秷缂栬緫鏃堕噸鏂板姞杞芥暟鎹�
+ getRouteInfo();
+ }
+ };
+
+ // 娣诲姞BOM椤�
+ const addBomItem = () => {
+ if (bomTableData.value.length > 0) {
+ const newItem = {
+ parentId: "",
+ parentTempId: "",
+ productName: "",
+ productId: "",
+ model: undefined,
+ productModelId: undefined,
+ processId: "",
+ processName: "",
+ unitQuantity: 0,
+ unit: "",
+ children: [],
+ tempId: new Date().getTime(),
+ };
+ bomTableData.value[0].bomList.push(newItem);
+ // 鐢变簬bomDataValue.value.dataList鍜宐omTableData.value[0].bomList鎸囧悜鍚屼竴涓暟缁勶紝涓嶉渶瑕侀噸澶嶆坊鍔�
+ }
+ };
+
+ // 娣诲姞BOM瀛愰」
+ const addBomItem2 = tempId => {
+ const addChildItem = (items, tempId) => {
+ for (let i = 0; i < items.length; i++) {
+ const item = items[i];
+ if (item.tempId === tempId) {
+ if (!item.children) {
+ item.children = [];
+ }
+ item.children.push({
+ parentId: item.id || "",
+ parentTempId: item.tempId || "",
+ productName: "",
+ productId: "",
+ model: undefined,
+ productModelId: undefined,
+ processId: "",
+ processName: "",
+ unitQuantity: 0,
+ unit: "",
+ children: [],
+ tempId: new Date().getTime(),
+ });
+ return true;
+ }
+ if (item.children && item.children.length > 0) {
+ if (addChildItem(item.children, tempId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ if (bomTableData.value.length > 0) {
+ addChildItem(bomTableData.value[0].bomList, tempId);
+ // 鐢变簬bomDataValue.value.dataList鍜宐omTableData.value[0].bomList鎸囧悜鍚屼竴涓暟缁勶紝涓嶉渶瑕侀噸澶嶆坊鍔�
+ }
+ };
+
+ // 鍒犻櫎BOM椤�
+ const removeBomItem = tempId => {
+ // 浠嶣OM琛ㄦ牸鏁版嵁涓垹闄�
+ if (bomTableData.value.length > 0) {
+ const removeFromList = (items, tempId) => {
+ for (let i = 0; i < items.length; i++) {
+ const item = items[i];
+ if (item.tempId === tempId) {
+ items.splice(i, 1);
+ return true;
+ }
+ if (item.children && item.children.length > 0) {
+ if (removeFromList(item.children, tempId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+ removeFromList(bomTableData.value[0].bomList, tempId);
+ // 鐢变簬bomDataValue.value.dataList鍜宐omTableData.value[0].bomList鎸囧悜鍚屼竴涓暟缁勶紝涓嶉渶瑕侀噸澶嶅垹闄�
+ }
+ };
+
+ // 鎵撳紑BOM浜у搧閫夋嫨瀵硅瘽妗�
+ const openBomProductDialog = tempId => {
+ bomDataValue.value.currentRowName = tempId;
+ bomDataValue.value.showProductDialog = true;
+ };
+
+ // 澶勭悊BOM浜у搧閫夋嫨
+ const handleBomProductSelect = products => {
+ if (products && products.length > 0) {
+ const product = products[0];
+ const updateProductInfo = (items, tempId, productData) => {
+ for (let i = 0; i < items.length; i++) {
+ const item = items[i];
+ if (item.tempId === tempId) {
+ item.productName = productData.productName;
+ item.model = productData.model;
+ item.productModelId = productData.id;
+ item.unit = productData.unit || "";
+ return true;
+ }
+ if (item.children && item.children.length > 0) {
+ if (updateProductInfo(item.children, tempId, productData)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ if (bomTableData.value.length > 0) {
+ updateProductInfo(
+ bomTableData.value[0].bomList,
+ bomDataValue.value.currentRowName,
+ product
+ );
+ // 鐢变簬bomDataValue.value.dataList鍜宐omTableData.value[0].bomList鎸囧悜鍚屼竴涓暟缁勶紝涓嶉渶瑕侀噸澶嶆洿鏂�
+ }
+ bomDataValue.value.showProductDialog = false;
+ }
+ };
+
+ // 淇濆瓨BOM鏇存敼
+ const saveBomChanges = () => {
+ // 鏍¢獙BOM鏁版嵁
+ const validateBomData = items => {
+ for (let i = 0; i < items.length; i++) {
+ const item = items[i];
+ // 鏍¢獙浜у搧鏄惁蹇呭~
+ if (!item.productModelId) {
+ ElMessage.error("璇烽�夋嫨浜у搧");
+ return false;
+ }
+ // 鏍¢獙鍗曚綅浜у嚭鎵�闇�鏁伴噺鏄惁蹇呭~
+ if (
+ item.unitQuantity === undefined ||
+ item.unitQuantity === null ||
+ item.unitQuantity === 0
+ ) {
+ ElMessage.error("璇峰~鍐欏崟浣嶄骇鍑烘墍闇�鏁伴噺");
+ return false;
+ }
+ // 閫掑綊鏍¢獙瀛愰」
+ if (item.children && item.children.length > 0) {
+ if (!validateBomData(item.children)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ };
+
+ // 鎵ц鏍¢獙
+ if (bomTableData.value.length > 0) {
+ if (!validateBomData(bomTableData.value[0].bomList)) {
+ return;
+ }
+ }
+
+ // 璋冪敤鏂扮殑淇濆瓨鎺ュ彛
+ // 鍑嗗淇濆瓨鏁版嵁锛岀‘淇濇牸寮忔纭�
+ // 閫掑綊澶勭悊BOM椤瑰強鍏跺瓙椤�
+ const processBomItem = (item, parentId = null, parentTempId = null) => {
+ const cleanItem = {
+ id: item.id || null,
+ orderId: Number(orderId.value) || null,
+ parentId: parentId,
+ parentTempId: parentTempId || null,
+ productModelId: item.productModelId || null,
+ processId: item.processId || null,
+ unitQuantity: item.unitQuantity || 0,
+ demandedQuantity: item.demandedQuantity || null,
+ unit: item.unit || "",
+ tempId: item.tempId || new Date().getTime(),
+ tenantId: item.tenantId || null,
+ bomId: Number(route.query.bomId) || null,
+ children: [],
+ };
+
+ // 閫掑綊澶勭悊瀛愰」
+ if (item.children && item.children.length > 0) {
+ cleanItem.children = item.children.map(child =>
+ processBomItem(child, item.id, item.tempId || null)
+ );
+ }
+
+ return cleanItem;
+ };
+
+ const saveData = bomTableData.value[0].bomList.map(item =>
+ processBomItem(item, item.parentId, item.parentTempId || null)
+ );
+ const formData = {
+ orderId: Number(orderId.value) || null,
+ children: saveData,
+ };
+
+ add2(formData)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("BOM淇濆瓨鎴愬姛");
+ bomDataValue.value.isEdit = false;
+ // 閲嶆柊鍔犺浇鏁版嵁浠ヨ幏鍙栨渶鏂扮姸鎬�
+ getRouteInfo();
+ } else {
+ ElMessage.error("BOM淇濆瓨澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ })
+ .catch(err => {
+ console.error("淇濆瓨BOM鏁版嵁澶辫触锛�", err);
+ ElMessage.error("BOM淇濆瓨澶辫触锛氱綉缁滈敊璇�");
+ });
+ };
+
+ // 鍙栨秷BOM缂栬緫
+ const cancelBomEdit = () => {
+ bomDataValue.value.isEdit = false;
+ getRouteInfo();
};
// 鍒濆鍖栨嫋鎷芥帓搴�
@@ -641,6 +1064,7 @@
ghostClass: "sortable-ghost",
handle: ".process-card",
filter: ".el-button",
+ delay: 500, // 闀挎寜500姣鍚庡紑濮嬫嫋鎷�
onEnd: evt => {
if (evt.oldIndex === evt.newIndex || !tableData.value[evt.oldIndex])
return;
@@ -711,50 +1135,96 @@
const handleViewParams = process => {
currentProcess.value = process;
// 璋冪敤API鑾峰彇鍙傛暟鍒楄〃
- getProcessParamList({
- routeItemId: process.id,
- pageNum: 1,
- pageSize: 1000,
- })
- .then(res => {
- if (res.code === 200) {
- paramList.value = res.data?.records || [];
- } else {
- ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
- paramList.value = [];
- }
- showParamListDialog.value = true;
+ if (pageType.value === "order") {
+ findProcessParamListOrder({
+ orderId: orderId.value,
+ routeItemId: process.id,
+ pageNum: 1,
+ pageSize: 1000,
})
- .catch(err => {
- console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
- ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
- paramList.value = [];
- showParamListDialog.value = true;
- });
+ .then(res => {
+ if (res.code === 200) {
+ paramList.value = res.data || [];
+ } else {
+ ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ }
+ showParamListDialog.value = true;
+ })
+ .catch(err => {
+ console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
+ ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ showParamListDialog.value = true;
+ });
+ } else {
+ getProcessParamList({
+ routeItemId: process.id,
+ pageNum: 1,
+ pageSize: 1000,
+ })
+ .then(res => {
+ if (res.code === 200) {
+ paramList.value = res.data?.records || [];
+ } else {
+ ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ }
+ showParamListDialog.value = true;
+ })
+ .catch(err => {
+ console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
+ ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ showParamListDialog.value = true;
+ });
+ }
};
// 鍒锋柊鍙傛暟鍒楄〃
const refreshParamList = () => {
if (!currentProcess.value) return;
// 閲嶆柊璋冪敤API鑾峰彇鍙傛暟鍒楄〃
- getProcessParamList({
- routeItemId: currentProcess.value.id,
- pageNum: 1,
- pageSize: 1000,
- })
- .then(res => {
- if (res.code === 200) {
- paramList.value = res.data?.records || [];
- } else {
- ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
- paramList.value = [];
- }
+ if (pageType.value === "order") {
+ findProcessParamListOrder({
+ orderId: orderId.value,
+ routeItemId: currentProcess.value.id,
+ pageNum: 1,
+ pageSize: 1000,
})
- .catch(err => {
- console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
- ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
- paramList.value = [];
- });
+ .then(res => {
+ if (res.code === 200) {
+ paramList.value = res.data || [];
+ } else {
+ ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
+ ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ });
+ } else {
+ getProcessParamList({
+ routeItemId: currentProcess.value.id,
+ pageNum: 1,
+ pageSize: 1000,
+ })
+ .then(res => {
+ if (res.code === 200) {
+ paramList.value = res.data?.records || [];
+ } else {
+ ElMessage.error(res.msg || "鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇鍙傛暟鍒楄〃澶辫触锛�", err);
+ ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
+ paramList.value = [];
+ });
+ }
};
onUnmounted(() => {
@@ -765,14 +1235,16 @@
<style scoped>
.card-container {
padding: 20px 0;
+ /* height: 350px; */
+ margin-bottom: 20px;
}
.cards-wrapper {
display: flex;
- gap: 16px;
+ gap: 24px;
overflow-x: auto;
padding: 10px 0;
- min-height: 200px;
+ /* min-height: 250px; */
}
.cards-wrapper::-webkit-scrollbar {
@@ -795,11 +1267,12 @@
.process-card {
flex-shrink: 0;
- width: 220px;
+ /* width: 300px; */
background: #fff;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
- padding: 16px;
+ border-radius: 12px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ /* padding: 30px 24px; */
+ padding: 25px 50px;
display: flex;
flex-direction: column;
cursor: move;
@@ -807,45 +1280,45 @@
}
.process-card:hover {
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- transform: translateY(-2px);
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
+ transform: translateY(-4px);
}
.card-header {
text-align: center;
- margin-bottom: 12px;
+ margin-bottom: 20px;
}
.card-number {
- width: 36px;
- height: 36px;
- line-height: 36px;
+ width: 60px;
+ height: 60px;
+ line-height: 60px;
border-radius: 50%;
background: #409eff;
color: #fff;
font-weight: bold;
- font-size: 16px;
- margin: 0 auto 8px;
+ font-size: 20px;
+ margin: 0 auto 16px;
}
.card-process-name {
- font-size: 14px;
+ font-size: 18px;
color: #333;
- font-weight: 500;
+ font-weight: 600;
word-break: break-all;
}
.card-content {
flex: 1;
- margin-bottom: 12px;
- min-height: 60px;
+ margin-bottom: 20px;
+ min-height: 80px;
display: flex;
align-items: center;
justify-content: center;
}
.product-info {
- font-size: 13px;
+ font-size: 14px;
color: #666;
text-align: center;
width: 100%;
@@ -858,7 +1331,7 @@
}
.product-name {
- margin-bottom: 6px;
+ margin-bottom: 8px;
word-break: break-all;
line-height: 1.5;
text-align: center;
@@ -866,7 +1339,7 @@
.product-model {
color: #909399;
- font-size: 12px;
+ font-size: 13px;
word-break: break-all;
line-height: 1.5;
text-align: center;
@@ -878,19 +1351,32 @@
}
.product-tag {
- margin: 10px 0;
+ margin: 12px 0;
}
.card-footer {
display: flex;
- justify-content: space-around;
- padding-top: 12px;
+ justify-content: center;
+ gap: 20px;
+ padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
.card-footer .el-button {
padding: 0;
- font-size: 12px;
+ font-size: 14px;
+ }
+
+ .card-footer .el-button:nth-child(1) {
+ color: #409eff;
+ }
+
+ .card-footer .el-button:nth-child(2) {
+ color: #67c23a;
+ }
+
+ .card-footer .el-button:nth-child(3) {
+ color: #f56c6c;
}
:deep(.sortable-ghost) {
@@ -902,13 +1388,13 @@
opacity: 0.8;
}
- /* 琛ㄦ牸瑙嗗浘鏍峰紡 */
- :deep(.el-table__row) {
+ /* 琛ㄦ牸瑙嗗浘鏍峰紡 - 浠呭簲鐢ㄤ簬椤圭洰鍒楄〃 */
+ :deep(.lims-table .el-table__row) {
transition: background-color 0.2s;
cursor: move;
}
- :deep(.el-table__row:hover) {
+ :deep(.lims-table .el-table__row:hover) {
background-color: #f9fafc !important;
}
@@ -945,6 +1431,12 @@
display: flex;
align-items: center;
}
+ .sort-tip {
+ font-size: 12px;
+ color: #909399;
+ margin-left: 8px;
+ margin-right: 20px;
+ }
/* 宸ヨ壓璺嚎淇℃伅鍗$墖鏍峰紡 */
.route-info-card {
@@ -957,7 +1449,7 @@
.route-info {
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
+ grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 16px;
padding: 4px;
}
@@ -1022,3 +1514,11 @@
word-break: break-all;
}
</style>
+<style scoped>
+ .hover-effect:hover {
+ border-color: #409eff;
+ background-color: #ecf5ff;
+ transform: translateY(-2px);
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 7b2c7e5..ae76ed4 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -38,12 +38,11 @@
label="瑙勬牸">
<template #default="{ row, $index }">
<el-form-item v-if="dataValue.isEdit"
- :rules="[{ required: true, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
+ :rules="[{ required: false, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
style="margin: 0">
<el-select v-model="row.model"
placeholder="璇烽�夋嫨瑙勬牸"
- clearable
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)"
+ :disabled="!dataValue.isEdit"
style="width: 100%"
@visible-change="(v) => { if (v) openDialog(row.tempId) }">
<el-option v-if="row.model"
@@ -57,14 +56,14 @@
label="娑堣�楀伐搴�">
<template #default="{ row, $index }">
<el-form-item v-if="dataValue.isEdit"
- :rules="dataValue.dataList.some(item => (item as any).tempId === row.tempId) ? [] : [{ required: true, message: '璇烽�夋嫨娑堣�楀伐搴�', trigger: 'change' }]"
+ :rules="[{ required: true, message: '璇烽�夋嫨娑堣�楀伐搴�', trigger: 'change' }]"
style="margin: 0">
<el-select v-model="row.processId"
placeholder="璇烽�夋嫨"
filterable
clearable
style="width: 100%"
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)">
+ :disabled="!dataValue.isEdit">
<el-option v-for="item in dataValue.processOptions"
:key="item.id"
:label="item.name"
@@ -81,11 +80,10 @@
style="margin: 0">
<el-input-number v-model="row.unitQuantity"
:min="0"
- :precision="2"
:step="1"
controls-position="right"
style="width: 100%"
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
+ :disabled="!dataValue.isEdit" />
</el-form-item>
</template>
</el-table-column>
@@ -102,7 +100,7 @@
:step="1"
controls-position="right"
style="width: 100%"
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
+ :disabled="!dataValue.isEdit" />
</el-form-item>
</template>
</el-table-column>
@@ -115,7 +113,7 @@
<el-input v-model="row.unit"
placeholder="璇疯緭鍏ュ崟浣�"
clearable
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
+ :disabled="!dataValue.isEdit" />
</el-form-item>
</template>
</el-table-column>
@@ -123,7 +121,7 @@
fixed="right"
width="200">
<template #default="{ row, $index }">
- <el-button v-if="dataValue.isEdit && !dataValue.dataList.some(item => (item as any).tempId === row.tempId)"
+ <el-button v-if="dataValue.isEdit"
type="danger"
text
@click="removeItem(row.tempId)">鍒犻櫎
@@ -141,13 +139,21 @@
</el-table-column>
<el-table-column label="BOM缂栧彿"
prop="bomNo" />
- <el-table-column label="浜у搧缂栫爜"
- prop="productCode" />
- <el-table-column label="浜у搧鍚嶇О"
- prop="productName" />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="model" />
+ <el-table-column label="浜у搧绫诲瀷"
+ prop="dictLabel" />
</el-table>
+ <div v-if="dataValue.isEdit"
+ style="text-align: center;border: 1px solid #e4e7ed;padding: 10px;transition: all 0.3s ease;cursor: pointer;"
+ :class="{'hover-effect': dataValue.isEdit}">
+ <el-button type="primary"
+ text
+ @click="addItem">
+ <el-icon style="vertical-align: middle;margin-right: 5px;">
+ <Plus />
+ </el-icon>
+ 娣诲姞
+ </el-button>
+ </div>
<product-select-dialog v-if="dataValue.showProductDialog"
v-model:model-value="dataValue.showProductDialog"
single
@@ -194,11 +200,8 @@
// 浠庤矾鐢卞弬鏁拌幏鍙栦骇鍝佷俊鎭�
const routeBomNo = computed(() => route.query.bomNo || "");
- const routeProductCode = computed(() => route.query.productCode || "");
- const routeProductName = computed(() => route.query.productName || "");
- const routeProductModelName = computed(
- () => route.query.productModelName || ""
- );
+ const routeDictLabel = computed(() => route.query.dictLabel || "");
+
const routeOrderId = computed(() => route.query.orderId);
const pageType = computed(() => route.query.type);
const isOrderPage = computed(
@@ -218,9 +221,8 @@
const tableData = reactive([
{
- productName: "",
- model: "",
bomNo: "",
+ dictLabel: "",
},
]);
@@ -332,12 +334,7 @@
const validateItem = (item: any, isTopLevel = false) => {
console.log(item, "item");
// 鏍¢獙褰撳墠椤圭殑蹇呭~瀛楁
- if (!item.model) {
- ElMessage.error("璇烽�夋嫨瑙勬牸");
- isValid = false;
- return;
- }
- if (!isTopLevel && !item.processId) {
+ if (!item.processId) {
ElMessage.error("璇烽�夋嫨娑堣�楀伐搴�");
isValid = false;
return;
@@ -431,6 +428,23 @@
}
});
};
+ const addItem = () => {
+ dataValue.dataList.push({
+ parentId: "",
+ parentTempId: "",
+ productName: "",
+ productId: "",
+ model: undefined,
+ productModelId: undefined,
+ processId: "",
+ processName: "",
+ unitQuantity: 0,
+ demandedQuantity: 0,
+ unit: "",
+ children: [],
+ tempId: new Date().getTime(),
+ });
+ };
const addItem2 = tempId => {
dataValue.dataList.map(item => {
if (item.tempId === tempId) {
@@ -510,9 +524,8 @@
onMounted(async () => {
// 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
- tableData[0].productName = routeProductName.value as string;
- tableData[0].model = routeProductModelName.value as string;
tableData[0].bomNo = routeBomNo.value as string;
+ tableData[0].dictLabel = routeDictLabel.value as string;
// 璁㈠崟鎯呭喌涓嬬鐢ㄧ紪杈�
if (isOrderPage.value) {
@@ -523,4 +536,13 @@
await fetchProcessOptions();
await fetchData();
});
-</script>
\ No newline at end of file
+</script>
+
+<style scoped>
+ .hover-effect:hover {
+ border-color: #409eff;
+ background-color: #ecf5ff;
+ transform: translateY(-2px);
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/productionManagement/productStructure/StructureEdit.vue b/src/views/productionManagement/productStructure/StructureEdit.vue
index fc46e05..732a070 100644
--- a/src/views/productionManagement/productStructure/StructureEdit.vue
+++ b/src/views/productionManagement/productStructure/StructureEdit.vue
@@ -38,7 +38,7 @@
<template #default="{ row, $index }">
<el-form-item v-if="dataValue.isEdit"
:prop="`dataList.${$index}.model`"
- :rules="[{ required: true, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
+ :rules="[{ required: false, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
style="margin: 0">
<el-select v-model="row.model"
placeholder="璇烽�夋嫨浜у搧"
diff --git a/src/views/productionManagement/productStructure/index.vue b/src/views/productionManagement/productStructure/index.vue
index 7032c09..2309dad 100644
--- a/src/views/productionManagement/productStructure/index.vue
+++ b/src/views/productionManagement/productStructure/index.vue
@@ -567,8 +567,7 @@
query: {
id: row.id,
bomNo: row.bomNo || "",
- productName: row.productName || "",
- productModelName: row.productModelName || "",
+ dictLabel: row.dictLabel || "",
},
});
};
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 761139e..4760456 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,16 +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"
+ <el-form-item label="璁㈠崟鍙�:">
+ <el-input v-model="searchForm.npsNo"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@@ -20,31 +12,67 @@
@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"
style="width: 160px;"
@change="handleQuery" />
</el-form-item>
+ <el-form-item label="浜у搧绫诲瀷:">
+ <el-select v-model="searchForm.strength"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨浜у搧绫诲瀷"
+ clearable
+ @change="handleQuery">
+ <el-option v-for="option in productTypeOptions2"
+ :key="option.dictLabel"
+ :label="option.dictLabel"
+ :value="option.dictLabel" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿:">
+ <el-date-picker v-model="createTime"
+ type="daterange"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ end-placeholder="缁撴潫鏃ユ湡"
+ style="width: 300px;"
+ @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-button type="danger"
+ @click="handleDelete">閫�鍥�</el-button>
+ <el-button @click="handleOut">瀵煎嚭</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 @click="handleOut">瀵煎嚭</el-button>
- </div>
+ <!-- <div style="width:350px;text-align:right;">
+ </div> -->
</div>
<div class="table_list">
<PIMTable rowKey="id"
@@ -54,14 +82,19 @@
: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>
+ <template #quantity="{ row }">
+ {{ row.quantity || '-' }}<span style="color:rgb(63, 95, 211)"> 鏂�</span>
+ </template>
+ <template #completeQuantity="{ row }">
+ {{ row.completeQuantity || '-' }}<span style="color:rgb(42, 169, 146)"> 鏂�</span>
</template>
</PIMTable>
</div>
@@ -90,10 +123,130 @@
</span>
</template>
</el-dialog>
-
<new-product-order v-if="isShowNewModal"
- v-model:visible="isShowNewModal"
- @completed="handleQuery" />
+ v-model:visible="isShowNewModal"
+ @completed="handleQuery" />
+ <!-- 鏉ユ簮鏁版嵁寮圭獥 -->
+ <el-dialog v-model="sourceDataDialogVisible"
+ title="鏉ユ簮鏁版嵁"
+ width="1000px">
+ <div class="applyno-summary1">
+ <div class="summary-item">
+ <span class="summary-label">浜у搧鍚嶇О锛�</span>
+ <span class="summary-value">
+ <el-tag type="primary">{{ sourceRowData.productName || '-' }}</el-tag>
+ </span>
+ </div>
+ <div class="summary-item">
+ <span class="summary-label">浜у搧瑙勬牸锛�</span>
+ <span class="summary-value">{{ sourceRowData.model || '-' }}</span>
+ </div>
+ <div class="summary-item">
+ <span class="summary-label">鐗╂枡缂栫爜锛�</span>
+ <span class="summary-value">{{ sourceRowData.materialCode || '-' }}</span>
+ </div>
+ <div class="summary-item">
+ <span class="summary-label">寮哄害锛�</span>
+ <span class="summary-value">{{ sourceRowData.strength || '-' }}</span>
+ </div>
+ </div>
+ <div class="source-data-container">
+ <!-- 宸︿晶applyNo鍒楄〃 -->
+ <div class="applyno-list">
+ <div class="list-header">鐢宠鍗曞垪琛�</div>
+ <div class="list-body">
+ <div v-for="(item, index) in sourceTableData"
+ :key="item.applyNo || index"
+ class="applyno-item"
+ :class="{ active: selectedApplyNo === item.applyNo }"
+ @click="selectApplyNo(item)">
+ <div class="applyno-text">{{ item.applyNo }}</div>
+ <div class="applyno-info">{{ item.customerName }}</div>
+ </div>
+ </div>
+ </div>
+ <!-- 鍙充晶璇︾粏淇℃伅 -->
+ <div class="detail-info">
+ <div v-if="selectedSourceData && selectedSourceData.items && selectedSourceData.items.length > 0">
+ <div v-for="item in selectedSourceData.items"
+ :key="item.id"
+ class="source-data-card">
+ <!-- <div class="card-header">
+ <div class="data-source-tag">
+ </div>
+ <div class="card-title">浜у搧鏄庣粏</div>
+ </div> -->
+ <div class="card-body">
+ <div class="info-grid">
+ <div class="info-item">
+ <div class="info-label">鏁版嵁鏉ユ簮</div>
+ <div class="info-value">
+ <el-tag :type="item.dataSourceType == 1 ? 'primary' : 'warning'">
+ {{ item.dataSourceType == 1 ? '閽夐拤鍚屾' : '鎵嬪姩鏂板' }}
+ </el-tag>
+ </div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">鍧楁暟</div>
+ <div class="info-value">{{ item.quantity || '-' }}<span style="color:rgb(63, 95, 211)"> 鍧�</span></div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">鏂规暟</div>
+ <div class="info-value">{{ item.volume || '-' }}<span style="color:rgba(27, 104, 90, 0.76)"> 鏂�</span></div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">涓嬪彂鐘舵��</div>
+ <div class="info-value">
+ <el-tag :type="{
+ 0: 'warning',
+ 1: 'primary',
+ 2: 'info'
+ }[item.status] || 'info'">
+ {{ item.status == 0 ? '寰呬笅鍙�' : item.status == 1 ? '閮ㄥ垎涓嬪彂' : '宸蹭笅鍙�' }}
+ </el-tag>
+ </div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">宸蹭笅鍙戞柟鏁�</div>
+ <div class="info-value">{{ item.assignedQuantity ? `${item.assignedQuantity}` : 0 }}<span style="color:rgba(214, 134, 22, 0.76)"> 鏂�</span></div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">灏哄</div>
+ <div class="info-value">{{ item.length || '-' }}mm 脳 {{ item.width || '-' }}mm 脳 {{ item.height || '-' }}mm</div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">璁″垝寮�濮嬫棩鏈�</div>
+ <div class="info-value">{{ item.startDate ? dayjs(item.startDate).format('YYYY-MM-DD') : '' }}</div>
+ </div>
+ <div class="info-item">
+ <div class="info-label">璁″垝缁撴潫鏃ユ湡</div>
+ <div class="info-value">{{ item.endDate ? dayjs(item.endDate).format('YYYY-MM-DD') : '' }}</div>
+ </div>
+ <!-- <div class="info-item">
+ <div class="info-label">寮哄害</div>
+ <div class="info-value">{{ item.strength || '' }}</div>
+ </div> -->
+ </div>
+ <div class="remarks-section">
+ <div class="info-item full-width">
+ <div class="info-label">澶囨敞 1</div>
+ <div class="info-value">{{ item.remarkOne || '-' }}</div>
+ </div>
+ <div class="info-item full-width">
+ <div class="info-label">澶囨敞 2</div>
+ <div class="info-value">{{ item.remarkTwo || '-' }}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div v-else
+ class="empty-state">
+ <el-empty :description="selectedSourceData ? '璇ョ敵璇峰崟鏆傛棤鏁版嵁' : '璇烽�夋嫨涓�涓敵璇峰崟'" />
+ </div>
+ </div>
+ </div>
+ </el-dialog>
</div>
</template>
@@ -102,60 +255,108 @@
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,
+ revokeProductOrder,
+ getProductOrderSource,
} 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();
const router = useRouter();
const isShowNewModal = ref(false);
+ const sourceDataDialogVisible = ref(false);
+ const sourceTableData = ref([]);
+ const selectedApplyNo = ref("");
+ const selectedSourceData = ref(null);
+ const sourceRowData = ref(null);
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: "150px",
},
{
label: "浜у搧鍚嶇О",
- prop: "productCategory",
- width: '120px',
+ prop: "productName",
+ width: "120px",
+ dataType: "tag",
},
{
label: "瑙勬牸",
- prop: "specificationModel",
- width: '120px',
+ prop: "model",
+ width: "120px",
+ },
+ {
+ label: "寮哄害",
+ prop: "strength",
+ width: "120px",
+ dataType: "tag",
+ },
+ {
+ label: "鐗╂枡缂栫爜",
+ prop: "materialCode",
+ width: "120px",
},
{
label: "宸ヨ壓璺嚎缂栧彿",
prop: "processRouteCode",
- width: '200px',
+ width: "200px",
+ className: "status-cell",
},
{
label: "闇�姹傛暟閲�",
prop: "quantity",
+ dataType: "slot",
+ align: "right",
+ slot: "quantity",
+ width: 120,
},
{
label: "瀹屾垚鏁伴噺",
prop: "completeQuantity",
+ dataType: "slot",
+ align: "right",
+ slot: "completeQuantity",
+ width: 120,
},
{
dataType: "slot",
@@ -178,17 +379,31 @@
},
{
label: "浜や粯鏃ユ湡",
- prop: "deliveryDate",
+ prop: "planCompleteTime",
formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
width: 120,
},
+ {
+ label: "鍒涘缓鏃堕棿",
+ prop: "createTime",
+ formatData: val => (val ? dayjs(val).format("YYYY-MM-DD HH:mm:ss") : ""),
+ 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 +414,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);
+ // },
+ // },
],
},
]);
@@ -223,13 +446,168 @@
});
const selectedRows = ref([]);
+ // 鏉ユ簮鏁版嵁寮圭獥鐩稿叧
+ const sourceTableColumn = ref([
+ {
+ label: "鏁版嵁鏉ユ簮",
+ width: "100px",
+ prop: "dataSourceType",
+ dataType: "tag",
+ formatType: params => {
+ const typeMap = {
+ 2: "warning",
+ 1: "primary",
+ };
+ return typeMap[params] || "info";
+ },
+ formatData: cell => (cell == 1 ? "閽夐拤鍚屾" : "鎵嬪姩鏂板"),
+ },
+ {
+ label: "鐢宠鍗曠紪鍙�",
+ prop: "applyNo",
+ width: "150px",
+ },
+ {
+ label: "瀹㈡埛鍚嶇О",
+ prop: "customerName",
+ width: "150px",
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ width: "200px",
+ dataType: "tag",
+ formatType: params => {
+ return "primary";
+ },
+ },
+ {
+ label: "浜у搧瑙勬牸",
+ prop: "model",
+ width: "150px",
+ className: "spec-cell",
+ },
+ {
+ label: "鐗╂枡缂栫爜",
+ prop: "materialCode",
+ width: "150px",
+ },
+ {
+ label: "鍧楁暟",
+ prop: "quantity",
+ align: "right",
+ dataType: "slot",
+ slot: "quantity",
+ },
+ {
+ label: "鏂规暟",
+ prop: "volume",
+ width: "150px",
+ align: "right",
+ dataType: "slot",
+ slot: "volume",
+ className: "volume-cell",
+ },
+ {
+ label: "涓嬪彂鐘舵��",
+ prop: "status",
+ width: "150px",
+ className: "status-cell",
+ dataType: "tag",
+ formatType: params => {
+ const typeMap = {
+ 0: "warning",
+ 1: "primary",
+ 2: "info",
+ };
+ return typeMap[params] || "info";
+ },
+ formatData: cell => {
+ const statusMap = {
+ 0: "寰呬笅鍙�",
+ 1: "閮ㄥ垎涓嬪彂",
+ 2: "宸蹭笅鍙�",
+ };
+ return statusMap[cell] || "";
+ },
+ },
+ {
+ label: "宸蹭笅鍙戞柟鏁�",
+ prop: "assignedQuantity",
+ width: "150px",
+ className: "spec-cell",
+ formatData: cell => (cell ? `${cell}鏂筦 : 0),
+ },
+ {
+ label: "闀�",
+ prop: "length",
+ className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
+ },
+ {
+ label: "瀹�",
+ prop: "width",
+ className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
+ },
+ {
+ label: "楂�",
+ prop: "height",
+ className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
+ },
+ {
+ label: "璁″垝寮�濮嬫棩鏈�",
+ prop: "startDate",
+ width: "150px",
+ className: "date-cell",
+ formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
+ },
+ {
+ label: "璁″垝缁撴潫鏃ユ湡",
+ prop: "endDate",
+ width: "150px",
+ className: "date-cell",
+ formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
+ },
+ {
+ label: "寮哄害",
+ prop: "strength",
+ formatData: cell => {
+ if (!cell) return "";
+ return cell;
+ },
+ },
+ {
+ label: "澶囨敞 1",
+ width: "150px",
+ prop: "remarkOne",
+ },
+ {
+ label: "澶囨敞 2",
+ width: "150px",
+ prop: "remarkTwo",
+ },
+ ]);
+ const sourceTableLoading = ref(false);
+ const sourcePage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+
const data = reactive({
searchForm: {
customerName: "",
salesContractNo: "",
projectName: "",
- productCategory: "",
- specificationModel: "",
+ productName: "",
+ model: "",
+ dictCode: null,
+ startTime: null,
+ endTime: null,
+ strength: null,
+ status: "",
},
});
const { searchForm } = toRefs(data);
@@ -253,19 +631,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 +650,7 @@
const bindRouteLoading = ref(false);
const bindRouteSaving = ref(false);
const routeOptions = ref([]);
+ const productTypeOptions = ref([]);
const bindForm = reactive({
orderId: null,
routeId: null,
@@ -283,15 +661,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 +716,27 @@
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: "",
+ strength: null,
+ startTime: null,
+ endTime: null,
+ };
+ createTime.value = [];
+ handleQuery();
+ };
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
@@ -343,11 +758,25 @@
}
handleQuery();
};
+ const createTime = ref([]);
const getList = () => {
tableLoading.value = true;
// 鏋勯�犱竴涓柊鐨勫璞★紝涓嶅寘鍚玡ntryDate瀛楁
const params = { ...searchForm.value, ...page };
params.entryDate = undefined;
+ params.startTime =
+ createTime.value.length > 0
+ ? dayjs(createTime.value[0]).format("YYYY-MM-DD HH:mm:ss")
+ : undefined;
+ params.endTime =
+ createTime.value.length > 0
+ ? dayjs(createTime.value[1])
+ .hour(23)
+ .minute(59)
+ .second(59)
+ .format("YYYY-MM-DD HH:mm:ss")
+ : undefined;
+
productOrderListPage(params)
.then(res => {
tableLoading.value = false;
@@ -362,23 +791,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 +817,128 @@
};
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 selectApplyNo = item => {
+ selectedApplyNo.value = item.applyNo;
+ selectedSourceData.value = item;
+ };
+
+ // 鏌ョ湅鏉ユ簮鐢熶骇璁″垝鏁版嵁
+ const showSourceData = row => {
+ // 瀛樺偍鐐瑰嚮鏉ユ簮鎸夐挳鏃朵紶閫掔殑row鍙傛暟
+ sourceRowData.value = row;
+ // 璋冪敤API鑾峰彇鏉ユ簮鏁版嵁
+ getProductOrderSource(row.id)
+ .then(res => {
+ if (res.code === 200) {
+ // 澶勭悊鎺ュ彛杩斿洖鐨勬暟鎹紝璋冩暣涓烘垜浠渶瑕佺殑鏍煎紡
+ sourceTableData.value = res.data.map(item => {
+ return {
+ applyNo: item.applyNo,
+ customerName: item.productPlans[0]?.customerName || "",
+ items: item.productPlans.map(plan => {
+ return {
+ id: plan.id,
+ dataSourceType: plan.dataSourceType,
+ productName: plan.productName,
+ model: plan.model,
+ materialCode: plan.materialCode,
+ quantity: plan.quantity,
+ volume: plan.volume,
+ status: plan.status,
+ assignedQuantity: plan.assignedQuantity,
+ length: plan.length,
+ width: plan.width,
+ height: plan.height,
+ startDate: plan.startDate,
+ endDate: plan.endDate,
+ strength: plan.strength,
+ remarkOne: plan.remarkOne,
+ remarkTwo: plan.remarkTwo,
+ };
+ }),
+ };
+ });
+ sourcePage.total = sourceTableData.value.length;
+ // 榛樿閫夋嫨绗竴涓敵璇峰崟
+ if (sourceTableData.value.length > 0) {
+ selectApplyNo(sourceTableData.value[0]);
+ } else {
+ selectedApplyNo.value = "";
+ selectedSourceData.value = null;
+ }
+ // 鎵撳紑寮圭獥
+ sourceDataDialogVisible.value = true;
+ } else {
+ proxy.$modal.msgError(res.msg || "鑾峰彇鏉ユ簮鏁版嵁澶辫触");
+ }
+ })
+ .catch(err => {
+ proxy.$modal.msgError("鑾峰彇鏉ユ簮鏁版嵁澶辫触");
+ console.error(err);
+ });
+ };
+
// 琛ㄦ牸閫夋嫨鏁版嵁
- 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(() => {
+ revokeProductOrder(ids).then(res => {
+ proxy.$modal.msgSuccess("閫�鍥炴垚鍔�");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
};
// 瀵煎嚭
@@ -436,7 +949,11 @@
type: "warning",
})
.then(() => {
- proxy.download("/productOrder/export", {...searchForm.value}, "鐢熶骇璁㈠崟.xlsx");
+ proxy.download(
+ "/productOrder/export",
+ { ...searchForm.value },
+ "鐢熶骇璁㈠崟.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -444,30 +961,274 @@
};
const handleConfirmRoute = () => {};
+ const productTypeOptions2 = ref([]);
+ // 鑾峰彇浜у搧绫诲瀷瀛楀吀
+ const getProductTypeOptions = () => {
+ getDicts("block_strength")
+ .then(res => {
+ if (res.code === 200) {
+ productTypeOptions2.value = res.data;
+ }
+ })
+ .catch(err => {
+ console.error("鑾峰彇浜у搧绫诲瀷瀛楀吀澶辫触锛�", err);
+ });
+ };
onMounted(() => {
+ getProductTypeOptions();
getList();
});
</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>
+<style lang="scss">
+ .status-cell {
+ font-weight: 600;
+ color: #409eff;
+ font-family: "Courier New", monospace;
+ text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2);
+ }
+
+ .source-data-container {
+ display: flex;
+ gap: 20px;
+ height: 500px;
+
+ .applyno-list {
+ width: 250px;
+ background: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+
+ .list-header {
+ padding: 12px 16px;
+ background: #f5f7fa;
+ border-bottom: 1px solid #e4e7ed;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .list-body {
+ height: calc(100% - 48px);
+ overflow-y: auto;
+
+ .applyno-item {
+ padding: 12px 16px;
+ border-bottom: 1px solid #f0f2f5;
+ cursor: pointer;
+ transition: all 0.3s;
+
+ &:hover {
+ background: #f5f7fa;
+ }
+
+ &.active {
+ background: #ecf5ff;
+ border-left: 4px solid #409eff;
+ }
+
+ .applyno-text {
+ font-weight: 600;
+ color: #303133;
+ font-family: "Courier New", monospace;
+ margin-bottom: 4px;
+ }
+
+ .applyno-info {
+ font-size: 12px;
+ color: #909399;
+ }
+ }
+ }
+ }
+
+ .detail-info {
+ flex: 1;
+ background: #fff;
+ border-radius: 8px;
+ // box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ overflow: auto;
+ display: flex;
+ flex-direction: column;
+
+ .applyno-summary {
+ padding: 16px 20px;
+ background: #f5f7fa;
+ border-bottom: 1px solid #e4e7ed;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px;
+
+ .summary-item {
+ display: flex;
+ align-items: center;
+
+ .summary-label {
+ font-size: 13px;
+ color: #909399;
+ margin-right: 8px;
+ font-weight: 500;
+ }
+
+ .summary-value {
+ font-size: 14px;
+ color: #303133;
+ font-weight: 500;
+ }
+ }
+ }
+
+ .empty-state {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .source-data-card {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ margin-top: 20px;
+ margin-right: 20px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+
+ .card-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px 20px;
+ background: #f5f7fa;
+ border-bottom: 1px solid #e4e7ed;
+
+ .data-source-tag {
+ flex-shrink: 0;
+ }
+
+ .card-title {
+ font-weight: 600;
+ color: #303133;
+ font-size: 14px;
+ }
+ }
+
+ .card-body {
+ flex: 1;
+ padding: 20px;
+ overflow-y: auto;
+ background-color: #f5f7fa;
+
+ .info-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 16px;
+ margin-bottom: 20px;
+
+ .info-item {
+ display: flex;
+ flex-direction: column;
+
+ .info-label {
+ font-size: 12px;
+ color: #909399;
+ margin-bottom: 4px;
+ font-weight: 500;
+ }
+
+ .info-value {
+ font-size: 14px;
+ color: #303133;
+ font-weight: 500;
+ }
+ }
+
+ .info-item.full-width {
+ grid-column: 1 / -1;
+ }
+ }
+
+ .remarks-section {
+ display: flex;
+ // flex-direction: column;
+ gap: 12px;
+ border-top: 1px solid #e4e7ed;
+ padding-top: 16px;
+
+ .info-item {
+ display: flex;
+ width: 50%;
+ flex-direction: column;
+
+ .info-label {
+ font-size: 12px;
+ color: #909399;
+ margin-bottom: 4px;
+ font-weight: 500;
+ }
+
+ .info-value {
+ font-size: 14px;
+ color: #303133;
+ line-height: 1.5;
+ padding: 8px;
+ background: #f9fafc;
+ border-radius: 4px;
+ border: 1px solid #ecf5ff;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ .applyno-summary1 {
+ padding: 16px 20px;
+ background: #f5f7fa;
+ border-bottom: 1px solid #e4e7ed;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px;
+
+ .summary-item {
+ display: flex;
+ align-items: center;
+ margin-right: 20px;
+
+ .summary-label {
+ font-size: 13px;
+ color: #909399;
+ margin-right: 8px;
+ font-weight: 500;
+ }
+
+ .summary-value {
+ font-size: 14px;
+ color: #303133;
+ font-weight: 500;
+ }
+ }
+ }
</style>
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 9994b94..b99c8d6 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -51,9 +51,9 @@
{{ process.status ? '鍚敤' : '鍋滅敤' }}
</el-tag>
<el-tag size="small"
- :type="process.isQuality ? 'warning' : 'info'"
+ :type="process.isQuality == 1 ? 'warning' : 'info'"
style="margin-left: 8px">
- {{ process.isQuality ? '璐ㄦ' : '闈炶川妫�' }}
+ {{ process.isQuality == 1 ? '璐ㄦ' : '闈炶川妫�' }}
</el-tag>
</div>
<span class="param-count">宸ヨ祫瀹氶: 楼{{ process.salaryQuota || 0 }}</span>
@@ -119,8 +119,8 @@
<el-form-item label="鏄惁璐ㄦ"
prop="isQuality">
<el-switch v-model="processForm.isQuality"
- :active-value="true"
- inactive-value="false" />
+ :active-value="1"
+ :inactive-value="0" />
</el-form-item>
<el-form-item label="宸ュ簭鎻忚堪"
prop="remark">
@@ -249,8 +249,8 @@
</el-form-item>
<el-form-item label="鏄惁蹇呭~">
<el-switch v-model="selectedParam.isRequired"
- :active-value="1"
- :inactive-value="0" />
+ :active-value="true"
+ :inactive-value="false" />
</el-form-item>
</el-form>
<el-empty v-else
@@ -313,8 +313,8 @@
<el-form-item label="鏄惁蹇呭~"
prop="isRequired">
<el-switch v-model="editParamForm.isRequired"
- :active-value="1"
- :inactive-value="0" />
+ :active-value="true"
+ :inactive-value="false" />
</el-form-item>
</el-form>
<template #footer>
@@ -368,7 +368,7 @@
no: "",
name: "",
salaryQuota: null,
- isQuality: false,
+ isQuality: 0,
remark: "",
status: true,
});
@@ -418,7 +418,7 @@
minValue: null,
maxValue: null,
sort: 1,
- isRequired: 0,
+ isRequired: false,
tenantId: 1,
});
const editParamRules = {
@@ -562,8 +562,8 @@
label: "鏄惁蹇呭~",
prop: "isRequired",
dataType: "tag",
- formatType: row => (row.isRequired === 1 ? "success" : "info"),
- formatData: row => (row.isRequired === 1 ? "鏄�" : "鍚�"),
+ formatType: row => (row.isRequired === true ? "success" : "info"),
+ formatData: row => (row.isRequired === true ? "鏄�" : "鍚�"),
},
{
label: "鎿嶄綔",
@@ -626,7 +626,7 @@
processForm.no = "";
processForm.name = "";
processForm.salaryQuota = null;
- processForm.isQuality = false;
+ processForm.isQuality = 0;
processForm.remark = "";
processForm.status = true;
processDialogVisible.value = true;
@@ -638,7 +638,7 @@
processForm.no = process.no;
processForm.name = process.name;
processForm.salaryQuota = process.salaryQuota;
- processForm.isQuality = process.isQuality || false;
+ processForm.isQuality = process.isQuality || 0;
processForm.remark = process.remark || "";
processForm.status = process.status;
processDialogVisible.value = true;
@@ -797,7 +797,7 @@
editParamForm.minValue = row.minValue;
editParamForm.maxValue = row.maxValue;
editParamForm.sort = row.sort || 1;
- editParamForm.isRequired = row.isRequired || 0;
+ editParamForm.isRequired = row.isRequired || false;
editParamForm.tenantId = 1;
editParamDialogVisible.value = true;
};
@@ -830,7 +830,7 @@
standardValue: selectedParam.value.standardValue,
minValue: selectedParam.value.minValue,
maxValue: selectedParam.value.maxValue,
- isRequired: selectedParam.value.isRequired || 0,
+ isRequired: selectedParam.value.isRequired || false,
tenantId: 1,
})
.then(() => {
@@ -990,17 +990,52 @@
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
+ min-width: 0;
}
.param-table-wrapper {
flex: 1;
padding: 0 20px 20px;
overflow: auto;
+ min-width: 100%;
}
/* 琛ㄦ牸妯悜婊氬姩 */
- :deep(.el-table) {
- // min-width: 800px;
+ .param-table-wrapper :deep(.el-table) {
+ min-width: 100%;
+ }
+
+ .param-table-wrapper :deep(.el-table__body-wrapper) {
+ overflow-x: auto;
+ }
+
+ .pagination-container {
+ margin-top: 10px;
+ overflow-x: auto;
+ padding-bottom: 8px;
+ }
+
+ .pagination-container .el-pagination {
+ white-space: nowrap;
+ }
+
+ /* 鍝嶅簲寮忚皟鏁� */
+ @media screen and (max-width: 768px) {
+ .pagination-container {
+ font-size: 12px;
+ }
+
+ .pagination-container .el-pagination__sizes {
+ margin-right: 8px;
+ }
+
+ .pagination-container .el-pagination__jump {
+ margin-left: 8px;
+ }
+
+ .pagination-container .el-pagination__page-size {
+ font-size: 12px;
+ }
}
.empty-tip {
diff --git a/src/views/productionManagement/productionReporting/components/ReportingDialog.vue b/src/views/productionManagement/productionReporting/components/ReportingDialog.vue
new file mode 100644
index 0000000..8eff508
--- /dev/null
+++ b/src/views/productionManagement/productionReporting/components/ReportingDialog.vue
@@ -0,0 +1,588 @@
+<template>
+ <el-dialog v-model="localVisible"
+ :title="dialogTitle"
+ width="800px"
+ @close="handleClose">
+ <!-- 姝ラ鏉� -->
+ <el-steps :active="activeStep"
+ finish-status="success">
+ <el-step title="閫夋嫨鐢熶骇璁㈠崟" />
+ <el-step title="濉啓鍩虹淇℃伅" />
+ <el-step title="鏌ョ湅宸ュ簭鍙傛暟" />
+ <el-step title="濉啓浜ч噺淇℃伅" />
+ </el-steps>
+ <!-- 绗竴姝ワ細閫夋嫨鐢熶骇璁㈠崟 -->
+ <div v-if="activeStep === 0">
+ <el-form :model="form"
+ ref="formRef"
+ label-width="120px">
+ <el-form-item label="鐢熶骇璁㈠崟"
+ prop="orderId"
+ required>
+ <el-select v-model="orderId"
+ placeholder="璇烽�夋嫨鐢熶骇璁㈠崟"
+ clearable
+ filterable
+ style="width: 100%"
+ :loading="orderLoading"
+ @change="handleOrderChange">
+ <el-option v-for="order in orderList"
+ :key="order.id"
+ :label="`${order.npsNo} - ${order.productName} ${order.model}`"
+ :value="order.id" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ </div>
+ <!-- 绗簩姝ワ細濉啓鍩虹淇℃伅 -->
+ <div v-else-if="activeStep === 1">
+ <el-form :model="form"
+ :rules="rules"
+ ref="formRef"
+ label-width="120px">
+ <el-form-item label="鐢熶骇璁㈠崟鍙�"
+ prop="npsNo">
+ <el-input disabled
+ v-model="form.npsNo" />
+ </el-form-item>
+ <el-form-item label="鐝粍"
+ prop="teamName"
+ required>
+ <el-select v-model="form.teamName"
+ placeholder="璇烽�夋嫨鐝粍"
+ style="width: 100%">
+ <el-option label="鐧界彮"
+ value="鐧界彮" />
+ <el-option label="澶滅彮"
+ value="澶滅彮" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="浜у搧缂栫爜"
+ prop="materialCode">
+ <el-input disabled
+ v-model="form.materialCode" />
+ </el-form-item>
+ <el-form-item label="浜у搧鍚嶇О"
+ prop="productName">
+ <el-input disabled
+ v-model="form.productName" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸"
+ prop="specification">
+ <el-input disabled
+ v-model="form.specification" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓浜�"
+ prop="createBy"
+ required>
+ <el-input v-model="form.createBy"
+ placeholder="璇疯緭鍏ュ垱寤轰汉" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿"
+ prop="createTime">
+ <el-date-picker disabled
+ v-model="form.createTime"
+ type="datetime"
+ placeholder="璇烽�夋嫨鍒涘缓鏃堕棿"
+ style="width: 100%" />
+ </el-form-item>
+ </el-form>
+ </div>
+ <!-- 绗笁姝ワ細鏌ョ湅宸ュ簭鍙傛暟 -->
+ <div v-else-if="activeStep === 2">
+ <!-- 宸ュ簭Tab椤� -->
+ <el-tabs v-model="activeProcessId"
+ @tab-click="handleTabClick">
+ <el-tab-pane v-for="process in processList"
+ :key="process.id"
+ :label="process.processName"
+ :name="process.id + ''">
+ <div>
+ <!-- 鍙傛暟缁勫垪琛� -->
+ <div v-for="(group, groupIndex) in form.paramGroups[process.id] || []"
+ :key="groupIndex"
+ class="param-group">
+ <div class="group-header">
+ <span>鍙傛暟缁� {{ groupIndex + 1 }}</span>
+ <el-button type="danger"
+ size="small"
+ @click="removeParamGroup(process.id, groupIndex)"
+ v-if="(form.paramGroups[process.id] || []).length > 1">
+ 鍒犻櫎
+ </el-button>
+ </div>
+ <el-form :model="form"
+ ref="formRef"
+ label-width="120px">
+ <!-- 鍔ㄦ�佸弬鏁� -->
+ <el-form-item v-for="param in params"
+ :key="param.id"
+ :label="param.paramName">
+ <template v-if="param.paramType == '1'">
+ <!-- 鏁板瓧绫诲瀷 -->
+ <div style="display: flex; align-items: center; gap: 8px;">
+ <el-input-number v-model="group[param.id]"
+ controls-position="right"
+ :precision="getPrecision(param.paramFormat)"
+ style="flex: 1" />
+ <span v-if="param.unit && param.unit != '/'">
+ {{ param.unit }}
+ </span>
+ </div>
+ </template>
+ <template v-else-if="param.paramType == '2'">
+ <!-- 鏂囨湰绫诲瀷 -->
+ <div style="display: flex; align-items: center; gap: 8px;">
+ <el-input v-model="group[param.id]"
+ style="flex: 1" />
+ <span v-if="param.unit && param.unit != '/'">
+ {{ param.unit }}
+ </span>
+ </div>
+ </template>
+ <template v-else-if="param.paramType == '3'">
+ <!-- 瀛楀吀绫诲瀷 -->
+ <div style="display: flex; align-items: center; gap: 8px;">
+ <el-select v-model="group[param.id]"
+ placeholder="璇烽�夋嫨"
+ style="flex: 1;width: 150px">
+ <el-option v-for="option in dictOptions[param.paramFormat] || []"
+ :key="option.dictValue"
+ :label="option.dictLabel"
+ :value="option.dictValue" />
+ </el-select>
+ <span v-if="param.unit && param.unit != '/'">
+ {{ param.unit }}
+ </span>
+ </div>
+ </template>
+ <template v-else-if="param.paramType == '4'">
+ <!-- 鏃ユ湡绫诲瀷 -->
+ <div style="display: flex; align-items: center; gap: 8px;">
+ <el-date-picker :value-format="param.paramFormat"
+ :format="param.paramFormat"
+ :type="param.paramFormat=='YYYY-MM-DD'?'daterange':'datetimerange'"
+ v-model="group[param.id]"
+ style="flex: 1" />
+ <span v-if="param.unit && param.unit != '/'">
+ {{ param.unit }}
+ </span>
+ </div>
+ </template>
+ <template v-else>
+ <!-- 鍏朵粬绫诲瀷 -->
+ <div style="display: flex; align-items: center; gap: 8px;">
+ <el-input v-model="group[param.id]"
+ style="flex: 1" />
+ <span v-if="param.unit && param.unit != '/'">
+ {{ param.unit }}
+ </span>
+ </div>
+ </template>
+ </el-form-item>
+ </el-form>
+ </div>
+ <!-- 鏂板鍙傛暟缁勬寜閽� -->
+ <el-button type="primary"
+ size="small"
+ @click="addParamGroup(process.id)">
+ 鏂板鍙傛暟缁�
+ </el-button>
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+ <!-- 绗洓姝ワ細濉啓浜ч噺淇℃伅 -->
+ <div v-else-if="activeStep === 3">
+ <el-form :model="form"
+ :rules="rules"
+ ref="formRef"
+ label-width="120px">
+ <el-form-item label="浜у嚭鏂归噺"
+ prop="outputVolume"
+ required>
+ <el-input-number v-model="form.outputVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="涓嶅悎鏍兼柟閲�"
+ prop="unqualifiedVolume"
+ required>
+ <el-input-number v-model="form.unqualifiedVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="瀹屾垚鏂归噺"
+ prop="completedVolume"
+ required>
+ <el-input-number v-model="form.completedVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ </el-form>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="handleClose">鍙� 娑�</el-button>
+ <el-button type="primary"
+ v-if="activeStep > 0"
+ @click="activeStep--">涓婁竴姝�</el-button>
+ <el-button type="primary"
+ v-if="activeStep < 3"
+ @click="handleNextStep">涓嬩竴姝�</el-button>
+ <el-button type="primary"
+ v-if="activeStep === 3"
+ :loading="submitLoading"
+ @click="handleSubmit">纭� 璁�</el-button>
+ </span>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+ import { ref, reactive, computed, watch } from "vue";
+ import { ElMessage } from "element-plus";
+ import { getDicts } from "@/api/system/dict/data";
+ import { productOrderListPage } from "@/api/productionManagement/productionOrder.js";
+ import {
+ findProductProcessRouteItemList,
+ findProcessParamListOrder,
+ } from "@/api/productionManagement/productProcessRoute.js";
+
+ const props = defineProps({
+ visible: {
+ type: Boolean,
+ default: false,
+ },
+ data: {
+ type: Object,
+ default: () => ({}),
+ },
+ });
+
+ const emit = defineEmits(["update:visible", "completed"]);
+
+ const dialogTitle = computed(() => (props.data.id ? "缂栬緫鎶ュ伐" : "鏂板鎶ュ伐"));
+
+ const formRef = ref(null);
+ const submitLoading = ref(false);
+ const orderLoading = ref(false);
+ const processLoading = ref(false);
+ const localVisible = ref(props.visible);
+ const activeStep = ref(0);
+
+ const orderId = ref(props.data.orderId || "");
+ const processId = ref(props.data.processId || "");
+ const activeProcessId = ref("");
+ const orderList = ref([]);
+ const processList = ref([]);
+ const params = ref([]);
+ const dictOptions = ref({});
+
+ const form = reactive({
+ id: props.data.id || undefined,
+ orderId: props.data.orderId || "",
+ npsNo: props.data.npsNo || "",
+ teamName: props.data.teamName || "",
+ materialCode: props.data.materialCode || "",
+ productName: props.data.productName || "",
+ specification: props.data.specification || "",
+ outputVolume: props.data.outputVolume || 0,
+ unqualifiedVolume: props.data.unqualifiedVolume || 0,
+ completedVolume: props.data.completedVolume || 0,
+ createBy: props.data.createBy || "褰撳墠鐧诲綍浜�",
+ createTime: props.data.createTime || new Date(),
+ paramGroups: props.data.paramGroups || {}, // 瀛樺偍姣忎釜宸ュ簭鐨勫弬鏁扮粍
+ });
+
+ const rules = {
+ teamName: [{ required: true, message: "璇烽�夋嫨鐝粍", trigger: "blur" }],
+ outputVolume: [
+ { required: true, message: "璇疯緭鍏ヤ骇鍑烘柟閲�", trigger: "blur" },
+ ],
+ unqualifiedVolume: [
+ { required: true, message: "璇疯緭鍏ヤ笉鍚堟牸鏂归噺", trigger: "blur" },
+ ],
+ completedVolume: [
+ { required: true, message: "璇疯緭鍏ュ畬鎴愭柟閲�", trigger: "blur" },
+ ],
+ createBy: [{ required: true, message: "璇疯緭鍏ュ垱寤轰汉", trigger: "blur" }],
+ };
+
+ // 鍔犺浇鐢熶骇璁㈠崟鍒楄〃
+ const loadOrders = () => {
+ orderLoading.value = true;
+ productOrderListPage({ pageNum: 1, pageSize: 100 })
+ .then(res => {
+ orderList.value = res.data.records || [];
+ })
+ .finally(() => {
+ orderLoading.value = false;
+ });
+ };
+
+ // 澶勭悊鐢熶骇璁㈠崟閫夋嫨
+ const handleOrderChange = val => {
+ if (val) {
+ const order = orderList.value.find(item => item.id === val);
+ if (order) {
+ form.orderId = val;
+ form.npsNo = order.npsNo;
+ form.materialCode = order.materialCode;
+ form.productName = order.productName;
+ form.specification = order.model;
+ }
+ // 鍔犺浇宸ュ簭鍒楄〃
+ loadProcesses(val);
+ } else {
+ form.orderId = "";
+ form.npsNo = "";
+ form.materialCode = "";
+ form.productName = "";
+ form.specification = "";
+ processId.value = "";
+ activeProcessId.value = "";
+ processList.value = [];
+ params.value = [];
+ form.params = {};
+ }
+ };
+
+ // 鍔犺浇宸ュ簭鍒楄〃
+ const loadProcesses = orderId => {
+ processLoading.value = true;
+ findProductProcessRouteItemList({ orderId })
+ .then(res => {
+ processList.value = res.data || [];
+ // 濡傛灉鏈夊伐搴忥紝榛樿閫夋嫨绗竴涓�
+ if (processList.value.length > 0) {
+ const firstProcess = processList.value[0];
+ activeProcessId.value = firstProcess.id + "";
+ processId.value = firstProcess.id;
+ form.processId = firstProcess.id;
+ // 鍔犺浇绗竴涓伐搴忕殑鍙傛暟
+ loadParams(firstProcess.id, orderId);
+ }
+ })
+ .finally(() => {
+ processLoading.value = false;
+ });
+ };
+
+ // 澶勭悊tab椤电偣鍑�
+ const handleTabClick = tab => {
+ const selectedProcessId = parseInt(tab.paneName);
+ processId.value = selectedProcessId;
+ form.processId = selectedProcessId;
+ // 鍔犺浇鍙傛暟鍒楄〃
+ loadParams(selectedProcessId, form.orderId);
+ };
+
+ // 鑾峰彇瀛楀吀鏁版嵁
+ const getDictOptions = async dictType => {
+ if (!dictType) return [];
+ if (dictOptions.value[dictType]) return dictOptions.value[dictType];
+
+ try {
+ const res = await getDicts(dictType);
+ if (res.code === 200) {
+ dictOptions.value[dictType] = res.data;
+ return res.data;
+ }
+ return [];
+ } catch (error) {
+ console.error("鑾峰彇瀛楀吀鏁版嵁澶辫触:", error);
+ return [];
+ }
+ };
+
+ // 鍔犺浇鍙傛暟鍒楄〃
+ const loadParams = (processId, orderId) => {
+ findProcessParamListOrder({ orderId, routeItemId: processId }).then(
+ async res => {
+ params.value = res.data || [];
+ // 鍒濆鍖栧弬鏁扮粍
+ if (!form.paramGroups[processId]) {
+ form.paramGroups[processId] = [];
+ }
+ // 濡傛灉娌℃湁鍙傛暟缁勶紝娣诲姞涓�涓粯璁ゅ弬鏁扮粍
+ if (form.paramGroups[processId].length === 0) {
+ const defaultGroup = {};
+ for (const param of params.value) {
+ defaultGroup[param.id] = param.standardValue || "";
+ // 濡傛灉鏄瓧鍏哥被鍨嬪弬鏁帮紝鑾峰彇瀛楀吀鏁版嵁
+ if (param.paramType == "3" && param.paramFormat) {
+ await getDictOptions(param.paramFormat);
+ }
+ }
+ form.paramGroups[processId].push(defaultGroup);
+ }
+ }
+ );
+ };
+
+ // 鑾峰彇灏忔暟绮惧害
+ const getPrecision = format => {
+ if (!format) return 2;
+ const match = format.match(/\.(\d+)/);
+ return match ? parseInt(match[1].length) : 2;
+ };
+
+ // 澶勭悊涓嬩竴姝�
+ const handleNextStep = () => {
+ if (activeStep.value === 0) {
+ // 绗竴姝ワ細楠岃瘉鐢熶骇璁㈠崟閫夋嫨
+ if (!orderId.value) {
+ ElMessage.error("璇烽�夋嫨鐢熶骇璁㈠崟");
+ return;
+ }
+ activeStep.value = 1;
+ } else if (activeStep.value === 1) {
+ // 绗簩姝ワ細楠岃瘉鍩虹淇℃伅
+ formRef.value.validate(valid => {
+ if (valid) {
+ activeStep.value = 2;
+ }
+ });
+ } else if (activeStep.value === 2) {
+ // 绗笁姝ワ細鐩存帴杩涘叆绗洓姝�
+ activeStep.value = 3;
+ }
+ };
+
+ // 澶勭悊鎻愪氦
+ const handleSubmit = () => {
+ formRef.value.validate(valid => {
+ if (valid) {
+ submitLoading.value = true;
+ // 杩欓噷鍙互璋冪敤API杩涜鎻愪氦
+ setTimeout(() => {
+ ElMessage.success(props.data.id ? "淇敼鎴愬姛" : "鏂板鎴愬姛");
+ localVisible.value = false;
+ emit("completed");
+ submitLoading.value = false;
+ }, 1000);
+ }
+ });
+ };
+
+ // 澶勭悊鍏抽棴
+ const handleClose = () => {
+ // 閲嶇疆鍒板垵濮嬬姸鎬�
+ activeStep.value = 0;
+ orderId.value = "";
+ processId.value = "";
+ activeProcessId.value = "";
+ processList.value = [];
+ params.value = [];
+ Object.assign(form, {
+ id: undefined,
+ orderId: "",
+ npsNo: "",
+ teamName: "",
+ materialCode: "",
+ productName: "",
+ specification: "",
+ outputVolume: 0,
+ unqualifiedVolume: 0,
+ completedVolume: 0,
+ createBy: "褰撳墠鐧诲綍浜�",
+ createTime: new Date(),
+ params: {},
+ });
+ localVisible.value = false;
+ };
+
+ // 鏂板鍙傛暟缁�
+ const addParamGroup = processId => {
+ if (!form.paramGroups[processId]) {
+ form.paramGroups[processId] = [];
+ }
+ // 鍒涘缓涓�涓柊鐨勫弬鏁扮粍锛屼娇鐢ㄩ粯璁ゅ��
+ const newGroup = {};
+ params.value.forEach(param => {
+ newGroup[param.id] = param.standardValue || "";
+ });
+ form.paramGroups[processId].push(newGroup);
+ };
+
+ // 鍒犻櫎鍙傛暟缁�
+ const removeParamGroup = (processId, index) => {
+ if (form.paramGroups[processId] && form.paramGroups[processId].length > 1) {
+ form.paramGroups[processId].splice(index, 1);
+ }
+ };
+
+ // 鍒濆鍖�
+ const init = () => {
+ // 鏃犺鏂板杩樻槸缂栬緫锛岄兘鍔犺浇璁㈠崟鍒楄〃
+ loadOrders();
+
+ if (props.data.id) {
+ // 缂栬緫鏃惰缃〃鍗曟暟鎹�
+ Object.assign(form, props.data);
+ // 璁剧疆orderId
+ orderId.value = props.data.orderId || "";
+ // 濡傛灉鏈夎鍗旾D锛屽姞杞藉伐搴忓拰鍙傛暟
+ if (props.data.orderId) {
+ // 妯℃嫙閫夋嫨璁㈠崟鐨勬搷浣滐紝瑙﹀彂鏁版嵁鍔犺浇
+ setTimeout(() => {
+ handleOrderChange(props.data.orderId);
+ }, 100);
+ }
+ } else {
+ // 鏂板鏃惰缃粯璁ゅ��
+ form.createBy = "褰撳墠鐧诲綍浜�";
+ form.createTime = new Date();
+ }
+ // 濮嬬粓浠庣涓�姝ュ紑濮�
+ activeStep.value = 0;
+ };
+
+ // 鐩戝惉props.visible鍙樺寲
+ watch(
+ () => props.visible,
+ newVal => {
+ localVisible.value = newVal;
+ if (newVal) {
+ init();
+ }
+ }
+ );
+
+ // 鐩戝惉localVisible鍙樺寲
+ watch(localVisible, newVal => {
+ emit("update:visible", newVal);
+ });
+</script>
+
+<style scoped>
+ .dialog-footer {
+ text-align: right;
+ }
+
+ .param-group {
+ border: 1px solid #e4e7ed;
+ border-radius: 4px;
+ padding: 16px;
+ margin-bottom: 16px;
+ background-color: #f9f9f9;
+ }
+
+ .group-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 16px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #e4e7ed;
+ }
+
+ .group-header span {
+ font-weight: bold;
+ font-size: 14px;
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index 0b42dae..4bf8452 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -3,418 +3,544 @@
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
- <el-form-item label="鎶ュ伐浜哄憳鍚嶇О:">
- <el-input v-model="searchForm.nickName"
+ <el-form-item label="鐢熶骇璁㈠崟鍙�:">
+ <el-input v-model="searchForm.orderNo"
placeholder="璇疯緭鍏�"
clearable
- prefix-icon="Search"
- style="width: 200px;"
- @change="handleQuery" />
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
</el-form-item>
- <el-form-item label="宸ュ崟鍙�:">
- <el-input v-model="searchForm.workOrderNo"
+ <el-form-item label="鐝粍:">
+ <el-input v-model="searchForm.teamName"
placeholder="璇疯緭鍏�"
clearable
- prefix-icon="Search"
- style="width: 200px;"
- @change="handleQuery" />
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
+ </el-form-item>
+ <el-form-item label="浜у搧鍚嶇О:">
+ <el-input v-model="searchForm.productName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
</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="handleAdd">鏂板</el-button>
+ <el-button @click="handleExport">瀵煎嚭</el-button>
+ </div>
</div>
<div class="table_list">
- <div style="text-align: right"
- class="mb10">
- <!-- <el-button type="primary"
- @click="openForm('add')">鐢熶骇鎶ュ伐</el-button> -->
- <el-button @click="handleOut">瀵煎嚭</el-button>
- </div>
<PIMTable rowKey="id"
:column="tableColumn"
:tableData="tableData"
:page="page"
- :isSelection="true"
- :expandRowKeys="expandedRowKeys"
- @expand-change="expandChange"
- @selection-change="handleSelectionChange"
:tableLoading="tableLoading"
- @pagination="pagination"
- :total="page.total">
- <template #expand="{ row }">
- <el-table :data="expandData"
- border
- show-summary
- :summary-method="summarizeMainTable"
- v-loading="childrenLoading">
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="鏈鐢熶骇鏁伴噺"
- prop="finishedNum"
- align="center"
- width="400">
- <template #default="scope">
- <el-input-number :step="0.01"
- :min="0"
- style="width: 100%"
- v-model="scope.row.finishedNum"
- :disabled="!scope.row.editType"
- :precision="2"
- placeholder="璇疯緭鍏�"
- clearable
- @change="changeNum(scope.row)" />
- </template>
- </el-table-column>
- <!-- <el-table-column label="寰呯敓浜ф暟閲�" prop="pendingNum" width="240" align="center"></el-table-column>-->
- <el-table-column label="鐢熶骇浜�"
- prop="schedulingUserId"
- width="400">
- <template #default="scope">
- <el-select v-model="scope.row.schedulingUserId"
- placeholder="閫夋嫨浜哄憳"
- :disabled="!scope.row.editType"
- style="width: 100%;">
- <el-option v-for="user in userList"
- :key="user.userId"
- :label="user.nickName"
- :value="user.userId" />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="鐢熶骇鏃ユ湡"
- prop="schedulingDate"
- width="400">
- <template #default="scope">
- <el-date-picker v-model="scope.row.schedulingDate"
- type="date"
- :disabled="!scope.row.editType"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%" />
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔"
- >
- <template #default="scope">
- <el-button link
- type="primary"
- size="small"
- @click="changeEditType(scope.row)"
- v-if="!scope.row.editType"
- :disabled="scope.row.parentStatus === 3">缂栬緫</el-button>
- <el-button link
- type="primary"
- size="small"
- @click="saveReceiptPayment(scope.row)"
- v-if="scope.row.editType">淇濆瓨</el-button>
- </template>
- </el-table-column>
- </el-table>
+ :isSelection="false"
+ @selection-change="handleSelectionChange"
+ @pagination="pagination">
+ <template #outputVolume="{ row }">
+ <span style="font-weight: bold;color: #409eff;">{{ row.outputVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
+ </template>
+ <template #unqualifiedVolume="{ row }">
+ <span style="font-weight: bold;color: #b43434;">{{ row.unqualifiedVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
+ </template>
+ <template #completedVolume="{ row }">
+ <span style="font-weight: bold;color: #28e431;">{{ row.completedVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
</template>
</PIMTable>
</div>
- <form-dia ref="formDia"
- @close="handleQuery"></form-dia>
- <input-modal v-if="isShowInput"
- v-model:visible="isShowInput"
- :production-product-main-id="isShowingId" />
+ <ReportingDialog v-model:visible="dialogVisible"
+ :data="form"
+ @completed="handleQuery" />
</div>
</template>
<script setup>
- import { onMounted, ref } from "vue";
- import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue";
- import { ElMessageBox } from "element-plus";
+ import { onMounted, ref, reactive, getCurrentInstance } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import dayjs from "dayjs";
import {
+ workListPage,
+ productionReport,
productionReportUpdate,
- workListPageById,
productionReportDelete,
} from "@/api/productionManagement/productionReporting.js";
- import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js";
- import { userListNoPageByTenantId } from "@/api/system/user.js";
- import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import ReportingDialog from "./components/ReportingDialog.vue";
- const data = reactive({
- searchForm: {
- nickName: "",
- workOrderNo: "",
- workOrderStatus: "",
- },
- });
- const { searchForm } = toRefs(data);
- const expandedRowKeys = ref([]);
- const expandData = ref([]);
- const userList = ref([]);
+ const { proxy } = getCurrentInstance();
+
const tableColumn = ref([
{
- label: "鎶ュ伐鍗曞彿",
- prop: "productNo",
- width: 120,
+ label: "鐢熶骇璁㈠崟鍙�",
+ prop: "orderNo",
+ width: "150px",
},
{
- label: "鎶ュ伐浜哄憳",
- prop: "nickName",
- width: 120,
+ label: "鐝粍",
+ prop: "teamName",
+ width: "120px",
+ dataType: "tag",
},
{
- label: "宸ュ簭",
- prop: "process",
- width: 120,
- },
- {
- label: "宸ュ崟缂栧彿",
- prop: "workOrderNo",
- width: 120,
- },
- {
- label: "閿�鍞悎鍚屽彿",
- prop: "salesContractNo",
- width: 120,
+ label: "浜у搧缂栫爜",
+ prop: "materialCode",
+ width: "150px",
},
{
label: "浜у搧鍚嶇О",
prop: "productName",
- width: 120,
+ width: "150px",
},
{
- label: "浜у搧瑙勬牸鍨嬪彿",
- prop: "productModelName",
- width: 120,
+ label: "瑙勬牸",
+ prop: "specification",
+ width: "120px",
+ className: "specification-cell",
},
{
- label: "浜у嚭鏁伴噺",
- prop: "quantity",
- width: 120,
+ label: "浜у嚭鏂归噺",
+ prop: "outputVolume",
+ width: "120px",
+ align: "right",
+ dataType: "slot",
+ slot: "outputVolume",
},
{
- label: "鎶ュ簾鏁伴噺",
- prop: "scrapQty",
- width: 120,
+ label: "涓嶅悎鏍兼柟閲�",
+ prop: "unqualifiedVolume",
+ width: "120px",
+ align: "right",
+ dataType: "slot",
+ slot: "unqualifiedVolume",
},
{
- label: "鍗曚綅",
- prop: "unit",
- width: 120,
+ label: "瀹屾垚鏂归噺",
+ prop: "completedVolume",
+ width: "120px",
+ align: "right",
+ dataType: "slot",
+ slot: "completedVolume",
},
-
+ {
+ label: "鍒涘缓浜�",
+ prop: "createBy",
+ width: "120px",
+ dataType: "tag",
+ },
{
label: "鍒涘缓鏃堕棿",
prop: "createTime",
- width: 120,
+ width: "160px",
+ formatData: val => (val ? dayjs(val).format("YYYY-MM-DD HH:mm:ss") : ""),
},
{
- dataType: "action",
label: "鎿嶄綔",
- align: "center",
+ dataType: "action",
+ width: "200px",
fixed: "right",
operation: [
{
- name: "鏌ョ湅鎶曞叆",
+ name: "璇︽儏",
type: "text",
clickFun: row => {
- showInput(row);
+ handleDetail(row);
+ },
+ },
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ handleEdit(row);
},
},
{
name: "鍒犻櫎",
- type: "danger",
+ type: "text",
clickFun: row => {
- deleteReport(row);
+ handleDelete(row);
},
},
],
},
]);
+
const tableData = ref([]);
- const selectedRows = ref([]);
const tableLoading = ref(false);
- const childrenLoading = ref(false);
const page = reactive({
current: 1,
- size: 100,
+ size: 10,
total: 0,
});
- const formDia = ref();
- const { proxy } = getCurrentInstance();
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const searchForm = reactive({
+ orderNo: "",
+ teamName: "",
+ productName: "",
+ });
+
+ const mockData = [
+ {
+ id: 1,
+ orderNo: "PO202401001",
+ teamName: "鐢熶骇涓�缁�",
+ materialCode: "PC001",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 120.5,
+ unqualifiedVolume: 2.3,
+ completedVolume: 118.2,
+ createBy: "寮犱笁",
+ createTime: "2024-01-15 08:30:00",
+ },
+ {
+ id: 2,
+ orderNo: "PO202401002",
+ teamName: "鐢熶骇浜岀粍",
+ materialCode: "PC002",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 150.8,
+ unqualifiedVolume: 1.5,
+ completedVolume: 149.3,
+ createBy: "鏉庡洓",
+ createTime: "2024-01-15 09:15:00",
+ },
+ {
+ id: 3,
+ orderNo: "PO202401003",
+ teamName: "鐢熶骇涓夌粍",
+ materialCode: "PC003",
+ productName: "鍔犳皵鐮屽潡",
+ specification: "600脳240脳250",
+ outputVolume: 95.2,
+ unqualifiedVolume: 0.8,
+ completedVolume: 94.4,
+ createBy: "鐜嬩簲",
+ createTime: "2024-01-15 10:00:00",
+ },
+ {
+ id: 4,
+ orderNo: "PO202401004",
+ teamName: "鐢熶骇涓�缁�",
+ materialCode: "PC004",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 180.6,
+ unqualifiedVolume: 3.2,
+ completedVolume: 177.4,
+ createBy: "璧靛叚",
+ createTime: "2024-01-15 14:20:00",
+ },
+ {
+ id: 5,
+ orderNo: "PO202401005",
+ teamName: "鐢熶骇浜岀粍",
+ materialCode: "PC005",
+ productName: "鍔犳皵鐮屽潡",
+ specification: "600脳240脳250",
+ outputVolume: 110.3,
+ unqualifiedVolume: 1.1,
+ completedVolume: 109.2,
+ createBy: "瀛欎竷",
+ createTime: "2024-01-15 15:45:00",
+ },
+ {
+ id: 6,
+ orderNo: "PO202401006",
+ teamName: "鐢熶骇涓夌粍",
+ materialCode: "PC006",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 135.7,
+ unqualifiedVolume: 2.5,
+ completedVolume: 133.2,
+ createBy: "鍛ㄥ叓",
+ createTime: "2024-01-16 08:00:00",
+ },
+ {
+ id: 7,
+ orderNo: "PO202401007",
+ teamName: "鐢熶骇涓�缁�",
+ materialCode: "PC007",
+ productName: "鍔犳皵鐮屽潡",
+ specification: "600脳240脳250",
+ outputVolume: 88.4,
+ unqualifiedVolume: 0.6,
+ completedVolume: 87.8,
+ createBy: "鍚翠節",
+ createTime: "2024-01-16 09:30:00",
+ },
+ {
+ id: 8,
+ orderNo: "PO202401008",
+ teamName: "鐢熶骇浜岀粍",
+ materialCode: "PC008",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 165.2,
+ unqualifiedVolume: 2.8,
+ completedVolume: 162.4,
+ createBy: "閮戝崄",
+ createTime: "2024-01-16 11:00:00",
+ },
+ {
+ id: 9,
+ orderNo: "PO202401009",
+ teamName: "鐢熶骇涓夌粍",
+ materialCode: "PC009",
+ productName: "鍔犳皵鐮屽潡",
+ specification: "600脳240脳250",
+ outputVolume: 102.5,
+ unqualifiedVolume: 1.3,
+ completedVolume: 101.2,
+ createBy: "閽卞崄涓�",
+ createTime: "2024-01-16 13:15:00",
+ },
+ {
+ id: 10,
+ orderNo: "PO202401010",
+ teamName: "鐢熶骇涓�缁�",
+ materialCode: "PC010",
+ productName: "鏍囧噯鐮屽潡",
+ specification: "600脳240脳200",
+ outputVolume: 142.8,
+ unqualifiedVolume: 2.1,
+ completedVolume: 140.7,
+ createBy: "鍒樺崄浜�",
+ createTime: "2024-01-16 15:00:00",
+ },
+ ];
+
+ const dialogVisible = ref(false);
+ const form = reactive({
+ id: undefined,
+ orderId: "",
+ orderNo: "",
+ teamName: "",
+ materialCode: "",
+ productName: "",
+ specification: "",
+ outputVolume: 0,
+ unqualifiedVolume: 0,
+ completedVolume: 0,
+ processId: "",
+ params: {},
+ });
+
+ const selectedRows = ref([]);
+
+ const getList = () => {
+ tableLoading.value = true;
+ setTimeout(() => {
+ tableLoading.value = false;
+ const start = (page.current - 1) * page.size;
+ const end = start + page.size;
+ tableData.value = mockData.slice(start, end);
+ page.total = mockData.length;
+ }, 500);
+ };
+
const handleQuery = () => {
page.current = 1;
getList();
};
- const changeDaterange = value => {
- if (value) {
- searchForm.value.entryDateStart = value[0];
- searchForm.value.entryDateEnd = value[1];
- } else {
- searchForm.value.entryDateStart = undefined;
- searchForm.value.entryDateEnd = undefined;
- }
- handleQuery();
+
+ const handleReset = () => {
+ searchForm.orderNo = "";
+ searchForm.teamName = "";
+ searchForm.productName = "";
+ page.current = 1;
+ getList();
};
- const deleteReport = row => {
- ElMessageBox.confirm("纭畾鍒犻櫎璇ユ姤宸ュ悧锛�", "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- productionReportDelete({ id: row.id }).then(res => {
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- } else {
- ElMessageBox.alert(res.msg || "鍒犻櫎澶辫触", "鎻愮ず", {
- confirmButtonText: "纭畾",
- });
- }
- });
- });
- };
+
const pagination = obj => {
page.current = obj.page;
page.size = obj.limit;
getList();
};
- const getList = () => {
- tableLoading.value = true;
- const params = { ...searchForm.value, ...page };
- params.entryDate = undefined;
- expandedRowKeys.value = [];
- productionProductMainListPage(params)
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records.map(item => ({
- ...item,
- pendingFinishNum:
- (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0),
- }));
- page.total = res.data.total;
- })
- .catch(err => {
- tableLoading.value = false;
- });
- };
- // 灞曞紑琛�
- const expandChange = (row, expandedRows) => {
- userListNoPageByTenantId().then(res => {
- userList.value = res.data;
- });
- if (expandedRows.length > 0) {
- nextTick(() => {
- expandedRowKeys.value = [];
- try {
- childrenLoading.value = true;
- workListPageById({ id: row.id }).then(res => {
- childrenLoading.value = false;
- const index = tableData.value.findIndex(item => item.id === row.id);
- if (index > -1) {
- expandData.value = res.data.map(item => ({
- ...item,
- pendingNum:
- (Number(item.schedulingNum) || 0) -
- (Number(item.finishedNum) || 0),
- parentStatus: row.status, // 鏂板鐖惰〃鐘舵��
- }));
- }
- expandedRowKeys.value.push(row.id);
- });
- } catch (error) {
- childrenLoading.value = false;
- console.log(error);
- }
- });
- } else {
- expandedRowKeys.value = [];
- }
- };
- const changeNum = row => {
- // 鎵惧埌鐖惰〃鏍兼暟鎹�
- const parentRow = tableData.value.find(
- item => item.id === expandedRowKeys.value[0]
- );
- // 璁$畻鎵�鏈夊瓙琛ㄦ牸 finishedNum 鐨勬�诲拰
- const totalFinishedNum = expandData.value.reduce(
- (sum, item) => sum + (Number(item.finishedNum) || 0),
- 0
- );
- // 鐖惰〃鏍肩殑鎺掍骇鏁伴噺
- const schedulingNum = parentRow ? Number(parentRow.schedulingNum) : 0;
- if (totalFinishedNum > schedulingNum) {
- // 鍥為��鏈杈撳叆
- row.finishedNum =
- schedulingNum - (totalFinishedNum - Number(row.finishedNum));
- proxy.$modal.msgWarning("鎵�鏈夋湰娆$敓浜ф暟閲忎箣鍜屼笉鍙ぇ浜庢帓浜ф暟閲�");
- }
- row.pendingNum = row.schedulingNum - row.finishedNum;
- };
- // 缂栬緫淇敼鐘舵��
- const changeEditType = row => {
- row.editType = !row.editType;
- };
- // 淇濆瓨璁板綍
- const saveReceiptPayment = row => {
- productionReportUpdate(row).then(res => {
- row.editType = !row.editType;
- getList();
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- });
- };
- // 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = selection => {
selectedRows.value = selection;
};
- const summarizeMainTable = param => {
- return proxy.summarizeTable(param, ["finishedNum"]);
- };
- // 鎵撳紑寮规
- const openForm = (type, row) => {
- if (selectedRows.value.length !== 1) {
- proxy.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�");
- return;
- }
- if (selectedRows.value[0].pendingFinishNum == 0) {
- proxy.$message.warning("鏃犻渶鍐嶆姤宸�");
- return;
- }
- nextTick(() => {
- const rowInfo = type === "add" ? selectedRows.value[0] : row;
- formDia.value?.openDialog(type, rowInfo);
+
+ const handleAdd = () => {
+ Object.assign(form, {
+ id: undefined,
+ orderId: "",
+ orderNo: "",
+ teamName: "",
+ materialCode: "",
+ productName: "",
+ specification: "",
+ outputVolume: 0,
+ unqualifiedVolume: 0,
+ completedVolume: 0,
+ processId: "",
+ params: {},
});
+ dialogVisible.value = true;
};
- // 鎵撳紑鎶曞叆妯℃�佹
- const isShowInput = ref(false);
- const isShowingId = ref(0);
- const showInput = row => {
- isShowInput.value = true;
- isShowingId.value = row.id;
+ const handleEdit = row => {
+ Object.assign(form, {
+ id: row.id,
+ orderId: row.orderId || "",
+ orderNo: row.orderNo,
+ teamName: row.teamName,
+ materialCode: row.materialCode,
+ productName: row.productName,
+ specification: row.specification,
+ outputVolume: row.outputVolume,
+ unqualifiedVolume: row.unqualifiedVolume,
+ completedVolume: row.completedVolume,
+ createBy: row.createBy || "",
+ createTime: row.createTime || new Date(),
+ processId: row.processId || "",
+ params: row.params || {},
+ });
+ dialogVisible.value = true;
};
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
+ const handleDetail = row => {
+ ElMessage.info("璇︽儏鍔熻兘寰呭疄鐜�");
+ };
+
+ const handleDelete = row => {
+ ElMessageBox.confirm("纭鍒犻櫎璇ユ潯鏁版嵁鍚�?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning",
})
.then(() => {
- proxy.download("/productionProductMain/export", {}, "鐢熶骇鎶ュ伐.xlsx");
+ productionReportDelete({ id: row.id })
+ .then(() => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ ElMessage.error("鍒犻櫎澶辫触");
+ });
})
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
+ .catch(() => {});
};
+
+ const handleExport = () => {
+ ElMessage.info("瀵煎嚭鍔熻兘寰呭疄鐜�");
+ };
+
onMounted(() => {
getList();
});
</script>
-<style scoped></style>
+<style scoped lang="scss">
+ .app-container {
+ padding: 24px;
+ background-color: #f0f2f5;
+ min-height: calc(100vh - 48px);
+ }
+
+ .search_form {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ flex-wrap: wrap;
+ gap: 16px;
+ margin-bottom: 24px;
+ padding: 20px;
+ background-color: #ffffff;
+ border-radius: 6px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
+ transition: all 0.3s ease;
+
+ &:hover {
+ box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
+ }
+
+ :deep(.el-form) {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0;
+
+ .el-form-item {
+ margin-right: 16px;
+ margin-bottom: 0;
+
+ &:last-child {
+ margin-right: 0;
+ }
+ }
+ }
+
+ > div {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ flex-shrink: 0;
+ }
+ }
+
+ .table_list {
+ background-color: #ffffff;
+ border-radius: 6px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
+ overflow: hidden;
+ height: calc(100vh - 220px);
+ }
+
+ :deep(.el-table) {
+ border: none;
+ border-radius: 6px;
+ overflow: hidden;
+
+ .el-table__header-wrapper {
+ background-color: #fafafa;
+
+ th {
+ background-color: #fafafa;
+ font-weight: 600;
+ color: #303133;
+ border-bottom: 1px solid #ebeef5;
+ padding: 14px 0;
+ }
+ }
+
+ .el-table__body-wrapper {
+ tr {
+ transition: all 0.3s ease;
+
+ &:hover {
+ background-color: #f5f7fa;
+ }
+
+ td {
+ border-bottom: 1px solid #ebeef5;
+ padding: 12px 0;
+ }
+ }
+
+ tr.current-row {
+ background-color: #ecf5ff;
+ }
+ }
+
+ .el-table__empty-block {
+ padding: 40px 0;
+ }
+ }
+</style>
+<style lang="scss">
+ .specification-cell {
+ color: #7a7d81;
+ font-style: italic;
+ }
+</style>
diff --git a/src/views/productionManagement/productionReporting/index2.vue b/src/views/productionManagement/productionReporting/index2.vue
new file mode 100644
index 0000000..0b42dae
--- /dev/null
+++ b/src/views/productionManagement/productionReporting/index2.vue
@@ -0,0 +1,420 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <el-form :model="searchForm"
+ :inline="true">
+ <el-form-item label="鎶ュ伐浜哄憳鍚嶇О:">
+ <el-input v-model="searchForm.nickName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ style="width: 200px;"
+ @change="handleQuery" />
+ </el-form-item>
+ <el-form-item label="宸ュ崟鍙�:">
+ <el-input v-model="searchForm.workOrderNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ style="width: 200px;"
+ @change="handleQuery" />
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleQuery">鎼滅储</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="table_list">
+ <div style="text-align: right"
+ class="mb10">
+ <!-- <el-button type="primary"
+ @click="openForm('add')">鐢熶骇鎶ュ伐</el-button> -->
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ :expandRowKeys="expandedRowKeys"
+ @expand-change="expandChange"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total">
+ <template #expand="{ row }">
+ <el-table :data="expandData"
+ border
+ show-summary
+ :summary-method="summarizeMainTable"
+ v-loading="childrenLoading">
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="鏈鐢熶骇鏁伴噺"
+ prop="finishedNum"
+ align="center"
+ width="400">
+ <template #default="scope">
+ <el-input-number :step="0.01"
+ :min="0"
+ style="width: 100%"
+ v-model="scope.row.finishedNum"
+ :disabled="!scope.row.editType"
+ :precision="2"
+ placeholder="璇疯緭鍏�"
+ clearable
+ @change="changeNum(scope.row)" />
+ </template>
+ </el-table-column>
+ <!-- <el-table-column label="寰呯敓浜ф暟閲�" prop="pendingNum" width="240" align="center"></el-table-column>-->
+ <el-table-column label="鐢熶骇浜�"
+ prop="schedulingUserId"
+ width="400">
+ <template #default="scope">
+ <el-select v-model="scope.row.schedulingUserId"
+ placeholder="閫夋嫨浜哄憳"
+ :disabled="!scope.row.editType"
+ style="width: 100%;">
+ <el-option v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId" />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐢熶骇鏃ユ湡"
+ prop="schedulingDate"
+ width="400">
+ <template #default="scope">
+ <el-date-picker v-model="scope.row.schedulingDate"
+ type="date"
+ :disabled="!scope.row.editType"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ >
+ <template #default="scope">
+ <el-button link
+ type="primary"
+ size="small"
+ @click="changeEditType(scope.row)"
+ v-if="!scope.row.editType"
+ :disabled="scope.row.parentStatus === 3">缂栬緫</el-button>
+ <el-button link
+ type="primary"
+ size="small"
+ @click="saveReceiptPayment(scope.row)"
+ v-if="scope.row.editType">淇濆瓨</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </template>
+ </PIMTable>
+ </div>
+ <form-dia ref="formDia"
+ @close="handleQuery"></form-dia>
+ <input-modal v-if="isShowInput"
+ v-model:visible="isShowInput"
+ :production-product-main-id="isShowingId" />
+ </div>
+</template>
+
+<script setup>
+ import { onMounted, ref } from "vue";
+ import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ productionReportUpdate,
+ workListPageById,
+ productionReportDelete,
+ } from "@/api/productionManagement/productionReporting.js";
+ import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
+
+ const data = reactive({
+ searchForm: {
+ nickName: "",
+ workOrderNo: "",
+ workOrderStatus: "",
+ },
+ });
+ const { searchForm } = toRefs(data);
+ const expandedRowKeys = ref([]);
+ const expandData = ref([]);
+ const userList = ref([]);
+ const tableColumn = ref([
+ {
+ label: "鎶ュ伐鍗曞彿",
+ prop: "productNo",
+ width: 120,
+ },
+ {
+ label: "鎶ュ伐浜哄憳",
+ prop: "nickName",
+ width: 120,
+ },
+ {
+ label: "宸ュ簭",
+ prop: "process",
+ width: 120,
+ },
+ {
+ label: "宸ュ崟缂栧彿",
+ prop: "workOrderNo",
+ width: 120,
+ },
+ {
+ label: "閿�鍞悎鍚屽彿",
+ prop: "salesContractNo",
+ width: 120,
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ width: 120,
+ },
+ {
+ label: "浜у搧瑙勬牸鍨嬪彿",
+ prop: "productModelName",
+ width: 120,
+ },
+ {
+ label: "浜у嚭鏁伴噺",
+ prop: "quantity",
+ width: 120,
+ },
+ {
+ label: "鎶ュ簾鏁伴噺",
+ prop: "scrapQty",
+ width: 120,
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ width: 120,
+ },
+
+ {
+ label: "鍒涘缓鏃堕棿",
+ prop: "createTime",
+ width: 120,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ operation: [
+ {
+ name: "鏌ョ湅鎶曞叆",
+ type: "text",
+ clickFun: row => {
+ showInput(row);
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ type: "danger",
+ clickFun: row => {
+ deleteReport(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const childrenLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const formDia = ref();
+ const { proxy } = getCurrentInstance();
+
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const changeDaterange = value => {
+ if (value) {
+ searchForm.value.entryDateStart = value[0];
+ searchForm.value.entryDateEnd = value[1];
+ } else {
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ }
+ handleQuery();
+ };
+ const deleteReport = row => {
+ ElMessageBox.confirm("纭畾鍒犻櫎璇ユ姤宸ュ悧锛�", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ productionReportDelete({ id: row.id }).then(res => {
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ } else {
+ ElMessageBox.alert(res.msg || "鍒犻櫎澶辫触", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ });
+ }
+ });
+ });
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page };
+ params.entryDate = undefined;
+ expandedRowKeys.value = [];
+ productionProductMainListPage(params)
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records.map(item => ({
+ ...item,
+ pendingFinishNum:
+ (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0),
+ }));
+ page.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+ // 灞曞紑琛�
+ const expandChange = (row, expandedRows) => {
+ userListNoPageByTenantId().then(res => {
+ userList.value = res.data;
+ });
+ if (expandedRows.length > 0) {
+ nextTick(() => {
+ expandedRowKeys.value = [];
+ try {
+ childrenLoading.value = true;
+ workListPageById({ id: row.id }).then(res => {
+ childrenLoading.value = false;
+ const index = tableData.value.findIndex(item => item.id === row.id);
+ if (index > -1) {
+ expandData.value = res.data.map(item => ({
+ ...item,
+ pendingNum:
+ (Number(item.schedulingNum) || 0) -
+ (Number(item.finishedNum) || 0),
+ parentStatus: row.status, // 鏂板鐖惰〃鐘舵��
+ }));
+ }
+ expandedRowKeys.value.push(row.id);
+ });
+ } catch (error) {
+ childrenLoading.value = false;
+ console.log(error);
+ }
+ });
+ } else {
+ expandedRowKeys.value = [];
+ }
+ };
+ const changeNum = row => {
+ // 鎵惧埌鐖惰〃鏍兼暟鎹�
+ const parentRow = tableData.value.find(
+ item => item.id === expandedRowKeys.value[0]
+ );
+ // 璁$畻鎵�鏈夊瓙琛ㄦ牸 finishedNum 鐨勬�诲拰
+ const totalFinishedNum = expandData.value.reduce(
+ (sum, item) => sum + (Number(item.finishedNum) || 0),
+ 0
+ );
+ // 鐖惰〃鏍肩殑鎺掍骇鏁伴噺
+ const schedulingNum = parentRow ? Number(parentRow.schedulingNum) : 0;
+
+ if (totalFinishedNum > schedulingNum) {
+ // 鍥為��鏈杈撳叆
+ row.finishedNum =
+ schedulingNum - (totalFinishedNum - Number(row.finishedNum));
+ proxy.$modal.msgWarning("鎵�鏈夋湰娆$敓浜ф暟閲忎箣鍜屼笉鍙ぇ浜庢帓浜ф暟閲�");
+ }
+ row.pendingNum = row.schedulingNum - row.finishedNum;
+ };
+ // 缂栬緫淇敼鐘舵��
+ const changeEditType = row => {
+ row.editType = !row.editType;
+ };
+ // 淇濆瓨璁板綍
+ const saveReceiptPayment = row => {
+ productionReportUpdate(row).then(res => {
+ row.editType = !row.editType;
+ getList();
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ });
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+ const summarizeMainTable = param => {
+ return proxy.summarizeTable(param, ["finishedNum"]);
+ };
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ if (selectedRows.value.length !== 1) {
+ proxy.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�");
+ return;
+ }
+ if (selectedRows.value[0].pendingFinishNum == 0) {
+ proxy.$message.warning("鏃犻渶鍐嶆姤宸�");
+ return;
+ }
+ nextTick(() => {
+ const rowInfo = type === "add" ? selectedRows.value[0] : row;
+ formDia.value?.openDialog(type, rowInfo);
+ });
+ };
+
+ // 鎵撳紑鎶曞叆妯℃�佹
+ const isShowInput = ref(false);
+ const isShowingId = ref(0);
+ const showInput = row => {
+ isShowInput.value = true;
+ isShowingId.value = row.id;
+ };
+
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/productionProductMain/export", {}, "鐢熶骇鎶ュ伐.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ onMounted(() => {
+ getList();
+ });
+</script>
+
+<style scoped></style>
diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 649d991..ed7011e 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -3,36 +3,9 @@
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
- <el-form-item label="瀹㈡埛鍚嶇О:">
- <el-input v-model="searchForm.customerName"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px;"
- @keyup.enter="handleQuery" />
- </el-form-item>
+ <!-- 绠�鍖栫増鎼滅储鏉′欢 -->
<el-form-item label="浜у搧鍚嶇О:">
<el-input v-model="searchForm.productName"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px;"
- @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="浜у搧瑙勬牸:">
- <el-input v-model="searchForm.model"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px;"
- @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="鐗╂枡缂栫爜:">
- <el-input v-model="searchForm.materialCode"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px;"
- @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="鐢宠鍗曠紪鍙�:">
- <el-input v-model="searchForm.applyNo"
placeholder="璇疯緭鍏�"
clearable
style="width: 160px;"
@@ -50,7 +23,7 @@
</el-form-item>
<el-form-item label="涓嬪彂鐘舵��:">
<el-select v-model="searchForm.status"
- placeholder="璇烽�夋嫨鐘舵��"
+ placeholder="璇烽�夋嫨鐘舵��"
clearable
filterable
style="width: 100px">
@@ -62,6 +35,37 @@
value="2" />
</el-select>
</el-form-item>
+ <!-- 灞曞紑鐗堟悳绱㈡潯浠� -->
+ <template v-if="searchFormExpanded">
+ <el-form-item label="瀹㈡埛鍚嶇О:">
+ <el-input v-model="searchForm.customerName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
+ </el-form-item>
+ <el-form-item label="浜у搧瑙勬牸:">
+ <el-input v-model="searchForm.model"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
+ </el-form-item>
+ <el-form-item label="鐗╂枡缂栫爜:">
+ <el-input v-model="searchForm.materialCode"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
+ </el-form-item>
+ <el-form-item label="鐢宠鍗曠紪鍙�:">
+ <el-input v-model="searchForm.applyNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px;"
+ @keyup.enter="handleQuery" />
+ </el-form-item>
+ </template>
<el-form-item>
<el-button type="primary"
@click="handleQuery">鎼滅储</el-button>
@@ -82,6 +86,16 @@
<div>
</div>
</div>
+ <div class="search-header">
+ <el-button type="text"
+ @click="toggleSearchForm">
+ <el-icon>
+ <ArrowUp v-if="searchFormExpanded" />
+ <ArrowDown v-else />
+ </el-icon>
+ {{ searchFormExpanded ? '鏀惰捣鎼滅储鏉′欢' : '灞曞紑鎼滅储鏉′欢' }}
+ </el-button>
+ </div>
<div class="table_list">
<PIMTable rowKey="id"
:column="tableColumn"
@@ -93,10 +107,17 @@
:selectable="isSelectable"
@selection-change="handleSelectionChange"
@pagination="pagination">
+ <template #quantity="{ row }">
+ {{ row.quantity || '-' }}<span style="color:rgb(63, 95, 211)"> 鍧�</span>
+ </template>
+ <template #volume="{ row }">
+ {{ row.volume || '-' }}<span style="color:rgba(12, 46, 40, 0.76)"> 鏂�</span>
+ </template>
</PIMTable>
</div>
<!-- 鍚堝苟涓嬪彂寮圭獥 -->
<el-dialog v-model="isShowNewModal"
+ destroy-on-close
title="鍚堝苟涓嬪彂"
width="600px">
<el-form :model="mergeForm"
@@ -168,6 +189,7 @@
</el-dialog>
<!-- 杩借釜杩涘害寮圭獥 -->
<el-dialog v-model="showTrackProgressDialog"
+ destroy-on-close
:title="`杩借釜杩涘害 - ${trackProgressForm.materialCode || ''}`"
width="600px">
<el-form :model="trackProgressForm"
@@ -246,6 +268,7 @@
@close="handleImportClose" />
<!-- 鏂板/缂栬緫寮圭獥 -->
<el-dialog v-model="dialogVisible"
+ destroy-on-close
:title="operationType === 'add' ? '鏂板鐢熶骇璁″垝' : '缂栬緫鐢熶骇璁″垝'"
width="600px">
<el-form ref="formRef"
@@ -366,6 +389,7 @@
<script setup>
import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
import { ElMessage } from "element-plus";
+ import { ArrowUp, ArrowDown } from "@element-plus/icons-vue";
import dayjs from "dayjs";
import ImportDialog from "@/components/Dialog/ImportDialog.vue";
import { getToken } from "@/utils/auth";
@@ -441,14 +465,18 @@
{
label: "鍧楁暟",
prop: "quantity",
- formatData: cell => (cell ? `${cell}鍧梎 : ""),
+ align: "right",
+ dataType: "slot",
+ slot: "quantity",
},
{
label: "鏂规暟",
prop: "volume",
width: "150px",
+ align: "right",
+ dataType: "slot",
+ slot: "volume",
className: "volume-cell",
- formatData: cell => (cell ? `${cell}鏂筦 : ""),
},
{
label: "涓嬪彂鐘舵��",
@@ -896,8 +924,14 @@
applyNo: "",
dateRange: [],
},
+ searchFormExpanded: false,
});
- const { searchForm } = toRefs(data);
+ const { searchForm, searchFormExpanded } = toRefs(data);
+
+ // 鍒囨崲鎼滅储琛ㄥ崟灞曞紑/鏀惰捣鐘舵��
+ const toggleSearchForm = () => {
+ data.searchFormExpanded = !data.searchFormExpanded;
+ };
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1042,7 +1076,7 @@
sum +
(row.volume == null
? 0
- : (Number(row.volume) - Number(row.assignedQuantity)).toFixed(4))
+ : Number(Number(row.volume) - Number(row.assignedQuantity).toFixed(4)))
);
}, 0);
sumAssignedQuantity.value = totalAssignedQuantity;
@@ -1087,10 +1121,12 @@
}
console.log(mergeForm, "mergeForm");
- const strengthItem = block_strength.value.find(item => item.id === mergeForm.strength);
+ const strengthItem = block_strength.value.find(
+ item => item.id === mergeForm.strength
+ );
const payload = {
...mergeForm,
- strength: strengthItem ? strengthItem.label : mergeForm.strength
+ strength: strengthItem ? strengthItem.label : mergeForm.strength,
};
productionPlanCombine(payload)
.then(res => {
@@ -1323,10 +1359,7 @@
}
.search_form {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24px;
+ // margin-bottom: 24px;
padding: 20px;
background-color: #ffffff;
border-radius: 6px;
@@ -1338,6 +1371,36 @@
}
}
+ .search-header {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ // margin-bottom: 5px;
+ // padding-bottom: 5px;
+ position: relative;
+ bottom: 35px;
+ // border-bottom: 1px solid #ebeef5;
+ }
+
+ .search-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .search-header .el-button {
+ color: #606266;
+ transition: all 0.3s ease;
+ }
+
+ .search-header .el-button:hover {
+ color: #409eff;
+ }
+
+ .search-header .el-icon {
+ margin-right: 4px;
+ }
+
.table_list {
// margin-bottom: 24px;
background-color: #ffffff;
@@ -1345,6 +1408,7 @@
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
height: calc(100vh - 250px);
+ margin-top: 0px !important;
}
:deep(.el-table) {
--
Gitblit v1.9.3