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

417 lines
14 KiB
Vue
Raw 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">
<u--form labelWidth="auto" :model="model" 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="model.STATUS==40">
</u-form-item>
<u--textarea style="font-size: 14px;" v-html="model.CONTEXT" border="surround" v-if="model.STATUS==40" disabled></u--textarea>
<u-form-item required label="整改记录编号:" @click="handleChangeArea">
<u--input v-model="model.CODE" placeholder="请选择编号" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
</u--input>
</u-form-item>
<view style="background-color: #f5f7fa;padding: 0px 15px;">
<u-form-item label="生产单元:" prop="Product_Unit">
<u--input v-model="model.Product_Unit" disabled border="none" inputAlign="right" fontSize="14px">
</u--input>
</u-form-item>
<u-form-item label="检查区域:">
<u--input v-model="(model.Nav_RiskArea||{}).NAME" disabled border="none" inputAlign="right" fontSize="14px">
</u--input>
</u-form-item>
<u-form-item label="隐患地点:" prop="HIDDEN_PLACE">
<u--input v-model="model.HIDDEN_PLACE" disabled inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="隐患描述:" prop="HIDDEN_DESCRIPTION">
<u--input v-model="model.HIDDEN_DESCRIPTION" disabled inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="隐患等级" prop="HIDDEN_LEVEL">
<u--input v-model="model.HIDDEN_LEVELName" disabled inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="整改期限" prop="HIDDEN_PLACE">
<u--input v-model="model.RECITIFY_TIME" disabled inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<view class="upload-title">整改前照片</view>
<full-upload v-model="model.Nav_RectifyPhotoas" :isShowBtn='false' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
</view>
<u-form-item required label="延期整改理由:" prop="HIDDEN_LEVEL">
<u--input v-model="model.DELAY_REASON" placeholder="请填写延期整改理由" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item required label="延期整改期限" prop="HIDDEN_PLACE" @click="handleChangeDate()">
<u--input v-model="model.DELAY_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 required label="整改前临时措施:">
<u--input v-model="model.RECITIFY_MEASURES_TEMP" placeholder="请填写整改前临时措施" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
</u--input>
</u-form-item>
</u--form>
</view>
<view style="padding: 10px 16px;" class="bottom-button">
<u-button type="primary" @click="submit" color="#3d4b70">提交</u-button>
</view>
<u-picker :show="showPopupUnit" :columns="UnitLists" @confirm="confirmUnit" @cancel="cancelUnit" :defaultIndex="UnitDefaultIndex"></u-picker>
<u-datetime-picker :show="showPopupDate" v-model="dateTime" mode="date" @confirm="confirmDate" @cancel="cancelDate"></u-datetime-picker>
<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,
SKAcceptResultEnum,
MineTypeIndex,
MineTypeName
} from '../../../../utils/enums.js'
import {
RectifyDeferrFullUpdate,
GetRiskCodeInfo,
GetRectifyDelayApplyReport
} from '../../../../services/apply/subPages/SK/SKServices.js'
import stepTitle from '@/components/custom/step-title.vue'
import {
getEnum
} from '../../../../services/common';
export default {
components: {
stepTitle,
},
data() {
return {
showDelModalIndex: undefined,
showDelModalIndex1: undefined,
subsectionList: ['入库', '不入库', ],
radiolist1: [{
name: '是',
disabled: false
}, {
name: '否',
disabled: false
}],
curNow: 1,
RiskLevel: ['一般', '重大'],
Accept: [],
showPopupUnit: false,
UnitDefaultIndex: [0],
showPopupRiskLevel: false,
RiskLevelDefaultIndex: [0],
showPopupAccept: false,
AcceptDefaultIndex: [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,
showPopupDateTwo: false,
showPopupRecitifyDate: false,
listPropUpload: ['NOTIFY_ID'],
listPropValUpload: [],
ORG_ID: uni.getStorageSync('orgId'),
model: {
Product_Unit: '',
MineType: '',
CODE: '',
Nav_RiskArea: {
NAME: ''
},
HIDDEN_PLACE: '',
HIDDEN_DESCRIPTION: '',
HIDDEN_LEVEL: '',
RECITIFY_TIME: '',
Nav_RectifyPhotoas: [],
DELAY_REASON: '',
DELAY_RECITIFY_TIME: '',
RECITIFY_MEASURES_TEMP: '',
},
dateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
stepsText: ['发起', '审批', '审阅', '归档'],
stepsPage: 0,
stepsPageList: 0,
TaskID: '',
currentOperateArea: {},
ID: '',
enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表)
enumsText: {} // 存储枚举文本列表(用于下拉选择等场景)
}
},
onLoad(option) {
this.TaskID = option.taskID ? option.taskID : '';
this.ID = option.ID ? option.ID : '';
this.fetchEnums(['SKProductionUnit', 'SKHiddenLevel']);
// this.loadData()
},
methods: {
async fetchEnums(enumNames) {
try {
// 存储所有枚举请求的Promise
const enumPromises = enumNames.map(name => {
return getEnum({
name
}).then(res => {
// 统一处理枚举格式添加name/code字段便于后续映射
return {
enumName: name,
data: res.map(item => ({
...item,
name: item.NAME, // 统一显示名称字段
code: item.ID // 统一值字段
}))
};
});
});
// 等待所有枚举请求完成
const results = await Promise.all(enumPromises);
// 存储枚举结果到data中键为枚举名称值为处理后的数据
results.forEach(({
enumName,
data
}) => {
this.enumsData[enumName] = data;
// 生成文本列表(如需要)
this.enumsText[enumName] = data.map(item => item.name);
});
// 所有枚举获取完成后执行loadData
this.loadData();
} catch (error) {
console.error('枚举请求失败:', error);
uni.showToast({
title: '枚举数据加载失败',
icon: 'none'
});
}
},
loadData() {
if (this.ID == undefined || this.ID == '') {
this.model.ID = guid()
// let mint = Number(uni.getStorageSync('appInfo').User.MineType)
// this.model.Product_Unit = this.enumsData['SKProductionUnit'].find(item => item.code === mint).name;
// this.model.MineType = this.enumsData['SKProductionUnit'].find(item => item.code === mint).code;
this.isLoadOK = false
this.$forceUpdate()
} else {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "")
extendRule(json, 'ID', 1, this.ID);
extendInclude(json, 'Nav_RectifyRecord.Nav_RiskArea');
extendInclude(json, 'Nav_RectifyRecord');
extendInclude(json, 'Nav_RectifyRecord.Nav_RectifyPhotoas.Nav_ImgFile');
GetRectifyDelayApplyReport(json).then(res => {
this.model = res;
this.model.ID = this.ID
this.model.MineType = res.MineType
this.model.HIDDEN_DANGER_RECTIFY_RECORD_ID = res.ID
this.model.CODE = res.Nav_RectifyRecord.CODE
this.model.Nav_RectifyPhotoas = res.Nav_RectifyRecord.Nav_RectifyPhotoas ? res.Nav_RectifyRecord.Nav_RectifyPhotoas : []
this.model.Nav_RiskArea = res.Nav_RectifyRecord.Nav_RiskArea ? res.Nav_RectifyRecord.Nav_RiskArea : []
this.model.HIDDEN_DESCRIPTION = res.Nav_RectifyRecord.HIDDEN_DESCRIPTION
this.model.HIDDEN_PLACE = res.Nav_RectifyRecord.HIDDEN_PLACE
this.model.HIDDEN_LEVEL = res.Nav_RectifyRecord.HIDDEN_LEVEL
this.model.RECITIFY_TIME = uni.$u.timeFormat(res.Nav_RectifyRecord.RECITIFY_TIME, 'yyyy-mm-dd')
this.model.DELAY_RECITIFY_TIME = uni.$u.timeFormat(res.DELAY_RECITIFY_TIME, 'yyyy-mm-dd')
this.model.HIDDEN_LEVELName = res.HIDDEN_LEVEL !== undefined ? this.enumsData['SKHiddenLevel'].find(item => item.code === res.Nav_RectifyRecord.HIDDEN_LEVEL).name : '';
this.model.Product_Unit = res.MineType !== undefined ? this.enumsData['SKProductionUnit'].find(item => item.code === res.Nav_RectifyRecord.MineType).name : '';
this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 20 ? 1 : res.STATUS == 21 ? 2 : 3
})
}
},
cancelDate() {
this.showPopupDate = false
},
handleChangeDate() {
this.showPopupDate = true
},
confirmDate(e) {
this.model.DELAY_RECITIFY_TIME = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.dateTime = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.showPopupDate = false
},
cancelUnit() {
this.showPopupUnit = false
},
handleChangeUnit() {
this.UnitLists = [FMProductionUnit]
this.showPopupUnit = true
},
confirmUnit(e) {
this.model.Product_Unit = e.value[0]
this.showPopupUnit = false
},
handleClosePopupArea() {
this.showPopupArea = false
// this.showPopupCertificate = false
},
handleChangeArea() {
this.currentOperateArea = {}
this.showPopupArea = true
this.handleSearchArea('init')
},
handleSearchArea(val, pageIndex) {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "", '', pageIndex)
if (val !== 'init') {
const tempGroup = initFilterGroup(false);
extendGroupRule(tempGroup, 'CODE', 9, val)
extendFilterGroup(json, tempGroup);
}
json.Limit = 20
if (pageIndex) {
json.Start = (pageIndex - 1) * 20;
}
// extendRule(json, 'ID', 1, this.model.ID);
extendInclude(json, 'Nav_RiskArea');
extendInclude(json, 'Nav_Question');
extendInclude(json, 'Nav_RectifyPhotoas.Nav_ImgFile');
json.Sort = 'CODE'
// extendInclude(json, 'Nav_ApplyDepartment');
// extendInclude(json, 'Nav_RectifyRecord');
// extendInclude(json, 'Nav_RectifyRecord.Nav_RiskArea');
// extendInclude(json, 'Nav_RectifyRecord.Nav_RectifyPhotoas.Nav_ImgFile');
extendIgnoreDataRule(json)
GetRiskCodeInfo(json).then(res => {
this.areaLists = res.Data.map(i => {
return {
...i,
id: i.ID,
name: i.CODE,
}
})
this.curTotalArea = res.TotalCount
})
},
handleSelectedArea(val) {
// this.model = val
this.model.MineType = val.MineType
this.model.Product_Unit = val.MineType!==undefined?this.enumsData['SKProductionUnit'].find(item => item.code === val.MineType).name:'';
this.model.HIDDEN_DANGER_RECTIFY_RECORD_ID = val.ID
this.model.CODE = val.CODE
this.model.Nav_RectifyPhotoas = val.Nav_RectifyPhotoas ? val.Nav_RectifyPhotoas : []
this.model.Nav_RiskArea = val.Nav_RiskArea ? val.Nav_RiskArea : []
this.model.HIDDEN_DESCRIPTION = val.HIDDEN_DESCRIPTION
this.model.HIDDEN_PLACE = val.HIDDEN_PLACE
this.model.HIDDEN_LEVEL = val.HIDDEN_LEVEL
this.model.RECITIFY_TIME = uni.$u.timeFormat(val.RECITIFY_TIME, 'yyyy-mm-dd')
this.model.HIDDEN_LEVELName =val.HIDDEN_LEVEL!==undefined? this.enumsData['SKHiddenLevel'].find(item => item.code === val.HIDDEN_LEVEL).name:'';
this.showPopupArea = false
},
submit() {
if (!this.model.CODE) {
uni.showToast({
title: '请选择整改记录编号',
icon: 'none'
})
return
}
if (!this.model.DELAY_REASON) {
uni.showToast({
title: '请填写延期整改理由',
icon: 'none'
})
return
}
if (!this.model.DELAY_RECITIFY_TIME) {
uni.showToast({
title: '请选择延期整改期限',
icon: 'none'
})
return
}
if (!this.model.RECITIFY_MEASURES_TEMP) {
uni.showToast({
title: '请填写整改前临时措施',
icon: 'none'
})
return
}
this.modelEdit = JSON.parse(JSON.stringify(this.model))
delete this.modelEdit.Nav_RectifyRecord
delete this.modelEdit.Nav_RiskArea
if (this.TaskID == null || this.TaskID == '') {
this.modelEdit.TaskID = '00000000-0000-0000-0000-000000000000'
} else {
this.modelEdit.TaskID = this.TaskID
}
if (this.modelEdit.ORG_ID == null || this.modelEdit.ORG_ID == '')
this.modelEdit.ORG_ID = this.ORG_ID
this.modelEdit.PUBLISH = 'SaveAndNotify'
// console.log(this.modelEdit,'this.modelEdit')
RectifyDeferrFullUpdate(this.modelEdit).then(res => {
if (res) {
uni.$showMsgFunc('操作成功!', () => {
uni.navigateBack()
}, 'success', 1000)
}
})
}
}
}
</script>
<style scoped>
@import url("../../../../style/css/newTemplate.css");
</style>