From c4a1747dc3efff0b10dee86fdc436572352b0def Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Wed, 3 Dec 2025 15:01:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=B7=A5=E5=99=A8=E5=85=B7?= =?UTF-8?q?=E7=9A=84=E5=8D=8F=E8=AE=AE=E5=8C=85=E5=90=AB=E6=9C=BA=E5=85=B7?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E8=83=BD=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leasePublish/component/addToolsApply.vue | 20 +++++++++++++++++++ .../lease/apply/component/addToolsApply.vue | 16 +++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/views/business/leasePublish/component/addToolsApply.vue b/src/views/business/leasePublish/component/addToolsApply.vue index 6246da50..92194438 100644 --- a/src/views/business/leasePublish/component/addToolsApply.vue +++ b/src/views/business/leasePublish/component/addToolsApply.vue @@ -239,6 +239,7 @@ import { getApplyInfo,getTypeOptions,applySubmit } from "@/api/leasePublish/index"; import { getUnitListLeaseApi, getListLeasePersonApi,getPendingOutNumByTypeId } from '@/api/lease/apply' +import { getAgreement,} from "@/api/lease/apply"; import { getToken } from "@/utils/auth"; import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' @@ -319,6 +320,8 @@ export default { items: [], + isSafeType: 0, + // 表单校验 rules: { unitId: [ @@ -361,6 +364,7 @@ export default { methods: { uniteChange(e) { this.getLeasePersonList(e.id) + this.getAgreementId(e.id) }, // 获取领料人列表 async getLeasePersonList(teamId) { @@ -372,6 +376,16 @@ export default { console.log('🚀 ~ 获取领料人列表失败 ~ error:', error) } }, + //获取协议 + async getAgreementId(teamId) { + await getAgreement({ + unitId: teamId, + projectId: this.leaseApplyData.leaseProjectId, + }).then((response) => { + this.isSafeType = response.data.isSafeType; + }); + }, + /** 转换菜单数据结构 */ normalizer(node) { if (node.children && !node.children.length) { @@ -473,6 +487,7 @@ export default { console.log('storageNum---',res.data.storageNum) this.$set(row, 'pendingOutNum', res.data.pendingOutNum) this.$set(row, 'storageNum', res.data.storageNum) + this.$set(row, 'jiJuType', res.data.jiJuType) } // this.$set(row, 'newTypeId', row.newTypeId) // this.$set(row, 'num', row.num) @@ -497,6 +512,11 @@ export default { this.leaseList.forEach((item) => { // 检查 item 的 id 是否存在于 this.items 中 if (this.items.some((selectedItem) => selectedItem.id === item.id)) { + console.log('hhhhhhhhhxxxxx',item,this.isSafeType) + if(item.jiJuType == 1 && this.isSafeType == 1){ + this.$modal.msgError("所选择的领用单位的安全工器具协议下所勾选的物资包含机具,不能发布!"); + return true; + } // 如果存在,将 item 存入 itemsTemp itemsTemp.push({'typeId': item.typeId,'parentId':item.parentId, 'num': item.num, 'newTypeId': item.newTypeId}); } diff --git a/src/views/material/lease/apply/component/addToolsApply.vue b/src/views/material/lease/apply/component/addToolsApply.vue index f9ea8e8c..d38a9e7a 100644 --- a/src/views/material/lease/apply/component/addToolsApply.vue +++ b/src/views/material/lease/apply/component/addToolsApply.vue @@ -468,6 +468,7 @@ export default { projectTemp: undefined, unitTemp: undefined, agreementId: undefined, + isSafeType: 0, // taxRate:0, flattenOptions: [], // 扁平化后的选项数据 typePopoverVisible: false, @@ -596,6 +597,7 @@ export default { // } else if (val && val.length == 0) { // this.maForm.projectId = ""; // } + setTimeout(()=>{ // projectId: this.maForm.projectId getMaterialUnitListApi({ projectId: this.maForm.projectId }).then((response) => { @@ -735,10 +737,11 @@ export default { // 处理类型数据 processTypeData(data) { const result = []; - + console.log("zzzzzzzzzzzzzzzzz",data) const traverse = (node, parents = []) => { const path = [...parents, node.typeName]; - + + // 确保jijuType属性被正确提取 if (!node.children || node.children.length === 0) { result.push({ typeId: node.typeId, @@ -751,7 +754,8 @@ export default { specificationType: node.typeName, unitName: node.unitName, unitValue: node.unitValue, - maxSortPriority: node.maxSortPriority + maxSortPriority: node.maxSortPriority, + jiJuType: node.jiJuType, }); } @@ -800,7 +804,6 @@ export default { // 获取新选中的项 const lastSelected = val[val.length - 1]; const typeData = this.flattenTypeOptions.find(item => item.typeId === lastSelected); - if (typeData) { if (this.equipmentList.some(item => item.typeId === lastSelected)) { this.$message({ @@ -917,8 +920,13 @@ export default { projectId: this.maForm.projectId, }).then((response) => { this.agreementId = response.data.agreementId; + this.isSafeType = response.data.isSafeType; this.maForm.agreementId = this.agreementId; }); + if(this.isSafeType==1 && this.equipmentList.some(item => item.jiJuType == 1)){ + this.$modal.msgError("该安全工器具协议下所申请的物资包含机具,不能申请!"); + return; + } this.maForm.taskId = this.taskId; // this.maForm.checkDetailsList = this.equipmentList await this.$modal