Commit 2fb6a094 by cwy

多个pdf文件问题

parent dbefce83
......@@ -2,4 +2,4 @@
ENV = 'production'
# 线上环境接口地址
VITE_API_URL = '/element-plus-api_v1'
\ No newline at end of file
VITE_API_URL = '/product_library_api'
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,6 +27,7 @@
"qs": "^6.11.0",
"screenfull": "^6.0.2",
"sortablejs": "^1.15.0",
"terser": "^5.34.1",
"vue": "^3.2.45",
"vue-clipboard3": "^2.0.0",
"vue-router": "^4.1.6",
......
......@@ -80,6 +80,21 @@ export function productApi() {
data,
});
},
enterpriseAllocationList: (data) => {
return request({
url: '/api/enterpriseAllocation/list',
method: 'post',
data,
});
},
equalDistributionEnterprise: (data) => {
return request({
url: '/api/enterpriseAllocation/equalDistributionEnterprise',
method: 'post',
data,
});
},
};
}
......
......@@ -103,7 +103,7 @@ router.beforeEach(async (to, from, next) => {
Session.clear();
NProgress.done();
} else if (token && to.path === '/login') {
next('/product_info');
next('/product_info/allocation');
NProgress.done();
} else {
const storesRoutesList = useRoutesList(pinia);
......
......@@ -23,7 +23,7 @@ export const dynamicRoutes = [
path: '/',
name: '/',
component: () => import('/@/layout/index.vue'),
redirect: '/inspectInfo',
redirect: '/product_info/allocation',
meta: {
isKeepAlive: false,
},
......
......@@ -3,28 +3,28 @@ export function getHost() {
if (process.env.NODE_ENV === 'development') {
return '/dev'
} else {
return '/element-plus-api_v1'
return '/product_library_api'
}
}
export function getUploadUrl() {
if (process.env.NODE_ENV === 'development') {
return '/dev/api/upload/picture'
} else {
return '/element-plus-api_v1/api/upload/picture'
return '/product_library_api/api/upload/picture'
}
}
export function getUploadPdf() {
if (process.env.NODE_ENV === 'development') {
return '/dev/api/getUploadUrl'
} else {
return '/element-plus-api_v1/api/getUploadUrl'
return '/product_library_api/api/getUploadUrl'
}
}
export function getServerUrl() {
if (process.env.NODE_ENV === 'development') {
return '/dev/api'
} else {
return '/element-plus-api_v1/api'
return '/product_library_api/api'
}
}
......
......@@ -25,7 +25,7 @@
<el-table-column prop="product_id" label="产品ID" key="product_id" v-if="columns[0].visible" width="200" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="productInfo.page_url" label="页面URL" key="page_url" v-if="columns[2].visible" width="200" align="center">
<template #default="scope">
<el-link type="productInfo.primary" :href="scope.row.page_url" target ="_blank">{{scope.row.page_url}}</el-link>
<el-link type="primary" :href="scope.row.productInfo.page_url" target ="_blank">{{scope.row.productInfo.page_url}}</el-link>
</template>
</el-table-column>
<el-table-column prop="productInfo.product_categ_name" label="产品分类名称" key="product_categ_name" v-if="columns[3].visible" width="200" align="center"></el-table-column>
......
<template>
<div class="system-menu-container">
<div class="breadcrumb-box">
<Breadcrumb />
</div>
<div class="header-search flex space-between">
<!-- <div>
<el-select v-model="state.apiListParam.task_id" placeholder="请选择任务" size="default" @change="searchChange" clearable filterable style="width:200px;margin-right: 20px;">
<el-option v-for="(item, index) in state.taskList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
</div> -->
<!-- <el-button size="default" type="primary" @click="add()" >新增产品</el-button>
<el-button size="default" type="primary" @click="distribute()" >产品分发</el-button> -->
<el-button size="default" type="primary" @click="allocation()" >分配任务</el-button>
</div>
<div class="page-main" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<!-- <Toolbar ref="ToolbarRef" v-model:showSearch="showSearch" @queryTable="getList" @search="search" :columns="columns"/> -->
<el-table :data="state.tableData.data" style="width: 100%" :height="state.tableHeight"
ref="multipleTableRef">
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="enterpriseInfo.enterprise_name" label="企业名称" key="product_categ_name" align="center"></el-table-column>
<el-table-column prop="adminInfo.name" label="检查人员" key="product_name" align="center"></el-table-column>
<el-table-column prop="total" label="产品总数" key="product_model" width="200" align="center">
<template #default="scope"><span style="color: #409EFF;">{{scope.row.total }}</span></template>
</el-table-column>
<el-table-column prop="not_checked" label="未检查数量" key="product_model" width="200" align="center">
<template #default="scope"><span style="color: #E6A23C;">{{scope.row.not_checked }}</span></template>
</el-table-column>
<el-table-column prop="checked" label="已检查数量" key="product_model" width="200" align="center">
<template #default="scope"><span style="color: #67C23A;">{{scope.row.checked }}</span></template>
</el-table-column>
<el-table-column prop="distribute_time" label="分发时间" key="product_model" align="center"></el-table-column>
</el-table>
<div class="pagination-box">
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.apiListParam.page" background
v-model:page-size="state.apiListParam.limit" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-card>
</div>
<AddDialog ref="AddDialogRef" @refresh="getList()" />
<DistributeDialog ref="DistributeDialogRef" @refresh="getList()" />
<SetupDialog ref="SetupDialogRef" @refresh="getList()" />
<Search ref="SearchDialogRef" @search-to-parent="searchData" />
</div>
</template>
<script setup name="taskPackage-list">
import { getCurrentInstance } from 'vue';
import { productApi } from '/@/api/product'
const router = useRouter();
import { ElMessageBox, ElMessage } from 'element-plus';
import { Session } from '/@/utils/storage';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const SetupDialog = defineAsyncComponent(() => import('/@/views/product_info/list/setup.vue'));
const AddDialog = defineAsyncComponent(() => import('/@/views/product_info/list/add.vue'));
const DistributeDialog = defineAsyncComponent(() => import('/@/views/product_info/list/distribute.vue'));
const Toolbar = defineAsyncComponent(() => import('/@/components/RightToolbar/index.vue'));
const Search = defineAsyncComponent(() => import('/@/views/product_info/list/search.vue'));
// 定义变量内容
const AddDialogRef = ref()
const DistributeDialogRef = ref()
const SetupDialogRef = ref()
const SearchDialogRef = ref()
const state = reactive({
// 查询列表参数
apiListParam: {
page: 1,
limit: 10,
},
tableData: {
data: [],
total: 0
},
tableHeight: '30vh',
normListExtend:[],
testIndex:0,
taskList:[],
verifyTypeList:['待检查','已检查'],
});
// 页面加载时
onMounted(() => {
getList()
state.tableHeight = getCurrentInstance().refs.pageMain.offsetHeight - 130 - 52 + "px";
});
const emits = defineEmits(['update:showSearch', 'queryTable','search','refresh']);
const search = () => {
SearchDialogRef.value.openDialog();
}
/**
* 搜索条件
*/
const searchData = (va) => {
console.log(va)
productApi().list({search:va}).then(res => {
state.tableData.data = res.data.data
state.tableData.total = res.data.total
}).catch(() => {
})
}
/**
* 重置按钮
*/
const reset = () => {
state.apiListParam.page = 1
state.apiListParam.name = '';
getList()
}
// 分页改变
const onHandleSizeChange = (val) => {
state.apiListParam.limit = val;
getList();
};
const onHandleCurrentChange = (val) => {
state.apiListParam.page = val;
getList();
};
// 获取列表
const getList = () => {
productApi().enterpriseAllocationList(state.apiListParam).then(res => {
state.tableData.data = res.data.data
state.tableData.total = res.data.total
}).catch(() => {
})
}
/**
* 点击添加
*/
const add = () => {
AddDialogRef.value.openDialog();
}
/**
* 点击添加
*/
const distribute = () => {
DistributeDialogRef.value.openDialog();
}
/**
* 点击查看
*/
const setup = (id) => {
router.push({ path: '/product_info/inspect', query: { id: id }});
}
const allocation = () => {
productApi().equalDistributionEnterprise().then(res => {
ElMessage.success('分配成功!');
getList();
}).catch(() => {
getList();
})
}
/**
* 企业信息类型显示
* @param {*} data
*/
const verifyType= (data) => {
if(state.verifyTypeList[parseInt(data)] ===undefined){
return data
}else{
return state.verifyTypeList[parseInt(data)]
}
}
</script>
<style lang="scss" scoped>
.page-main {
height: calc(100vh - 50px - 106px);
}
</style>
......@@ -12,7 +12,7 @@
</el-select>
</div> -->
<el-button size="default" type="primary" @click="add()" >新增产品</el-button>
<el-button size="default" type="primary" @click="distribute()" >产品分发</el-button>
<!-- <el-button size="default" type="primary" @click="distribute()" >产品分发</el-button> -->
<!-- <el-button size="default" type="primary" @click="impor()" >导入企业</el-button> -->
</div>
......
......@@ -79,7 +79,7 @@
</el-col>
<el-col :span="16"><div class="grid-content bg-purple-light">
<!-- <div style="float: right;"><el-link type="primary" href="https://element.eleme.io">主要链接</el-link></div> -->
<div><iframe src="https://element.eleme.io/#/zh-CN/component/layout" width="100%" height="830px" style=" border: #909399 1px dotted ; padding: 15px;" scrolling="no"></iframe></div>
<div><iframe :src="state.info.page_url" width="100%" height="830px" style=" border: #909399 1px dotted ; padding: 15px;" ></iframe></div>
</div>
</el-col>
</el-row>
......@@ -114,6 +114,8 @@ const state = reactive({
query_id : '',
info:{},
number:{},
xhr:null, // 请求对象
mscontent:'',
});
......@@ -195,6 +197,70 @@ const getProductAllocation = () => {
})
}
//大模型
const fileContentExtraction= () => {
state.mscontent = '';
state.xhr = new XMLHttpRequest();
var url = "https://api.moonshot.cn/v1/chat/completions";
state.xhr.open("POST", url, true);
state.xhr.setRequestHeader("Authorization", "Bearer sk-RR9fGn86n9sdqMf7dwTB2eseGzsWrs1kKXEajbGWSfxlMQoj");
// 请求前处理
// requestProcessing();
state.xhr.onreadystatechange = function () {
if(state.xhr.status == 200){
if(state.xhr.readyState == 2){
state.txt = '';
}else if(state.xhr.readyState == 3){
let chunkText = state.xhr.response;
var lines = chunkText.split('\n');
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line) {
// 这里只是简单地打印事件数据,你可能需要更复杂的解析逻辑
var txt = line.split('choices')
if(txt[1] !=undefined){
var parts = txt[1].split('['); // 使用中括号 [ 分割字符串
var result = parts[1].split(']')[0];
var jsonObject = JSON.parse(result);
state.mscontent+=jsonObject.delta.content
}
}
}
state.mscontent.replace('undefined', '');
console.log(state.mscontent)
} else if(state.xhr.readyState == 4){
state.httpStatus =false;
}
}else{
// 请求异常处理
if(state.xhr.status == 0){
let chunkText = state.xhr.response;
var lines = chunkText.split('\n');
ElMessage.success('停止输出 '+lines[0])
// xhr.abort()
state.httpStatus =false;
}else{
let chunkText = state.xhr.response;
var lines = chunkText.split('\n');
ElMessage.error('服务器开小差 '+lines[0])
// xhr.abort()
state.httpStatus =false;
}
}
};
var data = JSON.stringify({
"model": 'moonshot-v1-8k',
"messages":[
{"role":"user","content":'请帮我整理以下内容为json格式“符合《广东省高速公路电子不停车收费联网用户卡、ESAM卡文件结构与数据定义》 高速公路双片式OBE-SAM”'}
],
"temperature": 0.3,
"stream": true
});
state.xhr.send(data);
}
const page_turning = (num) => {
if(router.currentRoute.value.query.id == num){
ElMessage.error('数据已经加载完');
......@@ -223,6 +289,7 @@ created:{
}
onMounted(() => {
// fileContentExtraction()
});
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment