From f0420251442ac6f7bfb6beafa37ad045b4f6478a Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 31 十二月 2025 15:49:05 +0800
Subject: [PATCH] 报工多工序,用户多工序修改
---
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue | 87 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 76 insertions(+), 11 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
index 929ad0f..308c20d 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -67,6 +67,8 @@
customerName: '',
//椤圭洰鍚嶇О
project: '',
+ //鎵规
+ batch:'',
},
flowCard: {
//鍙姤宸ユ暟閲�
@@ -477,9 +479,11 @@
if (val<row.completedQuantityComputed){
//搴撳瓨鏁伴噺銆佸凡鍏ュ簱鏁伴噺
if (val>(row.inventory_quantity-row.received_quantity)){
- return new Error(`val
+ if (totalQuantity-val>(row.inventory_quantity-row.received_quantity)){
+ return new Error(`val
<=
${row.inventory_quantity-row.received_quantity}`)
+ }
}else {
if (val < (row.inventory_quantity-row.received_quantity)){
//瀹屽伐鎬绘暟銆佹湰娆″畬宸ユ暟銆佸凡鍏ュ簱鏁伴噺
@@ -621,7 +625,7 @@
}
}
},
- cellDblclick (params) {//琛ㄦ牸鍐呭鍙屽嚮鎵撳紑浜у搧鐣岄潰
+ cellDblclick (params) {//琛ㄦ牸鍐呭鍙屽嚮鎵撳紑娆$牬鐣岄潰
const { row } = params
brokenRow.value = row
if(brokenRow.value.damageDetails=== undefined){
@@ -899,7 +903,13 @@
}
}
}
-const openedBrokenTable = () => {
+
+const brokenGridKey = ref(0)
+const openedBrokenTable = async () => {
+ brokenGridKey.value++
+ await nextTick()
+ console.log('breakageType:', titleSelectJson.value.breakageType)
+ console.log('breakageReason:', titleSelectJson.value.breakageReason)
//addListener(brokenGrid.value,brokenGridOptions)
let damage =ref(brokenRow.value.damageDetails)
brokenGrid.value.reloadData(damage.value)
@@ -956,7 +966,28 @@
done()
}
+const parseProcessData = (rawData) => {
+ if (!rawData) return [] // 绌哄�艰繑鍥炵┖鏁扮粍
+ // 姝ラ1锛氬厛杞负瀛楃涓插苟鍘婚櫎棣栧熬澶氫綑鐨勫紩鍙凤紙澶勭悊鍚庣杩斿洖鐨� "\"[\"纾ㄨ竟\",\"鎵撳瓟\"]\"" 鎯呭喌锛�
+ let str = String(rawData).trim()
+ if (str.startsWith('"') && str.endsWith('"')) {
+ str = str.slice(1, -1) // 鍘绘帀棣栧熬鐨勫紩鍙�
+ }
+
+ // 姝ラ2锛氳В鏋怞SON瀛楃涓蹭负鏁扮粍
+ try {
+ const arr = JSON.parse(str)
+ // 纭繚瑙f瀽鍚庢槸鏁扮粍锛屼笖鍏冪礌鍘荤┖鏍�
+ return Array.isArray(arr) ? arr.map(item => item.trim()) : []
+ } catch (e) {
+ // 瑙f瀽澶辫触鏃讹紝闄嶇骇澶勭悊锛堟寜閫楀彿鍒嗗壊锛�
+ console.warn('宸ュ簭鏁版嵁瑙f瀽澶辫触锛岄檷绾у鐞嗭細', e)
+ return str.split(',').filter(item => item.trim())
+ }
+}
+
+const currentProcessOptions = ref([])
//绗竴娆″姞杞芥暟鎹�
let groupChangeProcess = ref(false)//鐢ㄤ簬鏈彮缁勬樉绀洪棶棰�
const initTiltle = async () => {
@@ -965,20 +996,47 @@
if (res.code == 200) {
titleSelectJson.value.processType = res.data.process
processName = res.data.processNameList
+
if(user.user.address!==null && user.user.address!==''){
- titleUploadData.value.thisProcess = user.user.address
+ user.user.address=parseProcessData(user.user.address)
+ titleUploadData.value.thisProcess = user.user.address[0] // 鏁扮粍鍙栫涓�涓綔涓洪粯璁ゅ�硷紙鍙�夛級
titleUploadData.value.teamsGroupsName = user.user.userName
- groupChangeProcess.value = true
+ currentProcessOptions.value = user.user.address.map((name, index) => ({
+ id: `user_process_${index}`,
+ basic_name: name,
+ basic_type: 'process',
+ basic_category: index + 1
+ }));
+
if (user.user.address==='鎶�鏈儴澶氭洸' || user.user.address==='澶硅兌'){
groupChangeProcess.value = false
+ currentProcessOptions.value = titleSelectJson.value.processType
}
gridOptions.toolbarConfig.buttons[1].visible=false
+ }else {
+ currentProcessOptions.value = titleSelectJson.value.processType // 鏃犻粯璁ゅ�兼樉绀哄叏閮�
}
} else {
ElMessage.warning(res.msg)
}
})
+}
+
+const filterCurrentProcessOptions = () => {
+ // ======== 鏍稿績淇敼寮�濮� ========
+ const userBelongProcess = user.user.address || [];
+ // 濮嬬粓鍙樉绀哄憳宸ユ墍灞炲伐搴忥紙鏈夊�硷級鎴栧叏閮ㄥ伐搴忥紙鏃犲�硷級
+ if (userBelongProcess.length > 0) {
+ currentProcessOptions.value = user.user.address.map((name, index) => ({
+ id: `user_process_${index}`,
+ basic_name: name,
+ basic_type: 'process',
+ basic_category: index + 1
+ }));
+ } else {
+ currentProcessOptions.value = titleSelectJson.value.processType;
+ }
}
@@ -1293,6 +1351,10 @@
titleUploadData.value.processId = processId
titleUploadData.value.teamsGroupsName = user.user.userName
titleUploadData.value.laminating = res.data.laminating
+ if(titleUploadData.value.order.batch!=null&&titleUploadData.value.order.batch!=""){
+ titleUploadData.value.order.project=titleUploadData.value.order.project+'('+titleUploadData.value.order.batch+')'
+ }
+
//璁惧涓嬫媺妗�
titleSelectJson.value.deviceType = res.data.device
//鐝粍涓嬫媺妗�
@@ -1344,6 +1406,9 @@
});
detail.value = modifiedCollection
xGrid.value.reloadData(detail.value)
+
+ filterCurrentProcessOptions()
+
hideButton()
// nextTick(() => {
// hiddenCompletedOk()
@@ -1676,7 +1741,7 @@
style="width: 120px"
@change="getWork();getQuantity()">
<el-option
- v-for="item in titleSelectJson['processType']"
+ v-for="item in currentProcessOptions"
:key="item.id"
:label="item.basic_name"
:value="item.basic_name"
@@ -1730,10 +1795,10 @@
<el-text>{{$t('processCard.customerName')}}锛�</el-text>
</el-col>
<el-col :span="3">
- <el-text class="customClass"></el-text>
+ <el-text class="customClass">{{ titleUploadData.order.customerName }}</el-text>
</el-col>
<el-col :span="2">
- <el-text >{{$t('order.project')}}锛�</el-text>
+ <el-text >{{$t('order.project')}}({{$t('order.batch')}})锛�</el-text>
</el-col>
<el-col :span="3">
<el-input :readonly="true" v-model="titleUploadData.order.project"/>
@@ -1890,7 +1955,7 @@
+brokenRow.glass_child+'.'+brokenRow.order_number+'.'+brokenRow.technology_number"
style="width: 80%;height:75% ">
<vxe-grid
-
+ :key="brokenGridKey"
height="400px"
ref="brokenGrid"
class="mytable-scrollbar"
@@ -1929,7 +1994,7 @@
</template>
<!-- 鍒虹牬绫诲瀷breakageType -->
<template #breakageType="{ row }">
- <vxe-select v-model="row.breakageType "
+ <vxe-select v-model="row.breakageType"
clearable placeholder=" " allow-create filterable>
<vxe-option v-for="item in titleSelectJson.breakageType" :key="item.id" :label="item.basic_name" :value="item.basic_name"/>
</vxe-select>
@@ -1940,7 +2005,7 @@
<!--娆$牬鍘熷洜-->
<template #breakageReason="{ row }">
- <vxe-select v-model="row.breakageReason "
+ <vxe-select v-model="row.breakageReason"
clearable placeholder=" " allow-create filterable>
<vxe-option v-for="item in titleSelectJson.breakageReason" :key="item.id" :label="item.basic_name" :value="item.basic_name"/>
</vxe-select>
--
Gitblit v1.8.0