dev-QQq
qinzhenpen 2 years ago
commit 7672a0a6a3

@ -73,3 +73,19 @@ export function linearRegression(data) {
data:data,
})
}
//线性回归-逻辑回归--预测
export function logisticRegressionPrediction(data) {
return request({
url: '/api/model/prediction',
method: 'post',
data:data,
})
}
//聚类分析表格下载
export function downloadClusterAnalysisForm(data) {
return request({
url: '/api/analysis/cAMExport',
method: 'post',
data:data,
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -199,26 +199,25 @@ aside {
text-align: center;
.el-button:nth-child(1) {
background: url("../../assets/images/szjj/提交任务.png") no-repeat;
background: url("../../assets/images/确定222.png") no-repeat;
background-size: 100% 100%;
}
.el-button:nth-child(2) {
background: url("../../assets/images/szjj/重新开始.png") no-repeat;
background: url("../../assets/images/取消.png") no-repeat;
background-size: 100% 100%;
}
.el-button--large.is-round {
padding: 12px 20px 12px 40px !important;
}
.el-button {
width: 136px;
height: 40px;
.el-button{
width: 89px;
height: 31px;
padding: 12px 20px 12px 40px !important;
font-size: 15px;
border: none;
color: #ffffff;
color: #080138;
}
}

@ -96,7 +96,7 @@ export const dynamicRoutes = [
path: "/digitalMarketTech",
component: () => import("@/views/digitalMarketTech/index"),
name: "digitalMarketTech",
meta: { title: "数字营销技术", icon: "monitor2", affix: true },
meta: { title: "数字营销技术", icon: "数据浏览", affix: true },
},
],
},
@ -110,7 +110,7 @@ export const dynamicRoutes = [
path: "/bi",
component: () => import("@/views/visual-analysis/index.vue"),
name: "bi",
meta: { title: "BI可视化分析", icon: "dashboard", affix: true },
meta: { title: "BI可视化分析", icon: "tongxunlu_B", affix: true },
},
],
},
@ -136,7 +136,7 @@ export const dynamicRoutes = [
path: "/digitalMarketingAlgorithms",
component: () => import("@/views/digitalMarketingAlgorithms/index"),
name: "digitalMarketingAlgorithms",
meta: { title: "数字营销算法", icon: "tongxunlu_B", affix: true },
meta: { title: "数字营销算法", icon: "monitor2", affix: true },
},
],
},

@ -16,6 +16,10 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
// baseURL: import.meta.env.VITE_APP_BASE_API,
<<<<<<<<< Temporary merge branch 1
baseURL:'http://118.31.7.2:9868/',
=========
baseURL:'http://192.168.2.28:9868/',
// baseURL:'http://118.31.7.2:9868/',
baseURL:'http://192.168.2.28:9868/',
// 超时

@ -0,0 +1,115 @@
<template>
<el-dialog
class="testDialog"
append-to-body
v-model="props.showModel"
title=""
align-center
draggable
:modal="false"
:show-close="false"
:style="{ borderRadius: 12 + 'px', width: props.width + 'px' }"
:close-on-click-modal="false"
custom-class="dialog"
>
<template #header>
<div
class="my-header"
:style="{
width: props.width + 'px',
backgroundSize: props.width + 'px ' + 43 + 'px',
}"
>
<span>{{ props.title }}</span>
<span style="cursor: pointer" @click="close()"
><img
style="width: 13px; height: 13px"
src="@/assets/images/关闭.png"
alt=""
/></span>
</div>
</template>
<slot name="content"></slot>
</el-dialog>
</template>
<script setup>
const emits = defineEmits(["closePop", "submit"]);
const dialogVisible = ref(false);
const props = defineProps({
modelValue: [String, Object, Array],
//
showModel: {
type: Boolean,
default: false,
},
title: {
type: String,
default: "Title",
},
width: {
type: String,
default: "673",
},
showOprBtn: {
type: Boolean,
default: true,
},
});
const close = () => {
emits("closePop");
};
const submit = () => {
emits("submit");
};
</script>
<style lang="scss" scoped>
.my-header {
display: flex;
justify-content: space-between;
padding-left: 25px;
padding-top: 15px;
padding-right: 15px;
position: absolute;
left: 0;
top: 0;
// background: url("@/assets/images/popHeader.png") no-repeat;
background-color: #ff6100;
width: 673px;
height: 53px;
background-size: 673px 43px;
color: white;
border-radius: 10px 10px 0 0;
}
.dialog-footer {
display: block;
text-align: center;
.okBtn {
width: 118px;
height: 40px;
// background: url("@/assets/images/popOkBtn.png");
background-color: #ff6100;
border: none;
color: white;
// padding-left: 40px;
text-align: center;
// margin-right: 50px;
}
.cancelBtn {
width: 118px;
height: 40px;
// background: url("@/assets/images/popCancelBtn.png");
border: none;
color: white;
padding-left: 40px;
}
}
</style>
<style>
.dialog_class {
pointer-events: none;
}
.el-dialog {
pointer-events: auto;
}
</style>

