| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog |
| | | :title="titles" |
| | | v-model="isShowDialog" |
| | | width="800px" |
| | | draggable |
| | | :fullscreen="full" |
| | | > |
| | | <el-dialog :title="titles" v-model="isShowDialog" width="800px" draggable :fullscreen="full" @close="closeDialog(ruleFormRef)"> |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form |
| | | ref="ruleFormRef" |
| | | :model="ruleForm" |
| | | size="default" |
| | | :rules="rules" |
| | | label-width="130px" |
| | | :disabled="disabled" |
| | | > |
| | | <el-form ref="ruleFormRef" :model="ruleForm" size="default" :rules="rules" label-width="140px" :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="accidentExpressId"> |
| | | <el-input |
| | | v-model="ruleForm.accidentExpressId" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | > |
| | | <el-form-item label="事故快报" prop="accidentName"> |
| | | <el-input v-model="ruleForm.accidentName" placeholder="请选择" class="input-with-select"> |
| | | <template #append> |
| | | <el-button :icon="Search" @click="daiInpt"/> |
| | | </template> |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="事故部门" placeholder="请选择" prop="accidentDepartmentId"> |
| | | <el-tree-select v-model="ruleForm.accidentDepartmentId" :data="data" class="w100" placeholder="请选择" /> |
| | | <!--<el-input v-model="ruleForm.accidentDepartmentName" class="input-with-select" />--> |
| | | <el-tree-select v-model="ruleForm.accidentDepartmentId" :data="newTreeList" :props="propse" class="w100" placeholder="请选择" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="发生时间" prop="occurrenceTime"> |
| | | <el-date-picker v-model="ruleForm.occurrenceTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" class="w100" placeholder="选择日期时间" /> |
| | | <el-date-picker |
| | | v-model="ruleForm.occurrenceTime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="datetime" |
| | | class="w100" |
| | | placeholder="选择日期时间" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="原因综合分析(直接分析)" prop="comprehensiveAnalysisDirect"> |
| | | <el-input v-model="ruleForm.comprehensiveAnalysisDirect" type="textarea" placeholder="请填写原因综合分析(直接分析)" maxlength="150"></el-input> |
| | | <el-input |
| | | v-model="ruleForm.comprehensiveAnalysisDirect" |
| | | type="textarea" |
| | | placeholder="请填写原因综合分析(直接分析)" |
| | | maxlength="150" |
| | | ></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="comprehensiveAnalysisIndirect"> |
| | | <el-input v-model="ruleForm.comprehensiveAnalysisIndirect" type="textarea" placeholder="请填写原因综合分析(间接分析)" maxlength="150"></el-input> |
| | | <el-input |
| | | v-model="ruleForm.comprehensiveAnalysisIndirect" |
| | | type="textarea" |
| | | placeholder="请填写原因综合分析(间接分析)" |
| | | maxlength="150" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="填写人" prop="fillInUserUid"> |
| | | <el-input |
| | | v-model="ruleForm.fillInUserUid" |
| | | placeholder="请选择" |
| | | class="input-with-select" |
| | | > |
| | | <el-form-item label="填写人" prop="fillInUserName"> |
| | | <el-input v-model="ruleForm.fillInUserName" placeholder="请选择" class="input-with-select"> |
| | | <template #append> |
| | | <el-button :icon="Search" @click="openUser"/> |
| | | </template> |
| | |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="相关人员笔录"> |
| | | <el-form-item label="相关人员笔录" prop="relevantPersonnelRecords"> |
| | | <el-input v-model="ruleForm.relevantPersonnelRecords" type="textarea" placeholder="请填写相关人员笔录" maxlength="150"></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="事故分析会议纪要"> |
| | | <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 label="事故分析会议纪要" prop="fileList"> |
| | | <uploaderImg :fileList="fileList"></uploaderImg> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="其他材料"> |
| | | <el-form-item label="其他材料" prop="otherMaterials"> |
| | | <el-input v-model="ruleForm.otherMaterials" type="textarea" placeholder="请填写其他材料" maxlength="150"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <AccidentName ref="Shows"/> |
| | | <DailogSearchUser ref="userRef" @SearchUser="onUser"/> |
| | | <AccidentName @selectItem="onSelectItem" ref="Shows" /> |
| | | <DailogSearchUser @SearchUser="onUser" ref="userRef" /> |
| | | <RegionsDialog ref="openRef"/> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { |
| | | reactive, |
| | | ref, |
| | | defineComponent |
| | | } from 'vue'; |
| | | import { reactive, ref, defineComponent,onMounted } from 'vue'; |
| | | |
| | | import type { |
| | | UploadUserFile, |
| | | FormInstance, |
| | | FormRules, |
| | | } from 'element-plus' |
| | | import type { UploadUserFile, FormInstance, FormRules } from 'element-plus'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { |
| | | Search, |
| | | FullScreen |
| | | } from '@element-plus/icons-vue' |
| | | import DailogSearchUser from "/@/components/DailogSearchUser/index.vue" |
| | | import AccidentName from '/@/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue' |
| | | import RegionsDialog from '/@/components/regionsDialog/index.vue' |
| | | import {emergencySuppliesApi} from "/@/api/emergencyResources"; |
| | | import {accidentManagementSystemApi} from "/@/api/workInjuryDeclaration"; |
| | | import { Search, FullScreen } from '@element-plus/icons-vue'; |
| | | import DailogSearchUser from '/@/components/DailogSearchUser/index.vue'; |
| | | import AccidentName from '/@/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue'; |
| | | import RegionsDialog from '/@/components/regionsDialog/index.vue'; |
| | | import uploaderImg from '/@/components/uploaderImg/index.vue'; |
| | | import { emergencySuppliesApi } from '/@/api/emergencyResources'; |
| | | import { accidentManagementSystemApi } from '/@/api/workInjuryDeclaration'; |
| | | import { goalManagementApi } from '/@/api/goalManagement'; |
| | | |
| | | export default defineComponent({ |
| | | name: 'openAdd', |
| | |
| | | AccidentName, |
| | | DailogSearchUser, |
| | | RegionsDialog, |
| | | uploaderImg |
| | | }, |
| | | setup(props, { emit }) { |
| | | const isShowDialog = ref(false) |
| | | const isShowDialog = ref(false); |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const ruleFormRef = ref<FormInstance>(); |
| | | //定义表单 |
| | | const ruleForm = ref ({ |
| | | accidentExpressId: '', |
| | | accidentExpressName:'', |
| | | accidentDepartmentId:'', |
| | | accidentDepartmentName:'', |
| | | occurrencePlace:'', |
| | | occurrenceTime:'', |
| | | |
| | | |
| | | |
| | | accidentType: '', |
| | | accidentGrade: '', |
| | | economicLoss: '', |
| | |
| | | rectificationMeasures: '', |
| | | accidentHandling: '', |
| | | fillInUserUid: '', |
| | | fillInUserName:'', |
| | | fillInTime: '', |
| | | relevantPersonnelRecords: '', |
| | | otherMaterials: '', |
| | | fileList: [ |
| | | { |
| | | fileUrl: '', |
| | | fileName: '', |
| | | } |
| | | ], |
| | | fileList: [], |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | |
| | | } |
| | | }; |
| | | // 关闭弹窗 |
| | | const closeDialog = () => { |
| | | const closeDialog = (formEl: FormInstance | undefined) => { |
| | | formEl.resetFields(); |
| | | console.log(ruleForm) |
| | | isShowDialog.value = false; |
| | | }; |
| | | // 取消 |
| | | const onCancel = () => { |
| | | closeDialog(); |
| | | const onCancel = (formEl: FormInstance | undefined) => { |
| | | closeDialog(formEl); |
| | | }; |
| | | //日期选择器 |
| | | const value1 = ref('') |
| | | const value1 = ref(''); |
| | | // 上传附件 |
| | | const fileList = ref<UploadUserFile[]>([]) |
| | | 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: '21', |
| | | label: 'Level two 2-1', |
| | | children: [ |
| | | { |
| | | value: '211', |
| | | label: 'Level three 2-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '22', |
| | | label: 'Level two 2-2', |
| | | children: [ |
| | | { |
| | | value: '221', |
| | | label: 'Level three 2-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: 'Level one 3', |
| | | children: [ |
| | | { |
| | | value: '31', |
| | | label: 'Level two 3-1', |
| | | children: [ |
| | | { |
| | | value: '311', |
| | | label: 'Level three 3-1-1', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '32', |
| | | label: 'Level two 3-2', |
| | | children: [ |
| | | { |
| | | value: '321', |
| | | label: 'Level three 3-2-1', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | }, |
| | | ] |
| | | const treeSelect = ref(); |
| | | //定义树形下拉框 |
| | | const responsibleDepartment = ref() |
| | | const responsibleDepartment = ref(); |
| | | const data = [ |
| | | { |
| | | value: '1', |
| | | label: '广汇能源综合物流发展有限责任公司', |
| | | children: [ |
| | | { |
| | | value: '11', |
| | | label: '经营班子', |
| | | children: [], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '生产运行部', |
| | | children: [ |
| | | { |
| | | value: '21', |
| | | label: '灌装一班', |
| | | children: [] |
| | | }, |
| | | { |
| | | value: '22', |
| | | label: '工艺四班', |
| | | children: [], |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '设备部', |
| | | children: [ |
| | | { |
| | | value: '31', |
| | | label: '仪表班', |
| | | children: [], |
| | | }, |
| | | { |
| | | value: '32', |
| | | label: '机修班', |
| | | children: [], |
| | | }, |
| | | ], |
| | | }, |
| | | ] |
| | | ]; |
| | | // 必填项提示 |
| | | const rules = reactive<FormRules>({ |
| | | accidentDepartmentId: [ |
| | |
| | | { |
| | | required: true, |
| | | message: '发生时间不能为空', |
| | | trigger: 'change', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | accidentType: [ |
| | |
| | | { |
| | | required: true, |
| | | message: '要求报告完成期限不能为空', |
| | | trigger: 'change', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | accidentLevel: [ |
| | |
| | | type: 'date', |
| | | required: true, |
| | | message: '填写日期不能为空', |
| | | trigger: 'change', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }) |
| | | }); |
| | | //事故快报回填 |
| | | const onSelectItem = (item: any) => { |
| | | console.log('item', item[0]); |
| | | ruleForm.value.accidentExpressId = item[0].id |
| | | ruleForm.value.accidentName = item[0].accidentName |
| | | ruleForm.value.accidentDepartmentId = item[0].accidentDepartmentId |
| | | ruleForm.value.accidentDepartmentName = item[0].deptName |
| | | ruleForm.value.occurrencePlace = item[0].occurrencePlace |
| | | ruleForm.value.occurrenceTime = item[0].occurrenceTime |
| | | }; |
| | | // 表单提交验证必填项 |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if (title == '新建事故报告') { |
| | |
| | | console.log('error submit!', fields); |
| | | } |
| | | }); |
| | | } |
| | | else if (title == '修改事故报告') { |
| | | } else if (title == '修改事故报告') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | //TODO 上传组件待定 |
| | | ruleForm.value.fileList = [] |
| | | isShowDialog.value = false; |
| | | accidentManagementSystemApi() |
| | | .editAccidentReport(ruleForm.value) |
| | |
| | | formEl.resetFields(); |
| | | ruleForm.value = { |
| | | accidentExpressId: '', |
| | | accidentExpressName:'', |
| | | accidentDepartmentId:'', |
| | | accidentDepartmentName:'', |
| | | occurrencePlace:'', |
| | | occurrenceTime:'', |
| | | |
| | | |
| | | |
| | | accidentType: '', |
| | | accidentGrade: '', |
| | | economicLoss: '', |
| | |
| | | rectificationMeasures: '', |
| | | accidentHandling: '', |
| | | fillInUserUid: '', |
| | | fillInUserName:'', |
| | | fillInTime: '', |
| | | relevantPersonnelRecords: '', |
| | | otherMaterials: '', |
| | | fileList: [ |
| | | { |
| | | fileUrl: '', |
| | | fileName: '', |
| | | fileList: [], |
| | | }; |
| | | } |
| | | ], |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | isShowDialog.value = false; |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | }; |
| | | const handleChange = (val: number) => { |
| | | console.log(val) |
| | | console.log(val); |
| | | }; |
| | | // 应急队伍弹窗 |
| | | const Shows=ref() |
| | | const Shows = ref(); |
| | | const daiInpt=()=>{ |
| | | Shows.value.openDailog() |
| | | } |
| | | Shows.value.openDailog(); |
| | | }; |
| | | // 选择区域弹窗 |
| | | const openRef=ref() |
| | | const openRef = ref(); |
| | | const regionsDialog=()=>{ |
| | | openRef.value.openDailog() |
| | | } |
| | | openRef.value.openDailog(); |
| | | }; |
| | | // 打开用户选择弹窗 |
| | | const userRef = ref(); |
| | | const openUser = () => { |
| | | userRef.value.openDailog(); |
| | | }; |
| | | const onUser = (e:any) => { |
| | | ruleForm.value.fillInUserUid=e.id |
| | | const onUser = (userItem: any) => { |
| | | ruleForm.value.fillInUserUid = userItem[0].uid; |
| | | ruleForm.value.fillInUserName = userItem[0].realName; |
| | | }; |
| | | //el-tree-select回显 |
| | | const propse = { |
| | | label: 'depName', |
| | | children: 'children', |
| | | }; |
| | | const newTreeList = []; |
| | | //得到部门树 |
| | | const department = async () => { |
| | | await goalManagementApi() |
| | | .getTreedepartment() |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | data.value = res.data.data; |
| | | getTreeList(res.data.data, newTreeList); |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | }; |
| | | // 递归树状数据且修改字段名 |
| | | const getTreeList = (treeList, newTreeList) => { |
| | | treeList.map((c) => { |
| | | let tempData = { |
| | | depName: c.depName, |
| | | value: c.depId, |
| | | children: [], |
| | | }; |
| | | if (c.children && c.children.length > 0) { |
| | | tempData.children = []; |
| | | getTreeList(c.children, tempData.children); |
| | | } |
| | | newTreeList.push(tempData); |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | department(); |
| | | }); |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | |
| | | ruleForm, |
| | | value1, |
| | | treeSelect, |
| | | tree, |
| | | daiInpt, |
| | | Shows, |
| | | ruleFormRef, |
| | |
| | | titles, |
| | | disabled, |
| | | emit, |
| | | handleChange |
| | | handleChange, |
| | | onSelectItem, |
| | | newTreeList, |
| | | department, |
| | | getTreeList, |
| | | propse |
| | | }; |
| | | }, |
| | | }); |