Bläddra i källkod

提交导出按钮

master
风继续吹 1 år sedan
förälder
incheckning
48f7d9e4b5
6 ändrade filer med 4720 tillägg och 11 borttagningar
  1. +93
    -0
      src/api/modules/http.js
  2. +10
    -0
      src/router/page/index.js
  3. +19
    -11
      src/views/Statistics/Insightintothedetails.vue
  4. +909
    -0
      src/views/Statistics/ai/createReport.vue
  5. +702
    -0
      src/views/Statistics/ai/intelligentReporting.vue
  6. +2987
    -0
      src/views/Statistics/ai/reportDetail.vue

+ 93
- 0
src/api/modules/http.js Visa fil

@@ -1654,3 +1654,96 @@ export function customerFindExplain(params) {
}



// 添加智能报告
export function addMonthlyDataopenApiData(data) {
return request({
url: 'autoSR/openApiData/addMonthlyData',
method: 'post',
data
})
}

// 智能报告列表
export function monthlyDataFindByPageopenApiData(params) {
return request({
url: 'autoSR/openApiData/findByPage',
method: 'get',
params
})
}


// 删除记录
export function monthlyDeleteDataByIdopenApiData(params) {
return request({
url: 'autoSR/openApiData/deleteDataById',
method: 'get',
params
})
}

// 删除智能报告规则
export function monthlyDeleteByRuleIdopenApiData(params) {
return request({
url: 'autoSR/openApiData/deleteByRuleId',
method: 'get',
params
})
}

// 智能报告公司下的项目
export function monthlyGetProjectListopenApiData(params) {
return request({
url: 'autoSR/openApiData/getProjectList',
method: 'get',
params
})
}

// 智能报告详情
export function monthlyFindRuleByIdopenApiData(params) {
return request({
url: 'autoSR/openApiData/findRuleById',
method: 'get',
params
})
}

// 添加智能报告
export function monthlyAddMonthlyRuleopenApiData(data) {
return request({
url: 'autoSR/openApiData/addMonthlyRule',
method: 'post',
data
})
}

// 获取项目列表 (智能报告)
export function monthlygetOrgCodeListopenApiData(params) {
return request({
url: 'autoSR/monthly/getOrgCodeList',
method: 'get',
params
})
}


// 智能报告详情
export function monthlyFindDataByIdopenApiData(params) {
return request({
url: 'autoSR/openApiData/findDataById',
method: 'get',
params
})
}

// 上传
export function uploadFileOpenApiData(params) {
return request({
url: 'autoSR/openApiData/uploadFile',
method: 'get',
params
})
}


+ 10
- 0
src/router/page/index.js Visa fil

@@ -66,6 +66,16 @@ export default [
name: '报告详情',
component: () => import(/* webpackChunkName: "views" */"@/views/Statistics/reportDetail")
},
{
path: '/Statistics/ai/createReport',
name: '创建AI报告',
component: () => import(/* webpackChunkName: "views" */"@/views/Statistics/ai/createReport")
},
{
path: '/Statistics/ai/reportDetail',
name: 'AI报告详情',
component: () => import(/* webpackChunkName: "views" */"@/views/Statistics/ai/reportDetail")
},

]
},


+ 19
- 11
src/views/Statistics/Insightintothedetails.vue Visa fil

@@ -87,7 +87,7 @@
>

