作者 唐俊升

海关任务管理、dify嵌入

... ... @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>物流信息平台</title>
<title>智慧统计</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
... ...
import http from "../http";
import axios from "axios";
let baseUrl = 'ifea-admin'
//任务分类
// 列表
export const getCategoryList = params => { return axios.get(`${baseUrl}/excelTaskCate/list`, { params: params }); };
// 更新
export const updateCategory = params => { return http.post(`${baseUrl}/excelTaskCate/update`, params); };
// 新增
export const addCategory = params => { return http.post(`${baseUrl}/excelTaskCate/add`, params); };
// 删除
export const delCategory = params => { return http.post(`${baseUrl}/excelTaskCate/delete`, params); };
// 任务管理
// 列表
export const getTaskManageList = params => { return axios.get(`${baseUrl}/excelTask/list`, { params: params }); };
// 更新
export const updateTaskManage = params => { return http.post(`${baseUrl}/excelTask/update`, params); };
// 新增
export const addTaskManage = params => { return http.post(`${baseUrl}/excelTask/add`, params); };
// 删除
export const delTaskManage = params => { return http.post(`${baseUrl}/excelTask/delete`, params); };
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
<div align="center" style="height: 66px;line-height: 66px;">
<!-- <img id="logo" src="~@/assets/logo1.png">-->
<h1 id="logo-text" style="color:white;display: inline-block;font-weight: 600;font-size: 15px;line-height: 50px"> &nbsp; &nbsp;物流信息平台</h1>
<h1 id="logo-text" style="color:white;display: inline-block;font-weight: 600;font-size: 15px;line-height: 50px"> &nbsp; &nbsp;智慧统计</h1>
</div>
<template v-for="(item,index) in menu">
<el-submenu :index="index+''" v-if="item.hasChild">
... ...
... ... @@ -225,6 +225,9 @@ import yqdeclare from './views/airtransport/yqdeclare.vue'
//import AiCoustoms from "./views/AiCoustoms/AiCoustoms.vue";
import Category from "./views/AiCoustoms/task/Category.vue";
import TaskManage from "./views/AiCoustoms/task/TaskManage.vue";
import ChatflowReportForm from "./views/AiCoustoms/questionsAndAnswers/ChatflowReportForm.vue"
import ChatflowReport from "./views/AiCoustoms/questionsAndAnswers/ChatflowReport.vue"
import ChatflowReportFormRoutine from "./views/AiCoustoms/questionsAndAnswers/ChatflowReportFormRoutine.vue"
let routes = [
... ... @@ -819,7 +822,10 @@ let routes = [
children: [
//{path: '/AiCoustoms', component: AiCoustoms, name: 'Ai智慧关务'},
{path: '/Category', component: Category, name: '任务分类'},
{path: '/TaskManage', component: TaskManage, name: '任务管理'}
{path: '/TaskManage', component: TaskManage, name: '任务管理'},
{path: '/ChatflowReportForm', component: ChatflowReportForm, name: '报表'},
{path: '/ChatflowReport', component: ChatflowReport, name: '报告'},
{path: '/ChatflowReportFormRoutine', component: ChatflowReportFormRoutine, name: '常规报表'},
]
},
{
... ...
<template>
<iframe
src="http://10.78.6.30/chat/ukXcVUWhP7HHv0Ss"
style="width: 100%; height: 100%; min-height: 700px"
frameborder="0"
allow="microphone">
</iframe>
</template>
<script>
export default {
}
</script>
\ No newline at end of file
... ...
<template>
<iframe
src="http://10.78.6.30/chat/2HCKREpFAnlbIlQf"
style="width: 100%; height: 100%; min-height: 700px"
frameborder="0"
allow="microphone">
</iframe>
</template>
<script>
export default {
}
</script>
\ No newline at end of file
... ...
<template>
<iframe
src="http://ai.15miaoo.com:17999/chatbot/VrcUZBXmDOhvn7SQ"
style="width: 100%; height: 100%; min-height: 700px"
frameborder="0"
allow="microphone">
</iframe>
</template>
<script>
export default {
}
</script>
\ No newline at end of file
... ...
... ... @@ -5,37 +5,18 @@
<el-table
:data="tableData"
border
style="width: 100%">
style="width: 100%"
height="500">
<el-table-column
fixed
prop="date"
label="日期"
width="150">
prop="id"
label="代码"
width="100">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="120">
</el-table-column>
<el-table-column
prop="province"
label="省份"
width="120">
</el-table-column>
<el-table-column
prop="city"
label="市区"
width="120">
</el-table-column>
<el-table-column
prop="address"
label="地址"
width="300">
</el-table-column>
<el-table-column
prop="zip"
label="邮编"
width="120">
label="名称"
min-width="200">
</el-table-column>
<el-table-column
fixed="right"
... ... @@ -97,47 +78,18 @@
</el-pagination>
</div>
</el-col>
</el-row>
</el-contaier>
</template>
<script>
import {delArea} from "../../../api/consigner/station";
// import {delArea} from "../../../api/consigner/station";
import {getCategoryList, updateCategory, addCategory, delCategory} from "../../../api/AiCustoms/CustomsTask"
export default {
data() {
return {
tableData: [
{
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-04',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1517 弄',
zip: 200333
}, {
date: '2016-05-01',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1519 弄',
zip: 200333
}, {
date: '2016-05-03',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1516 弄',
zip: 200333
}],
tableData: [],
dialogVisible:false,
ruleForm:{
id:'',
... ... @@ -159,25 +111,62 @@
total:0,
}
},
methods: {
mounted() {
this.getCategoryList()
},
methods: {
// 获取数据列表
getCategoryList(){
getCategoryList({page:this.page, pageSize:this.pageSize}).then((response) => {
const code = response.data.code;
if (code != 200){
return this.$message.error('获取列表失败!')
}
this.tableData = response.data.data.rows;
this.total = response.data.data.total;
this.$message.success('获取列表成功!')
}).catch(error => {
this.$message.error(error.toString())
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize = val;
this.getCategoryList();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.page = val;
this.getCategoryList();
},
handleClick(row) {
this.ruleForm=JSON.parse(JSON.stringify(row));
this.dialogApply='update';
this.dialogVisible=true;
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
this.$refs[formName].validate(async (valid) => {
if (!valid){
console.log('error submit!!');
return false;
}
try {
let response;
if (this.dialogApply === 'create'){
response = await addCategory(this.ruleForm);
} else if (this.dialogApply === 'update'){
response = await updateCategory(this.ruleForm);
}
if (response.data.code !== 200){
return this.$message.error(this.dialogApply === 'create' ? '新增失败!' : '更新失败!')
return;
}
this.$message.success(this.dialogApply === 'create' ? '新增成功!' : '更新成功!')
this.dialogVisible = false;
this.getCategoryList();
} catch (error){
this.$message.error(error.toString())
}
});
},
resetForm(formName) {
... ... @@ -192,7 +181,7 @@
.catch(_ => {});
},
// 删除
applyDel(index, row) {
applyDel(row) {
// 弹框询问是否删除?
this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
confirmButtonText: '确定删除',
... ... @@ -200,7 +189,18 @@
type: 'warning'
}
).then(() => {
//
// 删除
const delIds = [row.id];
delCategory(delIds).then((response) => {
const code =response.data.code;
if (code != 200){
return this.$message.error('删除失败!')
}
this.$message.success('删除成功!')
this.getCategoryList();
}).catch(error => {
this.$message.error(error.toString())
})
}).catch(() => {
})
},
... ...
... ... @@ -2,14 +2,14 @@
<el-contaier>
<el-row>
<el-col :span="5">
<el-input v-model="name" placeholder="任务名称" style="width: 200px"></el-input>
<el-input v-model="name" placeholder="任务分类" style="width: 200px"></el-input>
</el-col>
<el-col :span="5">
<el-input v-model="cateId" placeholder="任务分类" style="width: 200px"></el-input>
<el-input v-model="cateId" placeholder="任务名称" style="width: 200px"></el-input>
</el-col>
<el-col :span="6">
<el-button type="primary" size="mini" @click="add()">查询</el-button>
<el-button type="primary" size="mini" @click="getTaskManageList()">查询</el-button>
<el-button type="success" size="mini" @click="add()">新增</el-button>
</el-col>
</el-row>
... ... @@ -18,38 +18,62 @@
<el-table
:data="tableData"
border
style="width: 100%">
style="width: 100%"
height="500">
<!-- <el-table-column-->
<!-- fixed-->
<!-- prop="id"-->
<!-- label="代码"-->
<!-- width="150">-->
<!-- </el-table-column>-->
<el-table-column
fixed
prop="date"
label="日期"
width="150">
prop="name"
label="名称"
width="150"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="120">
prop="cateId"
label="分类"
width="50"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="province"
label="省份"
width="120">
prop="dateRule"
label="日期规则"
width="300"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="city"
label="市区"
width="120">
prop="form"
label="表单"
width="300"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="address"
label="地址"
width="300">
prop="creator"
label="创建者"
width="80"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="zip"
label="邮编"
width="120">
prop="creatorId"
label="创建者Id"
width="80"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
width="120"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="updateTime"
label="更新时间"
width="120"
show-overflow-tooltip>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
... ... @@ -86,6 +110,35 @@
<el-form-item label="任务名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="任务分类" prop="cateId">
<el-input v-model="ruleForm.cateId"></el-input>
</el-form-item>
<el-form-item label="日期规则" prop="dateRule">
<el-input v-model="ruleForm.dateRule"></el-input>
</el-form-item>
<el-form-item label="表单" prop="form">
<el-input v-model="ruleForm.form"></el-input>
</el-form-item>
<el-form-item label="创建者" prop="creator">
<el-input v-model="ruleForm.creator"></el-input>
</el-form-item>
<el-form-item label="创建者Id" prop="creatorId">
<el-input v-model="ruleForm.creatorId"></el-input>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-input
v-model="ruleForm.createTime"
readonly
disabled
></el-input>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-input
v-model="ruleForm.updateTime"
readonly
disabled
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
<el-button @click="resetForm('ruleForm')">取消</el-button>
... ... @@ -114,48 +167,37 @@
<script>
import {getCategoryList, getTaskManageList, updateTaskManage, addTaskManage, delTaskManage} from "../../../api/AiCustoms/CustomsTask";
export default {
data() {
return {
tableData: [
{
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-04',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1517 弄',
zip: 200333
}, {
date: '2016-05-01',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1519 弄',
zip: 200333
}, {
date: '2016-05-03',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1516 弄',
zip: 200333
}],
tableData: [],
dialogVisible:false,
ruleForm:{
id:'',
name:''
name:'',
cateId:'',
dateRule:'',
form:'',
creator:'',
creatorId:'',
createTime:'',
updateTime:''
},
rules:{
name: [
{ required: true, message: '请输入任务名称', trigger: 'blur' },
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
],
cateId: [
{ required: true, message: '请输入任务分类', trigger: 'blur' }
],
dateRule: [
{ required: true, message: '请输入日期规则', trigger: 'blur' }
],
form: [
{ required: true, message: '请输入表单', trigger: 'blur' }
]
},
dialogMap: {
... ... @@ -170,24 +212,103 @@
cateId:''
}
},
mounted() {
this.getTaskManageList();
// // 使用 $nextTick 确保 DOM 渲染完成后再加载脚本
// this.$nextTick(() => {
// // 添加 Dify Chatbot 配置
// window.difyChatbotConfig = {
// token: 'VrcUZBXmDOhvn7SQ',
// baseUrl: 'http://ai.15miaoo.com:17999',
// systemVariables: {
// // user_id: 'YOU CAN DEFINE USER ID HERE',
// },
// };
//
// // 动态加载脚本
// this.loadDifyScript();
// });
},
// // 添加 beforeDestroy 钩子来清理资源
// beforeDestroy() {
// // 移除聊天机器人相关的DOM元素
// const chatbotElements = [
// document.getElementById('dify-chatbot-bubble-button'),
// document.getElementById('dify-chatbot-bubble-window'),
// document.getElementById('VrcUZBXmDOhvn7SQ')
// ];
//
// chatbotElements.forEach(element => {
// if (element && element.parentNode) {
// element.parentNode.removeChild(element);
// }
// });
//
// // 清理可能存在的全局配置
// if (window.difyChatbotConfig) {
// delete window.difyChatbotConfig;
// }
// },
methods: {
getTaskManageList() {
getTaskManageList({name:this.name,cateId:this.cateId,page:this.page,pageSize:this.pageSize}).then((response) => {
console.log(this.page)
console.log(this.pageSize)
const code = response.data.code;
if (code != 200){
return this.$message.error('获取任务列表失败!')
}
this.tableData = response.data.data.rows;
this.total = response.data.data.total;
this.$message.success('获取任务列表成功!')
}).catch(erroe => {
this.$message.error(erroe.toString())
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize=val;
this.getTaskManageList();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.page=val;
this.getTaskManageList();
},
handleClick(row) {
this.ruleForm=JSON.parse(JSON.stringify(row));
this.dialogApply='update';
this.dialogVisible=true;
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
this.$refs[formName].validate(async (valid) => {
if (!valid){
console.log('error submit!!');
return false;
}
try {
let response;
if (this.dialogApply === 'create'){
response = await addTaskManage(this.ruleForm);
} else if (this.dialogApply === 'update'){
response = await updateTaskManage(this.ruleForm);
}
const code = response.data.code;
if (code !== 200){
this.$message.error(this.dialogApply === 'create' ? '新增失败!' : '更新失败!')
return;
}
this.$message.success(this.dialogApply === 'create' ? '新增成功!' : '更新成功!')
this.dialogVisible=false;
this.name = this.ruleForm.name;
this.cateId = this.ruleForm.cateId;
this.getTaskManageList();
} catch (error) {
this.$message.error(error.toString())
}
});
},
... ... @@ -203,7 +324,7 @@
.catch(_ => {});
},
// 删除
applyDel(index, row) {
applyDel(row) {
// 弹框询问是否删除?
this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
confirmButtonText: '确定删除',
... ... @@ -211,18 +332,60 @@
type: 'warning'
}
).then(() => {
//
// 删除
const delIds = [row.id];
delTaskManage(delIds).then((response) => {
const code =response.data.code;
if (code != 200){
return this.$message.error('删除失败!')
}
this.$message.success('删除成功!')
}).catch(error => {
this.$message.error(error.toString())
})
this.name = row.name;
this.cateId = row.cateId;
this.getTaskManageList();
}).catch(() => {
})
},
add(){
this.ruleForm={
id:'',
name:''
name:'',
cateId:'',
dateRule:'',
form:'',
creator:'',
creatorId:'',
createTime:'',
updateTime:''
};
this.dialogApply='create';
this.dialogVisible=true;
}
},
// loadDifyScript() {
// // 检查是否已经加载过脚本
// if (document.getElementById('VrcUZBXmDOhvn7SQ')) {
// return;
// }
//
// const script = document.createElement('script');
// script.src = 'http://ai.15miaoo.com:17999/embed.min.js';
// script.id = 'VrcUZBXmDOhvn7SQ';
// script.defer = true;
// document.head.appendChild(script);
// }
}
}
</script>
<!--<style>/* 原有样式 */-->
<!--#dify-chatbot-bubble-button {-->
<!-- background-color: #1C64F2 !important;-->
<!--}-->
<!--#dify-chatbot-bubble-window {-->
<!-- width: 24rem !important;-->
<!-- height: 40rem !important;-->
<!--}-->
<!--</style>-->
... ...