Commit 8361d733 authored by wp song's avatar wp song
Browse files

Merge branch 'developer' of http://git.censoft.com.cn/ai-yunshou/ai-yunshou-vue into developer

parents 7d943eca 4dcefc1b
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -40,6 +40,15 @@ export function listAlgFile(query) {
    })
  }

// 查询我的算法列表
export function listMyAlg(query) {
    return request({
      url: '/yunshou/userAlgorithm/list',
      method: 'get',
      params: query
    })
  }
  
// 查询算法列表x详情
export function detailAlg(id) {
    return request({
@@ -58,6 +67,15 @@ export function addAlg(data) {
  })
}

// 新增我的算法列表
export function addMyAlg(data) {
  return request({
    url: '/yunshou/userAlgorithm',
    method: 'post',
    data: data
  })
}

// 修改算法列表
export function updateAlg(data) {
    return request({
@@ -67,6 +85,24 @@ export function updateAlg(data) {
    })
  }
  
// 修改我的算法列表
export function updateMyAlg(data) {
    return request({
      url: '/yunshou/userAlgorithm',
      method: 'put',
      data: data
    })
  }

  // 修改我的算法状态
export function updateMyAlgState(data) {
  return request({
    url: '/yunshou/userAlgorithm/updateRunningState',
    method: 'post',
    data: data
  })
}


// 删除算法列表
export function deleteAlg(ids) {
@@ -76,6 +112,14 @@ export function deleteAlg(ids) {
  })
}

// 删除我的算法列表
export function deleteMyAlg(ids) {
  return request({
    url: `/yunshou/userAlgorithm/${ids}`,
    method: 'delete'
  })
}


// 启用禁用算法
export function updateAlgState(data) {
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ export function useDict(...args) {
        res.value[dictType] = dicts;
      } else {
        getDicts(dictType).then(resp => {
          res.value[dictType] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }))
          res.value[dictType] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass,remark: p.remark }))
          useDictStore().setDict(dictType, res.value[dictType]);
        })
      }
+11 −2
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
                  <el-button
                     type="primary"
                     plain
                     :class="isActive=='4'?'active':''"
                     @click="changeDivision(12,4)"
                  >四分屏</el-button>
               </el-col>
@@ -55,6 +56,7 @@
                  <el-button
                     type="primary"
                     plain
                    :class="isActive=='6'?'active':''"
                    @click="changeDivision(8,6)"
                  >六分屏</el-button>
               </el-col>
@@ -62,6 +64,7 @@
                  <el-button
                  type="primary"
                  plain
                  :class="isActive=='12'?'active':''"
                  @click="changeDivision(6,12)"
                  >十二分屏</el-button>
               </el-col>
@@ -120,6 +123,7 @@
  const ids = ref([]);
  const total = ref(0);
  const division = ref(6);
  const isActive = ref('12');
  const deviceList = ref([]);
  const algList = ref([]);
  const data = reactive({
@@ -142,6 +146,7 @@
  function changeDivision(val,pageSize){
    division.value=val
    queryParams.value.pageSize=pageSize
    isActive.value=pageSize
    getList()
  }
  
@@ -204,6 +209,10 @@
  </script>
  
  <style scoped lang="scss">
   .active{
    background-color: #409EFF;
    color: #fff;
   }
   .search-input{
    display: flex;
    width: 400px;
+2 −2
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ getDetials()
    }
    .img-box{
      // width: 500px;
      min-height: 365px;
      min-height: 200px;
      // border: 1px solid #d8dce5;
      border-radius: 5px;
      text-align: center;
@@ -411,7 +411,7 @@ getDetials()
    text-align: left;
    font-style: normal;
    text-transform: none;
    min-height: 180px;
    min-height: 120px;
  }
  .text-style{
    font-family: PingFang SC, PingFang SC;
+58 −19
Original line number Diff line number Diff line
@@ -27,14 +27,17 @@
              default-active="2"
              class="el-menu-vertical-demo"
            >
              <el-menu-item :index="''" @click="handMenuClick">
                <span>全部</span>
              <el-menu-item :index="'我的算法'" @click="getMyList">
                <span><el-icon style="color: #7F8184;"><component :is="'HomeFilled'" /></el-icon>我的算法</span>
              </el-menu-item>
              <el-menu-item :index="'我的算法'" @click="handMenuClick">
                <span>我的算法</span>
              <el-divider style="margin: 5px 0;"/>
              <el-menu-item :index="''" @click="handMenuClick">
                <span> <el-icon style="color: #7F8184;"><component :is="'DeleteFilled'" /></el-icon>全部</span>
              </el-menu-item>
     
              <el-menu-item v-for="item in algorithm_scen" :key="item.value" :index="item.value" @click="handMenuClick"> 
                <span style="display: flex;align-items: center;">
                  <el-icon style="color: #7F8184;"><component :is="iconComponent(item.remark)"/></el-icon>
                </span> &nbsp; 
                <span>{{ item.label }}</span>
              </el-menu-item>
            </el-menu>  
@@ -68,7 +71,7 @@
                     type="primary"
                     plain
                     @click="handState('1')"
                  ></el-button>
                  ></el-button>
               </el-col>
               <el-col :span="1.5">
                  <el-button
@@ -91,10 +94,11 @@
                  <div class="cleartitle">
                    <span class="ellipsis">{{item.algorithmName}}</span>
                    <el-tag
                      v-if="listState"
                      :type=" item.algorithmStatus=='0'?'success':'danger'"
                      effect="dark"
                    >
                      {{ item.algorithmStatus=='0'?'已启用':'' }}
                      {{ item.algorithmStatus=='0'?'已启用':'' }}
                    </el-tag>
                  </div>
                </template>
@@ -113,9 +117,9 @@
                    {{ item.cardCopywriting }}
                  </div>
                  <div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 10px;" >
                    <el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" >下载</el-button>
                    <el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" >{{item.algorithmStatus=='0'?'':'启用' }}</el-button>
                    <el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)">删除</el-button>
                    <el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" v-if="!listState">添加</el-button>
                    <el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'':'启用' }}</el-button>
                    <el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)" v-if="listState">删除</el-button>
                    <!-- <el-dropdown trigger="click" @command.stop="handleSetSize">
                      <el-button link type="primary">
                        <el-icon class="el-icon--right">