<!-- -->
<el-button
icon="el-icon-download"
v-if="permissions['sta_idx_download_detail']"
@@ -173,14 +173,19 @@ export default {
// 权限
this.sta_idx_download = this.permissions["sta_idx_download"];
var isnull = this.$route.query.flag;
if (isnull.TimetoAhoose) this.TimetoAhoose = isnull.TimetoAhoose;
if (isnull.customtime) this.customtime = isnull.customtime;
this.fromobj.starttime = isnull.starttime;
this.fromobj.endoftime = isnull.endoftime;
this.fromobj.projectId = isnull.houseId;
this.fromobj.keywords = isnull.keywordsId;
if (!isnull.TimetoAhoose && isnull.starttime && isnull.endoftime) {
this.TimetoAhoose = 6;
console.log(isnull);
try {
if (isnull.TimetoAhoose) this.TimetoAhoose = isnull.TimetoAhoose;
if (isnull.customtime) this.customtime = isnull.customtime;
this.fromobj.starttime = isnull.starttime;
this.fromobj.endoftime = isnull.endoftime;
this.fromobj.projectId = isnull.houseId;
this.fromobj.keywords = isnull.keywordsId;
if (!isnull.TimetoAhoose && isnull.starttime && isnull.endoftime) {
this.TimetoAhoose = 6;
}
} catch (e) {
console.log(e);
}
this.Accesstolevel();
},
@@ -188,10 +193,13 @@ export default {
...mapGetters(["permissions"]),
},
methods: {

// 导出
downLoads() {
exportMethodPost("autoSR/matchKeywords/receptionRecordExport", "画像详情", this.fromobj);
exportMethodPost(
"autoSR/matchKeywords/receptionRecordExport",
"画像详情",
this.fromobj
);
},

// 跳转接待详情


+ 909
- 0
src/views/Statistics/ai/createReport.vue Visa fil

@@ -0,0 +1,909 @@
<template>
<div class="pages">
<div class="titles">
<div class="label-item" v-if="selectCompanyList.length > 0 && false">
<span class="left-label"> 选择公司: </span>
<el-select
class="right-select"
placeholder="请选择公司"
disabled
v-model="inParamsObj.orgCode"
>
<el-option
v-for="item in selectCompanyList"
:key="item.orgCode"
:label="item.orgName"
:value="item.orgCode"
>
</el-option>
</el-select>
</div>

<div class="label-item">
<span class="left-label leftMF"> 模板名称: </span>
<el-input
v-model="inParamsObj.name"
class="right-select"
placeholder="请输入模板名称"
></el-input>
</div>
</div>

<!-- <%-- 选择报告内容--%> -->
<!-- <div class="f-title"></div> -->

<!-- <%-- --%> -->
<section class="sections">
<div class="sl-fl-tit"></div>
<div class="s-box">
<el-upload
class="upload-demo"
:action="actionUrl"
:on-change="
(file, fileList) => {
handleChange(file, fileList, 'system');
}
"
:file-list="system"
:accept="acceptList"
>
<div style="display: flex; align-items: center">
<div class="s-title">设置角色背景</div>
<el-button size="small" type="primary" style="margin-left: 20px"
>点击上传</el-button
>
</div>
</el-upload>
</div>
</section>

<section class="sections">
<div class="sl-fl-tit"></div>
<div class="s-box">
<el-upload
class="upload-demo"
:action="actionUrl"
:on-change="
(file, fileList) => {
handleChange(file, fileList, 'user');
}
"
:accept="acceptList"
:file-list="user"
>
<div style="display: flex; align-items: center">
<div class="s-title">问题或请求</div>
<el-button size="small" type="primary" style="margin-left: 20px"
>点击上传</el-button
>
</div>
</el-upload>
</div>
</section>

<section class="sections">
<div class="sl-fl-tit"></div>
<div class="s-box">
<el-upload
class="upload-demo"
:action="actionUrl"
:on-change="
(file, fileList) => {
handleChange(file, fileList, 'assistant');
}
"
:accept="acceptList"
:file-list="assistant"
>
<div style="display: flex; align-items: center">
<div class="s-title">期望的回应</div>
<el-button size="small" type="primary" style="margin-left: 20px"
>点击上传</el-button
>
</div>
</el-upload>
</div>
</section>
<el-button
type="primary"
style="
position: sticky;
bottom: 20px;
margin: 0 auto;
display: block;
width: 150px;
"
@click="creatMonthRule"
>保存</el-button
>
<!-- </section> -->
</div>
</template>

<script>
export default {
data() {
return {
// 周选择器配置
weekPickerOptions: {
disabledDate(time) {
const halfYear = (365 / 2) * 24 * 3600 * 1000;
let newDates = new Date();
let startTime = new Date(newDates.getTime() - halfYear).getTime();
return time.getTime() > Date.now() || time.getTime() < startTime;
},
},

selectItem: [
{
label: "全部",
},
{
label: "不等于",
},
{
label: "等于",
},
],

dateTypeLsit: [
{
label: "周",
},
{
label: "月",
},
{
label: "自定义",
},
],
params: {
dateType: "周", // 周 月 自定义
houseType: "全部", //
},
datessss: "", // 日期

pageParams: {
// 分页参数
total: 0,
pageNum: 1,
size: 10,
},

selectCompanyList: [], // 项目/公司列表

overViewList: [], // 数据概览的值

analysisList: [], // 数据分析

employeeList: [], // 员工分析

customerList: [], // 客户画像

suggestionsList: [], // 使用建议

specialArr1: [
{
label: "接待销讲执行率",
},
{
label: "接待挖掘成功率",
},
{
label: "接待时长",
},
{
label: "接待挖掘执行率",
},
{
label: "员工平均销讲执行率",
},
{
label: "员工平均挖掘成功率",
},
{
label: "员工平均接待时长",
},
{
label: "员工平均挖掘执行率",
},
], // 数据总览的指标分布

specialArr2: [
{
label: "有效接待率",
},
{
label: "标记顾问率",
},
{
label: "画像校准率",
},
], // 销讲分析达标率
specialArr3: [
{
label: "使用记录",
},
], // 员工分析
overViewOption: [
{
value: "1",
label: "指标概况",
},
{
value: "2",
label: "指标趋势",
},
{
value: "3",
label: "指标分布",
},
],
overViewOptionChildren: [
{
disabled: false,
value: "axure",
label: "接待量",
},
{
disabled: false,
value: "axure",
label: "有效接待",
},
{
disabled: false,
value: "axure",
label: "有效接待率",
},
{
disabled: false,
value: "axure",
label: "违禁接待次数",
},
{
disabled: false,
value: "axure",
label: "敏感词触发次数",
},
{
disabled: false,
value: "axure",
label: "标记顾问率",
},
{
disabled: false,
value: "axure",
label: "平均接待时长",
},
{
disabled: false,
value: "axure",
label: "平均销讲执行率",
},
{
disabled: false,
value: "axure",
label: "平均挖掘执行率",
},
{
disabled: false,
value: "axure",
label: "平均挖掘成功率",
},
{
disabled: false,
value: "axure",
label: "在线设备",
},
{
disabled: false,
value: "axure",
label: "接待校准率",
},
], // 数据概览对应条件1

analysisOption: [
{
value: "1",
label: "项目排名",
},
{
value: "1",
label: "项目指标变化",
},
{
value: "1",
label: "指标提升最大",
},
{
value: "1",
label: "指标下降最大",
},
{
value: "1",
label: "指标最高项目",
},
{
value: "1",
label: "指标最低项目",
},
{
value: "1",
label: "达标率",
},
],

// 销讲分析
analysisOptionChildren: [
{
value: "1",
label: "接待量",
disabled: false,
},
{
value: "1",
label: "有效接待",
disabled: false,
},
{
value: "1",
label: "有效接待率",
disabled: false,
},
{
value: "1",
label: "违禁接待次数",
disabled: false,
},
{
value: "1",
label: "敏感词触发次数",
disabled: false,
},
{
value: "1",
label: "标记顾问率",
disabled: false,
},
{
value: "1",
label: "平均接待时长",
disabled: false,
},
{
value: "1",
label: "平均销讲执行率",
disabled: false,
},
{
value: "1",
label: "平均挖掘执行率",
disabled: false,
},
{
value: "1",
label: "平均挖掘成功率",
disabled: false,
},
], // 销讲分析

employeeOption: [
{
label: "管理者记录",
},
{
label: "员工排名",
},
{
label: "提升最大",
},
{
label: "提升排名",
},
{
label: "明显下跌",
},
], // 员工分析
employeeOptionChildren: [
{
value: "1",
label: "接待量",
disabled: false,
},
{
value: "1",
label: "有效接待",
disabled: false,
},
{
value: "1",
label: "有效接待率",
disabled: false,
},
{
value: "1",
label: "违禁接待次数",
disabled: false,
},
{
value: "1",
label: "敏感词触发次数",
disabled: false,
},
{
value: "1",
label: "标记顾问率",
},
{
value: "1",
label: "平均接待时长",
disabled: false,
},
{
value: "1",
label: "平均销讲执行率",
disabled: false,
},
{
value: "1",
label: "平均挖掘执行率",
disabled: false,
},
{
value: "1",
label: "平均挖掘成功率",
disabled: false,
},
], // 销讲分析

customerOption: [
{
label: "画像触达总览",
},
{
label: "项目画像触达",
},
], // 客户画像

suggestionsOption: [
{
label: "硬件-充电及网络问题",
},
{
label: "硬件-充电及网络问题解决方案",
},
{
label: "应用-顾问未标记",
},
{
label: "应用-标记顾问流程",
},
{
label: "应用-执行率问题",
},
// {
// label: '自定义建议',
// },
], // 使用建议

// 对比的arr
companyOptionList: [
{
label: "集团平均",
},
{
label: "行业平均",
},
{
label: "自定义",
},
],

// 取前几名
mathAreaList: [
{
label: 5,
},
{
label: 10,
},
{
label: 15,
},
{
label: 20,
},
],

inParamsObj: {
type: 0, // 报告类型 0:公司,1:项目
rule: "", // 月报规则
name: "", // 报告名称
orgCode: localStorage.getItem("orgCode"), // orgCode 公司code(type为0传这个参数 )
houseId: "", // houseId 项目id(type为1传这个参数 )
},

needCpuData: [
{
name: "数据概览",
value: "overViewList",
},
{
name: "销讲分析",
value: "analysisList",
},
{
name: "员工分析",
value: "employeeList",
},
{
name: "客户画像",
value: "customerList",
},
{
name: "使用建议",
value: "suggestionsList",
},
], // 需要处理的数据列表
ruleId: "",
ruleObj: {}, // 规则对象

actionUrl: "/autoSR/openApiData/uploadFile", // 上传文件的路径
acceptList: ".txt, .doc, .docx", // 上传文件类型
system: [], // 角色背景
user: [], // 问题或请求
assistant: [], // 回应
};
},

computed: {
isShowDuiBi() {
// 有效接待率,标记顾问率,平均执行率,平均挖掘成功率,平均挖掘执行率
return (name) => {
return name.indexOf("率") != -1;
};
},
},
created() {
if (this.$route.query.id) this.ruleId = this.$route.query.id;
},
mounted() {
this.getOrgCodeList();
if (this.ruleId) {
this.findRuleById();
}
},

methods: {
// 文件上传成功
handleChange(file, filelist, name) {
console.log(file, filelist, name);
this[name] = filelist;
},
// 上传文件
upLoadFile() {
this.$api.http.uploadFileOpenApiData();
},

// 第一项选择
firstChange(e, arr, arr2, name, index) {
console.log(e, arr, arr2, name, index);
let needBindArr = [];
arr2.forEach((item) => {
needBindArr.push(item.value);
});
arr.forEach((item) => {
if (needBindArr.includes(item.label)) {
item.disabled = true;
} else {
item.disabled = false;
}
});

this[name][index].selectArr = [
{
value: "",
values: "", //
customValue: "", // 自定义输入的值
companyOptionList: this.companyOptionList, // 公司用的
mathAreaList: this.mathAreaList, // 提升排名接待量
},
];
},

// 第二项选项
secondChange(e, arr, arr2) {
let needBindArr = [];
arr2.forEach((item) => {
needBindArr.push(item.value);
});
arr.forEach((item) => {
if (needBindArr.includes(item.label)) {
item.disabled = true;
} else {
item.disabled = false;
}
});
},

//获取项目列表
getOrgCodeList() {
this.$api.http.monthlygetOrgCodeListopenApiData().then((res) => {
this.selectCompanyList = res.data;
});
},

// 公共添加方法
tianjia(keywords) {
cosnole.log(keywords);
},

//新增选项
addOverView(data, index, otherName) {
console.log(data, index, otherName);
if (
this[otherName + "List"][index].selectArr.length <
this[otherName + "OptionChildren"].length
) {
this[otherName + "List"][index].selectArr.push({
value: "",
values: "", //
customValue: "", // 自定义输入的值
companyOptionList: this.companyOptionList, // 公司用的
mathAreaList: this.mathAreaList, // 提升排名接待量
});
} else {
this.$message.error("不能再添加了~");
}
},
// 删除某一项
deleteView(index, seIndex, otherName) {
console.log(index, seIndex, otherName);
this[otherName + "List"][index].oneOption.forEach((item) => {
if (this[otherName + "List"][index].value == item.label) {
item.disabled = false;
}
});
if (["overView", "analysis", "employee"].includes(otherName)) {
let needArr = [];
if (seIndex == 0) {
this[otherName + "List"][index].selectArr.forEach((item) => {
needArr.push(item.value);
});
} else {
needArr.push(
this[otherName + "List"][index].selectArr[seIndex].value
);
}
if (this[otherName + "List"][index].value == "管理者记录") {
console.log("管理者记录delete");
} else if (this[otherName + "List"][index].value == "达标率") {
this[otherName + "List"][index].specialArr2.forEach((item) => {
if (needArr.includes(item.label)) {
item.disabled = false;
}
});
} else if (this[otherName + "List"][index].value == "指标分布") {
this[otherName + "List"][index].specialArr1.forEach((item) => {
if (needArr.includes(item.label)) {
item.disabled = false;
}
});
} else {
this[otherName + "List"][index].twoOption.forEach((item) => {
if (needArr.includes(item.label)) {
item.disabled = false;
}
});
}
}
if (seIndex == 0) {
this[otherName + "List"].splice(index, 1);
} else {
this[otherName + "List"][index].selectArr.splice(seIndex, 1);
}
},

// 查看详情
findRuleById() {
this.$api.http
.monthlyFindRuleByIdopenApiData({
id: this.ruleId,
})
.then((res) => {
if (res.code == 10000) {
this.inParamsObj.name = res.data.name;
this.inParamsObj.orgCode = res.data.orgCode;
let arr = JSON.parse(res.data.rule);
console.log(arr);
for (let i in arr) {
this[i] = arr[i];
}
}
});
},

// 生成报告规则
creatMonthRule() {
if (this.assistant.length == 0) {
this.$message.error("请上传期望的回应");
return;
}
let obj = {
system: this.system,
user: this.user,
assistant: this.assistant,
};
this.inParamsObj.rule = JSON.stringify(obj);
if (
this.ruleId &&
this.ruleId != undefined &&
this.ruleId != "undefined"
) {
this.inParamsObj.id = this.ruleId;
}
if (!this.inParamsObj.name) {
this.$message.error("请填写模板名称");
return;
}
this.addMonthlyRule();
},

addMonthlyRule() {
this.$api.http
.monthlyAddMonthlyRuleopenApiData(this.inParamsObj)
.then((res) => {
console.log(res);
if (res.code == 10000) {
this.$message.success(res.message);
setTimeout(() => {
this.$router.go(-1);
}, 1000);
} else {
this.$message.error(res.message);
}
});
},

//使用递归实现深拷贝
deepClone(obj) {
return JSON.parse(JSON.stringify(obj || ""));
},
},
};
</script>

<style lang="scss" scoped>
.pages {
margin: 0 auto;
width: 98%;
height: 90%;
overflow-y: auto;
padding: 15px;
background: #fff;
border-radius: 16px;
}

.titles {
position: sticky;
top: 0;
padding: 10px 20px;
background: #fff;
display: flex;
flex-wrap: wrap;
}

.label-item {
display: flex;
align-items: center;
}

.label-item .leftMF {
margin-left: 20px;
}

.left-label {
font-size: 16px;
color: #111111;
font-weight: 500;
font-family: PingFangSC-Medium, PingFang SC;
}

.label-item .left-label {
flex-shrink: 0;
width: 80px;
}

.label-item .right-select {
}

.f-title {
padding: 0 24px;
color: #111111;
font-weight: 500;
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
}

.sections {
padding: 24px;
background: #fff;
}

.s-title {
font-size: 14px;
font-weight: 500;
font-family: PingFangSC-Medium, PingFang SC;
}

.sl-fl-tit {
padding: 16px 0 0;
display: flex;
justify-content: space-between;
align-items: center;
}

.date {
display: flex;
align-items: center;
}

.date .date-box {
display: flex;
align-items: center;
}

.s-box .date .ld {
margin-right: 10px;
}

.s-box {
display: flex;
flex-direction: column;
}

.selectone {
padding: 10px 0;
margin-right: 20px;
flex-shrink: 0;
width: 180px;
}

.s-box .select {
width: 100%;
display: flex;
align-items: center;
}

.s-box .select .lefts {
flex-grow: 1;
display: flex;
flex-wrap: wrap;
}

.s-box .select .lefts .seconds {
width: calc(100% - 200px);
display: flex;
/*flex-direction: column;*/
}

.seconds .deletes {
display: flex;
align-items: center;
flex-shrink: 0;
}

.s-box .select .lefts .seconds .seconds-left {
flex-grow: 1;
display: flex;
align-items: center;
}

.s-box .select .rights {
flex-shrink: 0;
}

.elinputs {
width: 120px;
}
</style>

+ 702
- 0
src/views/Statistics/ai/intelligentReporting.vue Visa fil

@@ -0,0 +1,702 @@
<template>
<div class="pages">
<div class="titles">
<el-button type="primary" size="medium" @click="goCreatReport"
>创建模板</el-button
>
</div>
<div class="tablebox">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="模板名称" align="center">
</el-table-column>
<el-table-column prop="orgName" label="公司" align="center">
</el-table-column>
<el-table-column prop="accountName" label="创建人" align="center">
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center">
</el-table-column>

<el-table-column label="操作" width="250" align="center">
<template slot-scope="{ row }">
<template>
<el-button
style="color: var(--theme)"
@click.native.prevent="goCreatReport(row)"
type="text"
size="small"
>报告规则
</el-button>
</template>
<template>
<el-button
style="color: var(--theme)"
@click.native.prevent="showRuleTips(row)"
type="text"
size="small"
>生成报告
</el-button>
</template>
<template>
<el-button
style="color: var(--theme)"
@click.native.prevent="showHistory(row)"
type="text"
size="small"
>生成记录
</el-button>
</template>
<template>
<el-button
style="color: var(--theme)"
@click.native.prevent="deleteByRule(row)"
type="text"
size="small"
>删除
</el-button>
</template>
</template>
</el-table-column>
</el-table>
<div style="display: flex; justify-content: flex-end; margin-top: 10px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageParams.pageNum"
:page-sizes="[10, 20, 30]"
:page-size="pageParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageParams.total"
>
</el-pagination>
</div>
</div>

<el-dialog
title="生成报告"
:visible.sync="creatRule"
:close-on-click-modal="false"
width="50%"
>
<div class="sections">
<div class="s-box">
<div class="date">
<span class="ld" style="flex-shrink: 0">报告名称</span>
<div class="date-box">
<el-input
v-model="params.name"
class="right-select"
placeholder="请输入报告名称"
></el-input>
</div>
</div>
<div class="date">
<span class="ld" style="flex-shrink: 0">接待时间</span>
<div class="date-box">
<el-select
class="selectone"
placeholder="请选择"
v-model="params.dateType"
@change="emptyDateType"
>
<el-option
v-for="item in dateTypeLsit"
:key="item.label"
:label="item.label"
:value="item.label"
>
</el-option>
</el-select>

<template v-if="params.dateType == '周'">
<el-date-picker
v-model="params.time"
type="week"
format="yyyy年-W周"
:picker-options="weekPickerOptions"
placeholder="请选择"
>
</el-date-picker>
</template>

<template v-if="params.dateType == '月'">
<el-date-picker
v-model="params.time"
type="month"
format="yyyy-MM"
value-format="yyyy-MM"
:picker-options="weekPickerOptions"
placeholder="请选择"
>
</el-date-picker>
</template>

<template v-if="params.dateType == '自定义'">
<el-date-picker
class="little"
value-format="yyyy-MM-dd"
v-model="params.time"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="weekPickerOptions"
>
</el-date-picker>
</template>

<span class="ld" style="margin: 0 10px; flex-shrink: 0"
>对比时间</span
>

<template v-if="params.dateType == '周'">
<el-date-picker
v-model="params.contrastTime"
type="week"
format="yyyy年-W周"
:picker-options="weekPickerOptions"
placeholder="请选择"
>
</el-date-picker>
</template>

<template v-if="params.dateType == '月'">
<el-date-picker
v-model="params.contrastTime"
type="month"
format="yyyy-MM"
value-format="yyyy-MM"
:picker-options="weekPickerOptions"
placeholder="请选择"
>
</el-date-picker>
</template>

<template v-if="params.dateType == '自定义'">
<el-date-picker
class="little"
v-model="params.contrastTime"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="weekPickerOptions"
>
</el-date-picker>
</template>
</div>
</div>
<div class="date">
<span class="ld">选择项目</span>
<div class="date-box">
<el-select
class="selectone"
placeholder="请选择"
v-model="params.houseType"
>
<el-option
v-for="item in selectItem"
:key="item.label"
:label="item.label"
:value="item.label"
>
</el-option>
</el-select>

<template v-if="params.houseType != '全部'">
<el-select
class="selectone"
style="width: 280px"
placeholder="请选择"
v-model="params.selectHouseId"
filterable
multiple
collapse-tags
>
<el-option
v-for="item in projectList"
:key="item.id"
:label="item.propertyName"
:value="item.id"
>
</el-option>
</el-select>
</template>
</div>
</div>
</div>
</div>

<div slot="footer" class="dialog-footer">
<el-button @click="creatRule = false">取 消</el-button>
<el-button type="primary" @click="addMonthlyData()">确 定</el-button>
</div>
</el-dialog>
<el-dialog
title="生成纪录"
:visible.sync="roleHistory"
:close-on-click-modal="false"
>
<div>
<el-table :data="gridData" max-height="450px">
<el-table-column property="name" label="报告名称"></el-table-column>
<el-table-column
property="createName"
label="生成人"
></el-table-column>
<el-table-column
property="createTime"
label="生成时间"
></el-table-column>
<el-table-column property="address" label="操作">
<template slot-scope="{ row }">
<template v-if="row.status == 1">
<el-button
@click.native.prevent="toDetail(row)"
type="text"
size="small"
>查看
</el-button>
</template>
<template v-if="false">
<el-button
@click.native.prevent="b(row)"
type="text"
size="small"
>下载
</el-button>
</template>
<template v-if="row.status == 1">
<el-button
@click.native.prevent="deleteDataById(row)"
type="text"
size="small"
>删除
</el-button>
</template>
<template v-if="!row.status">
<span style="color: #808080ff">生成中...</span>
</template>
</template>
</el-table-column>
</el-table>
<div style="display: flex; justify-content: flex-end; margin-top: 10px">
<el-pagination
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"
:current-page="creatHistory.pageNum"
:page-sizes="[10, 20, 30]"
:page-size="creatHistory.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="creatHistory.total"
>
</el-pagination>
</div>
</div>

<div slot="footer" class="dialog-footer">
<el-button @click="roleHistory = false">关 闭</el-button>
<el-button type="primary" @click="roleHistory = false">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
// 周选择器配置
weekPickerOptions: {
disabledDate(time) {
const halfYear = (365 / 2) * 24 * 3600 * 1000;
let newDates = new Date();
let startTime = new Date(newDates.getTime() - halfYear).getTime();
return time.getTime() > Date.now() || time.getTime() < startTime;
},
},
row: {}, // 生成月报的数据集合
params: {
name: "", // 报告名称
dateType: "周", // 周 月 自定义
houseType: "全部", //
selectHouseId: [], // 选中house的id
time: "", // 日期
contrastTime: "", // 对比日期
},
dateTypeLsit: [
{
label: "周",
},
{
label: "月",
},
{
label: "自定义",
},
],
selectItem: [
{
label: "全部",
},
{
label: "不等于",
},
{
label: "等于",
},
],
creatRule: false, // 生成报告
roleHistory: false, // 生成记录
gridData: [], // 生成记录列表

pageParams: {
// 分页参数
total: 0,
pageNum: 1, //页码
pageSize: 10, //每页显示的记录数
// houseId: localStorage.getItem("houseId"), // 当前登陆楼盘
orgCode: localStorage.getItem("orgCode"),
},
projectList: [], // 项目列表

creatHistory: {
ruleId: "", // 当前生成记录的id
pageNum: 1, //页码
pageSize: 10, //每页显示的记录数
total: 0, // 总条数
}, // 生成记录
tableData: [], // 列表数据
};
},

