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

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 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;">
<text class="text-semi">安全防护措施</text>
</view>
@ -485,29 +485,39 @@
</picker>
</view>
</view>
<view class="wui-form-list" v-if="!forbidEdit">
<view class="cu-form-group">
<view class="title">安全交底人单位</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showConfessTree">
{{ pd.CONFESS_DEPARTMENT_NAME ? pd.CONFESS_DEPARTMENT_NAME : '请选择' }}
</view>
<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>
<tki-tree ref="tkiTree_confess"
:selectParent=true
:range="treeNode"
rangeKey="name"
@confirm="confesstreeConfirm"
@cancel="confesstreeCancel"></tki-tree>
</view>
<view class="cu-form-group">
<view class="title">安全交底人</view>
<picker @change="PickerConfess" :value="confessindex" :range="confessUserList" range-key="NAME"
:disabled="confessUserList.length == 0" @click="isBlankList('confess')">
<view class="picker">
{{ pd.CONFESS_USER_NAME ? pd.CONFESS_USER_NAME : '请选择' }}
<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="title">安全交底人单位</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="showConfessTree(index)">
{{ item.CONFESS_DEPARTMENT_NAME ? item.CONFESS_DEPARTMENT_NAME : '请选择' }}
</view>
</view>
</picker>
<tki-tree ref="tkiTree_confess"
:selectParent=true
:range="treeNode"
rangeKey="name"
@confirm="confesstreeConfirm($event,index)"
@cancel="confesstreeCancel"></tki-tree>
</view>
<view class="cu-form-group">
<view class="title">安全交底人</view>
<picker @change="PickerConfess($event,index)" :value="item.confessindex" :range="item.confessUserList" range-key="NAME"
:disabled="item.confessUserList.length === 0">
<view class="picker">
{{ item.CONFESS_USER_NAME ? item.CONFESS_USER_NAME : '请选择' }}
</view>
</picker>
</view>
</view>
</view>
<view class="wui-form-list" v-if="!forbidEdit">
@ -771,12 +781,21 @@ export default {
{name: 'MONITOR_USER_ID', message: '请选择验票班长'},
{name: 'ACCEPT_USER_ID', message: '请选择验收部门负责人'},
{name: 'GUARDIAN_USER_ID', message: '请选择监护人'},
{name: 'CONFESS_USER_ID', message: '请选择安全交底人'},
{name: 'ACCEPT_CONFESS_USER_ID', message: '请选择接受交底人'},
],
todayDate: '',
otherAssignments: 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.getLimitSpace();
this.getSafetyCheck();
loginSession();
},
@ -871,7 +891,10 @@ export default {
"MONITOR_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[5]
})
_this.pd.OTHER_PROTECTIVE_MEASURES = ''
_this.measuresList = res.data.measuresList
// created by liu jun description:
if (res.data.measuresList && res.data.measuresList.length > 0) {
_this.measuresList = res.data.measuresList
}
_this.files = res.data.imgList;
_this.files1 = res.data.imgList1;
let dongHuoCaoZuoRenPic = res.data.imgList2
@ -881,7 +904,6 @@ export default {
_this.pd.dongHuoCaoZuoRenPic.push(baseImgPath + dongHuoCaoZuoRenPic[i].FILEPATH)
}
}
console.log(this.pd.dongHuoCaoZuoRenPic)
if (_this.pd.APPLY_STATUS < 1) {
_this.forbidEdit = false;
}
@ -895,6 +917,13 @@ export default {
this.getUserList(this.pd.MONITOR_DEPARTMENT_ID, 'monitorUserList');
this.getUserList(this.pd.ACCEPT_DEPARTMENT_ID, 'acceptUserList');
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) {
@ -990,6 +1019,21 @@ export default {
if (!required) {
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 = {}
Object.keys(this.pd).map(key => {
@ -1005,6 +1049,7 @@ export default {
formData.dongHuoCaoZuoRenPic = this.pd.dongHuoCaoZuoRenPic
formData.CORPINFO_ID = loginUser.CORPINFO_ID
formData.USER_ID = loginUser.USER_ID
formData.confessList = JSON.stringify(this.confessList)
this.buttonloading = true
uni.request({
url: basePath + "/app/hotwork/cfd/" + _this.msg,
@ -1019,37 +1064,43 @@ export default {
USER_ID: loginUser.USER_ID,
},
success: (res) => {
console.log(res)
for (let i = 0; i < this.pd.dongHuoCaoZuoRenPic.length; i++) {
uni.uploadFile({
url: basePath + "/app/hotwork/cfd/uploadImg",
filePath: this.pd.dongHuoCaoZuoRenPic[i],
name: 'FFILE',
formData: {
HOTWORK_ID: res.data.HOTWORK_ID
},
success: () => {
if(i === this.pd.dongHuoCaoZuoRenPic.length - 1){
if (res.data.result == 'success') {
for (let i = 0; i < this.pd.dongHuoCaoZuoRenPic.length; i++) {
uni.uploadFile({
url: basePath + "/app/hotwork/cfd/uploadImg",
filePath: this.pd.dongHuoCaoZuoRenPic[i],
name: 'FFILE',
formData: {
HOTWORK_ID: res.data.HOTWORK_ID
},
success: () => {
if (i === this.pd.dongHuoCaoZuoRenPic.length - 1) {
uni.hideLoading();
uni.showToast({
title: '提交成功',
duration: 1500
});
_this.goback()
this.buttonloading = false
}
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: '提交成功',
duration: 1500
uni.showModal({
content: err.errMsg,
showCancel: false
});
_this.goback()
this.buttonloading = false
}
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
})
}
}else{
uni.hideLoading();
uni.showToast({
title: res.data.message,
duration: 1500
});
this.buttonloading = false
}
},
fail: (err) => {
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) {
this.levelindex = e.detail.value;
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() {
// post
var _this = this
@ -1292,14 +1389,14 @@ export default {
}
},
//
confesstreeConfirm(e) {
confesstreeConfirm(e ,index) {
this.isUps = false;
this.pd.CONFESS_DEPARTMENT_ID = e[0].id;
this.pd.CONFESS_DEPARTMENT_NAME = e[0].name;
this.pd.CONFESS_USER_ID = ''
this.pd.CONFESS_USER_NAME = ''
this.confessList[index].CONFESS_DEPARTMENT_ID = e[0].id;
this.confessList[index].CONFESS_DEPARTMENT_NAME = e[0].name;
this.confessList[index].CONFESS_USER_ID = ''
this.confessList[index].CONFESS_USER_NAME = ''
this.$forceUpdate();//
this.getUserList(e[0].id, 'confessUserList');
this.getUserListForJiaoDiRen(e[0].id, index);
},
//
confesstreeAcceptconfirm(e) {
@ -1329,9 +1426,9 @@ export default {
this.$refs.tkiTree_guardian._show();
},
//
showConfessTree() {
showConfessTree(index) {
this.isUps = true
this.$refs.tkiTree_confess._show();
this.$refs.tkiTree_confess[index]._show();
},
//
showAcceptconfessTree() {
@ -1344,10 +1441,10 @@ export default {
this.pd.GUARDIAN_USER_NAME = this.guardianUserList[this.guardianindex].NAME;
this.$forceUpdate();//
},
PickerConfess(e) {
this.confessindex = e.detail.value;
this.pd.CONFESS_USER_ID = this.confessUserList[this.confessindex].USER_ID;
this.pd.CONFESS_USER_NAME = this.confessUserList[this.confessindex].NAME;
PickerConfess(e,index) {
this.confessList[index].confessindex = e.detail.value;
this.confessList[index].CONFESS_USER_ID = this.confessList[index].confessUserList[index].USER_ID;
this.confessList[index].CONFESS_USER_NAME = this.confessList[index].confessUserList[index].NAME;
this.$forceUpdate();//
},
PickerAcceptconfess(e) {
@ -1625,7 +1722,7 @@ export default {
goToEdit() {
this.forbidEdit = false;
},
//2024-01-25 created by liu jun
//2024-01-25 created by liu jun description:
ChooseImage() {
var _this = this;
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>