zhangxiao
2024-08-15 a4a3a0d6457fb9318236e8e89fbcf95fed1cd5d6
src/views/dmx/model/index.vue
@@ -61,6 +61,9 @@
                          <div class="arco-btn-group">
                            <a-space class="btn-group">
                              <!-- <editModel></editModel> -->
                              <a-button @click="handleDeleteModel(item, 1)">
                                删除
                              </a-button>
                              <a-button
                                type="primary"
                                @click="handleEditModel(item, 1)"
@@ -102,12 +105,12 @@
                              <a-button @click="handleDeleteModel(list)">
                                删除
                              </a-button>
                              <a-button
                              <!-- <a-button
                                type="primary"
                                @click="handleEditModel(list)"
                              >
                                编辑
                              </a-button>
                              </a-button> -->
                              <!-- <editModel></editModel> -->
                            </a-space>
@@ -120,7 +123,7 @@
              </a-tabs>
            </a-col>
            <div> </div>
            <div class="box_right">
            <div class="box_right" v-if="Object.keys(tabData).length > 0">
              <!-- <div class="search_input">
                <a-input-search
                  :placeholder="$t('cardList.searchInput.placeholder')"
@@ -128,8 +131,11 @@
                />
              </div> -->
              <div>
                <!-- <addModel></addModel> -->
                <a-button type="primary" @click="handleAddModel">
                <a-button
                  type="primary"
                  @click="handleAddModel"
                  :disabled="addBtn"
                >
                  <template #icon>
                    <icon-plus />
                  </template>
@@ -172,6 +178,7 @@
    modelmyLlms,
    deleteLlm,
    deleteLlmFactory,
    getFactoryDetail,
  } from '@/api/model';
  import { Modal, Message } from '@arco-design/web-vue';
  import { userModelState } from '@/store';
@@ -180,6 +187,7 @@
  const modelStore = userModelState();
  let count = 5;
  const addBtn = ref(false);
  const activeKey = ref(1);
  const data = ref([
    {
@@ -202,6 +210,7 @@
    key: {
      tags: '添加key',
      id: 1,
      live: 1,
    },
  });
@@ -209,8 +218,9 @@
  const modalList = ref({});
  const tabKey = ref('key');
  const changeTabs = (val) => {
  const changeTabs = async (val) => {
    tabKey.value = val;
    await getFactory();
  };
  const httpUrl = modelStore.hrefUrl;
@@ -252,27 +262,31 @@
  };
  //删除模型
  const handleDeleteModel = (val) => {
    Modal.confirm({
      title: '警告',
      content: '确认删除吗',
      okText: '确定',
      cancelText: '取消',
      onOk: async () => {
        const factory = tabKey.value;
        const res = await deleteLlm({
          llm_factory: tabKey.value,
          llm_name: val.name,
        });
  const handleDeleteModel = (val, type) => {
    if (type == 1) {
      handleDelete(val);
    } else {
      Modal.confirm({
        title: '警告',
        content: '确认删除吗',
        okText: '确定',
        cancelText: '取消',
        onOk: async () => {
          const factory = tabKey.value;
          const res = await deleteLlm({
            llm_factory: tabKey.value,
            llm_name: val.name,
          });
        if ((res as any).code == 0) {
          queryModel();
          tabKey.value = factory;
        } else {
        }
      },
      onCancel: () => {},
    });
          if ((res as any).code == 0) {
            queryModel();
            tabKey.value = factory;
          } else {
          }
        },
        onCancel: () => {},
      });
    }
  };
  //父级模型
@@ -325,12 +339,36 @@
    modalList.value = res.data;
    loading.value = true;
    tabData.value = Object.assign({}, tabData.value, res.data);
    tabData.value = filterObject(tabData.value, 1);
    tabKey.value = Object.keys(tabData.value)[0];
    await getFactory();
  };
  queryModel();
  //返回满足条件的对象
  const filterObject = (obj, threshold) => {
    return Object.keys(obj)
      .filter((key) => obj[key].added == 1)
      .reduce((result, key) => {
        result[key] = obj[key];
        return result;
      }, {});
  };
  const refreshParentMethod = () => {
    queryModel();
    // 这里执行需要的操作
  };
  const getFactory = async () => {
    const { data } = await getFactoryDetail({
      factory_name: tabKey.value,
    });
    if (data.set_type == 2) {
      addBtn.value = true;
    } else {
      addBtn.value = false;
    }
  };
</script>
@@ -415,6 +453,9 @@
      // border-radius: 0;
      // background-color: #eee;
    }
    :deep(.arco-tabs-tab-close-btn) {
      display: none;
    }
    :deep(.arco-tabs-tab-close-btn .arco-icon) {
      color: #666;
    }