@ -340,6 +340,8 @@ const startOver=()=>{
input4.value=''
input5.value=''
input6.value=''
tableLabel.length=0
tableLabel2.length=0
}
</script>

@ -5,20 +5,7 @@
<p style="font-weight: 400;font-size: 12px;color: #E6E6E6;">给出任务清单参考做哪些数据的统计分析Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.</p>
</div>
<div class="main-but">
<el-upload
ref="uploadRef"
class="upload-demo"
:file-list="fileList"
:auto-upload="false"
:on-change="handleChange"
:show-file-list="false"
multiple="multiple"
>
<template #trigger>
<el-button><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
</template>
<!-- <div class="reportPromptFile" v-html="item[`${index}`].path"></div> -->
</el-upload>
<el-button @click="runResultShow = true"><img src="../../../assets/images/导入.png" alt="">算法知识导入</el-button>
<el-button @click="taskSubmit"><img src="../../../assets/images/提交.png" alt="">实训任务提交</el-button>
</div>
<div class="app-main">
@ -117,7 +104,7 @@
</div>
<div class="analysisResults" style="margin-top: 20px">
<span style="font-weight: bold;font-size: 18px;color: #3596EB;display: block;">分析结果</span>
<el-button>下载</el-button>
<el-button @click="upLoad"></el-button>
<el-table :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
</el-table>
@ -186,14 +173,32 @@
</div>
</template>
</el-dialog>
<pop-model
:showModel="runResultShow"
title="运行结果"
@closePop="runResultShow = false"
width="960"
@submit="runResultShow = false"
>
<template v-slot:content>
<div
v-html="
`<p>0 &nbsp; &nbsp;23364</p><p>1 &nbsp; &nbsp; 6636</p><p >Name: default.payment.next.month, dtype: int64</p>`
"
></div>
</template>
</pop-model>
</template>
<script setup>
import popModel from "@/views/components/popModel.vue";
import * as echarts from 'echarts';
import ecStat from 'echarts-stat';
import * as API from '@/api/AI.js'
import { getUserInfo } from "@/utils/auth";
import { onMounted } from 'vue';
const runResultShow=ref(false)
const { proxy } = getCurrentInstance()
const dialogVisible=ref(false)
const tableLabel=reactive([
@ -218,26 +223,18 @@ const { proxy } = getCurrentInstance()
const flag=ref(false)
let myChart;
let myChart2;
//
const getRandomColorHex = () => {
const randomValue = () => {
// 0 255
const value = Math.floor(Math.random() * 256);
const randomValue = (min, max) => {
// min max
const value = Math.floor(Math.random() * (max - min + 1)) + min;
//
return value.toString(16).padStart(2, '0');
};
// RGB
let r = randomValue();
let g = randomValue();
let b = randomValue();
//
while (parseInt(r, 16) > 200 && parseInt(g, 16) < 50 && parseInt(b, 16) < 50) {
r = randomValue();
g = randomValue();
b = randomValue();
}
// 绿
const r = randomValue(0, 128); // (0-128)
const g = randomValue(128, 255); // 绿 (128-255)
const b = randomValue(128, 255); // (128-255)
return `#${r}${g}${b}`;
};
@ -398,6 +395,7 @@ const resTable2=ref()
}
//
const nowData=ref([])
const computation=()=>{
if(input5.value&&input6.value&&input4.value){
const sendData={
@ -410,6 +408,7 @@ const resTable2=ref()
showChart.value=true
let sex=1
tableData3.value=[]
nowData.value=res.data
res.data.forEach((item,index)=>{
const newItem = {};
tableLabel.forEach((label,index) => {
@ -470,10 +469,29 @@ const resTable2=ref()
behavior: 'smooth' //
});
}
}, 10);
}, 100);
});
}
}
const upLoad=()=>{
const formData={
field:tableLabel.map(item=>item.label).join(','),
lists:nowData.value
}
// const formBody = Object.keys(formData)
// .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(formData[key]))
// .join('&');
// fetch('http://192.168.2.28:9868/api/analysis/cAMExport', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
// body: formBody
// })
API.downloadClusterAnalysisForm(formData).then(()=>{
})
}
const startOver=()=>{
myChart.setOption({
series: [
@ -499,6 +517,8 @@ const resTable2=ref()
input5.value=''
input6.value=''
showChart.value=false
tableLabel.length=0
nowData.value=[]
}
</script>

@ -84,17 +84,33 @@
/>
</el-select>
</div>
<div style="margin-top:10px;">
<div class="metrics2" style="margin-top:10px;">
<span style="font-weight: 400;font-size: 12px;color: #FFFFFF;">
Y变量选择
</span>
<el-input v-model="input5" style="width: 160px;margin-top:5px"/>
<!-- <el-input v-model="input5" style="width: 160px;margin-top:5px"/> -->
<el-select v-model="input5" multiple placeholder="请选择" style="width: 180px">
<el-option
v-for="item in option5"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div style="margin-top:10px;">
<div class="metrics2" style="margin-top:10px;">
<span style="font-weight: 400;font-size: 12px;color: #FFFFFF;">
X变量选择:
</span>
<el-input v-model="input6" style="width: 160px;margin-top:5px"/>
<!-- <el-input v-model="input6" style="width: 160px;margin-top:5px"/> -->
<el-select v-model="input6" multiple placeholder="请选择" style="width: 180px">
<el-option
v-for="item in option5"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<el-button @click="computation"></el-button>
</div>
@ -117,11 +133,16 @@
</div>
<div class="analysisResults" style="margin-top: 20px">
<span style="font-weight: bold;font-size: 18px;color: #3596EB;display: block;">分析结果</span>
<el-button>下载</el-button>
<el-button class="imgBtn">下载</el-button>
<el-table :data="tableData3" row-key="TSuid" style="width: 94%;margin-top:10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel2" :key="column.prop" :prop="column.prop" :label="column.label" align="center"/>
<el-table-column v-if="flagColumn" label="预测" align="center">
<template #default="scope">
<el-button type="primary" link @click="handleClick(scope.row)" v-if="predictionResults===''"></el-button>
<span v-else>{{predictionResults}}</span>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:10px" background layout="prev, pager, next" :total="1000" />
</div>
</div>
</div>
@ -175,6 +196,34 @@
</div>
</template>
</el-dialog>
<el-dialog
v-model="dialogVisible2"
title="预测"
width="400"
custom-class="dialogClass"
:show-close="false"
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header">
<span :id="titleId" :class="titleClass">预测</span>
<img class="gbImg" src="../../../assets/images/关闭.png" @click="close" alt="">
</div>
<img class="xtImg" src="../../../assets/images/线条.png" alt="">
</template>
<div class="from-item">
<el-form :inline="true" label-position="right" label-width="50px" :model="form" class="demo-form-inline">
<el-form-item label="x">
<el-input style="width: 225px;" v-model="formInline2.user" clearable placeholder="请输入x 多个以英文逗号隔开" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="Forecasting"></el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
@ -182,15 +231,22 @@
import ecStat from 'echarts-stat';
import * as API from '@/api/AI.js'
import { getUserInfo } from "@/utils/auth";
import { onMounted } from 'vue';
import { onMounted, reactive } from 'vue';
const { proxy } = getCurrentInstance()
const dialogVisible=ref(false)
const dialogVisible2=ref(false)
const flagColumn=ref(false)
const tableLabel=reactive([
{prop:'date',label:''},
])
const tableLabel2=reactive([
{prop:'date',label:''},
])
const formInline2=reactive({
user:''
})
const option5=ref([])
const option6=ref([])
const getList=()=>{
API.selectionMetrics({userId:JSON.parse(getUserInfo()).userId}).then((res)=>{
res.data.forEach(element => {
@ -241,7 +297,12 @@
}
API.analysisDataDisplay(sendData).then((res)=>{
tableLabel.length=0
option5.value.length=0
for (const key in res.data[0]) {
option5.value.push({
value:key,
label:key
})
tableLabel.push({
label:key,
prop:key
@ -317,19 +378,75 @@
//
const computation=()=>{
if(input5.value&&input6.value&&input4.value){
const sendData={
confidence:parseFloat(input5.value)/100,
support:parseFloat(input6.value)/100,
let sendData={
y:[],
x:[],
userId:JSON.parse(getUserInfo()).userId,
deduplicatedDataList:resTable2.value
}
API.associationRuleMining(sendData).then((res)=>{
tableData3.value=[]
res.data.forEach(element=>{
tableData3.value.push({
date:element
})
if(input4.value==='线性回归'){
if(input5.value.length>1){
proxy.$modal.msgError("y变量数量有误");
return
}
if(input6.value.length!=2||input6.value.length>2){
proxy.$modal.msgError("x变量数量有误");
return
}
flagColumn.value=true
tableData2.value.forEach(item=>{
sendData.y.push(item[input5.value[0]])
sendData.x.push([item[input6.value[0]],item[input6.value[1]]])
})
API.linearRegression(sendData).then((res)=>{
tableLabel2.length=0
for (const key in res.data) {
tableLabel2.push({
label:key,
prop:key
})
}
let data=res.data
data.slopes=data.slopes.join(',')
tableData3.value=[data]
})
}else{
if(input5.value.length>1){
proxy.$modal.msgError("y变量数量有误");
return
}
if(input6.value.length>2){
proxy.$modal.msgError("x变量数量有误");
return
}
}
flagColumn.value=true
// API.associationRuleMining(sendData).then((res)=>{
// tableData3.value=[]
// res.data.forEach(element=>{
// tableData3.value.push({
// date:element
// })
// })
// })
}
}
const nowData=ref([])
const handleClick=(item)=>{
dialogVisible2.value=true
nowData.value=item
}
const predictionResults=ref('')
const Forecasting=()=>{
if(nowData.value.type==='线性回归'){
const sendData={
intercept:nowData.value.intercept,
type:nowData.value.type,
slopes:nowData.value.slopes.split(',').map(Number),
raX:formInline2.user.split(',').map(Number)
}
API.logisticRegressionPrediction(sendData).then((res)=>{
dialogVisible2.value=false
predictionResults.value=res.data
})
}
}
@ -343,6 +460,12 @@
input4.value=''
input5.value=''
input6.value=''
flagColumn.value=false
tableLabel.length=0
tableLabel2.length=0
nowData.value=[]
formInline2.user=''
predictionResults.value=''
}
</script>
@ -472,9 +595,26 @@
}
}
}
.metrics2{
:deep(.el-input){
.el-input__wrapper{
background-color:#FFFFFF00;
}
--el-input-text-color:#FFFFFF;
--el-input-border-color:#409EFF;
--el-input-hover-border-color:#409EFF;
--el-input-hover-border:#409EFF;
--el-select-border-color-hover:#409EFF;
--el-select-input-focus-border-color:#409EFF;
--el-input-placeholder-color:#FFFFFF;
.el-input__inner{
color:#FFFFFF;
}
}
}
}
.analysisResults{
.el-button {
.imgBtn {
width: 89px;
height: 31px;
background: url('../../../assets/images/下载.png');

Loading…
Cancel
Save