yanzili 3 years ago
commit 06a90a548c

@ -6,57 +6,68 @@
*/ */
!--> !-->
<template> <template>
<el-select v-model="dictionary" placeholder="请选择" clearable @change="selectChange"> <el-select
<el-option v-for="item in dictionaryOptions" :key="item.id" :label="item.text" :value="item.id" /> v-model="dictionary"
placeholder="请选择"
clearable
@change="selectChange"
size="mini"
>
<el-option
v-for="item in dictionaryOptions"
:key="item.id"
:label="item.text"
:value="item.id"
/>
</el-select> </el-select>
</template> </template>
<script> <script>
import { getDictList } from '@/api/dict-data' // import { getDictList } from "@/api/dict-data"; //
export default { export default {
name: 'GetDictionary', name: "GetDictionary",
props: { props: {
dictKey: String, // code dictKey: String, // code
updataDict: String, // updataDict: String //
}, },
data() { data() {
return { return {
dictionary: '', // dictionary: "", //
dictionaryOptions: [], // dictionaryOptions: [] //
} };
}, },
watch: { watch: {
dictKey: { dictKey: {
immediate: true, immediate: true,
handler() { handler() {
this.getSystem() this.getSystem();
}, }
}, },
updataDict: { updataDict: {
immediate: true, immediate: true,
handler() { handler() {
this.dictionary = this.updataDict this.dictionary = this.updataDict;
}, }
}, }
}, },
created() { created() {
this.getSystem() this.getSystem();
}, },
mounted() { mounted() {
this.dictionary = this.updataDict this.dictionary = this.updataDict;
}, },
methods: { methods: {
// //
async getSystem() { async getSystem() {
const { code, data } = await getDictList(this.dictKey) const { code, data } = await getDictList(this.dictKey);
if (code != '200') return if (code != "200") return;
this.dictionaryOptions = data this.dictionaryOptions = data;
}, },
selectChange(val) { selectChange(val) {
this.$emit('input', val) this.$emit("input", val);
}, }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -1,6 +1,7 @@
import axios from 'axios' import axios from 'axios'
import { Message, MessageBox } from 'element-ui' import { Message, MessageBox } from 'element-ui'
import store from '../store' import store from '../store'
import { delItem } from "@/utils/storage"
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
@ -38,11 +39,9 @@ service.interceptors.response.use(
type: 'warning' type: 'warning'
} }
).then(() => { ).then(() => {
// store.dispatch('FedLogOut').then(() => { delItem('token')
// // location.reload() // 为了重新实例化vue-router对象 避免bug sessionStorage.clear()
// window.location.href = "/"; localStorage.clear()
// })
location.reload();
window.location.href = "/"; window.location.href = "/";
}) })
} }

@ -1,6 +1,11 @@
<template> <template>
<div> <div>
<el-button type="primary" icon="el-icon-plus" plain @click="handleAddClick" <el-button
type="primary"
size="mini"
icon="el-icon-plus"
plain
@click="handleAddClick"
>新增</el-button >新增</el-button
> >
<el-table :data="formData" style="width: 100%"> <el-table :data="formData" style="width: 100%">
@ -43,19 +48,23 @@
v-model="colorValue" v-model="colorValue"
style="width: 200px" style="width: 200px"
placeholder="请输入颜色" placeholder="请输入颜色"
size="mini"
> >
<template slot="append"> <template slot="append">
<el-color-picker <el-color-picker
v-model="colorValue" v-model="colorValue"
:predefine="predefineColors" :predefine="predefineColors"
size="mini"
/> />
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button size="mini" @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleSaveClick"> </el-button> <el-button size="mini" type="primary" @click="handleSaveClick"
> </el-button
>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>

