| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" :title="titles" width="50%" draggable> |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form :model="form" :disabled="disabled" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="岗位" size="default"> |
| | | <el-input v-model="form.jobId" placeholder="请选择"> |
| | | <template #append> <el-button :icon="Search" @click="daiInpt" /> </template |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="责任书签订日期" size="default"> |
| | | <el-date-picker v-model="form.signDate" style="width:100%" format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择日期时间" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="备注信息"> |
| | | <el-input v-model="form.memo" type="textarea" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <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" |
| | | multiple |
| | | :on-preview="handlePreview" |
| | | :on-remove="handleRemove" |
| | | :before-remove="beforeRemove" |
| | | :limit="3" |
| | | :on-exceed="handleExceed" |
| | | > |
| | | <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" size="default">关闭</el-button> |
| | | <el-button type="primary" @click="submitForm" size="default">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <DailogSearch ref="Shows" @backNum="IdNumber"></DailogSearch> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref, reactive } from 'vue'; |
| | | import { Search, FullScreen } from '@element-plus/icons-vue'; |
| | | import DailogSearch from './DailogSearch.vue'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import type { UploadProps, UploadUserFile } from 'element-plus'; |
| | | import { goalManagementApi } from '/@/api/goalManagement'; |
| | | export default defineComponent({ |
| | | components: { DailogSearch }, |
| | | setup(props, { emit }) { |
| | | const dialogVisible = ref<boolean>(false); |
| | | const form = ref({ |
| | | indexNum: '', //目标指标编号 |
| | | memo: '', ////备注信息 |
| | | signDate: '', //责任书签订日期 |
| | | extraFile: '666', //责任书附件 |
| | | jobId: '', //岗位 |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(false); |
| | | // 打开弹窗 |
| | | const openDailog = (title: string, value: any, id: number) => { |
| | | dialogVisible.value = true; |
| | | titles.value =`${title}目标责任书`; |
| | | disabled.value = title == '查看' ? true : false; |
| | | if (title == '查看' || title == '修改') |
| | | goalManagementApi() |
| | | .gettargetDutyfileInfoDetail(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | form.value = res.data.data; |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | }; |
| | | // 提交 |
| | | const submitForm = () => { |
| | | dialogVisible.value = false; |
| | | goalManagementApi() |
| | | .gettargetDutyfileInfoAddorUpdata(form.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('navAddorUpdata'); |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | form.value = { |
| | | indexNum: '', //目标指标编号 |
| | | memo: '', ////备注信息 |
| | | signDate: '', //责任书签订日期 |
| | | extraFile: '666', //责任书附件 |
| | | jobId: '', //岗位 |
| | | }; |
| | | }; |
| | | // 取消 |
| | | const resetForm = () => { |
| | | dialogVisible.value = false; |
| | | form.value = { |
| | | indexNum: '', //目标指标编号 |
| | | memo: '', ////备注信息 |
| | | signDate: '', //责任书签订日期 |
| | | extraFile: '666', //责任书附件 |
| | | jobId: '', //岗位 |
| | | }; |
| | | }; |
| | | // 安全目标指标弹窗 |
| | | const Shows = ref(); |
| | | const daiInpt = () => { |
| | | Shows.value.openDailog(); |
| | | }; |
| | | const IdNumber=(val:any)=>{ |
| | | form.value.jobId=val.id |
| | | } |
| | | // 点击上传 |
| | | const fileList = ref<UploadUserFile[]>([ |
| | | { |
| | | name: 'element-plus-logo.svg', |
| | | url: 'https://element-plus.org/images/element-plus-logo.svg', |
| | | }, |
| | | { |
| | | name: 'element-plus-logo2.svg', |
| | | url: 'https://element-plus.org/images/element-plus-logo.svg', |
| | | }, |
| | | ]); |
| | | |
| | | const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => { |
| | | console.log(file, uploadFiles); |
| | | }; |
| | | |
| | | const handlePreview: UploadProps['onPreview'] = (uploadFile) => { |
| | | console.log(uploadFile); |
| | | }; |
| | | |
| | | const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { |
| | | ElMessage.warning(`The limit is 3, you selected ${files.length} files this time, add up to ${files.length + uploadFiles.length} totally`); |
| | | }; |
| | | |
| | | const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { |
| | | return ElMessageBox.confirm(`Cancel the transfert of ${uploadFile.name} ?`).then( |
| | | () => true, |
| | | () => false |
| | | ); |
| | | }; |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | | if (full.value == false) { |
| | | full.value = true; |
| | | } else { |
| | | full.value = false; |
| | | } |
| | | }; |
| | | return { |
| | | IdNumber, |
| | | dialogVisible, |
| | | form, |
| | | disabled, |
| | | titles, |
| | | openDailog, |
| | | daiInpt, |
| | | submitForm, |
| | | resetForm, |
| | | Shows, |
| | | Search, |
| | | fileList, |
| | | handleRemove, |
| | | handlePreview, |
| | | handleExceed, |
| | | beforeRemove, |
| | | full, |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | .el-row { |
| | | padding: 0 0 20px 0; |
| | | } |
| | | </style> |