<template>
|
<div class="system-edit-user-container">
|
<el-dialog
|
:title="titles"
|
v-model="isShowDialog"
|
width="769px"
|
draggable
|
:fullscreen="full"
|
>
|
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
|
<el-form
|
ref="ruleFormRef"
|
:model="ruleForm"
|
size="default"
|
label-width="120px"
|
:disabled="disabled"
|
>
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练名称" prop="drillName">
|
<el-input v-model="ruleForm.drillName" placeholder="请填写演练名称"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练地点" prop="drillAddress">
|
<el-input v-model="ruleForm.drillAddress" placeholder="请填写演练地点"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="主办部门" placeholder="请选择" prop="departmentId">
|
<el-tree-select
|
v-model="ruleForm.departmentId"
|
:data="data" class="w100"
|
placeholder="请选择"/>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练方式" prop="drillWay">
|
<el-select v-model="ruleForm.drillWay" class="w100" placeholder="请选择">
|
<el-option label="综合" value="综合"></el-option>
|
<el-option label="桌面" value="桌面"></el-option>
|
<el-option label="专项" value="专项"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="应急预案" prop="planId" >
|
<el-input
|
v-model="ruleForm.planId"
|
placeholder="请选择"
|
class="input-with-select"
|
>
|
<template #append>
|
<el-button :icon="Search" @click="daiInpt"/>
|
</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练级别" prop="drillLevel">
|
<el-select v-model="ruleForm.drillLevel" class="w100" placeholder="请选择">
|
<el-option label="公司级" value="公司级"></el-option>
|
<el-option label="分厂级" value="分厂级"></el-option>
|
<el-option label="车间级" value="车间级"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="计划定制日期" prop="makingPlanDate">
|
<el-date-picker v-model="ruleForm.makingPlanDate" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%" />
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="计划演练日期" prop="drillPlanDate">
|
<el-date-picker v-model="ruleForm.drillPlanDate" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%" />
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="修改时间" prop="updateDate">
|
<el-date-picker v-model="ruleForm.updateDate" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%" />
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="计划定制人" prop="makingUserUid">
|
<el-input v-model="ruleForm.makingUserUid" placeholder="请填写计划定制人"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="制定部门" prop="makingDepartmentId">
|
<el-tree-select
|
v-model="ruleForm.makingDepartmentId"
|
:data="data" class="w100"
|
placeholder="请选择"/>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练人员" prop="telephone" >
|
<el-input
|
v-model="ruleForm.teamLeader"
|
placeholder="请选择"
|
class="input-with-select"
|
>
|
<template #append>
|
<el-button :icon="Search" @click="openUser"/>
|
</template>
|
</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="purpose">
|
<el-input
|
v-model="ruleForm.purpose"
|
placeholder="请填写演练目的"
|
class="input-with-select textarea"
|
type="textarea"
|
>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练负责人" prop="telephone" >
|
<el-input
|
v-model="ruleForm.teamLeader"
|
placeholder="请选择"
|
class="input-with-select"
|
>
|
<template #append>
|
<el-button :icon="Search" @click="openUser"/>
|
</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="保险措施" prop="insuranceMeasures">
|
<el-input v-model="ruleForm.insuranceMeasures" placeholder="请填写保险措施"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-form-item label="演练经费" prop="drillExpense">
|
<el-input v-model="ruleForm.drillExpense" placeholder="请填写演练经费"></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="remark">
|
<el-input
|
v-model="ruleForm.remark"
|
placeholder="请填写备注信息"
|
class="input-with-select textarea"
|
type="textarea"
|
>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" style="margin-bottom: 0!important;">
|
<el-form-item label="预案附件">
|
<el-upload
|
v-model:file-list="fileList"
|
class="upload-demo"
|
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
|
:on-change="handleChange"
|
>
|
<el-button type="primary"
|
>点击上传</el-button>
|
<template #tip>
|
<div class="el-upload__tip">
|
添加相关附件
|
</div>
|
</template>
|
</el-upload>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="resetForm(ruleFormRef)" size="default">关闭</el-button>
|
<el-button size="default" v-if="disabled == true ? false : true" type="primary" @click="submitForm(titles, ruleFormRef)">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<RegionsDialog ref="Shows"/>
|
<UserCheckbox ref="userRef"/>
|
</div>
|
</template>
|
|
<script lang="ts">
|
import {
|
// reactive,
|
ref,
|
defineComponent
|
} from 'vue';
|
|
import type {
|
UploadUserFile,
|
FormInstance,
|
} from 'element-plus'
|
import { ElMessage } from 'element-plus';
|
import {
|
Search,
|
FullScreen
|
} from '@element-plus/icons-vue'
|
import UserCheckbox from "/@/components/userCheckbox/index.vue"
|
import RegionsDialog from "/@/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue"
|
import {releaseDrillPlanApi} from "/@/api/releaseDrillPlan";
|
|
export default defineComponent({
|
name: 'openAdd',
|
components: {
|
RegionsDialog,
|
UserCheckbox,
|
},
|
setup(props, { emit }) {
|
const isShowDialog = ref(false)
|
|
const ruleFormRef = ref<FormInstance>()
|
//定义表单
|
const ruleForm = ref ({
|
makingPlanDate: '', // 计划制定日期
|
drillPlanDate: '', //计划演练日期
|
makingUserUid: '', //计划制定人ID
|
makingDepartmentId: '', // 计划制定部门ID
|
planId: '', // 应急预案ID
|
departmentId: '', // 主办部门ID
|
drillExpense: '', // 演练经费
|
drillLevel: '', //演练级别
|
drillAddress: '', //演练地点
|
drillName: '', // 演练名称
|
drillWay: '', // 演练方式
|
insuranceMeasures: '', // 保险措施
|
remark: '', // 备注
|
purpose: '', // 演练目的
|
fileList: [
|
{
|
fileName: 'name',
|
fileUrl: 'url',
|
}
|
],
|
userList: [
|
{
|
userUid: '',
|
type: 1
|
},
|
{
|
userUid: '',
|
type: 2
|
}
|
]
|
});
|
const titles = ref();
|
const disabled = ref();
|
// 打开弹窗
|
const openDialog = (title: string, id: number, type: boolean) => {
|
isShowDialog.value = true;
|
titles.value = title;
|
disabled.value = type;
|
if (title == '查看应急演练计划发布' || title == '修改应急演练计划发布') {
|
releaseDrillPlanApi()
|
.seeReleaseDrillPlan(id)
|
.then((res) => {
|
if (res.data.code == 200) {
|
ruleForm.value = res.data.data;
|
}
|
});
|
}
|
};
|
//日期选择器
|
const value1 = ref('')
|
// 上传附件
|
const fileList = ref<UploadUserFile[]>([])
|
// 可选择树
|
const treeSelect = ref()
|
const tree = [
|
{
|
value: '1',
|
label: 'Level one 1',
|
children: [
|
{
|
value: '11',
|
label: 'Level two 1-1',
|
children: [
|
{
|
value: '111',
|
label: 'Level three 1-1-1',
|
},
|
],
|
},
|
],
|
},
|
{
|
value: '2',
|
label: 'Level one 2',
|
children: [
|
{
|
value: '22',
|
label: 'Level two 2-1',
|
children: [
|
{
|
value: '222',
|
label: 'Level three 2-1-1',
|
},
|
],
|
},
|
{
|
value: '223',
|
label: 'Level two 2-2',
|
children: [
|
{
|
value: '2233',
|
label: 'Level three 2-2-1',
|
},
|
],
|
},
|
],
|
},
|
{
|
value: '3',
|
label: 'Level one 3',
|
children: [
|
{
|
value: '33',
|
label: 'Level two 3-1',
|
children: [
|
{
|
value: '3333',
|
label: 'Level three 3-1-1',
|
},
|
],
|
},
|
{
|
value: '3334',
|
label: 'Level two 3-2',
|
children: [
|
{
|
value: '333',
|
label: 'Level three 3-2-1',
|
},
|
],
|
},
|
],
|
},
|
]
|
//定义树形下拉框
|
const responsibleDepartment = ref()
|
const data = [
|
{
|
value: '1',
|
label: '广汇能源综合物流发展有限责任公司',
|
children: [
|
{
|
value: '11',
|
label: '经营班子',
|
children: [],
|
},
|
],
|
},
|
{
|
value: '12',
|
label: '生产运行部',
|
children: [
|
{
|
value: '21',
|
label: '灌装一班',
|
children: []
|
},
|
{
|
value: '22',
|
label: '工艺四班',
|
children: [],
|
},
|
],
|
},
|
{
|
value: '3',
|
label: '设备部',
|
children: [
|
{
|
value: '31',
|
label: '仪表班',
|
children: [],
|
},
|
{
|
value: '32',
|
label: '机修班',
|
children: [],
|
},
|
],
|
},
|
]
|
|
// 表单提交验证必填项
|
const submitForm = async (title: string, formEl: FormInstance | undefined) => {
|
if (title == '新建应急演练计划发布') {
|
if (!formEl) return;
|
await formEl.validate((valid, fields) => {
|
if (valid) {
|
isShowDialog.value = false;
|
releaseDrillPlanApi()
|
.addReleaseDrillPlan(ruleForm.value)
|
.then((res) => {
|
if (res.data.code == 200) {
|
ElMessage({
|
showClose: true,
|
message: res.data.msg,
|
type: 'success',
|
});
|
emit('myAdd', true);
|
} else {
|
ElMessage({
|
showClose: true,
|
message: res.data.msg,
|
type: 'error',
|
});
|
emit('myAdd', true);
|
}
|
formEl.resetFields();
|
});
|
} else {
|
console.log('error submit!', fields);
|
}
|
});
|
}
|
else if (title == '修改应急演练计划发布') {
|
if (!formEl) return;
|
await formEl.validate((valid, fields) => {
|
if (valid) {
|
isShowDialog.value = false;
|
releaseDrillPlanApi()
|
.editReleaseDrillPlan(ruleForm.value)
|
.then((res) => {
|
if (res.data.code == 200) {
|
ElMessage({
|
showClose: true,
|
message: '修改成功',
|
type: 'success',
|
});
|
emit('myAdd', true);
|
} else {
|
ElMessage({
|
showClose: true,
|
message: res.data.msg,
|
type: 'error',
|
});
|
emit('myAdd', true);
|
}
|
formEl.resetFields();
|
});
|
} else {
|
console.log('error submit!', fields);
|
}
|
});
|
formEl.resetFields();
|
ruleForm.value = {
|
makingPlanDate: '', // 计划制定日期
|
drillPlanDate: '', //计划演练日期
|
makingUserUid: '', //计划制定人ID
|
makingDepartmentId: '', // 计划制定部门ID
|
planId: '', // 应急预案ID
|
departmentId: '', // 主办部门ID
|
drillExpense: '', // 演练经费
|
drillLevel: '', //演练级别
|
drillAddress: '', //演练地点
|
drillName: '', // 演练名称
|
drillWay: '', // 演练方式
|
insuranceMeasures: '', // 保险措施
|
remark: '', // 备注
|
purpose: '', // 演练目的
|
fileList: [
|
{
|
fileName: 'name',
|
fileUrl: 'url',
|
}
|
],
|
userList: [
|
{
|
userUid: '',
|
type: 1
|
},
|
{
|
userUid: '',
|
type: 2
|
}
|
]
|
};
|
}
|
}
|
const resetForm = (formEl: FormInstance | undefined) => {
|
isShowDialog.value = false;
|
if (!formEl) return;
|
formEl.resetFields();
|
};
|
// 应急队伍弹窗
|
const Shows=ref()
|
const daiInpt=()=>{
|
Shows.value.openDailog()
|
}
|
// 打开用户选择弹窗
|
const userRef = ref();
|
const openUser = () => {
|
userRef.value.openDialog();
|
};
|
// 计划定制日期
|
const datetime = ref('')
|
//全屏
|
const full = ref(false);
|
const toggleFullscreen = () => {
|
if (full.value == false) {
|
full.value = true;
|
} else {
|
full.value = false;
|
}
|
};
|
return {
|
openDialog,
|
isShowDialog,
|
fileList,
|
responsibleDepartment,
|
data,
|
Search,
|
ruleForm,
|
value1,
|
treeSelect,
|
tree,
|
daiInpt,
|
Shows,
|
ruleFormRef,
|
submitForm,
|
openUser,
|
userRef,
|
datetime,
|
toggleFullscreen,
|
FullScreen,
|
full,
|
titles,
|
disabled,
|
resetForm,
|
emit,
|
};
|
},
|
});
|
</script>
|
<style scoped lang="scss">
|
.textarea{
|
height: 168px!important;
|
}
|
.textarea ::v-deep .el-textarea__inner{
|
height: 168px!important;
|
}
|
::v-deep .el-table__cell {
|
font-weight: 400;
|
}
|
.el-divider--horizontal{
|
height: 0;
|
margin: 0;
|
border-top: transparent;
|
}
|
.el-select{
|
width: 100%;
|
}
|
//多行文本框
|
.textarea{
|
height: 70px!important;
|
}
|
.textarea ::v-deep .el-textarea__inner{
|
height: 70px!important;
|
}
|
//弹窗底部边框线
|
::v-deep .el-dialog__footer{
|
border-top: 1px solid #e8e8e8;
|
border-radius: 0 0 4px 4px;
|
}
|
//弹窗顶部边框线
|
::v-deep .el-dialog__header {
|
border-bottom: 1px solid #e8e8e8;
|
margin-right: 0;
|
border-radius: 4px 4px 0 0;
|
}
|
</style>
|