安全工器具的协议包含机具,不能发布

This commit is contained in:
hongchao 2025-12-03 15:01:26 +08:00
parent 49d22604e1
commit c4a1747dc3
2 changed files with 32 additions and 4 deletions

View File

@ -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});
}

View File

@ -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