Skip to content

Commit

Permalink
[feature]{GenerateForm}: 加入slot
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Mar 17, 2019
1 parent 7244efb commit 13c0c39
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 90 deletions.
7 changes: 4 additions & 3 deletions src/components/CrudTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ export default {
this.$refs.generateForm
.getData()
.then((data) => {
this.entity = data;
this.entity.id = newGuid(); // 赋值主键
this.entity = {
...data,
id: newGuid(),
};
this.axios({
url: `/${this.tableName}/add`,
method: 'post',
Expand All @@ -248,7 +250,6 @@ export default {
.getData()
.then((data) => {
this.entity = data;
// this.entity.id = this.id;
this.axios({
url: `/${this.tableName}/update`,
method: 'post',
Expand Down
45 changes: 30 additions & 15 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,41 @@
v-for="(col, colIndex) in item.columns"
:key="colIndex"
:span="col.span">
<template v-for="citem in col.list" >

<genetate-form-item
:key="citem.key"
:models.sync="models"
:rules="rules"
:widget="citem"
:disabled="disabled"/>
<template v-for="citem in col.list">
<el-form-item v-if="citem.type=='blank'"
:label="citem.name"
:prop="citem.model"
:key="citem.key">
<slot :name="citem.model"
:model="models"></slot>
</el-form-item>
<GenerateFormItem v-else
:key="citem.key"
:models.sync="models"
:remote="remote"
:rules="rules"
:widget="citem"
v-show="!item.hidden"></GenerateFormItem>
</template>
</el-col>
</el-row>
</template>
<template v-else-if="item.type === 'blank'">
<el-form-item :label="item.name"
:prop="item.model"
:key="item.key">
<slot :name="item.model"
:model="models"></slot>
</el-form-item>
</template>
<!-- 普通行布局方式 -->
<template v-else>
<genetate-form-item
:key="item.key"
:models.sync="models"
:rules="rules"
:widget="item"
:disabled="disabled"
/>
<GenerateFormItem :key="item.key"
:models.sync="models"
:rules="rules"
:widget="item"
:remote="remote"
v-show="!item.hidden"></GenerateFormItem>
</template>

</template>
Expand Down
150 changes: 78 additions & 72 deletions src/views/Archive/person_count2.vue
Original file line number Diff line number Diff line change
@@ -1,112 +1,118 @@
<template>


<div style="overflow:hidden">

<el-row :gutter="32">

<el-col :xs="8" :sm="8" :lg="8">
<el-card class="box-card widget-box no-padding">
<div slot="header" class="clearfix">
<span>江苏省地图</span>
</div>
<map-chart width="100%" id="chart5" height="800px"></map-chart>

</el-card>


</el-col>

<el-col :xs="16" :sm="16" :lg="16">

<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="24">
<lineChart :data="lineChartData" :date="chartData.Month" class="widget-box" height="400px" width="100%" id="chart0"
/>
</el-col>


</el-row>


<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="12">
<pieChart title="线索来源" :data="chartData.ClueSource" class="widget-box" width="100%" id="chart1"
/>
<el-row :gutter="32">
<el-col :xs="8" :sm="8" :lg="8">
<el-card class="box-card widget-box no-padding">
<div slot="header" class="clearfix">
<span>江苏省地图</span>
</div>
<map-chart width="100%" id="chart5" height="800px"></map-chart>
</el-card>
</el-col>

<el-col :xs="24" :sm="24" :lg="12">
<pieChart class="widget-box" title="职务违法犯罪" :data="chartData.FilingChartData" width="100%" id="chart2"
/>
<el-col :xs="16" :sm="16" :lg="16">
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="24">
<lineChart
:data="lineChartData"
:date="chartData.Month"
class="widget-box"
height="400px"
width="100%"
id="chart0"
/>
</el-col>
</el-row>

<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="12">
<pieChart
title="线索来源"
:data="chartData.ClueSource"
class="widget-box"
width="100%"
id="chart1"
/>
</el-col>

<el-col :xs="24" :sm="24" :lg="12">
<pieChart
class="widget-box"
title="职务违法犯罪"
:data="chartData.FilingChartData"
width="100%"
id="chart2"
/>
</el-col>
</el-row>

<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="12">
<pieChart
title="违反六大纪律"
:data="chartData.six"
class="widget-box"
width="100%"
id="chart3"
/>
</el-col>

<el-col :xs="24" :sm="24" :lg="12">
<pieChart
class="widget-box"
title="党纪处分"
:data="chartData.PartyPunish"
width="100%"
id="chart4"
/>
</el-col>
</el-row>
</el-col>


</el-row>


<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="12">
<pieChart title="违反六大纪律" :data="chartData.six" class="widget-box" width="100%" id="chart3"
/>
</el-col>

<el-col :xs="24" :sm="24" :lg="12">
<pieChart class="widget-box" title="党纪处分" :data="chartData.PartyPunish" width="100%" id="chart4"
/>
</el-col>


</el-row>
</el-col>
</el-row>


</div>
</template>

<script>
import chartData from '@/components/Charts/data/Charts_Fake'
import pieChart from '@/components/Charts/pieChart'
import lineChart from '@/components/Charts/lineChart'
import mapChart from '@/components/Charts/mapChart'
import chartData from '@/components/Charts/data/Charts_Fake';
import pieChart from '@/components/Charts/pieChart';
import lineChart from '@/components/Charts/lineChart';
import mapChart from '@/components/Charts/mapChart';
export default {
name: 'person_count2',
data() {
const lineChartData = [chartData.ClueData, chartData.FilingData]
const lineChartData = [chartData.ClueData, chartData.FilingData];
return {
chartData,
lineChartData,
}
},
methods: {
};
},
methods: {},
components: {
pieChart,
lineChart,
mapChart,
},
}
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
padding: 32px;
height:100%;
height: 100%;
background-color: #fff;
.chart-wrapper {
background: #fff;
padding: 16px 16px 0;
margin-bottom: 32px;
}
}
.widget-box{
border-radius: 8px!important;
.widget-box {
border-radius: 8px !important;
}
.el-main{
padding:0px 0px 0px 30px;
.el-main {
padding: 0px 0px 0px 30px;
}
</style>

0 comments on commit 13c0c39

Please sign in to comment.