From 919177aceb22d6cca9c176a46c299d099a0ba0af Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 12 五月 2026 17:46:09 +0800
Subject: [PATCH] 分派生产单到班组长,班组长:排产工单到班组成员
---
src/api/productionManagement/workOrder.js | 11 +
src/views/productionManagement/productionOrder/index.vue | 9 +
src/views/productionPlan/productionPlan/index.vue | 73 +++++++++--
src/api/productionManagement/productionTeamUserRel.js | 20 +++
src/views/productionManagement/workOrderEdit/index.vue | 193 +++++++++++++++++++++++++++++++
src/api/productionManagement/productionTeam.js | 15 +-
6 files changed, 296 insertions(+), 25 deletions(-)
diff --git a/src/api/productionManagement/productionTeam.js b/src/api/productionManagement/productionTeam.js
index 3dd0947..e913a7d 100644
--- a/src/api/productionManagement/productionTeam.js
+++ b/src/api/productionManagement/productionTeam.js
@@ -3,7 +3,7 @@
// 鍒涘缓鐝粍
export function createTeam(data) {
return request({
- url: "/production_team",
+ url: "/productionTeam",
method: "post",
data: data,
});
@@ -12,7 +12,7 @@
// 鏇存柊鐝粍
export function updateTeam(data) {
return request({
- url: "/production_team",
+ url: "/productionTeam",
method: "put",
data: data,
});
@@ -21,7 +21,7 @@
// 鍒犻櫎鐝粍
export function deleteTeam(id) {
return request({
- url: "/production_team/" + id,
+ url: "/productionTeam/" + id,
method: "delete",
});
}
@@ -29,7 +29,7 @@
// 鏌ヨ鐝粍璇︽儏
export function getTeamDetail(id) {
return request({
- url: "/production_team/" + id,
+ url: "/productionTeam/" + id,
method: "get",
});
}
@@ -37,7 +37,7 @@
// 鏌ヨ鐝粍鍒楄〃
export function getTeamList(query) {
return request({
- url: "/production_team/list",
+ url: "/productionTeam/list",
method: "get",
params: query,
});
@@ -46,8 +46,11 @@
// 鍒嗛〉鏌ヨ鐝粍鍒楄〃
export function getTeamListPage(query) {
return request({
- url: "/production_team/listPage",
+ url: "/productionTeam/listPage",
method: "get",
params: query,
});
}
+
+
+
diff --git a/src/api/productionManagement/productionTeamUserRel.js b/src/api/productionManagement/productionTeamUserRel.js
new file mode 100644
index 0000000..e9904b6
--- /dev/null
+++ b/src/api/productionManagement/productionTeamUserRel.js
@@ -0,0 +1,20 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鐝粍闀垮垪琛�
+export function getTeamLeaderList(query) {
+ return request({
+ url: "/productionTeamUserRel/leaderList",
+ method: "get",
+ params: query,
+ });
+}
+
+export function getTeamMemberListByTeamLeader(query) {
+ return request({
+ url: "/productionTeamUserRel/memberListByLeader",
+ method: "get",
+ params: query,
+ });
+}
+
+
diff --git a/src/api/productionManagement/workOrder.js b/src/api/productionManagement/workOrder.js
index b3050c9..d5b37f5 100644
--- a/src/api/productionManagement/workOrder.js
+++ b/src/api/productionManagement/workOrder.js
@@ -32,6 +32,17 @@
});
}
+// 宸ュ崟-鎸囧畾鐝粍鍥㈤槦鎴愬憳
+export function assignTeamUser(data) {
+ return request({
+ url: "/productionOperationTask/assignTeamUser",
+ method: "post",
+ data: data,
+ });
+}
+
+
+
// 涓嬭浇宸ュ崟娴佽浆鍗★紙杩斿洖鏂囦欢娴侊級
export function downProductWorkOrder(id) {
return request({
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 90ca51d..234d012 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -226,6 +226,7 @@
import { ElMessageBox } from "element-plus";
import dayjs from "dayjs";
import { useRouter } from "vue-router";
+ import useUserStore from '@/store/modules/user'
import {
productOrderListPage,
listProcessRoute,
@@ -253,6 +254,7 @@
const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
const router = useRouter();
const isShowNewModal = ref(false);
const sourceDataDialogVisible = ref(false);
@@ -361,6 +363,11 @@
width: 120,
},
{
+ label: "鐝粍闀�",
+ prop: "teamLeaderUserName",
+ width: "120px",
+ },
+ {
dataType: "action",
label: "鎿嶄綔",
align: "center",
@@ -402,7 +409,7 @@
name: "棰嗘枡",
type: "text",
color: "#5EC7AB",
- showHide: row => !row.endOrder && !row.returned,
+ showHide: row => !row.endOrder && !row.returned && userStore.id === row.teamLeaderUserId,
clickFun: row => {
openMaterialDialog(row);
},
diff --git a/src/views/productionManagement/workOrderEdit/index.vue b/src/views/productionManagement/workOrderEdit/index.vue
index 64fd087..03bdb46 100644
--- a/src/views/productionManagement/workOrderEdit/index.vue
+++ b/src/views/productionManagement/workOrderEdit/index.vue
@@ -117,6 +117,45 @@
</span>
</template>
</el-dialog>
+ <!-- 鎸囧畾鐝粍鎴愬憳寮圭獥锛堝崟閫夛級 -->
+ <el-dialog v-model="assignTeamUserDialogVisible"
+ title="鎸囧畾鐝粍鎴愬憳"
+ width="800px">
+ <div class="assign-team-user-content">
+ <div class="selected-info-box"
+ v-if="selectedTeamUserId">
+ <div class="info-label">宸查�夋嫨锛�</div>
+ <div class="info-value">{{ getTeamUserNameById(selectedTeamUserId) }}</div>
+ </div>
+ <div class="team-user-list-container"
+ v-loading="teamUserTableLoading">
+ <el-radio-group v-model="selectedTeamUserId">
+ <div class="team-user-grid">
+ <div v-for="item in teamUserTableData"
+ :key="item.userId"
+ class="team-user-item">
+ <el-radio :label="item.userId">
+ <div class="team-user-info">
+ <span class="name">{{ item.nickName }}</span>
+ </div>
+ </el-radio>
+ </div>
+ </div>
+ </el-radio-group>
+ <div v-if="teamUserTableData.length === 0"
+ class="empty-text">
+ 鏆傛棤鍖归厤浜哄憳
+ </div>
+ </div>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary"
+ @click="handleSaveTeamUser">纭畾</el-button>
+ <el-button @click="assignTeamUserDialogVisible = false">鍙栨秷</el-button>
+ </span>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -126,9 +165,10 @@
import {
productWorkOrderPage,
updateProductWorkOrder,
- assignProductWorkOrder,
+ assignProductWorkOrder, assignTeamUser,
} from "@/api/productionManagement/workOrder.js";
import { listUser } from "@/api/system/user.js";
+ import {getTeamMemberListByTeamLeader} from "@/api/productionManagement/productionTeamUserRel.js";
const { proxy } = getCurrentInstance();
@@ -209,6 +249,11 @@
width: "180",
},
{
+ label: "鎸囧畾鐝粍鎴愬憳",
+ prop: "teamUserName",
+ width: "180",
+ },
+ {
label: "鎿嶄綔",
width: "200",
align: "center",
@@ -225,6 +270,12 @@
name: "鎸囧畾鎶ュ伐浜�",
clickFun: row => {
handleAssignReporter(row);
+ },
+ },
+ {
+ name: "鎸囧畾鐝粍鎴愬憳",
+ clickFun: row => {
+ handleAssignTeamUser(row);
},
},
],
@@ -341,6 +392,32 @@
getEmployeeList();
};
+ // 鎸囧畾鐝粍鎴愬憳鐩稿叧
+ const assignTeamUserDialogVisible = ref(false);
+ const teamUserTableLoading = ref(false);
+ const teamUserTableData = ref([]);
+ const teamUserPage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+
+ const currentTeamUser = ref(null);
+ const selectedTeamUserId = ref(null);
+
+ const handleAssignTeamUser = row => {
+ currentTeamUser.value = row;
+ assignTeamUserDialogVisible.value = true;
+ // 鍥炴樉宸查�夋嫨鐨勪汉鍛橈紙鍗曢�夛級
+ if (row.teamUserId) {
+ selectedTeamUserId.value = row.teamUserId;
+ } else {
+ selectedTeamUserId.value = null;
+ }
+ getTeamUserList(row.leaderUserId);
+ };
+
+
const getEmployeeList = () => {
employeeTableLoading.value = true;
const params = {
@@ -385,6 +462,45 @@
.then(() => {
proxy.$modal.msgSuccess("鎸囧畾鎴愬姛");
assignReporterDialogVisible.value = false;
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鎸囧畾澶辫触");
+ });
+ };
+
+ const getTeamUserList = (leaderUserId) => {
+ teamUserTableLoading.value = true;
+ getTeamMemberListByTeamLeader({leaderUserId: leaderUserId})
+ .then(res => {
+ teamUserTableLoading.value = false;
+ teamUserTableData.value = res.data;
+ })
+ .catch(() => {
+ teamUserTableLoading.value = false;
+ });
+ };
+
+ const getTeamUserNameById = id => {
+ const user = teamUserTableData.value.find(item => item.userId === id);
+ return user ? user.nickName : id;
+ };
+
+ const handleSaveTeamUser = () => {
+ if (!selectedTeamUserId.value) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鐝粍鎴愬憳");
+ return;
+ }
+
+ const updateData = {
+ id: currentTeamUser.value.id,
+ teamUserId: selectedTeamUserId.value,
+ };
+
+ assignTeamUser(updateData)
+ .then(() => {
+ proxy.$modal.msgSuccess("鎸囧畾鎴愬姛");
+ assignTeamUserDialogVisible.value = false;
getList();
})
.catch(() => {
@@ -493,4 +609,77 @@
}
}
}
-</style>
+
+ .assign-team-user-content {
+ .selected-info-box {
+ margin-bottom: 16px;
+ padding: 12px;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+
+ .info-label {
+ font-size: 14px;
+ color: #606266;
+ margin-right: 8px;
+ }
+
+ .info-value {
+ font-size: 14px;
+ color: #303133;
+ font-weight: bold;
+ }
+ }
+
+ .team-user-list-container {
+ max-height: 400px;
+ overflow-y: auto;
+ padding: 10px;
+ border: 1px solid #f0f0f0;
+ border-radius: 4px;
+
+ .team-user-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
+ gap: 12px;
+ }
+
+ .team-user-item {
+ :deep(.el-radio) {
+ width: 100%;
+ margin-right: 0;
+ height: auto;
+ padding: 8px;
+
+ .el-radio__label {
+ width: 100%;
+ }
+ }
+
+ .team-user-info {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+
+ .name {
+ font-weight: bold;
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .dept {
+ font-size: 12px;
+ color: #909399;
+ }
+ }
+ }
+
+ .empty-text {
+ text-align: center;
+ color: #909399;
+ padding: 20px;
+ }
+ }
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 01a513b..ae087f4 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -111,6 +111,7 @@
title="鍚堝苟涓嬪彂"
width="600px">
<el-form :model="mergeForm"
+ ref="mergeFormRef"
label-width="120px">
<el-row :gutter="20">
<el-col :span="10">
@@ -138,6 +139,29 @@
:max="sumAssignedQuantity"
@change="onBlur"
style="width: 100%" />
+ </el-form-item>
+
+ <el-form-item
+ prop="leaderId"
+ label="鐝粍闀�"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨鐝粍闀�',
+ trigger: 'change',
+ }
+ ]"
+ >
+ <el-select v-model="mergeForm.leaderId"
+ placeholder="璇烽�夋嫨"
+ filterable
+ @focus="fetchTeamLeaderOptions"
+ style="width: 100%">
+ <el-option v-for="item in teamLeaderOptions"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
</el-form-item>
</el-form>
<template #footer>
@@ -269,8 +293,10 @@
exportProductionPlan,
} from "@/api/productionPlan/productionPlan.js";
import { productTreeList, modelListPage } from "@/api/basicData/product.js";
+ import { getTeamLeaderList } from "@/api/productionManagement/productionTeamUserRel.js";
import PIMTable from "./components/PIMTable.vue";
import ImportDialog from "@/components/Dialog/ImportDialog.vue";
+ import {afterSalesServiceDispose} from "@/api/customerService/index.js";
const { proxy } = getCurrentInstance();
const router = useRouter();
@@ -473,7 +499,18 @@
totalAssignedQuantity: 0,
planCompleteTime: "",
productId: "",
+ leaderId: "",
});
+
+ // 鐝粍闀垮垪琛�
+ const teamLeaderOptions = ref([]);
+
+ // 鏌ヨ鐝粍闀垮垪琛�
+ const fetchTeamLeaderOptions = () => {
+ return getTeamLeaderList().then(res => {
+ teamLeaderOptions.value = res.data || [];
+ });
+ };
// 瀵煎叆鐩稿叧
const importDialogRef = ref(null);
@@ -778,22 +815,26 @@
const payload = {
...mergeForm,
};
- productionPlanCombine(payload)
- .then(res => {
- if (res.code === 200) {
- ElMessage.success("涓嬪彂鎴愬姛");
- getList();
- isShowNewModal.value = false;
- // 鍙互閫夋嫨鍒锋柊鍒楄〃鎴栧叾浠栨搷浣�
- getList();
- } else {
- ElMessage.error(res.message || "涓嬪彂澶辫触");
- }
- })
- .catch(err => {
- console.error("鍚堝苟涓嬪彂寮傚父锛�", err);
- ElMessage.error("绯荤粺寮傚父锛屽悎骞朵笅鍙戝け璐�");
- });
+ proxy.$refs["mergeFormRef"].validate(valid => {
+ if (!valid) return;
+ productionPlanCombine(payload)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("涓嬪彂鎴愬姛");
+ getList();
+ isShowNewModal.value = false;
+ // 鍙互閫夋嫨鍒锋柊鍒楄〃鎴栧叾浠栨搷浣�
+ getList();
+ } else {
+ ElMessage.error(res.message || "涓嬪彂澶辫触");
+ }
+ })
+ .catch(err => {
+ console.error("鍚堝苟涓嬪彂寮傚父锛�", err);
+ ElMessage.error("绯荤粺寮傚父锛屽悎骞朵笅鍙戝け璐�");
+ });
+ })
+
// 鍙互閫夋嫨鍒锋柊鍒楄〃鎴栧叾浠栨搷浣�
};
--
Gitblit v1.9.3