修改职业危害

This commit is contained in:
wjn 2024-07-05 16:34:37 +08:00
parent b380d3b267
commit 60d2e16900

View File

@ -66,7 +66,7 @@
</u-form-item>
<u-form-item required class="custom-form-item" label="职业危害名称" prop="DetailPost"
:borderBottom="false"
@click="handleQuerySelect({ formIndex: 'Nav_Identifyings', isMultiple: true})">
@click="handleQuerySelect({ formIndex: 'Nav_Identifyings', isMultiple: true, dataIndex: index})">
<view slot="right" class="custom-form-item-right">
<view class="multi">
<u--text v-for="(i, k) in item.Nav_Identifyings" :key="k" class="item"
@ -142,9 +142,6 @@
listPropUpload: ['TASK_ID'],
listPropValUpload: [],
model: {
Nav_LiableUser: {
NAME: "",
},
Nav_Detail: [],
Nav_Areas: [],
Nav_Files: [],
@ -159,6 +156,7 @@
lists: [],
formIndex: undefined,
isMultiple: false,
dataIndex:undefined,
},
Lists: [],
currSearchType: "",
@ -188,7 +186,6 @@
} else {
this.isAdd = 1;
let currUser = uni.getStorageSync('appInfo').User;
this.model.Nav_LiableUser.NAME = currUser.NAME;
this.model.LIABLE_USER_ID = currUser.ID;
this.model.ID = guid();
const json = initFilter(this.ORG_ID, "", "NAME", 1);
@ -269,7 +266,6 @@
},
handleChange(title, item) {
this.currentOperate = item;
console.log(this.currentOperate)
this.currSearchType = title;
this.showPopup = true;
this.handleSearch('init');
@ -283,7 +279,7 @@
extendFilterGroup(json, tempGroup);
}
if (this.currSearchType == "Nav_Area") {
if (!this.model.Nav_Areas.length > 0) {
if (this.model.Nav_Areas.length > 0) {
extendRule(json, 'TASK_ID', 1, this.model.ID);
extendInclude(json, 'Nav_Area');
getRequest(json, "/HM/HazardTaskArea/Entities").then(res => {
@ -397,6 +393,7 @@
this.qsCom = {
show: true,
name: opt.NAME,
dataIndex:opt.dataIndex,
formIndex: opt.formIndex,
isMultiple: opt.isMultiple,
lists: column
@ -423,13 +420,23 @@
extendGroupRule(tempGroup, 'NAME', 9, value)
extendFilterGroup(json, tempGroup);
}
let result = []
extendRule(json, 'TASK_ID', 1, this.model.ID);
extendInclude(json, 'Nav_Identifying');
const raw = await getRequest(json, "/HM/HazardTaskIdentifying/Entities").then(res => {
this.curTotal = res.TotalCount
return res
})
let result = [];
var raw = [];
if (this.model.Nav_Identifyings.length > 0) {
extendRule(json, 'TASK_ID', 1, this.model.ID);
extendInclude(json, 'Nav_Identifying');
raw = await getRequest(json, "/HM/HazardTaskIdentifying/Entities").then(res => {
this.curTotal = res.TotalCount
return res
})
}else{
extendRule(json, 'RISK_TYPE', 1, 2);
raw = await getIdentifying(json).then(res => {
this.curTotal = res.TotalCount
return res
})
}
result = raw.map(item => {
return {
...item,
@ -437,26 +444,23 @@
IDENTIFYING_ID: item?.Nav_Identifying.ID
}
})
console.log(result)
return result
},
onSelectedQS(val) {
console.log(val)
const {
formIndex,
} = this.qsCom
this.model.Nav_Detail.Nav_Identifyings = [];
const { formIndex, dataIndex } = this.qsCom
var detailId=this.model.Nav_Detail[dataIndex].ID;
this.model.Nav_Detail[dataIndex].Nav_Identifyings = [];
val.forEach(item => {
let obj = {
IDENTIFYING_ID: item.ID,
IDENTIFYING_ID: item.IDENTIFYING_ID,
Nav_Identifying: {
NAME: item.NAME
},
ID: guid(),
TASK_ID: this.model.ID,
TASK_DETAIL_ID: detailId,
ORG_ID: this.ORG_ID,
}
this.model.Nav_Detail.Nav_Identifyings.push(obj);
this.model.Nav_Detail[dataIndex].Nav_Identifyings.push(obj);
})
this.qsCom.show = false
},
@ -477,29 +481,15 @@
if (this.model.NOTE_AKER_ID == "") {
this.model.NOTE_AKER_ID = uni.getStorageSync('appInfo').User.ID;
}
this.model.Nav_Areas.forEach(item => {
item.IS_DELETED = true;
});
var uniqueAreas = new Set();
this.model.Nav_Detail.filter(t => t.IS_DELETED == false).forEach(function(obj) {
uniqueAreas.add(obj.AREA_ID);
});
let uniqueAreasArray = Array.from(uniqueAreas);
uniqueAreasArray.forEach(item => {
let obj = {
AREA_ID: item,
TASK_ID: this.model.ID,
ORG_ID: this.ORG_ID,
}
this.model.Nav_Areas.push(obj)
})
this.model.Nav_LiableUser = null;
this.model.Nav_Detail.forEach(item => {
item.Nav_User = null;
item.Nav_Area = null;
item.Nav_Users.forEach(item2 => {
item2.Nav_User = null;
});
item.Nav_Identifyings.forEach(item2 => {
item2.Nav_Identifying = null;
});
});
this.model.Nav_Files.forEach(item => {
if (item.TASK_ID == undefined) {