jy-safe-app/pages/apply/subPages/SK/riskRectifyEdit.vue

811 lines
27 KiB
Vue
Raw Permalink Normal View History

2025-10-14 15:17:30 +08:00
<template>
<view class="todo-page">
<step-title :stepPage="stepsPage" :stepText="stepsText"></step-title>
<view class="allview">
<view class="card" v-if="stepsPageList === 0">
<u--form labelWidth="auto" :model="dataModel" ref="wForm" 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="Product_Unit" @click="handleChangeUnit()">
<u--input v-model="dataModel.Product_Unit" disabled disabledColor="#ffffff" placeholder="请选择生产单元" border="none" inputAlign="right" fontSize="14px">
</u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u-form-item label="检查类型:" prop="Check_Type" @click="handleChangeType()">
<u--input v-model="dataModel.Check_Type" disabled disabledColor="#ffffff" placeholder="请选择检查类型" border="none" inputAlign="right" fontSize="14px"></u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u-form-item label="检查周期:" prop="Check_Period" @click="handleChangePeriod()">
<u--input v-model="dataModel.Check_Period" disabledColor="#ffffff" placeholder="请选择检查周期" border="none" inputAlign="right" fontSize="14px"></u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u-form-item label="检查层级:" prop="Check_Level" @click="handleChangeLevel()">
<u--input v-model="dataModel.Check_Level" disabled disabledColor="#ffffff" placeholder="请选择检查层级" border="none" inputAlign="right" fontSize="14px">
</u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u-form-item label="检查时间:" prop="Check_Date" @click="handleChangeDate()">
<u--input v-model="dataModel.Check_Date" disabled disabledColor="#ffffff" placeholder="请选择检查时间" border="none" inputAlign="right" fontSize="14px">
</u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<view class="upload-title">附件</view>
<full-upload v-model="dataModel.Nav_RectifyFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
</u--form>
</view>
<view style="padding: 10px 16px;" v-if="stepsPageList === 0" class="bottom-button">
<u-button type="primary" @click="stepAdd" color="#3d4b70">下一步</u-button>
</view>
<view class="card" v-if="stepsPageList === 1">
<u--form labelWidth="auto" :model="dataModel" ref="wForm" class="sub-form" :rules="rules">
<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;margin-top: 20px;">检查内容</view>
<view v-for="(item,index) in dataModel.Nav_RectifyDetails" :key="index" style="border-bottom: #ceccca 1px solid;margin-bottom: 10px;padding-bottom: 10px;">
<u-form-item>
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;flex: 1;">
<view style="flex: 1;" @click="handleChangeArea('Area',[index])">
{{index+1+'.'+'区域:'+item.Nav_RiskArea.NAME}}
</view>
<view class="action" style="display: flex;flex-direction: row;align-items: center;justify-content: space-around;">
<u-icon @click="handleDelRowBefore(index)" name="trash" color="#ff4d4f" size="21" style="margin-right: 20px;"></u-icon>
<u-icon name="arrow-up" size="12" v-if="item.showPack" @click="handlePack(index)"></u-icon>
<u-icon name="arrow-down" size="12" v-if="!item.showPack" @click="handlePack(index)"></u-icon>
</view>
</view>
<view></view>
</u-form-item>
<view v-if="item.showPack==true">
<u-form-item label="隐患描述" @click="handleChangeArea('Description',[index])">
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u--textarea v-model="item.Nav_Question.DESCREPTION" disabled placeholder="请选择隐患描述" maxlength="-1"></u--textarea>
<u-form-item label="隐患描述" prop="HIDDEN_DESCRIPTION" border-bottom>
<u--input v-model="item.HIDDEN_DESCRIPTION" placeholder="请填写隐患描述" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="隐患等级" prop="HIDDEN_LEVEL" @click="handleChangeRiskLevel(index)" border-bottom>
<u--input v-model="item.HIDDEN_LEVEL" disabled placeholder="请选择隐患等级" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px"
border="none">
</u--input>
</u-form-item>
<u-form-item label="隐患地点" prop="HIDDEN_PLACE" border-bottom>
<u--input v-model="item.HIDDEN_PLACE" placeholder="请填写隐患地点" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="整改措施" prop="HIDDEN_PLACE" border-bottom>
<u--input v-model="item.RECTIFICATION_MEASURES" placeholder="请填写整改措施" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="整改期限" prop="HIDDEN_PLACE" border-bottom @click="handleChangeRecitify(index)">
<u--input v-model="item.RECITIFY_TIME" disabled placeholder="请选择整改期限" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u-form-item label="整改落实人" prop="HIDDEN_PLACE" @click="handleChangeMonitor('ImplementUser',index)" border-bottom>
<u--input v-model="item.Nav_ImplementUser.NAME" placeholder="请选择整改落实人" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabled disabledColor="#ffffff" inputAlign="right"
fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="验收人" prop="HIDDEN_PLACE" @click="handleChangeMonitor('AcceptUser',index)" border-bottom>
<u--input v-model="item.Nav_AcceptUser.NAME" placeholder="请选择验收人" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabled disabledColor="#ffffff" inputAlign="right"
fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="隐患照片" prop="CHECKSTANDARD">
</u-form-item>
<full-upload v-model="item.Nav_RectifyDetailFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
</view>
</view>
<u-form-item @click="handleNewCheckContent">
<u-button text="新增检查区域" type="primary"></u-button>
</u-form-item>
</u--form>
</view>
<view style="padding: 10px 16px;display: flex;flex-direction: row;" v-if="stepsPageList === 1" 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>
<u-picker :show="showPopupUnit" :columns="UnitLists" @confirm="confirmUnit" @cancel="cancelUnit" :defaultIndex="UnitDefaultIndex"></u-picker>
<u-picker :show="showPopupRiskLevel" :columns="RiskLevel" @confirm="confirmRiskLevel" @cancel="cancelRiskLevel" :defaultIndex="RiskLevelDefaultIndex"></u-picker>
<u-picker :show="showPopupType" :columns="TypeLists" @confirm="confirmType" @cancel="cancelType" :defaultIndex="TypeDefaultIndex"></u-picker>
<u-picker :show="showPopupPeriod" :columns="PeriodLists" @confirm="confirmPeriod" @cancel="cancelPeriod" :defaultIndex="PeriodDefaultIndex"></u-picker>
<u-picker :show="showPopupLevel" :columns="LevelLists" @confirm="confirmLevel" @cancel="cancelLevel" :defaultIndex="LevelDefaultIndex"></u-picker>
<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" @cancel="cacelDel" :showCancelButton="true" title="确认删除?"></u-modal>
<u-datetime-picker :show="showPopupDate" v-model="dateTime" mode="date" @confirm="confirmDate" @cancel="cancelDate"></u-datetime-picker>
<u-datetime-picker :show="showPopupRecitifyDate" v-model="dateRecitifyTime" mode="date" @confirm="confirmRecitifyDate" @cancel="cancelRecitifyDate"></u-datetime-picker>
<people-selector :defaultChecked="peopleSelectOption.defaultChecked" :show="peopleSelectOption.showSelector" @select="handleSelectorPeople" @close="peopleSelectOption.showSelector = false">
</people-selector>
<query-selector :show="showPopupMonitor" :total="curTotalMonitor" :lists="monitorLists" :defaultValue="currentOperateMonitor.NAME" @close="handleClosePopupMonitor" @search="handleSearchMonitor"
@select="handleSelectedMonitor" />
<query-selector :show="showPopupArea" :total="curTotalArea" :lists="areaLists" :defaultValue="currentOperateArea.NAME" @close="handleClosePopupArea" @search="handleSearchArea" @select="handleSelectedArea" />
</view>
</view>
</template>
<script>
import {
extendFilterGroup,
extendGroupRule,
extendInclude,
extendOrder,
extendRule,
extendIgnoreDataRule,
guid,
initFilter,
initFilterGroup
} from '../../../../utils/common'
import {
FMProductionUnit,
CheckPeriods,
CheckLevels,
MineTypeIndex,
MineTypeName
} from '../../../../utils/enums.js'
import {
GetCheckContentsInfo,
GetDangerRectifyReport,
DangerRectifyFullUpdate,
GetRiskAreaInfo,
GetHiddenScripList,
getUserLists,
CheckTypeNewOrderPaged
} from '../../../../services/apply/subPages/SK/SKServices.js'
import {
getRequest,
} from '../../../../services/apply/FOServices/FOServices';
import stepTitle from '@/components/custom/step-title.vue'
import swipeActionItem from '../../../../uni_modules/uview-ui/libs/config/props/swipeActionItem';
export default {
components: {
stepTitle,
},
data() {
return {
showDelModalIndex: undefined,
showDelModalIndex1: undefined,
subsectionList: ['入库', '不入库', ],
radiolist1: [{
name: '是',
disabled: false
}, {
name: '否',
disabled: false
}],
curNow: 1,
RiskLevel: ['一般', '重大'],
showPopupUnit: false,
UnitDefaultIndex: [0],
showPopupRiskLevel: false,
RiskLevelDefaultIndex: [0],
UnitLists: [],
TypeLists: [],
showPopupType: false,
TypeDefaultIndex: [0],
PeriodLists: [],
showPopupPeriod: false,
PeriodDefaultIndex: [0],
LevelLists: [],
showPopupStep: false,
showPopupArea: false,
showPopupLevel: false,
curTotalStep: 0,
curTotalArea: 0,
stepLists: [],
areaLists: [],
LevelDefaultIndex: [0],
showPopupDate: false,
showPopupRecitifyDate: false,
listPropUpload: ['NOTIFY_ID'],
listPropValUpload: [],
ORG_ID: uni.getStorageSync('orgId'),
rules: {
'userInfo.name': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
},
'userInfo.sex': {
type: 'string',
max: 1,
required: true,
message: '请选择男或女',
trigger: ['blur', 'change']
},
},
dataModel: {
Nav_RectifyFiles: [],
Check_Type: '',
Check_Period: '',
Check_Level: '',
Check_Date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
Nav_RectifyDetails: [{
Nav_RiskArea: {
NAME: ''
},
Nav_Question: {
DESCREPTION: ''
},
HIDDEN_LEVEL: '',
HIDDEN_PLACE: '',
RECTIFICATION_MEASURES: '',
RECITIFY_TIME: '',
Nav_AcceptUser: {
NAME: ''
},
Nav_ImplementUser: {
NAME: ''
},
Nav_RectifyDetailFiles: []
}],
},
model: {
CHECK_TYPE_ID: '',
PLANCHECKFREQUENCY: '',
DEPARTMENT_TYPE: 0,
CHECK_TIME: '',
ORG_ID: '',
Nav_RectifyDetails: [{
RISK_AREA_ID: '',
CHECK_CONTENTS_ID: '',
CHECKPROOF: '',
CHECKSTANDARD: '',
Nav_CheckNoticeDetailUsers: {
USER_ID: ''
},
}],
},
peopleSelectOption: {
showSelector: false,
value: null,
index: 0,
defaultChecked: []
},
dateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
dateRecitifyTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
stepsText: ['发起', '确认', '归档'],
stepsPage: 0,
stepsPageList: 0,
Pu: '',
Check_Type_ID: '',
TypeListres: {},
TaskID: '',
poparr: '',
currentOperateStep: {},
currentOperateArea: {},
chooseCheckContent: '',
chooseCheckArea: '',
showPopupMonitor: false,
currentOperateMonitor: {},
monitorLists: [],
curTotalMonitor: 0,
chooseCheckMonitor: '',
chooseRecitify: '',
showPopupAccept: false,
currentOperateAccept: {},
AcceptLists: [],
curTotalAccept: 0,
chooseCheckAccept: '',
nowIndex: 0,
nowName:'',
}
},
onLoad(option) {
this.TaskID = option.taskID ? option.taskID : '';
this.ID = option.ID ? option.ID : '';
this.loadData()
},
methods: {
loadData() {
this.getCheckType()
// const json = {}
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "")
extendRule(json, 'ID', 1, this.ID);
extendInclude(json, 'Nav_CheckType');
extendInclude(json, 'Nav_RectifyFiles.Nav_ImgFile');
extendInclude(json, 'Nav_RectifyDetails');
extendInclude(json, 'Nav_RectifyDetails.Nav_RiskArea');
extendInclude(json, 'Nav_RectifyDetails.Nav_Contents');
extendInclude(json, 'Nav_RectifyDetails.Nav_ImplementUser');
extendInclude(json, 'Nav_RectifyDetails.Nav_AcceptUser');
extendInclude(json, 'Nav_RectifyDetails.Nav_RectifyDetailFiles.Nav_ImgFile');
// extendRule(json, 'TASK_ID', 1, this.TaskID);
extendIgnoreDataRule(json)
GetDangerRectifyReport(json).then(res => {
// this.model = res;
this.dataModel.Check_Type = res.Nav_CheckType.NAME
this.Check_Type_ID = res.CHECK_TYPE_ID
this.dataModel.Check_Period = res.PLANCHECKFREQUENCY == 0 ? '无' : res.PLANCHECKFREQUENCY == 10 ? '每天' : res.PLANCHECKFREQUENCY == 20 ? '每周' : res.PLANCHECKFREQUENCY == 30 ? '每月' : res
.PLANCHECKFREQUENCY == 40 ? '每季度' : res.PLANCHECKFREQUENCY == 50 ? '每半年' : res.PLANCHECKFREQUENCY == 60 ? '每年' : '每班'
this.dataModel.Check_Level = res.DEPARTMENT_TYPE == 0 ? '部门' : res.DEPARTMENT_TYPE == 1 ? '车间' : res.DEPARTMENT_TYPE == 2 ? '班组' : res.DEPARTMENT_TYPE == 3 ? '公司' : '岗位'
this.dataModel.Nav_RectifyFiles = res.Nav_RectifyFiles
this.dataModel.Check_Date = uni.$u.timeFormat(res.CHECK_TIME,
'yyyy-mm-dd')
this.dataModel.UserNames = res.CHECK_PERSON
this.dataModel.Nav_RectifyDetails = res.Nav_RectifyDetails
this.dataModel.Nav_RectifyDetails.map((item, index) => {
if(index==0){
item['showPack'] = true
}else{
item['showPack'] = false
}
if (!item.Nav_Question || !item.Nav_Question.DESCREPTION) {
item.Nav_Question = {
DESCREPTION: ''
}
}
item.HIDDEN_LEVEL = item.HIDDEN_LEVEL == 0 ? '一般' : '重大'
item.RECITIFY_TIME = uni.$u.timeFormat(item.RECITIFY_TIME,
'yyyy-mm-dd')
item.Nav_RiskArea = item.Nav_RiskArea ? item.Nav_RiskArea : {
NAME: ''
},
item.Nav_Question = item.Nav_Question ? item.Nav_Question : {
DESCREPTION: ''
},
item.Nav_ImplementUser = item.Nav_ImplementUser ? item.Nav_ImplementUser : {
NAME: ''
},
item.Nav_AcceptUser = item.Nav_AcceptUser ? item.Nav_AcceptUser : {
NAME: ''
}
})
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 10 ? 1 : 2
this.dataModel.Product_Unit = MineTypeName[res.MineType]
})
},
handlePack(index) {
this.dataModel.Nav_RectifyDetails[index].showPack = this.dataModel.Nav_RectifyDetails[index].showPack == false ? true : false
this.dataModel.Nav_RectifyDetails = [...this.dataModel.Nav_RectifyDetails]
},
getCheckType() {
const json = initFilter(this.orgId, "", "CODE", 1)
json.Limit = 100
const TypeList = []
CheckTypeNewOrderPaged(json).then(res => {
(res.Data || res).map((item, index) => {
TypeList.push(item.NAME)
if (item.NAME == this.dataModel.Check_Type) {
this.TypeDefaultIndex = [index]
}
})
this.TypeListres = res.Data
})
this.TypeLists = [TypeList]
},
stepAdd() {
if (!this.dataModel.Check_Period) {
uni.showToast({
title: '请选择检查周期',
icon: 'none'
})
return
}
if (!this.dataModel.Check_Level) {
uni.showToast({
title: '请选择检查层级',
icon: 'none'
})
return
}
if (!this.dataModel.Check_Type) {
uni.showToast({
title: '请选择检查类型',
icon: 'none'
})
return
}
if (!this.dataModel.Product_Unit) {
uni.showToast({
title: '请选择生产单元',
icon: 'none'
})
return
}
this.TypeListres.map(item => {
if (item.NAME == this.dataModel.Check_Type) {
this.Check_Type_ID = item.ID
}
})
this.stepsPageList = this.stepsPageList + 1
},
stepReduce() {
this.stepsPageList = this.stepsPageList - 1
},
cancelRiskLevel() {
this.showPopupRiskLevel = false
},
handleChangeRiskLevel(index) {
this.RiskLevel = [
['一般', '重大']
]
this.showPopupRiskLevel = true
this.nowIndex = index
},
confirmRiskLevel(e) {
this.dataModel.Nav_RectifyDetails[this.nowIndex].HIDDEN_LEVEL = e.value[0]
this.showPopupRiskLevel = false
},
cancelType() {
this.showPopupType = false
},
handleChangeType() {
// this.TypeLists = [FMProductionUnit]
this.showPopupType = true
},
cancelUnit() {
this.showPopupUnit = false
},
handleChangeUnit() {
this.UnitLists = [FMProductionUnit]
this.showPopupUnit = true
},
confirmUnit(e) {
this.dataModel.Product_Unit = e.value[0]
this.showPopupUnit = false
},
confirmType(e) {
this.dataModel.Check_Type = e.value[0]
this.showPopupType = false
},
cancelPeriod() {
this.showPopupPeriod = false
},
handleChangePeriod() {
this.PeriodLists = [CheckPeriods]
this.showPopupPeriod = true
},
confirmPeriod(e) {
this.dataModel.Check_Period = e.value[0]
this.showPopupPeriod = false
},
cancelLevel() {
this.showPopupLevel = false
},
handleChangeLevel() {
this.LevelLists = [CheckLevels]
CheckLevels.map((item, index) => {
if (item == this.dataModel.Check_Level) {
this.LevelDefaultIndex = [index]
}
})
this.showPopupLevel = true
},
confirmLevel(e) {
this.dataModel.Check_Level = e.value[0]
this.showPopupLevel = false
},
confirmDate(e) {
this.dataModel.Check_Date = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.dateTime = this.dataModel.Check_Date
this.showPopupDate = false
},
handleChangeDate() {
this.showPopupDate = true
},
cancelDate() {
this.showPopupDate = false
},
cancelRecitifyDate() {
this.showPopupRecitifyDate = false
},
handleChangeRecitify(index) {
this.showPopupRecitifyDate = true
this.nowIndex = index
},
confirmRecitifyDate(e) {
this.dataModel.Nav_RectifyDetails[this.nowIndex].RECITIFY_TIME = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.dateRecitifyTime = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.showPopupRecitifyDate = false
},
handleClosePopupArea() {
this.showPopupArea = false
// this.showPopupCertificate = false
},
handleChangeArea(name, index) {
this.nowName = name
this.nowIndex = index
this.currentOperateArea = {}
this.showPopupArea = true
this.handleSearchArea()
},
handleSearchArea(val, pageIndex) {
let requestInfo = this.nowName == 'Area' ? GetRiskAreaInfo : GetHiddenScripList
let p = this.dataModel.Nav_RectifyDetails[this.nowIndex[0]]
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "",0, pageIndex ?? 1)
if (val) {
extendRule(json, 'NAME', 9, val);
}
json.Limit = 20
if (pageIndex) {
json.Start = (pageIndex - 1) * json.Limit;
}
requestInfo(json).then(res => {
// if (res.IsSuccessful) {
this.areaLists = (res.Data || res).map(i => {
return {
...i,
id: i.ID,
name: i.NAME|| i.DESCREPTION,
}
})
this.curTotalArea = res.TotalCount
// }
})
},
handleSelectedArea(val) {
if(this.nowName == 'Area' ){debugger
this.dataModel.Nav_RectifyDetails[this.nowIndex[0]].RISK_AREA_ID = val.ID
this.dataModel.Nav_RectifyDetails[this.nowIndex[0]].Nav_RiskArea = val
}else{
this.dataModel.Nav_RectifyDetails[this.nowIndex[0]].CHECK_QUESTION_ID = val.ID
this.dataModel.Nav_RectifyDetails[this.nowIndex[0]].Nav_Question = val
}
this.dataModel.Nav_RectifyDetails = [...this.dataModel.Nav_RectifyDetails]
this.showPopupArea = false
},
handleClosePopupMonitor() {
this.showPopupMonitor = false
// this.showPopupCertificate = false
},
handleChangeMonitor(name,index) {
this.nowName = name
this.currentOperateMonitor = {}
this.nowIndex = index
this.showPopupMonitor = true
this.handleSearchMonitor('init')
},
handleSearchMonitor(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.monitorLists = res.Data.map(i => {
return {
...i,
name: i.NAME,
code: i.CODE
}
})
this.curTotalMonitor = res.TotalCount
}
})
},
handleSelectedMonitor(val) {
if(this.nowName =='ImplementUser'){
this.dataModel.Nav_RectifyDetails[this.nowIndex].IMPLEMENT_USER_ID = val.ID
this.dataModel.Nav_RectifyDetails[this.nowIndex].Nav_ImplementUser = val
}else{
this.dataModel.Nav_RectifyDetails[this.nowIndex].ACCEPT_USER_ID = val.ID
this.dataModel.Nav_RectifyDetails[this.nowIndex].Nav_AcceptUser = val
}
this.dataModel.Nav_RectifyDetails = [...this.dataModel.Nav_RectifyDetails]
this.showPopupMonitor = false
},
handleNewCheckContent() {
this.dataModel.Nav_RectifyDetails.unshift({
HIDDEN_DESCRIPTION: '',
HIDDEN_LEVEL: '一般',
HIDDEN_PLACE: '',
RECTIFICATION_MEASURES: '',
RECITIFY_TIME: '',
Nav_RectifyDetailFiles: [],
Nav_RiskArea: {
NAME: ''
},
Nav_Question: {
DESCREPTION: ''
},
Nav_ImplementUser: {
NAME: ''
},
Nav_AcceptUser: {
NAME: ''
},
RISK_AREA_ID: '',
showPack: true,
})
this.dataModel.Nav_RectifyDetails = [...this.dataModel.Nav_RectifyDetails]
},
handleDelRowBefore(index) {
this.nowIndex = index
this.showDelModalIndex = index
},
confirmDel() {
this.dataModel.Nav_RectifyDetails.splice(this.nowIndex, 1)
this.showDelModalIndex = undefined
},
cacelDel() {
this.showDelModalIndex = undefined
},
submit() {
for (let item of this.dataModel.Nav_RectifyDetails) {
if (!item.Nav_RiskArea.NAME) {
uni.showToast({
title: '请选择检查区域',
icon: 'none'
})
return
}
if (!item.Nav_ImplementUser.NAME) {
uni.showToast({
title: '请选择整改落实人',
icon: 'none'
})
return
}
if (!item.Nav_AcceptUser.NAME) {
uni.showToast({
title: '请选择验收人',
icon: 'none'
})
return
}
if (!item.HIDDEN_DESCRIPTION) {
uni.showToast({
title: '请填写隐患描述',
icon: 'none'
})
return
}
if (!item.HIDDEN_LEVEL) {
uni.showToast({
title: '请选择隐患等级',
icon: 'none'
})
return
}
if (!item.HIDDEN_PLACE) {
uni.showToast({
title: '请填写隐患地点',
icon: 'none'
})
return
}
if (!item.RECTIFICATION_MEASURES) {
uni.showToast({
title: '请填写整改措施',
icon: 'none'
})
return
}
if (!item.RECITIFY_TIME) {
uni.showToast({
title: '请选择整改期限',
icon: 'none'
})
return
}
}
let period = this.dataModel.Check_Period
let checkP = period == '无' ? 0 : period == '每天' ? 10 : period == '每周' ? 20 : period == '每月' ? 30 : period == '每季' ? 40 : period == '每半年' ? 50 : period == '每年' ? 60 : 70
let Check_Level = this.dataModel.Check_Level
const level = Check_Level == '部门' ? 0 : Check_Level == '车间' ? 1 : Check_Level == '班组' ? 2 : Check_Level == '公司' ? 3 : 4
this.model.CHECK_TYPE_ID = this.Check_Type_ID //检查类型
this.model.PLANCHECKFREQUENCY = checkP //检查周期
this.model.DEPARTMENT_TYPE = level //检查层级
this.model.CHECK_TIME = this.dataModel.Check_Date //检查时间
this.model.MineType = MineTypeIndex[this.dataModel.Product_Unit]
let arr = []
this.dataModel.Nav_RectifyDetails.map(item => {
arr.push({
RISK_AREA_ID: item.RISK_AREA_ID,
HIDDEN_DESCRIPTION: item.HIDDEN_DESCRIPTION,
HIDDEN_LEVEL: item.HIDDEN_LEVEL == '一般' ? 0 : 10,
HIDDEN_PLACE: item.HIDDEN_PLACE,
RECTIFICATION_MEASURES: item.RECTIFICATION_MEASURES,
RECITIFY_TIME: item.RECITIFY_TIME,
IMPLEMENT_USER_ID: item.IMPLEMENT_USER_ID,
ACCEPT_USER_ID: item.ACCEPT_USER_ID,
Nav_RectifyDetailFiles: item.Nav_RectifyDetailFiles
})
})
this.model.Nav_RectifyDetails = arr
const result = this.dataModel.Nav_RectifyFiles.map((obj) => {
return Object.assign({}, obj, {
IMG_FILE_ID: obj.IMG_FILE_ID,
})
return obj
})
this.model.Nav_RectifyFiles = result
if (this.model.ORG_ID == '') {
this.model.ORG_ID = this.ORG_ID
}
this.model.ID = this.ID
this.model.TaskID = this.TaskID
this.model.PUBLISH = "SaveAndNotify";
DangerRectifyFullUpdate(this.model).then(res => {
if (res) {
uni.$showMsgFunc('操作成功!', () => {
uni.navigateBack()
}, 'success', 1000)
}
})
}
}
}
</script>
<style scoped>
@import url("../../../../style/css/newTemplate.css");
</style>