| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">取消</el-button> |
| | | <el-button type="primary" |
| | | @click="submitForm">确定</el-button> |
| | | <el-button @click="dialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | <el-descriptions-item label="附件列表:"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | @click="downLoadFile(endform)">附件列表</el-button> |
| | | @click="openFileDialog(endform)">附件列表</el-button> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | <!-- <el-divider style="margin: 20px 0;" /> --> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 附件列表弹窗 --> |
| | | <FileListDialog ref="fileListRef" |
| | | v-model="fileListDialogVisible" |
| | | :show-upload-button="true" |
| | | :show-delete-button="true" |
| | | :is-show-pagination="true" |
| | | :page="filePagination" |
| | | :upload-method="handleUpload" |
| | | :delete-method="handleFileDelete" |
| | | @pagination="paginationSearch" |
| | | title="附件列表" /> |
| | | <!-- todo 附件预览相关 --> |
| | | <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="safe_training" :record-id="recordId" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import FileListDialog from "@/components/Dialog/FileListDialog.vue"; |
| | | import { |
| | | onMounted, |
| | | ref, |
| | |
| | | import useUserStore from "@/store/modules/user"; |
| | | import dayjs from "dayjs"; |
| | | const userStore = useUserStore(); |
| | | const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue")); |
| | | |
| | | // 表单验证规则 |
| | | const rules = { |
| | |
| | | name: "附件", |
| | | type: "text", |
| | | clickFun: row => { |
| | | downLoadFile(row); |
| | | openFileDialog(row); |
| | | }, |
| | | color: "#007AFF", |
| | | }, |
| | |
| | | form.value.principalMobile = selectedUser.phonenumber; |
| | | } |
| | | }; |
| | | /** |
| | | * 下载文件 |
| | | * |
| | | * @param row 下载文件的相关信息对象 |
| | | */ |
| | | const fileListRef = ref(null); |
| | | const fileListDialogVisible = ref(false); |
| | | const currentFileRow = ref(null); |
| | | const downLoadFile = row => { |
| | | currentFileRow.value = row; |
| | | safeTrainingFileListPage({ |
| | | safeTrainingId: row.id, |
| | | current: filePagination.value.current, |
| | | size: filePagination.value.size, |
| | | }).then(res => { |
| | | if (fileListRef.value) { |
| | | fileListRef.value.open(res.data.records); |
| | | filePagination.value.total = res.data?.total || 0; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 打开附件弹窗 |
| | | const recordId =ref(0) |
| | | const fileDialogVisible = ref(false) |
| | | |
| | | // 打开附件弹框 |
| | | const openFileDialog = async (row) => { |
| | | recordId.value = row.id |
| | | fileDialogVisible.value = true |
| | | } |
| | | |
| | | // 上传附件 |
| | | const handleUpload = async () => { |
| | | if (!currentFileRow.value) { |
| | |
| | | const pagination = obj => { |
| | | page.value.current = obj.page; |
| | | page.value.size = obj.limit; |
| | | handleQuery(); |
| | | getList(); |
| | | }; |
| | | |
| | | // 选择变化处理 |