Commit 1df2d0f2 by jml0128

feat

1 parent 0d805885
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-30 22:36:55
* @LastEditTime: 2021-07-01 13:28:14
-->
<template>
<div style="position:relative;" class="bi-chart-block">
......@@ -135,6 +135,7 @@ export default {
},
changeText(text) {
// 修改附加文字的内容
this.chartConfig['desc']['customText'] = text;
console.log(`${this.title.name}-用户自定义描述`, text);
},
toggleAxis() {
......
......@@ -6,14 +6,17 @@
<div class="bi-cover">
<div
class="bi-cover_bg"
:style="{ backgroundColor: coverList[coverIndex].background }"
:style="{
backgroundImage: `url(${chooseBackground.templatePicUrl})`,
backgroundSize: '100% 100%'
}"
>
<el-popover
:popper-class="isMobile ? 'mobile-popover' : ''"
placement="bottom"
trigger="click"
v-model="visibleCoverList"
v-if="!isPrint"
v-if="coverList.length > 0 && !isPrint"
>
<div class="bi-cover_popover">请选择封面</div>
<swiper class="bi-cover_swiper" :options="swiperOptions">
......@@ -28,9 +31,12 @@
<div
@click="localIndex = index"
class="bi-cover_item_img"
:style="{ background: item.background }"
:style="{
backgroundImage: `url(${item.templatePicUrl})`,
backgroundSize: '100% 100%'
}"
></div>
<div class="bi-cover_name">{{ item.name }}</div>
<div class="bi-cover_name">{{ item.templateName }}</div>
</swiper-slide>
</swiper>
<el-button
......@@ -101,6 +107,14 @@ export default {
coverContent: {
default: () => [],
type: Array
},
coverList: {
default: () => [],
type: Array
},
coverId: {
default: 0,
type: [Number, String]
}
},
data() {
......@@ -112,33 +126,24 @@ export default {
content: [],
coverIndex: 0,
localIndex: 0,
coverList: [
{
background: '#6C71FF',
name: '模板一'
},
{
background: '#1989FA',
name: '模板二'
},
{
background: '#3BCF9F',
name: '模板三'
},
{
background: '#FF846E',
name: '模板四'
}
],
drag: false
};
},
computed: {
chooseBackground() {
const a =
this.coverList.find(item => item.id == this.coverId) ||
this.coverList[0] ||
{};
return a;
}
},
methods: {
dealPos(dis) {
return dis * (this.isPrint ? printWidth : this.baseFontSize);
},
changeCover() {
this.coverIndex = this.localIndex;
this.$emit('change', this.coverList[this.localIndex].id);
this.visibleCoverList = false;
},
handleMouseDown(e, pos) {
......@@ -257,7 +262,11 @@ export default {
this.content = baseContent.map((item, index) => {
const { name, pos } = arr[index];
name && (item.name = name);
pos && (item.pos = pos);
try {
pos && (item.pos = JSON.parse(pos));
} catch (error) {
console.warn(error);
}
return item;
});
}
......@@ -268,27 +277,28 @@ export default {
if (Array.isArray(newV) && newV.length > 0) {
this.dealCoverContent(newV);
this.$nextTick(() => {
this.$refs['input'].forEach(item => {
item.addEventListener('paste', function(e) {
e.stopPropagation();
e.preventDefault();
var text = '',
event = e.originalEvent || e;
if (event.clipboardData && event.clipboardData.getData) {
text = event.clipboardData.getData('text/plain');
} else if (
window.clipboardData &&
window.clipboardData.getData
) {
text = window.clipboardData.getData('Text');
}
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
document.execCommand('paste', false, text);
}
Array.isArray(this.$refs['input']) &&
this.$refs['input'].forEach(item => {
item.addEventListener('paste', function(e) {
e.stopPropagation();
e.preventDefault();
var text = '',
event = e.originalEvent || e;
if (event.clipboardData && event.clipboardData.getData) {
text = event.clipboardData.getData('text/plain');
} else if (
window.clipboardData &&
window.clipboardData.getData
) {
text = window.clipboardData.getData('Text');
}
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
document.execCommand('paste', false, text);
}
});
});
});
});
}
},
......
......@@ -13,11 +13,11 @@
<img src="../lib/svg/chexiao.svg" />
撤销删除
</div>
<div class="">
<div class="" @click="save">
<img src="../lib/svg/baocun.svg" />
保存
</div>
<div class="">
<div class="" @click="exportFn">
<img src="../lib/svg/daochu-tianchong.svg" />
导出
</div>
......@@ -56,8 +56,9 @@
</template>
<script>
import { check } from 'xrk-tools';
import mixin from '../mixin/index';
import { Dialog, Button, Checkbox, CheckboxGroup } from 'element-ui';
import { Dialog, Button, Checkbox, CheckboxGroup, Message } from 'element-ui';
export default {
name: 'bi-operate',
mixins: [mixin],
......@@ -71,6 +72,14 @@ export default {
questionData: {
type: Array,
default: () => []
},
saveInfo: {
type: Function,
default: () => {}
},
exportBi: {
type: Function,
default: () => {}
}
},
data() {
......@@ -86,6 +95,26 @@ export default {
item.isDelete = 0;
});
this.resetDeleteArr = [];
},
save() {
if (check.isFunction(this.saveInfo)) {
const loading = Message({
message: '保存中...请稍等',
duration: 0
});
this.saveInfo().then(() => {
loading.close();
Message({
message: '保存成功',
type: 'success'
});
});
}
},
exportFn() {
if (check.isFunction(this.exportBi)) {
this.exportBi();
}
}
}
};
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-02-26 15:38:10
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-30 16:53:40
* @LastEditTime: 2021-07-01 14:30:15
-->
<template>
<div class="xrk-components-bi bi" :class="{ 'bi-print': print }">
......@@ -52,6 +52,18 @@ export default {
getGroupInfo: {
type: Function,
default: () => {}
},
saveInfo: {
type: Function,
default: () => {}
},
exportBi: {
type: Function,
default: () => {}
},
getTemplateList: {
type: Function,
default: () => {}
}
},
components: {
......
......@@ -191,7 +191,8 @@ export const chartConfig = () => {
text: znResultSystem,
customText: znResultUser,
resText: '总结可知:不同年龄患者的发病状态无显著性差异。'
}
},
baseInfo: { ...options }
};
},
create: (xLength, yLength, type = 1, options = {}) => {
......
......@@ -4,12 +4,18 @@
-->
<template>
<div class="bi-zone">
<BiCover></BiCover>
<BiCover
:coverContent="coverContent"
ref="cover"
:coverList="coverList"
:coverId="coverId"
@change="id => (coverId = id)"
></BiCover>
<BiCatalogue class="bi-block" :catalogueArr="catalogueArr"></BiCatalogue>
<BiOverview
class="bi-block"
name="数据报告信息"
title="奇正藏药医学沙龙推广项目数据报告2021-04-28期"
:title="projectName"
:data="baseInfo"
></BiOverview>
<BiMission
......@@ -49,6 +55,8 @@
<BiCoverEnd title="奇正藏药医学沙龙推广项目数据报告"></BiCoverEnd>
<BiOperate
:questionData="[...singleChoice, ...singleChoiceMixin]"
:saveInfo="saveInfo"
:exportBi="exportBi"
></BiOperate>
</div>
</template>
......@@ -72,6 +80,8 @@ import project from '../mixin/project';
import { chartConfig } from '../mock/index';
const ChartConfigFn = chartConfig();
import { date, base } from 'xrk-tools';
export default {
name: 'bi-zone',
mixins: [mixin, project],
......@@ -91,79 +101,15 @@ export default {
page2: 0,
page2Info: [],
page3Info: [],
coverId: 0,
coverContent: [],
coverList: [],
singleChoice: [],
singleChoiceMixin: [],
missionData: [],
questionInfo: [
{
name: '专区内容:',
value: '20'
},
{
name: '本期有效点击量:',
value: '2000'
},
{
name: '总执行数(人或者机构):',
value: '2000'
}
],
baseInfo: [
[
{
name: '发起方',
value: '在山西地区的零售药店巡店项目'
},
{
name: '服务商',
value: '北京医洋科技有限公司'
},
{
name: '任务时间',
value: '24天'
}
],
[
{
name: '任务开始时间',
value: '2021-04-02'
},
{
name: '任务结算时间',
value: '2021-04-02'
},
{
name: '报表生成时间',
value: '2020-10-2'
}
],
[
{
name: '本期个人数据数',
value: '213123'
},
{
name: '累计个人数据总数',
value: '2020-10-2'
}
]
],
textData: [
[
{
name: '专区内容:',
value: '20题'
},
{
name: '总执行数(人或者机构):',
value: '11111'
},
{
name: '本期有效点击量:',
value: '20000人次'
}
]
]
projectName: '',
baseInfo: [],
textData: []
};
},
computed: {
......@@ -308,10 +254,155 @@ export default {
}),
ChartConfigFn.create(4, 0, 1, { hideDelete: true, height: 400 })
];
},
dealBaseInfo(info) {
const {
id,
coverTemplateId, // 模板ID
styleConfigureId, // 配置ID
title,
titlePosition,
aspEnterpriseNameWrite,
aspNamePosition,
styleConfigureSettlementTime,
styleConfigureSettlementTimePosition,
projectName = '-',
sendEnterpriseName = '-',
aspEnterpriseName = '-',
settlementTime,
taskSum,
executePeopleNumber,
dataCollectNumber,
examinePeopleNumber,
createDt,
totalTopicNum,
chooseTopicNum,
isContrainGroupAnalyse,
isContrainSingleAnalyse
} = info;
this.biInfo = {
biInfoId: id,
styleConfigureId
};
this.coverId = coverTemplateId;
const biCreateDt = date.dateFormat(createDt, 'Y-M-D');
this.projectName = `${projectName}${biCreateDt}服务报告`;
this.coverContent = [
{
name: title,
pos: titlePosition
},
{
name: styleConfigureSettlementTime,
pos: styleConfigureSettlementTimePosition
},
{
name: aspEnterpriseNameWrite,
pos: aspNamePosition
}
];
this.baseInfo = [
[
{
name: '发起方',
value: '在山西地区的零售药店巡店项目'
},
{
name: '服务商',
value: '北京医洋科技有限公司'
},
{
name: '任务时间',
value: '24天'
}
],
[
{
name: '任务开始时间',
value: '2021-04-02'
},
{
name: '任务结算时间',
value: '2021-04-02'
},
{
name: '报表生成时间',
value: '2020-10-2'
}
],
[
{
name: '本期个人数据数',
value: '213123'
},
{
name: '累计个人数据总数',
value: '2020-10-2'
}
]
];
this.textData = [
[
{
name: '专区内容:',
value: '20题'
},
{
name: '总执行数(人或者机构):',
value: '11111'
},
{
name: '本期有效点击量:',
value: '20000人次'
}
]
];
},
saveInfo() {
const { biInfoId, styleConfigureId } = this.biInfo;
const { content } = this.$refs['cover'];
return this.Bi.saveInfo({
biInfoId: biInfoId,
commandType: 2,
biStyleConfigureInfo: {
aspEnterpriseNameWrite: content[2].name || '', //乙方封面名称
aspNamePosition: JSON.stringify(content[2].pos), //乙方封面名称位置
styleConfigId: styleConfigureId, //封面配置ID
coverTemplateId: this.coverId, //封面ID
settlementTime: content[1].name || '', //封面时间
settlementTimePosition: JSON.stringify(content[1].pos), //封面时间位置
title: content[0].name || '', //封面标题
titlePosition: JSON.stringify(content[0].pos) //标题位置
},
makeSceneFixedDetailInfos: chartConfigToSetInfo(this.missionData),
makeSceneStyleConfigureTopicDetailInfos: chartConfigToSetInfo(
this.singleChoice
),
makeSceneGroupDetails: chartConfigToSetInfo(this.singleChoiceMixin)
});
},
exportBi() {
this.Bi.exportBi({
commandType: 1,
type: 1
});
}
},
created() {
this.setData();
Promise.all([
this.Bi.getBaseInfo(),
this.Bi.getFixedInfo(),
this.Bi.getTopicInfo(),
this.Bi.getGroupInfo(),
this.Bi.getTemplateList()
]).then(([baseInfo, tempaletList]) => {
this.dealBaseInfo(baseInfo.data.data[0] || {});
this.coverList = tempaletList.data.data || [];
});
window.status = 'completed';
}
};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!