From 6e0b58813ae5a88526d30597b931eab9de5e015b Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 21 五月 2026 13:07:25 +0800
Subject: [PATCH] fix: 合并pro代码
---
src/utils/request.js | 25
src/views/index.vue | 592 +++++++++++++++++++------------
src/views/productionManagement/productStructure/Detail/index.vue | 12
src/views/productionManagement/processRoute/index.vue | 4
src/api/login.js | 17
src/store/modules/user.js | 236 ++++++-----
src/api/viewIndex.js | 56 ++
src/views/productionManagement/processRoute/processRouteItem/index.vue | 162 ++++++++
src/views/productionManagement/productionOrder/index.vue | 1
src/views/salesManagement/salesLedger/index.vue | 23
src/router/index.js | 8
11 files changed, 752 insertions(+), 384 deletions(-)
diff --git a/src/api/login.js b/src/api/login.js
index fea9d46..4cc0a5d 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -1,4 +1,5 @@
-import request from '@/utils/request'
+import request from '@/utils/request'
+import { getToken } from '@/utils/auth'
// 鐧诲綍鏂规硶
export function login(username, password, code, uuid) {
@@ -32,12 +33,14 @@
}
// 鑾峰彇鐢ㄦ埛璇︾粏淇℃伅
-export function getInfo() {
- return request({
- url: '/getInfo',
- method: 'get'
- })
-}
+export function getInfo() {
+ const token = getToken()
+ return request({
+ url: '/getInfo',
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
+ method: 'get'
+ })
+}
// 閫�鍑烘柟娉�
export function logout() {
diff --git a/src/api/viewIndex.js b/src/api/viewIndex.js
index 8b5d144..9cae219 100644
--- a/src/api/viewIndex.js
+++ b/src/api/viewIndex.js
@@ -326,3 +326,59 @@
method: "get",
});
};
+
+export const productionOverview = () => {
+ return request({
+ url: "/home/productionOverview",
+ method: "get",
+ headers: {
+ handleAuthError: false,
+ },
+ });
+};
+
+export const productionRealtimeBoard = () => {
+ return request({
+ url: "/home/productionRealtimeBoard",
+ method: "get",
+ headers: {
+ handleAuthError: false,
+ },
+ });
+};
+
+export const productionOrderProgress = (params = {}) => {
+ const safePageNum = Math.max(1, Number(params.pageNum || 1));
+ const safePageSize = Math.min(50, Math.max(1, Number(params.pageSize || 10)));
+ const safeTab = ["all", "inProgress", "completed", "paused"].includes(params.tab)
+ ? params.tab
+ : "all";
+ return request({
+ url: "/home/productionOrderProgress",
+ method: "get",
+ params: {
+ ...params,
+ tab: safeTab,
+ pageNum: safePageNum,
+ pageSize: safePageSize,
+ },
+ headers: {
+ handleAuthError: false,
+ },
+ });
+};
+
+export const todayProductionPlan = (params = {}) => {
+ const safeLimit = Math.min(20, Math.max(1, Number(params.limit || 4)));
+ return request({
+ url: "/home/todayProductionPlan",
+ method: "get",
+ params: {
+ ...params,
+ limit: safeLimit,
+ },
+ headers: {
+ handleAuthError: false,
+ },
+ });
+};
diff --git a/src/router/index.js b/src/router/index.js
index 352ed85..1d53a48 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -125,13 +125,9 @@
children: [
{
path: ":id",
- component: () =>
- import("@/views/projectManagement/Management/projectDetail.vue"),
+ component: () => import("@/views/projectManagement/Management/projectDetail.vue"),
name: "ProjectManagementDetail",
- meta: {
- title: "椤圭洰璇︽儏",
- activeMenu: "/projectManagement/Management",
- },
+ meta: { title: "椤圭洰璇︽儏", activeMenu: "/projectManagement/Management" },
},
],
},
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index ea358d1..b7714f6 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,12 +1,12 @@
-import {login, logout, getInfo, loginCheck, loginCheckFactory,tideLogin} from '@/api/login'
-import { getToken, setToken, removeToken } from '@/utils/auth'
-import { isHttp, isEmpty } from "@/utils/validate"
-import defAva from '@/assets/images/profile.jpg'
-import { defineStore } from 'pinia'
-
-const useUserStore = defineStore(
- 'user',
- {
+import {login, logout, getInfo, loginCheck, loginCheckFactory,tideLogin} from '@/api/login'
+import { getToken, setToken, removeToken } from '@/utils/auth'
+import { isHttp, isEmpty } from "@/utils/validate"
+import defAva from '@/assets/images/profile.jpg'
+import { defineStore } from 'pinia'
+
+const useUserStore = defineStore(
+ 'user',
+ {
state: () => ({
token: getToken(),
id: '',
@@ -15,54 +15,60 @@
roles: [],
permissions: [],
aiEnabled: 0
- }),
- actions: {
- // 鐧诲綍
- login(userInfo) {
- const username = userInfo.username.trim()
- const password = userInfo.password
- const code = userInfo.code
- const uuid = userInfo.uuid
- return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
- setToken(res.token)
- this.token = res.token
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
- },
- getCurrentTime() {
- const now = new Date();
- const year = now.getFullYear(); // 鑾峰彇骞翠唤
- const month = String(now.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝瑕�+1锛屽苟琛ラ浂
- const day = String(now.getDate()).padStart(2, '0'); // 鏃ユ湡琛ラ浂
- const hours = String(now.getHours()).padStart(2, '0'); // 灏忔椂琛ラ浂
- const minutes = String(now.getMinutes()).padStart(2, '0'); // 鍒嗛挓琛ラ浂
- const seconds = String(now.getSeconds()).padStart(2, '0'); // 绉掓暟琛ラ浂
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
- },
- // 鑾峰彇鐢ㄦ埛淇℃伅
- getInfo() {
- return new Promise((resolve, reject) => {
- getInfo().then(res => {
- const user = res.user
- let avatar = user.avatar || ""
- avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar
- if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
- this.roles = res.roles
- this.permissions = res.permissions
- } else {
- this.roles = ['ROLE_DEFAULT']
- }
- this.id = user.userId
- this.name = user.userName
- this.avatar = avatar
- this.currentFactoryName = user.currentFactoryName
- this.nickName = user.nickName
- this.roleName = user.roles[0].roleName
- this.currentDeptId = user.tenantId
+ }),
+ actions: {
+ // 鐧诲綍
+ login(userInfo) {
+ const username = userInfo.username.trim()
+ const password = userInfo.password
+ const code = userInfo.code
+ const uuid = userInfo.uuid
+ return new Promise((resolve, reject) => {
+ login(username, password, code, uuid).then(res => {
+ const token = res?.token || res?.data?.token
+ if (!token) {
+ reject(new Error('鏈幏鍙栧埌鐧诲綍浠ょ墝'))
+ return
+ }
+ setToken(token)
+ this.token = token
+ resolve()
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ getCurrentTime() {
+ const now = new Date();
+ const year = now.getFullYear(); // 鑾峰彇骞翠唤
+ const month = String(now.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝瑕�+1锛屽苟琛ラ浂
+ const day = String(now.getDate()).padStart(2, '0'); // 鏃ユ湡琛ラ浂
+ const hours = String(now.getHours()).padStart(2, '0'); // 灏忔椂琛ラ浂
+ const minutes = String(now.getMinutes()).padStart(2, '0'); // 鍒嗛挓琛ラ浂
+ const seconds = String(now.getSeconds()).padStart(2, '0'); // 绉掓暟琛ラ浂
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ },
+ // 鑾峰彇鐢ㄦ埛淇℃伅
+ getInfo() {
+ return new Promise((resolve, reject) => {
+ getInfo().then(res => {
+ res = res.data
+ const user = res.user || {}
+ let avatar = user.avatar || ""
+ avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar
+ if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
+ this.roles = res.roles
+ this.permissions = res.permissions
+ } else {
+ this.roles = ['ROLE_DEFAULT']
+ }
+ this.id = user.userId || ''
+ this.name = user.userName || ''
+ this.avatar = avatar
+ this.currentFactoryName = user.currentFactoryName || ''
+ this.nickName = user.nickName || ''
+ this.roleName = Array.isArray(user.roles) && user.roles.length > 0 ? (user.roles[0].roleName || '') : ''
+ this.currentDeptId = user.tenantId || ''
this.currentLoginTime = this.getCurrentTime()
this.aiEnabled = Number(res.aiEnabled) === 1 ? 1 : 0
resolve(res)
@@ -70,11 +76,11 @@
reject(error)
})
})
- },
- // 閫�鍑虹郴缁�
- logOut() {
- return new Promise((resolve, reject) => {
- logout(this.token).then(() => {
+ },
+ // 閫�鍑虹郴缁�
+ logOut() {
+ return new Promise((resolve, reject) => {
+ logout(this.token).then(() => {
this.token = ''
this.roles = []
this.permissions = []
@@ -84,51 +90,61 @@
}).catch(error => {
reject(error)
})
- })
- },
- // 鐧诲綍鏍¢獙
- loginCheck(userInfo) {
- const username = userInfo.username.trim()
- const password = userInfo.password
- return new Promise((resolve, reject) => {
- loginCheck(username, password).then(res => {
- resolve(res)
- }).catch(error => {
- reject(error)
- })
- })
- },
- // 閮ㄩ棬鐧诲綍
- loginCheckFactory(userInfo) {
- const username = userInfo.username.trim()
- const password = userInfo.password
- return new Promise((resolve, reject) => {
- loginCheckFactory(username, password).then(res => {
- setToken(res.token)
- this.token = res.token
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
- },
- TideLogin(code) {
- return new Promise((resolve, reject) => {
- tideLogin(code)
- .then((res) => {
- setToken(res.token);
- this.token = res.token
- Vue.prototype.uploadHeader = {
- Authorization: "Bearer " + res.token,
- };
- resolve();
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- }
- })
-
-export default useUserStore
+ })
+ },
+ // 鐧诲綍鏍¢獙
+ loginCheck(userInfo) {
+ const username = userInfo.username.trim()
+ const password = userInfo.password
+ return new Promise((resolve, reject) => {
+ loginCheck(username, password).then(res => {
+ resolve(res)
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ // 閮ㄩ棬鐧诲綍
+ loginCheckFactory(userInfo) {
+ const username = userInfo.username.trim()
+ const password = userInfo.password
+ return new Promise((resolve, reject) => {
+ loginCheckFactory(username, password).then(res => {
+ const token = res?.token || res?.data?.token
+ if (!token) {
+ reject(new Error('鏈幏鍙栧埌鐧诲綍浠ょ墝'))
+ return
+ }
+ setToken(token)
+ this.token = token
+ resolve()
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ TideLogin(code) {
+ return new Promise((resolve, reject) => {
+ tideLogin(code)
+ .then((res) => {
+ const token = res?.token || res?.data?.token
+ if (!token) {
+ reject(new Error('鏈幏鍙栧埌鐧诲綍浠ょ墝'))
+ return
+ }
+ setToken(token);
+ this.token = token
+ Vue.prototype.uploadHeader = {
+ Authorization: "Bearer " + token,
+ };
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ },
+ }
+ })
+
+export default useUserStore
diff --git a/src/utils/request.js b/src/utils/request.js
index 9cfcf5b..672bed8 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -21,11 +21,12 @@
})
// request鎷︽埅鍣�
-service.interceptors.request.use(config => {
+service.interceptors.request.use(config => {
+ config.headers = config.headers || {}
// 鏄惁闇�瑕佽缃� token
- const isToken = (config.headers || {}).isToken === false
+ const isToken = config.headers.isToken === false
// 鏄惁闇�瑕侀槻姝㈡暟鎹噸澶嶆彁浜�
- const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
+ const isRepeatSubmit = config.headers.repeatSubmit === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 璁╂瘡涓姹傛惡甯﹁嚜瀹氫箟token 璇锋牴鎹疄闄呮儏鍐佃嚜琛屼慨鏀�
}
@@ -66,23 +67,27 @@
}
}
return config
-}, error => {
- console.log(error)
- Promise.reject(error)
-})
+}, error => {
+ console.log(error)
+ return Promise.reject(error)
+})
// 鍝嶅簲鎷︽埅鍣�
service.interceptors.response.use(res => {
// 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬�
- const code = res.data.code || 200
+ const code = res.data.code || 200
+ const handleAuthError = (res.config && res.config.headers && res.config.headers.handleAuthError) !== false
// 鑾峰彇閿欒淇℃伅
const msg = errorCode[code] || res.data.msg || errorCode['default']
// 浜岃繘鍒舵暟鎹垯鐩存帴杩斿洖
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
return res.data
}
- if (code === 401) {
- if (!isRelogin.show) {
+ if (code === 401) {
+ if (!handleAuthError) {
+ return Promise.reject(new Error(msg))
+ }
+ if (!isRelogin.show) {
isRelogin.show = true
ElMessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', { confirmButtonText: '閲嶆柊鐧诲綍', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => {
isRelogin.show = false
diff --git a/src/views/index.vue b/src/views/index.vue
index 67c20c4..3176042 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -21,10 +21,10 @@
<section v-if="dashboardCards.length > 0" class="top-row">
<div class="stats-grid">
<article
- v-for="card in dashboardCards"
- :key="card.key"
- class="stat-card"
- :class="card.key"
+ v-for="card in dashboardCards"
+ :key="card.key"
+ class="stat-card"
+ :class="card.key"
>
<div class="stat-header">
<div class="stat-title-wrap">
@@ -66,15 +66,15 @@
<div class="process-body">
<div class="process-chart" :class="{ empty: !hasProcessData }">
<Echarts
- :options="chartBaseOptions"
- :chartStyle="{ width: '100%', height: '100%' }"
- :grid="processGrid"
- :series="processSeries"
- :tooltip="processTooltip"
- :xAxis="processXAxis"
- :yAxis="processYAxis"
- :style="{ height: hasProcessData ? '340px' : '280px' }"
- @click="handleChartClick"
+ :options="chartBaseOptions"
+ :chartStyle="{ width: '100%', height: '100%' }"
+ :grid="processGrid"
+ :series="processSeries"
+ :tooltip="processTooltip"
+ :xAxis="processXAxis"
+ :yAxis="processYAxis"
+ :style="{ height: hasProcessData ? '340px' : '280px' }"
+ @click="handleChartClick"
/>
<div v-if="!hasProcessData" class="chart-empty">
<el-icon><DataAnalysis /></el-icon>
@@ -113,10 +113,10 @@
<div class="panel-title-row">
<div class="panel-title">鐢熶骇璁㈠崟杩涘害</div>
<el-radio-group v-model="orderFilter" size="small">
- <el-radio-button label="all">鍏ㄩ儴</el-radio-button>
- <el-radio-button label="in_progress">杩涜涓�</el-radio-button>
- <el-radio-button label="completed">宸插畬鎴�</el-radio-button>
- <el-radio-button label="paused">宸叉殏鍋�</el-radio-button>
+ <el-radio-button label="all">鍏ㄩ儴({{ orderProgressMeta.total }})</el-radio-button>
+ <el-radio-button label="inProgress">杩涜涓�({{ orderProgressMeta.inProgressCount }})</el-radio-button>
+ <el-radio-button label="completed">宸插畬鎴�({{ orderProgressMeta.completedCount }})</el-radio-button>
+ <el-radio-button label="paused">宸叉殏鍋�({{ orderProgressMeta.pausedCount }})</el-radio-button>
</el-radio-group>
</div>
<el-table :data="filteredOrders" stripe>
@@ -128,10 +128,10 @@
<template #default="{ row }">
<div class="table-progress">
<el-progress
- :stroke-width="8"
- :percentage="row.completionRate"
- :show-text="false"
- status="success"
+ :stroke-width="8"
+ :percentage="row.completionRate"
+ :show-text="false"
+ status="success"
/>
<span>{{ row.completionRate }}%</span>
</div>
@@ -141,7 +141,7 @@
<el-table-column label="鐘舵��" min-width="90">
<template #default="{ row }">
<el-tag :type="getOrderStatusType(row.status)" effect="light">
- {{ getOrderStatusText(row.status) }}
+ {{ row.statusLabel || getOrderStatusText(row.status) }}
</el-tag>
</template>
</el-table-column>
@@ -149,53 +149,53 @@
</div>
<div v-if="visiblePanels.contract" class="cockpit-panel contract-panel">
- <div class="panel-title">瀹㈡埛鍚堝悓閲戦鍒嗘瀽</div>
- <div class="contract-summary">
- <div class="contract-card">
- <div class="contract-name">鎬诲悎鍚岄噾棰�(鍏�)</div>
- <div class="contract-main digital-number">{{ formatNumber(sum) }}</div>
- <div class="contract-compare">
- 鍚屾瘮
- <span class="rise">{{ trendText(yny) }}</span>
- 鐜瘮
- <span class="rise">{{ trendText(chain) }}</span>
- </div>
+ <div class="panel-title">瀹㈡埛鍚堝悓閲戦鍒嗘瀽</div>
+ <div class="contract-summary">
+ <div class="contract-card">
+ <div class="contract-name">鎬诲悎鍚岄噾棰�(鍏�)</div>
+ <div class="contract-main digital-number">{{ formatNumber(sum) }}</div>
+ <div class="contract-compare">
+ 鍚屾瘮
+ <span class="rise">{{ trendText(yny) }}</span>
+ 鐜瘮
+ <span class="rise">{{ trendText(chain) }}</span>
</div>
- <div class="contract-chart-wrap">
- <Echarts
+ </div>
+ <div class="contract-chart-wrap">
+ <Echarts
:options="chartBaseOptions"
:legend="pieLegend"
:chartStyle="chartStylePie"
:series="materialPieSeries"
:tooltip="pieTooltip"
- />
- </div>
+ />
</div>
- <ul class="contract-list">
- <li v-for="item in materialPieSeries[0].data" :key="item.name">
- <span class="legend-dot" :style="{ backgroundColor: item.itemStyle?.color }"></span>
- <span class="contract-item-name">{{ item.name }}</span>
- <span class="contract-item-rate">{{ item.rate }}%</span>
- <span class="contract-item-value digital-number">楼{{ formatNumber(item.value) }}</span>
- </li>
- </ul>
</div>
+ <ul class="contract-list">
+ <li v-for="item in materialPieSeries[0].data" :key="item.name">
+ <span class="legend-dot" :style="{ backgroundColor: item.itemStyle?.color }"></span>
+ <span class="contract-item-name">{{ item.name }}</span>
+ <span class="contract-item-rate">{{ item.rate }}%</span>
+ <span class="contract-item-value digital-number">楼{{ formatNumber(item.value) }}</span>
+ </li>
+ </ul>
+ </div>
<div v-if="visiblePanels.quality" class="cockpit-panel quality-panel">
- <div class="panel-title-row">
- <div class="panel-title">璐ㄩ噺缁熻</div>
- <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo">
- <el-radio-button :value="1">鍛�</el-radio-button>
- <el-radio-button :value="2">鏈�</el-radio-button>
- <el-radio-button :value="3">瀛e害</el-radio-button>
- </el-radio-group>
- </div>
- <div class="quality-cards">
- <div class="quality-card one">鍘熸潗鏂欏凡妫�鏁伴噺 <span>{{ qualityStatisticsObject.supplierNum }}浠�</span></div>
- <div class="quality-card two">杩囩▼妫�楠屾暟閲� <span>{{ qualityStatisticsObject.processNum }}浠�</span></div>
- <div class="quality-card three">鍑哄巶宸叉鏁伴噺 <span>{{ qualityStatisticsObject.factoryNum }}浠�</span></div>
- </div>
- <Echarts
+ <div class="panel-title-row">
+ <div class="panel-title">璐ㄩ噺缁熻</div>
+ <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo">
+ <el-radio-button :value="1">鍛�</el-radio-button>
+ <el-radio-button :value="2">鏈�</el-radio-button>
+ <el-radio-button :value="3">瀛e害</el-radio-button>
+ </el-radio-group>
+ </div>
+ <div class="quality-cards">
+ <div class="quality-card one">鍘熸潗鏂欏凡妫�鏁伴噺 <span>{{ qualityStatisticsObject.supplierNum }}浠�</span></div>
+ <div class="quality-card two">杩囩▼妫�楠屾暟閲� <span>{{ qualityStatisticsObject.processNum }}浠�</span></div>
+ <div class="quality-card three">鍑哄巶宸叉鏁伴噺 <span>{{ qualityStatisticsObject.factoryNum }}浠�</span></div>
+ </div>
+ <Echarts
:options="chartBaseOptions"
:chartStyle="chartStyle"
:grid="grid"
@@ -205,8 +205,8 @@
:xAxis="xAxis1"
:yAxis="yAxis1"
style="height: 270px"
- />
- </div>
+ />
+ </div>
</div>
<div v-if="hasRightPanels" class="right-column">
@@ -236,11 +236,11 @@
<div class="realtime-grid">
<div class="realtime-item" v-for="item in realtimeBoard" :key="item.key">
<el-progress
- type="circle"
- :percentage="item.percent"
- :stroke-width="10"
- :width="94"
- :color="item.color"
+ type="circle"
+ :percentage="item.percent"
+ :stroke-width="10"
+ :width="94"
+ :color="item.color"
>
<template #default>
<div class="realtime-value digital-number">{{ item.display }}</div>
@@ -258,11 +258,11 @@
</div>
<div class="quick-grid">
<button
- v-for="item in quickEntries"
- :key="item.label"
- class="quick-item"
- type="button"
- @click="goToQuick(item.path)"
+ v-for="item in quickEntries"
+ :key="item.label"
+ class="quick-item"
+ type="button"
+ @click="goToQuick(item.path)"
>
<span class="quick-icon">
<el-icon>
@@ -277,7 +277,7 @@
<div v-if="visiblePanels.plan" class="cockpit-panel plan-panel">
<div class="panel-title-row">
<div class="panel-title">浠婃棩鐢熶骇璁″垝</div>
- <span class="panel-more">{{ todayPlanList.length }}椤�</span>
+ <span class="panel-more">{{ todayPlanTotal }}椤�</span>
</div>
<ul class="plan-list">
<li v-for="item in todayPlanList" :key="item.orderNo" class="plan-item">
@@ -296,15 +296,15 @@
<div v-if="visiblePanels.receipt" class="cockpit-panel receipt-panel">
<div class="panel-title">鍥炴涓庡紑绁ㄥ垎鏋�</div>
<Echarts
- :options="chartBaseOptions"
- :chartStyle="chartStyle"
- :grid="grid"
- :legend="lineLegend"
- :series="lineSeries"
- :tooltip="tooltipLine"
- :xAxis="xAxis2"
- :yAxis="yAxis2"
- style="height: 300px"
+ :options="chartBaseOptions"
+ :chartStyle="chartStyle"
+ :grid="grid"
+ :legend="lineLegend"
+ :series="lineSeries"
+ :tooltip="tooltipLine"
+ :xAxis="xAxis2"
+ :yAxis="yAxis2"
+ style="height: 300px"
/>
</div>
@@ -363,8 +363,12 @@
getBusiness,
homeTodos,
processDataProductionStatistics,
+ productionOrderProgress,
+ productionOverview,
+ productionRealtimeBoard,
qualityInspectionStatistics,
statisticsReceivablePayable,
+ todayProductionPlan,
} from "@/api/viewIndex.js";
import { list } from "@/api/productionManagement/productionProcess";
@@ -391,7 +395,7 @@
});
const welcomeAvatar = computed(() =>
- welcomeAvatarLoadFailed.value || !userStore.avatar ? defaultWelcomeAvatar : userStore.avatar
+ welcomeAvatarLoadFailed.value || !userStore.avatar ? defaultWelcomeAvatar : userStore.avatar
);
const handleWelcomeAvatarError = () => {
@@ -401,10 +405,10 @@
};
watch(
- () => userStore.avatar,
- () => {
- welcomeAvatarLoadFailed.value = false;
- }
+ () => userStore.avatar,
+ () => {
+ welcomeAvatarLoadFailed.value = false;
+ }
);
const axisTextColor = "#5f6f86";
@@ -436,6 +440,31 @@
processNum: 0,
factoryNum: 0,
});
+
+const productionOverviewData = ref({
+ totalOutput: 0,
+ totalScrap: 0,
+ yieldRate: 0,
+});
+
+const realtimeBoardData = ref({
+ deviceOee: { value: 0, compareYesterday: 0 },
+ orderAchievementRate: { value: 0, compareYesterday: 0 },
+ defectRate: { value: 0, compareYesterday: 0 },
+});
+
+const orderProgressMeta = ref({
+ tab: "all",
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ inProgressCount: 0,
+ completedCount: 0,
+ pausedCount: 0,
+});
+
+const todayPlanList = ref([]);
+const todayPlanTotal = ref(0);
const sum = ref(0);
const yny = ref(0);
@@ -677,11 +706,11 @@
const name = params?.[0]?.name ?? "";
const list = Array.isArray(params) ? params : [];
const lines = list
- .map((p) => {
- const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>`;
- return `${colorBox}${p.seriesName}<b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>`;
- })
- .join("<br/>");
+ .map((p) => {
+ const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>`;
+ return `${colorBox}${p.seriesName}<b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>`;
+ })
+ .join("<br/>");
return `<div style="min-width:140px;"><div style="font-weight:700;margin-bottom:6px;">${name}</div>${lines}</div>`;
},
});
@@ -730,15 +759,15 @@
});
const processTotals = computed(() =>
- processChartData.value.reduce(
- (acc, cur) => {
- acc.input += Number(cur.input || 0);
- acc.scrap += Number(cur.scrap || 0);
- acc.output += Number(cur.output || 0);
- return acc;
- },
- { input: 0, scrap: 0, output: 0 }
- )
+ processChartData.value.reduce(
+ (acc, cur) => {
+ acc.input += Number(cur.input || 0);
+ acc.scrap += Number(cur.scrap || 0);
+ acc.output += Number(cur.output || 0);
+ return acc;
+ },
+ { input: 0, scrap: 0, output: 0 }
+ )
);
const hasProcessData = computed(() => {
@@ -771,8 +800,8 @@
subLabel: "寰呬粯娆鹃噾棰�",
subValue: formatNumber(businessInfo.value.monthPurchaseHaveMoney),
trend: `鍗犳瘮 ${ratioText(
- businessInfo.value.monthPurchaseHaveMoney,
- businessInfo.value.monthPurchaseMoney
+ businessInfo.value.monthPurchaseHaveMoney,
+ businessInfo.value.monthPurchaseMoney
)}`,
icon: ShoppingCartFull,
visible: visibleModules.value.procurement,
@@ -792,102 +821,68 @@
key: "production",
title: "鐢熶骇鎬昏",
desc: "绱浜у嚭(浠�)",
- value: formatNumber(processTotals.value.output),
+ value: formatNumber(productionOverviewData.value.totalOutput),
subLabel: "绱鎶ュ簾",
- subValue: formatNumber(processTotals.value.scrap),
- trend: `鑹巼 ${ratioText(processTotals.value.output, processTotals.value.input)}`,
+ subValue: formatNumber(productionOverviewData.value.totalScrap),
+ trend: `鑹巼 ${Number(productionOverviewData.value.yieldRate || 0).toFixed(2)}%`,
icon: Operation,
visible: visibleModules.value.production,
},
].filter((item) => item.visible));
-const productionOrders = ref([
- {
- orderNo: "MO-20260518-001",
- productName: "鏅鸿兘鎺у埗鍣�",
- planQty: 1000,
- completedQty: 860,
- completionRate: 86,
- deliveryDate: "2026-05-20",
- status: "in_progress",
- },
- {
- orderNo: "MO-20260518-002",
- productName: "鐢垫簮妯″潡",
- planQty: 800,
- completedQty: 640,
- completionRate: 80,
- deliveryDate: "2026-05-22",
- status: "in_progress",
- },
- {
- orderNo: "MO-20260518-003",
- productName: "浼犳劅鍣ㄧ粍浠�",
- planQty: 500,
- completedQty: 150,
- completionRate: 30,
- deliveryDate: "2026-05-25",
- status: "paused",
- },
- {
- orderNo: "MO-20260518-004",
- productName: "缁撴瀯浠禔",
- planQty: 1200,
- completedQty: 1200,
- completionRate: 100,
- deliveryDate: "2026-05-15",
- status: "completed",
- },
-]);
+const productionOrders = ref([]);
const orderFilter = ref("all");
-const filteredOrders = computed(() => {
- if (orderFilter.value === "all") return productionOrders.value;
- return productionOrders.value.filter((item) => item.status === orderFilter.value);
-});
+const filteredOrders = computed(() => productionOrders.value);
-const todayPlanList = computed(() =>
- productionOrders.value
- .slice()
- .sort((a, b) => dayjs(a.deliveryDate).valueOf() - dayjs(b.deliveryDate).valueOf())
- .slice(0, 5)
-);
+const getCompareTrend = (value) => {
+ const num = Number(value || 0);
+ if (num > 0) return "up";
+ if (num < 0) return "down";
+ return "flat";
+};
-const avgCompletionRate = computed(() => {
- if (!productionOrders.value.length) return 0;
- const total = productionOrders.value.reduce((acc, cur) => acc + Number(cur.completionRate || 0), 0);
- return Number((total / productionOrders.value.length).toFixed(1));
-});
+const getCompareText = (value) => {
+ const num = Number(value || 0);
+ const abs = Math.abs(num).toFixed(2);
+ if (num > 0) return `杈冩槰鏃� 鈫� ${abs}%`;
+ if (num < 0) return `杈冩槰鏃� 鈫� ${abs}%`;
+ return "杈冩槰鏃� 鎸佸钩";
+};
const realtimeBoard = computed(() => {
- const oee = ratioNumber(processTotals.value.output, processTotals.value.input);
- const defectRate = ratioNumber(processTotals.value.scrap, processTotals.value.input);
+ const oee = Number(realtimeBoardData.value.deviceOee?.value || 0);
+ const orderAchievement = Number(realtimeBoardData.value.orderAchievementRate?.value || 0);
+ const defectRate = Number(realtimeBoardData.value.defectRate?.value || 0);
+ const oeeCompare = Number(realtimeBoardData.value.deviceOee?.compareYesterday || 0);
+ const orderCompare = Number(realtimeBoardData.value.orderAchievementRate?.compareYesterday || 0);
+ const defectCompare = Number(realtimeBoardData.value.defectRate?.compareYesterday || 0);
return [
{
key: "oee",
label: "璁惧 OEE",
percent: clampPercent(oee),
- display: `${oee.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 4.0%",
- trend: "up",
+ display: `${oee.toFixed(2)}%`,
+ delta: getCompareText(oeeCompare),
+ trend: getCompareTrend(oeeCompare),
color: "#2d8cff",
},
{
key: "order",
label: "璁㈠崟杈炬垚鐜�",
- percent: clampPercent(avgCompletionRate.value),
- display: `${avgCompletionRate.value.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 2.6%",
- trend: "up",
+ percent: clampPercent(orderAchievement),
+ display: `${orderAchievement.toFixed(2)}%`,
+ delta: getCompareText(orderCompare),
+ trend: getCompareTrend(orderCompare),
color: "#31d2ff",
},
{
key: "defect",
label: "涓嶈壇鐜�",
percent: clampPercent(defectRate),
- display: `${defectRate.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 0.5%",
- trend: "down",
+ display: `${defectRate.toFixed(2)}%`,
+ delta: getCompareText(defectCompare),
+ trend: getCompareTrend(defectCompare),
color: "#f6a23f",
},
];
@@ -930,11 +925,11 @@
const normalizeMenuTitle = (title) => String(title || "").replace(/\s+/g, "").trim();
const normalizeRoutePath = (path) =>
- String(path || "")
- .trim()
- .replace(/\/+/g, "/")
- .replace(/\/$/, "")
- .toLowerCase();
+ String(path || "")
+ .trim()
+ .replace(/\/+/g, "/")
+ .replace(/\/$/, "")
+ .toLowerCase();
const resolveRoutePath = (route, parentPath = "") => {
const currentPath = String(route?.path || "").trim();
@@ -966,11 +961,11 @@
const accessibleMenuRoutes = computed(() => {
const routePool =
- permissionStore.defaultRoutes?.length > 0
- ? permissionStore.defaultRoutes
- : permissionStore.sidebarRouters?.length > 0
- ? permissionStore.sidebarRouters
- : permissionStore.routes;
+ permissionStore.defaultRoutes?.length > 0
+ ? permissionStore.defaultRoutes
+ : permissionStore.sidebarRouters?.length > 0
+ ? permissionStore.sidebarRouters
+ : permissionStore.routes;
return collectAccessibleRoutes(routePool || []);
});
@@ -1014,13 +1009,13 @@
};
const hasModuleAccess = (config) =>
- accessibleMenuRoutes.value.some((route) => {
- const matchedTitle = (config.titles || []).some((title) => route.title === normalizeMenuTitle(title));
- const matchedPath = (config.pathPrefixes || []).some(
- (prefix) => route.path === prefix || route.path.startsWith(`${prefix}/`)
- );
- return matchedTitle || matchedPath;
- });
+ accessibleMenuRoutes.value.some((route) => {
+ const matchedTitle = (config.titles || []).some((title) => route.title === normalizeMenuTitle(title));
+ const matchedPath = (config.pathPrefixes || []).some(
+ (prefix) => route.path === prefix || route.path.startsWith(`${prefix}/`)
+ );
+ return matchedTitle || matchedPath;
+ });
const visibleModules = computed(() => ({
sales: hasModuleAccess(moduleAccessConfig.sales),
@@ -1047,29 +1042,29 @@
}));
const hasLeftPanels = computed(
- () => visiblePanels.value.process || visiblePanels.value.order || visiblePanels.value.contract || visiblePanels.value.quality
+ () => visiblePanels.value.process || visiblePanels.value.order || visiblePanels.value.contract || visiblePanels.value.quality
);
const hasRightPanels = computed(
- () => visiblePanels.value.todo || visiblePanels.value.realtime || visiblePanels.value.quick || visiblePanels.value.plan || visiblePanels.value.receipt
+ () => visiblePanels.value.todo || visiblePanels.value.realtime || visiblePanels.value.quick || visiblePanels.value.plan || visiblePanels.value.receipt
);
const hasVisiblePanels = computed(() => hasLeftPanels.value || hasRightPanels.value);
const quickEntries = computed(() =>
- quickEntryConfigs
- .map((item) => {
- const targetRoute = accessibleMenuRoutes.value.find((route) =>
- item.titles.some((title) => route.title === normalizeMenuTitle(title))
- );
- const resolvedPath = targetRoute?.path || "";
- return resolvedPath
- ? {
- label: item.label,
- icon: item.icon,
- path: resolvedPath,
- }
- : null;
- })
- .filter(Boolean)
+ quickEntryConfigs
+ .map((item) => {
+ const targetRoute = accessibleMenuRoutes.value.find((route) =>
+ item.titles.some((title) => route.title === normalizeMenuTitle(title))
+ );
+ const resolvedPath = targetRoute?.path || "";
+ return resolvedPath
+ ? {
+ label: item.label,
+ icon: item.icon,
+ path: resolvedPath,
+ }
+ : null;
+ })
+ .filter(Boolean)
);
const updateNowTime = () => {
@@ -1111,20 +1106,137 @@
const getOrderStatusText = (status) => {
const mapping = {
- in_progress: "杩涜涓�",
- completed: "宸插畬鎴�",
- paused: "鏆傚仠",
+ 1: "寰呭紑濮�",
+ 2: "杩涜涓�",
+ 3: "宸插畬鎴�",
+ 4: "宸叉殏鍋�",
};
return mapping[status] || "鏈煡";
};
const getOrderStatusType = (status) => {
const mapping = {
- in_progress: "success",
- completed: "primary",
- paused: "warning",
+ 1: "info",
+ 2: "success",
+ 3: "primary",
+ 4: "warning",
};
return mapping[status] || "info";
+};
+
+const formatDueDate = (value) => {
+ if (!value) return "--";
+ const date = dayjs(value);
+ return date.isValid() ? date.format("YYYY-MM-DD") : "--";
+};
+
+const mapOrderProgressRecord = (item = {}) => ({
+ orderNo: item.orderNo || "--",
+ productName: item.productName || "--",
+ planQty: Number(item.plannedQuantity || 0),
+ completedQty: Number(item.completedQuantity || 0),
+ completionRate: clampPercent(Number(item.completionRate || 0)),
+ deliveryDate: formatDueDate(item.dueDate),
+ status: Number(item.status || 0),
+ statusLabel: item.statusLabel || "",
+});
+
+const mapTodayPlanRecord = (item = {}) => ({
+ orderNo: item.orderNo || "--",
+ productName: item.productName || "--",
+ planQty: Number(item.plannedQuantity || 0),
+ deliveryDate: formatDueDate(item.dueDate),
+ status: Number(item.status || 0),
+ statusLabel: item.statusLabel || "",
+});
+
+const refreshProductionOverview = async () => {
+ try {
+ const res = await productionOverview();
+ const data = res?.data || {};
+ productionOverviewData.value = {
+ totalOutput: Number(data.totalOutput || 0),
+ totalScrap: Number(data.totalScrap || 0),
+ yieldRate: Number(data.yieldRate || 0),
+ };
+ } catch {
+ productionOverviewData.value = {
+ totalOutput: 0,
+ totalScrap: 0,
+ yieldRate: 0,
+ };
+ }
+};
+
+const refreshProductionRealtimeBoard = async () => {
+ try {
+ const res = await productionRealtimeBoard();
+ const data = res?.data || {};
+ realtimeBoardData.value = {
+ deviceOee: {
+ value: Number(data.deviceOee?.value || 0),
+ compareYesterday: Number(data.deviceOee?.compareYesterday || 0),
+ },
+ orderAchievementRate: {
+ value: Number(data.orderAchievementRate?.value || 0),
+ compareYesterday: Number(data.orderAchievementRate?.compareYesterday || 0),
+ },
+ defectRate: {
+ value: Number(data.defectRate?.value || 0),
+ compareYesterday: Number(data.defectRate?.compareYesterday || 0),
+ },
+ };
+ } catch {
+ realtimeBoardData.value = {
+ deviceOee: { value: 0, compareYesterday: 0 },
+ orderAchievementRate: { value: 0, compareYesterday: 0 },
+ defectRate: { value: 0, compareYesterday: 0 },
+ };
+ }
+};
+
+const refreshProductionOrderProgress = async () => {
+ try {
+ const res = await productionOrderProgress({
+ tab: orderFilter.value,
+ pageNum: 1,
+ pageSize: 10,
+ });
+ const data = res?.data || {};
+ orderProgressMeta.value = {
+ tab: data.tab || orderFilter.value,
+ total: Number(data.total || 0),
+ pageNum: Number(data.pageNum || 1),
+ pageSize: Number(data.pageSize || 10),
+ inProgressCount: Number(data.inProgressCount || 0),
+ completedCount: Number(data.completedCount || 0),
+ pausedCount: Number(data.pausedCount || 0),
+ };
+ productionOrders.value = (data.records || []).map(mapOrderProgressRecord);
+ } catch {
+ orderProgressMeta.value = {
+ tab: orderFilter.value,
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ inProgressCount: 0,
+ completedCount: 0,
+ pausedCount: 0,
+ };
+ productionOrders.value = [];
+ }
+};
+
+const refreshTodayProductionPlan = async () => {
+ try {
+ const res = await todayProductionPlan({ limit: 4 });
+ const data = res?.data || {};
+ todayPlanTotal.value = Number(data.total || 0);
+ todayPlanList.value = (data.records || []).map(mapTodayPlanRecord);
+ } catch {
+ todayPlanTotal.value = 0;
+ todayPlanList.value = [];
+ }
};
const getBusinessData = async () => {
@@ -1238,11 +1350,20 @@
router.push(path).catch(() => {});
};
+watch(orderFilter, () => {
+ if (visiblePanels.value.order) {
+ refreshProductionOrderProgress();
+ }
+});
+
onMounted(() => {
updateNowTime();
clockTimer = setInterval(updateNowTime, 1000);
if (dashboardCards.value.length > 0) {
getBusinessData();
+ }
+ if (visibleModules.value.production) {
+ refreshProductionOverview();
}
if (visiblePanels.value.contract) {
analysisCustomer();
@@ -1260,6 +1381,15 @@
if (visiblePanels.value.process) {
getProcessList();
refreshProcessStats();
+ }
+ if (visiblePanels.value.order) {
+ refreshProductionOrderProgress();
+ }
+ if (visiblePanels.value.realtime) {
+ refreshProductionRealtimeBoard();
+ }
+ if (visiblePanels.value.plan) {
+ refreshTodayProductionPlan();
}
});
@@ -1280,7 +1410,7 @@
flex-direction: column;
gap: 16px;
overflow-x: clip;
- margin-top: 10px;
+ margin-top: 10px;
}
.digital-number {
@@ -1305,8 +1435,8 @@
min-height: 92px;
padding: 18px 22px;
background:
- radial-gradient(circle at 8% 20%, rgba(59, 130, 246, 0.12), transparent 32%),
- linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.88));
+ radial-gradient(circle at 8% 20%, rgba(59, 130, 246, 0.12), transparent 32%),
+ linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.88));
}
.welcome-user {
@@ -1522,7 +1652,7 @@
z-index: 1;
pointer-events: none;
background:
- url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 40' preserveAspectRatio='none'%3E%3Cpath d='M0 31C20 16 44 36 66 24C87 12 107 31 129 18C148 8 169 28 193 16C214 5 237 25 259 14C280 3 306 19 340 8' fill='none' stroke='%236ea4ee' stroke-width='1.5'/%3E%3C/svg%3E")
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 40' preserveAspectRatio='none'%3E%3Cpath d='M0 31C20 16 44 36 66 24C87 12 107 31 129 18C148 8 169 28 193 16C214 5 237 25 259 14C280 3 306 19 340 8' fill='none' stroke='%236ea4ee' stroke-width='1.5'/%3E%3C/svg%3E")
center / 100% 100% no-repeat;
}
@@ -1658,21 +1788,21 @@
border: 1px solid rgba(148, 163, 184, 0.24);
border-radius: 14px;
background:
- linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 255, 0.9)),
- repeating-linear-gradient(
- to right,
- rgba(148, 163, 184, 0.07) 0,
- rgba(148, 163, 184, 0.07) 1px,
- transparent 1px,
- transparent 48px
- ),
- repeating-linear-gradient(
- to bottom,
- rgba(148, 163, 184, 0.06) 0,
- rgba(148, 163, 184, 0.06) 1px,
- transparent 1px,
- transparent 34px
- );
+ linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 255, 0.9)),
+ repeating-linear-gradient(
+ to right,
+ rgba(148, 163, 184, 0.07) 0,
+ rgba(148, 163, 184, 0.07) 1px,
+ transparent 1px,
+ transparent 48px
+ ),
+ repeating-linear-gradient(
+ to bottom,
+ rgba(148, 163, 184, 0.06) 0,
+ rgba(148, 163, 184, 0.06) 1px,
+ transparent 1px,
+ transparent 34px
+ );
overflow: hidden;
padding: 10px;
}
@@ -1953,6 +2083,10 @@
color: #f59e0b;
}
+.realtime-delta.flat {
+ color: #64748b;
+}
+
.warning-list {
margin-top: 10px;
display: flex;
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 43425c6..1ef5b9d 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -61,7 +61,9 @@
import EditProcess from "@/views/productionManagement/processRoute/Edit.vue";
import RouteItemForm from "@/views/productionManagement/processRoute/ItemsForm.vue";
import { listPage, del } from "@/api/productionManagement/processRoute.js";
- const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+ const FileList = defineAsyncComponent(() =>
+ import("@/components/Dialog/FileList.vue")
+ );
import { useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 92a2fa1..3c52410 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -47,16 +47,45 @@
<span class="info-value">{{ routeInfo.quantity || '-' }}</span>
</div>
</div>
- <div class="info-item full-width"
- v-if="routeInfo.description">
+ <div class="info-item">
<div class="info-label-wrapper">
- <span class="info-label">鎻忚堪</span>
+ <span class="info-label">澶囨敞</span>
</div>
<div class="info-value-wrapper">
<span class="info-value">{{ routeInfo.description }}</span>
</div>
</div>
</div>
+ </el-card>
+ <!-- 闄勪欢妯″潡 -->
+ <div v-if="pageType === 'order'"
+ class="section-header">
+ <div class="section-title">闄勪欢</div>
+ </div>
+ <el-card v-if="pageType === 'order'"
+ class="attachment-card"
+ shadow="hover"
+ style="margin-top: 10px; margin-bottom: 20px;">
+ <el-table :data="attachmentTableData"
+ border
+ class="attachment-table">
+ <el-table-column label="闄勪欢鍚嶇О"
+ prop="originalFilename"
+ show-overflow-tooltip />
+ <el-table-column fixed="right"
+ label="鎿嶄綔"
+ width="200"
+ align="center">
+ <template #default="scope">
+ <el-button link
+ type="primary"
+ size="small"
+ @click="downloadAttachmentFile(scope.row.downloadURL)">
+ 涓嬭浇
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
</el-card>
<!-- 琛ㄦ牸瑙嗗浘 -->
<div v-if="viewMode === 'table'"
@@ -382,6 +411,18 @@
v-model="bomDataValue.showProductDialog"
:single="true"
@confirm="handleBomProduct" />
+ <!-- 涓婁紶缁勪欢寮圭獥 -->
+ <el-dialog v-model="uploadDialogVisible"
+ title="涓婁紶闄勪欢"
+ width="50%"
+ @close="closeAttachmentUpload">
+ <AttachmentUpload v-model:file-list="newFileList" />
+ <template #footer>
+ <el-button @click="saveAttachmentUpload"
+ type="primary">淇濆瓨</el-button>
+ <el-button @click="closeAttachmentUpload">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
<!-- 鏂板/缂栬緫寮圭獥 -->
<el-dialog v-model="dialogVisible"
:title="operationType === 'add' ? '鏂板宸ヨ壓璺嚎椤圭洰' : '缂栬緫宸ヨ壓璺嚎椤圭洰'"
@@ -518,6 +559,12 @@
queryList2,
add2,
} from "@/api/productionManagement/productStructure.js";
+ import AttachmentUpload from "@/components/AttachmentUpload/file/index.vue";
+ import {
+ attachmentList,
+ deleteAttachment,
+ createAttachment,
+ } from "@/api/basicData/storageAttachment.js";
import { useRoute } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus";
@@ -530,6 +577,7 @@
const orderId = computed(() => route.query.orderId);
const pageType = computed(() => route.query.type);
const editable = computed(() => route.query.editable !== "false");
+ const technologyRoutingId = computed(() => route.query.technologyRoutingId);
const tableLoading = ref(false);
const tableData = ref([]);
@@ -548,7 +596,66 @@
bomNo: "",
description: "",
quantity: 0,
+ technologyRoutingId: "",
});
+
+ // 闄勪欢鐩稿叧
+ const attachmentTableData = ref([]);
+ const uploadDialogVisible = ref(false);
+ const newFileList = ref([]);
+
+ const getAttachmentList = () => {
+ if (!technologyRoutingId.value) return;
+ attachmentList({
+ recordType: "technology_routing",
+ recordId: technologyRoutingId.value,
+ }).then(res => {
+ attachmentTableData.value = (res && res.data) || [];
+ });
+ };
+
+ const handleUploadAttachment = () => {
+ uploadDialogVisible.value = true;
+ };
+
+ const saveAttachmentUpload = async () => {
+ if (newFileList.value.length > 0) {
+ createAttachment({
+ application: "file",
+ recordType: "technology_routing",
+ recordId: technologyRoutingId.value,
+ storageBlobDTOs: [...newFileList.value, ...attachmentTableData.value],
+ })
+ .then(res => {
+ if (res && res.code === 200) {
+ proxy?.$modal?.msgSuccess("涓婁紶鎴愬姛");
+ newFileList.value = [];
+ getAttachmentList();
+ }
+ })
+ .finally(() => {
+ uploadDialogVisible.value = false;
+ });
+ }
+ };
+
+ const closeAttachmentUpload = () => {
+ newFileList.value = [];
+ uploadDialogVisible.value = false;
+ };
+
+ const handleDeleteAttachment = async row => {
+ deleteAttachment([row.storageAttachmentId]).then(res => {
+ if (res && res.code === 200) {
+ proxy?.$modal?.msgSuccess("鍒犻櫎鎴愬姛");
+ getAttachmentList();
+ }
+ });
+ };
+
+ const downloadAttachmentFile = url => {
+ window.open(url, "_blank");
+ };
const processOptions = ref([]);
const showProductSelectDialog = ref(false);
@@ -680,6 +787,7 @@
bomId: route.query.bomId || "",
description: route.query.description || "",
quantity: route.query.quantity || 0,
+ technologyRoutingId: route.query.technologyRoutingId || "",
status: !(route.query.status == 1 || route.query.status === "false"),
};
bomTableData.value[0].productName = routeInfo.value.productName;
@@ -1165,16 +1273,20 @@
const handleBomProcessChange = (row, value) => {
row.processId = value || "";
syncProcessOperationFields(row);
-
- // 鍚屼竴灞傜骇鍙兘閫変竴鏍风殑宸ュ簭
+
+ // 妫�鏌ュ悓涓�灞傜骇鏄惁宸茬粡鏈夊叾浠栦笉鍚岀殑宸ュ簭琚�変腑
const siblings = findSiblings(bomDataValue.value.dataList, row.tempId);
if (siblings && value) {
- siblings.forEach(sibling => {
- if (sibling.tempId !== row.tempId) {
- sibling.processId = value;
- syncProcessOperationFields(sibling);
- }
+ const hasDifferentProcess = siblings.some(sibling => {
+ return (
+ sibling.tempId !== row.tempId &&
+ sibling.processId &&
+ sibling.processId !== value
+ );
});
+ if (hasDifferentProcess) {
+ ElMessage.warning("鍚屼竴灞傜骇宸插瓨鍦ㄤ笉鍚岀殑宸ュ簭锛岃鍏堢粺涓�宸ュ簭鍚庡啀杩涜淇敼");
+ }
}
};
@@ -1391,9 +1503,36 @@
}
};
+ // 鏍¢獙鍚屼竴灞傜骇鐨勫伐搴忔槸鍚︿竴鑷�
+ const validateProcessConsistency = items => {
+ if (!items || items.length === 0) return;
+
+ // 妫�鏌ュ綋鍓嶅眰绾�
+ const processes = items
+ .filter(item => item.processId)
+ .map(item => item.processId);
+ if (processes.length > 1) {
+ const uniqueProcesses = [...new Set(processes)];
+ if (uniqueProcesses.length > 1) {
+ ElMessage.error("鍚屼竴灞傜骇鐨勫伐搴忓繀椤讳竴鑷�");
+ isValid = false;
+ return;
+ }
+ }
+
+ // 閫掑綊妫�鏌ュ瓙绾�
+ items.forEach(item => {
+ if (item.children && item.children.length > 0) {
+ validateProcessConsistency(item.children);
+ }
+ });
+ };
+
bomDataValue.value.dataList.forEach(item => {
validateItem(item, true);
});
+
+ validateProcessConsistency(bomDataValue.value.dataList);
return isValid;
};
@@ -1449,6 +1588,9 @@
getList();
getProcessList();
fetchBomData();
+ if (pageType.value === "order") {
+ getAttachmentList();
+ }
};
onMounted(() => {
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 76c67dc..5cb08e8 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -336,15 +336,15 @@
row.processId = value || "";
syncProcessOperationFields(row);
- // 鍚屼竴灞傜骇鍙兘閫変竴鏍风殑宸ュ簭
+ // 妫�鏌ュ悓涓�灞傜骇鏄惁宸茬粡鏈夊叾浠栦笉鍚岀殑宸ュ簭琚�変腑
const siblings = findSiblings(dataValue.dataList, row.tempId);
if (siblings && value) {
- siblings.forEach(sibling => {
- if (sibling.tempId !== row.tempId) {
- sibling.processId = value;
- syncProcessOperationFields(sibling);
- }
+ const hasDifferentProcess = siblings.some(sibling => {
+ return sibling.tempId !== row.tempId && sibling.processId && sibling.processId !== value;
});
+ if (hasDifferentProcess) {
+ ElMessage.warning("鍚屼竴灞傜骇宸插瓨鍦ㄤ笉鍚岀殑宸ュ簭锛岃鍏堢粺涓�宸ュ簭鍚庡啀杩涜淇敼");
+ }
}
};
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 90ca51d..9c7682b 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -723,6 +723,7 @@
bomNo: row.bomNo || "",
description: data.description || "",
quantity: row.quantity || 0,
+ technologyRoutingId: data.technologyRoutingId,
orderId,
type: "order",
editable: !row.endOrder,
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index a4ebbdf..904979c 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -284,10 +284,15 @@
<el-col :span="12">
<el-form-item label="閿�鍞悎鍚屽彿锛�"
prop="salesContractNo">
- <el-input v-model="form.salesContractNo"
- placeholder="鑷姩鐢熸垚"
- clearable
- disabled />
+ <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
+ <el-checkbox v-model="form.autoGenerateContractNo" v-if="operationType === 'add'">鑷姩鐢熸垚
+ </el-checkbox>
+ <el-input v-model="form.salesContractNo"
+ :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
+ clearable
+ :disabled="form.autoGenerateContractNo" />
+
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -1069,6 +1074,7 @@
},
form: {
salesContractNo: "",
+ autoGenerateContractNo: true,
salesman: "",
customerId: "",
entryPerson: "",
@@ -1587,6 +1593,8 @@
form.value.entryDate = getCurrentDate();
// 绛捐鏃ユ湡榛樿涓哄綋澶�
form.value.executionDate = getCurrentDate();
+ // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+ form.value.autoGenerateContractNo = true;
} else {
currentId.value = row.id;
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -1594,6 +1602,8 @@
form.value.entryPerson = Number(res.entryPerson);
productData.value = form.value.productData;
fileList.value = form.value.storageBlobVOs;
+ // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+ form.value.autoGenerateContractNo = false;
});
}
// let userAll = await userStore.getInfo()
@@ -1730,6 +1740,9 @@
}
form.value.storageBlobDTOs = fileList;
form.value.type = 1;
+ if (form.value.autoGenerateContractNo) {
+ form.value.salesContractNo = '';
+ }
addOrUpdateSalesLedger(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -3007,4 +3020,4 @@
page-break-after: avoid;
}
}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.3