<template>
|
<div class="system-add-menu-container">
|
<el-dialog :title="title" v-model="isShowRectifyDialog" width="600px">
|
<el-form :model="rectifyForm" :rules="rectifyFormRules" ref="rectifyFormRef" size="default" label-width="120px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改说明" prop="rectifyInfo">
|
<el-input
|
class="input-add"
|
type="textarea"
|
:rows="2"
|
v-model.trim="rectifyForm.rectifyInfo"
|
placeholder="请输入整改说明"
|
clearable
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改时间" prop="applyTime">
|
<el-date-picker
|
type="datetime"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
class="input-add"
|
v-model="rectifyForm.applyTime"
|
placeholder="请选择整改时间"
|
clearable
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="isShowRectifyDialog = !isShowRectifyDialog" size="default">取 消</el-button>
|
<el-button type="primary" @click="submitRectify" v-throttle size="default">确 实</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<el-dialog :title="title" v-model="isShowDelayDialog" width="600px">
|
<el-form :model="delayForm" :rules="delayFormRules" ref="rectifyFormRef" size="default" label-width="120px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="延期说明" prop="timeOutDesc">
|
<el-input
|
class="input-add"
|
type="textarea"
|
:rows="2"
|
v-model.trim="delayForm.timeOutDesc"
|
placeholder="请输入延期说明"
|
clearable
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改期限" prop="rectifyTime">
|
<el-date-picker
|
type="datetime"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
class="input-add"
|
v-model="delayForm.rectifyTime"
|
placeholder="请选择整改期限"
|
clearable
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="isShowDelayDialog = !isShowDelayDialog" size="default">取 消</el-button>
|
<el-button type="primary" @click="submitDelay" v-throttle size="default">确 实</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script lang="ts">
|
interface stateType {
|
isShowRectifyDialog: Boolean;
|
isShowDelayDialog: Boolean;
|
rectifyForm: {
|
id: number | null;
|
dangerManagerId: number | null;
|
rectifyInfo: string | null;
|
applyTime: string | null;
|
};
|
delayForm: {
|
id: number | null;
|
dangerManagerId: number | null;
|
rectifyTime: string | null;
|
timeOutDesc: string | null;
|
};
|
title: string;
|
rectifyTypeList: Array<rectifyTypeState>;
|
rectifyFormRules: {};
|
delayFormRules: {};
|
}
|
interface rectifyTypeState {
|
regionType: string;
|
id: number;
|
}
|
|
import { reactive, toRefs, ref } from 'vue';
|
import { ElMessage } from 'element-plus';
|
import { hiddenRectifyApi } from '/@/api/doublePreventSystem/rectify';
|
export default {
|
name: 'rectifyDialog',
|
setup(props: any, context: any) {
|
const rectifyFormRef = ref();
|
const state = reactive<stateType>({
|
title: '',
|
rectifyTypeList: [],
|
isShowDelayDialog: false,
|
isShowRectifyDialog: false,
|
rectifyForm: {
|
id: null,
|
dangerManagerId: null,
|
rectifyInfo: null,
|
applyTime: null
|
},
|
delayForm: {
|
id: null,
|
dangerManagerId: null,
|
rectifyTime: null,
|
timeOutDesc: null
|
},
|
rectifyFormRules: {
|
rectifyInfo: [{ required: true, message: '请填写整改说明', trigger: 'blur' }],
|
applyTime: [{ required: true, message: '请选择整改时间', trigger: 'change' }]
|
},
|
delayFormRules: {
|
timeOutDesc: [{ required: true, message: '请填写延期说明', trigger: 'blur' }],
|
rectifyTime: [{ required: true, message: '请选择整改期限', trigger: 'change' }]
|
}
|
});
|
|
//打开模态框
|
const openRectifyDialog = (type: string, value: object) => {
|
if (type === '延期') {
|
state.title = '延期';
|
state.isShowDelayDialog = true;
|
const delayForm = JSON.parse(JSON.stringify(value));
|
state.delayForm.id = delayForm.id;
|
state.delayForm.dangerManagerId = delayForm.dangerManagerId;
|
state.delayForm.timeOutDesc = null;
|
state.delayForm.rectifyTime = null;
|
} else {
|
state.title = '整改';
|
state.isShowRectifyDialog = true;
|
const rectifyForm = JSON.parse(JSON.stringify(value));
|
state.rectifyForm.id = rectifyForm.id;
|
state.rectifyForm.dangerManagerId = rectifyForm.dangerManagerId;
|
state.rectifyForm.rectifyInfo = null;
|
state.rectifyForm.applyTime = null;
|
}
|
};
|
|
//提交整改
|
const submitRectify = async () => {
|
rectifyFormRef.value.validate(async (valid: Boolean) => {
|
if (valid) {
|
let res = await hiddenRectifyApi().submitHiddenRectify(state.rectifyForm);
|
if (res.data.code === '200') {
|
ElMessage({
|
type: 'success',
|
message: '整改提交成功',
|
duration: 2000
|
});
|
state.isShowRectifyDialog = false;
|
context.emit('refreshRectify');
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: '请完善基本信息'
|
});
|
}
|
});
|
};
|
|
//提交延期
|
const submitDelay = async () => {
|
rectifyFormRef.value.validate(async (valid: Boolean) => {
|
if (valid) {
|
let res = await hiddenRectifyApi().delayHiddenRectifyTime(state.delayForm);
|
if (res.data.code === '200') {
|
ElMessage({
|
type: 'success',
|
message: '隐患延期成功',
|
duration: 2000
|
});
|
state.isShowDelayDialog = false;
|
context.emit('refreshRectify');
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: '请完善基本信息'
|
});
|
}
|
});
|
};
|
|
return {
|
...toRefs(state),
|
rectifyFormRef,
|
submitDelay,
|
submitRectify,
|
openRectifyDialog
|
};
|
}
|
};
|
</script>
|
|
<style scoped>
|
.input-length {
|
width: 85%;
|
}
|
</style>
|