dev-QQq
qinzhenpen 2 years ago
parent df48a96bf0
commit c86d105a86

@ -2,7 +2,7 @@
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2024-08-16 10:14:59
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2024-08-16 16:38:09
* @LastEditTime: 2024-08-17 16:57:01
* @FilePath: \vue3\src\api\marketing-algorithm.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -31,3 +31,27 @@ export function getMarketingAlgorithmPreprocessing(data) {
data,
});
}
// 自建表导入
export function getMarketingAlgorithmImport(data) {
return request({
url: "/api/userprofile/uploadExcel",
method: "POST",
data,
});
}
// 查询自建表
export function getMarketingAlgorithmTable(params) {
return request({
url: "/api/userprofile/selfExcelBaseInfo",
method: "GET",
params,
});
}
// 算法知识导入
export function getMarketingAlgorithmKnowledgeImport(data) {
return request({
url: "/api/model/batchImport",
method: "POST",
data,
});
}

@ -1,28 +1,14 @@
<template>
<div
:class="classObj"
class="app-wrapper"
:style="{ '--current-color': theme }"
>
<div class="title" style="height: 58px;background-color: #072048 !important;">
<div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }">
<div class="title" style="height: 58px; background-color: #072048 !important; z-index: 900 !important; position: relative">
<div class="navTitle">
<span class="nacber-name"> </span>
</div>
<span class="nacber-name"> </span>
</div>
</div>
<div
v-if="device === 'mobile' && sidebar.opened"
class="drawer-bg"
@click="handleClickOutside"
/>
<div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
<div
:class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
class="main-container"
>
<div :class="{ 'fixed-header': fixedHeader }">
<!-- <navbar @setLayout="setLayout" />
<tags-view v-if="needTagsView" /> -->
</div>
<div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container">
<div :class="{ 'fixed-header': fixedHeader }"></div>
<app-main />
<settings ref="settingRef" />
</div>
@ -113,19 +99,19 @@ function setLayout() {
margin-left: 33px;
margin-top: 3px;
letter-spacing: 1px;
}
}
}
.sidebar-container {
margin-top: 58px;
}
.main-container {
.caseData {
position: fixed;
right: 2%;
top: 10%;
z-index: 10000;
}
margin-top: 58px;
}
.main-container {
.caseData {
position: fixed;
right: 2%;
top: 10%;
z-index: 10000;
}
}
}
.drawer-bg {

@ -1,20 +1,27 @@
import { parseTime } from './ruoyi'
export function getAssetsFile(url){
import { parseTime } from "./ruoyi";
export function getAssetsFile(url) {
return new URL(`../assets/images/${url}`, import.meta.url).href;
}
/**
* 表格时间格式化
*/
export function formatDate(cellValue) {
if (cellValue == null || cellValue == "") return "";
var date = new Date(cellValue)
var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
// 判断是不是时间戳不是就返回
let time;
if (typeof cellValue === new Date()) {
var date = new Date(cellValue);
var year = date.getFullYear();
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
time = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
} else {
time = cellValue;
}
return time;
}
/**
@ -23,40 +30,30 @@ export function formatDate(cellValue) {
* @returns {string}
*/
export function formatTime(time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
if (("" + time).length === 10) {
time = parseInt(time) * 1000;
} else {
time = +time
time = +time;
}
const d = new Date(time)
const now = Date.now()
const d = new Date(time);
const now = Date.now();
const diff = (now - d) / 1000
const diff = (now - d) / 1000;
if (diff < 30) {
return '刚刚'
return "刚刚";
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + '分钟前'
return Math.ceil(diff / 60) + "分钟前";
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
return Math.ceil(diff / 3600) + "小时前";
} else if (diff < 3600 * 24 * 2) {
return '1天前'
return "1天前";
}
if (option) {
return parseTime(time, option)
return parseTime(time, option);
} else {
return (
d.getMonth() +
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
)
return d.getMonth() + 1 + "月" + d.getDate() + "日" + d.getHours() + "时" + d.getMinutes() + "分";
}
}
@ -65,18 +62,18 @@ export function formatTime(time, option) {
* @returns {Object}
*/
export function getQueryObject(url) {
url = url == null ? window.location.href : url
const search = url.substring(url.lastIndexOf('?') + 1)
const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g
url = url == null ? window.location.href : url;
const search = url.substring(url.lastIndexOf("?") + 1);
const obj = {};
const reg = /([^?&=]+)=([^?&=]*)/g;
search.replace(reg, (rs, $1, $2) => {
const name = decodeURIComponent($1)
let val = decodeURIComponent($2)
val = String(val)
obj[name] = val
return rs
})
return obj
const name = decodeURIComponent($1);
let val = decodeURIComponent($2);
val = String(val);
obj[name] = val;
return rs;
});
return obj;
}
/**
@ -85,14 +82,14 @@ export function getQueryObject(url) {
*/
export function byteLength(str) {
// returns the byte length of an utf8 string
let s = str.length
let s = str.length;
for (var i = str.length - 1; i >= 0; i--) {
const code = str.charCodeAt(i)
if (code > 0x7f && code <= 0x7ff) s++
else if (code > 0x7ff && code <= 0xffff) s += 2
if (code >= 0xDC00 && code <= 0xDFFF) i--
const code = str.charCodeAt(i);
if (code > 0x7f && code <= 0x7ff) s++;
else if (code > 0x7ff && code <= 0xffff) s += 2;
if (code >= 0xdc00 && code <= 0xdfff) i--;
}
return s
return s;
}
/**
@ -100,13 +97,13 @@ export function byteLength(str) {
* @returns {Array}
*/
export function cleanArray(actual) {
const newArray = []
const newArray = [];
for (let i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i])
newArray.push(actual[i]);
}
}
return newArray
return newArray;
}
/**
@ -114,13 +111,13 @@ export function cleanArray(actual) {
* @returns {Array}
*/
export function param(json) {
if (!json) return ''
if (!json) return "";
return cleanArray(
Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
Object.keys(json).map((key) => {
if (json[key] === undefined) return "";
return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
})
).join('&')
).join("&");
}
/**
@ -128,21 +125,21 @@ export function param(json) {
* @returns {Object}
*/
export function param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
const search = decodeURIComponent(url.split("?")[1]).replace(/\+/g, " ");
if (!search) {
return {}
return {};
}
const obj = {}
const searchArr = search.split('&')
searchArr.forEach(v => {
const index = v.indexOf('=')
const obj = {};
const searchArr = search.split("&");
searchArr.forEach((v) => {
const index = v.indexOf("=");
if (index !== -1) {
const name = v.substring(0, index)
const val = v.substring(index + 1, v.length)
obj[name] = val
const name = v.substring(0, index);
const val = v.substring(index + 1, v.length);
obj[name] = val;
}
})
return obj
});
return obj;
}
/**
@ -150,9 +147,9 @@ export function param2Obj(url) {
* @returns {string}
*/
export function html2Text(val) {
const div = document.createElement('div')
div.innerHTML = val
return div.textContent || div.innerText
const div = document.createElement("div");
div.innerHTML = val;
return div.textContent || div.innerText;
}
/**
@ -162,21 +159,21 @@ export function html2Text(val) {
* @returns {Object}
*/
export function objectMerge(target, source) {
if (typeof target !== 'object') {
target = {}
if (typeof target !== "object") {
target = {};
}
if (Array.isArray(source)) {
return source.slice()
return source.slice();
}
Object.keys(source).forEach(property => {
const sourceProperty = source[property]
if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty)
Object.keys(source).forEach((property) => {
const sourceProperty = source[property];
if (typeof sourceProperty === "object") {
target[property] = objectMerge(target[property], sourceProperty);
} else {
target[property] = sourceProperty
target[property] = sourceProperty;
}
})
return target
});
return target;
}
/**
@ -185,18 +182,16 @@ export function objectMerge(target, source) {
*/
export function toggleClass(element, className) {
if (!element || !className) {
return
return;
}
let classString = element.className
const nameIndex = classString.indexOf(className)
let classString = element.className;
const nameIndex = classString.indexOf(className);
if (nameIndex === -1) {
classString += '' + className
classString += "" + className;
} else {
classString =
classString.substr(0, nameIndex) +
classString.substr(nameIndex + className.length)
classString = classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length);
}
element.className = classString
element.className = classString;
}
/**
@ -204,10 +199,10 @@ export function toggleClass(element, className) {
* @returns {Date}
*/
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
if (type === "start") {
return new Date().getTime() - 3600 * 1000 * 24 * 90;
} else {
return new Date(new Date().toDateString())
return new Date(new Date().toDateString());
}
}
@ -218,38 +213,38 @@ export function getTime(type) {
* @return {*}
*/
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result
let timeout, args, context, timestamp, result;
const later = function() {
const later = function () {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
const last = +new Date() - timestamp;
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last)
timeout = setTimeout(later, wait - last);
} else {
timeout = null
timeout = null;
// 如果设定为immediate===true因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args)
if (!timeout) context = args = null
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
}
};
return function(...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
return function (...args) {
context = this;
timestamp = +new Date();
const callNow = immediate && !timeout;
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait)
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args)
context = args = null
result = func.apply(context, args);
context = args = null;
}
return result
}
return result;
};
}
/**
@ -260,18 +255,18 @@ export function debounce(func, wait, immediate) {
* @returns {Object}
*/
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
if (!source && typeof source !== "object") {
throw new Error("error arguments", "deepClone");
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
const targetObj = source.constructor === Array ? [] : {};
Object.keys(source).forEach((keys) => {
if (source[keys] && typeof source[keys] === "object") {
targetObj[keys] = deepClone(source[keys]);
} else {
targetObj[keys] = source[keys]
targetObj[keys] = source[keys];
}
})
return targetObj
});
return targetObj;
}
/**
@ -279,16 +274,16 @@ export function deepClone(source) {
* @returns {Array}
*/
export function uniqueArr(arr) {
return Array.from(new Set(arr))
return Array.from(new Set(arr));
}
/**
* @returns {string}
*/
export function createUniqueString() {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
const timestamp = +new Date() + "";
const randomNum = parseInt((1 + Math.random()) * 65536) + "";
return (+(randomNum + timestamp)).toString(32);
}
/**
@ -298,7 +293,7 @@ export function createUniqueString() {
* @returns {boolean}
*/
export function hasClass(ele, cls) {
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
}
/**
@ -307,7 +302,7 @@ export function hasClass(ele, cls) {
* @param {string} cls
*/
export function addClass(ele, cls) {
if (!hasClass(ele, cls)) ele.className += ' ' + cls
if (!hasClass(ele, cls)) ele.className += " " + cls;
}
/**
@ -317,94 +312,91 @@ export function addClass(ele, cls) {
*/
export function removeClass(ele, cls) {
if (hasClass(ele, cls)) {
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
ele.className = ele.className.replace(reg, ' ')
const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
ele.className = ele.className.replace(reg, " ");
}
}
export function makeMap(str, expectsLowerCase) {
const map = Object.create(null)
const list = str.split(',')
const map = Object.create(null);
const list = str.split(",");
for (let i = 0; i < list.length; i++) {
map[list[i]] = true
map[list[i]] = true;
}
return expectsLowerCase
? val => map[val.toLowerCase()]
: val => map[val]
return expectsLowerCase ? (val) => map[val.toLowerCase()] : (val) => map[val];
}
export const exportDefault = 'export default '
export const exportDefault = "export default ";
export const beautifierConf = {
html: {
indent_size: '2',
indent_char: ' ',
max_preserve_newlines: '-1',
indent_size: "2",
indent_char: " ",
max_preserve_newlines: "-1",
preserve_newlines: false,
keep_array_indentation: false,
break_chained_methods: false,
indent_scripts: 'separate',
brace_style: 'end-expand',
indent_scripts: "separate",
brace_style: "end-expand",
space_before_conditional: true,
unescape_strings: false,
jslint_happy: false,
end_with_newline: true,
wrap_line_length: '110',
wrap_line_length: "110",
indent_inner_html: true,
comma_first: false,
e4x: true,
indent_empty_lines: true
indent_empty_lines: true,
},
js: {
indent_size: '2',
indent_char: ' ',
max_preserve_newlines: '-1',
indent_size: "2",
indent_char: " ",
max_preserve_newlines: "-1",
preserve_newlines: false,
keep_array_indentation: false,
break_chained_methods: false,
indent_scripts: 'normal',
brace_style: 'end-expand',
indent_scripts: "normal",
brace_style: "end-expand",
space_before_conditional: true,
unescape_strings: false,
jslint_happy: true,
end_with_newline: true,
wrap_line_length: '110',
wrap_line_length: "110",
indent_inner_html: true,
comma_first: false,
e4x: true,
indent_empty_lines: true
}
}
indent_empty_lines: true,
},
};
// 首字母大小
export function titleCase(str) {
return str.replace(/( |^)[a-z]/g, L => L.toUpperCase())
return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
}
// 下划转驼峰
export function camelCase(str) {
return str.replace(/_[a-z]/g, str1 => str1.substr(-1).toUpperCase())
return str.replace(/_[a-z]/g, (str1) => str1.substr(-1).toUpperCase());
}
export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
}
//文件下载
export function downBlobFile(fileName, fileBlob) {
const link = document.createElement('a')
const link = document.createElement("a");
try {
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型先定义成blob对象格式,type格式根据返回文件不同修改
const blob = fileBlob
const _fileName = fileName // 拆解获取文件名,如果后端没返回文件格式,则需要自己拼接文件后缀
link.style.display = 'none'
const blob = fileBlob;
const _fileName = fileName; // 拆解获取文件名,如果后端没返回文件格式,则需要自己拼接文件后缀
link.style.display = "none";
// 兼容浏览器
const url = window.URL || window.webkitURL || window.moxURL
link.href = url.createObjectURL(blob) // 如果没设置axios请求reponseType为blob的话则参数应为new Blob(文件流),否则报错
link.download = _fileName // 下载的文件名称
link.click()
window.URL.revokeObjectURL(url) // #URL.revokeObjectURL()方法会释放一个通过URL.createObjectURL()创建的对象URL. 当你要已经用过了这个对象URL,然后要让浏览器知道这个URL已经不再需要指向对应的文件的时候,就需要调用这个方法.
const url = window.URL || window.webkitURL || window.moxURL;
link.href = url.createObjectURL(blob); // 如果没设置axios请求reponseType为blob的话则参数应为new Blob(文件流),否则报错
link.download = _fileName; // 下载的文件名称
link.click();
window.URL.revokeObjectURL(url); // #URL.revokeObjectURL()方法会释放一个通过URL.createObjectURL()创建的对象URL. 当你要已经用过了这个对象URL,然后要让浏览器知道这个URL已经不再需要指向对应的文件的时候,就需要调用这个方法.
} catch (error) {
console.error(error.message)
console.error(error.message);
}
}

