Commit e5c2a3d3 by web

Merge branch 'develop' into 'release'

Develop

See merge request !20
2 parents b4fc2b26 468e98bd
/dist /dist
\ No newline at end of file /src/packages/bi/src/components/photo-wall/waterfall.vue
\ No newline at end of file
{ {
"name": "xrk-bi", "name": "xrk-bi",
"version": "0.3.0-beta.11", "version": "0.4.1",
"description": "xrk-bi", "description": "xrk-bi",
"author": "xrk", "author": "xrk",
"main": "dist/bundler.js", "main": "dist/bundler.js",
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.2",
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0", "babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1", "babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
:mobile="isMobile" :mobile="isMobile"
:print="isPrint" :print="isPrint"
:projectType="projectType" :projectType="projectType"
:selectType="selectType"
></component> ></component>
<!-- <XrkTaskRecordPdf :projectType="20" :taskId="1209388" :from="1" /> -->
</div> </div>
<!-- <ul class="pervie"> <!-- <ul class="pervie">
<li name="任务记录"> <li name="任务记录">
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<script> <script>
import { getQueryVariable } from './packages/bi/src/chart-type/common'; import { getQueryVariable } from './packages/bi/src/chart-type/common';
// import { XrkTaskRecordPdf } from './packages/task-recored/index';
export default { export default {
name: 'App', name: 'App',
data() { data() {
...@@ -44,7 +44,8 @@ export default { ...@@ -44,7 +44,8 @@ export default {
isMobile: +getQueryVariable('mobile') === 1, isMobile: +getQueryVariable('mobile') === 1,
isPrint: +getQueryVariable('print') === 1, isPrint: +getQueryVariable('print') === 1,
projectType: +getQueryVariable('projectType') || 6, projectType: +getQueryVariable('projectType') || 6,
componentName: getQueryVariable('componentName') || 'XrkBi' componentName: getQueryVariable('componentName') || 'XrkBi',
selectType: +getQueryVariable('selectType') || 45 // 44自定义-BI报告 45当期-BI报告 46累计-BI报告
}; };
} }
}; };
......
/* /*
* @Description: * @Description:
* @LastEditors: jml
* @Date: 2021-01-28 23:29:19 * @Date: 2021-01-28 23:29:19
*/ */
// import 'babel-polyfill';
import Vue from 'vue'; import Vue from 'vue';
import App from './App'; import App from './App';
import Xrk from './lib/index.js'; import Xrk from './lib/index.js';
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(Xrk); Vue.use(Xrk);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
class="bi_title_text_icon" class="bi_title_text_icon"
/> />
</div> </div>
<slot name="handler"></slot>
</div> </div>
</template> </template>
...@@ -33,9 +34,12 @@ $bluecolor: #1989fa; ...@@ -33,9 +34,12 @@ $bluecolor: #1989fa;
line-height: 0; line-height: 0;
height: 88px; height: 88px;
border-bottom: 2px solid #f4f4f4; border-bottom: 2px solid #f4f4f4;
padding-left: 29px; padding: 0 29px;
display: flex;
align-items: center;
justify-content: space-between;
&_text { &_text {
margin-top: 32px; // margin-top: 32px;
height: 33px; height: 33px;
background: $bluecolor; background: $bluecolor;
font-size: 22px; font-size: 22px;
......
...@@ -74,7 +74,6 @@ export default { ...@@ -74,7 +74,6 @@ export default {
// return cataloguePageSize; // return cataloguePageSize;
// } // }
}, },
created() {},
watch: { watch: {
catalogueArr: { catalogueArr: {
handler() { handler() {
......
...@@ -118,10 +118,10 @@ export default { ...@@ -118,10 +118,10 @@ export default {
}); });
this.saving = false; this.saving = false;
}) })
.catch(() => { .catch(e => {
this.saving = false; this.saving = false;
loading.close(); loading.close();
Message.error('保存失败'); Message.error(e || '保存失败');
}); });
} }
}, },
......
<!--
* @Description:
* @Date: 2022-05-13 09:41:06
-->
<template>
<div>
<el-button @click="handleRemove" class="bi-photo_btn">
<img
src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/delete.svg"
alt=""
/>
删除
</el-button>
</div>
</template>
<script>
import { MessageBox, Message, Button } from 'element-ui';
export default {
name: 'photo-wall-del',
components: {
[Button.name]: Button
},
methods: {
handleRemove() {
MessageBox.confirm(
'是否确认删除?删除后可在撤销删除里面回复该分析',
'提示',
{
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
}
)
.then(() => {
this.$emit('del');
Message({
type: 'success',
message: '删除成功!'
});
})
.catch(() => {
Message({
type: 'info',
message: '已取消删除'
});
});
}
}
};
</script>
<style scoped lang="scss">
.bi-photo {
// page-break-before: always;
// page-break-after: always;
padding-bottom: 50px;
&_btn {
display: inline-block;
min-width: 42px;
height: 42px;
border: 1px solid #bac1ce;
border-radius: 4px;
vertical-align: top;
text-align: center;
line-height: 42px;
padding: 0 15px;
font-size: 16px;
font-weight: 500;
color: #6f7a91;
cursor: pointer;
position: relative;
&_group {
position: absolute;
right: 16px;
top: 50%;
margin-top: -21px;
z-index: 3;
&_item {
& + .bi-chart-title_btn_group_item {
margin-left: 8px;
}
}
}
}
}
</style>
<template>
<!-- <ul :style="{ columnCount }">
<li v-for="(item, index) in taskImageInfo.imageUrls" :key="index">
<img :src="setUrl(item.imageUrl)" />
</li>
</ul> -->
<div>
<div
v-for="(imageUrls, imageUrlsIndex) in waterfalls"
:key="imageUrlsIndex"
>
<waterfall
ref="waterfall"
:col="columnCount"
:data="imageUrls"
@finish="finish"
>
<template>
<div
v-for="(item, index) in imageUrls"
:key="index"
:style="{
padding: '10px 0',
'text-align': 'center'
}"
>
<img
:style="{ width: widthPx, height: heightPx }"
:src="setUrl(item.imageUrl)"
/>
</div>
</template>
</waterfall>
</div>
</div>
</template>
<script>
import waterfall from './waterfall.vue';
const IMG_MAPPING = {
1: {
column: 2, // 2列数据
width: 548,
height: 305
},
2: {
column: 3,
width: 355,
height: 198
},
3: {
column: 4,
width: 262,
height: 144
}
};
const baseHeight = 1697;
export default {
name: 'bi-photo-wall-images',
components: {
waterfall
},
props: {
taskImageInfo: {
type: Object,
default() {
return {
imageStyle: 2, // 1流式 2平铺 流式不限制高度,但是有max-height,平铺为正方形
imageSize: 2, //图片大小 1 大 2中 3小
imageUrls: [
// {
// id: 1,
// biInfoId: 123, //BI主键
// taskId: 123, //任务记录ID
// imageUrl: '图片地址'
// }
]
};
}
}
},
watch: {
taskImageInfo: {
deep: true,
immediate: true,
handler(v) {
const { imageUrls, imageStyle } = v;
let waterfalls = [];
const titleHeight = 88;
const margin = 20;
// 第一页图片总列数
const firstColumnNum = Math.floor(
(baseHeight - titleHeight) / (this.height + margin)
);
// 其他页图片总列数
const otherColumnNum = Math.floor(baseHeight / (this.height + margin));
const firstCount = firstColumnNum * this.columnCount; // 第一页数据总数
const otherCount = otherColumnNum * this.columnCount; // 其他页数据总数
if (imageUrls) {
if (imageStyle === 2) {
imageUrls.forEach((item, index) => {
// 第一个 || 第一组最后一个(只会出现一次) || 其他组最后一个(多次出现)
if (
index === 0 ||
index === firstCount ||
!(index % otherCount)
) {
waterfalls[waterfalls.length] = [];
}
waterfalls[waterfalls.length - 1].push(item);
});
} else {
waterfalls = [imageUrls];
}
this.waterfalls = waterfalls;
}
}
}
},
data() {
return {
waterfalls: [] // 二维数组,第一个为第一页算上title单独计算,其他为统一计算分组
};
},
computed: {
columnCount() {
return IMG_MAPPING[this.taskImageInfo.imageSize].column;
},
width() {
return IMG_MAPPING[this.taskImageInfo.imageSize].width;
},
height() {
return IMG_MAPPING[this.taskImageInfo.imageSize].height;
},
widthPx() {
return this.width + 'px';
},
heightPx() {
if (this.taskImageInfo.imageStyle === 2) {
return this.height + 'px';
}
return 'auto';
}
},
methods: {
finish() {
this.$emit('finish');
},
setUrl(url) {
// x-oss-process=image/resize,w_355 流式
// ?x-oss-process=image/resize,m_fill,w_355,h_355
const _url = url.split('?')[0];
if (this.taskImageInfo.imageStyle === 1) {
return `${_url}?x-oss-process=image/resize,w_${this.width}`;
}
return `${_url}?x-oss-process=image/resize,m_fill,w_${this.width},h_${this.height}`;
}
}
};
</script>
<style scoped lang="scss">
// https://help.aliyun.com/document_detail/44688.html
// ul {
// padding: 0 30px;
// padding-top: 35px;
// position: relative;
// list-style: none;
// display: flex;
// flex-wrap: wrap;
// li {
// margin: 10px;
// img {
// // 大548px 中355px 小262px
// width: 358px;
// height: 358px;
// // object-fit: fill;
// }
// }
// }
ul {
padding: 0 30px;
padding-top: 35px;
position: relative;
list-style: none;
// display: flex;
// flex-wrap: wrap;
column-count: 3;
column-gap: 0;
li {
break-inside: avoid;
img {
max-height: 588px;
margin: 10px;
// 大548px 中355px 小262px
// width: 358px;
// height: 358px;
// object-fit: fill;
}
}
}
</style>
<!--
* @Description:
* @Date: 2021-06-09 19:05:20
-->
<template>
<div class="bi-photo" ref="bi-photo">
<BiTitle :index="index" :name="name">
<template #handler>
<div class="bi-title-photo-btn" v-if="!isPrint">
<SelectStyle
style="margin: 0 5px"
v-if="showEdit"
:layout="{
imageStyle: value.imageStyle,
imageSize: value.imageSize
}"
@handleSave="selectStyleSave"
/>
<SelectImages
style="margin: 0 5px"
v-if="showEdit"
:imageUrls="value.imageUrls"
@handleSave="selectImgSave"
/>
<Del style="margin: 0 5px" @del="onDel" />
</div>
</template>
</BiTitle>
<BiImages :taskImageInfo="value" @finish="finish" />
</div>
</template>
<script>
import BiTitle from '../../commonComponents/title.vue';
import BiImages from './images';
import SelectImages from './select';
import SelectStyle from './style';
import Del from './del';
import { heightToPage } from '../../chart-type/common';
import mixin from '../../mixin/index';
export default {
name: 'bi-photo-wall',
mixins: [mixin],
components: {
BiTitle,
BiImages,
SelectImages,
SelectStyle,
Del
},
props: {
name: String,
value: {
default() {
return {
isDelete: 0, // 1删除
imageStyle: 2, // 1流式 2平铺 流式不限制高度,但是有max-height,平铺为正方形
imageSize: 2, //图片大小 1 大 2中 3小
imageUrls: [
// {
// id: 1,
// biInfoId: 123, //BI主键
// taskId: 123, //任务记录ID
// imageUrl: '图片地址'
// }
]
};
},
type: Object
},
index: {
type: Number,
default: 4
}
},
computed: {
showEdit() {
return +this.Bi.selectType === 45; // 44自定义-BI报告 45当期-BI报告(显示样式、选择) 46累计-BI报告
}
},
methods: {
finish() {
this.$emit('finish');
},
// 选择图片的保存
selectImgSave(e) {
this.$emit('input', {
...this.value,
imageUrls: e
});
},
// 选择样式的保存
selectStyleSave(e) {
this.$emit('input', {
...this.value,
...e
});
},
onDel() {
this.$emit('input', {
...this.value,
isDelete: 1
});
}
},
watch: {
value: {
handler() {
this.$nextTick(() => {
this.$emit('page', heightToPage(this.$refs['bi-photo'].offsetHeight));
});
},
deep: true,
immediate: true
}
}
};
</script>
<style lang="scss" scoped>
.bi-photo {
page-break-before: always;
// page-break-after: always;
padding-bottom: 50px;
&_btn {
display: inline-block;
min-width: 42px;
height: 42px;
border: 1px solid #bac1ce;
border-radius: 4px;
vertical-align: top;
text-align: center;
line-height: 42px;
padding: 0 15px;
font-size: 16px;
font-weight: 500;
color: #6f7a91;
cursor: pointer;
position: relative;
&_group {
position: absolute;
right: 16px;
top: 50%;
margin-top: -21px;
z-index: 3;
&_item {
& + .bi-chart-title_btn_group_item {
margin-left: 8px;
}
}
}
}
}
.bi-title-photo-btn {
display: flex;
width: 320px;
justify-content: flex-end;
}
</style>
<template>
<div>
<el-button @click="openDialog" class="bi-photo_btn">
<img
src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/delete.svg"
alt=""
/>
选择图片
</el-button>
<el-dialog
title="选择图片"
:visible.sync="selectImgShow"
width="700px"
center
:before-close="handleClose"
>
<div class="select-img-main">
<div
class="select-img-item"
v-for="(item, index) in imgWallPageList"
:key="item.imageUrl + index"
>
<el-checkbox
:disabled="selectSum >= 50 && !imageUrlsMap.includes(item.imageUrl)"
class="select-box"
:value="imageUrlsMap.includes(item.imageUrl)"
@change="
e => {
selectChange(e, item);
}
"
></el-checkbox>
<img :src="item.imageUrl" />
</div>
</div>
<div style="margin: 10px">
<el-checkbox
:indeterminate="selectSum > 0 && selectSum < imgWallList.length"
:value="selectSum === imgWallList.length"
@change="selectAll"
>
全选
</el-checkbox>
<span>当前选中{{ selectSum }}</span>
<span style="color: red">(最大选取50张)</span>
</div>
<el-pagination
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next, jumper"
:total="imgWallList.length"
></el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleSave">保 存</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import mixin from '../../mixin/index';
import {
Dialog,
Button,
Checkbox,
CheckboxGroup,
Pagination,
Message
} from 'element-ui';
export default {
name: 'select-img',
mixins: [mixin],
props: {
// 已勾选数据 [url,url]
imageUrls: {
type: Array,
default() {
return [];
}
}
},
components: {
[Dialog.name]: Dialog,
[Button.name]: Button,
[CheckboxGroup.name]: CheckboxGroup,
[Checkbox.name]: Checkbox,
[Pagination.name]: Pagination
},
data() {
return {
selectImgShow: false,
selectedImageUrls: [],
currentPage: 1,
pageSize: 6,
imgWallList: []
};
},
methods: {
async openDialog() {
this.selectedImageUrls = JSON.parse(JSON.stringify(this.imageUrls));
this.selectImgShow = true;
const asyncData = await this.Bi.getTaskPicList();
this.imgWallList = asyncData.data.data.taskImages;
},
// 全选/取消全选
selectAll(e) {
if (e) {
// 全部选择
if (this.imgWallList.length > 50) {
// 超出50条弹出提示
Message.error('当前可选照片超过50张,已为您自动选择前50张照片');
this.selectedImageUrls = this.imgWallList.slice(0, 50);
} else {
this.selectedImageUrls = this.imgWallList;
}
} else {
// 取消全选
this.selectedImageUrls = [];
}
},
// 单选
selectChange(e, item) {
if (e) {
this.selectedImageUrls.push(item);
} else {
this.selectedImageUrls = this.selectedImageUrls.filter(
urls => urls.imageUrl !== item.imageUrl
);
}
},
handleClose() {
this.selectImgShow = false;
},
handleSave() {
if (this.selectSum <= 0) {
Message.error('至少选择一张图片!');
return;
}
this.$emit('handleSave', this.selectedImageUrls);
this.selectImgShow = false;
}
},
computed: {
// 模拟分页
imgWallPageList() {
return this.imgWallList.slice(
(this.currentPage - 1) * this.pageSize,
this.currentPage * this.pageSize
);
},
// 所选条数
selectSum() {
return this.selectedImageUrls.length;
},
imageUrlsMap() {
return this.selectedImageUrls.map(item => item.imageUrl);
}
},
created() {}
};
</script>
<style scoped lang="scss">
.bi-photo {
// page-break-before: always;
// page-break-after: always;
padding-bottom: 50px;
&_btn {
display: inline-block;
min-width: 42px;
height: 42px;
border: 1px solid #bac1ce;
border-radius: 4px;
vertical-align: top;
text-align: center;
line-height: 42px;
padding: 0 15px;
font-size: 16px;
font-weight: 500;
color: #6f7a91;
cursor: pointer;
position: relative;
&_group {
position: absolute;
right: 16px;
top: 50%;
margin-top: -21px;
z-index: 3;
&_item {
& + .bi-chart-title_btn_group_item {
margin-left: 8px;
}
}
}
}
}
.select-img-main {
display: flex;
flex-wrap: wrap;
.select-img-item {
border: 1px solid rgb(182, 185, 188);
margin: 4px;
position: relative;
.select-box {
position: absolute;
top: 15px;
right: 15px;
}
}
img {
width: 200px;
height: 150px;
}
}
</style>
<template>
<div>
<el-button @click="openDialog" class="bi-photo_btn">
<img
src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/delete.svg"
alt=""
/>
选择样式
</el-button>
<el-dialog
title="选择样式"
:visible.sync="selectStyleShow"
width="400px"
center
:before-close="handleClose"
>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="布局样式:">
<el-radio-group v-model="form.imageStyle">
<el-radio :label="1">流式布局</el-radio>
<el-radio :label="2">平铺布局</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="图片大小:">
<el-radio-group v-model="form.imageSize">
<el-radio :label="1">大图</el-radio>
<el-radio :label="2">中图</el-radio>
<el-radio :label="3">小图</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleSave">保 存</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { Dialog, Button, Radio, RadioGroup, Form, FormItem } from 'element-ui';
export default {
name: 'select-style',
props: {
layout: {
type: Object,
default() {
return {
imageStyle: 2,
imageSize: 2
};
}
}
},
components: {
[Form.name]: Form,
[FormItem.name]: FormItem,
[Dialog.name]: Dialog,
[Button.name]: Button,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio
},
data() {
return {
selectStyleShow: false,
form: {
imageStyle: 2,
imageSize: 2
}
};
},
methods: {
openDialog() {
this.selectStyleShow = true;
Object.assign(this.form, this.layout);
},
handleClose() {
this.selectStyleShow = false;
},
handleSave() {
this.$emit('handleSave', this.form);
this.selectStyleShow = false;
}
}
};
</script>
<style scoped lang="scss">
.bi-photo {
// page-break-before: always;
// page-break-after: always;
padding-bottom: 50px;
&_btn {
display: inline-block;
min-width: 42px;
height: 42px;
border: 1px solid #bac1ce;
border-radius: 4px;
vertical-align: top;
text-align: center;
line-height: 42px;
padding: 0 15px;
font-size: 16px;
font-weight: 500;
color: #6f7a91;
cursor: pointer;
position: relative;
&_group {
position: absolute;
right: 16px;
top: 50%;
margin-top: -21px;
z-index: 3;
&_item {
& + .bi-chart-title_btn_group_item {
margin-left: 8px;
}
}
}
}
}
</style>
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
* @Description: * @Description:
* @Author: jml * @Author: jml
* @Date: 2021-02-26 15:38:10 * @Date: 2021-02-26 15:38:10
* @LastEditors: Please set LastEditors * @LastEditTime: 2022-06-07 11:25:17
* @LastEditTime: 2022-04-20 13:26:04
--> -->
<template> <template>
<div class="xrk-components-bi bi" :class="{ 'bi-print': print }"> <div class="xrk-components-bi bi" :class="{ 'bi-print': print }">
...@@ -59,6 +58,7 @@ export default { ...@@ -59,6 +58,7 @@ export default {
cantEdit: [Number, String], cantEdit: [Number, String],
projectType: [Number, String], projectType: [Number, String],
from: [Number, String], from: [Number, String],
selectType: Number, // 44自定义-BI报告 45当期-BI报告 46累计-BI报告
getBaseInfo: { getBaseInfo: {
type: Function, type: Function,
default: () => {} default: () => {}
...@@ -86,6 +86,32 @@ export default { ...@@ -86,6 +86,32 @@ export default {
getTemplateList: { getTemplateList: {
type: Function, type: Function,
default: () => {} default: () => {}
},
// 当期BI-保持选择的图片
saveBiPicList: {
type: Function,
default: () => {}
},
// 当期BI-任务记录图片列表
getTaskPicList: {
type: Function,
default: () => {}
},
// 照片墙获取50张图片
getImageList: {
type: Function,
default: () => {}
},
// 获取是否含有照片题
getImageQuestionCount: {
type: Function,
default: () => {
return {
data: {
data: 0
}
};
}
} }
}, },
components: { components: {
......
...@@ -51,6 +51,12 @@ export default { ...@@ -51,6 +51,12 @@ export default {
resolve('load fail'); resolve('load fail');
}; };
}); });
},
preloadImgs(urls) {
if (!urls.length) {
return Promise.resolve();
}
return Promise.all(urls.map(url => this.preloadImg(url)));
} }
} }
}; };
...@@ -53,9 +53,28 @@ ...@@ -53,9 +53,28 @@
@sort="sort(arguments, 'singleChoiceMixin', hideSingleChoiceMixin)" @sort="sort(arguments, 'singleChoiceMixin', hideSingleChoiceMixin)"
@page="setPage(arguments, 'page3', 'page3Info')" @page="setPage(arguments, 'page3', 'page3Info')"
></BiSingleChoice> ></BiSingleChoice>
<!-- <BiSingleChoice
v-if="showSingleChoice.length > 0"
class="bi-block no-border"
:singleChoice="showSingleChoice"
:pageWrap="true"
@sort="sort(arguments, 'singleChoice', hideSingleChoice)"
@page="setPage(arguments, 'page4')"
>
<BiSingleChoiceInfo index="4" name="照片合集"></BiSingleChoiceInfo>
</BiSingleChoice> -->
<BiPhoto
v-if="!hideTaskImage"
class="bi-block"
ref="bi-photo"
name="照片合集"
v-model="taskImageInfo"
@page="setPage(arguments, 'page4')"
@finish="taskImageInfo.finish = true"
/>
<BiCoverEnd title="奇正藏药医学沙龙推广项目数据报告"></BiCoverEnd> <BiCoverEnd title="奇正藏药医学沙龙推广项目数据报告"></BiCoverEnd>
<BiOperate <BiOperate
:questionData="[...singleChoice, ...singleChoiceMixin]" :questionData="[...singleChoice, ...singleChoiceMixin, taskImageInfo]"
:saveInfo="saveInfo" :saveInfo="saveInfo"
:exportBi="exportBi" :exportBi="exportBi"
></BiOperate> ></BiOperate>
...@@ -70,8 +89,9 @@ import BiOverview from '../components/overview.vue'; ...@@ -70,8 +89,9 @@ import BiOverview from '../components/overview.vue';
import BiMission from '../components/mission.vue'; import BiMission from '../components/mission.vue';
import BiSingleChoice from '../components/singleChoice.vue'; import BiSingleChoice from '../components/singleChoice.vue';
import BiCoverEnd from '../components/cover-end.vue'; import BiCoverEnd from '../components/cover-end.vue';
import BiOperate from '../components/operate.vue'; import BiOperate from '../components/operate.vue';
import BiPhoto from '../components/photo-wall/index.vue';
import mixin, { printWidth } from '../mixin/index'; import mixin, { printWidth } from '../mixin/index';
/** /**
* dealSingleChoice、sort、setPage * dealSingleChoice、sort、setPage
...@@ -100,7 +120,8 @@ export default { ...@@ -100,7 +120,8 @@ export default {
BiSingleChoice, BiSingleChoice,
BiSingleChoiceInfo, BiSingleChoiceInfo,
BiCoverEnd, BiCoverEnd,
BiOperate BiOperate,
BiPhoto
}, },
data() { data() {
return { return {
...@@ -117,7 +138,25 @@ export default { ...@@ -117,7 +138,25 @@ export default {
projectName: '', projectName: '',
baseInfo: [], baseInfo: [],
textData: [], textData: [],
biInfo: {} biInfo: {},
taskImageInfo: {
title: {
name: '照片墙'
},
finish: false, // 图片是否渲染完成
has: false, // true有图片题,false无
isDelete: 0,
imageStyle: 2, //展示样式 1 流式 2平铺
imageSize: 2, //图片大小 1 大 2中 3小
imageUrls: [
// {
// id: 1,
// biInfoId: 123, //BI主键
// taskId: 123, //任务记录ID
// imageUrl: '图片地址'
// }
]
}
}; };
}, },
computed: { computed: {
...@@ -178,7 +217,18 @@ export default { ...@@ -178,7 +217,18 @@ export default {
}; };
}) })
] ]
} },
...(!this.hideTaskImage && [
{
name: '照片合集',
child: [
{
name: '照片合集',
page: 4
}
]
}
])
]; ];
}, },
showSingleChoice() { showSingleChoice() {
...@@ -192,9 +242,21 @@ export default { ...@@ -192,9 +242,21 @@ export default {
}, },
hideSingleChoiceMixin() { hideSingleChoiceMixin() {
return this.dealSingleChoice(this.singleChoiceMixin, true); return this.dealSingleChoice(this.singleChoiceMixin, true);
},
hideTaskImage() {
return !!this.taskImageInfo.isDelete || !this.taskImageInfo.has;
} }
}, },
methods: { methods: {
taskImageFinish(resolve) {
if (this.taskImageInfo.finish) {
resolve();
} else {
setTimeout(() => {
this.taskImageFinish(resolve);
}, 1000);
}
},
dealPos(dis) { dealPos(dis) {
return dis * (this.isPrint ? printWidth : this.baseFontSize); return dis * (this.isPrint ? printWidth : this.baseFontSize);
}, },
...@@ -452,26 +514,52 @@ export default { ...@@ -452,26 +514,52 @@ export default {
}); });
}, },
saveInfo() { saveInfo() {
const { biInfoId, styleConfigureId } = this.biInfo; return new Promise((resolve, reject) => {
const { content } = this.$refs['cover']; const { biInfoId, styleConfigureId } = this.biInfo;
return this.Bi.saveInfo({ const { content } = this.$refs['cover'];
biInfoId: biInfoId, if (!this.hideTaskImage && !this.taskImageInfo.imageUrls.length) {
commandType: 2, reject('照片墙:请删除或至少选择一张图片');
biStyleConfigureInfo: { }
aspEnterpriseNameWrite: content[2].name || '', //乙方封面名称 Promise.all([
aspNamePosition: JSON.stringify(content[2].pos), //乙方封面名称位置 this.Bi.saveInfo({
styleConfigId: styleConfigureId, //封面配置ID biInfoId: biInfoId,
coverTemplateId: this.coverId, //封面ID commandType: 2,
settlementTime: content[1].name || '', //封面时间 biStyleConfigureInfo: {
settlementTimePosition: JSON.stringify(content[1].pos), //封面时间位置 aspEnterpriseNameWrite: content[2].name || '', //乙方封面名称
title: content[0].name || '', //封面标题 aspNamePosition: JSON.stringify(content[2].pos), //乙方封面名称位置
titlePosition: JSON.stringify(content[0].pos) //标题位置 styleConfigId: styleConfigureId, //封面配置ID
}, coverTemplateId: this.coverId, //封面ID
makeSceneFixedDetailInfos: chartConfigToSetInfo(this.missionData), settlementTime: content[1].name || '', //封面时间
makeSceneStyleConfigureTopicDetailInfos: chartConfigToSetInfo( settlementTimePosition: JSON.stringify(content[1].pos), //封面时间位置
this.singleChoice title: content[0].name || '', //封面标题
), titlePosition: JSON.stringify(content[0].pos) //标题位置
makeSceneGroupDetails: chartConfigToSetInfo(this.singleChoiceMixin) },
makeSceneFixedDetailInfos: chartConfigToSetInfo(this.missionData),
makeSceneStyleConfigureTopicDetailInfos: chartConfigToSetInfo(
this.singleChoice
),
makeSceneGroupDetails: chartConfigToSetInfo(this.singleChoiceMixin)
}),
...(this.taskImageInfo.has && [
this.Bi.saveBiPicList({
biInfoId,
isDelete: this.taskImageInfo.isDelete,
...(!this.taskImageInfo.isDelete && {
biInfoImageJson: JSON.stringify(
this.taskImageInfo.imageUrls.map(item => {
return {
...item,
imageStyle: this.taskImageInfo.imageStyle,
imageSize: this.taskImageInfo.imageSize
};
})
)
})
})
])
]).then(() => {
resolve();
});
}); });
}, },
exportBi() { exportBi() {
...@@ -484,7 +572,9 @@ export default { ...@@ -484,7 +572,9 @@ export default {
this.Bi.getFixedInfo(), this.Bi.getFixedInfo(),
this.Bi.getTopicInfo(), this.Bi.getTopicInfo(),
this.Bi.getGroupInfo(), this.Bi.getGroupInfo(),
this.Bi.getTemplateList() this.Bi.getTemplateList(),
this.Bi.getImageList(),
this.Bi.getImageQuestionCount()
]) ])
.then( .then(
([ ([
...@@ -492,16 +582,33 @@ export default { ...@@ -492,16 +582,33 @@ export default {
fixedInfo, fixedInfo,
topicInfo, topicInfo,
topicMixinInfo, topicMixinInfo,
tempaletList = { data: { data: [] } } tempaletList = { data: { data: [] } },
taskImageInfo,
imageQuestionCount
]) => { ]) => {
const hasImageQuestion = imageQuestionCount.data.data > 0;
this.dealBaseInfo(baseInfo.data.data[0] || {}); this.dealBaseInfo(baseInfo.data.data[0] || {});
this.dealFixedInfo(fixedInfo.data.data || []); this.dealFixedInfo(fixedInfo.data.data || []);
this.dealChoice(topicInfo.data.data || []); this.dealChoice(topicInfo.data.data || []);
this.dealChoiceMixin(topicMixinInfo.data.data || []); this.dealChoiceMixin(topicMixinInfo.data.data || []);
this.coverList = tempaletList.data.data || []; this.coverList = tempaletList.data.data || [];
// taskImageInfo.data.data.imageUrls.forEach(item => {
// item.imageUrl = item.imageUrl.replace('https', 'http');
// });
Object.assign(this.taskImageInfo, taskImageInfo.data.data, {
has: hasImageQuestion,
finish: !hasImageQuestion || !!taskImageInfo.data.data.isDelete
});
this.$nextTick(async () => { this.$nextTick(async () => {
await this.preloadImg(this.coverUrl); await this.preloadImg(this.coverUrl);
window.status = '1'; await new Promise(resolve => {
this.taskImageFinish(resolve); // 提供给wkwebivewtopdf使用,页面处理完成,node不用
});
setTimeout(() => {
window.status = '1'; // 提供给wkwebivewtopdf使用,页面处理完成,node不用
console.log('done7');
}, 1000 * 5);
}); });
} }
) )
...@@ -513,8 +620,4 @@ export default { ...@@ -513,8 +620,4 @@ export default {
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
.bi-block {
// margin-top: 8px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!