From ed36047f6ce0b91dad25efc10c8a0e83dd533a68 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 20 三月 2026 17:15:37 +0800
Subject: [PATCH] change
---
src/views/productionManagement/processRoute/index.vue | 12
src/views/productionManagement/productionReporting/index2.vue | 420 +++++++
src/layout/components/Navbar.vue | 449 +++---
src/views/productionManagement/processRoute/processRouteItem/index.vue | 451 +++++++
src/components/ProcessParamListDialog.vue | 5
src/api/productionManagement/productionOrder.js | 18
src/api/productionManagement/productProcessRoute.js | 27
src/views/productionManagement/productStructure/Detail/index.vue | 2
src/api/personnelManagement/class.js | 1
src/views/productionManagement/productionReporting/index.vue | 742 +++++++-----
src/views/personnelManagement/classsSheduling/index.vue | 2
src/api/productionManagement/productStructure.js | 19
src/views/productionManagement/productionOrder/index.vue | 691 +++++++++++
src/views/productionPlan/productionPlan/index.vue | 16
src/views/productionManagement/productionReporting/components/ReportingDialog.vue | 613 ++++++++++
15 files changed, 2,869 insertions(+), 599 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/productProcessRoute.js b/src/api/productionManagement/productProcessRoute.js
index c7fb302..c926a28 100644
--- a/src/api/productionManagement/productProcessRoute.js
+++ b/src/api/productionManagement/productProcessRoute.js
@@ -4,23 +4,16 @@
// 鍒楄〃鏌ヨ
export function findProductProcessRouteItemList(query) {
return request({
- url: `/processRouteItemInstance/list/${query.orderId}`,
- method: "get",
- params: query,
- });
-}
-// 鍒楄〃鏌ヨ-鐢熶骇璁㈠崟
-export function findProcessRouteItemInstanceList(query) {
- return request({
- url: `/processRouteItemInstance/list/${query.orderId}`,
+ url: `/productionOrderRouteItem/list/${query.orderId}`,
method: "get",
});
}
+
export function addOrUpdateProductProcessRouteItem(data) {
return request({
- url: "/processRouteItemInstance/update",
+ url: "/productionOrderRouteItem/update",
method: "put",
data: data,
});
@@ -29,7 +22,7 @@
// 鐢熶骇璁㈠崟涓嬶細鏂板宸ヨ壓璺嚎椤圭洰
export function addRouteItem(data) {
return request({
- url: "/processRouteItemInstance/add",
+ url: "/productionOrderRouteItem/add",
method: "post",
data,
});
@@ -47,7 +40,7 @@
// 鍒犻櫎宸ヨ壓璺嚎椤圭洰锛堣矾鐢卞悗鎷兼帴 id锛�
export function deleteRouteItem(id) {
return request({
- url: `/processRouteItemInstance/delete/${id}`,
+ url: `/productionOrderRouteItem/delete/${id}`,
method: "delete",
});
}
@@ -55,7 +48,7 @@
// 鐢熶骇璁㈠崟涓嬶細鎺掑簭宸ヨ壓璺嚎椤圭洰
export function sortRouteItem(data) {
return request({
- url: "/productProcessRoute/sortRouteItem",
+ url: "/productionOrderRouteItem/sort",
method: "post",
data,
});
@@ -63,7 +56,7 @@
// 鑾峰彇宸ュ簭鍙傛暟鍒楄〃-鐢熶骇璁㈠崟
export function findProcessParamListOrder(query) {
return request({
- url: `/processRouteItemParamInstance/list`,
+ url: `/productionOrderRouteItemParam/list`,
method: "get",
params: query,
});
@@ -71,7 +64,7 @@
// 宸ヨ壓璺嚎鍙傛暟鏂板-鐢熶骇璁㈠崟
export function addProcessRouteItemParamOrder(data) {
return request({
- url: "/processRouteItemParamInstance/add",
+ url: "/productionOrderRouteItemParam/add",
method: "post",
data: data,
});
@@ -79,7 +72,7 @@
// 宸ヨ壓璺嚎鍙傛暟淇敼-鐢熶骇璁㈠崟
export function editProcessRouteItemParamOrder(data) {
return request({
- url: "/processRouteItemParamInstance/update",
+ url: "/productionOrderRouteItemParam/update",
method: "put",
data: data,
});
@@ -87,7 +80,7 @@
// 宸ヨ壓璺嚎鍙傛暟鍒犻櫎-鐢熶骇璁㈠崟
export function delProcessRouteItemParamOrder(id) {
return request({
- url: `/processRouteItemParamInstance/delete/${id}`,
+ 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 28cbb51..89eb419 100644
--- a/src/api/productionManagement/productionOrder.js
+++ b/src/api/productionManagement/productionOrder.js
@@ -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/ProcessParamListDialog.vue b/src/components/ProcessParamListDialog.vue
index 5d76781..16241f9 100644
--- a/src/components/ProcessParamListDialog.vue
+++ b/src/components/ProcessParamListDialog.vue
@@ -424,8 +424,9 @@
if (props.pageType === "order") {
addProcessRouteItemParamOrder({
orderId: Number(props.orderId),
- processId: props.process.id,
- routeItemId: Number(props.routeId),
+ // processId: props.process.id,
+ routeItemId: props.process.id,
+ // routeItemId: Number(props.routeId),
paramId: selectedParam.value.id,
standardValue: isNumericMode
? selectedParam.value.standardValue || ""
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/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/index.vue b/src/views/productionManagement/processRoute/index.vue
index 628c5e3..f907915 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -93,6 +93,8 @@
{
label: "宸ヨ壓璺嚎缂栧彿",
prop: "processRouteCode",
+ width: "200px",
+ className: "status-cell",
},
{
label: "鐘舵��",
@@ -117,6 +119,7 @@
{
label: "浜у搧绫诲瀷",
prop: "dictLabel",
+ dataType: "tag",
},
{
label: "BOM缂栧彿",
@@ -240,6 +243,7 @@
model: row.model || "",
bomNo: row.bomNo || "",
dictLabel: row.dictLabel || "",
+ orderId: row.id || "",
bomId: row.bomId || null,
description: row.description || "",
type: "route",
@@ -320,3 +324,11 @@
</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/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 2a5186c..5d841e8 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -169,6 +169,16 @@
<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琛ㄦ牸 -->
@@ -179,28 +189,110 @@
style="width: 100%">
<el-table-column type="expand">
<template #default="props">
- <el-table :data="props.row.bomList"
- row-key="id"
- default-expand-all
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
- style="width: 100%">
- <el-table-column prop="productName"
- label="浜у搧" />
- <el-table-column prop="model"
- label="瑙勬牸" />
- <el-table-column prop="processName"
- label="娑堣�楀伐搴�" />
- <el-table-column prop="unitQuantity"
- label="鍗曚綅浜у嚭鎵�闇�鏁伴噺" />
- <el-table-column prop="unit"
- label="鍗曚綅" />
- </el-table>
+ <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="浜у搧鍚嶇О"
@@ -208,6 +300,18 @@
<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>
<!-- 鏂板/缂栬緫寮圭獥 -->
@@ -249,6 +353,10 @@
<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) : ''} - 鍙傛暟鍒楄〃`"
@@ -289,7 +397,11 @@
sortRouteItem,
} from "@/api/productionManagement/productProcessRoute.js";
import { processList } from "@/api/productionManagement/productionProcess.js";
- import { queryList } from "@/api/productionManagement/productStructure.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";
@@ -327,6 +439,14 @@
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;
@@ -407,12 +527,21 @@
bomId: route.query.bomId || null,
description: route.query.description || "",
};
-
- // 濡傛灉鏈塨omId锛岃幏鍙朆OM鏁版嵁
- if (routeInfo.value.bomId) {
- queryList(routeInfo.value.bomId)
+ 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,
@@ -423,12 +552,49 @@
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鏁版嵁锛屼娇鐢ㄦ柊鐨勬帴鍙�
};
// 鏂板
@@ -586,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();
};
// 鍒濆鍖栨嫋鎷芥帓搴�
@@ -1113,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 2ed9507..ae76ed4 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -42,7 +42,6 @@
style="margin: 0">
<el-select v-model="row.model"
placeholder="璇烽�夋嫨瑙勬牸"
- clearable
:disabled="!dataValue.isEdit"
style="width: 100%"
@visible-change="(v) => { if (v) openDialog(row.tempId) }">
@@ -81,7 +80,6 @@
style="margin: 0">
<el-input-number v-model="row.unitQuantity"
:min="0"
- :precision="2"
:step="1"
controls-position="right"
style="width: 100%"
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index a306bff..3116256 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,6 +3,14 @@
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
+ <el-form-item label="璁㈠崟鍙�:">
+ <el-input v-model="searchForm.npsNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ style="width: 160px;"
+ @change="handleQuery" />
+ </el-form-item>
<el-form-item label="浜у搧鍚嶇О:">
<el-input v-model="searchForm.productName"
placeholder="璇疯緭鍏�"
@@ -10,6 +18,29 @@
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.model"
@@ -35,13 +66,13 @@
@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="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"
@@ -58,6 +89,12 @@
<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>
@@ -89,6 +126,127 @@
<new-product-order v-if="isShowNewModal"
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>
@@ -104,6 +262,8 @@
bindingRoute,
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";
@@ -117,6 +277,11 @@
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([
{
@@ -153,11 +318,18 @@
label: "浜у搧鍚嶇О",
prop: "productName",
width: "120px",
+ dataType: "tag",
},
{
label: "瑙勬牸",
prop: "model",
width: "120px",
+ },
+ {
+ label: "寮哄害",
+ prop: "strength",
+ width: "120px",
+ dataType: "tag",
},
{
label: "鐗╂枡缂栫爜",
@@ -168,14 +340,23 @@
label: "宸ヨ壓璺嚎缂栧彿",
prop: "processRouteCode",
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",
@@ -200,6 +381,12 @@
label: "浜や粯鏃ユ湡",
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,
},
@@ -259,6 +446,156 @@
});
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: "",
@@ -266,6 +603,11 @@
projectName: "",
productName: "",
model: "",
+ dictCode: null,
+ startTime: null,
+ endTime: null,
+ strength: null,
+ status: "",
},
});
const { searchForm } = toRefs(data);
@@ -388,7 +730,11 @@
productName: "",
model: "",
status: "",
+ strength: null,
+ startTime: null,
+ endTime: null,
};
+ createTime.value = [];
handleQuery();
};
// 鏌ヨ鍒楄〃
@@ -412,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;
@@ -474,21 +834,66 @@
});
};
+ // 閫夋嫨鐢宠鍗�
+ const selectApplyNo = item => {
+ selectedApplyNo.value = item.applyNo;
+ selectedSourceData.value = item;
+ };
+
// 鏌ョ湅鏉ユ簮鐢熶骇璁″垝鏁版嵁
const showSourceData = row => {
- // 杩欓噷闇�瑕佹牴鎹疄闄呯殑API鍜岃矾鐢辫繘琛岃皟鏁�
- // 鍋囪鐢熶骇璁㈠崟涓湁鐢熶骇璁″垝ID瀛楁锛屾瘮濡俻roductionPlanId
- if (row.productionPlanId) {
- // 璺宠浆鍒扮敓浜ц鍒掕鎯呴〉闈�
- router.push({
- path: "/productionManagement/productionPlan",
- query: {
- id: row.productionPlanId,
- },
+ // 瀛樺偍鐐瑰嚮鏉ユ簮鎸夐挳鏃朵紶閫掔殑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);
});
- } else {
- proxy.$modal.msgWarning("褰撳墠璁㈠崟娌℃湁鍏宠仈鐨勭敓浜ц鍒�");
- }
};
// 琛ㄦ牸閫夋嫨鏁版嵁
@@ -496,13 +901,13 @@
selectedRows.value = selection;
};
const handleDeleteSolo = row => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚��鍥烇紝鏄惁纭閫�鍥烇紵", "瀵煎嚭", {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
})
.then(() => {
- delProductOrder([row.id]).then(res => {
+ delProductOrder(row.id).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
@@ -526,8 +931,8 @@
type: "warning",
})
.then(() => {
- delProductOrder(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ revokeProductOrder(ids).then(res => {
+ proxy.$modal.msgSuccess("閫�鍥炴垚鍔�");
getList();
});
})
@@ -556,8 +961,22 @@
};
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>
@@ -583,3 +1002,233 @@
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/productionReporting/components/ReportingDialog.vue b/src/views/productionManagement/productionReporting/components/ReportingDialog.vue
new file mode 100644
index 0000000..9016880
--- /dev/null
+++ b/src/views/productionManagement/productionReporting/components/ReportingDialog.vue
@@ -0,0 +1,613 @@
+<template>
+ <el-dialog v-model="localVisible"
+ :title="dialogTitle"
+ width="800px"
+ @close="handleClose">
+ <!-- 姝ラ鏉� -->
+ <el-steps :active="activeStep"
+ finish-status="success"
+ v-if="!props.data.id">
+ <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 + ''">
+ <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'">
+ <!-- 鏁板瓧绫诲瀷 -->
+ <el-input v-model="form.params[param.id]" />
+ </template>
+ <template v-else-if="param.paramType == '2'">
+ <!-- 鏂囨湰绫诲瀷 -->
+ <el-input v-model="form.params[param.id]" />
+ </template>
+ <template v-else-if="param.paramType == '3'">
+ <!-- 瀛楀吀绫诲瀷 -->
+ <el-select v-model="form.params[param.id]"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%">
+ <el-option v-for="option in dictOptions[param.paramFormat] || []"
+ :key="option.dictValue"
+ :label="option.dictLabel"
+ :value="option.dictValue" />
+ </el-select>
+ </template>
+ <template v-else-if="param.paramType == '4'">
+ <!-- 鏃ユ湡绫诲瀷 -->
+ <el-date-picker v-model="form.params[param.id]" />
+ </template>
+ <template v-else>
+ <!-- 鍏朵粬绫诲瀷 -->
+ <el-input v-model="form.params[param.id]" />
+ </template>
+ </el-form-item>
+ </el-form>
+ </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>
+ <!-- 缂栬緫妯″紡锛氱洿鎺ユ樉绀烘墍鏈変俊鎭� -->
+ <div v-if="props.data.id">
+ <el-form :model="form"
+ :rules="rules"
+ ref="formRef"
+ label-width="120px">
+ <el-form-item label="鐢熶骇璁㈠崟鍙�"
+ prop="npsNo"
+ disabled>
+ <el-input v-model="form.npsNo" />
+ </el-form-item>
+ <el-form-item label="鐝粍"
+ prop="teamName">
+ <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"
+ disabled>
+ <el-input v-model="form.materialCode" />
+ </el-form-item>
+ <el-form-item label="浜у搧鍚嶇О"
+ prop="productName"
+ disabled>
+ <el-input v-model="form.productName" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸"
+ prop="specification"
+ disabled>
+ <el-input v-model="form.specification" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓浜�"
+ prop="createBy">
+ <el-input v-model="form.createBy"
+ placeholder="璇疯緭鍏ュ垱寤轰汉" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿"
+ prop="createTime"
+ disabled>
+ <el-date-picker v-model="form.createTime"
+ type="datetime"
+ placeholder="璇烽�夋嫨鍒涘缓鏃堕棿"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="浜у嚭鏂归噺"
+ prop="outputVolume">
+ <el-input-number v-model="form.outputVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="涓嶅悎鏍兼柟閲�"
+ prop="unqualifiedVolume">
+ <el-input-number v-model="form.unqualifiedVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="瀹屾垚鏂归噺"
+ prop="completedVolume">
+ <el-input-number v-model="form.completedVolume"
+ :min="0"
+ :precision="2"
+ style="width: 100%" />
+ </el-form-item>
+ </el-form>
+ <!-- 宸ュ簭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 + ''">
+ <el-form :model="form"
+ :rules="rules"
+ ref="formRef"
+ label-width="120px">
+ <!-- 鍔ㄦ�佸弬鏁� -->
+ <el-form-item v-for="param in params"
+ :key="param.id"
+ :label="param.paramName"
+ :prop="`params.${param.id}`"
+ :rules="param.isRequired ? [{ required: true, message: `璇疯緭鍏�${param.paramName}`, trigger: 'blur' }] : []">
+ <template v-if="param.paramType == '1'">
+ <!-- 鏁板瓧绫诲瀷 -->
+ <el-input-number v-model="form.params[param.id]"
+ :min="0"
+ :precision="getPrecision(param.paramFormat)"
+ style="width: 100%" />
+ </template>
+ <template v-else-if="param.paramType == '2'">
+ <!-- 鏂囨湰绫诲瀷 -->
+ <el-input v-model="form.params[param.id]"
+ :placeholder="`璇疯緭鍏�${param.paramName}`" />
+ </template>
+ <template v-else-if="param.paramType == '3'">
+ <!-- 瀛楀吀绫诲瀷 -->
+ <el-select v-model="form.params[param.id]"
+ placeholder="璇烽�夋嫨"
+ style="width: 100%">
+ <el-option v-for="option in dictOptions[param.paramFormat] || []"
+ :key="option.dictValue"
+ :label="option.dictLabel"
+ :value="option.dictValue" />
+ </el-select>
+ </template>
+ <template v-else-if="param.paramType == '4'">
+ <!-- 鏃ユ湡绫诲瀷 -->
+ <el-date-picker v-model="form.params[param.id]"
+ type="datetime"
+ placeholder="璇烽�夋嫨鏃ユ湡鏃堕棿"
+ style="width: 100%" />
+ </template>
+ <template v-else>
+ <!-- 鍏朵粬绫诲瀷 -->
+ <el-input v-model="form.params[param.id]"
+ :placeholder="`璇疯緭鍏�${param.paramName}`" />
+ </template>
+ </el-form-item>
+ </el-form>
+ </el-tab-pane>
+ </el-tabs>
+ </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 && !props.data.id"
+ @click="handleNextStep">涓嬩竴姝�</el-button>
+ <el-button type="primary"
+ v-if="activeStep === 3 || props.data.id"
+ :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(),
+ params: props.data.params || {},
+ });
+
+ 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 || [];
+ // 鍒濆鍖栧弬鏁板�煎苟鑾峰彇瀛楀吀鏁版嵁
+ for (const param of params.value) {
+ if (!form.params[param.id]) {
+ form.params[param.id] = param.standardValue || "";
+ }
+ // 濡傛灉鏄瓧鍏哥被鍨嬪弬鏁帮紝鑾峰彇瀛楀吀鏁版嵁
+ if (param.paramType == "3" && param.paramFormat) {
+ await getDictOptions(param.paramFormat);
+ }
+ }
+ }
+ );
+ };
+
+ // 鑾峰彇灏忔暟绮惧害
+ 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 init = () => {
+ if (!props.data.id) {
+ // 鏂板鏃跺姞杞借鍗曞垪琛�
+ loadOrders();
+ // 璁剧疆榛樿鍒涘缓浜哄拰鍒涘缓鏃堕棿
+ form.createBy = "褰撳墠鐧诲綍浜�";
+ form.createTime = new Date();
+ } else {
+ // 缂栬緫鏃跺姞杞界浉鍏虫暟鎹�
+ if (props.data.orderId) {
+ orderId.value = props.data.orderId;
+ if (props.data.processId) {
+ processId.value = props.data.processId;
+ activeProcessId.value = props.data.processId + "";
+ loadParams(props.data.processId, props.data.orderId);
+ } else {
+ loadProcesses(props.data.orderId);
+ }
+ } else {
+ loadOrders();
+ }
+ }
+ };
+
+ // 鐩戝惉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;
+ }
+</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 aec4eed..8dea0db 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -107,6 +107,12 @@
: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>
<!-- 鍚堝苟涓嬪彂寮圭獥 -->
@@ -456,14 +462,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: "涓嬪彂鐘舵��",
@@ -1063,7 +1073,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;
--
Gitblit v1.9.3