nanjingliujinyu пре 5 месеци
родитељ
комит
45834f054c

+ 6 - 0
ruoyi-ui/src/api/standardization/modeling.js

@@ -21,4 +21,10 @@ export function addModeling(data) {
     method: 'post',
     data:data
   });
+}
+export function delModeling(id) {
+  return request({
+    url: '/md/app/' + id,
+    method: 'delete'
+  })
 }

+ 0 - 1
ruoyi-ui/src/utils/request.js

@@ -19,7 +19,6 @@ const service = axios.create({
   // 超时
   timeout: 10000
 })
-
 // request拦截器
 service.interceptors.request.use(config => {
   // 是否需要设置 token

+ 39 - 28
ruoyi-ui/src/views/service/info/editModel.vue

@@ -197,25 +197,25 @@
                             :header-cell-style="{ textAlign: 'center'}"
                             :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
                             border >
-                                <el-table-column prop="itemName" label="参数字段">
+                                <el-table-column prop="itemName" label="参数字段(必填)">
                                     <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-input :disabled="isEdit" placeholder="请填写参数编码" type="primary" class="noBor" v-model="scope.row.paraCode" size="mini" text style="margin-left: 0%;border: transparent;"></el-input>
+                                        <div style="width: 100%;display: flex;">
+                                            <el-input :disabled="isEdit" placeholder="请填写参数编码" type="primary" class="noBor" v-model="scope.row.paramCode" size="mini" text style="margin-left: 0%;border: transparent;"></el-input>
                                         </div>
                                     </template>
                                 </el-table-column>
-                                <el-table-column prop="itemName" label="参数名称">
+                                <el-table-column prop="itemName" label="参数名称(必填)">
                                     <template #default="scope">
                                         <div style="width: 100%;">
-                                            <el-input :disabled="isEdit" placeholder="请填写参数名称" type="primary" class="noBor" v-model="scope.row.paraName" size="mini" text style="margin-left: 0%;"></el-input>
+                                            <el-input :disabled="isEdit" placeholder="请填写参数名称" type="primary" class="noBor" v-model="scope.row.paramName" size="mini" text style="margin-left: 0%;"></el-input>
                                         </div>
                                     </template>
                                 </el-table-column>
-                                <el-table-column prop="itemName" label="参数类型" width="200">
+                                <el-table-column prop="itemName" label="参数类型(必填)" width="200">
                                     <template #default="scope">
                                         <div style="width: 100%;">
                                             <el-select
-                                            v-model="scope.row.paraType"
+                                            v-model="scope.row.paramType"
                                             class="noBorSel"
                                             :disabled="isEdit"
                                             placeholder=""
@@ -234,7 +234,7 @@
                                 <el-table-column prop="itemName" label="参数说明" >
                                     <template #default="scope">
                                         <div style="width: 100%;">
-                                            <el-input type="primary" :disabled="isEdit" class="noBor" v-model="scope.row.paraNote" size="mini" text style="margin-left: 0%;"></el-input>
+                                            <el-input type="primary" :disabled="isEdit" class="noBor" v-model="scope.row.paramNote" size="mini" text style="margin-left: 0%;"></el-input>
                                         </div>
                                     </template>
                                 </el-table-column>
@@ -659,10 +659,10 @@ const parTree = ref({})
 const valueKet = ref(0)
 const tableDataCan = ref([
     {
-      parName:'',
-      parCode:'',
-      parType:'',
-      parNote:''
+      paramName:'',
+      paramCode:'',
+      paramType:'',
+      paramNote:''
     }
 ])
 const optionsMdid = ref([])
@@ -940,22 +940,30 @@ async function saveEditService(){
     par.example = example.value
     par.rpcontent = dataJsonXiang.value
     par.cateCode = par.cateCode[0]
-    console.log(par)
-    await editService(par).then(res=>{
-      if(res.code===200){
-        var parCan = tableDataCan.value
-        parCan.forEach(item => {
-          item.srvId = parId.value
-        });
-        // parCan.srvId = parId.value
-        addServiceParam(parCan).then(res1=>{
-          if(res1.code===200){
-            proxy.$modal.msgSuccess("修改成功");
-            getTreeLeft()
-          }
-        })
+    var validTable = true
+    for (const item of tableDataCan.value) {
+      if (item.paramCode.length === 0 || item.paramName.length === 0 || item.paramType.length === 0) {
+          proxy.$modal.msgError("请填写必填项!");
+          validTable = false
+          break;
       }
-    })
+    }
+    if(validTable){
+      await editService(par).then(res=>{
+        if(res.code===200){
+          var parCan = tableDataCan.value
+          parCan.forEach(item => {
+            item.srvId = parId.value
+          });
+          addServiceParam(parCan).then(res1=>{
+            if(res1.code===200){
+              proxy.$modal.msgSuccess("修改成功");
+              getTreeLeft()
+            }
+          })
+        }
+      })
+    }
   }
 }
 async function addSer(){
@@ -1077,7 +1085,10 @@ function buildTree(flatData, rootValue = '0') {
     }
 function addPa(){
     var par = {
-      
+      paramName:'',
+      paramNote:'',
+      paramType:'',
+      paramCode:''
     }
     tableDataCan.value.push(par)
 }

+ 60 - 32
ruoyi-ui/src/views/standardization/modelUsing/index.vue

@@ -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;