lm-safe-app/pages/apply/subPages/FO2/jobEventEdit1.vue

1188 lines
42 KiB
Vue
Raw Permalink Normal View History

2024-06-03 09:37:52 +08:00
<template>
<view>
<step-title :stepPage="stepsPage" :stepText="stepsText"></step-title>
<view class="page-wrap">
<view class="card" v-if="stepsPage === 0">
<u--form :model="dataModel" ref="wForm" labelWidth="auto" class="demo-ruleForm">
<view style="position: relative;">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息填写</view>
<u-form-item label="审核意见:" prop="CONTEXT" v-if="dataModel.FORM_STATUS==4">
</u-form-item>
<u--textarea v-html="dataModel.CONTEXT" border="surround" disabled v-if="dataModel.FORM_STATUS==4"></u--textarea>
<u-form-item label="编号" prop="CODE">
<u--input v-model="dataModel.CODE" placeholder="请输入编号" disabled fontSize="14px" disabledColor="#ffffff" border="none" inputAlign="right">
</u--input>
</u-form-item>
<u-form-item label="作业名称" prop="stepName">
<u--input v-model="dataModel.Nav_OperationStep.NAME" disabled fontSize="14px" disabledColor="#ffffff" placeholder="请输入作业名称" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="作业地点" prop="JOB_LOCATION">
<u--input v-model="dataModel.JOB_LOCATION" placeholder="请输入作业地点" fontSize="14px" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="开始时间" prop="JOB_DATE">
<u--input :value="startDate" placeholder="请输入作业时间" disabled fontSize="14px" disabledColor="#ffffff" border="none" inputAlign="right">
</u--input>
</u-form-item>
<u-form-item label="结束时间" prop="JOB_DATE">
<u--input :value="endDate" placeholder="请输入作业时间" disabled fontSize="14px" disabledColor="#ffffff" border="none" inputAlign="right">
</u--input>
</u-form-item>
</u--form>
</view>
<view v-if="stepsPage === 0" class="bottom-button">
<u-button type="primary" @click="stepAdd" color="#3d4b70">下一步</u-button>
</view>
<view class="sub-form" v-if="stepsPage === 1">
<view>
<u--form labelPosition="left" labelWidth="90px" ref="sForm" class="demo-ruleForm" size="mini">
<view class="form-sub-add" v-for="(item, index) in dataModel.Nav_JobEventPerson" :key="index">
<view>
<view style="position: relative;" v-if="index==0">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;padding-bottom: 10px;"
:style="index > 0?'border-top: #e7e6e4 1px solid;padding-top:10px':''">
<view style="font-size: 15px; font-weight: bold;color: #3d4b70;display: flex;flex-direction: row;align-items: center;">
作业人员信息
<u-badge :value="index+1" bgColor="#3d4b70" style="margin-left: 5px;"></u-badge>
<view v-if="index>0" style="margin-left: 10px;">
<view style="display: flex;align-items: center;" v-if="thisUser.indexOf(index)!==-1" @click="handleAddUserPush(index)">
<u-icon name="arrow-down"></u-icon>
</view>
<view style="display: flex;align-items: center;" v-if="thisUser.indexOf(index)==-1" @click="handleAddUserPush(index)">
<u-icon name="arrow-up"></u-icon>
</view>
</view>
</view>
<view style="font-size: 15px;align-items: center;" v-if="thisUser.indexOf(index)!==-1">
{{item['Nav_User'].NAME}}
</view>
<view v-if="index > 0" @click="handleDelRowBefore(index)" style="padding: 0px 0px 0px 20px;">
<u-icon name="trash" size="24" color="#3d4b70"></u-icon>
</view>
</view>
<view v-if="thisUser.indexOf(index)==-1">
<u-form-item label="人员姓名" prop="personName" @click="handleChangeUser(item['Nav_User'])">
<u--input disabled disabledColor="#fff" v-model="item['Nav_User'].NAME" placeholder="请选择人员姓名" suffixIcon="arrow-right" suffixIconStyle="font-size:12px" fontSize="14px"
customStyle="margin:0px;display:flex;padding:3px 9px" border="none">
</u--input>
</u-icon>
</u-form-item>
<u-form-item label="人员编号" prop="personNo">
<u--input disabledColor="#fff" fontSize="14px" placeholder="请选择人员姓名" customStyle="margin:0px;display:flex;padding:3px 9px" v-model="item['Nav_User'].CODE" border="none"></u--input>
</u-form-item>
<u-form-item label="部门" prop="job" style="padding-bottom: 10px;">
<u--input disabled disabledColor="#fff" v-model="item['Nav_User']['Nav_Department'].NAME" placeholder="请选择人员姓名" fontSize="14px" border="none"
customStyle="margin:0px;display:flex;padding:3px 9px;"></u--input>
</u-form-item>
</view>
</view>
</view>
<view style="display: flex;align-items: center;justify-content: center;border-top: #e7e6e4 1px solid;" @click="handleAddUser">
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_JobEventPerson.length == 1">添加作业人员信息</view>
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_JobEventPerson.length !== 1">继续添加作业人员信息</view>
</view>
</view>
</u--form>
</view>
</view>
<view style="display: flex;flex-direction: row;" v-if="stepsPage === 1" class="bottom-button">
<button type="default" @click="stepReduce" :plain="true"
style="margin-right: 5px;background-color: #fff;color: #3d4b70;width: 50%;height: 40px;display: flex;align-items: center;justify-content: center;font-size: 14px;">上一步</button>
<button type="default" @click="stepAddTwo"
style="margin-left: 5px;background-color: #3d4b70;color: #fff;width: 50%;height: 40px;display: flex;align-items: center;justify-content: center;font-size: 14px;">下一步</button>
</view>
<view class="sub-form" v-if="stepsPage === 2">
<u--form labelPosition="left" labelWidth="auto" ref="sForm" class="demo-ruleForm-thr" size="mini">
<view style="display: flex;flex-direction: column;">
<view class="form-sub-add" v-for="(item, index) in dataModel.Nav_Details" :key="index">
<view style="position: relative;" v-if="index==0">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="font-size: 15px; font-weight: bold;white-space: nowrap;color: #3d4b70;display: flex;flex-direction: row;align-items: center;margin-bottom: 10px;" v-if="index==0">
作业前确认
</view>
<view>
<u-form-item prop="NAME" :style="index ==0?'':'border-top: 1px solid #e7e6e4;'">
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;width: 100%;">
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="margin-right: 10px;">
<view style="display: flex;align-items: center;" v-if="thisIndex.indexOf(index)==-1" @click="handleAddDetailPush(index)">
<u-icon name="arrow-down"></u-icon>
</view>
<view style="display: flex;align-items: center;" v-if="thisIndex.indexOf(index)!==-1" @click="handleAddDetailPush(index)">
<u-icon name="arrow-up"></u-icon>
</view>
</view>
<u-badge :value="index+1" bgColor="#3d4b70" style="margin-right: 20px;"></u-badge>
<view style="font-size: 14px;align-items: center;overflow: hidden;text-overflow: ellipsis;" v-if="thisIndex.indexOf(index)==-1">
{{item.SafeConfirmsStr}}
</view>
</view>
<view style="display: flex;flex-direction: row;">
<view @click.stop="handleOkRowDetail(index)">
<u-icon name="checkmark-circle" size="20" color="#3C9CFF" v-if="dataModel.Nav_Details[index].IS_CONFIRM===false"></u-icon>
<u-icon name="checkmark-circle" size="20" color="#55aa00" v-if="dataModel.Nav_Details[index].IS_CONFIRM===true"></u-icon>
</view>
<view v-if="index == 0" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#c4c6c9"></u-icon>
</view>
<view v-if="index > 0" @click="handleDelRowBeforeDetail(index)" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#3d4b70"></u-icon>
</view>
</view>
</view>
</u-form-item>
<view v-if="thisIndex.indexOf(index)!==-1" style="position: relative;">
<u-form-item label="名称" prop="SafeConfirmsStr">
<u--textarea v-model="item.SafeConfirmsStr" placeholder="请输入名称" autoHeight></u--textarea>
<!-- <u--input disabledColor="#fff" v-model="item.SafeConfirmsStr" border="none" inputAlign="right" ></u--input> -->
</u-form-item>
<view style="display: flex;flex-direction: row;margin: 10px 0px;">
<view style="font-size: 14px;color: #8e8b9c;margin-right: 25px;margin-top: 5px;white-space: nowrap;">附件</view>
<view class="full-upload-border">
<full-upload v-model="item.Nav_Files"></full-upload>
</view>
</view>
</view>
</view>
</view>
<view style="display: flex;align-items: center;justify-content: center;border-top: #e7e6e4 1px solid;" @click="handleAddDetail">
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Details.length == 1">添加作业前确认</view>
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Details.length !== 1">继续添加作业前确认</view>
</view>
</view>
</view>
</u--form>
</view>
<view style="display: flex;flex-direction: row;" v-if="stepsPage === 2" class="bottom-button">
<u-button type="primary" @click="stepReduce" color="#3d4b70" :plain="true" style="margin-right: 5px;">上一步</u-button>
<u-button type="primary" @click="stepAddThree" color="#3d4b70" style="margin-left: 5px;">下一步</u-button>
</view>
<view class="sub-form" v-if="stepsPage === 3">
<view>
<u--form labelPosition="left" labelWidth="auto" ref="sForm" class="demo-ruleForm-thr" size="mini">
<view style="display: flex;flex-direction: column;">
<view class="form-sub-add" v-for="(item, index) in dataModel.Nav_Flow" :key="index">
<view style="position: relative;" v-if="index==0">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="font-size: 15px; font-weight: bold;white-space: nowrap;color: #3d4b70;display: flex;flex-direction: row;align-items: center;margin-bottom: 10px;" v-if="index==0">
作业流程及安全措施
</view>
<view>
<u-form-item prop="NAME" :style="index ==0?'':'border-top: 1px solid #e7e6e4;'">
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;width: 100%;">
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="margin-right: 10px;">
<view style="display: flex;align-items: center;" v-if="thisFluce.indexOf(index)==-1" @click="handleAddFlucePush(index)">
<u-icon name="arrow-down"></u-icon>
</view>
<view style="display: flex;align-items: center;" v-if="thisFluce.indexOf(index)!==-1" @click="handleAddFlucePush(index)">
<u-icon name="arrow-up"></u-icon>
</view>
</view>
<u-badge :value="index+1" bgColor="#3d4b70" style="margin-right: 20px;"></u-badge>
<view style="font-size: 14px;align-items: center;overflow: hidden;text-overflow: ellipsis;" v-if="thisFluce.indexOf(index)==-1">
{{item.SafeMeasuresStr}}
</view>
</view>
<view style="display: flex;flex-direction: row;">
<view @click.stop="handleOkRowFlow(index)">
<u-icon name="checkmark-circle" size="20" color="#3C9CFF" v-if="dataModel.Nav_Flow[index].IS_CONFIRM===false"></u-icon>
<u-icon name="checkmark-circle" size="20" color="#55aa00" v-if="dataModel.Nav_Flow[index].IS_CONFIRM===true"></u-icon>
</view>
<view v-if="index == 0" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#c4c6c9"></u-icon>
</view>
<view v-if="index > 0" @click="handleDelRowBeforeFlow(index)" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#3d4b70"></u-icon>
</view>
</view>
</view>
</u-form-item>
<view v-if="thisFluce.indexOf(index)!==-1" style="position: relative;">
<u-form-item label="名称" prop="SafeMeasuresStr">
<u--textarea v-model="item.SafeMeasuresStr" placeholder="请输入名称" autoHeight></u--textarea>
<!-- <u--input disabledColor="#fff" v-model="item.SafeConfirmsStr" border="none" inputAlign="right" ></u--input> -->
</u-form-item>
<view style="display: flex;flex-direction: row;margin: 10px 0px;">
<view style="font-size: 14px;color: #8e8b9c;margin-right: 25px;margin-top: 5px;white-space: nowrap;">附件</view>
<view class="full-upload-border">
<full-upload v-model="item.Nav_Files"></full-upload>
</view>
</view>
</view>
</view>
</view>
<view style="display: flex;align-items: center;justify-content: center;border-top: #e7e6e4 1px solid;" @click="handleAddFlow">
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Flow.length == 1">添加作业流程及安全措施</view>
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Flow.length !== 1">继续添加作业流程及安全措施</view>
</view>
</view>
</view>
</u--form>
</view>
</view>
<view style="display: flex;flex-direction: row;" v-if="stepsPage === 3" class="bottom-button">
<button type="default" @click="stepReduce" :plain="true"
style="margin-right: 5px;background-color: #fff;color: #3d4b70;width: 50%;height: 40px;display: flex;align-items: center;justify-content: center;font-size: 14px;">上一步</button>
<button type="default" @click="stepAddFour"
style="margin-left: 5px;background-color: #3d4b70;color: #fff;width: 50%;height: 40px;display: flex;align-items: center;justify-content: center;font-size: 14px;">下一步</button>
<!-- <u-button type="primary" @click="stepReduce" color="#3d4b70" :plain="true" style="margin-right: 5px;">上一步</u-button>
<u-button type="primary" @click="stepAddFour" color="#3d4b70" style="margin-left: 5px;">下一步</u-button> -->
</view>
<view class="sub-form" v-if="stepsPage === 4">
<view>
<u--form labelPosition="left" labelWidth="auto" ref="sForm" class="demo-ruleForm-thr" size="mini">
<view style="display: flex;flex-direction: column;">
<view class="form-sub-add" v-for="(item, index) in dataModel.Nav_Measure" :key="index">
<view style="position: relative;" v-if="index==0">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="font-size: 15px; font-weight: bold;white-space: nowrap;color: #3d4b70;display: flex;flex-direction: row;align-items: center;margin-bottom: 10px;" v-if="index==0">
作业后处理措施
</view>
<view>
<u-form-item prop="NAME" :style="index ==0?'':'border-top: 1px solid #e7e6e4;'">
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;width: 100%;">
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="margin-right: 10px;">
<view style="display: flex;align-items: center;" v-if="thisMeasure.indexOf(index)==-1" @click="handleAddMeasurePush(index)">
<u-icon name="arrow-down"></u-icon>
</view>
<view style="display: flex;align-items: center;" v-if="thisMeasure.indexOf(index)!==-1" @click="handleAddMeasurePush(index)">
<u-icon name="arrow-up"></u-icon>
</view>
</view>
<u-badge :value="index+1" bgColor="#3d4b70" style="margin-right: 20px;"></u-badge>
<view style="font-size: 14px;align-items: center;overflow: hidden;text-overflow: ellipsis;" v-if="thisMeasure.indexOf(index)==-1">
{{item.DealMeasuresStr}}
</view>
</view>
<view style="display: flex;flex-direction: row;">
<view @click.stop="handleOkRowDeal(index)">
<u-icon name="checkmark-circle" size="20" color="#3C9CFF" v-if="dataModel.Nav_Measure[index].IS_CONFIRM===false"></u-icon>
<u-icon name="checkmark-circle" size="20" color="#55aa00" v-if="dataModel.Nav_Measure[index].IS_CONFIRM===true"></u-icon>
</view>
<view v-if="index == 0" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#c4c6c9"></u-icon>
</view>
<view v-if="index > 0" @click="handleDelRowBeforeDeal(index)" style="padding: 0px 0px 0px 10px;">
<u-icon name="trash" size="24" color="#3d4b70"></u-icon>
</view>
</view>
</view>
</u-form-item>
<view v-if="thisMeasure.indexOf(index)!==-1" style="position: relative;">
<u-form-item label="名称" prop="SafeMeasuresStr">
<u--textarea v-model="item.DealMeasuresStr" placeholder="请输入名称" autoHeight></u--textarea>
<!-- <u--input disabledColor="#fff" v-model="item.SafeConfirmsStr" border="none" inputAlign="right" ></u--input> -->
</u-form-item>
<view style="display: flex;flex-direction: row;margin: 10px 0px;">
<view style="font-size: 14px;color: #8e8b9c;margin-right: 25px;margin-top: 5px;white-space: nowrap;">附件</view>
<view class="full-upload-border">
<full-upload v-model="item.Nav_Files"></full-upload>
</view>
</view>
</view>
</view>
</view>
<view style="display: flex;align-items: center;justify-content: center;border-top: #e7e6e4 1px solid;" @click="handleAddDeal">
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Measure.length == 1">添加作业后处理措施</view>
<view style="font-size: 16px;color: #3d4b70;font-weight: bold;padding: 15px 0px;" v-if="this.dataModel.Nav_Measure.length !== 1">继续添加作业后处理措施</view>
</view>
</view>
</view>
</u--form>
</view>
</view>
<view style="display: flex;flex-direction: row;" v-if="stepsPage === 4" class="bottom-button">
<u-button type="primary" @click="stepReduce" color="#3d4b70" :plain="true" style="margin-right: 5px;">上一步</u-button>
<u-button type="primary" @click="submit" color="#3d4b70" style="margin-left: 5px;">提交</u-button>
</view>
<query-selector :show="showPopup" :total="curTotal" :lists="userLists" :defaultValue="currentOperateUser.NAME" @close="handleClosePopup" @search="handleSearchUser" @select="handleSelectedUser" />
<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" title="确认删除?" showCancelButton @cancel="cancelDel"></u-modal>
<u-modal :show="showDelModalDetail >= 0" @confirm="confirmDelDetail" title="确认删除?" showCancelButton @cancel="cancelDelDetail"></u-modal>
<u-modal :show="showDelModalFlow >= 0" @confirm="confirmDelFlow" title="确认删除?" showCancelButton @cancel="cancelDelFlow"></u-modal>
<u-modal :show="showDelModalDeal >= 0" @confirm="confirmDelDeal" title="确认删除?" showCancelButton @cancel="cancelDelDeal"></u-modal>
<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="closePicker" @cancel="closePicker" keyName="NAME"></u-picker>
<!-- <view class="bottom-button">
<button type="primary" @click="submit">提交</button>
</view> -->
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations
} from 'vuex'
import {
extendFilterGroup,
extendGroupRule,
extendInclude,
extendOrder,
extendRule,
guid,
initFilter,
initFilterGroup,
extendIgnoreDataRule
} from '../../../../utils/common'
import {
getRequest,
getUserLists,
saveJobEventRecord
} from '../../../../services/apply/FOServices/FOServices.js'
import config from '../../../../config/common'
import stepTitle from '@/components/custom/step-title.vue'
export default {
components: {
stepTitle,
},
data() {
return {
stepsPage: 0,
stepsText: ['基本信息', '作业人员', '作业前', '作业中', '作业后'],
ID: '',
tableKey: 0,
curTotal: 0,
showDelModalIndex: undefined,
showDelModalDetail: undefined,
showDelModalFlow: undefined,
showDelModalDeal: undefined,
isLoadOK: false,
userLists: [],
startDate: '',
endDate: '',
thisUser: [],
thisIndex: [],
thisFluce: [],
thisMeasure: [],
dataModel: {
CODE: '',
Nav_OperationStep: {},
JOB_LOCATION: '',
JOB_DATE: '',
Nav_JobEventPerson: {
Nav_User: {
NAME: '',
CODE: '',
Nav_Department: {
NAME: ''
}
}
}
},
subDataModel: {
Nav_JobEventPerson: {
Nav_User: {
NAME: '',
CODE: '',
Nav_Department: {
NAME: ''
}
}
},
Nav_User: {
Nav_Department: {
NAME: ''
},
NAME: '',
CODE: '',
},
Nav_Details: {
NUM: 0,
SafeConfirmsStr: '',
IS_CONFIRM: false,
IS_CONFIRM_SHOW: '否',
Nav_Files: []
},
Nav_Flow: {
NUM: 0,
SafeMeasuresStr: '',
IS_CONFIRM: false,
IS_CONFIRM_SHOW: '否',
Nav_Files: []
},
Nav_Measure: {
NUM: 0,
DealMeasuresStr: '',
IS_CONFIRM: false,
IS_CONFIRM_SHOW: '否',
Nav_Files: []
}
},
options: [{
text: '删除',
style: {
backgroundColor: '#f56c6c'
}
}],
rules: {
'JOB_LOCATION': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'JOB_DATE': {
type: 'string',
required: true,
trigger: ['blur', 'change']
}
},
comPickerInfo: {
showSheet: false,
columns: [],
title: '',
dataIndex: undefined,
formIndex: undefined,
name: ''
},
currentOperateUser: {},
showPopup: false,
TaskID: '',
}
},
onLoad(opt) {
this.handleGetJobEventGet(opt)
},
methods: {
handleAddDetailPush(index) {
if (this.thisIndex.indexOf(index) == -1) {
this.thisIndex.push(index)
} else {
this.thisIndex = this.thisIndex.filter(item => item != index)
}
},
handleAddUserPush(index) {
if (this.thisUser.indexOf(index) == -1) {
this.thisUser.push(index)
} else {
this.thisUser = this.thisUser.filter(item => item != index)
}
},
handleAddFlucePush(index) {
if (this.thisFluce.indexOf(index) == -1) {
this.thisFluce.push(index)
} else {
this.thisFluce = this.thisFluce.filter(item => item != index)
}
},
handleAddMeasurePush(index) {
if (this.thisMeasure.indexOf(index) == -1) {
this.thisMeasure.push(index)
} else {
this.thisMeasure = this.thisMeasure.filter(item => item != index)
}
},
stepAdd() {
if (this.dataModel.JOB_LOCATION == '' || this.dataModel.JOB_LOCATION == undefined || this.dataModel.JOB_LOCATION == null) {
uni.$showErrorInfo('请检查作业地点,不能为空')
return
}
this.stepsPage = this.stepsPage + 1
},
stepAddTwo() {
let numA = 0;
this.dataModel.Nav_JobEventPerson.map((item) => {
if (item['Nav_User'].NAME == '') {
return
}
numA = numA + 1
})
if (numA == this.dataModel.Nav_JobEventPerson.length) {
this.stepsPage = this.stepsPage + 1
} else {
uni.$showErrorInfo('作业人员不能为空')
}
},
stepAddThree() {
let numA = 0;
let numB = 0;
this.dataModel.Nav_Details.map((item) => {
if (item.SafeConfirmsStr == '') {
return
}
numA = numA + 1
})
this.dataModel.Nav_Details.map((item) => {
if (item.IS_CONFIRM == false) {
return
}
numB = numB + 1
})
if (numA !== this.dataModel.Nav_Details.length) {
uni.$showErrorInfo('添加作业前确认信息不能为空')
} else if (numB !== this.dataModel.Nav_Details.length) {
uni.$showErrorInfo('作业前安全未全部确认')
} else {
this.stepsPage = this.stepsPage + 1
}
},
stepAddFour() {
let numA = 0;
let numB = 0;
this.dataModel.Nav_Flow.map((item) => {
if (item.SafeMeasuresStr == '') {
return
}
numA = numA + 1
})
this.dataModel.Nav_Flow.map((item) => {
if (item.IS_CONFIRM == '') {
return
}
numB = numB + 1
})
if (numA !== this.dataModel.Nav_Flow.length) {
uni.$showErrorInfo('添加作业流程及安全措施信息不能为空')
} else if (numB !== this.dataModel.Nav_Flow.length) {
uni.$showErrorInfo('作业流程及安全措施未全部确认')
} else {
this.stepsPage = this.stepsPage + 1
}
},
stepReduce() {
this.stepsPage = this.stepsPage - 1
},
handleGetJobEventGet(opt) {
this.TaskID = opt.taskID ? opt.taskID : '';
this.ID = opt.ID ? opt.ID : '';
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "")
extendRule(json, 'ID', 1, opt.ID)
// extendInclude(json, 'Nav_Meeting');
// extendInclude(json, 'Nav_CreateUser');
// extendInclude(json, 'Nav_OperationStep');
// extendInclude(json, 'Nav_JobEventPerson');
// extendInclude(json, 'Nav_JobEventPerson.Nav_User.Nav_Department');
// extendInclude(json, 'Nav_JobEventPerson.Nav_User.Nav_UserSignFiles.Nav_ImgFile.Nav_File');
// extendInclude(json, 'Nav_Details.Nav_Files.Nav_ImgFile.Nav_File');
// extendInclude(json, 'Nav_Flow.Nav_Files.Nav_ImgFile.Nav_File');
// extendInclude(json, 'Nav_Measure.Nav_Files.Nav_ImgFile.Nav_File');
// extendIgnoreDataRule(json)
// TODO: id 未获取
getRequest(json, "/FO/FOJobEventRecord/GetEdit").then(res => {
this.dataModel = res
if (res.JOB_DATE.indexOf("-")) {
let index = res.JOB_DATE.indexOf("-");
this.startDate = res.JOB_DATE.substring(0, index)
this.endDate = res.JOB_DATE.substring(index + 1, res.JOB_DATE.length)
let jobDate = res.JOB_DATE.replace("-", "<br/>")
res.JOB_DATE = jobDate
}
//数据组装
let strUserName = ''
if (res.Nav_JobEventPerson && res.Nav_JobEventPerson.length > 0) {
for (let i = 0; i < res.Nav_JobEventPerson.length; i++) {
if (res.Nav_JobEventPerson[i].DEAL_STATUS == 0) {
strUserName += (strUserName.length > 0 ? "&nbsp;&nbsp;" : "") + "<text style='color:red'>" +
res.Nav_JobEventPerson[i].Nav_User.NAME + "</text>";
} else {
let user = res.Nav_JobEventPerson[i].USER_ID != null ? res.Nav_JobEventPerson[i].Nav_User.NAME : '';
strUserName += (strUserName.length > 0 ? "&nbsp;&nbsp;" : "") + user;
}
}
}
//数据组装
if (res.Nav_Details && res.Nav_Details.length > 0) {
for (let i = 0; i < res.Nav_Details.length; i++) {
res.Nav_Details[i].NUM = i + 1;
if (res.Nav_Details[i].IS_CONFIRM == true) {
res.Nav_Details[i].IS_CONFIRM = true
res.Nav_Details[i].IS_CONFIRM_SHOW = "是"
} else {
res.Nav_Details[i].IS_CONFIRM = false
res.Nav_Details[i].IS_CONFIRM_SHOW = "否"
}
}
}
//数据组装
if (res.Nav_Flow && res.Nav_Flow.length > 0) {
for (let i = 0; i < res.Nav_Flow.length; i++) {
res.Nav_Flow[i].NUM = i + 1;
if (res.Nav_Flow[i].IS_CONFIRM == true) {
res.Nav_Flow[i].IS_CONFIRM = true
res.Nav_Flow[i].IS_CONFIRM_SHOW = "是"
} else {
res.Nav_Flow[i].IS_CONFIRM_SHOW = "否"
res.Nav_Flow[i].IS_CONFIRM = false
}
}
}
//数据组装
if (res.Nav_Measure && res.Nav_Measure.length > 0) {
for (let i = 0; i < res.Nav_Measure.length; i++) {
res.Nav_Measure[i].NUM = i + 1;
if (res.Nav_Measure[i].IS_CONFIRM == true) {
res.Nav_Measure[i].IS_CONFIRM = true
res.Nav_Measure[i].IS_CONFIRM_SHOW = "是"
} else {
res.Nav_Measure[i].IS_CONFIRM = false
res.Nav_Measure[i].IS_CONFIRM_SHOW = "否"
}
}
}
this.dataModel.UserNames = strUserName
this.isLoadOK = true
})
},
async handleShowSheet(p) {
let column = []
if (p.name === 'IS_CONFIRM_SAFE' || p.name === 'IS_CONFIRM_MEAS' || p.name === 'IS_CONFIRM_DEAL') {
column = [{
NAME: '否',
ID: false
},
{
NAME: '是',
ID: true
}
]
}
if (column.length) {
this.comPickerInfo = {
showSheet: true,
title: p.title,
name: p.name,
dataIndex: p.index,
formIndex: p.formIndex,
columns: [column]
}
} else {
// 暂无数据
}
},
valChangeDetail(e) {
// this.dataModel.Nav_Details[index].NUM=e.value;
},
valChangeFlow(e) {
// this.dataModel.Nav_Flow[index].NUM=e.value;
},
valChangeDeal(e) {
// this.dataModel.Nav_Measure[index].NUM=e.value;
},
handleOkRowDetail(index) {
// this.dataModel.Nav_Details[index].IS_CONFIRM=true;
this.dataModel.Nav_Details[index].IS_CONFIRM = true;
this.dataModel.Nav_Details[index].IS_CONFIRM_SHOW = "是";
let column = [{
NAME: '是',
ID: true
}]
this.comPickerInfo = {
name: "是",
dataIndex: index,
columns: [column]
}
},
handleOkRowFlow(index) {
this.dataModel.Nav_Flow[index].IS_CONFIRM = true;
this.dataModel.Nav_Flow[index].IS_CONFIRM_SHOW = "是";
let column = [{
NAME: '是',
ID: true
}]
this.comPickerInfo = {
name: "是",
dataIndex: index,
columns: [column]
}
},
handleOkRowDeal(index) {
this.dataModel.Nav_Measure[index].IS_CONFIRM_SHOW = "是";
this.dataModel.Nav_Measure[index].IS_CONFIRM = true;
let column = [{
NAME: '是',
ID: true
}]
this.comPickerInfo = {
name: "是",
dataIndex: index,
columns: [column]
}
},
handleAddUser() {
const persons = JSON.parse(JSON.stringify(this.subDataModel.Nav_JobEventPerson))
this.dataModel.Nav_JobEventPerson.push(persons)
},
handleAddDetail() {
const persons = JSON.parse(JSON.stringify(this.subDataModel.Nav_Details))
this.dataModel.Nav_Details.push(persons)
// this.dataModel.Nav_Details.unshift(this.subDataModel.Nav_Details)
},
handleAddFlow() {
const persons = JSON.parse(JSON.stringify(this.subDataModel.Nav_Flow))
this.dataModel.Nav_Flow.push(persons)
// this.dataModel.Nav_Flow.unshift(this.subDataModel.Nav_Flow)
},
handleAddDeal() {
const persons = JSON.parse(JSON.stringify(this.subDataModel.Nav_Measure))
this.dataModel.Nav_Measure.push(persons)
// this.dataModel.Nav_Measure.unshift(this.subDataModel.Nav_Measure)
},
handleDelRowBefore(index) {
this.showDelModalIndex = index
},
handleDelRowBeforeDetail(index) {
this.showDelModalDetail = index
},
handleDelRowBeforeFlow(index) {
this.showDelModalFlow = index
},
handleDelRowBeforeDeal(index) {
this.showDelModalDeal = index
},
confirmDel() {
this.dataModel.Nav_JobEventPerson.splice(this.showDelModalIndex, 1)
this.showDelModalIndex = undefined
},
confirmDelDetail() {
this.dataModel.Nav_Details.splice(this.showDelModalDetail, 1)
this.showDelModalDetail = undefined
},
confirmDelFlow() {
this.dataModel.Nav_Flow.splice(this.showDelModalFlow, 1)
this.showDelModalFlow = undefined
},
confirmDelDeal() {
this.dataModel.Nav_Measure.splice(this.showDelModalDeal, 1)
this.showDelModalDeal = undefined
},
cancelDel() {
// this.dataModel.Nav_JobEventPerson.splice(this.showDelModalIndex, 1)
this.showDelModalIndex = undefined
},
cancelDelDetail() {
// this.dataModel.Nav_Details.splice(this.showDelModalDetail, 1)
this.showDelModalDetail = undefined
},
cancelDelFlow() {
// this.dataModel.Nav_Flow.splice(this.showDelModalFlow, 1)
this.showDelModalFlow = undefined
},
cancelDelDeal() {
// this.dataModel.Nav_Measure.splice(this.showDelModalDeal, 1)
this.showDelModalDeal = undefined
},
handleSearchUser(val, pageIndex) {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "NAME", '', pageIndex)
extendInclude(json, "Nav_Department")
extendRule(json, 'ENABLE_STATUS', 1, '0')
if (val !== 'init') {
const tempGroup = initFilterGroup(false);
extendGroupRule(tempGroup, 'NAME', 9, val)
extendFilterGroup(json, tempGroup);
}
json.Limit = 20
if (pageIndex) {
json.Start = (pageIndex - 1) * 20;
}
getUserLists(json).then(res => {
if (res.IsSuccessful) {
this.userLists = res.Data.map(i => {
return {
...i,
name: i.NAME,
code: i.CODE
}
})
this.curTotal = res.TotalCount
}
})
},
handleSelectedUser(val) {
let numc = 0;
this.dataModel.Nav_JobEventPerson.map((item) => {
if (item.USER_ID == val.ID) {
numc = numc + 1
return
}
})
if (numc == 1) {
this.showPopup = false
uni.$showErrorInfo('不能选择相同的作业人员')
return
}
this.showPopup = false
this.currentOperateUser.CODE = val.CODE
this.lists = []
const result = this.dataModel.Nav_JobEventPerson.map((obj) => {
const {
Nav_User
} = obj
if (Nav_User.CODE === this.currentOperateUser.CODE) {
return Object.assign({}, obj, {
Nav_User: val,
USER_ID: val.ID,
})
}
return obj
})
this.dataModel.Nav_JobEventPerson = result
},
handleClosePopup() {
this.showPopup = false
},
handleChangeUser(user) {
this.currentOperateUser = user
this.showPopup = true
this.handleSearchUser('init')
},
onConfirmPicker(e) {
const {
name,
dataIndex,
formIndex
} = this.comPickerInfo
if (formIndex === "sForm1") {
const result = this.dataModel.Nav_JobEventPerson.map((obj, index) => {
if (index === dataIndex) {
return Object.assign({}, obj, {
// ATTEND_STATUS: e.value[0].ID,
})
}
return obj
})
this.dataModel.Nav_JobEventPerson = result
} else {
}
if (name === "IS_CONFIRM_SAFE") {
this.dataModel.Nav_Details[dataIndex].IS_CONFIRM = e.value[0].ID
this.dataModel.Nav_Details[dataIndex].IS_CONFIRM_SHOW = e.value[0].NAME
}
if (name === "IS_CONFIRM_MEAS") {
this.dataModel.Nav_Flow[dataIndex].IS_CONFIRM = e.value[0].ID
this.dataModel.Nav_Flow[dataIndex].IS_CONFIRM_SHOW = e.value[0].NAME
}
if (name === "IS_CONFIRM_DEAL") {
this.dataModel.Nav_Measure[dataIndex].IS_CONFIRM = e.value[0].ID
this.dataModel.Nav_Measure[dataIndex].IS_CONFIRM_SHOW = e.value[0].NAME
}
this.comPickerInfo.showSheet = false
},
closePicker() {
this.comPickerInfo = {
showSheet: false,
columns: [],
title: '',
name: '',
dataIndex: undefined,
formIndex: undefined
}
},
handleDelAction({
name
}) {
uni.showModal({
title: '是否删除数据?',
success: (res) => {
if (res.confirm) {
}
}
})
},
submit() {
let numA = 0;
let numB = 0;
this.dataModel.Nav_Measure.map((item) => {
if (item.DealMeasuresStr == '') {
return
}
numA = numA + 1
})
this.dataModel.Nav_Measure.map((item) => {
if (item.IS_CONFIRM == '') {
return
}
numB = numB + 1
})
if (numA !== this.dataModel.Nav_Measure.length) {
uni.$showErrorInfo('添加作业后处理措施不能为空')
} else if (numB !== this.dataModel.Nav_Measure.length) {
uni.$showErrorInfo('作业后处理措施未全部确认')
} else {
this.dataModel.PUBLISH = "SaveAndNotify";
this.dataModel.TaskID = this.TaskID;
this.dataModel.ID = this.ID;
this.dataModel.ORG_ID = uni.getStorageSync('orgId')
if (this.dataModel.JOB_DATE.indexOf("<br/>")) {
let jobDate = this.dataModel.JOB_DATE.replace("<br/>", "-")
this.dataModel.JOB_DATE = jobDate
}
const resultDetail = this.dataModel.Nav_Details.map((obj, index) => {
let navFiles = [];
obj.Nav_Files.map(item => {
navFiles.push({
IMG_FILE_ID: item.responseText.imgFileID,
T_FO_JOB_EVENT_MEASURE_ID: obj.ID,
ORG_ID: uni.getStorageSync('orgId')
})
})
// if (obj.IS_CONFIRM === "是") {
// return Object.assign({}, obj, {
// IS_CONFIRM: true,
// Nav_Files:navFiles
// })
// }
// else
// {
return Object.assign({}, obj, {
IS_CONFIRM: obj.IS_CONFIRM,
Nav_Files: navFiles
})
// }
return obj
})
this.dataModel.Nav_Details = resultDetail
const resultFlow = this.dataModel.Nav_Flow.map((obj, index) => {
let navFiles = [];
obj.Nav_Files.map(item => {
navFiles.push({
IMG_FILE_ID: item.responseText.imgFileID,
T_FO_JOB_EVENT_MEASURE_ID: obj.ID,
ORG_ID: uni.getStorageSync('orgId')
})
})
// if (obj.IS_CONFIRM === "是") {
// return Object.assign({}, obj, {
// IS_CONFIRM: true,
// Nav_Files:navFiles
// })
// }
// else
// {
return Object.assign({}, obj, {
IS_CONFIRM: obj.IS_CONFIRM,
Nav_Files: navFiles
})
// }
return obj
})
this.dataModel.Nav_Flow = resultFlow
const resultDeal = this.dataModel.Nav_Measure.map((obj, index) => {
let navFiles = [];
obj.Nav_Files.map(item => {
navFiles.push({
IMG_FILE_ID: item.responseText.imgFileID,
T_FO_JOB_EVENT_MEASURE_ID: obj.ID,
ORG_ID: uni.getStorageSync('orgId')
})
})
// if (obj.IS_CONFIRM === "是") {
// return Object.assign({}, obj, {
// IS_CONFIRM: true,
// Nav_Files:navFiles
// })
// }
// else
// {
return Object.assign({}, obj, {
IS_CONFIRM: obj.IS_CONFIRM,
Nav_Files: navFiles
})
// }
return obj
})
this.dataModel.Nav_Measure = resultDeal
saveJobEventRecord(this.dataModel).then(res => {
uni.$showMsgFunc('操作成功!', () => {
// if (this.tableKey == null || this.tableKey == 0) {
// uni.navigateTo({
// url: 'jobEventRecord'
// })
// } else {
uni.switchTab({
url: '/pages/index/index2'
})
// }
}, 'success', 1000)
})
}
},
uploadFilePromise(url) {
const appInfoData = uni.getStorageSync('appInfo')
const userId = appInfoData?.User?.ID || ''
const orgId = uni.getStorageSync('orgId')
const tenant = uni.getStorageSync('Tenant') || ''
const remoteUrl = config.serviceHost('/PF/File/UploadFile')
return new Promise((resolve, reject) => {
uni.uploadFile({
url: remoteUrl,
filePath: url,
fileList: url,
name: 'file',
formData: {
OrgId: orgId
},
header: {
Tenant: tenant,
userid: userId
},
success: (res) => {
if (res.statusCode === 200) {
const uploadResult = JSON.parse(res.data)
if (uploadResult.IsSuccessful) {
resolve(uploadResult.Data)
}
}
}
});
})
},
}
}
</script>
<style scoped>
.page-wrap {
/* padding: 16px 16px 66px; */
}
.card {
margin: 20px 16px 10px 16px;
padding: 20px 30px 10px 30px;
background-color: #ffffff;
border-radius: 10px;
}
.sub-form {
margin: 20px 16px 180px 16px;
padding: 20px 30px 10px 30px;
background-color: #ffffff;
border-radius: 10px;
}
.sub-form-btn {
margin-bottom: 8px;
display: flex;
flex-direction: row;
}
.bottom-button {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 10px 16px;
box-sizing: border-box;
background: #edf1fd;
z-index: 999;
}
.upload-title {
color: #303133;
font-size: 15px;
line-height: 22px;
padding: 8px 0;
}
.sub-form>>>.u-textarea {
padding: 9px 9px 25px 9px;
margin-left: 20px;
}
.demo-ruleForm-thr>>>.u-form-item__body__left__content__label {
font-size: 14px;
color: #8e8b9c;
margin-right: 20px;
/* justify-content: flex-start; */
}
.demo-ruleForm-thr>>>.u-form-item__body__left__content__ {
left: -11px;
top: 0px
}
.demo-ruleForm-thr>>>.u-textarea__field {
font-size: 14px;
}
.demo-ruleForm-thr>>>.u-cell__title-text {
font-size: 14px;
}
/* .page-wrap>>>.u-upload__button {
margin-bottom: 0;
} */
.demo-ruleForm>>>.u-form-item__body__left__content__label {
font-size: 14px;
color: #8e8b9c;
/* justify-content: flex-start; */
}
.demo-ruleForm>>>.u-form-item__body__left__content__ {
left: -11px;
top: 0px
}
.demo-ruleForm>>>.u-textarea__field {
font-size: 14px;
}
.demo-ruleForm>>>.u-cell__title-text {
font-size: 14px;
}
.collapse-title {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.collapse-title .down {
width: 20px;
flex: 0 0 auto;
}
.collapse-title .text {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
flex: 1;
width: calc(100% - 60px);
}
.collapse-title .action {
width: 60px;
flex: 0 0 auto;
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.page-wrap>>>.u-upload__button {
margin-bottom: 0;
}
</style>