From 133fe29837cb43a5c88c24323d1e79370c4350f9 Mon Sep 17 00:00:00 2001 From: shenzhouyu Date: Thu, 3 Sep 2026 13:53:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E5=AE=89pda=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=8F=91=E6=96=99=E5=92=8C=E9=80=80=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/production-issue/directIssue.vue | 24 ++++--- .../production-issue/directIssueDetail.vue | 6 +- .../directIssueNoMaterial.vue | 30 +++++---- .../directIssueNoMaterialDetail.vue | 6 +- .../modules/production-issue/production.vue | 61 ++++++++++++++++++ .../modules/production-return/production.vue | 62 ++++++++++++++++++- .../productionReturnIssueList.vue | 7 ++- .../productionReturnPicking.vue | 20 +++--- .../productionReturnPickingDetail.vue | 14 +++-- 9 files changed, 188 insertions(+), 42 deletions(-) diff --git a/src/views/modules/production-issue/directIssue.vue b/src/views/modules/production-issue/directIssue.vue index ddc0541..5ed277a 100644 --- a/src/views/modules/production-issue/directIssue.vue +++ b/src/views/modules/production-issue/directIssue.vue @@ -138,6 +138,7 @@ import { getWorkOrderMaterials, getShopOrderLine, } from "@/api/production/production-issue"; +import { filterRowsByAuthorizedSubSite, getAuthorizedSubSiteCodeList } from "@/utils/subSiteAuth.js"; import moment from "moment"; export default { @@ -229,7 +230,7 @@ export default { workOrderNo: this.workOrderNo.trim(), releaseNo: (this.releaseNo || "*").trim() || "*", sequenceNo: (this.sequenceNo || "*").trim() || "*", - site: localStorage.getItem('site'), + site: localStorage.getItem('site')+'%', }; getWorkOrderInfo(params) @@ -277,7 +278,7 @@ export default { this.loading = true; const params = { workOrderNo: this.workOrderNo.trim(), - site: localStorage.getItem('site'), + site: localStorage.getItem('site')+'%', }; getShopOrderLine(params) @@ -285,17 +286,19 @@ export default { this.loading = false; console.log("工单信息", data); - if ( - data.workOrders && - data.workOrders.length > 0 && - data.code === 0 - ) { - this.workOrderList = data.workOrders; + if (data.code === 0) { + const sourceRows = data.workOrders || []; + const authorizedSubSiteCodeList = getAuthorizedSubSiteCodeList(this.$store.state.user.subSiteCodeList); + // 接口按site前缀查询会返回同前缀下的所有子site,这里按当前用户授权子site做二次过滤 + this.workOrderList = filterRowsByAuthorizedSubSite(sourceRows, authorizedSubSiteCodeList, ['contract']); this.selectedWorkOrder = null; this.materialList = []; this.showOnlySelected = false; + if (this.workOrderList.length === 0) { + this.$message.error(data.msg || "未找到该工单信息"); + } } else { - this.$message.error(data.msg ||"未找到该工单信息"); + this.$message.error(data.msg || "未找到该工单信息"); this.workOrderList = []; this.selectedWorkOrder = null; this.materialList = []; @@ -347,7 +350,7 @@ export default { const params = { workOrderNo: this.selectedWorkOrder.orderNo, - site: localStorage.getItem('site'), + site: this.selectedWorkOrder.contract, releaseNo: (this.selectedWorkOrder.releaseNo || "*").trim() || "*", sequenceNo: (this.selectedWorkOrder.sequenceNo || "*").trim() || "*", }; @@ -392,6 +395,7 @@ export default { requiredQty: material.qtyRequired, issuedQty: material.qtyIssued || 0, partDesc: material.componentPartDesc, + site: this.selectedWorkOrder.contract, } }); }, diff --git a/src/views/modules/production-issue/directIssueDetail.vue b/src/views/modules/production-issue/directIssueDetail.vue index 0d4d5ab..b8a7488 100644 --- a/src/views/modules/production-issue/directIssueDetail.vue +++ b/src/views/modules/production-issue/directIssueDetail.vue @@ -176,6 +176,7 @@ export default { requiredQty: 0, issuedQty: 0, itemNo: '', + site: '', loading: false, issueInfo: {}, quantityDialogVisible: false, @@ -210,7 +211,7 @@ export default { scannedLabel: labelCode, workOrderNo: this.workOrderNo, componentPartNo: this.componentPartNo, - site: localStorage.getItem('site'), + site: this.site, } scanMaterialLabelIssue(params) .then(({ data }) => { @@ -298,7 +299,7 @@ export default { } const params = { - site: localStorage.getItem('site'), + site: this.site, workOrderNo: this.workOrderNo, componentPartNo: this.componentPartNo, operatorName: localStorage.getItem('userName'), @@ -345,6 +346,7 @@ export default { this.requiredQty = Number(this.$route.query.requiredQty || 0) this.issuedQty = Number(this.$route.query.issuedQty || 0) this.itemNo = this.$route.query.itemNo || '' + this.site = this.$route.query.site || '' this.issueInfo = { releaseNo: this.$route.query.releaseNo, sequenceNo: this.$route.query.sequenceNo, diff --git a/src/views/modules/production-issue/directIssueNoMaterial.vue b/src/views/modules/production-issue/directIssueNoMaterial.vue index 28b0bc5..572601f 100644 --- a/src/views/modules/production-issue/directIssueNoMaterial.vue +++ b/src/views/modules/production-issue/directIssueNoMaterial.vue @@ -92,6 +92,7 @@ import { getWorkOrderMaterials, getShopOrderLine, } from '@/api/production/production-issue-no-material' +import { filterRowsByAuthorizedSubSite, getAuthorizedSubSiteCodeList } from '@/utils/subSiteAuth.js' import moment from 'moment' export default { @@ -196,24 +197,29 @@ export default { this.loading = true const params = { workOrderNo: this.workOrderNo.trim(), - site: localStorage.getItem('site'), + site: localStorage.getItem('site')+'%', } getShopOrderLine(params) .then(({ data }) => { this.loading = false - if ( - data.workOrders && - data.workOrders.length > 0 && - data.code === 0 - ) { - this.workOrderList = data.workOrders + if (data.code === 0) { + const sourceRows = data.workOrders || [] + const authorizedSubSiteCodeList = getAuthorizedSubSiteCodeList(this.$store.state.user.subSiteCodeList) + // 接口按site前缀查询会返回同前缀下的所有子site,这里按当前用户授权子site做二次过滤 + this.workOrderList = filterRowsByAuthorizedSubSite(sourceRows, authorizedSubSiteCodeList, ['contract']) + this.selectedWorkOrder = null + this.materialList = [] + this.showOnlySelected = false + if (this.workOrderList.length === 0) { + this.$message.error(data.msg || '未找到该工单信息') + } } else { this.$message.error(data.msg || '未找到该工单信息') this.workOrderList = [] + this.selectedWorkOrder = null + this.materialList = [] + this.showOnlySelected = false } - this.selectedWorkOrder = null - this.materialList = [] - this.showOnlySelected = false }) .catch((error) => { this.loading = false @@ -250,7 +256,7 @@ export default { this.loading = true const params = { workOrderNo: this.selectedWorkOrder.orderNo, - site: localStorage.getItem('site'), + site: this.selectedWorkOrder.contract, releaseNo: (this.selectedWorkOrder.releaseNo || '*').trim() || '*', sequenceNo: (this.selectedWorkOrder.sequenceNo || '*').trim() || '*', } @@ -286,6 +292,7 @@ export default { requiredQty: 0, issuedQty: 0, partDesc: '物料详情', + site: this.selectedWorkOrder.contract, }, }) } @@ -353,6 +360,7 @@ export default { requiredQty: material.qtyRequired, issuedQty: material.qtyIssued || 0, partDesc: material.componentPartDesc, + site: this.selectedWorkOrder.contract, }, }) }, diff --git a/src/views/modules/production-issue/directIssueNoMaterialDetail.vue b/src/views/modules/production-issue/directIssueNoMaterialDetail.vue index f21cf06..5736f70 100644 --- a/src/views/modules/production-issue/directIssueNoMaterialDetail.vue +++ b/src/views/modules/production-issue/directIssueNoMaterialDetail.vue @@ -268,6 +268,7 @@ export default { requiredQty: 0, issuedQty: 0, itemNo: "", + site: "", loading: false, issueInfo: {}, quantityDialogVisible: false, @@ -300,7 +301,7 @@ export default { const params = { scannedLabel: labelCode, workOrderNo: this.workOrderNo, - site: localStorage.getItem("site"), + site: this.site, } scanMaterialLabelNoPartNo(params) .then(({ data }) => { @@ -472,7 +473,7 @@ export default { } const params = { - site: localStorage.getItem("site"), + site: this.site, workOrderNo: this.workOrderNo, componentPartNo: this.componentPartNo, operatorName: localStorage.getItem("userName"), @@ -523,6 +524,7 @@ export default { this.requiredQty = Number(this.$route.query.requiredQty || 0); this.issuedQty = Number(this.$route.query.issuedQty || 0); this.itemNo = this.$route.query.itemNo || ""; + this.site = this.$route.query.site || ""; this.issueInfo = { releaseNo: this.$route.query.releaseNo, sequenceNo: this.$route.query.sequenceNo, diff --git a/src/views/modules/production-issue/production.vue b/src/views/modules/production-issue/production.vue index c58814c..f148f30 100644 --- a/src/views/modules/production-issue/production.vue +++ b/src/views/modules/production-issue/production.vue @@ -14,6 +14,7 @@ class="menu-item" v-for="(btn, index) in buttons" :key="index" + v-site-auth="btn.siteAuth || '*'" :class="{ disabled: btn.disabled }" @click="handleButtonClick(btn)" > @@ -37,6 +38,7 @@ export default { iconClass: "purchase", to: "directIssue", disabled: false, + siteAuth: "*", }, { icon: "scan", @@ -44,6 +46,7 @@ export default { iconClass: "purchase", to: "directIssueNoMaterial", disabled: false, + siteAuth: "*", }, { icon: "records", @@ -51,6 +54,7 @@ export default { iconClass: "qualified", to: "productionPicking", disabled: false, + siteAuth: "55", }, /* { icon: "records", @@ -61,7 +65,64 @@ export default { ], }; }, + directives: { + // 与 main.vue 的 v-site-auth 一致:* 或命中当前 site 才显示 + siteAuth: { + inserted(el, binding, vnode) { + if (vnode.context && vnode.context.applySiteAuthForElement) { + vnode.context.applySiteAuthForElement(el, binding); + } + }, + componentUpdated(el, binding, vnode) { + if (vnode.context && vnode.context.applySiteAuthForElement) { + vnode.context.applySiteAuthForElement(el, binding); + } + }, + }, + }, + computed: { + currentSite() { + const storeSite = this.$store.state.user.site; + const normalizedStoreSite = + storeSite === null || storeSite === undefined + ? "" + : String(storeSite).trim(); + if (normalizedStoreSite && normalizedStoreSite !== "0") { + return normalizedStoreSite; + } + return (localStorage.getItem("site") || "").trim(); + }, + }, methods: { + normalizeMenuSiteAuthValue(siteAuthValue) { + const rawValue = + siteAuthValue === null || siteAuthValue === undefined + ? "*" + : String(siteAuthValue).trim(); + return rawValue === "" ? "*" : rawValue; + }, + isMenuVisibleForCurrentSite(siteAuthValue) { + const normalizedAuthValue = this.normalizeMenuSiteAuthValue(siteAuthValue); + if (normalizedAuthValue === "*") { + return true; + } + const currentSite = this.currentSite; + if (!currentSite) { + return false; + } + const authSiteList = normalizedAuthValue + .split(",") + .map((item) => item.trim()) + .filter((item) => item !== ""); + return ( + authSiteList.includes("*") || + authSiteList.includes(String(currentSite).trim()) + ); + }, + applySiteAuthForElement(el, binding) { + const isVisible = this.isMenuVisibleForCurrentSite(binding.value); + el.style.display = isVisible ? "" : "none"; + }, handleButtonClick(btn) { if (btn.disabled) { this.$message.warning("正在开发中,敬请期待..."); diff --git a/src/views/modules/production-return/production.vue b/src/views/modules/production-return/production.vue index a5fe061..3b2a561 100644 --- a/src/views/modules/production-return/production.vue +++ b/src/views/modules/production-return/production.vue @@ -14,6 +14,7 @@ class="menu-item" v-for="(btn, index) in buttons" :key="index" + v-site-auth="btn.siteAuth || '*'" :class="{ 'disabled': btn.disabled }" @click="handleButtonClick(btn)" > @@ -31,12 +32,69 @@ export default { data() { return { buttons: [ - { icon: 'scan', label: '直接退料', iconClass: 'direct', to: 'productionReturnPicking', disabled: false }, - { icon: 'records', label: '申请单退料', iconClass: 'request', to: 'productionReturnPDA', disabled: false }, + { icon: 'scan', label: '直接退料', iconClass: 'direct', to: 'productionReturnPicking', disabled: false, siteAuth: '*' }, + { icon: 'records', label: '申请单退料', iconClass: 'request', to: 'productionReturnPDA', disabled: false, siteAuth: '55' }, ] } }, + directives: { + // 与 main.vue 的 v-site-auth 一致:* 或命中当前 site 才显示 + siteAuth: { + inserted(el, binding, vnode) { + if (vnode.context && vnode.context.applySiteAuthForElement) { + vnode.context.applySiteAuthForElement(el, binding); + } + }, + componentUpdated(el, binding, vnode) { + if (vnode.context && vnode.context.applySiteAuthForElement) { + vnode.context.applySiteAuthForElement(el, binding); + } + }, + }, + }, + computed: { + currentSite() { + const storeSite = this.$store.state.user.site; + const normalizedStoreSite = + storeSite === null || storeSite === undefined + ? '' + : String(storeSite).trim(); + if (normalizedStoreSite && normalizedStoreSite !== '0') { + return normalizedStoreSite; + } + return (localStorage.getItem('site') || '').trim(); + }, + }, methods: { + normalizeMenuSiteAuthValue(siteAuthValue) { + const rawValue = + siteAuthValue === null || siteAuthValue === undefined + ? '*' + : String(siteAuthValue).trim(); + return rawValue === '' ? '*' : rawValue; + }, + isMenuVisibleForCurrentSite(siteAuthValue) { + const normalizedAuthValue = this.normalizeMenuSiteAuthValue(siteAuthValue); + if (normalizedAuthValue === '*') { + return true; + } + const currentSite = this.currentSite; + if (!currentSite) { + return false; + } + const authSiteList = normalizedAuthValue + .split(',') + .map((item) => item.trim()) + .filter((item) => item !== ''); + return ( + authSiteList.includes('*') || + authSiteList.includes(String(currentSite).trim()) + ); + }, + applySiteAuthForElement(el, binding) { + const isVisible = this.isMenuVisibleForCurrentSite(binding.value); + el.style.display = isVisible ? '' : 'none'; + }, handleButtonClick(btn) { if (btn.disabled) { this.$message.warning('正在开发中,敬请期待...'); diff --git a/src/views/modules/production-return/productionReturnIssueList.vue b/src/views/modules/production-return/productionReturnIssueList.vue index 72cdc0e..9c363b5 100644 --- a/src/views/modules/production-return/productionReturnIssueList.vue +++ b/src/views/modules/production-return/productionReturnIssueList.vue @@ -84,7 +84,8 @@ export default { lineItemNo: '', releaseNo: '', sequenceNo: '', - umId:'' + umId: '', + site: '', }; }, methods: { @@ -95,7 +96,7 @@ export default { this.loading = true; const params = { workOrderNo: this.workOrderNo, - site: localStorage.getItem('site'), + site: this.site, componentPartNo: this.componentPartNo, releaseNo: this.releaseNo || '*', sequenceNo: this.sequenceNo || '*', @@ -139,6 +140,7 @@ export default { wdrNo: item.WAIV_DEV_REJ_NO , engChgLevel: item.ENG_CHG_LEVEL || '1', umId: this.umId, + site: this.site, }, }); }, @@ -153,6 +155,7 @@ export default { this.releaseNo = this.$route.query.releaseNo; this.sequenceNo = this.$route.query.sequenceNo; this.umId = this.$route.query.uom; + this.site = this.$route.query.site || ''; this.loadIssueList(); }, }; diff --git a/src/views/modules/production-return/productionReturnPicking.vue b/src/views/modules/production-return/productionReturnPicking.vue index b0094d6..1d87c5a 100644 --- a/src/views/modules/production-return/productionReturnPicking.vue +++ b/src/views/modules/production-return/productionReturnPicking.vue @@ -138,6 +138,7 @@