@ -16,9 +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,
baseURL:'http://118.31.7.2:9868/',
// baseURL:'http://118.31.7.2:9868/',
baseURL:'http://192.168.2.28:9868/',
// 超时
timeout: 10000
timeout: 100000
})
// request拦截器
service.interceptors.request.use(config => {

@ -1,5 +1,5 @@
<template>
<div class="app-main">
<div class="app-main" v-loading="loading">
<div class="main-left">
<div class="left-top">
<img style="width: 26px; height: 26px" src="../../../assets/images/图标1.png" alt="" />
@ -15,14 +15,24 @@
<span>自建表</span>
</div>
<div class="left-item">
<div v-for="(item, index) in zjData" :key="index" class="item" :class="{ 'is-active': zjIndex === index }" @click="goZJ(index)">
<span>{{ item }}</span>
<div class="metrics">
<el-select v-model="n_dataTableQuery.selfTableName" placeholder="请选择数据" style="width: 180px" @change="selectType">
<el-option v-for="item in zjData" :key="item" :label="item" :value="item" />
</el-select>
</div>
</div>
<div class="left-button">
<input type="file" ref="fileData" style="display: none" @change="importData" />
<el-button round type="primary" @click="$refs.fileData.click()"></el-button>
</div>
</div>
<div class="main-right">
<el-table :data="tableData" style="width: 100%" :header-cell-style="headerCellStyle">
<el-table-column v-for="column in tableLabel" :key="column" :prop="column.prop" :label="column.label" align="center" />
<el-table-column v-for="column in tableLabel" :key="column" :prop="column.prop" :label="column.label" align="center">
<template #default="{ row }">
{{ formatDate(row[column.prop]) }}
</template>
</el-table-column>
</el-table>
<pagination v-show="datatotal > 0" :total="datatotal" v-model:page="n_dataTableQuery.index" v-model:limit="n_dataTableQuery.size" @pagination="getSurface" style="margin-top: 10px" />
</div>
@ -30,25 +40,30 @@
</template>
<script setup>
import * as portraitModel from "@/api/portraitModel";
import * as marketingAlgorithmApi from "@/api/marketing-algorithm";
import { formatDate } from "@/utils/index.js";
import useUserStore from "@/store/modules/user";
import useAlgorithmStore from "@/store/modules/algorithm.js";
import { ref } from "vue";
const { proxy } = getCurrentInstance();
import { getUserInfo } from "@/utils/auth";
const userInfo = JSON.parse(getUserInfo());
const loading = ref(false);
const fileData = ref(null);
const userStore = useUserStore();
const algorithmStore = useAlgorithmStore();
// query
const n_dataTableQuery = ref({
index: 1,
size: 20,
size: 7,
tableName: "用户属性表",
userId: userStore.userInfo.userId,
userId: userInfo.userId,
});
const datatotal = ref(0);
const nzIndex = ref(0);
const nzData = ["用户属性表", "用户登录活跃表", "用户消费能力表", "用户行为表", "用户评论表"];
const zjIndex = ref(-1);
const zjData = ["用户属性表", "用户登录活跃表", "用户消费能力表", "用户行为表", "用户评论表"];
const tableLabel = reactive([
const zjData = ref([]);
const tableLabel = ref([
{ prop: "id", label: "用户ID" },
{ prop: "loginName", label: "登录名" },
{ prop: "userName", label: "用户姓名" },
@ -62,10 +77,28 @@ const tableLabel = reactive([
{ prop: "updateTime", label: "注册时间" },
{ prop: "location", label: "所在地" },
]);
const tableLabel2 = ref([]);
const arrhander = ref([]);
const arrhanderkey = ref([]);
const goNZ = (index, item) => {
nzIndex.value = index;
zjIndex.value = -1;
tableLabel.value = [
{ prop: "id", label: "用户ID" },
{ prop: "loginName", label: "登录名" },
{ prop: "userName", label: "用户姓名" },
{ prop: "studentId", label: "学号" },
{ prop: "stuClass", label: "班级" },
{ prop: "major", label: "专业" },
{ prop: "school", label: "学校" },
{ prop: "roleName", label: "角色名称" },
{ prop: "roleGender", label: "角色性别" },
{ prop: "roleAge", label: "角色年龄" },
{ prop: "updateTime", label: "注册时间" },
{ prop: "location", label: "所在地" },
];
n_dataTableQuery.value.tableName = item;
delete n_dataTableQuery.value.selfTableName;
getSurface();
};
const goZJ = (index) => {
@ -73,22 +106,60 @@ const goZJ = (index) => {
nzIndex.value = -1;
};
const tableData = ref([]);
const headerCellStyle = () => {
return {
color: "#ffffff !important",
};
};
//
const selectType = (type) => {};
const selectType = (type) => {
delete n_dataTableQuery.value.tableName;
getSurface();
nzIndex.value = -1;
};
const getSurface = () => {
portraitModel.getUserTableData(n_dataTableQuery.value).then((res) => {
tableData.value = res?.data?.list;
datatotal.value = res.data.total;
tableLabel2.value = [];
if (tableData.value[0]?.stepOneA) {
arrhander.value = JSON.parse(tableData.value[0].stepOneA);
arrhanderkey.value = Object.keys(tableData.value[0]).slice(2, arrhander.value.length + 2);
arrhander.value.forEach((item, index) => {
tableLabel2.value.push({
prop: arrhanderkey.value[index],
label: item,
});
});
tableLabel.value = tableLabel2.value;
}
});
};
//
const importData = (e) => {
loading.value = true;
const files = e.target.files[0];
const formdata = new FormData();
formdata.append("file", files);
formdata.append("userId", userInfo.userId);
marketingAlgorithmApi.getMarketingAlgorithmImport(formdata).then((res) => {
loading.value = false;
proxy.$modal.msgSuccess("导入成功");
});
};
//
const selectZJ = (item) => {
marketingAlgorithmApi.getMarketingAlgorithmTable();
};
//
const getZJData = () => {
marketingAlgorithmApi.getMarketingAlgorithmTable({ userId: userInfo.userId }).then((res) => {
zjData.value = res?.data;
});
};
onMounted(() => {
getSurface();
getZJData();
});
</script>
@ -135,6 +206,44 @@ onMounted(() => {
color: #ffffff;
}
}
.metrics {
padding: 0px 7px !important;
:deep(.el-input) {
.el-input__wrapper {
background-color: #ffffff00;
background-image: url("../../../assets/images/下拉框.png");
background-size: 100% 100%;
}
--el-input-text-color: #ffffff;
--el-input-border-color: #ffffff00;
--el-input-hover-border-color: #ffffff00;
--el-input-hover-border: #ffffff00;
--el-select-border-color-hover: #ffffff00;
--el-select-input-focus-border-color: #ffffff00;
--el-input-placeholder-color: #ffffff;
.el-input__inner {
color: #ffffff;
}
}
}
}
.left-button {
width: 195px;
height: 31px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
margin-top: 20px !important;
:deep(.el-button) {
width: 149px;
height: 48px;
background: url("../../../assets/images/确定.png");
color: #ffffff;
border-color: #ffffff00;
background-size: 100% 100%;
margin: 15px;
}
}
}
.main-right {

@ -1,11 +1,12 @@
<template>
<el-scrollbar height="800px">
<el-scrollbar height="800px" v-loading="loading">
<div class="main-top">
<span style="font-weight: bold; font-size: 18px; color: #3596eb">任务描述</span>
<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-button>
<input type="file" ref="fileknowledge" style="display: none" @change="knowledgeImport" />
<el-button @click="$refs.fileknowledge.click()">
<img src="../../../assets/images/导入.png" alt="" />
算法知识导入
</el-button>
@ -26,7 +27,7 @@
</el-select>
</div>
<div class="metrics-table" style="margin-top: 10px">
<el-table border :data="algorithmStore.indexLibrary" style="width: 100%" :header-cell-style="headerCellStyle" @selection-change="handleSelectionChange">
<el-table border ref="multipleTableRef" :data="algorithmStore.indexLibrary" style="width: 100%" :header-cell-style="headerCellStyle" @selection-change="handleSelectionChange">
<el-table-column type="selection" prop="date" label="Date" align="center" />
<el-table-column label="指标" align="center" prop="label" />
</el-table>
@ -50,7 +51,7 @@
<span>模型参数设置</span>
</div>
<div class="metrics-table" style="margin-top: 10px">
<el-table border :data="modelParams" style="width: 100%" :header-cell-style="headerCellStyle" @selection-change="handlemodelSelectionChange">
<el-table border ref="multipleTableRef" :data="modelParams" style="width: 100%" :header-cell-style="headerCellStyle" @selection-change="handlemodelSelectionChange">
<el-table-column type="selection" prop="date" label="Date" align="center" />
<el-table-column prop="name" label="统计量" align="center" />
</el-table>
@ -58,7 +59,7 @@
</div>
</div>
<div style="margin-top: auto">
<div class="startOver">
<div class="startOver" @click="restart">
<img src="../../../assets/images/重新开始.png" alt="" />
<span>重新开始</span>
</div>
@ -75,9 +76,8 @@
<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-table :data="tableData" style="width: 94%; margin-top: 10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.label" :prop="column.label" :label="column.label" align="center"></el-table-column>
<p v-for="column in tableLabel" :key="column.label">{{ column.label }}</p>
<el-table :data="tableData" style="width: 100%; margin-top: 10px" :header-cell-style="headerCellStyle" height="350">
<el-table-column v-for="column in tableLabel" :key="column.label" :prop="column.prop" :label="column.label" align="center"></el-table-column>
</el-table>
<el-pagination style="margin-top: 10px" background layout="prev, pager, next" :total="1000" />
</div>
@ -95,46 +95,46 @@
<div class="from-item">
<el-form :inline="true" label-position="right" label-width="84px" :model="form" class="demo-form-inline">
<el-form-item label="平均数:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.average" clearable />
</el-form-item>
<el-form-item label="众数:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.mode" clearable />
</el-form-item>
<el-form-item label="中位数:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.median" clearable />
</el-form-item>
<el-form-item label="标准差:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.standardDeviation" clearable />
</el-form-item>
<el-form-item label="方差:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.variance" clearable />
</el-form-item>
<el-form-item label="峰度:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.kurtosis" clearable />
</el-form-item>
<el-form-item label="标准误差:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.standardError" clearable />
</el-form-item>
<el-form-item label="偏度:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.skewness" clearable />
</el-form-item>
<el-form-item label="最大值:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.max" clearable />
</el-form-item>
<el-form-item label="最小值:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.min" clearable />
</el-form-item>
<el-form-item label="求和:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.summation" clearable />
</el-form-item>
<el-form-item label="观测数:">
<el-input style="width: 120px" v-model="formInline.user" clearable />
<el-input style="width: 120px" v-model="formInline.observations" clearable />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">确定</el-button>
<el-button @click="submitTask"></el-button>
<el-button type="primary" @click="dialogVisible = false">返回</el-button>
</div>
</template>
@ -142,19 +142,25 @@
</template>
<script setup>
import * as API from "@/api/AI.js";
import * as portraitModel from "@/api/portraitModel";
import * as API from "@/api/AI.js";
import * as marketingAlgorithmApi from "@/api/marketing-algorithm.js";
import useAlgorithmStore from "@/store/modules/algorithm.js";
import useUserStore from "@/store/modules/user";
import { onMounted, ref } from "vue";
import { getUserInfo } from "@/utils/auth";
const userInfo = JSON.parse(getUserInfo());
const loading = ref(false);
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const algorithmStore = useAlgorithmStore();
const multipleTableRef=ref(null)
const fileknowledge = ref(null);
const n_dataTableQuery = ref({
index: 1,
size: 20,
tableName: "用户属性表",
userId: userStore.userInfo.userId,
userId: userInfo.userId,
});
const dialogVisible = ref(false);
//
@ -199,20 +205,33 @@ const modelParams = reactive([
const analysisData = ref([]);
const analysisHanderKry = ref([]);
const tableLabel = reactive([
{ prop: "date", label: "用户ID" },
{ prop: "name", label: "登录名" },
{ prop: "name", label: "用户姓名" },
{ prop: "name", label: "学号" },
{ prop: "name", label: "班级" },
{ prop: "name", label: "专业" },
{ prop: "name", label: "学校" },
{ prop: "name", label: "角色名称" },
{ prop: "name", label: "角色性别" },
{ prop: "name", label: "角色年龄" },
{ prop: "name", label: "注册时间" },
{ prop: "name", label: "所在地" },
{ prop: "average", label: "平均数" },
{ prop: "median", label: "中位数" },
{ prop: "mode", label: "众数" },
{ prop: "standardDeviation", label: "标准差" },
{ prop: "variance", label: "方差" },
{ prop: "standardError", label: "标准误差" },
{ prop: "kurtosis", label: "峰度" },
{ prop: "skewness", label: "偏度" },
{ prop: "max", label: "最大值" },
{ prop: "min", label: "最小值" },
{ prop: "summation", label: "求和" },
{ prop: "observations", label: "观测数" },
]);
const formInline = ref({});
const formInline = ref({
average: "",
median: "",
mode: "",
standardDeviation: "",
variance: "",
standardError: "",
kurtosis: "",
skewness: "",
max: "",
min: "",
summation: "",
observations: "",
});
const input = ref();
const g_indicatorData = ref([]);
const preProcessText = ref({
@ -223,6 +242,10 @@ const preProcessText = ref({
const g_modelParameter = ref([]);
//
const preProcess = (tetx) => {
if (analysisData.value.length == 0) {
proxy.$modal.msgWarning("请先选择指标进行数据分析!");
preProcessText.value.text2 = "";
}
API.dataPreprocessing({
mapList: analysisData.value,
method: preProcessText.value.text2,
@ -235,28 +258,7 @@ const preProcess = (tetx) => {
const taskSubmit = () => {
dialogVisible.value = true;
};
const tableData = [
{
date: "2016-05-03",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
{
date: "2016-05-02",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
{
date: "2016-05-04",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
{
date: "2016-05-01",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
];
const tableData = ref([]);
const headerCellStyle = () => {
return {
backgroundColor: "#1882DE !important", //
@ -274,9 +276,11 @@ const handleSelectionChange = (type) => {
};
//
const submit = () => {
if (g_indicatorData.value.length == 0) return proxy.$modal.msgWarning("请选择指标");
marketingAlgorithmApi.getMarketingAlgorithm({ userId: n_dataTableQuery.value.userId, tableName: n_dataTableQuery.value.tableName, fieldList: g_indicatorData.value }).then((res) => {
analysisData.value = res.data;
analysisHanderKry.value = Object.keys(res.data[0]);
proxy.$modal.msgSuccess("分析数据成功");
});
};
//
@ -285,8 +289,14 @@ const handlemodelSelectionChange = (type) => {
};
//
const modelCalculation = () => {
if (analysisData.value.length == 0 && g_modelParameter.value.length == 0) {
proxy.$modal.msgWarning("请先分析数据/未选择模型参数!");
return;
}
const processedData = processArrayData(analysisHanderKry.value, analysisData.value);
marketingAlgorithmApi.getMarketingAlgorithmPreprocessing(JSON.stringify({ map: processedData, statistic: g_modelParameter.value, userId: n_dataTableQuery.value.userId }));
marketingAlgorithmApi.getMarketingAlgorithmPreprocessing(JSON.stringify({ map: processedData, statistic: g_modelParameter.value, userId: n_dataTableQuery.value.userId })).then((res) => {
tableData.value = res.data.map((item) => item.statistics);
});
};
function processArrayData(keys, data) {
//
@ -309,6 +319,65 @@ onMounted(() => {
const getIndicator = () => {
algorithmStore.getUserDatabase({ userId: n_dataTableQuery.value.userId, tableName: n_dataTableQuery.value.tableName });
};
//
const knowledgeImport = (e) => {
loading.value = true;
const files = e.target.files[0];
const formdata = new FormData();
formdata.append("file", files);
marketingAlgorithmApi.getMarketingAlgorithmKnowledgeImport(formdata).then((res) => {
proxy.$modal.msgSuccess("导入成功");
loading.value = false;
});
};
//
const submitTask = () => {
for (let key in formInline.value) {
if (formInline.value[key] == "") {
const label = tableLabel.find((item) => item.prop == key);
proxy.$modal.msgWarning(`${label.label}不能为空`);
return;
}
}
portraitModel
.submit({
userId: n_dataTableQuery.value.userId,
taskName: "描述性统计",
numberOfErrors: 0,
})
.then((res) => {
dialogVisible.value = false;
proxy.$modal.msgSuccess("提交成功");
});
};
//
const restart = () => {
//
formInline.value = {
average: "",
median: "",
mode: "",
standardDeviation: "",
variance: "",
standardError: "",
kurtosis: "",
skewness: "",
max: "",
min: "",
summation: "",
observations: "",
};
analysisData.value = [];
analysisHanderKry.value = [];
tableData.value = [];
g_indicatorData.value = [];
g_modelParameter.value = [];
preProcessText.value.text2 = "";
n_dataTableQuery.value.tableName = "用户属性表";
getIndicator();
proxy.$modal.msgSuccess("重新开始成功");
multipleTableRef.value.clearSelection();
};
</script>
<style lang="scss" scoped>
@ -323,14 +392,14 @@ const getIndicator = () => {
.main-but {
margin: 5px 20px 0;
display: flex;
.el-button:nth-child(1) {
.el-button:nth-child(2) {
width: 180px;
height: 56px;
background: url("../../../assets/images/011.png");
color: #ffffff;
border-color: #ffffff00;
}
.el-button:nth-child(2) {
.el-button:nth-child(3) {
width: 180px;
height: 56px;
background: url("../../../assets/images/022.png");

@ -38,6 +38,9 @@
.top_item{
img{
margin-right: 5px;
}
.el-button{
padding-left: 49px !important;
}
.el-button:nth-child(1) {
width: 170px;
@ -94,9 +97,9 @@
border-color:#FFFFFF00;
padding:8px 5px 8px 20px;
}
// .active{
// background: url('../../assets/images/.png');
// }
.active{
background: url('../../assets/images/亮(钮).png');
}
}
}
</style>

Loading…
Cancel
Save