|
|
@@ -19,14 +19,14 @@
|
|
|
<el-option label="已发布" :value="2" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div style="height: 70vh;width: 98%;margin-left:1%;background-color: transparent;margin-top: 1%;display: flex;flex-wrap: wrap;justify-content: space-between;">
|
|
|
- <div v-for="(item,index) in modelList">
|
|
|
- <div class="coz-card" @mouseenter="setHoverIndex(index)" @mouseleave="resetHoverIndex">
|
|
|
- <div style="display: flex;">
|
|
|
- <div style="margin-left: 8%;margin-top: 5%;">
|
|
|
+ <div style="height: 70vh;width: 98%;margin-left:1%;background-color: transparent;margin-top: 1%;display: flex;flex-wrap: wrap;justify-content: flex-start;gap: 0.65%">
|
|
|
+ <div v-for="(item,index) in modelList">
|
|
|
+ <div class="coz-card" @mouseenter="setHoverIndex(index)" style="cursor: pointer;" @mouseleave="resetHoverIndex">
|
|
|
+ <div style="display: flex;width: 100%;">
|
|
|
+ <div style="margin-left: 8%;margin-top: 5%;width: 60%;">
|
|
|
{{ item.appTitle }}
|
|
|
</div>
|
|
|
- <img style="width: 90px;height: 90px;margin-left: 40%;margin-top: 8%;border-radius: 12px;" :src="item.appIcon" alt="">
|
|
|
+ <img style="width: 90px;height: 90px;margin-left: 0%;margin-top: 8%;border-radius: 12px;" :src="item.appIcon" alt="">
|
|
|
</div>
|
|
|
<div>
|
|
|
<el-tag style="margin-left: 8%;margin-top: -2%;">应用</el-tag>
|
|
|
@@ -36,7 +36,8 @@
|
|
|
<div style="margin-left: 3%;font-size: 12px;">
|
|
|
创建人:{{ item.createBy }} 更新时间:{{item.createTime}}
|
|
|
</div>
|
|
|
- <el-icon style="color: red;margin-left: auto;cursor: pointer;" @click="delModel(item)" v-if="hoverIndex === index"><Delete /></el-icon>
|
|
|
+ <el-icon style="color: #79bbff;margin-left: auto;cursor: pointer;" @click="editModel(item)" v-if="hoverIndex === index"><Edit /></el-icon>
|
|
|
+ <el-icon style="color: red;margin-left: 2%;cursor: pointer;" @click="delModel(item)" v-if="hoverIndex === index"><Delete /></el-icon>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -98,7 +99,7 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
import { Search,RefreshRight,Plus,Download,Upload,Delete,Setting,Minus} from '@element-plus/icons-vue'
|
|
|
-import { getModellist,addModeling } from '@/api/standardization/modeling'
|
|
|
+import { getModellist,addModeling,delModeling } from '@/api/standardization/modeling'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
import imagePath from '@/assets/images/defaultModel.png';
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
@@ -112,8 +113,10 @@ const uploadRef = ref()
|
|
|
const fileList = ref([
|
|
|
{
|
|
|
url: imagePath,
|
|
|
- status: 'ready',
|
|
|
+ status: 'success', // 关键:标记为已上传
|
|
|
+ uid: Date.now(),
|
|
|
raw: new File([], 'default.png')
|
|
|
+
|
|
|
},
|
|
|
]);
|
|
|
const formAdd = ref({
|
|
|
@@ -147,29 +150,59 @@ const setHoverIndex = (index) => {
|
|
|
const resetHoverIndex = () => {
|
|
|
hoverIndex.value = -1;
|
|
|
};
|
|
|
+function delModel(item){
|
|
|
+ proxy.$confirm('是否删除该模型应用?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delModeling(item.appId).then(res => {
|
|
|
+ if(res.code === 200){
|
|
|
+ proxy.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ getList();
|
|
|
+ } else {
|
|
|
+ proxy.$message.error('删除失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+}
|
|
|
function submitAdd(){
|
|
|
- formAddref.value.validate(async (valid) => {
|
|
|
+ if(!uploadRef.value.fileList){
|
|
|
+ formAddref.value.validate(async (valid) => {
|
|
|
if(valid){
|
|
|
- if (uploadRef.value?.uploadFiles?.length === 0) {
|
|
|
- uploadRef.value.handleStart({
|
|
|
- uid: Date.now(),
|
|
|
- name: 'default.png',
|
|
|
- status: 'ready',
|
|
|
- raw: new File([], 'default.png') // 创建虚拟文件对象
|
|
|
+ formAdd.value.appIcon = '/profile/upload/2025/08/20/defaultModel_20250820173415A032.png'
|
|
|
+ addModeling(formAdd.value).then(res => {
|
|
|
+ if(res.code === 200){
|
|
|
+ proxy.$message({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ isContentVisible.value = false;
|
|
|
+ getList();
|
|
|
+ } else {
|
|
|
+ proxy.$message.error('新增失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ formAddref.value.validate(async (valid) => {
|
|
|
+ if(valid){
|
|
|
+ nextTick(() => {
|
|
|
+ uploadRef.value.submit();
|
|
|
});
|
|
|
}
|
|
|
- nextTick(() => {
|
|
|
- uploadRef.value.submit(); // 触发上传
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
-function handlepro(event, file, fileList){
|
|
|
- console.log("上传进度:", event.percent);
|
|
|
- console.log("当前文件:", file);
|
|
|
- console.log("文件列表:", fileList);
|
|
|
-};
|
|
|
function handleFileSuccess(response, file, fileList){
|
|
|
console.log("上传成功的响应:", response);
|
|
|
if(response.code===200){
|
|
|
@@ -194,11 +227,9 @@ function clearDefault(){
|
|
|
uploadRef.value.clearFiles();
|
|
|
}
|
|
|
function handleChange(file, fileList){
|
|
|
+ console.log(file, fileList)
|
|
|
const rawFile = file.raw;
|
|
|
- console.log("原始文件对象:", rawFile);
|
|
|
-
|
|
|
previewUrl.value = URL.createObjectURL(rawFile);
|
|
|
- console.log("预览地址:", fileList);
|
|
|
}
|
|
|
function showAdd(){
|
|
|
isContentVisible.value = true
|
|
|
@@ -229,15 +260,12 @@ onMounted(() => {
|
|
|
width: 100px !important;
|
|
|
}
|
|
|
.coz-card {
|
|
|
- flex-grow: 1;
|
|
|
- margin-left: 1%;
|
|
|
margin-top: 5%;
|
|
|
height: 20vh;
|
|
|
width: 24vw;
|
|
|
border-radius: 6px;
|
|
|
border: 1px solid;
|
|
|
border-style: solid;
|
|
|
- position: relative;
|
|
|
overflow: hidden;
|
|
|
border-color: #e9e9eb;
|
|
|
transition: all 150ms ease-out;
|