From 5c475d3ac8ee98713e0f0962dd9464daccfb9eb1 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 28 十一月 2024 18:16:07 +0800
Subject: [PATCH] 模型参数改为output

---
 src/views/model/mpk/file/MpkForm.vue |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/src/views/model/mpk/file/MpkForm.vue b/src/views/model/mpk/file/MpkForm.vue
index bc18d62..22d5efc 100644
--- a/src/views/model/mpk/file/MpkForm.vue
+++ b/src/views/model/mpk/file/MpkForm.vue
@@ -16,7 +16,7 @@
           <el-col :span="12">
             <el-form-item label="模型类型" prop="pyType">
               <el-radio-group v-model="formData.pyType" @change="pyTypeChange">
-                <el-radio-button
+                <el-radio-button :disabled="actionType == 'edit'"
                   v-for="dict in getDictOptions(DICT_TYPE.MODEL_TYPE)"
                   :key="dict.label"
                   :label="dict.value"
@@ -28,7 +28,7 @@
           </el-col>
         </el-row>
         <el-row :gutter="8">
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="模型文件" prop="pyName">
               <el-input disabled v-model="formData.pyName" placeholder=""/>
             </el-form-item>
@@ -41,13 +41,14 @@
               :action="importUrl"
               :auto-upload="true"
               :disabled="uploadLoading"
+              v-loading="uploadLoading"
               :before-upload="beforeUpload"
               :headers="uploadHeaders"
               :on-error="submitFormError"
               :on-success="submitFormSuccess"
-              accept=".pyd"
+              accept=".py"
             >
-              <el-tooltip content="上传.pyd算法文件" placement="top" effect="light">
+              <el-tooltip content="上传.py算法文件" placement="top" effect="light">
                 <el-button type="primary">
                   <Icon icon="ep:upload"/>
                   模型上传
@@ -67,12 +68,23 @@
         <el-row :gutter="8">
           <el-col :span="12">
             <el-form-item label="包名" prop="pkgName">
-              <el-input v-model="formData.pkgName" placeholder=""/>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="模型路径" prop="pyModule">
-              <el-input v-model="formData.pyModule" placeholder=""/>
+              <el-select v-model="formData.pkgName" clearable filterable placeholder="请选择包名">
+                <el-option
+                  v-for="item in pkgNameList"
+                  :key="item.packName"
+                  :label="item.packName"
+                  :value="item.packName"
+                >
+                  <span style="float: left">{{ item.packName}}</span>
+                  <span
+                    style="
+                      float: right;
+                      color: var(--el-text-color-secondary);
+                      font-size: 13px;">
+                    {{ item.packDesc}}
+                  </span>
+                </el-option>
+              </el-select>
             </el-form-item>
           </el-col>
         </el-row>
@@ -104,7 +116,7 @@
                       float: right;
                       color: var(--el-text-color-secondary);
                       font-size: 13px;">
-                    <img :src="'/SimtreeUnitImage/' + item.iconName" style="height: 24px;" :alt=" item.iconDesc" />
+                    <img :src="staticDir + 'SimtreeUnitImage/' + item.iconName" style="height: 24px;" :alt=" item.iconDesc" />
                   </span>
                 </el-option>
               </el-select>
@@ -112,7 +124,7 @@
           </el-col>
         </el-row>
         <el-row :gutter="20">
-          <el-col :span="24">
+          <el-col :span="12">
             <el-form-item label="备注" prop="remark">
               <el-input v-model="formData.remark" placeholder="" type="textarea"/>
             </el-form-item>
@@ -198,6 +210,7 @@
                         @click="updateSetting(scope.row)"
                         key="danger"
                         type="primary"
+                        :disabled="scope.row.settingKey === 'pyFile'"
                         link
                       >修改
                       </el-button>
@@ -205,6 +218,7 @@
                         @click="deleteSetting(props.row.methodSettings,scope.$index)"
                         key="danger"
                         type="danger"
+                        :disabled="scope.row.settingKey === 'pyFile'"
                         link
                       >删除
                       </el-button>
@@ -240,6 +254,7 @@
   import {DICT_TYPE, getDictOptions, getIntDictOptions} from '@/utils/dict'
   import * as MpkApi from '@/api/model/mpk/mpk'
   import * as MpkIconApi from '@/api/model/mpk/icon'
+  import * as MpkPackApi from '@/api/model/mpk/pack'
   import * as MpkMenuApi from '@/api/model/mpk/menu'
   import {FormRules} from 'element-plus'
   import {getAccessToken, getTenantId} from "@/utils/auth";
@@ -249,13 +264,17 @@
   const {t} = useI18n() // 国际化
   const message = useMessage() // 消息弹窗
   const title = ref('') // 弹窗的标题
+  const actionType = ref('') // 操作类型
   const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
   const formType = ref('') // 表单的类型:create - 新增;update - 修改
   const route = useRoute() // 路由
   const router = useRouter();
 
+  const staticDir = ref(import.meta.env.VITE_STATIC_DIR)
+
   const treeData = ref([])
   const iconList = ref([] as MpkIconApi.MpkIconVO)
+  const pkgNameList = ref([] as MpkPackApi.MpkPackVO)
 
 /** settingForm弹窗 */
   const settingFormRef = ref()
@@ -310,9 +329,6 @@
     ],
     className: [
       {required: true, message: '类名不能为空', trigger: 'blur'}
-    ],
-    pyModule: [
-      {required: true, message: '模型路径不能为空', trigger: 'blur'}
     ],
     menuAndGroup: [
       {required: true, message: '所属目录不能为空', trigger: 'blur'}
@@ -418,7 +434,7 @@
     }
     const data = response.data;
     formData.value.filePath = data.filePath
-    formData.value.pyName = data.fileName.replace('.pyd', '')
+    formData.value.pyName = data.fileName
     message.success('上传成功')
     uploadLoading.value = false
   }
@@ -426,6 +442,7 @@
   onMounted(async () => {
     const id = formData.value.id;
     const type = id ? 'edit' : 'create'
+    actionType.value = type
     title.value = t('action.' + type)
     formType.value = type
     resetForm()
@@ -434,7 +451,9 @@
     if (id) {
       formLoading.value = true
       try {
+        debugger
         formData.value = await MpkApi.getMpk(id)
+        debugger
       } finally {
         formLoading.value = false
       }
@@ -442,6 +461,8 @@
 
     // 加载图标列表
     iconList.value = await MpkIconApi.getList()
+
+    pkgNameList.value = await MpkPackApi.getList()
 
     // 加载菜单,分组
     treeData.value = await MpkMenuApi.getTree()
@@ -468,7 +489,6 @@
           methodSettings: []
         }
       ]
-      debugger
     }else {
       formData.value.modelMethods = [
         {

--
Gitblit v1.9.3