@@ -148,7 +152,7 @@
</template>
  
<script setup name="Index">
  import { listAlg, detailAlg, addAlg, updateAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js";
  import { listAlg, listMyAlg ,detailAlg, addMyAlg, updateMyAlgState,deleteMyAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js";
  import algorithmDown from './components/algorithmDown.vue'
  // import algForm from './components/algorithmDown.vue'
  const { proxy } = getCurrentInstance();
@@ -160,7 +164,12 @@
  const algorithmDownRef = ref(null)
  const nowText=ref('算法管理')
  const nowTopTitle=ref('算法管理')
  const listState=ref(false)
  const ids = ref([]);
  // const iconComponent = ref('');
  // setTimeout(() => {
  //   iconComponent.value='CirclePlusFilled'
  // }, 1000);
  const algorithmList=reactive([])
  const algList = ref([]);
  const data = reactive({
@@ -182,13 +191,20 @@

  /** 查询算法列表 */
  function getList() {
    // loading.value = true;
    listAlg(queryParams.value).then(response => {
      // console.log("🚀 ~ listAlg ~ response:", response)
      algList.value = response.rows
      // loading.value = false;
      listState.value=false
    });
  }
  /** 查询我的算法列表 */
  function getMyList() {
    nowTopTitle.value='我的算法'
    listMyAlg(queryParams.value).then(response => {
      algList.value = response.rows
      listState.value=true
    });
  }

  function handeAdd(row){
    algorithmDownRef.value.handleAdd()
  }
@@ -201,7 +217,11 @@
    getList()
  }
  function handleUpdate(row) {  
    algorithmDownRef.value.handleUpdate(row)
    addMyAlg({algorithmId:row.id}).then((res) => {
      proxy.$modal.msgSuccess("添加成功");
      console.log("🚀 ~ addMyAlg ~ res:", res)
    })
    // algorithmDownRef.value.handleUpdate(row)
  }
  
  function handMenuClick(row) {
@@ -210,6 +230,15 @@
    getList()
  }
  
  function iconComponent(row){
    if(row){
      return row
    }else{
      return 'CirclePlusFilled'
    }

  }

  function handleEnable(row){
    const params={
      algorithmStatus: row.algorithmStatus=='1'?"0":"1",
@@ -224,14 +253,24 @@

  /** 删除按钮操作 */
  function handleDelete(row) {
    const id = row.id || ids.value;
    const id = row.userAlgorithmId || ids.value;
    proxy.$modal.confirm('是否确认删除算法名称为"' + row.algorithmName + '"的数据项?').then(function() {
      return deleteAlg(id);
      return deleteMyAlg(id);
    }).then(() => {
      getList();
      getMyList();
      proxy.$modal.msgSuccess("删除成功");
    }).catch(() => {});
  }

  //
    function handeImg(row){
      if(row){
        return `src/assets/algImg/${row}.png`

      }else{
        return `src/assets/algImg/setting.png`
      }
    }
  getList();
  </script>
  
Loading