| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog :title="titles" v-model="isShowDialog" width="50%" draggable :fullscreen="full" @close="closeDialog(ruleFormRef)"> |
| | | <el-dialog :title="titles" v-model="isShowDialog" width="50%" draggable :fullscreen="full" |
| | | destroy-on-close @close="closeDialog(ruleFormRef)"> |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" size="default" label-width="140px"> |
| | | <el-row :gutter="35"> |
| | |
| | | <el-form-item label="事故照片" prop="fileList"> |
| | | <!--<el-input v-model="ruleForm.fileList" :disabled="disabled"--> |
| | | <!--type="textarea" placeholder="请填写应急防范措施" maxlength="150"></el-input>--> |
| | | <uploaderImg :fileList="fileListDemo"></uploaderImg> |
| | | <uploaderImg :fileList="fileList" :disabled="disabled" |
| | | :systemName="'INCIDENT_MANAGE'" @successUploader="successUploader"></uploaderImg> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | // 打开弹窗 |
| | | const openDialog = (title: string, id: number, type: boolean) => { |
| | | const openDialog = async (title: string, id: number, type: boolean) => { |
| | | isShowDialog.value = true; |
| | | titles.value = title; |
| | | disabled.value = type; |
| | |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ruleForm.value = res.data.data; |
| | | fileList.value = (res.data.data.fileList?res.data.data.fileList:[]) |
| | | initFileListData() |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | const initFileListData = async () => { |
| | | for(var a = 0;a<fileList.value.length;a++){ |
| | | await goalManagementApi() |
| | | .searchFile(fileList.value[a].fileName) |
| | | .then((res) => { |
| | | fileList.value[a].url = res.data |
| | | }) |
| | | } |
| | | } |
| | | //日期选择器 |
| | | const value1 = ref(''); |
| | | // 上传附件 |
| | | const fileList = ref<UploadUserFile[]>([]); |
| | | const fileListDemo = ref<UploadUserFile[]>([ |
| | | { |
| | | name: 'food.jpeg', |
| | | url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100', |
| | | }, |
| | | { |
| | | name: 'food.jpeg', |
| | | url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100', |
| | | }, |
| | | ]); |
| | | const fileList = ref([]); |
| | | // 上传成功组装数据 |
| | | const successUploader = (list) =>{ |
| | | fileList.value = list |
| | | const formFileList = [] |
| | | for(var a = 0;a<fileList.value.length;a++){ |
| | | formFileList.push( |
| | | { |
| | | fileName:fileList.value[a].fileName, |
| | | fileUrl:'' |
| | | } |
| | | ) |
| | | } |
| | | ruleForm.value.fileList = formFileList |
| | | } |
| | | // 可选择树 |
| | | const treeSelect = ref(); |
| | | |
| | |
| | | // const emit=defineEmits(['myAdd']) |
| | | // 表单提交验证必填项 |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | | if(!ruleForm.value.fileList){ |
| | | ruleForm.value.fileList = [] |
| | | } |
| | | if (title == '新建事故快报') { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | ruleForm.value.fileList = [ |
| | | // { |
| | | // fileUrl: 'url', |
| | | // fileName: 'name', |
| | | // }, |
| | | ]; |
| | | accidentManagementSystemApi() |
| | | .accidentView(ruleForm.value) |
| | | .then((res) => { |
| | |
| | | }; |
| | | const closeDialog = (formEl: FormInstance | undefined) => { |
| | | formEl.resetFields(); |
| | | fileList.value = [] |
| | | console.log(ruleForm); |
| | | isShowDialog.value = false; |
| | | }; |
| | |
| | | getTreeList, |
| | | newTreeList, |
| | | closeDialog, |
| | | fileListDemo, |
| | | successUploader |
| | | }; |
| | | }, |
| | | }); |