mounted() {
this.getFindByPage();
},

methods: {
// 生成记录
findDataByRuleId() {
this.$api.http.findDataByRuleIdopenApiData(this.creatHistory).then((res) => {
this.gridData = res.data.records;
this.roleHistory = true; // 获取到数据后展示列表
this.creatHistory.total = res.data.total;
});
},

emptyDateType() {
if (this.params.dateType != "自定义") {
this.params.time = "";
this.params.contrastTime = "";
} else {
this.params.time = [];
this.params.contrastTime = [];
}
},
// 获取该公司下的项目
getProjectList(row) {
this.$api.http
.monthlyGetProjectList({
orgCode: row.orgCode,
})
.then((res) => {
console.log(res);
this.projectList = res.data;
});
},

// screen //筛选条件
// ruleId //月报规则id

// 添加筛选时间
addMonthlyData() {
if (!this.params.name) {
this.$message.error("请输入报告名称");
return;
}
console.log(this.params);
let arr = [];
let obj = {
screen: "",
name: this.params.name,
ruleId: this.row.id,
};

// 自定义时间选择
if (this.params.dateType == "自定义") {
if (!this.params.time || this.params.time.length == 0) {
this.$message.error("请选择时间");
return;
}
if (!this.params.contrastTime || this.params.contrastTime.length == 0) {
this.$message.error("请选择对比时间");
return;
}
let aTime =
new Date(this.params.time[1]).getTime() -
new Date(this.params.time[0]).getTime();
let bTime =
new Date(this.params.contrastTime[1]).getTime() -
new Date(this.params.contrastTime[0]).getTime();
if (aTime != bTime) {
this.$message.error("请选择相同天数的时间段");
return;
}
}

// 是否选择时间
if (
!this.params.time ||
!this.params.contrastTime ||
this.params.time.length == 0 ||
this.params.contrastTime.length == 0
) {
this.$message.error("请选择时间");
return;
}

// 指定选择某些项目时
if (
this.params.houseType != "全部" &&
this.params.selectHouseId.length == 0
) {
this.$message.error("请选择项目");
return;
}

if (this.params.houseType == "不等于") {
this.projectList.forEach((item) => {
if (!this.params.selectHouseId.includes(item.id)) {
arr.push(item.id);
}
});
let a = {
...this.params,
houstId: arr.join(","),
};
obj.screen = JSON.stringify(a);
} else {
let a = {
...this.params,
houstId: this.params.selectHouseId.join(","),
};
obj.screen = JSON.stringify(a);
}
this.creatRule = false; // 先关闭弹窗
this.params = {
dateType: "周", // 周 月 自定义
houseType: "全部", //
selectHouseId: [], // 选中house的id
time: "", // 日期
contrastTime: "", // 对比日期
};
this.$api.http.addMonthlyDataopenApiData(obj).then((res) => {
console.log(res, "resss");
if (res.code == 10000) {
this.$message.success(res.message);
} else {
this.$message.error(res.message);
}
});
},

// 跳转详情
toDetail(row) {
this.$router.push({
path: "/Statistics/ai/reportDetail",
query: {
id: row.id,
},
});
},

// 生成报告
showRuleTips(row) {
this.row = row;
this.emptyDateType();
this.getProjectList(row);
this.creatRule = true;
},

// 生成记录
showHistory(row) {
this.creatHistory.ruleId = row.id;
this.findDataByRuleId();
},
// 跳转页面
goCreatReport(data) {
this.$router.push({
path: "/Statistics/ai/createReport",
query: {
id: data.id || "",
},
});
},

// 分页每页条数改变
handleSizeChange(val) {
this.pageParams.pageNum = 1;
this.pageParams.pageSize = val;
this.getFindByPage();
},

// 切换上下页面
handleCurrentChange(val) {
this.pageParams.pageNum = val;
this.getFindByPage();
},

handleSizeChanges(val) {
this.creatHistory.pageNum = 1;
this.creatHistory.pageSize = val;
this.findDataByRuleId();
},

// 切换上下页面
handleCurrentChanges(val) {
this.creatHistory.pageNum = val;
this.findDataByRuleId();
},

//获取table数据、
getFindByPage() {
this.$api.http.monthlyDataFindByPageopenApiData(this.pageParams).then((res) => {
if (res.code == 10000) {
this.tableData = res.data.records;
this.pageParams.total = res.data.total;
}
});
},

// 删除记录
deleteDataById(row) {
this.$confirm("是否删除此报告", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$api.http
.monthlyDeleteDataByIdopenApiData({
id: row.id,
})
.then((res) => {
if (res.code == 10000) {
this.$message.success("操作成功");
this.findDataByRuleId();
} else {
this.$message.error(res.message);
}
})
.catch((e) => {
this.$message.error("操作失败");
});
})
.catch(() => {});
},

