jy-safe-app/pages/apply/subPages/SK/riskReportEdit.vue
2025-10-14 15:17:30 +08:00

981 lines
34 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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="CONTEXT" borderBottom v-if="STATUS==40">
</u-form-item>
<u--textarea v-html="dataModel.CONTEXT" border="surround" v-if="STATUS==40"
disabled></u--textarea>
<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>
<u-form-item label="检查人员:" prop="UserNames">
</u-form-item>
<rich-text style="line-height: 30px;" autoHeight type="textarea" v-html="dataModel.UserNames" border="none" inputAlign="right" disabled class="richtext"></rich-text>
<view class="upload-title">附件:</view>
<full-upload v-model="dataModel.Nav_ReportFiles" :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" :loading="stepLoad" @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_ReportDetails" :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 @click="handleChangeArea(index)" style="flex: 1;">
{{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,0,'Area')" name="trash" color="#ff4d4f" size="21" style="margin-right: 20px;"></u-icon>
<u-icon name="arrow-down" size="12"></u-icon>
</view>
</view>
<!-- <u--input v-model="item.Nav_RiskArea.NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
</u--input>
<u-icon name="arrow-down" size="12"></u-icon> -->
</u-form-item>
<u-form-item label="检查内容" @click="handleNewCheckContent(item,index,'CheckContent')">
<u-button text="新增检查内容" size="small" type="primary" style="margin-left: 40%;"></u-button>
<!-- <u-icon name="plus-circle" size="24" color="#3d9cff" slot="right"></u-icon> -->
</u-form-item>
<view v-for="(item1,index1) in item.Nav_DetailContents" :key="index1" style="padding: 0px 5px;">
<u-form-item prop="Nav_Contents">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;flex: 1;">
<view @click="handleChangeStep('Content',[index,index1])" style="flex: 1;">
{{index1+1+'.'+item1.Nav_Contents.CHECKCONTENT}}
</view>
<view class="action" style="display: flex;flex-direction: row;align-items: center;justify-content: space-around;">
<u-icon @click="handleDelRowBefore(index, index1,'CheckContent')" name="trash" color="#ff4d4f" size="21" style="margin-right: 20px;"></u-icon>
<u-icon name="arrow-up" size="12" v-if="item1.showPack" @click="handlePack(index, index1)"></u-icon>
<u-icon name="arrow-down" size="12" v-if="!item1.showPack" @click="handlePack(index, index1)"></u-icon>
</view>
</view>
</u-form-item>
<!-- <u-form-item label="" prop="HIDDEN_LEVEL" @click="handleCheckContent(item1)">
<u--input v-model="item1.Nav_Contents.CHECKCONTENT" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item> -->
<!-- <u--textarea v-model="item1.Nav_Contents.CHECKCONTENT" placeholder="请输入内容" v-if="item1.Nav_Contents"></u--textarea> -->
<view v-if="item1.showPack==true">
<u-form-item label="是否入库" prop="CHECKPROOF" border-bottom>
<u-radio-group v-model="item1.IS_STORE" placement="row" style="display: flex;flex-direction: row;justify-content: end;">
<u-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name"> </u-radio>
</u-radio-group>
</u-form-item>
<!-- <u-form-item label="检查依据" @click="handleChangeStep('Inspection',[index,index1])">
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u--textarea v-model="item1.Nav_ReportDetailBasicsName" disabled placeholder="请选择检查依据" maxlength="-1"></u--textarea>
<u-form-item label="判定标准" prop="CHECKSTANDARD" border-bottom>
<u--input v-model="item1.CHECKSTANDARD" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item> -->
<u-form-item label="隐患描述" @click="handleChangeStep('Description',[index,index1])">
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
</u-icon>
</u-form-item>
<u--textarea v-model="item1.Nav_Question.DESCREPTION" disabled placeholder="请选择隐患描述" maxlength="-1"></u--textarea>
<u-form-item label="隐患等级" prop="HIDDEN_LEVEL" @click="handleChangeRiskLevel(index,index1)" border-bottom>
<u--input v-model="item1.HIDDEN_LEVEL" 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="item1.HIDDEN_PLACE" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="整改责任人" prop="HIDDEN_PLACE" @click="handleChangeMonitor(index,index1)" border-bottom>
<u--input v-model="item1.Nav_RecitifyUser.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" border-bottom @click="handleChangeRecitify(index,index1)">
<u--input v-model="item1.RECITIFY_TIME" 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="CHECKSTANDARD">
</u-form-item>
<full-upload v-model="item1.Nav_ReportDetailFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
</view>
</view>
</view>
<u-button text="新增检查区域" type="primary" @click="handleNewCheckContent('','','Area')"></u-button>
</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="datetime" @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 :multiple="isMultiple" :defaultChecked="defaultChecked" :show="showPopupStep" :total="curTotalStep" :lists="stepLists" :defaultValue="currentOperateStep.NAME" @close="handleClosePopupStep" @search="handleSearchStep" @select="handleSelectedStep" />
<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,
GetHiddenDangerReport,
DangerReportFullUpdate,
GetRiskAreaInfo,
getUserLists,
CheckTypeNewOrderPaged,
GetCheckInspection,
GetHiddenScripList
} 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,
showDelModalAreaIndex: undefined,
subsectionList: ['入库', '不入库', ],
isMultiple: false,
defaultChecked: [],
radiolist1: [{
name: '是',
disabled: false
}, {
name: '否',
disabled: false
}],
curNow: 1,
stepLoad: true,
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_ReportFiles: [],
Check_Type: '',
Check_Period: '',
Check_Level: '',
Check_Date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
Nav_ReportDetails: [{
Nav_RiskArea: {
NAME: ''
},
Nav_Users: [],
Nav_DetailContents: {
Nav_Contents: {
CHECKCONTENT: ''
},
Nav_RecitifyUser: {
NAME: ''
}
}
}],
},
model: {
CHECK_TYPE_ID: '',
PLANCHECKFREQUENCY: '',
DEPARTMENT_TYPE: 0,
CHECK_TIME: '',
ORG_ID: '',
Nav_ReportDetails: [{
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 hh:MM'),
dateRecitifyTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
stepsText: ['发起', '确认','审批', '归档'],
stepsPage: 0,
stepsPageList: 0,
Pu: '',
Check_Type_ID: '',
TypeListres: {},
TaskID: '',
poparr: '',
currentOperateStep: {},
currentOperateArea: {},
chooseCheckContent: '',
chooseCheckArea: '',
showPopupMonitor: false,
currentOperateMonitor: {},
monitorLists: [],
curTotalMonitor: 0,
chooseCheckMonitor: '',
chooseRecitify: '',
nowIndex: 0,
nowName: '',
STATUS:0,
}
},
onLoad(option) {
this.TaskID = option.taskID ? option.taskID : '';
this.ID = option.ID ? option.ID : '';
this.loadData()
},
methods: {
loadData() {
// const json = {}
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "")
extendRule(json, 'ID', 1, this.ID);
extendRule(json, 'TASK_ID', 1, this.TaskID);
extendInclude(json, 'Nav_ReportDetails.Nav_DetailContents');
extendIgnoreDataRule(json)
GetHiddenDangerReport(json).then(res => {
// this.model = res;
this.dataModel.CONTEXT = res.CONTEXT?res.CONTEXT:''
this.STATUS = res.STATUS
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_ReportFiles = res.Nav_ReportFiles
this.dataModel.Check_Date = uni.$u.timeFormat(res.CHECK_TIME,
'yyyy-mm-dd hh:MM:ss')
this.dataModel.UserNames = res.CHECK_PERSON
this.dataModel.Nav_ReportDetails = res.Nav_ReportDetails
this.dataModel.Nav_ReportDetails.map((item, index) => {
if (item.Nav_DetailContents&&item.Nav_DetailContents.length>0) {
item.Nav_DetailContents.map((item1, index1) => {
if(index1==0&&index==0){
item1['showPack'] = true
}else{
item1['showPack'] = false
}
if(!item1.Nav_Question||!item1.Nav_Question.DESCREPTION){
item1.Nav_Question = {
DESCREPTION:''
}
}
if(!item1.Nav_Contents||!item1.Nav_Contents.CHECKCONTENT){
item1.Nav_Contents = {
CHECKCONTENT:''
}
}
item1.IS_STORE = item1.IS_STORE == 10 ? '是' : '否'
item1.HIDDEN_LEVEL = item1.HIDDEN_LEVEL == 0 ? '一般' : '重大'
item1.RECITIFY_TIME = uni.$u.timeFormat(item1.RECITIFY_TIME,
'yyyy-mm-dd')
if (item1.RECITIFY_USER_ID == null) {
item1.Nav_RecitifyUser = {}
}
if (item1.Nav_ReportDetailBasics.length > 0) {
let areaShow = ''
item1.Nav_ReportDetailBasics.map(o => {
if (o.Nav_Law && o.Nav_Law.NAME) {
areaShow += o.Nav_Law.NAME + ' 、'
}
})
item1['Nav_ReportDetailBasicsName'] = areaShow
} else {
item1['Nav_ReportDetailBasicsName'] = ''
}
})
} else {
item['Nav_DetailContents'] = []
}
})
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 20 ? 1 : res.STATUS == 10 ? 2 : 3
this.dataModel.Product_Unit = MineTypeName[res.MineType]
})
this.getCheckType()
},
handlePack(index, index1) {
this.dataModel.Nav_ReportDetails[index].Nav_DetailContents[index1].showPack = this.dataModel.Nav_ReportDetails[index].Nav_DetailContents[index1].showPack == false ? true : false
this.dataModel.Nav_ReportDetails = [...this.dataModel.Nav_ReportDetails]
},
getCheckType() {
const json = initFilter(this.orgId, "", "CODE", 1)
const TypeList = []
json.Limit = 100
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]
this.stepLoad = false
},
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, index1) {
this.RiskLevel = [
['一般', '重大']
]
this.showPopupRiskLevel = true
this.nowIndex = [index, index1]
},
confirmRiskLevel(e) {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].HIDDEN_LEVEL = e.value[0]
this.dataModel.Product_RiskLevel = 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 hh:MM:ss')
this.dateTime = this.dataModel.Check_Date
this.showPopupDate = false
},
handleChangeDate() {
this.showPopupDate = true
},
cancelDate() {
this.showPopupDate = false
},
cancelRecitifyDate() {
this.showPopupRecitifyDate = false
},
handleChangeRecitify(index, index1) {
this.showPopupRecitifyDate = true
this.nowIndex = [index, index1]
},
confirmRecitifyDate(e) {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].RECITIFY_TIME = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.dateRecitifyTime = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.showPopupRecitifyDate = false
},
handleSelectorPeople(e) {
const {
index: key
} = this.peopleSelectOption
this.dataModel.Nav_ReportDetails[key].Nav_CheckRecordDetailUsers = e.map(i => {
return {
USER_ID: i.USER_ID,
IS_DELETED: i.IS_DELETED,
NAME: i.NAME,
Nav_User: {
NAME: i.NAME,
ID: i.USER_ID
}
}
})
},
handleShowUserSelector(item, index) {
this.peopleSelectOption = {
showSelector: true,
value: item,
index,
defaultChecked: item.Nav_CheckRecordDetailUsers.map(i => {
return {
...i,
NAME: i.Nav_User.NAME,
USER_ID: i.Nav_User.ID,
}
})
}
},
handleChangeStep(name, index) {
this.nowIndex = index
this.nowName = name
this.currentOperateStep = {}
this.showPopupStep = true
this.handleSearchStep()
},
handleClosePopupStep() {
this.showPopupStep = false
this.isMultiple = false
this.defaultChecked = []
// this.showPopupCertificate = false
},
handleSearchStep(val, pageIndex) {
let requestInfo = this.nowName == 'Content' ? GetCheckContentsInfo :
this.nowName == 'Inspection'?GetCheckInspection: GetHiddenScripList
let p = this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]]
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;
}
if (this.nowName == 'Inspection') {
this.isMultiple = true
if (p.Nav_ReportDetailBasics && p.Nav_ReportDetailBasics.length > 0) {
p.Nav_ReportDetailBasics.map(item => {
let newId = item.LAW_ID;
// 创建一个新对象ID 为 item.LAW_ID其他属性和 item 相同
let newItem = {
...item,
ID: newId
};
// 将新对象添加到 this.defaultChecked 数组中
this.defaultChecked.push(newItem);
})
} else {
this.defaultChecked = []
}
} else {
this.isMultiple = false
}
if(this.nowName=='Description' &&p.CHECK_CONTENTS_ID){
extendRule(json, 'CHECK_CONTENTS_ID', 1, p.CHECK_CONTENTS_ID);
}
requestInfo(json).then(res => {
// if (res.IsSuccessful) {
this.stepLists = (res.Data || res).map(i => {
return {
...i,
id: i.ID,
name: i.NAME || i.CHECKCONTENT || i.DESCREPTION,
}
})
this.curTotalStep = res.TotalCount
// }
})
},
handleSelectedStep(val) {
this.defaultChecked = []
if (this.nowName == 'Content') {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_Contents = val
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECK_CONTENTS_ID = val.ID
} else if (this.nowName == 'Inspection') {
let listArea = []
let areaShow = ''
if (val.length > 0) {
val.forEach((item, i) => {
if (i > 0) {
areaShow += ' '
}
let newItem = {
...item,
LAW_ID: item.ID,
SECURITY_INSPECTION_RECORD_DETAIL_ID: item.ID,
NAME: item.NAME || item.Nav_Law.NAME,
};
listArea.push(newItem)
if (item.NAME && item.NAME != null) {
areaShow += item.NAME
} else if (item.Nav_Law && item.Nav_Law.NAME != null) {
areaShow += item.Nav_Law.NAME
}
})
}
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_ReportDetailBasics = listArea
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_ReportDetailBasicsName = areaShow
}else if (this.nowName == 'Description') {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_Question = val
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECK_QUESTION_ID = val.ID
}
this.dataModel.Nav_ReportDetails = [...this.dataModel.Nav_ReportDetails]
this.showPopupStep = false
},
handleClosePopupArea() {
this.showPopupArea = false
// this.showPopupCertificate = false
},
handleChangeArea(index) {
this.nowIndex = [index]
this.currentOperateArea = {}
this.showPopupArea = true
this.handleSearchArea()
},
handleSearchArea(val, pageIndex) {
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;
}
GetRiskAreaInfo(json).then(res => {
// if (res.IsSuccessful) {
this.areaLists = (res.Data || res).map(i => {
return {
...i,
id: i.ID,
name: i.NAME,
}
})
this.curTotalArea = res.TotalCount
// }
})
},
handleSelectedArea(val) {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].RISK_AREA_ID = val.ID
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_RiskArea = val
this.dataModel.Nav_ReportDetails = [...this.dataModel.Nav_ReportDetails]
this.showPopupArea = false
},
handleClosePopupMonitor() {
this.showPopupMonitor = false
// this.showPopupCertificate = false
},
handleChangeMonitor(index, index1) {
this.currentOperateMonitor = {}
this.nowIndex = [index, index1]
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) {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_RecitifyUser = val
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].RECITIFY_USER_ID = val.ID
this.dataModel.Nav_ReportDetails = [...this.dataModel.Nav_ReportDetails]
this.showPopupMonitor = false
},
handleNewCheckContent(item, index, name) {
if (name == 'Area') {
this.dataModel.Nav_ReportDetails.push({
Nav_DetailContents: [{
Nav_Contents: {
CHECKCONTENT: ''
},
Nav_RecitifyUser: {
NAME: ''
},
CHECK_CONTENTS_ID: '',
CHECKPROOF: '',
CHECKSTANDARD: '',
HIDDEN_DESCRIPTION: '',
HIDDEN_LEVEL: '一般',
HIDDEN_PLACE: '',
IS_STORE: '是',
RECITIFY_TIME: '',
Nav_ReportDetailFiles: [],
showPack: false,
}],
Nav_RiskArea: {
NAME: ''
}
})
} else {
this.dataModel.Nav_ReportDetails[index].Nav_DetailContents.unshift({
Nav_Contents: {
CHECKCONTENT: ''
},
Nav_RecitifyUser: {
NAME: ''
},
CHECK_CONTENTS_ID: '',
CHECKPROOF: '',
CHECKSTANDARD: '',
HIDDEN_DESCRIPTION: '',
HIDDEN_LEVEL: '一般',
HIDDEN_PLACE: '',
IS_STORE: '是',
RECITIFY_TIME: '',
Nav_ReportDetailFiles: [],
showPack: false,
})
}
this.dataModel.Nav_ReportDetails = [...this.dataModel.Nav_ReportDetails]
},
handleDelRowBefore(index, index1, name) {
this.showDelModalIndex = index
this.nowIndex = [index, index1, name]
},
confirmDel() {
if (this.nowIndex[2] == 'Area') {
this.dataModel.Nav_ReportDetails.splice(this.nowIndex[0], 1)
} else {
this.dataModel.Nav_ReportDetails[this.nowIndex[0]].Nav_DetailContents.splice(this.nowIndex[1], 1)
}
this.showDelModalIndex = undefined
},
cacelDel() {
this.showDelModalIndex = undefined
},
submit() {
for (let item of this.dataModel.Nav_ReportDetails) {
for (let item1 of item.Nav_DetailContents) {
if (!item1.Nav_Contents.CHECKCONTENT) {
uni.showToast({
title: '请填写检查内容',
icon: 'none'
})
return
}
if (!item1.Nav_Question.DESCREPTION) {
uni.showToast({
title: '请填写隐患描述',
icon: 'none'
})
return
}
if (!item1.HIDDEN_PLACE) {
uni.showToast({
title: '请填写隐患地点',
icon: 'none'
})
return
}
if (!item1.Nav_RecitifyUser.NAME) {
uni.showToast({
title: '请选择整改责任人',
icon: 'none'
})
return
}
if (!item1.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_ReportDetails.map(item => {
item.Nav_DetailContents.map(item1 => {
arr.push({
RISK_AREA_ID: item.RISK_AREA_ID,
CHECK_CONTENTS_ID: item1.CHECK_CONTENTS_ID,
Nav_ReportDetailBasics: item1.Nav_ReportDetailBasics,
// CHECKPROOF: item1.CHECKPROOF,
CHECKSTANDARD: item1.CHECKSTANDARD,
CHECK_QUESTION_ID:item1.CHECK_QUESTION_ID,
// HIDDEN_DESCRIPTION: item1.HIDDEN_DESCRIPTION,
HIDDEN_LEVEL: item1.HIDDEN_LEVEL == '一般' ? 0 : 10,
HIDDEN_PLACE: item1.HIDDEN_PLACE,
IS_STORE: item1.IS_STORE == '是' ? 10 : 0,
RECITIFY_USER_ID: item1.RECITIFY_USER_ID,
RECITIFY_TIME: item1.RECITIFY_TIME,
// Nav_Contents: {
// CHECKCONTENT: item1.Nav_Contents.CHECKCONTENT
// },
// Nav_RecitifyUser: {
// NAME: item1.Nav_RecitifyUser.NAME
// },
Nav_ReportDetailFiles: item1.Nav_ReportDetailFiles,
})
})
})
this.model.Nav_ReportDetails = arr
const result = this.dataModel.Nav_ReportFiles.map((obj) => {
return Object.assign({}, obj, {
IMG_FILE_ID: obj.IMG_FILE_ID,
})
return obj
})
this.model.Nav_ReportFiles = 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";
DangerReportFullUpdate(this.model).then(res => {
if (res) {
uni.$showMsgFunc('操作成功!', () => {
uni.navigateBack()
}, 'success', 1000)
}
})
}
}
}
</script>
<style scoped>
@import url("../../../../style/css/newTemplate.css");
</style>