| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog |
| | | :title="titles" |
| | | v-model="isShowDialog" |
| | | width="30%" |
| | | draggable |
| | | :fullscreen="full" |
| | | > |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form :model="ruleForm" ref="ruleFormRef" label-width="80px"> |
| | | <el-form-item label="备注" > |
| | | <el-input v-model="ruleForm.remark" type="textarea" autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="resetForm(ruleFormRef)" size="default">取消</el-button> |
| | | <el-button size="default" type="primary" @click="submitForm(titles,ruleFormRef)">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { |
| | | ref, |
| | | defineComponent |
| | | } from 'vue'; |
| | | |
| | | import type { |
| | | FormInstance, |
| | | } from 'element-plus' |
| | | import { ElMessage } from 'element-plus'; |
| | | import { |
| | | Search, |
| | | FullScreen |
| | | } from '@element-plus/icons-vue' |
| | | import {emergencyPlanLogApi} from "/@/api/contingencyManagement/emergencyPlanLog"; |
| | | |
| | | export default defineComponent({ |
| | | name: 'openAdd', |
| | | components: { |
| | | }, |
| | | setup(prop, {emit}) { |
| | | const isShowDialog = ref(false); |
| | | const ruleFormRef = ref<FormInstance>(); |
| | | |
| | | const ruleForm = ref({ |
| | | // id: id, |
| | | remark: '', |
| | | }) |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | // 打开弹窗 |
| | | // const openDialog = (title: string ,id: number,) => { |
| | | // isShowDialog.value = true; |
| | | // titles.value = title; |
| | | // if (title == '启动') { |
| | | // emergencyPlanLogApi() |
| | | // .seeEmergencyPlanLog(id) |
| | | // .then((res) => { |
| | | // if (res.data.code == 200) { |
| | | // ruleForm.value = res.data.data; |
| | | // } |
| | | // }); |
| | | // } |
| | | // }; |
| | | const openDialog = (title: string) => { |
| | | isShowDialog.value = true; |
| | | titles.value = title; |
| | | }; |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if (title == '启动') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | emergencyPlanLogApi() |
| | | .addEmergencyPlanLog(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(); |
| | | }); |
| | | ruleForm.value = { |
| | | // id: id, |
| | | remark: '', |
| | | } |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | isShowDialog.value = false; |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | }; |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | | if (full.value == false) { |
| | | full.value = true; |
| | | } else { |
| | | full.value = false; |
| | | } |
| | | }; |
| | | return { |
| | | openDialog, |
| | | Search, |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | full, |
| | | titles, |
| | | emit, |
| | | isShowDialog, |
| | | ruleFormRef, |
| | | ruleForm, |
| | | submitForm, |
| | | disabled, |
| | | resetForm, |
| | | }; |
| | | }, |
| | | }); |
| | | </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%; |
| | | } |
| | | </style> |