// monthly/deleteByRuleId
deleteByRule(row) {
this.$confirm('是否删除"' + row.name + '"报告', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$api.http
.monthlyDeleteByRuleIdopenApiData({
id: row.id,
})
.then((res) => {
if (res.code == 10000) {
this.$message.success("操作成功");
this.getFindByPage();
} else {
this.$message.error(res.data.message);
}
})
.catch((e) => {
this.$message.error("操作失败");
});
})
.catch(() => {});
},
},
};
</script>

<style lang="scss" scoped>
.pages {
margin: 0 auto;
width: 98%;
height: 90%;
padding: 15px;
background: #fff;
border-radius: 16px;
}

.titles {
padding: 10px 20px;
background: #fff;
}

.sl-fl-tit {
padding: 16px 0 0;
display: flex;
justify-content: space-between;
align-items: center;
}

.date {
display: flex;
align-items: center;
}

.date .date-box {
display: flex;
align-items: center;
}

.s-box .date .ld {
margin-right: 10px;
}

.s-title {
height: 32px;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
}

.s-box .date .ld {
margin-right: 10px;
}

.s-box {
display: flex;
flex-direction: column;
}

.date .date-box {
display: flex;
align-items: center;
}

.selectone {
padding: 10px 0;
margin-right: 20px;
flex-shrink: 0;
width: 180px;
}

.sections {
flex-direction: column;
}

.little {
width: 270px;
}
</style>

+ 2987
- 0
src/views/Statistics/ai/reportDetail.vue
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


Laddar…
Avbryt
Spara