<template>
|
<div class="system-add-menu-container">
|
<el-dialog :title="title" v-model="isShowCheckDialog" width="600px" :close-on-click-modal="false">
|
<el-form :model="checkForm" :rules="checkFormRules" ref="checkFormRef" 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="checkInfo">
|
<el-input class="input-add" type="textarea" :rows="2" v-model.trim="checkForm.checkAcceptDesc" placeholder="请输入验收意见" clearable></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="isShowCheckDialog = !isShowCheckDialog" size="default">取 消</el-button>
|
<el-button type="primary" @click="submitCheck" v-throttle size="default">确 定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<el-dialog :title="title" v-model="isShowCheckInfoDialog" width="600px" :close-on-click-modal="false">
|
<el-form :model="checkInfoForm" ref="checkFormRef" 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="rectifyDesc">
|
<el-input class="input-add" :disabled="true" type="textarea" :rows="2" v-model.trim="checkInfoForm.rectifyDesc" readonly></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="rectifyType">
|
<el-select class="input-add" :disabled="true" v-model="checkInfoForm.rectifyType" readonly>
|
<el-option v-for="item in rectifyTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改部门" prop="rectifyDepId">
|
<el-cascader :disabled="true" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请选择部门" clearable filterable class="input-add" v-model="checkInfoForm.rectifyDepId" readonly> </el-cascader>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改责任人" prop="liablePersonId">
|
<el-select class="input-add" :disabled="true" v-model="checkInfoForm.liablePersonId" clearable filterable readonly>
|
<el-option v-for="item in userList" :key="item.uid" :label="item.username" :value="item.uid"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="整改资金" prop="dangerResult">
|
<el-input class="input-add" :disabled="true" type="number" v-model="checkInfoForm.cost" readonly> </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="checkAcceptPerson">
|
<el-input class="input-add" :disabled="true" v-model="checkInfoForm.checkAcceptPerson" readonly />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script lang="ts">
|
import { getUserByDepartment } from '/@/assets/methods';
|
|
interface stateType {
|
isShowCheckDialog: Boolean;
|
isShowCheckInfoDialog: Boolean;
|
checkForm: {
|
id: number | null;
|
dangerManagerId: number | null;
|
checkAcceptDesc: string | null;
|
};
|
departmentList: [];
|
userList: [];
|
rectifyTypeList: Array<rectifyType>;
|
checkInfoForm: {
|
rectifyDepId: number | null;
|
liablePersonId: number | null;
|
};
|
title: string;
|
checkTypeList: Array<checkTypeState>;
|
checkFormRules: {};
|
}
|
interface checkTypeState {
|
regionType: string;
|
id: number;
|
}
|
|
interface rectifyType {
|
id: number;
|
name: string;
|
}
|
|
import { reactive, toRefs, ref } from 'vue';
|
import { ElMessage } from 'element-plus';
|
import { hiddenCheckApi } from '/@/api/doublePreventSystem/check';
|
export default {
|
name: 'hiddenCheckDialog',
|
setup(props: any, context: any) {
|
const checkFormRef = ref();
|
const state = reactive<stateType>({
|
title: '',
|
checkTypeList: [],
|
rectifyTypeList: [
|
{ id: 1, name: '即查即改' },
|
{ id: 2, name: '限期整改' }
|
],
|
departmentList: [],
|
userList: [],
|
isShowCheckDialog: false,
|
isShowCheckInfoDialog: false,
|
checkForm: {
|
id: null,
|
dangerManagerId: null,
|
checkAcceptDesc: null
|
},
|
checkInfoForm: {
|
rectifyDepId: null,
|
liablePersonId: null
|
},
|
checkFormRules: {
|
checkAcceptDesc: [{ required: true, message: '请填写整改说明', trigger: 'blur' }]
|
}
|
});
|
|
//打开模态框
|
const openCheckDialog = async (type: string, value: object, departmentList: []) => {
|
state.departmentList = departmentList;
|
if (type === '验收') {
|
state.title = '验收';
|
state.isShowCheckDialog = true;
|
const checkForm = JSON.parse(JSON.stringify(value));
|
state.checkForm.id = checkForm.id;
|
state.checkForm.dangerManagerId = checkForm.dangerManagerId;
|
} else {
|
state.title = '查看';
|
state.isShowCheckInfoDialog = true;
|
state.checkInfoForm.rectifyDepId = JSON.parse(JSON.stringify(value)).rectifyDepId;
|
await achieveUserList();
|
state.checkInfoForm = JSON.parse(JSON.stringify(value));
|
}
|
};
|
|
//提交整改
|
const submitCheck = async () => {
|
checkFormRef.value.validate(async (valid: Boolean) => {
|
if (valid) {
|
let res = await hiddenCheckApi().submitHiddenCheck(state.checkForm);
|
if (res.data.code === '200') {
|
ElMessage({
|
type: 'success',
|
message: '整改提交成功',
|
duration: 2000
|
});
|
state.isShowCheckDialog = false;
|
context.emit('refreshCheck');
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: '请完善基本信息'
|
});
|
}
|
});
|
};
|
|
const achieveUserList = async () => {
|
state.checkInfoForm.liablePersonId = null;
|
const user: unknown = await getUserByDepartment(state.checkInfoForm.rectifyDepId);
|
state.userList = user as [];
|
};
|
|
return {
|
...toRefs(state),
|
checkFormRef,
|
submitCheck,
|
openCheckDialog
|
};
|
}
|
};
|
</script>
|
|
<style scoped>
|
:deep(.el-textarea.is-disabled .el-textarea__inner) {
|
background-color: var(--el-card-bg-color);
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__inner) {
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__wrapper) {
|
background-color: var(--el-card-bg-color);
|
}
|
</style>
|