@ -1,193 +1,213 @@
<template> <template>
<div> <div>
<el-form label-width="80px" <el-form label-width="80px" label-position="left">
label-position="left">
<el-form-item label="数据集"> <el-form-item label="数据集">
<el-select v-model="dataSetValue" <el-select
clearable size="mini"
placeholder="请选择" v-model="dataSetValue"
@change="selectDataSet"> clearable
<el-option v-for="item in dataSet" placeholder="请选择"
:key="item.code" @change="selectDataSet"
:label="item.setName" >
:value="item.id" /> <el-option
v-for="item in dataSet"
:key="item.code"
:label="item.setName"
:value="item.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-for="(item, index) in userNameList" <el-form-item
:key="index" v-for="(item, index) in userNameList"
:label="item.paramName"> :key="index"
<el-input v-model="item.sampleItem" /> :label="item.paramName"
>
<el-input v-model="item.sampleItem" size="mini" />
</el-form-item> </el-form-item>
<el-form-item v-for="item in setParamList" <el-form-item v-for="item in setParamList" :key="item" :label="item">
:key="item" <Dictionary
:label="item"> v-model="params"
<Dictionary v-model="params" :dict-key="'CHART_PROPERTIES'"
:dict-key="'CHART_PROPERTIES'" @input="selectParams($event, item)"
@input="selectParams($event, item)" /> />
</el-form-item> </el-form-item>
<el-button style="width: 100%" <el-button
type="primary" style="width: 100%"
plain type="primary"
@click="saveDataBtn">刷新</el-button> plain
size="mini"
@click="saveDataBtn"
>刷新</el-button
>
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
import { queryAllDataSet, detailBysetId, getData } from '@/api/bigscreen' import { queryAllDataSet, detailBysetId, getData } from "@/api/bigscreen";
import Dictionary from '@/components/Dictionary/index' import Dictionary from "@/components/Dictionary/index";
export default { export default {
name: 'DynamicComponents', name: "DynamicComponents",
components: { components: {
Dictionary, Dictionary
}, },
model: { model: {
prop: 'formData', prop: "formData",
event: 'input', event: "input"
}, },
props: { props: {
chartType: String, chartType: String,
props: ['formData'], props: ["formData"]
}, },
data () { data() {
return { return {
dataSetValue: '', dataSetValue: "",
dataSet: [], // dataSet: [], //
userNameList: [], // userNameList: [], //
setParamList: [], // setParamList: [], //
params: {}, params: {},
chartProperties: {}, chartProperties: {}
} };
}, },
computed: { computed: {
setCode () { setCode() {
let code = '' let code = "";
this.dataSet.forEach((el) => { this.dataSet.forEach(el => {
if (el.id == this.dataSetValue) { if (el.id == this.dataSetValue) {
code = el.setCode code = el.setCode;
} }
}) });
return code return code;
}, }
}, },
mounted () { mounted() {
this.loadDataSet() this.loadDataSet();
}, },
methods: { methods: {
async loadDataSet () { async loadDataSet() {
const { code, data } = await queryAllDataSet() const { code, data } = await queryAllDataSet();
this.dataSet = data this.dataSet = data;
if (code != '200') return if (code != "200") return;
}, },
async selectDataSet () { async selectDataSet() {
const { code, data } = await detailBysetId(this.dataSetValue) const { code, data } = await detailBysetId(this.dataSetValue);
this.userNameList = data.dataSetParamDtoList this.userNameList = data.dataSetParamDtoList;
this.setParamList = data.setParamList this.setParamList = data.setParamList;
if (code != '200') return if (code != "200") return;
}, },
async saveDataBtn () { async saveDataBtn() {
const contextData = {} const contextData = {};
for (let i = 0; i < this.userNameList.length; i++) { for (let i = 0; i < this.userNameList.length; i++) {
contextData[this.userNameList[i].paramName] = this.userNameList[i].sampleItem contextData[this.userNameList[i].paramName] = this.userNameList[
i
].sampleItem;
} }
const params = { const params = {
chartType: this.chartType, chartType: this.chartType,
setCode: this.setCode, setCode: this.setCode,
chartProperties: this.chartProperties, chartProperties: this.chartProperties,
contextData, contextData
} };
const { code, data } = await getData(params) const { code, data } = await getData(params);
const analysisData = this.analysisChartsData(data) const analysisData = this.analysisChartsData(data);
console.log(analysisData) console.log(analysisData);
this.$emit('input', analysisData) this.$emit("input", analysisData);
if (code != '200') return if (code != "200") return;
}, },
selectParams (val, key) { selectParams(val, key) {
this.chartProperties[key] = val this.chartProperties[key] = val;
}, },
// //
analysisChartsData (data) { analysisChartsData(data) {
// widget-barchart 线widget-linechart 线 widget-barlinechart 线widget-piechart widget-hollow-piechart // widget-barchart 线widget-linechart 线 widget-barlinechart 线widget-piechart widget-hollow-piechart
// widget-funnel widget-gauge // widget-funnel widget-gauge
const chartType = this.chartType const chartType = this.chartType;
if (chartType == 'widget-barchart' || chartType == 'widget-linechart' || chartType == 'widget-barlinechart') { if (
return this.barOrLineChartFn(data) chartType == "widget-barchart" ||
} else if (chartType == 'widget-piechart' || chartType == 'widget-hollow-piechart' || chartType == 'widget-funnel') { chartType == "widget-linechart" ||
return this.piechartFn(data) chartType == "widget-barlinechart"
} else if (chartType == 'widget-gauge') { ) {
return this.gaugeFn(data) return this.barOrLineChartFn(data);
} else if (
chartType == "widget-piechart" ||
chartType == "widget-hollow-piechart" ||
chartType == "widget-funnel"
) {
return this.piechartFn(data);
} else if (chartType == "widget-gauge") {
return this.gaugeFn(data);
} else { } else {
} }
}, },
// 线 // 线
barOrLineChartFn (data) { barOrLineChartFn(data) {
const ananysicData = {} const ananysicData = {};
const xAxisList = [] const xAxisList = [];
const series = [] const series = [];
for (const key in this.chartProperties) { for (const key in this.chartProperties) {
const obj = {} const obj = {};
const seriesData = [] const seriesData = [];
const value = this.chartProperties[key] const value = this.chartProperties[key];
obj['type'] = value obj["type"] = value;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (value.startsWith('xAxis')) { if (value.startsWith("xAxis")) {
// x // x
xAxisList[i] = data[i][key] xAxisList[i] = data[i][key];
} else { } else {
// series // series
seriesData[i] = data[i][key] seriesData[i] = data[i][key];
} }
} }
obj['data'] = seriesData obj["data"] = seriesData;
if (!obj['type'].startsWith('xAxis')) { if (!obj["type"].startsWith("xAxis")) {
series.push(obj) series.push(obj);
} }
} }
ananysicData['xAxis'] = xAxisList ananysicData["xAxis"] = xAxisList;
ananysicData['series'] = series ananysicData["series"] = series;
// console.log(ananysicData, '') // console.log(ananysicData, '')
return ananysicData return ananysicData;
}, },
// //
piechartFn (data) { piechartFn(data) {
const ananysicData = [] const ananysicData = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const obj = {} const obj = {};
for (const key in this.chartProperties) { for (const key in this.chartProperties) {
const value = this.chartProperties[key] const value = this.chartProperties[key];
if (value === 'name') { if (value === "name") {
obj['name'] = data[i][key] obj["name"] = data[i][key];
} else { } else {
obj['value'] = data[i][key] obj["value"] = data[i][key];
} }
} }
ananysicData.push(obj) ananysicData.push(obj);
} }
// console.log(ananysicData, '') // console.log(ananysicData, '')
return ananysicData return ananysicData;
}, },
gaugeFn (data) { gaugeFn(data) {
const ananysicData = [] const ananysicData = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const obj = {} const obj = {};
for (const key in this.chartProperties) { for (const key in this.chartProperties) {
const value = this.chartProperties[key] const value = this.chartProperties[key];
if (value === 'name') { if (value === "name") {
obj['name'] = data[i][key] obj["name"] = data[i][key];
} else { } else {
obj['value'] = data[i][key] obj["value"] = data[i][key];
} }
} }
if (!obj['unit']) { if (!obj["unit"]) {
obj['unit'] = '%' obj["unit"] = "%";
} }
ananysicData.push(obj) ananysicData.push(obj);
} }
// console.log(ananysicData, '') // console.log(ananysicData, '')
return ananysicData[0] return ananysicData[0];
}, }
}, }
} };
</script> </script>
<style lang="sass" scoped></style> <style lang="sass" scoped></style>

