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

793 lines
27 KiB
Vue
Raw 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" >
<u--input v-model="dataModel.Product_Unit" disabled disabledColor="#ffffff" 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" >
<u--input v-model="dataModel.Check_Type" disabled disabledColor="#ffffff" 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" >
<u--input v-model="dataModel.Check_Period" disabledColor="#ffffff" 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" >
<u--input v-model="dataModel.Check_Level" disabled disabledColor="#ffffff" 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 required 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_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_CheckNoticeDetails" :key="index" style="border-bottom: #ceccca 1px solid;margin-bottom: 10px;padding-bottom: 10px;">
<u-form-item :label="index+1+'.区域:'" @click="handleChangeArea(index)">
<u--input v-model="item.Nav_RiskArea.NAME" placeholder="请选择检查区域" disabled disabledColor="#ffffff" border="none" fontSize="14px">
</u--input>
<view @click.stop style="display: flex;flex-direction: row;align-items: center;justify-content: space-around;">
<u-icon @click="handleDelRowBefore('Area',[index])" name="trash" color="#ff4d4f" size="21" style="margin-right: 20px;"></u-icon>
<u-icon name="arrow-up" size="12" v-if="item.showPackRegion" @click="handlePackRegion(index)"></u-icon>
<u-icon name="arrow-down" size="12" v-if="!item.showPackRegion" @click="handlePackRegion( index)"></u-icon>
</view>
</u-form-item>
<u-form-item label="检查人员" @click="handleShowUserSelector(item,index)">
<!-- <u--input placeholder="检查人员多选" v-model="item.Nav_CheckNoticeUserSlice" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
</u--input> -->
<u-icon name="man-add" size="24" color="#3d9cff" slot="right"></u-icon>
</u-form-item>
<view class="tag-view" v-if="item.Nav_CheckNoticeDetailUsers">
<uni-tag class="tag" v-for="(i, k) in item.Nav_CheckNoticeDetailUsers.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_User.NAME" type="primary" />
</view>
<view v-if="item.showPackRegion==true">
<u-form-item label="检查内容" @click="handleNewCheckContent(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.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>
<view v-if="item1.showPack==true">
<!-- <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_CheckNoticeDetailBasicsName" disabled placeholder="请选择检查依据" maxlength="-1"></u--textarea>
<u-form-item label="判定标准">
<u--input v-model="item1.CHECKSTANDARD" disabledColor="#ffffff" inputAlign="right" fontSize="14px">
</u--input>
</u-form-item> -->
</view>
</view>
</view>
</view>
<u-form-item @click="handleNewCheckArea">
<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="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" />
<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,
guid,
initFilter,
initFilterGroup,
extendIgnoreDataRule
} from '../../../../utils/common'
import {
FMProductionUnit,
CheckPeriod,
CheckLevel,
MineTypeIndex,
MineTypeName
} from '../../../../utils/enums.js'
import {
GetCheckContents,
GetCheckContentsInfo,
GetCheckInspection,
FullUpdate,
GetRiskAreaInfo,
CheckTypeNewOrderPaged,
GetIdentityUserEdit
} from '../../../../services/apply/subPages/SK/SKServices.js'
import {
getRequest,
} from '../../../../services/apply/FOServices/FOServices';
import stepTitle from '@/components/custom/step-title.vue'
export default {
components: {
stepTitle,
},
data() {
return {
showDelModalIndex: undefined,
showDelModalIndex1: undefined,
isMultiple: false,
UnitLists: [],
showPopupUnit: false,
UnitDefaultIndex: [0],
TypeLists: [],
showPopupType: false,
TypeDefaultIndex: [0],
PeriodLists: [],
showPopupPeriod: false,
PeriodDefaultIndex: [0],
LevelLists: [],
defaultChecked: [],
showPopupLevel: false,
stepLoad: true,
LevelDefaultIndex: [0],
showPopupDate: false,
listPropUpload: ['NOTIFY_ID'],
listPropValUpload: [],
ORG_ID: uni.getStorageSync('orgId'),
dataModel: {
Nav_Files: [],
Product_Unit: '',
Check_Type: '',
Check_Period: '无',
Check_Level: '',
Check_Date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
Nav_CheckNoticeDetails: [{
Nav_RiskArea: {
NAME: ''
},
Nav_CheckNoticeDetailUsers: []
}],
},
model: {
MineType: 0,
CHECK_TYPE_ID: '',
PLANCHECKFREQUENCY: '',
DEPARTMENT_TYPE: 0,
CHECK_TIME: '',
ORG_ID: '',
Nav_CheckNoticeDetails: [{
RISK_AREA_ID: '',
CHECK_CONTENTS_ID: '',
Nav_CheckNoticeDetailBasics: [],
CHECKSTANDARD: '',
Nav_CheckNoticeDetailUsers: {
USER_ID: ''
}
}],
Nav_CheckNoticeFiles: {
IMG_FILE_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,
Check_Type_ID: '',
TypeListres: {},
currentOperateArea: {},
chooseCheckArea: '',
areaLists: [],
stepLists: [],
curTotalArea: 0,
showPopupArea: false,
currentOperateStep: {},
curTotalStep: 0,
showPopupStep: false,
chooseCheckContent: '',
nowIndex: 0,
nowName: '',
STATUS:0,
}
},
onLoad(option) {
this.TaskID = option.taskID ? option.taskID : '';
this.model.ID = option.ID ? option.ID : '';
this.model.TaskID = option.taskID ? option.taskID : '';
this.ID = option.ID ? option.ID : '';
this.loadData()
},
methods: {
loadData() {
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_CheckNoticeDetails.Nav_DetailContents.Nav_CheckNoticeDetailBasics.Nav_Law');
extendIgnoreDataRule(json)
GetIdentityUserEdit(json).then(res => {
if (res) {
this.stepLoad = false
this.dataModel.CONTEXT = res.CONTEXT?res.CONTEXT:''
this.dataModel.Product_Unit = MineTypeName[res.MineType]
this.dataModel.Check_Type = res.Nav_CheckType.NAME
this.Check_Type_ID = res.CHECK_TYPE_ID
let period = res.PLANCHECKFREQUENCY
this.dataModel.Check_Period = period == 0 ? '无' : period == 10 ? '每天' : period == 20 ? '每周' : period == 30 ? '每月' : period == 40 ? '每季' : period == 50 ? '每半年' : '每年'
this.PeriodDefaultIndex = [Number(String(period).slice(0, 1))]
let level = res.DEPARTMENT_TYPE
this.dataModel.Check_Level = level == 0 ? '部门' : level == 1 ? '车间' : level == 2 ? '班组' : '公司'
this.LevelDefaultIndex = [Number(String(level).slice(0, 1))]
this.dataModel.Check_Date = res.CHECK_TIME
this.dataModel.Nav_CheckNoticeDetails = res.Nav_CheckNoticeDetails ? res.Nav_CheckNoticeDetails : []
this.STATUS = res.STATUS
this.dataModel.CONTEXT = res.CONTEXT
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 20 ? 1 : res.STATUS == 10 ? 2 : 3
if (this.dataModel.Nav_CheckNoticeDetails.length > 0) {
this.dataModel.Nav_CheckNoticeDetails.map((item, index) => {
if (index == 0) {
item['showPackRegion'] = true
} else {
item['showPackRegion'] = false
}
if (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_CheckNoticeDetailBasics.length > 0) {
let areaShow = ''
item1.Nav_CheckNoticeDetailBasics.map(o => {
if (o.Nav_Law && o.Nav_Law.NAME) {
areaShow += o.Nav_Law.NAME + ' 、'
}
})
item1['Nav_CheckNoticeDetailBasicsName'] = areaShow
} else {
item1['Nav_CheckNoticeDetailBasicsName'] = ''
}
})
}
item.Nav_CheckNoticeDetailUsers = item.Nav_CheckNoticeDetailUsers ? item.Nav_CheckNoticeDetailUsers : []
})
}
this.dataModel.Nav_Files = res.Nav_CheckNoticeFiles
}
})
this.getCheckType()
// const mineType = Number(uni.getStorageSync('appInfo').User.MineType)
// this.dataModel.Product_Unit = MineTypeName[mineType]
// const type = uni.getStorageSync('appInfo').User.Nav_Department.DEPARTMENT_TYPE
// if (type == '2') {
// this.dataModel.Check_Level = '班组'
// this.dataModel.Check_Type = '巡回检查'
// } else {
// this.dataModel.Check_Type = '例行检查'
// if (type == '0') {
// this.dataModel.Check_Level = '部门'
// } else if (type == '1') {
// this.dataModel.Check_Level = '车间'
// } else if (type == '2') {
// this.dataModel.Check_Level = '班组'
// } else {
// this.dataModel.Check_Level = '公司'
// }
// }
},
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]
},
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_CheckNoticeDetails[this.nowIndex].RISK_AREA_ID = val.ID
this.dataModel.Nav_CheckNoticeDetails[this.nowIndex].Nav_RiskArea = val
this.dataModel.Nav_CheckNoticeDetails = [...this.dataModel.Nav_CheckNoticeDetails]
this.showPopupArea = false
},
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) {
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;
}
this.defaultChecked = []
let requestInfo = this.nowName == 'Inspection' ? GetCheckInspection : GetCheckContentsInfo
if (this.nowName == 'Inspection') {
this.isMultiple = true
let p = this.dataModel.Nav_CheckNoticeDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]]
if (p.Nav_CheckNoticeDetailBasics && p.Nav_CheckNoticeDetailBasics.length > 0) {
p.Nav_CheckNoticeDetailBasics.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
}
requestInfo(json).then(res => {
// if (res.IsSuccessful) {
this.stepLists = (res.Data || res).map(i => {
return {
...i,
id: i.ID,
name: i.CHECKCONTENT,
}
})
this.curTotalStep = res.TotalCount
// }
})
},
handleSelectedStep(val) {
this.defaultChecked = []
if (this.nowName == 'Inspection') {
let listArea = []
let areaShow = ''
if (val.length > 0) {
val.forEach((item, i) => {
if (i > 0) {
areaShow += ' '
}
let newId = item.ID;
// 创建一个新对象ID 为 item.LAW_ID其他属性和 item 相同
let newItem = {
...item,
LAW_ID: newId
};
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_CheckNoticeDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_CheckNoticeDetailBasics = listArea
this.dataModel.Nav_CheckNoticeDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].Nav_CheckNoticeDetailBasicsName = areaShow
} else {
this.dataModel.Nav_CheckNoticeDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECK_CONTENTS_ID = val.ID
this.dataModel.Nav_CheckNoticeDetails[this.nowIndex[0]].Nav_DetailContents[this.nowIndex[1]].CHECKCONTENT = val.CHECKCONTENT
this.dataModel.Nav_CheckNoticeDetails = [...this.dataModel.Nav_CheckNoticeDetails]
}
this.showPopupStep = false
},
handlePack(index, index1) {
this.dataModel.Nav_CheckNoticeDetails[index].Nav_DetailContents[index1].showPack =this.dataModel.Nav_CheckNoticeDetails[index].Nav_DetailContents[index1].showPack == false ? true : false
this.dataModel.Nav_CheckNoticeDetails = [...this.dataModel.Nav_CheckNoticeDetails]
},
handlePackRegion(index) {
this.dataModel.Nav_CheckNoticeDetails[index].showPackRegion = this.dataModel.Nav_CheckNoticeDetails[index].showPackRegion == false ? true : false
this.dataModel.Nav_CheckNoticeDetails = [...this.dataModel.Nav_CheckNoticeDetails]
},
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
// }
if (!this.dataModel.Check_Date) {
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
},
cancelUnit() {
this.showPopupUnit = false
},
handleChangeUnit() {
this.UnitLists = [FMProductionUnit]
this.showPopupUnit = true
},
confirmUnit(e) {
this.dataModel.Product_Unit = e.value[0]
this.showPopupUnit = false
},
cancelType() {
this.showPopupType = false
},
handleChangeType() {
// this.TypeLists = [FMProductionUnit]
this.showPopupType = true
},
confirmType(e) {
this.dataModel.Check_Type = e.value[0]
this.TypeListres.map(item => {
if (item.NAME == e.value[0]) {
this.Check_Type_ID = item.ID
}
})
this.showPopupType = false
},
cancelPeriod() {
this.showPopupPeriod = false
},
handleChangePeriod() {
this.PeriodLists = [CheckPeriod]
this.showPopupPeriod = true
},
confirmPeriod(e) {
this.dataModel.Check_Period = e.value[0]
this.showPopupPeriod = false
},
cancelLevel() {
this.showPopupLevel = false
},
handleChangeLevel() {
this.LevelLists = [CheckLevel]
CheckLevel.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')
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_CheckNoticeDetails[key].Nav_CheckNoticeDetailUsers = 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_CheckNoticeDetailUsers?.map(i => {
return {
...i,
NAME: i.Nav_User.NAME,
USER_ID: i.Nav_User.ID,
}
})
}
},
handleNewCheckArea() {
this.dataModel.Nav_CheckNoticeDetails.unshift({
Nav_RiskArea: {
NAME: ''
},
showPackRegion:true,
Nav_CheckNoticeDetailUsers: [],
Nav_DetailContents: [],
})
},
handleNewCheckContent(index) {
this.dataModel.Nav_CheckNoticeDetails[index].Nav_DetailContents.unshift({
CHECKCONTENT: '',
CHECK_CONTENTS_ID: '',
Nav_CheckNoticeDetailBasics: [],
Nav_CheckNoticeDetailBasicsName: '',
CHECKSTANDARD: '',
})
let nowadd = 0
this.dataModel.Nav_CheckNoticeDetails = [...this.dataModel.Nav_CheckNoticeDetails]
},
handleDelRowBefore(name, index) {
this.nowName = name
this.nowIndex = index
this.showDelModalIndex = index[0]
},
confirmDel() {
if (this.nowName == 'Area') {
this.dataModel.Nav_CheckNoticeDetails.splice(this.nowIndex[0], 1)
} else {
this.dataModel.Nav_CheckNoticeDetails[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_CheckNoticeDetails) {
if (item.Nav_CheckNoticeDetailUsers.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.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 : 60
let Check_Level = this.dataModel.Check_Level
const level = Check_Level == '部门' ? 0 : Check_Level == '车间' ? 1 : Check_Level == '班组' ? 2 : 3
this.model.MineType = MineTypeIndex[this.dataModel.Product_Unit]
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
let arr = []
this.dataModel.Nav_CheckNoticeDetails.map(item => {
item.Nav_DetailContents.map(item1 => {
arr.push({
RISK_AREA_ID: item.RISK_AREA_ID,
CHECK_CONTENTS_ID: item1.CHECK_CONTENTS_ID,
Nav_CheckNoticeDetailBasics: item1.Nav_CheckNoticeDetailBasics,
CHECKSTANDARD: item1.CHECKSTANDARD,
// CHECKCONTENT: item1.CHECKCONTENT,
Nav_CheckNoticeDetailUsers: item.Nav_CheckNoticeDetailUsers.map(obj => {
return {
USER_ID: obj.USER_ID,
IS_DELETED: obj.IS_DELETED
}
})
})
})
})
this.model.Nav_CheckNoticeDetails = arr
this.model.Nav_CheckNoticeFiles = this.dataModel.Nav_Files
if (this.model.ORG_ID == '') {
this.model.ORG_ID = this.ORG_ID
}
this.model.PUBLISH = "SaveAndNotify";
this.model.ID = this.ID
this.model.TaskID = this.TaskID
FullUpdate(this.model).then(res => {
if (res) {
uni.$showMsgFunc('操作成功!', () => {
uni.navigateBack()
}, 'success', 1000)
}
})
}
}
}
</script>
<style scoped>
@import url("../../../../style/css/newTemplate.css");
</style>