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

829 lines
30 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="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_Files" :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" :loading="stepLoad">下一步</u-button>
</view>
<view class="card" v-if="stepsPageList === 1">
<u--form labelWidth="auto" :model="dataModel" ref="wForm" class="sub-form">
<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_CheckRecordDetails" :key="index" style="border-bottom: #ceccca 1px solid;margin-bottom: 10px;padding-bottom: 10px;">
<u-form-item :label="index+1+'.区域:'" @click="handleChangeStep('Area',[index])">
<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" style="margin-left: 10px;"></u-icon>
<view @click.stop>
<u-icon @click="handleDelRowBefore('Area',[index])" name="trash" color="#ff4d4f" size="21" style="margin-left: 20px;"></u-icon>
</view>
</u-form-item>
<u-form-item label="检查人员" @click="handleShowUserSelector(item,index)">
<u-icon name="man-add" size="24" color="#3d9cff" slot="right"></u-icon>
</u-form-item>
<view v-show="!!item.Nav_CheckRecordDetailUsers.length" class="tag-view">
<uni-tag class="tag" v-for="(i, k) in item.Nav_CheckRecordDetailUsers.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_User.NAME" type="primary" />
</view>
<u-form-item label="检查内容" @click="handleNewCheckContent(item,index)">
<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('Content',[index,index1])" 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-subsection :list="subsectionList" :current="item1.CHECK_RESULTS" @change="sectionChange($event,item1)"></u-subsection>
<!-- <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_CheckRecordDetailBasicsName" disabled placeholder="请选择检查依据" maxlength="-1"></u--textarea>
<u-form-item label="判定标准" prop="CHECKSTANDARD" border-bottom>
<u--input v-model="item1.CHECKSTANDARD" placeholder="请填写判定标准" 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(item1)">
<u--input v-model="item1.HIDDEN_LEVEL" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="bottom">
</u--input>
</u-form-item>
<u-form-item label="隐患地点" prop="HIDDEN_PLACE">
<u--input v-model="item1.HIDDEN_PLACE" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="bottom">
</u--input>
</u-form-item>
<u-form-item label="隐患照片" prop="CHECKSTANDARD">
</u-form-item>
<full-upload v-model="item1.Nav_CheckRecordDetailFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
</view>
</view>
</view>
<view style="padding: 10px 16px;display: flex;flex-direction: row;">
<u-button type="primary" @click="handleNewCheckArea" color="#3d4b70" >新增检查区域</u-button>
<!-- <u-button type="primary" @click="handleNewCheckList" color="#3d4b70" style="margin-left: 5px;">检查清单</u-button> -->
</view>
</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>
<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" />
</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,
GetIdentityUserRecordSummary,
SummaryFullUpdate,
GetRiskAreaInfo,
GetCheckInspection,
GetHiddenScripList,
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: ['无隐患', '有隐患', '不涉及'],
curNow: 1,
RiskLevel: ['一般', '重大'],
showPopupUnit: false,
UnitDefaultIndex: [0],
showPopupRiskLevel: false,
RiskLevelDefaultIndex: [0],
UnitLists: [],
TypeLists: [],
showPopupType: false,
isMultiple: false,
defaultChecked: [],
TypeDefaultIndex: [0],
PeriodLists: [],
showPopupPeriod: false,
PeriodDefaultIndex: [0],
LevelLists: [],
showPopupStep: false,
showPopupArea: false,
showPopupLevel: false,
stepLoad: true,
curTotalStep: 0,
curTotalArea: 0,
stepLists: [],
areaLists: [],
LevelDefaultIndex: [0],
showPopupDate: false,
listPropUpload: ['NOTIFY_ID'],
listPropValUpload: [],
ORG_ID: uni.getStorageSync('orgId'),
dataModel: {
Nav_Files: [],
Check_Type: '',
Check_Period: '',
Check_Level: '',
SECURITY_INSPECTION_RECORD_ID:null,
Check_Date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
Nav_CheckRecordDetails: [{
Nav_RiskArea: {
NAME: ''
},
Nav_Users: [],
Nav_DetailContents: {
Nav_Contents: {
CHECKCONTENT: ''
}
}
}],
},
model: {
CHECK_TYPE_ID: '',
PLANCHECKFREQUENCY: '',
DEPARTMENT_TYPE: 0,
CHECK_TIME: '',
ORG_ID: '',
SECURITY_INSPECTION_RECORD_ID:null,
Nav_CheckRecordDetails: [{
RISK_AREA_ID: '',
CHECK_CONTENTS_ID: '',
CHECKSTANDARD: '',
Nav_CheckNoticeDetailUsers: {
USER_ID: ''
},
}],
},
peopleSelectOption: {
showSelector: false,
value: null,
index: 0,
defaultChecked: []
},
dateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
stepsText: ['发起', '确认', '归档'],
stepsPage: 0,
stepsPageList: 0,
Pu: '',
Check_Type_ID: '',
TypeListres: {},
TaskID: '',
ID:'',
poparr: '',
currentOperateStep: {},
currentOperateArea: {},
chooseCheckContent: '',
chooseCheckArea: '',
}
},
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);
extendIgnoreDataRule(json)
GetIdentityUserRecordSummary(json).then(res => {
this.stepLoad = false
// this.model = res;
this.dataModel.SECURITY_INSPECTION_RECORD_ID=res.SECURITY_INSPECTION_RECORD_ID
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_Files = res.Nav_CheckRecordFiles
this.dataModel.Check_Date = res.CHECK_TIME
this.dataModel.UserNames = res.CHECK_PERSON
this.dataModel.Nav_CheckRecordDetails = res.Nav_CheckRecordDetails
if (this.dataModel.Nav_CheckRecordDetails && this.dataModel.Nav_CheckRecordDetails.length > 0) {
this.dataModel.Nav_CheckRecordDetails.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.CHECK_RESULTS = Number(item1.CHECK_RESULT.toString().slice(0, 1))
item1.HIDDEN_LEVEL = item1.HIDDEN_LEVEL == 0 ? '一般' : '重大'
if (item1.Nav_CheckRecordDetailBasics.length > 0) {
let areaShow = ''
item1.Nav_CheckRecordDetailBasics.map(o => {
if (o.Nav_Law && o.Nav_Law.NAME) {
areaShow += o.Nav_Law.NAME + ' 、'
}
})
item1['Nav_CheckRecordDetailBasicsName'] = areaShow
} else {
item1['Nav_CheckRecordDetailBasicsName'] = ''
}
})
}
})
}
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 10 ? 1 : 2
this.dataModel.Product_Unit = MineTypeName[res.MineType]
})
this.getCheckType()
},
handlePack(index, index1) {
this.dataModel.Nav_CheckRecordDetails[index].Nav_DetailContents[index1].showPack =this.dataModel.Nav_CheckRecordDetails[index].Nav_DetailContents[index1].showPack == false ? true : false
this.dataModel.Nav_CheckRecordDetails = [...this.dataModel.Nav_CheckRecordDetails]
},
sectionChange(index, item) {
this.curNow = index;
this.dataModel.Nav_CheckRecordDetails.map((item1, index1) => {
item1.Nav_DetailContents.map((item2, index2) => {
if (item2.ID == item.ID) {
item2.CHECK_RESULTS = index
if (index == 0) {
item2.CHECK_RESULT = 0
} else {
item2.CHECK_RESULT = Number(index.toString() + '0')
}
}
})
})
this.dataModel.Nav_CheckRecordDetails = [...this.dataModel.Nav_CheckRecordDetails]
},
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]
},
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(item) {
this.RiskLevel = [
['一般', '重大']
]
this.showPopupRiskLevel = true
this.poparr = item
},
confirmRiskLevel(e) {
this.dataModel.Nav_CheckRecordDetails.map((item, index) => {
item.Nav_DetailContents.map((item1, index1) => {
if (item1.ID == this.poparr.ID) {
item1.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
},
handleSelectorPeople(e) {
const {
index: key
} = this.peopleSelectOption
this.dataModel.Nav_CheckRecordDetails[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.nowName = name
this.nowIndex = index
// this.chooseCheckContent = [index, index1]
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 == 'Area' ? GetRiskAreaInfo :
this.nowName == 'Content' ? GetCheckContentsInfo :
this.nowName == 'Inspection'?GetCheckInspection: GetHiddenScripList
let p = this.dataModel.Nav_CheckRecordDetails[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_CheckRecordDetailBasics && p.Nav_CheckRecordDetailBasics.length > 0) {
p.Nav_CheckRecordDetailBasics.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 == 'Area') {
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].RISK_AREA_ID = val.ID
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_RiskArea = val
} else if (this.nowName == 'Content') {
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECK_CONTENTS_ID = val.ID
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_Contents = val
} 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_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_CheckRecordDetailBasics = listArea
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_CheckRecordDetailBasicsName = areaShow
} else if (this.nowName == 'Description') {
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_Question = val
this.dataModel.Nav_CheckRecordDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECK_QUESTION_ID = val.ID
}
this.dataModel.Nav_CheckRecordDetails = [...this.dataModel.Nav_CheckRecordDetails]
this.showPopupStep = false
},
handleNewCheckArea() {
this.dataModel.Nav_CheckRecordDetails.push({
Nav_RiskArea: {
NAME: ''
},
Nav_CheckRecordDetailUsers: [],
Nav_DetailContents: [],
})
},
handleNewCheckContent(item, index) {
let nowadd = 0
this.dataModel.Nav_CheckRecordDetails.map((item1, index1) => {
if (item.ID == item1.ID) {
item1.Nav_DetailContents.map((item2, index2) => {
if (item2.CHECK_CONTENTS_ID == '') {
nowadd = nowadd + 1
}
})
if (nowadd !== 0) {
uni.showToast({
title: '请先填写检查内容',
icon: 'none'
})
return
}
item1.Nav_DetailContents.unshift({
Nav_Contents: {
CHECKCONTENT: ''
},
CHECK_CONTENTS_ID: '',
Nav_CheckRecordDetailBasics: [],
CHECKSTANDARD: '',
Nav_Question:{
DESCREPTION:''
},
HIDDEN_LEVEL: '一般',
HIDDEN_PLACE: '',
CHECK_RESULT: 0,
CHECK_RESULTS: 0,
Nav_CheckRecordDetailFiles: [],
})
}
})
this.dataModel.Nav_CheckRecordDetails = [...this.dataModel.Nav_CheckRecordDetails]
},
handleDelRowBefore(name, nowIndex) {
this.nowName = name
this.nowIndex = nowIndex
this.showDelModalIndex = nowIndex[0]
},
confirmDel() {
if (this.nowName == 'Area') {
this.dataModel.Nav_CheckRecordDetails.splice(this.nowIndex[0], 1)
} else {
this.dataModel.Nav_CheckRecordDetails[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_CheckRecordDetails) {
if (item.Nav_CheckRecordDetailUsers.length == 0) {
uni.showToast({
title: '请选择检查人员',
icon: 'none'
})
return
}
if (item.Nav_DetailContents.length == 0) {
uni.showToast({
title: '检查内容不能为空',
icon: 'none'
})
return
}
for (let item1 of item.Nav_DetailContents) {
if (!item1.Nav_Contents.CHECKCONTENT) {
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.SECURITY_INSPECTION_RECORD_ID = this.dataModel.SECURITY_INSPECTION_RECORD_ID
this.model.CHECK_TIME = this.dataModel.Check_Date //检查时间
this.model.MineType = MineTypeIndex[this.dataModel.Product_Unit]
let arr = []
this.dataModel.Nav_CheckRecordDetails.map(item => {
item.Nav_DetailContents.map(item1 => {
arr.push({
RISK_AREA_ID: item.RISK_AREA_ID,
CHECK_CONTENTS_ID: item1.CHECK_CONTENTS_ID,
Nav_CheckRecordDetailBasics: item1.Nav_CheckRecordDetailBasics,
CHECKSTANDARD: item1.CHECKSTANDARD,
CHECK_QUESTION_ID:item1.CHECK_QUESTION_ID,
HIDDEN_LEVEL: item1.HIDDEN_LEVEL == '一般' ? 0 : 10,
HIDDEN_PLACE: item1.HIDDEN_PLACE,
CHECK_RESULT: item1.CHECK_RESULT,
// Nav_Contents: {
// CHECKCONTENT: item1.Nav_Contents.CHECKCONTENT
// },
Nav_CheckRecordDetailFiles: item1.Nav_CheckRecordDetailFiles,
Nav_CheckRecordDetailUsers: item.Nav_CheckRecordDetailUsers.map(obj => {
return {
USER_ID: obj.USER_ID,
IS_DELETED: obj.IS_DELETED
}
})
})
})
})
this.model.Nav_CheckRecordDetails = arr
const result = this.dataModel.Nav_Files.map((obj) => {
return Object.assign({}, obj, {
IMG_FILE_ID: obj.IMG_FILE_ID,
})
return obj
})
this.model.Nav_CheckRecordFiles = 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";
SummaryFullUpdate(this.model).then(res => {
if (res) {
uni.$showMsgFunc('操作成功!', () => {
uni.navigateBack()
}, 'success', 1000)
}
})
}
}
}
</script>
<style scoped>
@import url("../../../../style/css/newTemplate.css");
</style>