@ -104,6 +104,7 @@
<el-button <el-button
v-if="item.type == 'el-button'" v-if="item.type == 'el-button'"
type="primary" type="primary"
size="mini"
plain plain
@click="addStaticData" @click="addStaticData"
>编辑</el-button >编辑</el-button
@ -311,12 +312,6 @@ export default {
this.setDefaultValue(); this.setDefaultValue();
this.isShowData(); this.isShowData();
} }
// formData: {
// handler () {
// this.$emit('onChanged', this.formData)
// },
// deep: true,
// },
}, },
created() { created() {
this.isShowData(); this.isShowData();

@ -34,6 +34,8 @@
v-for="(item, index) in layerWidget" v-for="(item, index) in layerWidget"
:key="index" :key="index"
class="tools-item" class="tools-item"
:class="widgetIndex == index ? 'is-active' : ''"
@click="layerClick(index)"
> >
<span class="tools-item-icon"> <span class="tools-item-icon">
<i class="iconfont" :class="item.icon"></i> <i class="iconfont" :class="item.icon"></i>
@ -123,7 +125,7 @@
:bigscreen="{ bigscreenWidth, bigscreenHeight }" :bigscreen="{ bigscreenWidth, bigscreenHeight }"
@onActivated="setOptionsOnClickWidget" @onActivated="setOptionsOnClickWidget"
@contextmenu.prevent.native="rightClick($event, index)" @contextmenu.prevent.native="rightClick($event, index)"
@click.prevent.native="widgetsClick(index)" @mousedown.prevent.native="widgetsClick(index)"
/> />
</div> </div>
</vue-ruler-tool> </vue-ruler-tool>
@ -197,6 +199,7 @@ export default {
}, },
data() { data() {
return { return {
layerWidget: [],
widgetTools: widgetTools, // js widgetTools: widgetTools, // js
widthLeftForTools: 200, // widthLeftForTools: 200, //
widthLeftForToolsHideButton: 15, // widthLeftForToolsHideButton: 15, //
@ -292,13 +295,14 @@ export default {
}, },
bigscreenHeightInWorkbench() { bigscreenHeightInWorkbench() {
return this.getPXUnderScale(this.bigscreenHeight); return this.getPXUnderScale(this.bigscreenHeight);
}, }
layerWidget() { },
const layerWidgetArr = []; watch: {
for (let i = 0; i < this.widgets.length; i++) { widgets: {
layerWidgetArr.push(getToolByCode(this.widgets[i].type)); handler(val) {
} this.handlerLayerWidget(val);
return layerWidgetArr; },
deep: true
} }
}, },
mounted() { mounted() {
@ -310,6 +314,21 @@ export default {
this.widgets = []; this.widgets = [];
}, },
methods: { methods: {
handlerLayerWidget(val) {
const layerWidgetArr = [];
for (let i = 0; i < val.length; i++) {
const obj = {};
obj.icon = getToolByCode(val[i].type).icon;
const options = val[i].options["setup"];
options.forEach(el => {
if (el.name == "layerName") {
obj.label = el.value;
}
});
layerWidgetArr.push(obj);
}
this.layerWidget = layerWidgetArr;
},
async initEchartData() { async initEchartData() {
const reportCode = this.$route.query.reportCode; const reportCode = this.$route.query.reportCode;
const { code, data } = await detailDashboard(reportCode); const { code, data } = await detailDashboard(reportCode);
@ -512,7 +531,10 @@ export default {
} }
return widgetJson; return widgetJson;
}, },
layerClick(index) {
this.widgetIndex = index;
this.widgetsClick(index);
},
// //
setOptionsOnClickScreen() { setOptionsOnClickScreen() {
this.screenCode = "screen"; this.screenCode = "screen";
@ -523,11 +545,15 @@ export default {
// //
setOptionsOnClickWidget(obj) { setOptionsOnClickWidget(obj) {
this.screenCode = "";
if (typeof obj == "number") {
this.widgetOptions = this.deepClone(this.widgets[obj]["options"]);
return;
}
if (obj.index < 0 || obj.index >= this.widgets.length) { if (obj.index < 0 || obj.index >= this.widgets.length) {
return; return;
} }
this.widgetIndex = obj.index; this.widgetIndex = obj.index;
this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]);
this.widgets[obj.index].value.position = obj; this.widgets[obj.index].value.position = obj;
this.widgets[obj.index].options.position.forEach(el => { this.widgets[obj.index].options.position.forEach(el => {
for (const key in obj) { for (const key in obj) {
@ -536,7 +562,7 @@ export default {
} }
} }
}); });
console.log(this.widgets); this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]);
}, },
widgetsClick(index) { widgetsClick(index) {
const draggableArr = this.$refs.widgets; const draggableArr = this.$refs.widgets;
@ -547,9 +573,9 @@ export default {
this.$refs.widgets[i].$refs.draggable.setActive(false); this.$refs.widgets[i].$refs.draggable.setActive(false);
} }
} }
this.setOptionsOnClickWidget(index);
}, },
handleMouseDown() { handleMouseDown() {
console.log(1);
const draggableArr = this.$refs.widgets; const draggableArr = this.$refs.widgets;
for (let i = 0; i < draggableArr.length; i++) { for (let i = 0; i < draggableArr.length; i++) {
this.$refs.widgets[i].$refs.draggable.setActive(false); this.$refs.widgets[i].$refs.draggable.setActive(false);
@ -557,15 +583,6 @@ export default {
}, },
// //
widgetValueChanged(key, val) { widgetValueChanged(key, val) {
/* this.widgets this.widgetIndex value
widgets: [{
type: 'widget-text',
value: {
setup:{},
data: {},
position: {}
}
}]*/
if (this.screenCode == "screen") { if (this.screenCode == "screen") {
this.dashboard = this.deepClone(val); this.dashboard = this.deepClone(val);
} }
@ -593,7 +610,6 @@ export default {
}, },
deletelayer() { deletelayer() {
this.widgets.splice(this.rightClickIndex, 1); this.widgets.splice(this.rightClickIndex, 1);
// console.log(this.widgets);
}, },
setDefaultValue(options, val) { setDefaultValue(options, val) {
for (let i = 0; i < options.length; i++) { for (let i = 0; i < options.length; i++) {
@ -624,6 +640,10 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.is-active {
background: #409eff !important;
color: #373d41 !important;
}
.layout { .layout {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;

@ -1506,14 +1506,6 @@ const widgetTools = [
placeholder: '', placeholder: '',
value: '柱状图', value: '柱状图',
}, },
{
type: 'el-switch',
label: '竖展示',
name: 'verticalShow',
required: false,
placeholder: '',
value: false,
},
{ {
type: 'vue-color', type: 'vue-color',
label: '背景颜色', label: '背景颜色',
@ -1523,35 +1515,6 @@ const widgetTools = [
value: '' value: ''
}, },
[ [
// {
// name: '柱体设置',
// list: [
// {
// type: 'el-slider',
// label: '最大宽度',
// name: 'maxWidth',
// required: false,
// placeholder: '',
// value: 10,
// },
// {
// type: 'el-slider',
// label: '圆角',
// name: 'radius',
// require: false,
// placeholder: '',
// value: 5,
// },
// {
// type: 'el-slider',
// label: '最小高度',
// name: 'minHeight',
// require: false,
// placeholder: '',
// value: 0,
// },
// ],
// },
{ {
name: '标题设置', name: '标题设置',
list: [ list: [
@ -1654,325 +1617,200 @@ const widgetTools = [
}, },
], ],
}, },
// { {
// name: 'X轴设置', name: 'X轴设置',
// list: [ list: [
// { {
// type: 'el-input-text', type: 'el-input-text',
// label: '名称', label: '名称',
// name: 'xName', name: 'xName',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '' value: ''
// }, },
// { {
// type: 'el-switch', type: 'el-switch',
// label: '显示', label: '显示',
// name: 'hideX', name: 'hideX',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: true, value: true,
// }, },
// { {
// type: 'vue-color', type: 'vue-color',
// label: '坐标名颜色', label: '坐标名颜色',
// name: 'xNameColor', name: 'xNameColor',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '#fff' value: '#fff'
// }, },
// { {
// type: 'el-input-number', type: 'el-input-number',
// label: '字体大小', label: '字体大小',
// name: 'xNameFontSize', name: 'xNameFontSize',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: 12 value: 12
// }, },
// { {
// type: 'el-slider', type: 'el-slider',
// label: '文字角度', label: '文字角度',
// name: 'textAngle', name: 'textAngle',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: 0 value: 0
// }, },
// { {
// type: 'el-input-number', type: 'el-input-number',
// label: '文字间隔', label: '文字间隔',
// name: 'textInterval', name: 'textInterval',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '' value: ''
// }, },
// { {
// type: 'el-switch', type: 'el-switch',
// label: '轴反转', label: '轴反转',
// name: 'reversalX', name: 'reversalX',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '' value: ''
// }, },
// { {
// type: 'vue-color', type: 'vue-color',
// label: '颜色', label: '颜色',
// name: 'Xcolor', name: 'Xcolor',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '#fff', value: '#fff',
// }, },
// { {
// type: 'el-input-number', type: 'el-input-number',
// label: '字号', label: '字号',
// name: 'fontSizeX', name: 'fontSizeX',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: 12, value: 12,
// }, },
// ], ],
// }, },
// { {
// name: 'Y轴设置', name: 'Y轴设置',
// list: [ list: [
// { {
// type: 'el-input-text', type: 'el-input-text',
// label: '名称', label: '名称',
// name: 'textNameY', name: 'textNameY',
// require: false, require: false,
// placeholder: '', placeholder: '',
// value: '' value: ''
// }, },
// { {
// type: 'el-switch', type: 'el-switch',
// label: '显示', label: '显示',
// name: 'isShowY', name: 'isShowY',
// require: false, require: false,
// placeholder: '', placeholder: '',
// value: true, value: true,
// }, },
// { {
// type: 'vue-color', type: 'vue-color',
// label: '坐标名颜色', label: '坐标名颜色',
// name: 'NameColorY', name: 'NameColorY',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '#fff', value: '#fff',
// }, },
// { {
// type: 'el-input-number', type: 'el-input-number',
// label: '字体大小', label: '字体大小',
// name: 'NameFontSizeY', name: 'NameFontSizeY',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: 12, value: 12,
// }, },
// { {
// type: 'el-switch', type: 'el-switch',
// label: '轴反转', label: '轴反转',
// name: 'reversalY', name: 'reversalY',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: false value: false
// }, },
// { {
// type: 'vue-color', type: 'vue-color',
// label: '颜色', label: '颜色',
// name: 'colorY', name: 'colorY',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: '#fff', value: '#fff',
// }, },
// { {
// type: 'el-input-number', type: 'el-input-number',
// label: '字号', label: '字号',
// name: 'fontSizeY', name: 'fontSizeY',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: 12, value: 12,
// }, },
// ], ],
// }, },
// { {
// name: '数值设定', name: '坐标轴边距设置',
// list: [ list: [
// { {
// type: 'el-switch', type: 'el-slider',
// label: '显示', label: '左边距(像素)',
// name: 'isShow', name: 'marginLeft',
// required: false, required: false,
// placeholder: '', placeholder: '',
// value: false value: 10,
// }, }, {
// { type: 'el-slider',
// type: 'el-input-number', label: '顶边距(像素)',
// label: '字体大小', name: 'marginTop',
// name: 'fontSize', required: false,
// required: false, placeholder: '',
// placeholder: '', value: 50,
// value: 14 }, {
// }, type: 'el-slider',
// { label: '右边距(像素)',
// type: 'vue-color', name: 'marginRight',
// label: '字体颜色', required: false,
// name: 'subTextColor', placeholder: '',
// required: false, value: 40,
// placeholder: '', }, {
// value: '#fff' type: 'el-slider',
// }, label: '底边距(像素)',
// { name: 'marginBottom',
// type: 'el-select', required: false,
// label: '字体粗细', placeholder: '',
// name: 'fontWeight', value: 10,
// required: false, },
// placeholder: '', ],
// selectOptions: [ },
// { code: 'normal', name: '正常' }, {
// { code: 'bold', name: '粗体' }, name: '渐变色',
// { code: 'bolder', name: '特粗体' }, list: [
// { code: 'lighter', name: '细体' } {
// ], type: 'vue-color',
// value: 'normal' label: '0%处',
// }, name: 'barStart',
// ], required: false,
// }, placeholder: '',
// { value: '#00F4FFFF'
// name: '提示语设置', },
// list: [ {
// { type: 'vue-color',
// type: 'el-input-number', label: '100%处',
// label: '字体大小', name: 'barEnd',
// name: 'fontSize', required: false,
// required: false, placeholder: '',
// placeholder: '', value: '#004DA7FF'
// }, },
// {
// type: 'vue-color', ],
// label: '字体颜色', },
// name: 'lineColor',
// required: false,
// placeholder: '',
// },
// ],
// },
// {
// name: '坐标轴边距设置',
// list: [
// {
// type: 'el-slider',
// label: '左边距(像素)',
// name: 'marginLeft',
// required: false,
// placeholder: '',
// value: 10,
// }, {
// type: 'el-slider',
// label: '顶边距(像素)',
// name: 'marginTop',
// required: false,
// placeholder: '',
// value: 50,
// }, {
// type: 'el-slider',
// label: '右边距(像素)',
// name: 'marginRight',
// required: false,
// placeholder: '',
// value: 40,
// }, {
// type: 'el-slider',
// label: '底边距(像素)',
// name: 'marginBottom',
// required: false,
// placeholder: '',
// value: 10,
// },
// ],
// },
// {
// name: '图例操作',
// list: [
// {
// type: 'el-switch',
// label: '图例',
// name: 'isShowLegend',
// required: false,
// placeholder: '',
// value: true,
// },
// {
// type: 'vue-color',
// label: '字体颜色',
// name: 'lengedColor',
// required: false,
// placeholder: '',
// value: '#fff',
// },
// {
// type: 'el-input-number',
// label: '字体大小',
// name: 'lengedFontSize',
// required: false,
// placeholder: '',
// value: 16,
// },
// {
// type: 'el-input-number',
// label: '图例宽度',
// name: 'lengedWidth',
// required: false,
// placeholder: '',
// value: 15,
// },
// {
// type: 'el-select',
// label: '横向位置',
// name: 'lateralPosition',
// required: false,
// placeholder: '',
// selectOptions: [
// { code: 'left', name: '左对齐' },
// { code: 'right', name: '右对齐' },
// ],
// value: ''
// },
// {
// type: 'el-select',
// label: '纵向位置',
// name: 'longitudinalPosition',
// required: false,
// placeholder: '',
// selectOptions: [
// { code: 'top', name: '顶部' },
// { code: 'bottom', name: '底部' },
// ],
// value: ''
// },
// {
// type: 'el-select',
// label: '布局前置',
// name: 'layoutFront',
// required: false,
// placeholder: '',
// selectOptions: [
// { code: 'vertical', name: '竖排' },
// { code: 'horizontal', name: '横排' },
// ],
// value: ''
// },
// ],
// },
// {
// name: '自定义配色',
// list: [
// {
// type: 'customColor',
// label: '',
// name: 'customColor',
// required: false,
// value: [{ color: '#ff7f50' }, { color: '#87cefa' }, { color: '#da70d6' }, { color: '#32cd32' }, { color: '#6495ed' }],
// },
// ],
// },
], ],
], ],
// 数据 // 数据

@ -16,7 +16,7 @@
data() { data() {
return { return {
options: { options: {
backgroundColor: '#00265f', // backgroundColor: '#00265f',
"title": { "title": {
"text": "政策补贴额度", "text": "政策补贴额度",
x: "center", x: "center",
@ -176,13 +176,13 @@
// options // options
editorOptions() { editorOptions() {
this.setOptionsTitle() this.setOptionsTitle()
// this.setOptionsX() this.setOptionsX()
// this.setOptionsY() this.setOptionsY()
// this.setOptionsTop() // this.setOptionsTop()
// this.setOptionsTooltip() // this.setOptionsTooltip()
// this.setOptionsMargin() this.setOptionsMargin()
// this.setOptionsLegend() // this.setOptionsLegend()
// this.setOptionsColor() this.setOptionsColor()
this.setOptionsData() this.setOptionsData()
}, },
// //
@ -331,29 +331,17 @@
} }
legend.itemWidth = optionsCollapse.lengedWidth legend.itemWidth = optionsCollapse.lengedWidth
}, },
// //
setOptionsColor() { setOptionsColor() {
const optionsCollapse = this.optionsSetup const optionsCollapse = this.optionsSetup
const customColor = optionsCollapse.customColor const barStart = {}
if (!customColor) return barStart['offset'] = 0
const arrColor = [] barStart['color'] = optionsCollapse.barStart
for (let i = 0; i < customColor.length; i++) { const barEnd = {}
arrColor.push(customColor[i].color) barStart['offset'] = 1
} barStart['color'] = optionsCollapse.barEnd
const itemStyle = { // this.options.series[0].itemStyle.normal.color = new echarts.graphic.LinearGradient(0, 0, 0, 1,[ barStart, barEnd], false)
normal: {
color: (params) => {
return arrColor[params.dataIndex]
},
barBorderRadius: optionsCollapse.radius,
},
}
for (const key in this.options.series) {
if (this.options.series[key].type == 'bar') {
this.options.series[key].itemStyle = itemStyle
}
}
this.options = Object.assign({}, this.options)
}, },
// //
setOptionsData() { setOptionsData() {
@ -419,8 +407,6 @@
.echarts { .echarts {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-width: 200px;
min-height: 200px;
overflow: hidden; overflow: hidden;
} }
</style> </style>

@ -22,17 +22,14 @@ export default {
toolbox: { toolbox: {
show: true, show: true,
feature: { feature: {
mark: {show: true}, mark: {show: true}
dataView: {show: true, readOnly: false},
restore: {show: true},
saveAsImage: {show: true}
} }
}, },
series: [ series: [
{ {
name: '面积模式', name: '面积模式',
type: 'pie', type: 'pie',
radius: [50, 250], radius: ["10%", "50%"],
center: ['50%', '50%'], center: ['50%', '50%'],
roseType: 'area', roseType: 'area',
itemStyle: { itemStyle: {
@ -335,8 +332,6 @@ export default {
.echarts { .echarts {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-width: 200px;
min-height: 200px;
overflow: hidden; overflow: hidden;
} }
</style> </style>

@ -103,9 +103,7 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
handleFocus({ index, left, top, width, height }) { handleFocus({ index, left, top, width, height }) {},
// console.log(index, left, top, width, height);
},
handleBlur({ index, left, top, width, height }) { handleBlur({ index, left, top, width, height }) {
this.$emit("onActivated", { index, left, top, width, height }); this.$emit("onActivated", { index, left, top, width, height });
this.$refs.draggable.setActive(true); this.$refs.draggable.setActive(true);

Loading…
Cancel
Save