安全措施选择
parent
a53064ece7
commit
c88c0719a4
|
@ -0,0 +1,131 @@
|
||||||
|
<template>
|
||||||
|
<page-meta :page-style="'overflow:'+(visible?'hidden':'visible')"></page-meta>
|
||||||
|
<uni-popup ref="popup" type="center" :mask-click="false">
|
||||||
|
<scroll-view scroll-y style="width: 100vw;height: 100vh;">
|
||||||
|
<view :style="{padding: this.CustomBar + 15 + 'px 15px 15px 15px'}">
|
||||||
|
<checkbox-group @change="change">
|
||||||
|
<view v-for="(item,index) in withSelectMeasuresList" :key="index" style="display: flex;margin-top: 15upx">
|
||||||
|
<checkbox :value="item.BUS_BREAKGROUND_MEASURES_ID" :checked="item.check"/>
|
||||||
|
<view style="padding-left: 10upx;">{{ item.PROTECTIVE_MEASURES }}</view>
|
||||||
|
</view>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="cu-bar btn-group" style="margin-top: 50upx;">
|
||||||
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="determine">确定</button>
|
||||||
|
<button class="cu-btn bg-grey margin-tb-sm lg" @click="close">关闭</button>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</uni-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import uniPopup from '@/components/more-select/uni-popup/uni-popup.vue';
|
||||||
|
import {basePath, loginUser} from "@/common/tool";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
uniPopup,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
measuresList: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectValue: [],
|
||||||
|
withSelectMeasuresList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
visible: {
|
||||||
|
handler(newValue) {
|
||||||
|
if (newValue) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.popup.open()
|
||||||
|
})
|
||||||
|
this.getWithSelectMeasuresList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSelectedMeasuresList() {
|
||||||
|
const index = this.index
|
||||||
|
const value = this.value
|
||||||
|
const allSelectedMeasuresList = []
|
||||||
|
const currentIndexSelectedMeasuresList = []
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
for (let j = 0; j < value[i].selectMeasures.length; j++) {
|
||||||
|
allSelectedMeasuresList.push(value[i].selectMeasures[j])
|
||||||
|
if (i === index) {
|
||||||
|
currentIndexSelectedMeasuresList.push({...value[i].selectMeasures[j], check: true})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {allSelectedMeasuresList, currentIndexSelectedMeasuresList}
|
||||||
|
},
|
||||||
|
getWithSelectMeasuresList() {
|
||||||
|
const {allSelectedMeasuresList, currentIndexSelectedMeasuresList} = this.getSelectedMeasuresList()
|
||||||
|
const withSelectMeasuresList = [...this.measuresList]
|
||||||
|
if (allSelectedMeasuresList.length > 0) {
|
||||||
|
for (let i = 0; i < allSelectedMeasuresList.length; i++) {
|
||||||
|
for (let j = 0; j < withSelectMeasuresList.length; j++) {
|
||||||
|
if (allSelectedMeasuresList[i].BUS_BREAKGROUND_MEASURES_ID === withSelectMeasuresList[j].BUS_BREAKGROUND_MEASURES_ID) {
|
||||||
|
withSelectMeasuresList.splice(j, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
withSelectMeasuresList.push(...currentIndexSelectedMeasuresList)
|
||||||
|
this.withSelectMeasuresList = withSelectMeasuresList
|
||||||
|
},
|
||||||
|
change(event) {
|
||||||
|
this.selectValue = event.detail.value
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.selectValue = []
|
||||||
|
this.withSelectMeasuresList = []
|
||||||
|
this.$emit('update:visible', false)
|
||||||
|
this.$refs.popup.close()
|
||||||
|
},
|
||||||
|
determine() {
|
||||||
|
const value = []
|
||||||
|
const selectValue = this.selectValue
|
||||||
|
const withSelectMeasuresList = this.withSelectMeasuresList
|
||||||
|
for (let i = 0; i < selectValue.length; i++) {
|
||||||
|
for (let j = 0; j < withSelectMeasuresList.length; j++) {
|
||||||
|
if (selectValue[i] === withSelectMeasuresList[j].BUS_BREAKGROUND_MEASURES_ID) {
|
||||||
|
value.push(withSelectMeasuresList[j])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.value[this.index].selectMeasures = value
|
||||||
|
this.$emit('input', [...this.value])
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -9,49 +9,61 @@
|
||||||
<detail v-if="pd.BREAKGROUND_ID" :breakgroundId="pd.BREAKGROUND_ID" :showMeasures="false"></detail>
|
<detail v-if="pd.BREAKGROUND_ID" :breakgroundId="pd.BREAKGROUND_ID" :showMeasures="false"></detail>
|
||||||
|
|
||||||
<view class="wui-form-list" style="padding-top: 20upx;">
|
<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;display: flex;justify-content: space-between;align-items: center">
|
||||||
<text class="text-semi">安全防护措施</text>
|
<text class="text-semi">安全防护措施</text>
|
||||||
|
<button class="cu-btn round bg-blue" @click="addMeasuresListCopy" style="margin-right: 20upx;">添加</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="wui-table" style="padding: 0 20upx;">
|
<view>
|
||||||
<uni-table name='measuresList' border stripe emptyText="暂无更多数据" >
|
<view class="add_pard_item" v-for="(item,index) in measuresListCopy" :key="item.id">
|
||||||
<!-- 表头行 -->
|
<view class="add_pard_del" @click="removeMeasuresListCopy(index)" v-if="index !== 0">
|
||||||
<uni-tr>
|
<text class="cuIcon-roundclosefill text-red f40"></text>
|
||||||
<uni-th align="center" style="font-weight: bold;">主要安全措施</uni-th>
|
|
||||||
</uni-tr>
|
|
||||||
<template v-for="(item,index) in measuresList">
|
|
||||||
<uni-tr>
|
|
||||||
<uni-td>
|
|
||||||
<view style="margin-bottom: 20upx;">
|
|
||||||
{{item.PROTECTIVE_MEASURES}}
|
|
||||||
</view>
|
</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="showDeptTree(index)">{{measuresList[index].DEPARTMENT_NAME?measuresList[index].DEPARTMENT_NAME:'请选择'}}</view>
|
<view class="picker-tree" @tap="showDeptTree(index)">
|
||||||
|
{{item.DEPARTMENT_NAME?item.DEPARTMENT_NAME:'请选择'}}
|
||||||
</view>
|
</view>
|
||||||
<tki-tree :ref="'tkiTree'+index"
|
</view>
|
||||||
|
<tki-tree
|
||||||
|
:ref="'tkiTree'+index"
|
||||||
:selectParent=true
|
:selectParent=true
|
||||||
:range="treeNode"
|
:range="treeNode"
|
||||||
rangeKey="name"
|
rangeKey="name"
|
||||||
@confirm="deptTreeConfirm($event,index)"
|
@confirm="deptTreeConfirm($event,index)"
|
||||||
@cancel="deptTreeCancel($event,index)"></tki-tree>
|
@cancel="deptTreeCancel($event,index)">
|
||||||
|
</tki-tree>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="cu-form-group" >
|
<view class="cu-form-group" >
|
||||||
<view class="title">确认人</view>
|
<view class="title">确认人</view>
|
||||||
<picker @change="pickerUser($event,index)" :value="item.userIndex" :range="item.userList" range-key="NAME" :disabled="item.userList.length == 0" @click="isBlankList(index)">
|
<picker
|
||||||
|
@change="pickerUser($event,index)"
|
||||||
|
:value="item.userIndex"
|
||||||
|
:range="item.userList"
|
||||||
|
range-key="NAME"
|
||||||
|
:disabled="item.userList.length === 0"
|
||||||
|
@click="isBlankList(index)"
|
||||||
|
>
|
||||||
<view class="picker">
|
<view class="picker">
|
||||||
{{measuresList[index].USER_NAME?measuresList[index].USER_NAME:'请选择'}}
|
{{item.USER_NAME?item.USER_NAME:'请选择'}}
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
</uni-td>
|
<view class="measures cu-form-group">
|
||||||
</uni-tr>
|
<view style="flex: 1">
|
||||||
</template>
|
<view style="margin-top: 10upx;display: flex;justify-content: space-between;align-items: center">
|
||||||
</uni-table>
|
<view class="title">安全措施:</view>
|
||||||
|
<view>
|
||||||
|
<button class="cu-btn round bg-blue" @click="fnSelectMeasures(index)">选择安全措施</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content" v-for="(item1,index1) in item.selectMeasures" :key="index1">
|
||||||
|
{{index1+1}} . {{item1.PROTECTIVE_MEASURES}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="wui-sign" >
|
<view class="wui-sign" >
|
||||||
<view class="title"></view>
|
<view class="title"></view>
|
||||||
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
|
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
|
||||||
|
@ -78,6 +90,7 @@
|
||||||
<view class="padding flex flex-direction">
|
<view class="padding flex flex-direction">
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<select-measures :measures-list="measuresList" v-model="measuresListCopy" :visible.sync="selectMeasuresShow" :index="selectMeasuresIndex"/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -90,9 +103,10 @@
|
||||||
import gcoord from '@/common/gcoord.js'
|
import gcoord from '@/common/gcoord.js'
|
||||||
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
||||||
import detail from '@/pages/application/breakground/breakground-detail/index'
|
import detail from '@/pages/application/breakground/breakground-detail/index'
|
||||||
|
import selectMeasures from "@/components/select_measures/index.vue";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tkiTree,ruiDatePicker,writingBoard,detail
|
tkiTree,ruiDatePicker,writingBoard,detail,selectMeasures
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -102,8 +116,11 @@
|
||||||
treeNode:[],//部门下拉数据
|
treeNode:[],//部门下拉数据
|
||||||
pd:{},// 数据
|
pd:{},// 数据
|
||||||
measuresList:[],
|
measuresList:[],
|
||||||
|
measuresListCopy:[],
|
||||||
modalName:null,
|
modalName:null,
|
||||||
imgList:[],
|
imgList:[],
|
||||||
|
selectMeasuresShow:false,
|
||||||
|
selectMeasuresIndex:-1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(event){
|
onLoad(event){
|
||||||
|
@ -112,6 +129,7 @@
|
||||||
// 初始化现场作业负责人
|
// 初始化现场作业负责人
|
||||||
this.getDept();
|
this.getDept();
|
||||||
this.getMeasures();
|
this.getMeasures();
|
||||||
|
this.addMeasuresListCopy();
|
||||||
loginSession();
|
loginSession();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -165,8 +183,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(APPLY_STATUS == 1){
|
if(APPLY_STATUS == 1){
|
||||||
for (let i = 0; i < this.measuresList.length; i++) {
|
for (let i = 0; i < this.measuresListCopy.length; i++) {
|
||||||
const measures = this.measuresList[i]
|
const measures = this.measuresListCopy[i]
|
||||||
if(!measures.USER_ID){
|
if(!measures.USER_ID){
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
@ -175,17 +193,38 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(measures.selectMeasures.length === 0){
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '第'+(i+1)+'项未选择安全措施',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const formData={}
|
const formData={}
|
||||||
var files = [];
|
var files = [];
|
||||||
var signtime = [];
|
var signtime = [];
|
||||||
const signers = this.measuresList.map(item => {
|
var signers = [];
|
||||||
return {
|
for (let i = 0; i < this.measuresListCopy.length; i++) {
|
||||||
BUS_BREAKGROUND_MEASURES_ID: item.BUS_BREAKGROUND_MEASURES_ID,
|
const measures = this.measuresListCopy[i]
|
||||||
USER_ID: item.USER_ID
|
for (let j = 0; j < measures.selectMeasures.length; j++) {
|
||||||
}
|
signers.push({
|
||||||
|
BUS_BREAKGROUND_MEASURES_ID: measures.selectMeasures[j].BUS_BREAKGROUND_MEASURES_ID,
|
||||||
|
USER_ID: measures.USER_ID
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(signers.length !== this.measuresList.length){
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '请为每个安全措施选择确认人',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.uploadImgFaults(files,signtime)
|
this.uploadImgFaults(files,signtime)
|
||||||
formData.BREAKGROUND_ID = _this.pd.BREAKGROUND_ID
|
formData.BREAKGROUND_ID = _this.pd.BREAKGROUND_ID
|
||||||
formData.SIGNTIME = signtime.join(",")
|
formData.SIGNTIME = signtime.join(",")
|
||||||
|
@ -238,11 +277,7 @@
|
||||||
USER_ID:loginUser.USER_ID,
|
USER_ID:loginUser.USER_ID,
|
||||||
},
|
},
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
_this.measuresList = res.data.measuresList.map((item,index)=>{
|
_this.measuresList = res.data.measuresList
|
||||||
item.userList = []
|
|
||||||
item.userIndex = -1
|
|
||||||
return item
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -272,6 +307,25 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
addMeasuresListCopy(){
|
||||||
|
this.measuresListCopy.push({
|
||||||
|
id:Math.random(),
|
||||||
|
DEPARTMENT_ID:'',
|
||||||
|
DEPARTMENT_NAME:'',
|
||||||
|
USER_ID:'',
|
||||||
|
USER_NAME:'',
|
||||||
|
userList:[],
|
||||||
|
userIndex:-1,
|
||||||
|
selectMeasures:[]
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removeMeasuresListCopy(index){
|
||||||
|
this.measuresListCopy.splice(index,1)
|
||||||
|
},
|
||||||
|
fnSelectMeasures(index){
|
||||||
|
this.selectMeasuresShow = true
|
||||||
|
this.selectMeasuresIndex = index
|
||||||
|
},
|
||||||
|
|
||||||
showDeptTree(index) {
|
showDeptTree(index) {
|
||||||
this.isUps=true
|
this.isUps=true
|
||||||
|
@ -280,10 +334,10 @@
|
||||||
|
|
||||||
deptTreeConfirm(e,i) {
|
deptTreeConfirm(e,i) {
|
||||||
this.isUps=false;
|
this.isUps=false;
|
||||||
this.measuresList[i].DEPARTMENT_ID=e[0].id;
|
this.measuresListCopy[i].DEPARTMENT_ID=e[0].id;
|
||||||
this.measuresList[i].DEPARTMENT_NAME=e[0].name;
|
this.measuresListCopy[i].DEPARTMENT_NAME=e[0].name;
|
||||||
this.measuresList[i].USER_ID = ''
|
this.measuresListCopy[i].USER_ID = ''
|
||||||
this.measuresList[i].USER_NAME = ''
|
this.measuresListCopy[i].USER_NAME = ''
|
||||||
this.getUserList(e[0].id,i);
|
this.getUserList(e[0].id,i);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -292,14 +346,24 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
pickerUser(e,i) {
|
pickerUser(e,i) {
|
||||||
this.measuresList[i].userIndex = e.detail.value;
|
for (let j = 0; j < this.measuresListCopy.length; j++) {
|
||||||
this.measuresList[i].USER_ID=this.measuresList[i].userList[e.detail.value].USER_ID;
|
if(this.measuresListCopy[j].USER_ID === this.measuresListCopy[i].userList[e.detail.value].USER_ID && i !== j){
|
||||||
this.measuresList[i].USER_NAME=this.measuresList[i].userList[e.detail.value].NAME;
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '确认人不能重复',
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.measuresListCopy[i].userIndex = e.detail.value;
|
||||||
|
this.measuresListCopy[i].USER_ID=this.measuresListCopy[i].userList[e.detail.value].USER_ID;
|
||||||
|
this.measuresListCopy[i].USER_NAME=this.measuresListCopy[i].userList[e.detail.value].NAME;
|
||||||
this.$forceUpdate();//强制刷新
|
this.$forceUpdate();//强制刷新
|
||||||
},
|
},
|
||||||
|
|
||||||
isBlankList(i) {
|
isBlankList(i) {
|
||||||
if (this.measuresList[i].userList.length == 0) {
|
if (this.measuresListCopy[i].userList.length == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '请先选择确认单位',
|
title: '请先选择确认单位',
|
||||||
|
@ -327,7 +391,7 @@
|
||||||
},
|
},
|
||||||
success: function(res){
|
success: function(res){
|
||||||
if("success" == res.data.result){
|
if("success" == res.data.result){
|
||||||
_this.measuresList[i].userList = res.data.userList;
|
_this.measuresListCopy[i].userList = res.data.userList;
|
||||||
}else{
|
}else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.message,
|
title: res.data.message,
|
||||||
|
@ -375,5 +439,19 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.measures{
|
||||||
|
padding-left: 16px;
|
||||||
|
padding-right: 16px;
|
||||||
|
.title{
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.content{
|
||||||
|
font-size: 14px;
|
||||||
|
color: #000000;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue