Przeglądaj źródła

ai题名接口调用

duy 1 miesiąc temu
rodzic
commit
2f1ad44954

+ 30 - 0
src/api/modules/ai/ai.js

@@ -0,0 +1,30 @@
+import { HcApi } from '../../request/index'
+
+export default {
+
+  async creatFileNameFormAI(form, msg = true) {
+      return HcApi({
+        url: '/api/blade-archive/archivesauto/creatFileNameFormAI',
+        method: 'post',
+        data: form,
+      }, msg)
+  },
+
+    async getArchiveAiTask(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-archive/archiveainame/getArchiveAiTask',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+  
+    async getPage(form, msg = true) {
+        return HcApi({
+            url: '/  api/blade-archive/archiveainame/page ',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+
+
+}

+ 36 - 4
src/views/archives/manage/ai.vue

@@ -32,10 +32,16 @@
 </template>
 
 <script setup>
-import { ref } from 'vue'
-
-
+import { onMounted, ref } from 'vue'
+import aiApi from '~api/ai/ai.js'
+import { useAppStore } from '~src/store'
+import { useRoute } from 'vue-router'
+import { getArrValue } from 'js-fast-way'
+const useAppState = useAppStore()
 
+const projectId = ref(useAppState.getProjectId)
+const contractId = ref(useAppState.getContractId)
+const useRoutes = useRoute()
 const tableColumn = [
     { key: 'archiveName', name: '案卷题名' },
     { key: 'archiveNameAi', name: 'AI题名' },
@@ -48,12 +54,38 @@ const tableData = ref([
 ])
 //搜索表单
 const searchForm = ref({ current: 1, size: 20, total: 60 })
-
+const taskId = ref(useRoutes.query.taskId)
 //分页被点击
 const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
 }
+const tableLoading = ref(false)
+const getTableData = async () => {
+ 
+    tableLoading.value = true
+    const { error, code, data } = await aiApi.getPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+        taskId: taskId.value,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data?.records)
+        searchForm.value.total = data?.total || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
+}
+
+//渲染完成
+onMounted(() => {
+    // getClassIfyList()
+    getTableData
+
+})
 </script>
 
 <style>

+ 54 - 22
src/views/archives/manage/tuning.vue

@@ -38,10 +38,10 @@
                 >
                     <template #content> 
                         <div class="task-info">
-                            <div v-for="item in taskInfoList" :key="item.id" class="task-info-item" @click="getInfoDetailClick">
+                            <div v-for="item in taskInfoList" :key="item.taskId" v-loading="taskListLoad" class="task-info-item" @click="getInfoDetailClick(item)">
                                 <div class="task-info-item-left">
-                                    <span>{{ item.date }}</span>
-                                    <span v-if="item.state" class="ml-2">待生成</span>
+                                    <span>{{ item.taskTime }}</span>
+                                    <span v-if="item.status === 1" class="ml-2">待生成</span>
                                     <span v-else class="ml-2">生成</span>
                                     <span class="text-red">{{ item.num }}</span>
                                     <span>条AI数据</span>
@@ -56,7 +56,7 @@
                             </div>
                         </div>
                     </template>
-                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" keys="archives_tuning_btn_ai" @click="AiClick">
+                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" keys="archives_tuning_btn_ai" :loading="aiLoading" @click="AiClick" @mouseenter="getTaskInfoList">
                         AI题名
                     </el-button>
                 </el-tooltip>
@@ -371,6 +371,7 @@ import { rowsToId, rowsToIdNumArr } from '~uti/tools'
 
 import tuningApi from '~api/archiveConfig/tuning.js'
 import archiveFileApi from '~api/archiveFile/archiveFileAuto.js'
+import aiApi from '~api/ai/ai.js'
 
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { toPdfPage } from '~uti/btn-auth'
@@ -1247,27 +1248,58 @@ const mergeDataColumn = [
             { key: 'name', name: '案卷题名', align: 'center' },
    
 ]
-const AiClick = ()=>{
-    
+const aiLoading = ref(false)
+
+const AiClick = async ()=>{
+        // 检查是否有被锁定的案卷
+    const lockedArchives = tableCheckedKeys.value.filter(item => item.isLock === 1)
+    if (lockedArchives.length > 0) {
+        window.$message.warning('选择的案卷中包含被锁定的项,无法进行AI题名')
+        return
+    }
+     let ids = ''
+    const rows = tableCheckedKeys.value
+    ids = rowsToId(rows)
+    aiLoading.value = true
+    const { error, code, data, msg } = await aiApi.creatFileNameFormAI({
+        ids: ids,
+        projectId:projectId.value,
+        contractId:contractId.value,
+      
+    })
+    aiLoading.value = false
+    if (!error && code === 200) {
+        window.$message?.success(msg)
+        getTableData()
+         
+    } else {
+        window.$message?.error(msg)
+    }
 }
-const taskInfoList = ref([
-    { date:'2020年6月30日', num:30, state:true, id:1 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:2 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:3 },
-    { date:'2020年6月30日 ', num:30, state:true, id:4 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:5 },
-
-    { date:'2020年6月30日', num:30, state:true, id:1 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:2 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:3 },
-    { date:'2020年6月30日 ', num:30, state:true, id:4 },
-    { date:'2020年6月30日12:43:30', num:30, state:false, id:5 },
-    
 
-])
-const getInfoDetailClick = ()=>{
+const taskInfoList = ref([])
+const getInfoDetailClick = (item)=>{
     console.log('详情')
-        router.push({ path: '/archives/manage/ai' })//ai
+        router.push({ path: '/archives/manage/ai', query:item.taskId })//ai
+}
+const taskListLoad = ref(false)
+const getTaskInfoList = async ()=>{
+
+    taskListLoad.value = true
+    const { error, code, data } = await aiApi.getArchiveAiTask({
+    
+        projectId: projectId.value,
+        contractId: contractId.value,
+      
+    })
+    taskListLoad.value = false
+    if (!error && code === 200) {
+        taskInfoList.value = getArrValue(data?.records)
+      
+    } else {
+        taskInfoList.value = []
+       
+    }
 }
 </script>