|
@@ -3,10 +3,14 @@
|
|
<el-card>
|
|
<el-card>
|
|
<!-- 添加el-button触发弹窗 -->
|
|
<!-- 添加el-button触发弹窗 -->
|
|
<!-- 添加一个按钮来控制显示Upload组件 -->
|
|
<!-- 添加一个按钮来控制显示Upload组件 -->
|
|
- <el-button type="primary" @click="toggleUpload">上传图片</el-button>
|
|
|
|
|
|
+ <!-- 添加el-button触发弹窗 -->
|
|
|
|
+ <el-button type="primary" @click="showUploadDialog = true">上传图片</el-button>
|
|
|
|
|
|
- <!-- 使用v-if根据showUpload的值来决定是否渲染Upload组件 -->
|
|
|
|
- <upload v-if="showUpload"></upload>
|
|
|
|
|
|
+ <!-- 使用el-dialog组件 -->
|
|
|
|
+ <el-dialog v-model="showUploadDialog" title="上传图片">
|
|
|
|
+ <!-- 在这里插入你的upload组件 -->
|
|
|
|
+ <upload @close="showUploadDialog = false" />
|
|
|
|
+ </el-dialog>
|
|
<!-- 添加el-dialog组件 -->
|
|
<!-- 添加el-dialog组件 -->
|
|
<el-table :data="tableData" border style="width: 100%;margin-top:20px">
|
|
<el-table :data="tableData" border style="width: 100%;margin-top:20px">
|
|
<el-table-column label="序号" width="60">
|
|
<el-table-column label="序号" width="60">
|
|
@@ -28,26 +32,25 @@
|
|
<el-table-column label="操作" width="100">
|
|
<el-table-column label="操作" width="100">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-button type="danger" size="small" @click="deleteResource(scope.row.ID)">删除</el-button>
|
|
<el-button type="danger" size="small" @click="deleteResource(scope.row.ID)">删除</el-button>
|
|
-<!-- <el-button type="primary" size="small" @click="deleteResource(scope.row.ID)">修改</el-button>-->
|
|
|
|
-<!-- <el-button size="small"-->
|
|
|
|
-<!-- @click="() => router.push({ path: '/user/detail', query: { id: scope.row.id } })">详情-->
|
|
|
|
-<!-- </el-button>-->
|
|
|
|
|
|
+ <!-- <el-button type="primary" size="small" @click="deleteResource(scope.row.ID)">修改</el-button>-->
|
|
|
|
+ <!-- <el-button size="small"-->
|
|
|
|
+ <!-- @click="() => router.push({ path: '/user/detail', query: { id: scope.row.id } })">详情-->
|
|
|
|
+ <!-- </el-button>-->
|
|
|
|
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
- <el-pagination style="margin-top:20px" :current-page="searchForm.page" :page-size="searchForm.size"
|
|
|
|
- :total="total"
|
|
|
|
- @current-change="handleCurrentChange"/>
|
|
|
|
|
|
+ <el-pagination style="margin-top:20px" :current-page="searchForm.page" :page-size="searchForm.size" :total="total"
|
|
|
|
+ @current-change="handleCurrentChange" />
|
|
</el-card>
|
|
</el-card>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import {onMounted, reactive, ref} from "vue";
|
|
|
|
-import {ElMessage, ElMessageBox} from 'element-plus';
|
|
|
|
-import {useRouter} from 'vue-router'
|
|
|
|
|
|
+import { onMounted, reactive, ref } from "vue";
|
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
+import { useRouter } from 'vue-router'
|
|
import resource from "../../api/resource";
|
|
import resource from "../../api/resource";
|
|
import Upload from "./upload.vue";
|
|
import Upload from "./upload.vue";
|
|
|
|
|
|
@@ -98,14 +101,14 @@ const searchUser = () => {
|
|
// 删除资源信息
|
|
// 删除资源信息
|
|
const deleteResource = (id) => {
|
|
const deleteResource = (id) => {
|
|
ElMessageBox.confirm(
|
|
ElMessageBox.confirm(
|
|
- '确定要删除该资源信息吗?',
|
|
|
|
- {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning',
|
|
|
|
- }
|
|
|
|
|
|
+ '确定要删除该资源信息吗?',
|
|
|
|
+ {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ }
|
|
).then(async () => {
|
|
).then(async () => {
|
|
- const res = await resource.deleteResource({id: id});
|
|
|
|
|
|
+ const res = await resource.deleteResource({ id: id });
|
|
if (res.data.Code === 200) {
|
|
if (res.data.Code === 200) {
|
|
ElMessage.success("删除成功")
|
|
ElMessage.success("删除成功")
|
|
getResourceList();
|
|
getResourceList();
|