安全工器具的协议包含机具,不能发布
This commit is contained in:
parent
49d22604e1
commit
c4a1747dc3
|
|
@ -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});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue