安全交底人单选变多选功能模块更新

limingyu-20240419-一公司危险作业更新
liujun 2024-02-03 15:29:35 +08:00
parent eca761e86a
commit d0347308ea
1 changed files with 178 additions and 65 deletions

View File

@ -153,7 +153,7 @@
</view> </view>
<view class="wui-form-list" style="padding-top: 20upx;" v-if="pd.APPLY_STATUS > 1"> <view class="wui-form-list" style="padding-top: 20upx;">
<view class="wui-title" style="margin-left: 20upx;"> <view class="wui-title" style="margin-left: 20upx;">
<text class="text-semi">安全防护措施</text> <text class="text-semi">安全防护措施</text>
</view> </view>
@ -485,31 +485,41 @@
</picker> </picker>
</view> </view>
</view> </view>
<view class="wui-form-list" v-if="!forbidEdit"> <view class="add_pard_box" v-if="!forbidEdit">
<view class="add_pard_btns">
<view class="add_pard_b" style="width: 170px;">
<button class="cu-btn round bg-blue" @click="addConfessUser"></button>
</view>
</view>
<view class="add_pard_item" v-for="(item,index) of confessList">
<view class="add_pard_del" v-if="index>0" @click="removeConfessUser(index)">
<text class="cuIcon-roundclosefill text-red f40"></text>
</view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">安全交底人单位</view> <view class="title">安全交底人单位</view>
<view class="picker-tree-box"> <view class="picker-tree-box">
<view class="picker-tree" @tap="showConfessTree"> <view class="picker-tree" @tap="showConfessTree(index)">
{{ pd.CONFESS_DEPARTMENT_NAME ? pd.CONFESS_DEPARTMENT_NAME : '请选择' }} {{ item.CONFESS_DEPARTMENT_NAME ? item.CONFESS_DEPARTMENT_NAME : '请选择' }}
</view> </view>
</view> </view>
<tki-tree ref="tkiTree_confess" <tki-tree ref="tkiTree_confess"
:selectParent=true :selectParent=true
:range="treeNode" :range="treeNode"
rangeKey="name" rangeKey="name"
@confirm="confesstreeConfirm" @confirm="confesstreeConfirm($event,index)"
@cancel="confesstreeCancel"></tki-tree> @cancel="confesstreeCancel"></tki-tree>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">安全交底人</view> <view class="title">安全交底人</view>
<picker @change="PickerConfess" :value="confessindex" :range="confessUserList" range-key="NAME" <picker @change="PickerConfess($event,index)" :value="item.confessindex" :range="item.confessUserList" range-key="NAME"
:disabled="confessUserList.length == 0" @click="isBlankList('confess')"> :disabled="item.confessUserList.length === 0">
<view class="picker"> <view class="picker">
{{ pd.CONFESS_USER_NAME ? pd.CONFESS_USER_NAME : '请选择' }} {{ item.CONFESS_USER_NAME ? item.CONFESS_USER_NAME : '请选择' }}
</view> </view>
</picker> </picker>
</view> </view>
</view> </view>
</view>
<view class="wui-form-list" v-if="!forbidEdit"> <view class="wui-form-list" v-if="!forbidEdit">
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">接受交底人单位</view> <view class="title">接受交底人单位</view>
@ -771,12 +781,21 @@ export default {
{name: 'MONITOR_USER_ID', message: '请选择验票班长'}, {name: 'MONITOR_USER_ID', message: '请选择验票班长'},
{name: 'ACCEPT_USER_ID', message: '请选择验收部门负责人'}, {name: 'ACCEPT_USER_ID', message: '请选择验收部门负责人'},
{name: 'GUARDIAN_USER_ID', message: '请选择监护人'}, {name: 'GUARDIAN_USER_ID', message: '请选择监护人'},
{name: 'CONFESS_USER_ID', message: '请选择安全交底人'},
{name: 'ACCEPT_CONFESS_USER_ID', message: '请选择接受交底人'}, {name: 'ACCEPT_CONFESS_USER_ID', message: '请选择接受交底人'},
], ],
todayDate: '', todayDate: '',
otherAssignments: false, otherAssignments: false,
otherIdentification: false, otherIdentification: false,
confessList:[
{
CONFESS_DEPARTMENT_NAME:'',
CONFESS_DEPARTMENT_ID:'',
CONFESS_USER_NAME:'',
CONFESS_USER_ID:'',
confessUserList:[],
confessindex: -1
}
],
} }
}, },
@ -800,6 +819,7 @@ export default {
// //
this.getDept(); this.getDept();
this.getLimitSpace(); this.getLimitSpace();
this.getSafetyCheck();
loginSession(); loginSession();
}, },
@ -871,7 +891,10 @@ export default {
"MONITOR_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[5] "MONITOR_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[5]
}) })
_this.pd.OTHER_PROTECTIVE_MEASURES = '' _this.pd.OTHER_PROTECTIVE_MEASURES = ''
// created by liu jun description:
if (res.data.measuresList && res.data.measuresList.length > 0) {
_this.measuresList = res.data.measuresList _this.measuresList = res.data.measuresList
}
_this.files = res.data.imgList; _this.files = res.data.imgList;
_this.files1 = res.data.imgList1; _this.files1 = res.data.imgList1;
let dongHuoCaoZuoRenPic = res.data.imgList2 let dongHuoCaoZuoRenPic = res.data.imgList2
@ -881,7 +904,6 @@ export default {
_this.pd.dongHuoCaoZuoRenPic.push(baseImgPath + dongHuoCaoZuoRenPic[i].FILEPATH) _this.pd.dongHuoCaoZuoRenPic.push(baseImgPath + dongHuoCaoZuoRenPic[i].FILEPATH)
} }
} }
console.log(this.pd.dongHuoCaoZuoRenPic)
if (_this.pd.APPLY_STATUS < 1) { if (_this.pd.APPLY_STATUS < 1) {
_this.forbidEdit = false; _this.forbidEdit = false;
} }
@ -895,6 +917,13 @@ export default {
this.getUserList(this.pd.MONITOR_DEPARTMENT_ID, 'monitorUserList'); this.getUserList(this.pd.MONITOR_DEPARTMENT_ID, 'monitorUserList');
this.getUserList(this.pd.ACCEPT_DEPARTMENT_ID, 'acceptUserList'); this.getUserList(this.pd.ACCEPT_DEPARTMENT_ID, 'acceptUserList');
this.getWorkUserList(); this.getWorkUserList();
// created by liu jun description:
if (res.data.pd.confessList && res.data.pd.confessList.length > 0) {
_this.confessList = res.data.pd.confessList
for (let i = 0; i < _this.confessList.length; i++) {
this.getUserListForJiaoDiRen(_this.confessList[i].CONFESS_DEPARTMENT_ID, i);
}
}
} else if ("exception" == data.result) { } else if ("exception" == data.result) {
@ -990,6 +1019,21 @@ export default {
if (!required) { if (!required) {
return return
} }
console.log(this.confessList)
for (let i = 0; i < this.confessList.length; i++) {
if (!this.confessList[i].CONFESS_USER_ID) {
uni.showToast({
icon: 'none',
title: '请选择安全交底人',
duration: 1500
});
required = false
}
}
//
for (let i = 0; i < this.confessList.length; i++) {
this.confessList[i].confessUserList = []
}
} }
const formData = {} const formData = {}
Object.keys(this.pd).map(key => { Object.keys(this.pd).map(key => {
@ -1005,6 +1049,7 @@ export default {
formData.dongHuoCaoZuoRenPic = this.pd.dongHuoCaoZuoRenPic formData.dongHuoCaoZuoRenPic = this.pd.dongHuoCaoZuoRenPic
formData.CORPINFO_ID = loginUser.CORPINFO_ID formData.CORPINFO_ID = loginUser.CORPINFO_ID
formData.USER_ID = loginUser.USER_ID formData.USER_ID = loginUser.USER_ID
formData.confessList = JSON.stringify(this.confessList)
this.buttonloading = true this.buttonloading = true
uni.request({ uni.request({
url: basePath + "/app/hotwork/cfd/" + _this.msg, url: basePath + "/app/hotwork/cfd/" + _this.msg,
@ -1019,7 +1064,7 @@ export default {
USER_ID: loginUser.USER_ID, USER_ID: loginUser.USER_ID,
}, },
success: (res) => { success: (res) => {
console.log(res) if (res.data.result == 'success') {
for (let i = 0; i < this.pd.dongHuoCaoZuoRenPic.length; i++) { for (let i = 0; i < this.pd.dongHuoCaoZuoRenPic.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: basePath + "/app/hotwork/cfd/uploadImg", url: basePath + "/app/hotwork/cfd/uploadImg",
@ -1048,8 +1093,14 @@ export default {
} }
}) })
} }
}else{
uni.hideLoading();
uni.showToast({
title: res.data.message,
duration: 1500
});
this.buttonloading = false
}
}, },
fail: (err) => { fail: (err) => {
uni.hideLoading(); uni.hideLoading();
@ -1079,6 +1130,24 @@ export default {
} }
}); });
}, },
getSafetyCheck(){
var _this = this;
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/hotwork/cfd/getSafetyCheckItem?tm=' + new Date().getTime(),
data: {
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: function (res) {
_this.measuresList = res.data.measuresList;
}
});
},
levelChange(e) { levelChange(e) {
this.levelindex = e.detail.value; this.levelindex = e.detail.value;
this.pd.WORK_LEVEL = this.levelList[this.levelindex].name; this.pd.WORK_LEVEL = this.levelList[this.levelindex].name;
@ -1160,6 +1229,34 @@ export default {
} }
}) })
}, },
getUserListForJiaoDiRen(dept, index) {
// post
var _this = this
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
url: basePath + '/app/sys/listUser',
data: {
DEPARTMENT_ID: dept,
tm: new Date().getTime(),
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: function (res) {
if ("success" === res.data.result) {
_this.confessList[index].confessUserList = res.data.userList;
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
getWorkUserList() { getWorkUserList() {
// post // post
var _this = this var _this = this
@ -1292,14 +1389,14 @@ export default {
} }
}, },
// //
confesstreeConfirm(e) { confesstreeConfirm(e ,index) {
this.isUps = false; this.isUps = false;
this.pd.CONFESS_DEPARTMENT_ID = e[0].id; this.confessList[index].CONFESS_DEPARTMENT_ID = e[0].id;
this.pd.CONFESS_DEPARTMENT_NAME = e[0].name; this.confessList[index].CONFESS_DEPARTMENT_NAME = e[0].name;
this.pd.CONFESS_USER_ID = '' this.confessList[index].CONFESS_USER_ID = ''
this.pd.CONFESS_USER_NAME = '' this.confessList[index].CONFESS_USER_NAME = ''
this.$forceUpdate();// this.$forceUpdate();//
this.getUserList(e[0].id, 'confessUserList'); this.getUserListForJiaoDiRen(e[0].id, index);
}, },
// //
confesstreeAcceptconfirm(e) { confesstreeAcceptconfirm(e) {
@ -1329,9 +1426,9 @@ export default {
this.$refs.tkiTree_guardian._show(); this.$refs.tkiTree_guardian._show();
}, },
// //
showConfessTree() { showConfessTree(index) {
this.isUps = true this.isUps = true
this.$refs.tkiTree_confess._show(); this.$refs.tkiTree_confess[index]._show();
}, },
// //
showAcceptconfessTree() { showAcceptconfessTree() {
@ -1344,10 +1441,10 @@ export default {
this.pd.GUARDIAN_USER_NAME = this.guardianUserList[this.guardianindex].NAME; this.pd.GUARDIAN_USER_NAME = this.guardianUserList[this.guardianindex].NAME;
this.$forceUpdate();// this.$forceUpdate();//
}, },
PickerConfess(e) { PickerConfess(e,index) {
this.confessindex = e.detail.value; this.confessList[index].confessindex = e.detail.value;
this.pd.CONFESS_USER_ID = this.confessUserList[this.confessindex].USER_ID; this.confessList[index].CONFESS_USER_ID = this.confessList[index].confessUserList[index].USER_ID;
this.pd.CONFESS_USER_NAME = this.confessUserList[this.confessindex].NAME; this.confessList[index].CONFESS_USER_NAME = this.confessList[index].confessUserList[index].NAME;
this.$forceUpdate();// this.$forceUpdate();//
}, },
PickerAcceptconfess(e) { PickerAcceptconfess(e) {
@ -1625,7 +1722,7 @@ export default {
goToEdit() { goToEdit() {
this.forbidEdit = false; this.forbidEdit = false;
}, },
//2024-01-25 created by liu jun //2024-01-25 created by liu jun description:
ChooseImage() { ChooseImage() {
var _this = this; var _this = this;
uni.chooseImage({ uni.chooseImage({
@ -1660,7 +1757,23 @@ export default {
} }
} }
}) })
} },
// 2024-01-31 created by liu jun description:
addConfessUser(){
var _this = this;
let o = {
CONFESS_DEPARTMENT_NAME:'',
CONFESS_DEPARTMENT_ID:'',
CONFESS_USER_NAME:'',
CONFESS_USER_ID:'',
confessUserList:[],
confessindex: -1
};
_this.confessList.push(o);
},
removeConfessUser(index){
this.confessList.splice(index,1);
},
} }
} }
</script> </script>